diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index d7fc4d5c08..ba9c24fc2e 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -98,6 +98,22 @@ function wptexturize($text) { return $output; } +function wpautop($pee, $br=1) { + $pee = preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newlines + $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates + $pee = preg_replace('/\n?(.+?)(\n\n|\z)/s', "
$1
\n", $pee); // make paragraphs, including one at the end + $pee = preg_replace('/\s*(<(?:table|ol|ul|pre|select|form)>)/', "$1", $pee); + $pee = preg_replace('!((?:table|ol|ul|pre|select|form)>)
!', "$1", $pee); + if ($br) $pee = preg_replace('|(?)\s*\n|', "]*)>|i', "', $pee); + $pee = str_replace('', '", $pee); + $pee = str_replace('
', '
', $pee); + $pee = preg_replace('#
\s*#', '', $pee); + $pee = preg_replace('/&[^#](?![a-z]*;)/', '&', $pee); + return $pee; +} + function autobrize($content) { $content = preg_replace("/