Purger more create_function usage during autop and iso descrambling. See #14424 props ScottMac.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-10-28 07:38:00 +00:00
parent 5169f2036c
commit fed42ecdf1

View File

@ -208,7 +208,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
if ($br) {
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee);
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '__autop_newline_preservation_helper', $pee);
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
}
@ -221,6 +221,18 @@ function wpautop($pee, $br = 1) {
return $pee;
}
/**
* Newline preservation help function for wpautop
*
* @since 3.1.0
* @access private
* @param array $matches preg_replace_callback matches array
* @returns string
*/
function __autop_newline_preservation_helper( $matches ) {
return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
}
/**
* Don't auto-p wrap shortcodes that stand alone
*
@ -1555,11 +1567,22 @@ function wp_iso_descrambler($string) {
return $string;
} else {
$subject = str_replace('_', ' ', $matches[2]);
$subject = preg_replace_callback('#\=([0-9a-f]{2})#i', create_function('$match', 'return chr(hexdec(strtolower($match[1])));'), $subject);
$subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '__wp_iso_convert', $subject);
return $subject;
}
}
/**
* Helper function to convert hex encoded chars to ascii
*
* @since 3.1.0
* @access private
* @param $match the preg_replace_callback matches array
*/
function __wp_iso_convert( $match ) {
return chr( hexdec( strtolower( $match[1] ) ) );
}
/**
* Returns a date in the GMT equivalent.
*