Replacing 'eval'

Home Forums WPAlchemy Replacing 'eval'

This topic contains 2 replies, has 2 voices, and was last updated by  denoizzed 1 year, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2500

    denoizzed
    Participant

    Hello,

    is there a way to replace eval function in MediaAccess.php (line 375) with another one:

    data = eval("(" + (data.indexOf('{') < 0 ? '{' + data + '}' : data) + ")");

    since it fails in Theme-Check plugin so I can’t proceed with submitting the theme.

    Thanks!

    • This topic was modified 1 year, 7 months ago by  denoizzed.
    #2502

    Dimas
    Key Master

    I will see what i can do for it .. but usually i never use eval unless i absolutely have to.

    #2503

    denoizzed
    Participant

    Hey Dimas,

    replacing this line with


    if( data.indexOf('{') < 0 ){

    data ='{' + data + '}';

    }

    data=data.replace('"',"'");

    data=data.replace('{','{\"');

    data=data.replace('}','\"}');

    data=data.replace(':','\":\"');

    data=data.replace("'","");

    data = jQuery.parseJSON(data);

    seems to do the trick.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.