Eliminate the use of `extract()` in `WP_Tax_Query::get_sql()`. All unit tests still pass.

See #22400.

Built from https://develop.svn.wordpress.org/trunk@28422


git-svn-id: http://core.svn.wordpress.org/trunk@28249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-15 05:41:14 +00:00
parent e6fad96f5e
commit 80a37d2fcd
1 changed files with 13 additions and 8 deletions

View File

@ -738,17 +738,20 @@ class WP_Tax_Query {
foreach ( $this->queries as $index => $query ) {
$this->clean_query( $query );
if ( is_wp_error( $query ) )
if ( is_wp_error( $query ) ) {
return self::$no_results;
}
extract( $query );
$terms = $query['terms'];
$operator = $query['operator'];
if ( 'IN' == $operator ) {
if ( empty( $terms ) ) {
if ( 'OR' == $this->relation ) {
if ( ( $index + 1 === $count ) && empty( $where ) )
if ( ( $index + 1 === $count ) && empty( $where ) ) {
return self::$no_results;
}
continue;
} else {
return self::$no_results;
@ -766,8 +769,9 @@ class WP_Tax_Query {
$where[] = "$alias.term_taxonomy_id $operator ($terms)";
} elseif ( 'NOT IN' == $operator ) {
if ( empty( $terms ) )
if ( empty( $terms ) ) {
continue;
}
$terms = implode( ',', $terms );
@ -778,8 +782,9 @@ class WP_Tax_Query {
)";
} elseif ( 'AND' == $operator ) {
if ( empty( $terms ) )
if ( empty( $terms ) ) {
continue;
}
$num_terms = count( $terms );
@ -796,11 +801,11 @@ class WP_Tax_Query {
$i++;
}
if ( ! empty( $where ) )
if ( ! empty( $where ) ) {
$where = ' AND ( ' . implode( " $this->relation ", $where ) . ' )';
else
} else {
$where = '';
}
return compact( 'join', 'where' );
}