From 6b351163ef11bff5e6b61c9e22917f52a9eecfbd Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 20 Sep 2010 15:28:58 +0000 Subject: [PATCH] Simplify sanitize_key() and use it in more places. see #14910 git-svn-id: http://svn.automattic.com/wordpress/trunk@15635 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 4 ---- wp-includes/post.php | 4 ++-- wp-includes/query.php | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index c940a35d58..350569fba7 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -763,10 +763,6 @@ function sanitize_user( $username, $strict = false ) { */ function sanitize_key( $key ) { $raw_key = $key; - $key = wp_strip_all_tags($key); - // Kill octets - $key = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $key); - $key = preg_replace('/&.+?;/', '', $key); // Kill entities $key = preg_replace('|[^a-z0-9 _.\-@]|i', '', $key); diff --git a/wp-includes/post.php b/wp-includes/post.php index 6aba67aba9..adacec189c 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -571,7 +571,7 @@ function register_post_status($post_status, $args = array()) { $args = wp_parse_args($args, $defaults); $args = (object) $args; - $post_status = sanitize_user($post_status, true); + $post_status = sanitize_key($post_status); $args->name = $post_status; if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) @@ -819,7 +819,7 @@ function register_post_type($post_type, $args = array()) { $args = wp_parse_args($args, $defaults); $args = (object) $args; - $post_type = sanitize_user($post_type, true); + $post_type = sanitize_key($post_type); $args->name = $post_type; // If not set, default to the setting for public. diff --git a/wp-includes/query.php b/wp-includes/query.php index 8fa701ed91..5284e034ea 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1456,9 +1456,9 @@ class WP_Query { if ( !empty($qv['post_type']) ) { if ( is_array($qv['post_type']) ) - $qv['post_type'] = array_map('sanitize_user', $qv['post_type'], array(true)); + $qv['post_type'] = array_map('sanitize_key', $qv['post_type']); else - $qv['post_type'] = sanitize_user($qv['post_type'], true); + $qv['post_type'] = sanitize_key($qv['post_type']); } if ( !empty($qv['post_status']) )