WP_Query whitespace cleanup, some loop cleanup as well

git-svn-id: https://develop.svn.wordpress.org/trunk@14401 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-05-03 20:19:13 +00:00
parent 54c73c0c2b
commit aa7c1d8a41
1 changed files with 62 additions and 63 deletions

View File

@ -1545,7 +1545,7 @@ class WP_Query {
$this->init_query_flags();
$this->is_404 = true;
$this->is_feed = $is_feed;
//$this->is_feed = $is_feed;
}
/**
@ -1558,9 +1558,8 @@ class WP_Query {
* @return mixed
*/
function get($query_var) {
if (isset($this->query_vars[$query_var])) {
if ( isset($this->query_vars[$query_var]) )
return $this->query_vars[$query_var];
}
return '';
}
@ -2046,23 +2045,23 @@ class WP_Query {
if ( empty($q['author']) || ($q['author'] == '0') ) {
$whichauthor = '';
} else {
$q['author'] = ''.urldecode($q['author']).'';
$q['author'] = (string)urldecode($q['author']);
$q['author'] = addslashes_gpc($q['author']);
if ( strpos($q['author'], '-') !== false ) {
$eq = '!=';
$andor = 'AND';
$q['author'] = explode('-', $q['author']);
$q['author'] = '' . absint($q['author'][1]);
$q['author'] = (string)absint($q['author'][1]);
} else {
$eq = '=';
$andor = 'OR';
}
$author_array = preg_split('/[,\s]+/', $q['author']);
$whichauthor .= " AND ($wpdb->posts.post_author ".$eq.' '.absint($author_array[0]);
for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
$whichauthor .= ' '.$andor." $wpdb->posts.post_author ".$eq.' '.absint($author_array[$i]);
}
$whichauthor .= ')';
$_author_array = array();
foreach ( $author_array as $key => $_author )
$_author_array[] = "$wpdb->posts.post_author " . $eq . ' ' . absint($_author);
$whichauthor .= ' AND (' . implode(" $andor ", $_author_array) . ')';
unset($author_array, $_author_array);
}
// Author stuff for nice URLs