WordPress.org

Make WordPress Core

Ticket #7648: 7648.3.patch

File 7648.3.patch, 838 bytes (added by Viper007Bond, 11 years ago)

Patch refresh and simplification

  • wp-includes/formatting.php

     
    20592059 * @param string $text The text to be escaped.
    20602060 * @return string Escaped text.
    20612061 */
    2062 function js_escape($text) {
     2062function js_escape( $text ) {
    20632063        $safe_text = wp_check_invalid_utf8( $text );
    2064         $safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
    2065         $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
     2064        $safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", $safe_text );
    20662065        $safe_text = preg_replace( "/\r?\n/", "\\n", addslashes( $safe_text ) );
     2066        $safe_text = str_replace( '\\\n', '\n', $safe_text );
    20672067        return apply_filters( 'js_escape', $safe_text, $text );
    20682068}
    20692069