From f285ca5c550e6d6e4ed84a1402dc9c1681f7b037 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Mon, 11 Oct 2004 22:07:09 +0000 Subject: [PATCH] Move balanceTags into filters. git-svn-id: http://svn.automattic.com/wordpress/trunk@1781 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/post.php | 10 +++++----- wp-comments-post.php | 2 -- wp-includes/template-functions-comment.php | 8 +++++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index 99d80ffcd..1e5dc3ba3 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -48,9 +48,9 @@ case 'post': $post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1") + 1; $post_pingback = intval($_POST['post_pingback']); - $content = balanceTags($_POST['content']); + $content = apply_filters('content_save_pre', $_POST['content']); $content = format_to_post($content); - $excerpt = balanceTags($_POST['excerpt']); + $excerpt = apply_filters('excerpt_save_pre',$_POST['excerpt']); $excerpt = format_to_post($excerpt); $post_title = $_POST['post_title']; $post_categories = $_POST['post_category']; @@ -281,9 +281,9 @@ case 'editpost': $post_ID = $_POST['post_ID']; $post_categories = $_POST['post_category']; if (!$post_categories) $post_categories[] = 1; - $content = balanceTags($_POST['content']); + $content = apply_filters('content_save_pre', $_POST['content']); $content = format_to_post($content); - $excerpt = balanceTags($_POST['excerpt']); + $excerpt = apply_filters('excerpt_save_pre', $_POST['excerpt']); $excerpt = format_to_post($excerpt); $post_title = $_POST['post_title']; $prev_status = $_POST['prev_status']; @@ -702,7 +702,7 @@ case 'editedcomment': } else { $datemodif = ''; } - $content = balanceTags($_POST['content']); + $content = apply_filters('comment_save_pre', $_POST['content']); $content = format_to_post($content); $result = $wpdb->query(" diff --git a/wp-comments-post.php b/wp-comments-post.php index 2e0783d03..f6a224761 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -48,8 +48,6 @@ if ( '' == $comment ) $now = current_time('mysql'); $now_gmt = current_time('mysql', 1); - -$comment = balanceTags($comment, 1); $comment = format_to_post($comment); $comment = apply_filters('post_comment_text', $comment); diff --git a/wp-includes/template-functions-comment.php b/wp-includes/template-functions-comment.php index e425b53cd..2b6d0a4f9 100644 --- a/wp-includes/template-functions-comment.php +++ b/wp-includes/template-functions-comment.php @@ -11,11 +11,17 @@ add_filter('comment_url', 'clean_url'); add_filter('comment_text', 'convert_chars'); add_filter('comment_text', 'make_clickable'); add_filter('comment_text', 'wpautop', 30); -add_filter('comment_text', 'balanceTags'); +add_filter('comment_text', 'balanceTags', 50); add_filter('comment_text', 'convert_smilies', 20); add_filter('comment_excerpt', 'convert_chars'); +// Places to balance tags on input +add_filter('post_comment_text', 'balanceTags', 50); +add_filter('content_save_pre', 'balanceTags', 50); +add_filter('excerpt_save_pre', 'balanceTags', 50); +add_filter('comment_save_pre', 'balanceTags', 50); + function comments_template() { global $withcomments, $post, $wpdb, $id, $comment;