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-media-list-table.php`.

Includes minor code layout fixes for better readability.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50770 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Apr 19, 2021
1 parent 2d7b7dd commit c072116
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/wp-admin/includes/class-wp-media-list-table.php
Expand Up @@ -648,12 +648,14 @@ public function display_rows() {

while ( have_posts() ) :
the_post();

if ( $this->is_trash && 'trash' !== $post->post_status
|| ! $this->is_trash && 'trash' === $post->post_status
) {
continue;
}
$post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';

$post_owner = ( get_current_user_id() === (int) $post->post_author ) ? 'self' : 'other';
?>
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
<?php $this->single_row_columns( $post ); ?>
Expand Down Expand Up @@ -691,6 +693,7 @@ private function _get_row_actions( $post, $att_title ) {
__( 'Edit' )
);
}

if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
$actions['trash'] = sprintf(
Expand All @@ -712,6 +715,7 @@ private function _get_row_actions( $post, $att_title ) {
);
}
}

$actions['view'] = sprintf(
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
get_permalink( $post->ID ),
Expand Down Expand Up @@ -739,6 +743,7 @@ private function _get_row_actions( $post, $att_title ) {
__( 'Edit' )
);
}

if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( $this->is_trash ) {
$actions['untrash'] = sprintf(
Expand All @@ -757,6 +762,7 @@ private function _get_row_actions( $post, $att_title ) {
_x( 'Trash', 'verb' )
);
}

if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) {
$delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
$actions['delete'] = sprintf(
Expand All @@ -769,6 +775,7 @@ private function _get_row_actions( $post, $att_title ) {
);
}
}

if ( ! $this->is_trash ) {
$actions['view'] = sprintf(
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
Expand Down

0 comments on commit c072116

Please sign in to comment.