WP Live CSS Editor
Backslahes added > CSS broken (7 posts)

  1. JackNUMBER
    Posted 3 years ago #

    Hi !
    Thanks for your plugin, very usefull!

    I check the CSS after Saving with your plugin some backslahes were added before quotes and doublequotes. See below : http://i.imgur.com/AeLcH66.png
    The file seems working on the server but breaked my notepad (ST2).

    Can you fix it or have any solution? Thanks :)


  2. JackNUMBER
    Posted 3 years ago #

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

  3. Philip Ingram
    Plugin Author

    Posted 3 years ago #

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

  4. JackNUMBER
    Posted 3 years ago #

    I stopped use this plugin.

  5. Philip Ingram
    Plugin Author

    Posted 3 years ago #

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

    fwrite($fh, $css);

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

  6. Philip Ingram
    Plugin Author

    Posted 3 years ago #

    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
  7. funlab
    Plugin Author

    Posted 2 years ago #

    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 !

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Live CSS Editor
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic