summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/functions-formatting.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-18 13:47:42 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-18 13:47:42 +0000
commit56777d417dd3fefd42e44db4f60377709fccdf5a (patch)
tree163d1422f805827f7ba408260ccd9d9aaa6c5ea7 /wp-inst/wp-includes/functions-formatting.php
parent2b56b90f06b0018f0dba866e2d799cda640d9597 (diff)
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@440 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/functions-formatting.php')
-rw-r--r--wp-inst/wp-includes/functions-formatting.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/wp-inst/wp-includes/functions-formatting.php b/wp-inst/wp-includes/functions-formatting.php
index c95fb23..da245a8 100644
--- a/wp-inst/wp-includes/functions-formatting.php
+++ b/wp-inst/wp-includes/functions-formatting.php
@@ -62,7 +62,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|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<p>$1</p>\n", $pee); // make paragraphs, including one at the end
+ $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
@@ -993,4 +993,21 @@ function ent2ncr($text) {
return $text;
}
+function wp_richedit_pre($text) {
+ // Filtering a blank results in an annoying <br />\n
+ if ( empty($text) ) return '';
+
+ $output = $text;
+ $output = html_entity_decode($output); // undoes format_to_edit()
+ $output = wptexturize($output);
+ $output = convert_chars($output);
+ $output = wpautop($output);
+
+ // These must be double-escaped or planets will collide.
+ $output = str_replace('&lt;', '&amp;lt;', $output);
+ $output = str_replace('&gt;', '&amp;gt;', $output);
+
+ return $output;
+}
+
?>