diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 8482e3304e..4b34c4db0e 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -84,36 +84,46 @@ class WP_Media_List_Table extends WP_List_Table { * @return array */ protected function get_views() { - global $wpdb, $post_mime_types, $avail_post_mime_types; + global $post_mime_types, $avail_post_mime_types; $type_links = array(); - $_num_posts = (array) wp_count_attachments(); - $_total_posts = array_sum($_num_posts) - $_num_posts['trash']; - $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" ); - $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); - $num_posts = array(); - foreach ( $matches as $type => $reals ) { - foreach ( $reals as $real ) { - $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; - } - } - $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : ''; - $type_links['all'] = "'; + + $filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter']; + + $type_links['all'] = sprintf( + '', + selected( $filter, true, false ), + __( 'All media items' ) + ); + foreach ( $post_mime_types as $mime_type => $label ) { - if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) + if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { continue; + } - $selected = ''; - 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] = ''; + $selected = selected( + $filter && 0 === strpos( $filter, 'post_mime_type:' ) && + wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), + true, + false + ); + + $type_links[$mime_type] = sprintf( + '', + esc_attr( $mime_type ), + $selected, + $label[0] + ); } - $type_links['detached'] = ''; - - if ( !empty($_num_posts['trash']) ) - $type_links['trash'] = ''; + $type_links['detached'] = ''; + if ( $this->is_trash ) { + $type_links['trash'] = sprintf( + '', + selected( 'trash' === $filter, true, false ), + __( 'Trash' ) + ); + } return $type_links; } @@ -372,7 +382,7 @@ class WP_Media_List_Table extends WP_List_Table {

- ID ); echo wp_basename( $file ); ?> diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 7154148cdd..66ec318a43 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -25,6 +25,8 @@ if ( 'grid' === $mode ) { wp_enqueue_script( 'media-grid' ); wp_enqueue_script( 'media' ); + remove_action( 'admin_head', 'wp_admin_canonical_url' ); + $q = $_GET; // let JS handle this unset( $q['s'] ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e0725d8f86..ea23c84d11 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34255'; +$wp_version = '4.4-alpha-34256'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.