From ece505b1227263c415e4984a802185e216060b73 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 29 Apr 2013 01:10:50 +0000 Subject: [PATCH] Remove redundant echo calls from list tables. Don't mix string concatenation with direct output. see #24210. git-svn-id: https://develop.svn.wordpress.org/trunk@24123 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ajax-actions.php | 2 +- .../includes/class-wp-comments-list-table.php | 2 +- wp-admin/includes/class-wp-list-table.php | 2 +- .../includes/class-wp-posts-list-table.php | 23 +++++++++++++------ .../includes/class-wp-terms-list-table.php | 23 ++++++++----------- wp-admin/includes/class-wp-upgrader.php | 2 +- .../includes/class-wp-users-list-table.php | 2 +- wp-admin/includes/theme-install.php | 2 +- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index a0ecf2bacb..8974ebf7a2 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1415,7 +1415,7 @@ function wp_ajax_inline_save_tax() { $parent = $parent_tag->parent; $level++; } - echo $wp_list_table->single_row( $tag, $level ); + $wp_list_table->single_row( $tag, $level ); wp_die(); } diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index bd04f09be1..af9896d255 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -315,7 +315,7 @@ class WP_Comments_List_Table extends WP_List_Table { $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); echo ""; - echo $this->single_row_columns( $comment ); + $this->single_row_columns( $comment ); echo "\n"; } diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 8c91c701da..22c35f5edc 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -826,7 +826,7 @@ class WP_List_Table { $row_class = ( $row_class == '' ? ' class="alternate"' : '' ); echo ''; - echo $this->single_row_columns( $item ); + $this->single_row_columns( $item ); echo ''; } diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index 2e90a0093a..139c983348 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -382,8 +382,10 @@ class WP_Posts_List_Table extends WP_List_Table { if ( $count >= $end ) break; - if ( $count >= $start ) - echo "\t" . $this->single_row( $page, $level ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $page, $level ); + } $count++; @@ -397,8 +399,12 @@ class WP_Posts_List_Table extends WP_List_Table { foreach ( $orphans as $op ) { if ( $count >= $end ) break; - if ( $count >= $start ) - echo "\t" . $this->single_row( $op, 0 ); + + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $op, 0 ); + } + $count++; } } @@ -444,13 +450,16 @@ class WP_Posts_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 ); + echo "\t"; + $this->single_row( $my_parent, $level - $num_parents ); $num_parents--; } } - if ( $count >= $start ) - echo "\t" . $this->single_row( $page, $level ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $page, $level ); + } $count++; diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index de8d8d32c1..59dcd3e4d5 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -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(); @@ -152,11 +151,11 @@ class WP_Terms_List_Table extends WP_List_Table { $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, 0, $taxonomy ); $count = $number; // Only displaying a single page. } @@ -165,8 +164,6 @@ class WP_Terms_List_Table extends WP_List_Table { echo ''; $this->no_items(); echo ''; - } else { - echo $out; } } @@ -174,7 +171,6 @@ class WP_Terms_List_Table extends WP_List_Table { $end = $start + $per_page; - $output = ''; foreach ( $terms as $key => $term ) { if ( $count >= $end ) @@ -199,23 +195,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, $taxonomy ); $num_parents--; } } - if ( $count >= $start ) - $output .= "\t" . $this->single_row( $term, $level, $taxonomy ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $term, $level, $taxonomy ); + } ++$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 +222,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 ''; } diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 98f8dc8fe4..c8815c04f2 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1129,7 +1129,7 @@ class WP_Upgrader_Skin { return; $this->done_header = true; echo '
'; - echo screen_icon(); + screen_icon(); echo '

' . $this->options['title'] . '

'; } function footer() { diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php index 3071fa97af..48c9c0c256 100644 --- a/wp-admin/includes/class-wp-users-list-table.php +++ b/wp-admin/includes/class-wp-users-list-table.php @@ -209,7 +209,7 @@ class WP_Users_List_Table extends WP_List_Table { continue; $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; - echo "\n\t", $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); + echo "\n\t" . $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); } } diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index 5d5191b38a..fd7a0adb61 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -153,7 +153,7 @@ add_action('install_themes_upload', 'install_themes_upload', 10, 1); function display_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4' ); global $wp_list_table; - return $wp_list_table->single_row( $theme ); + $wp_list_table->single_row( $theme ); } /**