Make WordPress Core

Ticket #9102: 9102.diff

File 9102.diff, 2.4 KB (added by Denis-de-Bernardy, 16 years ago)
  • wp-includes/link-template.php

     
    12291229        $home_root = parse_url(get_option('home'));
    12301230        $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
    12311231        $home_root = preg_quote( trailingslashit( $home_root ), '|' );
     1232        if ( get_option('home') != get_option('siteurl') ) {
     1233                $site_root = parse_url(get_option('siteurl'));
     1234                $site_root = ( isset($site_root['path']) ) ? $site_root['path'] : '';
     1235                $site_root = preg_quote( trailingslashit( $site_root ), '|' );
     1236        } else {
     1237                $site_root = false;
     1238        }
    12321239
    12331240        $request = preg_replace('|^'. $home_root . '|', '', $request);
     1241        if ( $site_root )
     1242                $request = preg_replace('|^'. $home_root . '|', '', $request);
    12341243        $request = preg_replace('|^/+|', '', $request);
    12351244
    12361245        if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
  • wp-includes/classes.php

     
    165165                        else
    166166                                $home_path = '';
    167167                        $home_path = trim($home_path, '/');
     168                        if ( get_option('home') != get_option('siteurl') ) {
     169                                $site_path = parse_url(get_option('siteurl'));
     170                                if ( isset($site_path['path']) )
     171                                        $site_path = $site_path['path'];
     172                                else
     173                                        $site_path = '';
     174                                $site_path = trim($site_path, '/');
     175                        } else {
     176                                $site_path = false;
     177                        }
    168178
    169179                        // Trim path info from the end and the leading home path from the
    170180                        // front.  For path info requests, this leaves us with the requesting
     
    173183                        $req_uri = str_replace($pathinfo, '', rawurldecode($req_uri));
    174184                        $req_uri = trim($req_uri, '/');
    175185                        $req_uri = preg_replace("|^$home_path|", '', $req_uri);
     186                        if ( $site_path )
     187                                $req_uri = preg_replace("|^$site_path|", '', $req_uri);
    176188                        $req_uri = trim($req_uri, '/');
    177189                        $pathinfo = trim($pathinfo, '/');
    178190                        $pathinfo = preg_replace("|^$home_path|", '', $pathinfo);
     191                        if ( $site_path )
     192                                $pathinfo = preg_replace("|^$site_path|", '', $pathinfo);
    179193                        $pathinfo = trim($pathinfo, '/');
    180194                        $self = trim($self, '/');
    181195                        $self = preg_replace("|^$home_path|", '', $self);
     196                        if ( $site_path )
     197                                $self = preg_replace("|^$site_path|", '', $self);
    182198                        $self = trim($self, '/');
    183199
    184200                        // The requested permalink is in $pathinfo for path info requests and