Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in `wp-admin/includes/class-w…
Browse files Browse the repository at this point in the history
…p-posts-list-table.php`.

Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50804 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed May 3, 2021
1 parent 984c194 commit 1415ac7
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 38 deletions.
4 changes: 3 additions & 1 deletion src/wp-admin/includes/class-wp-comments-list-table.php
Expand Up @@ -413,7 +413,9 @@ protected function extra_tablenav( $which ) {
}
}

if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) {
if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items
&& current_user_can( 'moderate_comments' )
) {
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
$title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
submit_button( $title, 'apply', 'delete_all', false );
Expand Down
12 changes: 11 additions & 1 deletion src/wp-admin/includes/class-wp-media-list-table.php
Expand Up @@ -171,6 +171,7 @@ protected function get_views() {
*/
protected function get_bulk_actions() {
$actions = array();

if ( MEDIA_TRASH ) {
if ( $this->is_trash ) {
$actions['untrash'] = __( 'Restore' );
Expand Down Expand Up @@ -208,7 +209,9 @@ protected function extra_tablenav( $which ) {

submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );

if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
if ( $this->is_trash && $this->has_items()
&& current_user_can( 'edit_others_posts' )
) {
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
}
?>
Expand Down Expand Up @@ -336,6 +339,7 @@ public function get_columns() {
} else {
$column_key = 'taxonomy-' . $taxonomy;
}

$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
}

Expand All @@ -346,8 +350,10 @@ public function get_columns() {
$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
}
}

/* translators: Column name. */
$posts_columns['date'] = _x( 'Date', 'column name' );

/**
* Filters the Media list table columns.
*
Expand Down Expand Up @@ -424,12 +430,15 @@ public function column_title( $post ) {
<strong<?php echo $class; ?>>
<?php
echo $link_start;

if ( $thumb ) :
?>
<span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span>
<?php
endif;

echo $title . $link_end;

_media_states( $post );
?>
</strong>
Expand Down Expand Up @@ -598,6 +607,7 @@ public function column_default( $post, $column_name ) {

if ( $taxonomy ) {
$terms = get_the_terms( $post->ID, $taxonomy );

if ( is_array( $terms ) ) {
$out = array();
foreach ( $terms as $t ) {
Expand Down

0 comments on commit 1415ac7

Please sign in to comment.