diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 1b6b7feb97..5e19a02475 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -44,10 +44,18 @@ function wptexturize($text) { return $output; } -function clean_pre($text) { +// Accepts matches array from preg_replace_callback in wpautop() +// or a string +function clean_pre($matches) { + if ( is_array($matches) ) + $text = $matches[1] . $matches[2] . ""; + else + $text = $matches; + $text = str_replace('
', '', $text); $text = str_replace('

', "\n", $text); $text = str_replace('

', '', $text); + return $text; } @@ -78,7 +86,7 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!(]*>)\s*
!', "$1", $pee); $pee = preg_replace('!
(\s*]*>)!', '$1', $pee); if (strpos($pee, ')(.*?)!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '' ", $pee); + $pee = preg_replace_callback('!()(.*?)!is', 'clean_pre', $pee ); $pee = preg_replace( "|\n

$|", '

', $pee ); return $pee;