From c072116d6aa3f182e6d91dea19ce76c59f7d16d5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 19 Apr 2021 11:39:54 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-admin/includes/class-wp-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 --- src/wp-admin/includes/class-wp-media-list-table.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 3634c304998e..872591b3122c 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -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'; ?> single_row_columns( $post ); ?> @@ -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( @@ -712,6 +715,7 @@ private function _get_row_actions( $post, $att_title ) { ); } } + $actions['view'] = sprintf( '%s', get_permalink( $post->ID ), @@ -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( @@ -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( @@ -769,6 +775,7 @@ private function _get_row_actions( $post, $att_title ) { ); } } + if ( ! $this->is_trash ) { $actions['view'] = sprintf( '%s',