From e9c621df152f2cfd51d52fc0b13f18a5e043daf5 Mon Sep 17 00:00:00 2001 From: rboren Date: Tue, 1 Feb 2005 08:34:19 +0000 Subject: [PATCH] Add parse_query_vars() and parse_query action. git-svn-id: http://svn.automattic.com/wordpress/trunk@2190 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/classes.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 7eaf2159ce..ba3b760e4f 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -56,11 +56,20 @@ class WP_Query { $this->current_post = -1; } + // Reparse the query vars. + function parse_query_vars() { + $this->parse_query(''); + } + + // Parse a query string and set query type booleans. function parse_query ($query) { - $this->init(); - parse_str($query, $qv); - $this->query = $query; - $this->query_vars = $qv; + if ( !empty($query) || !isset($this->query) ) { + $this->init(); + parse_str($query, $qv); + $this->query = $query; + $this->query_vars = $qv; + } + $qv['m'] = (int) $qv['m']; $qv['p'] = (int) $qv['p']; @@ -185,6 +194,10 @@ class WP_Query { if ( ! ($this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin)) { $this->is_home = true; } + + if ( !empty($query) ) { + do_action('parse_query', array(&$this)); + } } function get($query_var) {