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

props evansolomon for initial cleanup.
fixes #22209.


git-svn-id: https://develop.svn.wordpress.org/trunk@25617 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-09-25 00:46:39 +00:00
parent 8d72ad52ff
commit beca878aa6

View File

@ -141,22 +141,13 @@ class WP {
$error = '404'; $error = '404';
$this->did_permalink = true; $this->did_permalink = true;
if ( isset($_SERVER['PATH_INFO']) ) $pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
$pathinfo = $_SERVER['PATH_INFO']; list( $pathinfo ) = explode( '?', $pathinfo );
else $pathinfo = str_replace( "%", "%25", $pathinfo );
$pathinfo = '';
$pathinfo_array = explode('?', $pathinfo); list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
$req_uri = $_SERVER['REQUEST_URI'];
$req_uri_array = explode('?', $req_uri);
$req_uri = $req_uri_array[0];
$self = $_SERVER['PHP_SELF']; $self = $_SERVER['PHP_SELF'];
$home_path = parse_url(home_url()); $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
if ( isset($home_path['path']) )
$home_path = $home_path['path'];
else
$home_path = '';
$home_path = trim($home_path, '/');
// Trim path info from the end and the leading home path from the // Trim path info from the end and the leading home path from the
// front. For path info requests, this leaves us with the requesting // front. For path info requests, this leaves us with the requesting