Permalink
Browse files

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...
1 parent c9a6c4b commit a24c40fb00be68517c20d1384359cf9ca992532e @markjaquith markjaquith committed Jan 18, 2013
View
2 wp-admin/options-permalink.php
@@ -227,7 +227,7 @@ function options_permalink_add_js() {
<?php
$suffix = '';
if ( ! $is_apache && ! $iis7_permalinks )
- $suffix = 'index.php/';
+ $suffix = $wp_rewrite->index . '/';
?>
<p><?php
/* translators: %s is a placeholder that must come at the start of the URL path. */
View
10 wp-includes/canonical.php
@@ -272,9 +272,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
$redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
}
- $redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
- if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/index.php/') === false )
- $redirect['path'] = trailingslashit($redirect['path']) . 'index.php/';
+ $redirect['path'] = user_trailingslashit( preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
+ if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/' . $wp_rewrite->index . '/') === false )
+ $redirect['path'] = trailingslashit($redirect['path']) . $wp_rewrite->index . '/';
if ( !empty( $addl_path ) )
$redirect['path'] = trailingslashit($redirect['path']) . $addl_path;
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
@@ -324,7 +324,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
unset($redirect['port']);
// trailing /index.php
- $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']);
+ $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
// Remove trailing spaces from the path
$redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
@@ -345,7 +345,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
// strip /index.php/ when we're not using PATHINFO permalinks
if ( !$wp_rewrite->using_index_permalinks() )
- $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']);
+ $redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
// trailing slashes
if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) {
View
4 wp-includes/link-template.php
@@ -1449,13 +1449,13 @@ function get_pagenum_link($pagenum = 1, $escape = true ) {
}
$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
- $request = preg_replace( '|^index\.php|i', '', $request);
+ $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
$request = ltrim($request, '/');
$base = trailingslashit( get_bloginfo( 'url' ) );
if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
- $base .= 'index.php/';
+ $base .= $wp_rewrite->index . '/';
if ( $pagenum > 1 ) {
$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
View
2 wp-includes/nav-menu-template.php
@@ -367,7 +367,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
$item_url = untrailingslashit( $raw_item_url );
- $_indexless_current = untrailingslashit( preg_replace( '/index.php$/', '', $current_url ) );
+ $_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
$classes[] = 'current-menu-item';
View
2 wp-includes/rewrite.php
@@ -315,7 +315,7 @@ function url_to_postid($url) {
// Strip 'index.php/' if we're not using path info permalinks
if ( !$wp_rewrite->using_index_permalinks() )
- $url = str_replace('index.php/', '', $url);
+ $url = str_replace( $wp_rewrite->index . '/', '', $url );
if ( false !== strpos($url, home_url()) ) {
// Chop off http://domain.com

0 comments on commit a24c40f

Please sign in to comment.