X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-admin/includes/class-wp-terms-list-table.php diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index 85010105..eef7ccfd 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -52,7 +52,7 @@ class WP_Terms_List_Table extends WP_List_Table { $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter } - $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : ''; + $search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; $args = array( 'search' => $search, @@ -61,10 +61,10 @@ class WP_Terms_List_Table extends WP_List_Table { ); if ( !empty( $_REQUEST['orderby'] ) ) - $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) ); + $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); if ( !empty( $_REQUEST['order'] ) ) - $args['order'] = trim( stripslashes( $_REQUEST['order'] ) ); + $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); $this->callback_args = $args; @@ -136,7 +136,6 @@ class WP_Terms_List_Table extends WP_List_Table { $args['offset'] = $offset = ( $page - 1 ) * $number; // convert it to table rows - $out = ''; $count = 0; $terms = array(); @@ -144,37 +143,37 @@ 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 ''; + $this->no_items(); + echo ''; + return; + } + + if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) { if ( !empty( $search ) ) // Ignore children on searches. $children = array(); 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 - $out .= $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); + $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); } else { $terms = get_terms( $taxonomy, $args ); foreach ( $terms as $term ) - $out .= $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 ''; - $this->no_items(); - echo ''; - } else { - echo $out; - } } - 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; - $output = ''; foreach ( $terms as $key => $term ) { if ( $count >= $end ) @@ -199,23 +198,24 @@ class WP_Terms_List_Table extends WP_List_Table { $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { - $output .= "\t" . $this->single_row( $my_parent, $level - $num_parents, $taxonomy ); + echo "\t"; + $this->single_row( $my_parent, $level - $num_parents ); $num_parents--; } } - if ( $count >= $start ) - $output .= "\t" . $this->single_row( $term, $level, $taxonomy ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $term, $level ); + } ++$count; unset( $terms[$key] ); if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) ) - $output .= $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); + $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); } - - return $output; } function single_row( $tag, $level = 0 ) { @@ -225,7 +225,7 @@ class WP_Terms_List_Table extends WP_List_Table { $this->level = $level; echo ''; - echo $this->single_row_columns( $tag ); + $this->single_row_columns( $tag ); echo ''; } @@ -361,9 +361,8 @@ class WP_Terms_List_Table extends WP_List_Table { ?>

- - labels->update_item; ?> - + + labels->update_item; ?>