diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-07-09 10:00:15 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-07-09 10:00:15 +0000 |
commit | 6211685ea85940b5cd34a850f3f1de9d483dd4df (patch) | |
tree | 9867583f435190c01e8116614c9f93935fb7ceb6 /wp-includes/formatting.php | |
parent | bfed4d22293ce81b07d262eb89ae1883a5e3b5ab (diff) | |
download | wordpress-mu-6211685ea85940b5cd34a850f3f1de9d483dd4df.tar.gz wordpress-mu-6211685ea85940b5cd34a850f3f1de9d483dd4df.tar.xz wordpress-mu-6211685ea85940b5cd34a850f3f1de9d483dd4df.zip |
WP Merge with revision 8300
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1360 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/formatting.php')
-rw-r--r-- | wp-includes/formatting.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index c49b663..e2b969a 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3,6 +3,7 @@ function wptexturize($text) { global $wp_cockneyreplace; $next = true; + $has_pre_parent = false; $output = ''; $curl = ''; $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); @@ -26,13 +27,17 @@ function wptexturize($text) { for ( $i = 0; $i < $stop; $i++ ) { $curl = $textarr[$i]; - if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag + if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag // static strings $curl = str_replace($static_characters, $static_replacements, $curl); // regular expressions $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); - } elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) { + } elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) { $next = false; + } elseif (strpos($curl, '<pre') !== false) { + $has_pre_parent = true; + } elseif (strpos($curl, '</pre>') !== false) { + $has_pre_parent = false; } else { $next = true; } @@ -1124,18 +1129,10 @@ function wp_richedit_pre($text) { // Filtering a blank results in an annoying <br />\n if ( empty($text) ) return apply_filters('richedit_pre', ''); - $output = $text; - $output = convert_chars($output); + $output = convert_chars($text); $output = wpautop($output); + $output = htmlspecialchars($output, ENT_NOQUOTES); - // These must be double-escaped or planets will collide. - $output = str_replace('<', '&lt;', $output); - $output = str_replace('>', '&gt;', $output); - - // These should be entities too - $output = str_replace('<', '<', $output); - $output = str_replace('>', '>', $output); - return apply_filters('richedit_pre', $output); } |