Changeset 8620 for branches/crazyhorse/wp-includes/rewrite.php
- Timestamp:
- 08/11/2008 10:52:43 PM (18 years ago)
- File:
-
- 1 edited
-
branches/crazyhorse/wp-includes/rewrite.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-includes/rewrite.php
r8242 r8620 65 65 * @param string $base the taxonomy base that we're going to filter 66 66 * @return string 67 * @author Mark Jaquith 67 * @author Mark Jaquith 68 68 */ 69 69 function _wp_filter_taxonomy_base( $base ) { 70 if ( !empty( $base ) ) 71 $base = preg_replace( '|^/index\.php/|', '/', $base ); 70 if ( !empty( $base ) ) { 71 $base = preg_replace( '|^/index\.php/|', '', $base ); 72 $base = trim( $base, '/' ); 73 } 72 74 return $base; 73 75 } … … 151 153 152 154 // Substitute the substring matches into the query. 153 eval("\$query = \" $query\";");155 eval("\$query = \"" . addslashes($query) . "\";"); 154 156 // Filter out non-public query vars 155 157 global $wp; 156 158 parse_str($query, $query_vars); 157 159 $query = array(); 158 foreach ( $query_vars as $key => $value ) {160 foreach ( (array) $query_vars as $key => $value ) { 159 161 if ( in_array($key, $wp->public_query_vars) ) 160 162 $query[$key] = $value; … … 389 391 preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); 390 392 $tok_index = 1; 391 foreach ( $tokens[0] as $token) {393 foreach ( (array) $tokens[0] as $token) { 392 394 if ( ($token == '%post_id%') && ($tok_index <= 3) ) { 393 395 $front = $front . 'date/'; … … 446 448 447 449 if (empty($this->category_base)) 448 $this->category_structure = $this->front . 'category/';450 $this->category_structure = trailingslashit( $this->front . 'category' ); 449 451 else 450 $this->category_structure = $this->category_base . '/';452 $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base ); 451 453 452 454 $this->category_structure .= '%category%'; … … 466 468 467 469 if (empty($this->tag_base)) 468 $this->tag_structure = $this->front . 'tag/';470 $this->tag_structure = trailingslashit( $this->front . 'tag' ); 469 471 else 470 $this->tag_structure = $this->tag_base . '/';472 $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base ); 471 473 472 474 $this->tag_structure .= '%tag%'; … … 575 577 //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/? 576 578 $feedregex2 = ''; 577 foreach ( $this->feeds as $feed_name) {579 foreach ( (array) $this->feeds as $feed_name) { 578 580 $feedregex2 .= $feed_name . '|'; 579 581 } … … 590 592 if ($endpoints) { 591 593 $ep_query_append = array (); 592 foreach ( $this->endpoints as $endpoint) {594 foreach ( (array) $this->endpoints as $endpoint) { 593 595 //match everything after the endpoint name, but allow for nothing to appear there 594 596 $epmatch = $endpoint[1] . '(/(.*))?/?$'; … … 689 691 //do endpoints 690 692 if ($endpoints) { 691 foreach ( $ep_query_append as $regex => $ep) {693 foreach ( (array) $ep_query_append as $regex => $ep) { 692 694 //add the endpoints on if the mask fits 693 695 if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) { … … 746 748 747 749 //do endpoints for attachments 748 if ( ! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) {750 if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) { 749 751 if ($ep[0] & EP_ATTACHMENT) { 750 752 $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); … … 894 896 895 897 //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) 896 foreach ( $this->non_wp_rules as $match => $query) {898 foreach ( (array) $this->non_wp_rules as $match => $query) { 897 899 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 898 900 $match = str_replace('.+?', '.+', $match); … … 915 917 "RewriteRule ^.*$ - [S=$num_rules]\n"; 916 918 917 foreach ( $rewrite as $match => $query) {919 foreach ( (array) $rewrite as $match => $query) { 918 920 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 919 921 $match = str_replace('.+?', '.+', $match); … … 994 996 $this->root = $this->index . '/'; 995 997 } 996 $this->category_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) .get_option( 'category_base' );997 $this->tag_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) .get_option( 'tag_base' );998 $this->category_base = get_option( 'category_base' ); 999 $this->tag_base = get_option( 'tag_base' ); 998 1000 unset($this->category_structure); 999 1001 unset($this->author_structure);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)