Ticket #16687: no_verbose_ver1.diff
File no_verbose_ver1.diff, 3.8 KB (added by , 14 years ago) |
---|
-
wp-includes/class-wp.php
189 189 // Don't try to match against AtomPub calls 190 190 if ( $req_uri == 'wp-app.php' ) 191 191 break; 192 192 193 193 // If the requesting file is the anchor of the match, prepend it 194 194 // to the path info. 195 195 if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) ) … … 197 197 198 198 if ( preg_match("#^$match#", $request_match, $matches) || 199 199 preg_match("#^$match#", urldecode($request_match), $matches) ) { 200 201 if ( $wp_rewrite->use_verbose_page_rules == true && strpos( $query, 'pagename' ) !== false ) { 202 // this is a verbose page match, lets check to be sure about it 203 if ( ! get_page_by_path($request_match) ) continue; 204 } 205 200 206 // Got a match. 201 207 $this->matched_rule = $match; 202 208 203 209 // Trim the query of everything up to the '?'. 204 210 $query = preg_replace("!^.+\?!", '', $query); 205 211 -
wp-includes/rewrite.php
306 306 // Look for matches. 307 307 $request_match = $request; 308 308 foreach ( (array)$rewrite as $match => $query) { 309 310 if ( $wp_rewrite->use_verbose_page_rules == true && strpos( $query, 'pagename' ) !== false ) { 311 // this is a verbose page match, lets check to be sure about it 312 if ( ! get_page_by_path($request_match) ) 313 continue; 314 } 315 309 316 // If the requesting file is the anchor of the match, prepend it 310 317 // to the path info. 311 318 if ( !empty($url) && ($url != $request) && (strpos($match, $url) === 0) ) … … 813 820 $rewrite_rules = array(); 814 821 $page_structure = $this->get_page_permastruct(); 815 822 816 if ( ! $this->use_verbose_page_rules ) { 817 $this->add_rewrite_tag('%pagename%', "(.+?)", 'pagename='); 818 $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); 819 return $rewrite_rules; 820 } 821 822 $page_uris = $this->page_uri_index(); 823 $uris = $page_uris[0]; 824 $attachment_uris = $page_uris[1]; 825 826 if ( is_array( $attachment_uris ) ) { 827 foreach ( $attachment_uris as $uri => $pagename ) { 828 $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment='); 829 $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); 830 } 831 } 832 if ( is_array( $uris ) ) { 833 foreach ( $uris as $uri => $pagename ) { 834 $this->add_rewrite_tag('%pagename%', "($uri)", 'pagename='); 835 $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); 836 } 837 } 838 823 $this->add_rewrite_tag('%pagename%', "(.+?)", 'pagename='); 824 $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES)); 839 825 return $rewrite_rules; 840 826 } 841 827 … … 1558 1544 1559 1545 // Put them together. 1560 1546 if ( $this->use_verbose_page_rules ) 1561 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $ page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);1547 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules); 1562 1548 else 1563 1549 $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $default_feeds, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules); 1564 1550