Terms list table:

* Don't call single_row() with an undeclared and unused $taxonomy argument.
 * Don't define optional parameters before required parameters in the _rows() method. Make them required.
 * Move empty( $terms ) check above other operations. This function was improperly returning an else case until [24123].

props rlerdorf.
see #24210.



git-svn-id: http://core.svn.wordpress.org/trunk@24127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-04-29 13:39:28 +00:00
parent 92b4636e17
commit 2ea564da8b

View File

@ -143,8 +143,18 @@ class WP_Terms_List_Table extends WP_List_Table {
if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) {
// We'll need the full set of terms then.
$args['number'] = $args['offset'] = 0;
}
$terms = get_terms( $taxonomy, $args );
$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.
$children = array();
else
@ -155,19 +165,12 @@ class WP_Terms_List_Table extends WP_List_Table {
} else {
$terms = get_terms( $taxonomy, $args );
foreach ( $terms as $term )
$this->single_row( $term, 0, $taxonomy );
$this->single_row( $term );
$count = $number; // Only displaying a single page.
}
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>';
}
}
function _rows( $taxonomy, $terms, &$children, $start = 0, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
$end = $start + $per_page;
@ -196,14 +199,14 @@ class WP_Terms_List_Table extends WP_List_Table {
$num_parents = count( $my_parents );
while ( $my_parent = array_pop( $my_parents ) ) {
echo "\t";
$this->single_row( $my_parent, $level - $num_parents, $taxonomy );
$this->single_row( $my_parent, $level - $num_parents );
$num_parents--;
}
}
if ( $count >= $start ) {
echo "\t";
$this->single_row( $term, $level, $taxonomy );
$this->single_row( $term, $level );
}
++$count;