diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-09-26 15:45:20 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-09-26 15:45:20 +0000 |
commit | 28781ebb081ab8d99b30a33f5cd911b3b050bcc9 (patch) | |
tree | f21e6b7d3dd06002c58dd52ae2eae10d64d62d85 /wp-includes/query.php | |
parent | cbd939114d362bfece3839d7d5d5e07367fd6be8 (diff) | |
download | wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.gz wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.tar.xz wordpress-mu-28781ebb081ab8d99b30a33f5cd911b3b050bcc9.zip |
WP Merge to rev 4254
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@770 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/query.php')
-rw-r--r-- | wp-includes/query.php | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/wp-includes/query.php b/wp-includes/query.php index 689b27f..c1b88ec 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -329,6 +329,44 @@ class WP_Query { function parse_query_vars() {
$this->parse_query('');
}
+
+ function fill_query_vars($array) {
+ $keys = array(
+ 'error'
+ , 'm'
+ , 'p'
+ , 'subpost'
+ , 'subpost_id'
+ , 'attachment'
+ , 'attachment_id'
+ , 'name'
+ , 'hour'
+ , 'static'
+ , 'pagename'
+ , 'page_id'
+ , 'second'
+ , 'minute'
+ , 'hour'
+ , 'day'
+ , 'monthnum'
+ , 'year'
+ , 'w'
+ , 'category_name'
+ , 'author_name'
+ , 'feed'
+ , 'tb'
+ , 'paged'
+ , 'comments_popup'
+ , 'preview'
+ );
+
+ foreach ($keys as $key) {
+ if ( !isset($array[$key]))
+ $array[$key] = '';
+ }
+
+ return $array;
+ }
// Parse a query string and set query type booleans.
function parse_query ($query) {
@@ -341,7 +379,9 @@ class WP_Query { $this->query = $query;
$this->query_vars = $qv;
}
-
+
+ $qv = $this->fill_query_vars($qv);
+
if ( ! empty($qv['robots']) ) {
$this->is_robots = true;
return;
@@ -530,6 +570,8 @@ class WP_Query { // Shorthand.
$q = &$this->query_vars;
+
+ $q = $this->fill_query_vars($q);
// First let's clear some variables
$distinct = '';
@@ -540,6 +582,7 @@ class WP_Query { $where = '';
$limits = '';
$join = '';
+ $search = '';
if ( !isset($q['post_type']) )
$q['post_type'] = 'post';
@@ -909,12 +952,12 @@ class WP_Query { }
if (($q['what_to_show'] == 'posts')) {
- $q['offset'] = abs(intval($q['offset']));
if ( empty($q['offset']) ) {
$pgstrt = '';
$pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
} else { // we're ignoring $page and using 'offset'
+ $q['offset'] = abs(intval($q['offset']));
$pgstrt = $q['offset'] . ', ';
$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
}
|