Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Consistently use $wp_rewrite->index instead of hardcoding "index.php".

props wonderboymusic. fixes #7337

git-svn-id: http://core.svn.wordpress.org/trunk@23305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit a24c40fb00be68517c20d1384359cf9ca992532e 1 parent c9a6c4b
Mark Jaquith markjaquith authored
2  wp-admin/options-permalink.php
@@ -227,7 +227,7 @@ function options_permalink_add_js() {
10 wp-includes/canonical.php
@@ -272,9 +272,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
272 272 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
273 273 }
274 274
275   - $redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
276   - if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/index.php/') === false )
277   - $redirect['path'] = trailingslashit($redirect['path']) . 'index.php/';
  275 + $redirect['path'] = user_trailingslashit( preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
  276 + if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/' . $wp_rewrite->index . '/') === false )
  277 + $redirect['path'] = trailingslashit($redirect['path']) . $wp_rewrite->index . '/';
278 278 if ( !empty( $addl_path ) )
279 279 $redirect['path'] = trailingslashit($redirect['path']) . $addl_path;
280 280 $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
@@ -324,7 +324,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
324 324 unset($redirect['port']);
325 325
326 326 // trailing /index.php
327   - $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']);
  327 + $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
328 328
329 329 // Remove trailing spaces from the path
330 330 $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
@@ -345,7 +345,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
345 345
346 346 // strip /index.php/ when we're not using PATHINFO permalinks
347 347 if ( !$wp_rewrite->using_index_permalinks() )
348   - $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']);
  348 + $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
349 349
350 350 // trailing slashes
351 351 if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) {
4 wp-includes/link-template.php
@@ -1449,13 +1449,13 @@ function get_pagenum_link($pagenum = 1, $escape = true ) {
2  wp-includes/nav-menu-template.php
@@ -367,7 +367,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
367 367 $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
368 368 $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
369 369 $item_url = untrailingslashit( $raw_item_url );
370   - $_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) );
  370 + $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
371 371
372 372 if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
373 373 $classes[] = 'current-menu-item';
2  wp-includes/rewrite.php
@@ -315,7 +315,7 @@ function url_to_postid($url) {
315 315
316 316 // Strip 'index.php/' if we're not using path info permalinks
317 317 if ( !$wp_rewrite->using_index_permalinks() )
318   - $url = str_replace('index.php/', '', $url);
  318 + $url = str_replace( $wp_rewrite->index . '/', '', $url );
319 319
320 320 if ( false !== strpos($url, home_url()) ) {
321 321 // Chop off http://domain.com

0 comments on commit a24c40f

Please sign in to comment.
Something went wrong with that request. Please try again.