Changeset 9156 for trunk/wp-includes/canonical.php
- Timestamp:
- 10/14/2008 05:51:01 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/canonical.php
r8843 r9156 40 40 global $wp_rewrite, $is_IIS, $wp_query, $wpdb; 41 41 42 if ( is_ feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )42 if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() ) 43 43 return; 44 44 … … 118 118 } 119 119 120 // paging 121 if ( $paged = get_query_var('paged') ) { 122 if ( $paged > 0 ) { 123 if ( !$redirect_url ) 124 $redirect_url = $requested_url; 125 $paged_redirect = @parse_url($redirect_url); 126 $paged_redirect['path'] = preg_replace('|/page/[0-9]+?(/+)?$|', '/', $paged_redirect['path']); // strip off any existing paging 127 $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']); // strip off trailing /index.php/ 120 // paging and feeds 121 if ( get_query_var('paged') || is_feed() ) { 122 if ( !$redirect_url ) 123 $redirect_url = $requested_url; 124 $paged_redirect = @parse_url($redirect_url); 125 while ( preg_match( '#page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/feed(/[a-z0-9-]*?(/+)?)?$#', $paged_redirect['path'] ) ) { 126 // Strip off paging and feed 127 $paged_redirect['path'] = preg_replace('#/page/[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging 128 $paged_redirect['path'] = preg_replace('#/feed(/[a-z0-9-]*?(/+)?)?$#', '/', $paged_redirect['path']); // strip off any existing feed 129 } 130 131 $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']); // strip off trailing /index.php/ 132 if ( get_query_var('paged') > 0 ) { 133 $paged = get_query_var('paged'); 128 134 if ( $paged > 1 && !is_single() ) { 129 135 $paged_redirect['path'] = trailingslashit($paged_redirect['path']); … … 131 137 $paged_redirect['path'] .= 'index.php/'; 132 138 $paged_redirect['path'] .= user_trailingslashit("page/$paged", 'paged'); 133 } elseif ( !is_ home() && !is_single() ){139 } elseif ( !is_single() ) { 134 140 $paged_redirect['path'] = user_trailingslashit($paged_redirect['path'], 'paged'); 135 141 } 136 $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path']; 137 $redirect['path'] = $paged_redirect['path']; 138 } 139 $redirect['query'] = remove_query_arg('paged', $redirect['query']); 142 } 143 if ( is_feed() ) { 144 $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'feed/' . ( ( 'rss2' == get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' ); 145 } 146 $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path']; 147 $redirect['path'] = $paged_redirect['path']; 148 $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] ); 149 $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); 140 150 } 141 151 } … … 249 259 exit(); 250 260 } else { 261 // Debug 262 // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) ); 251 263 return false; 252 264 }
Note: See TracChangeset
for help on using the changeset viewer.