*
* @since 2.0.0
*
+ * @global WP_Rewrite $wp_rewrite
+ *
* @param array|string $extra_query_vars Set the extra query variables.
*/
public function parse_request($extra_query_vars = '') {
list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
$self = $_SERVER['PHP_SELF'];
$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
+ $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
// Trim path info from the end and the leading home path from the
// front. For path info requests, this leaves us with the requesting
// requested permalink.
$req_uri = str_replace($pathinfo, '', $req_uri);
$req_uri = trim($req_uri, '/');
- $req_uri = preg_replace("|^$home_path|i", '', $req_uri);
+ $req_uri = preg_replace( $home_path_regex, '', $req_uri );
$req_uri = trim($req_uri, '/');
$pathinfo = trim($pathinfo, '/');
- $pathinfo = preg_replace("|^$home_path|i", '', $pathinfo);
+ $pathinfo = preg_replace( $home_path_regex, '', $pathinfo );
$pathinfo = trim($pathinfo, '/');
$self = trim($self, '/');
- $self = preg_replace("|^$home_path|i", '', $self);
+ $self = preg_replace( $home_path_regex, '', $self );
$self = trim($self, '/');
// The requested permalink is in $pathinfo for path info requests and
}
}
+ // Resolve conflicts between posts with numeric slugs and date archive queries.
+ $this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars );
+
foreach ( (array) $this->private_query_vars as $var) {
if ( isset($this->extra_query_vars[$var]) )
$this->query_vars[$var] = $this->extra_query_vars[$var];
* be taken when naming global variables that might interfere with the
* WordPress environment.
*
- * @global string $query_string Query string for the loop.
- * @global array $posts The found posts.
+ * @global WP_Query $wp_query
+ * @global string $query_string Query string for the loop.
+ * @global array $posts The found posts.
* @global WP_Post|null $post The current post, if available.
- * @global string $request The SQL statement for the request.
- * @global int $more Only set, if single page or post.
- * @global int $single If single page or post. Only set, if single page or post.
- * @global WP_User $authordata Only set, if author archive.
+ * @global string $request The SQL statement for the request.
+ * @global int $more Only set, if single page or post.
+ * @global int $single If single page or post. Only set, if single page or post.
+ * @global WP_User $authordata Only set, if author archive.
*
* @since 2.0.0
*/
* Set up the Loop based on the query variables.
*
* @since 2.0.0
+ *
+ * @global WP_Query $wp_the_query
*/
public function query_posts() {
global $wp_the_query;
* Otherwise, issue a 200.
*
* @since 2.0.0
+ *
+ * @global WP_Query $wp_query
*/
public function handle_404() {
global $wp_query;
*/
do_action_ref_array( 'wp', array( &$this ) );
}
-
}
/**
*
* static helper function to ease use
*
+ * @static
* @access public
+ *
* @param string $subject subject
* @param array $matches data used for substitution
* @return string
$index = intval(substr($matches[0], 9, -1));
return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
}
-
}