diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index b0caa96b57..78125c6b1b 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -208,7 +208,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!
\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
if ($br) {
- $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "", $matches[0]);'), $pee);
+ $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '__autop_newline_preservation_helper', $pee);
$pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks
$pee = str_replace('', "\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", "", $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.
*