Make WordPress Core

Changeset 25617


Ignore:
Timestamp:
09/25/2013 12:46:39 AM (13 years ago)
Author:
nacin
Message:

Clean up the path calculations in wp::parse_request().

props evansolomon for initial cleanup.
fixes #22209.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r25585 r25617  
    142142                        $this->did_permalink = true;
    143143
    144                         if ( isset($_SERVER['PATH_INFO']) )
    145                                 $pathinfo = $_SERVER['PATH_INFO'];
    146                         else
    147                                 $pathinfo = '';
    148                         $pathinfo_array = explode('?', $pathinfo);
    149                         $pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
    150                         $req_uri = $_SERVER['REQUEST_URI'];
    151                         $req_uri_array = explode('?', $req_uri);
    152                         $req_uri = $req_uri_array[0];
     144                        $pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
     145                        list( $pathinfo ) = explode( '?', $pathinfo );
     146                        $pathinfo = str_replace( "%", "%25", $pathinfo );
     147
     148                        list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
    153149                        $self = $_SERVER['PHP_SELF'];
    154                         $home_path = parse_url(home_url());
    155                         if ( isset($home_path['path']) )
    156                                 $home_path = $home_path['path'];
    157                         else
    158                                 $home_path = '';
    159                         $home_path = trim($home_path, '/');
     150                        $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
    160151
    161152                        // Trim path info from the end and the leading home path from the
Note: See TracChangeset for help on using the changeset viewer.