Make WordPress Core

Changeset 28422


Ignore:
Timestamp:
05/15/2014 05:40:40 AM (12 years ago)
Author:
wonderboymusic
Message:

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

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r28421 r28422  
    739739                        $this->clean_query( $query );
    740740
    741                         if ( is_wp_error( $query ) )
     741                        if ( is_wp_error( $query ) ) {
    742742                                return self::$no_results;
    743 
    744                         extract( $query );
     743                        }
     744
     745                        $terms = $query['terms'];
     746                        $operator = $query['operator'];
    745747
    746748                        if ( 'IN' == $operator ) {
    … …  
    748750                                if ( empty( $terms ) ) {
    749751                                        if ( 'OR' == $this->relation ) {
    750                                                 if ( ( $index + 1 === $count ) && empty( $where ) )
     752                                                if ( ( $index + 1 === $count ) && empty( $where ) ) {
    751753                                                        return self::$no_results;
     754                                                }
    752755                                                continue;
    753756                                        } else {
    … …  
    767770                        } elseif ( 'NOT IN' == $operator ) {
    768771
    769                                 if ( empty( $terms ) )
     772                                if ( empty( $terms ) ) {
    770773                                        continue;
     774                                }
    771775
    772776                                $terms = implode( ',', $terms );
    … …  
    779783                        } elseif ( 'AND' == $operator ) {
    780784
    781                                 if ( empty( $terms ) )
     785                                if ( empty( $terms ) ) {
    782786                                        continue;
     787                                }
    783788
    784789                                $num_terms = count( $terms );
    … …  
    797802                }
    798803
    799                 if ( ! empty( $where ) )
     804                if ( ! empty( $where ) ) {
    800805                        $where = ' AND ( ' . implode( " $this->relation ", $where ) . ' )';
    801                 else
     806                } else {
    802807                        $where = '';
    803 
     808                }
    804809                return compact( 'join', 'where' );
    805810        }
Note: See TracChangeset for help on using the changeset viewer.