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
This commit is contained in:
ryan 2010-09-20 15:28:58 +00:00
parent c2100074d3
commit 6b351163ef
3 changed files with 4 additions and 8 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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']) )