Remove redundant echo calls from list tables. Don't mix string concatenation with direct output. see #24210.

git-svn-id: http://core.svn.wordpress.org/trunk@24123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-04-29 01:10:50 +00:00
parent 93b0b5c32c
commit dace3f0b6d
8 changed files with 32 additions and 26 deletions

View File

@ -1415,7 +1415,7 @@ function wp_ajax_inline_save_tax() {
$parent = $parent_tag->parent; $parent = $parent_tag->parent;
$level++; $level++;
} }
echo $wp_list_table->single_row( $tag, $level ); $wp_list_table->single_row( $tag, $level );
wp_die(); wp_die();
} }

View File

@ -315,7 +315,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>"; echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
echo $this->single_row_columns( $comment ); $this->single_row_columns( $comment );
echo "</tr>\n"; echo "</tr>\n";
} }

View File

@ -826,7 +826,7 @@ class WP_List_Table {
$row_class = ( $row_class == '' ? ' class="alternate"' : '' ); $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
echo '<tr' . $row_class . '>'; echo '<tr' . $row_class . '>';
echo $this->single_row_columns( $item ); $this->single_row_columns( $item );
echo '</tr>'; echo '</tr>';
} }

View File

@ -382,8 +382,10 @@ class WP_Posts_List_Table extends WP_List_Table {
if ( $count >= $end ) if ( $count >= $end )
break; break;
if ( $count >= $start ) if ( $count >= $start ) {
echo "\t" . $this->single_row( $page, $level ); echo "\t";
$this->single_row( $page, $level );
}
$count++; $count++;
@ -397,8 +399,12 @@ class WP_Posts_List_Table extends WP_List_Table {
foreach ( $orphans as $op ) { foreach ( $orphans as $op ) {
if ( $count >= $end ) if ( $count >= $end )
break; break;
if ( $count >= $start )
echo "\t" . $this->single_row( $op, 0 ); if ( $count >= $start ) {
echo "\t";
$this->single_row( $op, 0 );
}
$count++; $count++;
} }
} }
@ -444,13 +450,16 @@ class WP_Posts_List_Table extends WP_List_Table {
} }
$num_parents = count( $my_parents ); $num_parents = count( $my_parents );
while ( $my_parent = array_pop( $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--; $num_parents--;
} }
} }
if ( $count >= $start ) if ( $count >= $start ) {
echo "\t" . $this->single_row( $page, $level ); echo "\t";
$this->single_row( $page, $level );
}
$count++; $count++;

View File

@ -136,7 +136,6 @@ class WP_Terms_List_Table extends WP_List_Table {
$args['offset'] = $offset = ( $page - 1 ) * $number; $args['offset'] = $offset = ( $page - 1 ) * $number;
// convert it to table rows // convert it to table rows
$out = '';
$count = 0; $count = 0;
$terms = array(); $terms = array();
@ -152,11 +151,11 @@ class WP_Terms_List_Table extends WP_List_Table {
$children = _get_term_hierarchy( $taxonomy ); $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 // 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 { } else {
$terms = get_terms( $taxonomy, $args ); $terms = get_terms( $taxonomy, $args );
foreach ( $terms as $term ) foreach ( $terms as $term )
$out .= $this->single_row( $term, 0, $taxonomy ); $this->single_row( $term, 0, $taxonomy );
$count = $number; // Only displaying a single page. $count = $number; // Only displaying a single page.
} }
@ -165,8 +164,6 @@ class WP_Terms_List_Table extends WP_List_Table {
echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">'; echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
$this->no_items(); $this->no_items();
echo '</td></tr>'; echo '</td></tr>';
} else {
echo $out;
} }
} }
@ -174,7 +171,6 @@ class WP_Terms_List_Table extends WP_List_Table {
$end = $start + $per_page; $end = $start + $per_page;
$output = '';
foreach ( $terms as $key => $term ) { foreach ( $terms as $key => $term ) {
if ( $count >= $end ) if ( $count >= $end )
@ -199,23 +195,24 @@ class WP_Terms_List_Table extends WP_List_Table {
$num_parents = count( $my_parents ); $num_parents = count( $my_parents );
while ( $my_parent = array_pop( $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--; $num_parents--;
} }
} }
if ( $count >= $start ) if ( $count >= $start ) {
$output .= "\t" . $this->single_row( $term, $level, $taxonomy ); echo "\t";
$this->single_row( $term, $level, $taxonomy );
}
++$count; ++$count;
unset( $terms[$key] ); unset( $terms[$key] );
if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) ) 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 ) { function single_row( $tag, $level = 0 ) {
@ -225,7 +222,7 @@ class WP_Terms_List_Table extends WP_List_Table {
$this->level = $level; $this->level = $level;
echo '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>'; echo '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
echo $this->single_row_columns( $tag ); $this->single_row_columns( $tag );
echo '</tr>'; echo '</tr>';
} }

View File

@ -1129,7 +1129,7 @@ class WP_Upgrader_Skin {
return; return;
$this->done_header = true; $this->done_header = true;
echo '<div class="wrap">'; echo '<div class="wrap">';
echo screen_icon(); screen_icon();
echo '<h2>' . $this->options['title'] . '</h2>'; echo '<h2>' . $this->options['title'] . '</h2>';
} }
function footer() { function footer() {

View File

@ -209,7 +209,7 @@ class WP_Users_List_Table extends WP_List_Table {
continue; continue;
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; $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 );
} }
} }

View File

@ -153,7 +153,7 @@ add_action('install_themes_upload', 'install_themes_upload', 10, 1);
function display_theme( $theme ) { function display_theme( $theme ) {
_deprecated_function( __FUNCTION__, '3.4' ); _deprecated_function( __FUNCTION__, '3.4' );
global $wp_list_table; global $wp_list_table;
return $wp_list_table->single_row( $theme ); $wp_list_table->single_row( $theme );
} }
/** /**