Support » Plugin: WP Live CSS Editor » Backslahes added > CSS broken

Viewing 6 replies - 1 through 6 (of 6 total)
  • And the plugin detect itself the pb :

    Plugin Author Philip Ingram


    Yep, all single and double quotes are escaped with backslash upon save rendering css invalid.

    I stopped use this plugin.

    Plugin Author Philip Ingram


    This can be fixed, open up wp-live-css-editor.php and on line 117

    fwrite($fh, $css);

    fwrite($fh, str_replace('\\\'', '\'', $css));

    Plugin Author Philip Ingram


    actually, I didn’t think too far ahead on this because I almost exclusively use single quotes, but we also need to take care of the double quotes too, so let’s make this a little more intuitive with arrays that can be easily modified later to add more rules if discovered.

    First let’s find what needs to be fixed and find the escaped quotes, first the single, then the double quotes.
    $search = array('\\\'', '\"');

    Then let’s define how we want to replace them, in the same order we found them.
    $replace = array('\'', '"');

    Now we apply it against $css, simply add the 3 lines just above the fwrite line.

    $search = array('\\\'', '\"'); //find escaped quotes
    $replace = array('\'', '"'); //unescaped replacements
    $css = str_replace($search, $replace, $css); //apply replacements
    fwrite($fh, $css); //write to file

    Plugin Author funlab


    I just uploaded a fix on both trunk and 13.09 tag.
    It’s replacing line 86 of wp-live-css-editor.php:

    $css = $_POST['css'];

    with this:

    if (get_magic_quotes_gpc()) {
    $css = stripslashes($_POST[‘css’]);
    } else {
    $css = $_POST[‘css’];

    So far it’s working on wp 3.6 in my server without needing the replace functions. But let us know if it breaks !

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Backslahes added > CSS broken’ is closed to new replies.