mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Eliminate preg_replace with /e. Props tbaboon. fixes #8689
git-svn-id: https://develop.svn.wordpress.org/trunk@11098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -772,6 +772,18 @@ function convert_chars($content, $deprecated = '') {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback used to change %uXXXX to &#YYY; syntax
|
||||
*
|
||||
* @since 2.8?
|
||||
*
|
||||
* @param array $matches Single Match
|
||||
* @return string An HTML entity
|
||||
*/
|
||||
function funky_javascript_callback($matches) {
|
||||
return "&#".base_convert($matches[1],16,10).";";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes javascript bugs in browsers.
|
||||
*
|
||||
@@ -788,9 +800,10 @@ function funky_javascript_fix($text) {
|
||||
// Fixes for browsers' javascript bugs
|
||||
global $is_macIE, $is_winIE;
|
||||
|
||||
/** @todo use preg_replace_callback() instead */
|
||||
if ( $is_winIE || $is_macIE )
|
||||
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
|
||||
$text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
|
||||
"funky_javascript_callback",
|
||||
$text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user