diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php
index f51069943b..e8cd2629c5 100644
--- a/b2-include/b2functions.php
+++ b/b2-include/b2functions.php
@@ -64,7 +64,8 @@ function wptexturize($text) {
return $output;
}
-function wpautop($pee, $br=1) {
+function wpautop($pee, $br=1) {
+ $pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|
\s*
|', "\n\n", $pee);
$pee = preg_replace('!(<(?:table|ul|ol|li|pre|select|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $pee); // Space things out a little
$pee = preg_replace('!((?:table|ul|ol|li|pre|select|form|blockquote|h[1-6])>)!', "$1\n", $pee); // Space things out a little
@@ -72,12 +73,10 @@ function wpautop($pee, $br=1) {
$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*
|', '
', $pee); - $pee = preg_replace('|
\s*|', '', $pee); $pee = preg_replace('|]*)>|i', "', $pee); - $pee = preg_replace('!', '", $pee); $pee = str_replace('
\s*(?(?:table|ul|ol|li|pre|select|form|blockquote|h[1-6])[^>]*>)!', "$1", $pee); - $pee = preg_replace('!(?(?:table|ul|ol|li|pre|select|form|blockquote|h[1-6])>)\s*
!', "$1", $pee); + $pee = preg_replace('!\s*(?(?:table|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $pee); + $pee = preg_replace('!(?(?:table|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)\s*
!', "$1", $pee); if ($br) $pee = preg_replace('|(?)\s*\n|', "