Add parse_query_vars() and parse_query action.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2005-02-01 08:34:19 +00:00
parent dc140e66c8
commit e9c621df15
1 changed files with 17 additions and 4 deletions

View File

@ -56,11 +56,20 @@ class WP_Query {
$this->current_post = -1; $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) { function parse_query ($query) {
$this->init(); if ( !empty($query) || !isset($this->query) ) {
parse_str($query, $qv); $this->init();
$this->query = $query; parse_str($query, $qv);
$this->query_vars = $qv; $this->query = $query;
$this->query_vars = $qv;
}
$qv['m'] = (int) $qv['m']; $qv['m'] = (int) $qv['m'];
$qv['p'] = (int) $qv['p']; $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)) { 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; $this->is_home = true;
} }
if ( !empty($query) ) {
do_action('parse_query', array(&$this));
}
} }
function get($query_var) { function get($query_var) {