Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter JackNUMBER

    (@jacknumber)

    And the plugin detect itself the pb : http://i.imgur.com/F8hFrqB.jpg

    Plugin Contributor pingram

    (@pingram3541)

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

    Thread Starter JackNUMBER

    (@jacknumber)

    I stopped use this plugin.

    Plugin Contributor pingram

    (@pingram3541)

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

    replace:
    fwrite($fh, $css);

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

    Plugin Contributor pingram

    (@pingram3541)

    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

    (@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.