X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..5d244c8fd9a27c9f89dd08da2af6fbc67d4fce63:/wp-admin/includes/class-wp-media-list-table.php diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 237c99d1..377e3c02 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -22,6 +22,11 @@ class WP_Media_List_Table extends WP_List_Table { public function __construct( $args = array() ) { $this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); + $this->modes = array( + 'list' => __( 'List View' ), + 'grid' => __( 'Grid View' ) + ); + parent::__construct( array( 'plural' => 'media', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, @@ -70,7 +75,7 @@ class WP_Media_List_Table extends WP_List_Table { if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) ) $selected = ' selected="selected"'; if ( !empty( $num_posts[$mime_type] ) ) - $type_links[$mime_type] = ''; + $type_links[$mime_type] = ''; } $type_links['detached'] = ''; @@ -82,13 +87,26 @@ class WP_Media_List_Table extends WP_List_Table { protected function get_bulk_actions() { $actions = array(); - $actions['delete'] = __( 'Delete Permanently' ); + if ( MEDIA_TRASH ) { + if ( $this->is_trash ) { + $actions['untrash'] = __( 'Restore' ); + $actions['delete'] = __( 'Delete Permanently' ); + } else { + $actions['trash'] = __( 'Trash' ); + } + } else { + $actions['delete'] = __( 'Delete Permanently' ); + } + if ( $this->detached ) $actions['attach'] = __( 'Attach to a post' ); return $actions; } + /** + * @param string $which + */ protected function extra_tablenav( $which ) { if ( 'bar' !== $which ) { return; @@ -131,42 +149,11 @@ class WP_Media_List_Table extends WP_List_Table { _e( 'No media attachments found.' ); } - protected function pagination( $which ) { - global $mode; - - parent::pagination( $which ); - } - /** - * Display a view switcher - * - * @since 3.1.0 - * @access protected + * @param string $which */ - protected function view_switcher( $current_mode ) { - $modes = array( - 'list' => __( 'List View' ), - 'grid' => __( 'Grid View' ) - ); - -?> - -
- $title ) { - $classes = array( 'view-' . $mode ); - if ( $current_mode == $mode ) - $classes[] = 'current'; - printf( - "%s\n", - esc_url( add_query_arg( 'mode', $mode ) ), - implode( ' ', $classes ), - $title - ); - } - ?> -
-get_views(); ?>
- view_switcher( $mode ); ?> +
+ view_switcher( $mode ); ?> - + $view ) { + echo "\t$view\n"; + } } - } - ?> - + ?> + extra_tablenav( 'bar' ); + $this->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 ''; - } ?> +
@@ -486,21 +475,19 @@ foreach ( $columns as $column_name => $column_display_name ) { break; } ?> - > - - ID ); ?> - + >ID ); + ?> $column_display_name ) {