Make WordPress Core

Changeset 28390


Ignore:
Timestamp:
05/13/2014 05:36:22 AM (13 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in WP_Terms_List_Table::display_rows_or_placeholder():

  • Set variables for $page and $number
  • list(...) = $this->get_column_info() can be removed, as none of the variables returned are used.
  • orderby and search can be checked from $args, leaving no reason to extract

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r28360 r28390  
    155155                ) );
    156156
    157                 extract( $args, EXTR_SKIP );
     157                $page = $args['page'];
     158                // set variable because $args['number'] can be subsequently overridden
     159                $number = $args['number'];
    158160
    159161                $args['offset'] = $offset = ( $page - 1 ) * $number;
    … …  
    162164                $count = 0;
    163165
    164                 $terms = array();
    165 
    166                 if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) {
     166                if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
    167167                        // We'll need the full set of terms then.
    168168                        $args['number'] = $args['offset'] = 0;
    … …  
    171171
    172172                if ( empty( $terms ) ) {
    173                         list( $columns, $hidden ) = $this->get_column_info();
    174173                        echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
    175174                        $this->no_items();
    … …  
    178177                }
    179178
    180                 if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) {
    181                         if ( !empty( $search ) ) // Ignore children on searches.
     179                if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
     180                        if ( ! empty( $args['search'] ) ) {// Ignore children on searches.
    182181                                $children = array();
    183                         else
     182                        } else {
    184183                                $children = _get_term_hierarchy( $taxonomy );
    185 
     184                        }
    186185                        // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake
    187186                        $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
    188187                } else {
    189188                        $terms = get_terms( $taxonomy, $args );
    190                         foreach ( $terms as $term )
     189                        foreach ( $terms as $term ) {
    191190                                $this->single_row( $term );
     191                        }
    192192                        $count = $number; // Only displaying a single page.
    193193                }
Note: See TracChangeset for help on using the changeset viewer.