Ticket #9591: 9591.2.diff

File 9591.2.diff, 4.0 KB (added by scribu, 3 years ago)

refresh

  • wp-includes/taxonomy.php

     
    534534                case 'slug': 
    535535                case 'name': 
    536536                        foreach ( $terms as $i => $term ) { 
    537                                 $terms[$i] = sanitize_term_field('slug', $term, 0, $taxonomy, 'db'); 
     537                                $terms[$i] = sanitize_title_for_query($term); 
    538538                        } 
    539539                        $terms = array_filter($terms); 
    540540 
  • wp-includes/query.php

     
    17861786                } 
    17871787 
    17881788                if ( '' != $q['name'] ) { 
    1789                         $q['name'] = sanitize_title($q['name']); 
     1789                        $q['name'] = sanitize_title_for_query($q['name']); 
    17901790                        $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'"; 
    17911791                } elseif ( '' != $q['pagename'] ) { 
    17921792                        if ( isset($this->queried_object_id) ) { 
     
    18141814 
    18151815                        $page_for_posts = get_option('page_for_posts'); 
    18161816                        if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) { 
    1817                                 $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); 
    18181817                                $page_paths = '/' . trim($q['pagename'], '/'); 
    1819                                 $q['pagename'] = sanitize_title(basename($page_paths)); 
     1818                                $q['pagename'] = sanitize_title_for_query(basename($page_paths)); 
    18201819                                $q['name'] = $q['pagename']; 
    18211820                                $where .= " AND ($wpdb->posts.ID = '$reqpage')"; 
    18221821                                $reqpage_obj = get_page($reqpage); 
     
    18281827                                } 
    18291828                        } 
    18301829                } elseif ( '' != $q['attachment'] ) { 
    1831                         $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment']))); 
    18321830                        $attach_paths = '/' . trim($q['attachment'], '/'); 
    1833                         $q['attachment'] = sanitize_title(basename($attach_paths)); 
     1831                        $q['attachment'] = sanitize_title_for_query(basename($attach_paths)); 
    18341832                        $q['name'] = $q['attachment']; 
    18351833                        $where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'"; 
    18361834                } 
     
    19631961                                        $q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailling slash 
    19641962                                } 
    19651963                        } 
    1966                         $q['author_name'] = sanitize_title($q['author_name']); 
     1964                        $q['author_name'] = sanitize_title_for_query($q['author_name']); 
    19671965                        $q['author'] = get_user_by('slug', $q['author_name']); 
    19681966                        if ( $q['author'] ) 
    19691967                                $q['author'] = $q['author']->ID; 
  • wp-includes/formatting.php

     
    628628                chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', 
    629629                chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', 
    630630                chr(197).chr(190) => 'z', chr(197).chr(191) => 's', 
     631                chr(200).chr(153) => 's', chr(200).chr(155) => 't', 
    631632                // Euro Sign 
    632633                chr(226).chr(130).chr(172) => 'E', 
    633634                // GBP (Pound) Sign 
     
    783784 * 
    784785 * @param string $title The string to be sanitized. 
    785786 * @param string $fallback_title Optional. A title to use if $title is empty. 
     787 * @param string $context Optional. The operation for which the string is sanitized 
    786788 * @return string The sanitized string. 
    787789 */ 
    788 function sanitize_title($title, $fallback_title = '') { 
     790function sanitize_title($title, $fallback_title = '', $context = 'save') { 
    789791        $raw_title = $title; 
    790         $title = strip_tags($title); 
    791         $title = apply_filters('sanitize_title', $title, $raw_title); 
    792792 
     793        if ( 'save' == $context ) 
     794                $title = remove_accents($title); 
     795 
     796        $title = apply_filters('sanitize_title', $title, $raw_title, $context); 
     797 
    793798        if ( '' === $title || false === $title ) 
    794799                $title = $fallback_title; 
    795800 
    796801        return $title; 
    797802} 
    798803 
     804function sanitize_title_for_query($title) { 
     805        return sanitize_title($title, '', 'query'); 
     806} 
     807 
    799808/** 
    800809 * Sanitizes title, replacing whitespace with dashes. 
    801810 * 
     
    816825        // Restore octets. 
    817826        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); 
    818827 
    819         $title = remove_accents($title); 
    820828        if (seems_utf8($title)) { 
    821829                if (function_exists('mb_strtolower')) { 
    822830                        $title = mb_strtolower($title, 'UTF-8');