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
This commit is contained in:
parent
aef35fe6a2
commit
9476cd33a3
|
@ -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 '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
|
||||
$this->no_items();
|
||||
echo '</td></tr>';
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue