Make WordPress Core

Changeset 23305


Ignore:
Timestamp:
01/18/2013 01:44:22 PM (14 years ago)
Author:
markjaquith
Message:

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

props wonderboymusic. fixes #7337

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-permalink.php

    r22931 r23305  
    228228$suffix = '';
    229229if ( ! $is_apache && ! $iis7_permalinks )
    230         $suffix = 'index.php/';
     230        $suffix = $wp_rewrite->index . '/';
    231231?>
    232232<p><?php
  • trunk/wp-includes/canonical.php

    r21813 r23305  
    273273                        }
    274274
    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 . '/';
    278278                        if ( !empty( $addl_path ) )
    279279                                $redirect['path'] = trailingslashit($redirect['path']) . $addl_path;
     
    325325
    326326        // trailing /index.php
    327         $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']);
     327        $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
    328328
    329329        // Remove trailing spaces from the path
     
    346346        // strip /index.php/ when we're not using PATHINFO permalinks
    347347        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'] );
    349349
    350350        // trailing slashes
  • trunk/wp-includes/link-template.php

    r22564 r23305  
    14501450
    14511451                $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
    1452                 $request = preg_replace( '|^index\.php|i', '', $request);
     1452                $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
    14531453                $request = ltrim($request, '/');
    14541454
     
    14561456
    14571457                if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
    1458                         $base .= 'index.php/';
     1458                        $base .= $wp_rewrite->index . '/';
    14591459
    14601460                if ( $pagenum > 1 ) {
  • trunk/wp-includes/nav-menu-template.php

    r22302 r23305  
    368368                        $raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
    369369                        $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 ) );
    371371
    372372                        if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_current ) ) ) {
  • trunk/wp-includes/rewrite.php

    r22441 r23305  
    316316        // Strip 'index.php/' if we're not using path info permalinks
    317317        if ( !$wp_rewrite->using_index_permalinks() )
    318                 $url = str_replace('index.php/', '', $url);
     318                $url = str_replace( $wp_rewrite->index . '/', '', $url );
    319319
    320320        if ( false !== strpos($url, home_url()) ) {
Note: See TracChangeset for help on using the changeset viewer.