WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. JackNUMBER
    Member
    Posted 1 year 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 :)

    http://wordpress.org/extend/plugins/wp-live-css-editor/

  2. JackNUMBER
    Member
    Posted 1 year ago #

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

  3. pingram3541
    Member
    Plugin Author

    Posted 1 year ago #

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

  4. JackNUMBER
    Member
    Posted 1 year ago #

    I stopped use this plugin.

  5. pingram3541
    Member
    Plugin Author

    Posted 1 year ago #

    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));

  6. pingram3541
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Plugin Author

    Posted 6 months 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

About this Topic

Tags