Do not use lambda functions in wp_kses_decode_entities(), props mdawaffe, fixes #10623
git-svn-id: https://develop.svn.wordpress.org/trunk@11828 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
438666badd
commit
5d667146b8
@ -1027,12 +1027,32 @@ function valid_unicode($i) {
|
||||
* @return string Content after decoded entities
|
||||
*/
|
||||
function wp_kses_decode_entities($string) {
|
||||
$string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string);
|
||||
$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string);
|
||||
$string = preg_replace_callback('/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string);
|
||||
$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regex callback for wp_kses_decode_entities()
|
||||
*
|
||||
* @param array $match preg match
|
||||
* @return string
|
||||
*/
|
||||
function _wp_kses_decode_entities_chr( $match ) {
|
||||
return chr( $match[1] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Regex callback for wp_kses_decode_entities()
|
||||
*
|
||||
* @param array $match preg match
|
||||
* @return string
|
||||
*/
|
||||
function _wp_kses_decode_entities_chr_hexdec( $match ) {
|
||||
return chr( hexdec( $match[1] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize content with allowed HTML Kses rules.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user