WordPress.org

Make WordPress Core

Ticket #14245: 14245.diff

File 14245.diff, 3.4 KB (added by nacin, 5 years ago)
  • wp-includes/post-template.php

     
    225225 
    226226        } 
    227227        if ( $preview ) // preview fix for javascript bug with foreign languages 
    228                 $output =       preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output); 
     228                $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', 'funky_javascript_callback', $output ); 
    229229 
    230230        return $output; 
    231231} 
    232232 
    233233/** 
     234 * Callback used to change %uXXXX to &#YYY; syntax 
     235 * 
     236 * @since 2.8.0 
     237 * @access private 
     238 * 
     239 * @param array $matches Single Match 
     240 * @return string An HTML entity 
     241 */ 
     242function funky_javascript_callback( $matches ) { 
     243        return '&#' . base_convert( $matches[1], 16, 10 ) . ';'; 
     244} 
     245 
     246/** 
    234247 * Display the post excerpt. 
    235248 * 
    236249 * @since 0.71 
  • wp-includes/deprecated.php

     
    24622462} 
    24632463 
    24642464/** 
    2465  * Callback used to change %uXXXX to &#YYY; syntax 
    2466  * 
    2467  * @since 2.8.0 
    2468  * @access private 
    2469  * @deprecated 3.0.0 
    2470  * 
    2471  * @param array $matches Single Match 
    2472  * @return string An HTML entity 
    2473  */ 
    2474 function funky_javascript_callback($matches) { 
    2475         return "&#".base_convert($matches[1],16,10).";"; 
    2476 } 
    2477  
    2478 /** 
    24792465 * Fixes javascript bugs in browsers. 
    24802466 * 
    24812467 * Converts unicode characters to HTML numbered entities. 
     
    24952481 
    24962482        if ( $is_winIE || $is_macIE ) 
    24972483                $text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/", 
    2498                                         "funky_javascript_callback", 
     2484                                        'funky_javascript_callback', 
    24992485                                        $text); 
    25002486 
    25012487        return $text; 
  • wp-includes/kses.php

     
    546546        global $pass_allowed_html, $pass_allowed_protocols; 
    547547        $pass_allowed_html = $allowed_html; 
    548548        $pass_allowed_protocols = $allowed_protocols; 
    549         return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', 
    550                 create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string); 
     549        return preg_replace_callback( '%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', 'wp_kses_split2', $string ); 
    551550} 
    552551 
    553552/** 
     
    566565 * @since 1.0.0 
    567566 * @uses wp_kses_attr() 
    568567 * 
    569  * @param string $string Content to filter 
    570  * @param array $allowed_html Allowed HTML elements 
    571  * @param array $allowed_protocols Allowed protocols to keep 
     568 * @param mixed $string Content to filter. If array, then takes $string[1]. 
     569 * @param array $allowed_html Allowed HTML elements. Defaults to $pass_allowed_html global. 
     570 * @param array $allowed_protocols Allowed protocols to keep. Defaults to $pass_allowed_protocols global. 
    572571 * @return string Fixed HTML element 
    573572 */ 
    574 function wp_kses_split2($string, $allowed_html, $allowed_protocols) { 
     573function wp_kses_split2($string, $allowed_html = null, $allowed_protocols = null ) { 
     574        if ( is_array( $string ) ) 
     575                $string = $string[1]; 
     576        if ( null === $allowed_html ) 
     577                $allowed_html = $GLOBALS['pass_allowed_html']; 
     578        if ( null === $allowed_protocols ) 
     579                $allowed_protocols = $GLOBALS['pass_allowed_protocols']; 
     580 
    575581        $string = wp_kses_stripslashes($string); 
    576582 
    577583        if (substr($string, 0, 1) != '<')