Make WordPress Core


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

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

props wonderboymusic. fixes #7337

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.