Make WordPress Core

Changeset 24127


Ignore:
Timestamp:
04/29/2013 01:39:28 PM (10 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

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

    r24123 r24127  
    144144            // We'll need the full set of terms then.
    145145            $args['number'] = $args['offset'] = 0;
    146 
    147             $terms = get_terms( $taxonomy, $args );
     146        }
     147        $terms = get_terms( $taxonomy, $args );
     148
     149        if ( empty( $terms ) ) {
     150            list( $columns, $hidden ) = $this->get_column_info();
     151            echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
     152            $this->no_items();
     153            echo '</td></tr>';
     154            return;
     155        }
     156
     157        if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) {
    148158            if ( !empty( $search ) ) // Ignore children on searches.
    149159                $children = array();
     
    156166            $terms = get_terms( $taxonomy, $args );
    157167            foreach ( $terms as $term )
    158                 $this->single_row( $term, 0, $taxonomy );
     168                $this->single_row( $term );
    159169            $count = $number; // Only displaying a single page.
    160170        }
    161 
    162         if ( empty( $terms ) ) {
    163             list( $columns, $hidden ) = $this->get_column_info();
    164             echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
    165             $this->no_items();
    166             echo '</td></tr>';
    167         }
    168     }
    169 
    170     function _rows( $taxonomy, $terms, &$children, $start = 0, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
     171    }
     172
     173    function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
    171174
    172175        $end = $start + $per_page;
     
    197200                while ( $my_parent = array_pop( $my_parents ) ) {
    198201                    echo "\t";
    199                     $this->single_row( $my_parent, $level - $num_parents, $taxonomy );
     202                    $this->single_row( $my_parent, $level - $num_parents );
    200203                    $num_parents--;
    201204                }
     
    204207            if ( $count >= $start ) {
    205208                echo "\t";
    206                 $this->single_row( $term, $level, $taxonomy );
     209                $this->single_row( $term, $level );
    207210            }
    208211
Note: See TracChangeset for help on using the changeset viewer.