Changeset 15929
- Timestamp:
- 10/23/2010 12:55:55 PM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r15816 r15929 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', … … 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 793 if ( 'save' == $context ) 794 $title = remove_accents($title); 795 796 $title = apply_filters('sanitize_title', $title, $raw_title, $context); 792 797 793 798 if ( '' === $title || false === $title ) … … 795 800 796 801 return $title; 802 } 803 804 function sanitize_title_for_query($title) { 805 return sanitize_title($title, '', 'query'); 797 806 } 798 807 … … 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')) { -
trunk/wp-includes/query.php
r15923 r15929 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'] ) { … … 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')"; … … 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'] . "'"; … … 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'] ) -
trunk/wp-includes/taxonomy.php
r15922 r15929 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);
Note: See TracChangeset
for help on using the changeset viewer.