More filters and KSES cleanup.

git-svn-id: https://develop.svn.wordpress.org/trunk@2151 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2005-01-26 22:29:18 +00:00
parent 97691eb22b
commit 5671e81028
3 changed files with 10 additions and 5 deletions

View File

@ -6,7 +6,7 @@
* generic function for inserting data into the posts table. * generic function for inserting data into the posts table.
*/ */
function wp_insert_post($postarr = array()) { function wp_insert_post($postarr = array()) {
global $wpdb, $post_default_category; global $wpdb, $post_default_category, $allowedtags;
// export array as variables // export array as variables
extract($postarr); extract($postarr);

View File

@ -45,8 +45,7 @@ $allowedtags = array(
); );
} }
function wp_kses($string, $allowed_html, $allowed_protocols = function wp_kses($string, $allowed_html, $allowed_protocols =
array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', array('http', 'https', 'ftp', 'news', 'nntp', 'feed', 'gopher', 'mailto'))
'gopher', 'mailto'))
############################################################################### ###############################################################################
# This function makes sure that only the allowed HTML element names, attribute # This function makes sure that only the allowed HTML element names, attribute
# names and attribute values plus only sane HTML entities will occur in # names and attribute values plus only sane HTML entities will occur in
@ -556,9 +555,9 @@ function wp_kses_decode_entities($string)
return $string; return $string;
} # function wp_kses_decode_entities } # function wp_kses_decode_entities
function wp_filter_kses($data) { function wp_filter_kses( $string ) {
global $allowedtags; global $allowedtags;
return wp_kses($data, $allowedtags); return wp_kses($string, $allowedtags);
} }
?> ?>

View File

@ -139,9 +139,15 @@ add_filter('pre_comment_author_url', 'strip_tags');
add_filter('pre_comment_author_url', 'trim'); add_filter('pre_comment_author_url', 'trim');
add_filter('pre_comment_author_url', 'clean_url'); add_filter('pre_comment_author_url', 'clean_url');
add_filter('pre_comment_content', 'stripslashes', 1);
add_filter('pre_comment_content', 'wp_filter_kses'); add_filter('pre_comment_content', 'wp_filter_kses');
add_filter('pre_comment_content', 'wp_rel_nofollow', 15); add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
add_filter('pre_comment_content', 'balanceTags', 30); add_filter('pre_comment_content', 'balanceTags', 30);
add_filter('pre_comment_content', 'addslashes', 50);
add_filter('pre_comment_author_name', 'wp_filter_kses');
add_filter('pre_comment_author_email', 'wp_filter_kses');
add_filter('pre_comment_author_url', 'wp_filter_kses');
// Default filters for these functions // Default filters for these functions
add_filter('comment_author', 'wptexturize'); add_filter('comment_author', 'wptexturize');