Make WordPress Core


Ignore:
Timestamp:
09/05/2010 09:26:27 PM (13 years ago)
Author:
scribu
Message:

introduce WP_List_Table::views(). See #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload.php

    r15528 r15578  
    202202<?php } ?>
    203203
    204 <ul class="subsubsub">
    205 <?php
    206 $type_links = array();
    207 $_num_posts = (array) wp_count_attachments();
    208 $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
    209 if ( !isset( $total_orphans ) )
    210         $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
    211 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
    212 foreach ( $matches as $type => $reals )
    213     foreach ( $reals as $real )
    214         $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
    215 
    216 $class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : '';
    217 $type_links[] = "<li><a href='upload.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</a>';
    218 foreach ( $post_mime_types as $mime_type => $label ) {
    219     $class = '';
    220 
    221     if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
    222         continue;
    223 
    224     if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
    225         $class = ' class="current"';
    226     if ( !empty( $num_posts[$mime_type] ) )
    227         $type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
    228 }
    229 $type_links[] = '<li><a href="upload.php?detached=1"' . ( $detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached <span class="count">(%s)</span>', 'Unattached <span class="count">(%s)</span>', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</a>';
    230 
    231 if ( !empty($_num_posts['trash']) )
    232     $type_links[] = '<li><a href="upload.php?status=trash"' . ( (isset($_GET['status']) && $_GET['status'] == 'trash' ) ? ' class="current"' : '') . '>' . sprintf( _nx( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</a>';
    233 
    234 echo implode( " |</li>\n", $type_links) . '</li>';
    235 unset($type_links);
    236 ?>
    237 </ul>
     204<?php $wp_list_table->views(); ?>
    238205
    239206<form class="search-form" action="" method="get">
Note: See TracChangeset for help on using the changeset viewer.