From e29ccde9a1a522697b40590690d9d7ec5dafcc37 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 26 May 2006 22:14:55 +0000 Subject: [PATCH] Add some category filters. git-svn-id: https://develop.svn.wordpress.org/trunk@3799 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-db.php | 7 +++++-- wp-includes/default-filters.php | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index 77e8db5e5c..38c2faef8a 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -92,8 +92,10 @@ function wp_insert_category($catarr) { else $update = false; - $cat_name = wp_specialchars($cat_name); - + $cat_name = apply_filters('pre_category_name', $cat_name); + $category_nicename = apply_filters('pre_category_nicename', $category_nicename); + $category_description = apply_filters('pre_category_description', $category_description); + if (empty ($category_nicename)) $category_nicename = sanitize_title($cat_name); else @@ -102,6 +104,7 @@ function wp_insert_category($catarr) { if (empty ($category_description)) $category_description = ''; + $category_parent = (int) $category_parent; if (empty ($category_parent)) $category_parent = 0; diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 0c5ad99d70..1467873699 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -47,6 +47,13 @@ add_filter('comment_text', 'convert_smilies', 20); add_filter('comment_excerpt', 'convert_chars'); +// Categories +add_filter('pre_category_name', 'strip_tags'); +add_filter('pre_category_name', 'trim'); +add_filter('pre_category_name', 'wp_filter_kses'); +add_filter('pre_category_name', 'wp_specialchars', 30); +add_filter('pre_category_description', 'wp_filter_kses'); + // Places to balance tags on input add_filter('content_save_pre', 'balanceTags', 50); add_filter('excerpt_save_pre', 'balanceTags', 50);