WordPress.org

Make WordPress Core

Ticket #7648: 7648.2.patch

File 7648.2.patch, 686 bytes (added by Viper007Bond, 12 years ago)

Don't escape literal \n's

  • wp-includes/formatting.php

     
    11881188
    11891189// Escape single quotes, specialchar double quotes, and fix line endings.
    11901190function js_escape($text) {
    1191         $safe_text = wp_specialchars($text, 'double');
     1191        $safe_text = addslashes($text);
    11921192        $safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
    11931193        $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text));
     1194        $safe_text = str_replace('\\\n', '\n', $safe_text);
    11941195        return apply_filters('js_escape', $safe_text, $text);
    11951196}
    11961197