Ticket #9591: 9591.4.diff
File 9591.4.diff, 3.8 KB (added by , 13 years ago) |
---|
-
wp-includes/taxonomy.php
534 534 case 'slug': 535 535 case 'name': 536 536 foreach ( $terms as $i => $term ) { 537 $terms[$i] = sanitize_t erm_field('slug', $term, 0, $taxonomy, 'db');537 $terms[$i] = sanitize_title_for_query( $term ); 538 538 } 539 539 $terms = array_filter($terms); 540 540 -
wp-includes/query.php
1784 1784 } 1785 1785 1786 1786 if ( '' != $q['name'] ) { 1787 $q['name'] = sanitize_title ( $q['name'] );1787 $q['name'] = sanitize_title_for_query( $q['name'] ); 1788 1788 $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'"; 1789 1789 } elseif ( '' != $q['pagename'] ) { 1790 1790 if ( isset($this->queried_object_id) ) { … … 1812 1812 1813 1813 $page_for_posts = get_option('page_for_posts'); 1814 1814 if ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) { 1815 $q['pagename'] = sanitize_title ( $this->_qv_basename( $q['pagename'] ) );1815 $q['pagename'] = sanitize_title_for_query( $this->_qv_basename( $q['pagename'] ) ); 1816 1816 $q['name'] = $q['pagename']; 1817 1817 $where .= " AND ($wpdb->posts.ID = '$reqpage')"; 1818 1818 $reqpage_obj = get_page($reqpage); … … 1824 1824 } 1825 1825 } 1826 1826 } elseif ( '' != $q['attachment'] ) { 1827 $q['attachment'] = sanitize_title ( $this->_qv_basename( $q['attachment'] ) );1827 $q['attachment'] = sanitize_title_for_query( $this->_qv_basename( $q['attachment'] ) ); 1828 1828 $q['name'] = $q['attachment']; 1829 1829 $where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'"; 1830 1830 } … … 1957 1957 $q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailling slash 1958 1958 } 1959 1959 } 1960 $q['author_name'] = sanitize_title ( $q['author_name'] );1960 $q['author_name'] = sanitize_title_for_query( $q['author_name'] ); 1961 1961 $q['author'] = get_user_by('slug', $q['author_name']); 1962 1962 if ( $q['author'] ) 1963 1963 $q['author'] = $q['author']->ID; -
wp-includes/formatting.php
628 628 chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', 629 629 chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', 630 630 chr(197).chr(190) => 'z', chr(197).chr(191) => 's', 631 chr(200).chr(153) => 's', chr(200).chr(155) => 't', 631 632 // Euro Sign 632 633 chr(226).chr(130).chr(172) => 'E', 633 634 // GBP (Pound) Sign … … 783 784 * 784 785 * @param string $title The string to be sanitized. 785 786 * @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 786 788 * @return string The sanitized string. 787 789 */ 788 function sanitize_title($title, $fallback_title = '' ) {790 function sanitize_title($title, $fallback_title = '', $context = 'save') { 789 791 $raw_title = $title; 790 $title = strip_tags($title);791 $title = apply_filters('sanitize_title', $title, $raw_title);792 792 793 if ( 'save' == $context ) 794 $title = remove_accents($title); 795 796 $title = apply_filters('sanitize_title', $title, $raw_title, $context); 797 793 798 if ( '' === $title || false === $title ) 794 799 $title = $fallback_title; 795 800 796 801 return $title; 797 802 } 798 803 804 function sanitize_title_for_query($title) { 805 return sanitize_title($title, '', 'query'); 806 } 807 799 808 /** 800 809 * Sanitizes title, replacing whitespace with dashes. 801 810 * … … 816 825 // Restore octets. 817 826 $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); 818 827 819 $title = remove_accents($title);820 828 if (seems_utf8($title)) { 821 829 if (function_exists('mb_strtolower')) { 822 830 $title = mb_strtolower($title, 'UTF-8');