From 9476cd33a33b681ce4a05eee6814de0a6ec8d972 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 13 May 2014 05:37:14 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@28390 git-svn-id: http://core.svn.wordpress.org/trunk@28218 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-terms-list-table.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index 887cf56f00..bff36ce99d 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -154,41 +154,41 @@ class WP_Terms_List_Table extends WP_List_Table { 'hide_empty' => 0 ) ); - extract( $args, EXTR_SKIP ); + $page = $args['page']; + // set variable because $args['number'] can be subsequently overridden + $number = $args['number']; $args['offset'] = $offset = ( $page - 1 ) * $number; // convert it to table rows $count = 0; - $terms = array(); - - if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) { + if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { // We'll need the full set of terms then. $args['number'] = $args['offset'] = 0; } $terms = get_terms( $taxonomy, $args ); if ( empty( $terms ) ) { - list( $columns, $hidden ) = $this->get_column_info(); echo ''; $this->no_items(); echo ''; return; } - if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) { - if ( !empty( $search ) ) // Ignore children on searches. + if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { + if ( ! empty( $args['search'] ) ) {// Ignore children on searches. $children = array(); - else + } else { $children = _get_term_hierarchy( $taxonomy ); - + } // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); } else { $terms = get_terms( $taxonomy, $args ); - foreach ( $terms as $term ) + foreach ( $terms as $term ) { $this->single_row( $term ); + } $count = $number; // Only displaying a single page. } }