mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 07:35:39 +01:00
Optimize parse_request for the home page. Props duck_. see #17177
git-svn-id: http://svn.automattic.com/wordpress/trunk@18466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
009b264271
commit
b1842a700c
@ -185,21 +185,28 @@ class WP {
|
|||||||
|
|
||||||
// Look for matches.
|
// Look for matches.
|
||||||
$request_match = $request;
|
$request_match = $request;
|
||||||
foreach ( (array) $rewrite as $match => $query) {
|
if ( empty( $req_uri ) ) {
|
||||||
// Don't try to match against AtomPub calls
|
if ( isset( $rewrite['$'] ) ) {
|
||||||
if ( $req_uri == 'wp-app.php' )
|
$this->matched_rule = '$';
|
||||||
break;
|
$query = $rewrite['$'];
|
||||||
|
$matches = array('');
|
||||||
// If the requesting file is the anchor of the match, prepend it
|
}
|
||||||
// to the path info.
|
} else if ( $req_uri != 'wp-app.php' ) {
|
||||||
if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) )
|
foreach ( (array) $rewrite as $match => $query ) {
|
||||||
|
// If the requesting file is the anchor of the match, prepend it to the path info.
|
||||||
|
if ( ! empty($req_uri) && strpos($match, $req_uri) === 0 && $req_uri != $request )
|
||||||
$request_match = $req_uri . '/' . $request;
|
$request_match = $req_uri . '/' . $request;
|
||||||
|
|
||||||
if ( preg_match("#^$match#", $request_match, $matches) ||
|
if ( preg_match("#^$match#", $request_match, $matches) ||
|
||||||
preg_match("#^$match#", urldecode($request_match), $matches) ) {
|
preg_match("#^$match#", urldecode($request_match), $matches) ) {
|
||||||
// Got a match.
|
// Got a match.
|
||||||
$this->matched_rule = $match;
|
$this->matched_rule = $match;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $this->matched_rule ) ) {
|
||||||
// Trim the query of everything up to the '?'.
|
// Trim the query of everything up to the '?'.
|
||||||
$query = preg_replace("!^.+\?!", '', $query);
|
$query = preg_replace("!^.+\?!", '', $query);
|
||||||
|
|
||||||
@ -213,26 +220,17 @@ class WP {
|
|||||||
|
|
||||||
// If we're processing a 404 request, clear the error var
|
// If we're processing a 404 request, clear the error var
|
||||||
// since we found something.
|
// since we found something.
|
||||||
if ( isset($_GET['error']) )
|
unset( $_GET['error'] );
|
||||||
unset($_GET['error']);
|
unset( $error );
|
||||||
|
|
||||||
if ( isset($error) )
|
|
||||||
unset($error);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If req_uri is empty or if it is a request for ourself, unset error.
|
// If req_uri is empty or if it is a request for ourself, unset error.
|
||||||
if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
|
if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
|
||||||
if ( isset($_GET['error']) )
|
unset( $_GET['error'] );
|
||||||
unset($_GET['error']);
|
unset( $error );
|
||||||
|
|
||||||
if ( isset($error) )
|
|
||||||
unset($error);
|
|
||||||
|
|
||||||
if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
|
if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
|
||||||
unset($perma_query_vars);
|
unset( $perma_query_vars );
|
||||||
|
|
||||||
$this->did_permalink = false;
|
$this->did_permalink = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user