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
This commit is contained in:
Mark Jaquith 2013-01-18 13:44:22 +00:00
parent c9a6c4ba0c
commit a24c40fb00
5 changed files with 10 additions and 10 deletions

View File

@ -227,7 +227,7 @@ $structures = array(
<?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 File

@ -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 File

@ -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 File

@ -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 File

@ -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