Make WordPress Core

Changeset 15923


Ignore:
Timestamp:
10/22/2010 10:54:05 PM (16 years ago)
Author:
scribu
Message:

Introduce _qv_basename() and apply it to hierarchical taxonomies. See #9591.

File:
1 edited

Legend:

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

    r15921 r15923  
    14661466
    14671467                                        if ( $t->rewrite['hierarchical'] ) {
    1468                                                 $q[$t->query_var] = basename($q[$t->query_var]);
     1468                                                $q[$t->query_var] = $this->_qv_basename( $q[$t->query_var] );
    14691469                                        }
    14701470
     
    17851785
    17861786                if ( '' != $q['name'] ) {
    1787                         $q['name'] = sanitize_title($q['name']);
     1787                        $q['name'] = sanitize_title( $q['name'] );
    17881788                        $where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'";
    17891789                } elseif ( '' != $q['pagename'] ) {
     
    18131813                        $page_for_posts = get_option('page_for_posts');
    18141814                        if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
    1815                                 $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
    1816                                 $page_paths = '/' . trim($q['pagename'], '/');
    1817                                 $q['pagename'] = sanitize_title(basename($page_paths));
     1815                                $q['pagename'] = sanitize_title( $this->_qv_basename( $q['pagename'] ) );
    18181816                                $q['name'] = $q['pagename'];
    18191817                                $where .= " AND ($wpdb->posts.ID = '$reqpage')";
     
    18271825                        }
    18281826                } elseif ( '' != $q['attachment'] ) {
    1829                         $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
    1830                         $attach_paths = '/' . trim($q['attachment'], '/');
    1831                         $q['attachment'] = sanitize_title(basename($attach_paths));
     1827                        $q['attachment'] = sanitize_title( $this->_qv_basename( $q['attachment'] ) );
    18321828                        $q['name'] = $q['attachment'];
    18331829                        $where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'";
     
    19621958                                }
    19631959                        }
    1964                         $q['author_name'] = sanitize_title($q['author_name']);
     1960                        $q['author_name'] = sanitize_title( $q['author_name'] );
    19651961                        $q['author'] = get_user_by('slug', $q['author_name']);
    19661962                        if ( $q['author'] )
     
    31353131                return (bool) $this->is_404;
    31363132        }
     3133
     3134        /**
     3135         * i18n friendly way to get the last segment in a path
     3136         *
     3137         * @since 3.1.0
     3138         * @access private
     3139         *
     3140         * @param string $path The path
     3141         * @return string
     3142         */
     3143        function _qv_basename( $path ) {
     3144                return basename( str_replace( '%2F', '/', urlencode( urldecode( $path ) ) ) );
     3145        }
    31373146}
    31383147
Note: See TracChangeset for help on using the changeset viewer.