diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 6d2f44be90..d5dac82ebd 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -9,12 +9,9 @@ class WP_Media_List_Table extends WP_List_Table { function WP_Media_List_Table() { - global $detached; - - $detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); + $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); parent::WP_List_Table( array( - 'screen' => $detached ? 'upload-detached' : 'upload', 'plural' => 'media' ) ); } @@ -44,7 +41,7 @@ class WP_Media_List_Table extends WP_List_Table { } function get_views() { - global $wpdb, $post_mime_types, $detached, $avail_post_mime_types; + global $wpdb, $post_mime_types, $avail_post_mime_types; $type_links = array(); $_num_posts = (array) wp_count_attachments(); @@ -56,7 +53,7 @@ class WP_Media_List_Table extends WP_List_Table { foreach ( $reals as $real ) $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; - $class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : ''; + $class = ( empty($_GET['post_mime_type']) && !$this->detached && !isset($_GET['status']) ) ? ' class="current"' : ''; $type_links['all'] = "" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . ''; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; @@ -69,7 +66,7 @@ class WP_Media_List_Table extends WP_List_Table { if ( !empty( $num_posts[$mime_type] ) ) $type_links[$mime_type] = "" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . ''; } - $type_links['detached'] = '' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . ''; + $type_links['detached'] = 'detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . ''; if ( !empty($_num_posts['trash']) ) $type_links['trash'] = '' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . ''; @@ -78,30 +75,28 @@ class WP_Media_List_Table extends WP_List_Table { } function get_bulk_actions() { - global $detached; - $actions = array(); $actions['delete'] = __( 'Delete Permanently' ); - if ( $detached ) + if ( $this->detached ) $actions['attach'] = __( 'Attach to a post' ); return $actions; } function extra_tablenav( $which ) { - global $post_type, $detached; + global $post_type; $post_type_obj = get_post_type_object( $post_type ); ?>