WordPress.org

Make WordPress Core

Changeset 15635


Ignore:
Timestamp:
09/20/2010 03:28:58 PM (9 years ago)
Author:
ryan
Message:

Simplify sanitize_key() and use it in more places. see #14910

Location:
trunk/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r15590 r15635  
    764764function sanitize_key( $key ) {
    765765    $raw_key = $key;
    766     $key = wp_strip_all_tags($key);
    767     // Kill octets
    768     $key = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $key);
    769     $key = preg_replace('/&.+?;/', '', $key); // Kill entities
    770766
    771767    $key = preg_replace('|[^a-z0-9 _.\-@]|i', '', $key);
  • trunk/wp-includes/post.php

    r15590 r15635  
    572572    $args = (object) $args;
    573573
    574     $post_status = sanitize_user($post_status, true);
     574    $post_status = sanitize_key($post_status);
    575575    $args->name = $post_status;
    576576
     
    820820    $args = (object) $args;
    821821
    822     $post_type = sanitize_user($post_type, true);
     822    $post_type = sanitize_key($post_type);
    823823    $args->name = $post_type;
    824824
  • trunk/wp-includes/query.php

    r15627 r15635  
    14571457        if ( !empty($qv['post_type']) ) {
    14581458            if ( is_array($qv['post_type']) )
    1459                 $qv['post_type'] = array_map('sanitize_user', $qv['post_type'], array(true));
     1459                $qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
    14601460            else
    1461                 $qv['post_type'] = sanitize_user($qv['post_type'], true);
     1461                $qv['post_type'] = sanitize_key($qv['post_type']);
    14621462        }
    14631463
Note: See TracChangeset for help on using the changeset viewer.