Add parse_query_vars() and parse_query action.

git-svn-id: https://develop.svn.wordpress.org/trunk@2190 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-02-01 08:34:19 +00:00
parent 22f48d88c0
commit c336926a96
1 changed files with 17 additions and 4 deletions

View File

@ -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) {