Make WordPress Core


Ignore:
Timestamp:
04/27/2009 04:17:24 PM (16 years ago)
Author:
ryan
Message:

Eliminate preg_replace with /e. Props tbaboon. fixes #8689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r11070 r11098  
    774774
    775775/**
     776 * Callback used to change %uXXXX to &#YYY; syntax
     777 *
     778 * @since 2.8?
     779 *
     780 * @param array $matches Single Match
     781 * @return string An HTML entity
     782 */
     783function funky_javascript_callback($matches) {
     784    return "&#".base_convert($matches[1],16,10).";";
     785}
     786
     787/**
    776788 * Fixes javascript bugs in browsers.
    777789 *
     
    789801    global $is_macIE, $is_winIE;
    790802
    791     /** @todo use preg_replace_callback() instead */
    792803    if ( $is_winIE || $is_macIE )
    793         $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
     804        $text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
     805                           "funky_javascript_callback",
     806                           $text);
    794807
    795808    return $text;
Note: See TracChangeset for help on using the changeset viewer.