diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/includes/class-wp-media-list-table.php
--- a/wp/wp-admin/includes/class-wp-media-list-table.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/class-wp-media-list-table.php Wed Sep 21 18:19:35 2022 +0200
@@ -71,9 +71,11 @@
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
- // Exclude attachments scheduled for deletion in the next two hours
- // if they are for zip packages for interrupted or failed updates.
- // See File_Upload_Upgrader class.
+ /*
+ * Exclude attachments scheduled for deletion in the next two hours
+ * if they are for zip packages for interrupted or failed updates.
+ * See File_Upload_Upgrader class.
+ */
$not_in = array();
foreach ( _get_cron_array() as $cron ) {
@@ -169,6 +171,7 @@
*/
protected function get_bulk_actions() {
$actions = array();
+
if ( MEDIA_TRASH ) {
if ( $this->is_trash ) {
$actions['untrash'] = __( 'Restore' );
@@ -196,20 +199,22 @@
}
?>
- is_trash ) {
- $this->months_dropdown( 'attachment' );
- }
+ is_trash ) {
+ $this->months_dropdown( 'attachment' );
+ }
+
+ /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
+ do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
- /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
- do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
-
- submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+ submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
- if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
- submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
- }
- ?>
+ if ( $this->is_trash && $this->has_items()
+ && current_user_can( 'edit_others_posts' )
+ ) {
+ submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
+ }
+ ?>
screen->render_screen_reader_content( 'heading_views' );
?>
-
-
- view_switcher( $mode ); ?>
+
+
+ view_switcher( $mode ); ?>
-
-
- $view ) {
- echo "\t$view\n";
- }
- }
- ?>
-
+
+
+ $view ) {
+ echo "\t$view\n";
+ }
+ }
+ ?>
+
- extra_tablenav( 'bar' );
+ extra_tablenav( 'bar' );
- /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
- $views = apply_filters( "views_{$this->screen->id}", array() );
+ /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
+ $views = apply_filters( "views_{$this->screen->id}", array() );
- // Back compat for pre-4.0 view links.
- if ( ! empty( $views ) ) {
- echo '
';
- foreach ( $views as $class => $view ) {
- echo "$view ";
- }
- echo ' ';
- }
- ?>
-
+ // Back compat for pre-4.0 view links.
+ if ( ! empty( $views ) ) {
+ echo '
';
+ foreach ( $views as $class => $view ) {
+ echo "$view ";
+ }
+ echo ' ';
+ }
+ ?>
+
-
-
-
-
+
+
+
+
+
labels->name;
}
@@ -343,8 +350,10 @@
$posts_columns['comments'] = '';
}
}
+
/* translators: Column name. */
$posts_columns['date'] = _x( 'Date', 'column name' );
+
/**
* Filters the Media list table columns.
*
@@ -421,12 +430,15 @@
>
@@ -512,14 +524,9 @@
$parent_type = get_post_type_object( $parent->post_type );
if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
- ?>
-
-
- %s ', get_edit_post_link( $post->post_parent ), $title );
} elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
- ?>
-
- %s', $title );
} else {
_e( '(Private post)' );
}
@@ -600,6 +607,7 @@
if ( $taxonomy ) {
$terms = get_the_terms( $post->ID, $taxonomy );
+
if ( is_array( $terms ) ) {
$out = array();
foreach ( $terms as $t ) {
@@ -614,7 +622,7 @@
);
}
/* translators: Used between list items, there is a space after the comma. */
- echo join( __( ', ' ), $out );
+ echo implode( __( ', ' ), $out );
} else {
echo '— ' . get_taxonomy( $taxonomy )->labels->no_terms . ' ';
}
@@ -650,13 +658,14 @@
while ( have_posts() ) :
the_post();
- if (
- ( $this->is_trash && 'trash' !== $post->post_status )
- || ( ! $this->is_trash && 'trash' === $post->post_status )
+
+ 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 ); ?>
@@ -694,6 +703,7 @@
__( 'Edit' )
);
}
+
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
$actions['trash'] = sprintf(
@@ -715,6 +725,7 @@
);
}
}
+
$actions['view'] = sprintf(
'%s ',
get_permalink( $post->ID ),
@@ -742,6 +753,7 @@
__( 'Edit' )
);
}
+
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( $this->is_trash ) {
$actions['untrash'] = sprintf(
@@ -760,6 +772,7 @@
_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(
@@ -772,6 +785,7 @@
);
}
}
+
if ( ! $this->is_trash ) {
$actions['view'] = sprintf(
'%s ',
@@ -802,9 +816,9 @@
*
* @since 4.3.0
*
- * @param object $post Attachment being acted upon.
- * @param string $column_name Current column name.
- * @param string $primary Primary column name.
+ * @param WP_Post $post Attachment being acted upon.
+ * @param string $column_name Current column name.
+ * @param string $primary Primary column name.
* @return string Row actions output for media attachments, or an empty string
* if the current column is not the primary column.
*/