X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..7f1521bf193b382565eb753043c161f4cb3fcda7:/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..9ebd5c0c 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -9,6 +9,10 @@ */ class WP_Media_List_Table extends WP_List_Table { + private $detached; + + private $is_trash; + /** * Constructor. * @@ -22,6 +26,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 +79,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 +91,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; @@ -117,6 +139,9 @@ class WP_Media_List_Table extends WP_List_Table { if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) return 'attach'; + if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) + return 'detach'; + if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) return 'delete_all'; @@ -131,44 +156,6 @@ 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 - */ - protected function view_switcher( $current_mode ) { - $modes = array( - 'list' => __( 'List View' ), - 'grid' => __( 'Grid View' ) - ); - -?> - -
-ID ), $matches ) ) - echo esc_html( strtoupper( $matches[1] ) ); - else - echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) ); -?> -
+guid ); ?>
row_actions( $this->_get_row_actions( $post, $att_title ) ); ?> @@ -422,7 +403,16 @@ foreach ( $columns as $column_name => $column_display_name ) { } else { echo $title; } ?>, - +