diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php
index 31efd738f2..922e11eb39 100644
--- a/wp-includes/functions-formatting.php
+++ b/wp-includes/functions-formatting.php
@@ -1,8 +1,9 @@
)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
+ $output = '';
+ // Capture tags and everything inside them
+ $textarr = preg_split("/(<.*>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$stop = count($textarr); $next = true; // loop stuff
for ($i = 0; $i < $stop; $i++) {
$curl = $textarr[$i];
@@ -30,7 +31,6 @@ function wptexturize($text) {
$curl = preg_replace("/\(tm\)/i", '™', $curl);
$curl = preg_replace("/\(c\)/i", '©', $curl);
$curl = preg_replace("/\(r\)/i", '®', $curl);
- $curl = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $curl);
$curl = str_replace("''", '”', $curl);
$curl = preg_replace('/(d+)x(\d+)/', "$1×$2", $curl);
@@ -55,9 +55,10 @@ function clean_pre($text) {
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|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "\n$1", $pee); // Space things out a little
- $pee = preg_replace('!((?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)!', "$1\n", $pee); // Space things out a little
- $pee = preg_replace("/(\r\n|\r)/", "\n", $pee); // cross-platform newlines
+ // Space things out a little
+ $pee = preg_replace('!(<(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "\n$1", $pee);
+ $pee = preg_replace('!((?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])>)!', "$1\n", $pee);
+ $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t
$1
\n", $pee); // make paragraphs, including one at the end $pee = preg_replace('|\s*?
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace @@ -71,7 +72,6 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!(?(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*