Make WordPress Core

Ticket #7337: wp-rewrite-index.diff

File wp-rewrite-index.diff, 4.9 KB (added by wonderboymusic, 13 years ago)
  • wp-includes/nav-menu-template.php

    Property changes on: .
    ___________________________________________________________________
    Added: svn:ignore
       + .wp-tests-version
    
    
     
    367367                        $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
    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 ) ) ) {
    373373                                $classes[] = 'current-menu-item';
  • wp-includes/link-template.php

     
    14451445                }
    14461446
    14471447                $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
    1448                 $request = preg_replace( '|^index\.php|i', '', $request);
     1448                $request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
    14491449                $request = ltrim($request, '/');
    14501450
    14511451                $base = trailingslashit( get_bloginfo( 'url' ) );
    14521452
    14531453                if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
    1454                         $base .= 'index.php/';
     1454                        $base .= $wp_rewrite->index . '/';
    14551455
    14561456                if ( $pagenum > 1 ) {
    14571457                        $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
  • wp-includes/rewrite.php

     
    315315
    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()) ) {
    321321                // Chop off http://domain.com
  • wp-includes/canonical.php

     
    272272                                $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
    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;
    280280                        $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
     
    324324                unset($redirect['port']);
    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
    330330        $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
     
    345345
    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
    351351        if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) {
  • wp-admin/options-permalink.php

     
    227227<?php
    228228$suffix = '';
    229229if ( ! $is_apache && ! $iis7_permalinks )
    230         $suffix = 'index.php/';
     230        $suffix = $wp_rewrite->index . '/';
    231231?>
    232232<p><?php
    233233/* translators: %s is a placeholder that must come at the start of the URL path. */