Make WordPress Core

Changeset 15578


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

introduce WP_List_Table::views(). See #14579

Location:
trunk/wp-admin
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r15528 r15578  
    195195?>
    196196
     197<?php $wp_list_table->views(); ?>
     198
    197199<form id="comments-form" action="" method="post">
    198 <ul class="subsubsub">
    199 <?php
    200 $status_links = array();
    201 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
    202 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
    203 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
    204 $stati = array(
    205                 'all' => _nx_noop('All', 'All', 'comments'), // singular not used
    206                 'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
    207                 'approved' => _n_noop('Approved', 'Approved'), // singular not used
    208                 'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
    209                 'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
    210         );
    211 
    212 if ( !EMPTY_TRASH_DAYS )
    213         unset($stati['trash']);
    214 
    215 $link = 'edit-comments.php';
    216 if ( !empty($comment_type) && 'all' != $comment_type )
    217         $link = add_query_arg( 'comment_type', $comment_type, $link );
    218 
    219 foreach ( $stati as $status => $label ) {
    220         $class = ( $status == $comment_status ) ? ' class="current"' : '';
    221 
    222         if ( !isset( $num_comments->$status ) )
    223                 $num_comments->$status = 10;
    224         $link = add_query_arg( 'comment_status', $status, $link );
    225         if ( $post_id )
    226                 $link = add_query_arg( 'p', absint( $post_id ), $link );
    227         /*
    228         // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
    229         if ( !empty( $_REQUEST['s'] ) )
    230                 $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
    231         */
    232         $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
    233                 _n( $label[0], $label[1], $num_comments->$status ),
    234                 number_format_i18n( $num_comments->$status )
    235         ) . '</a>';
    236 }
    237 
    238 $status_links = apply_filters( 'comment_status_links', $status_links );
    239 
    240 echo implode( " |</li>\n", $status_links) . '</li>';
    241 unset($status_links);
    242 ?>
    243 </ul>
    244 
    245200<p class="search-box">
    246201        <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
  • trunk/wp-admin/edit.php

    r15528 r15578  
    208208<?php } ?>
    209209
     210<?php $wp_list_table->views(); ?>
     211
    210212<form id="posts-filter" action="" method="get">
    211 
    212 <ul class="subsubsub">
    213 <?php
    214 if ( empty($locked_post_status) ) :
    215 $status_links = array();
    216 $num_posts = wp_count_posts( $post_type, 'readable' );
    217 $class = '';
    218 $allposts = '';
    219 
    220 $user_posts = false;
    221 if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
    222         $user_posts = true;
    223 
    224         $user_posts_count = $wpdb->get_var( $wpdb->prepare( "
    225                 SELECT COUNT( 1 ) FROM $wpdb->posts
    226                 WHERE post_type = '%s' AND post_status NOT IN ( 'trash', 'auto-draft' )
    227                 AND post_author = %d
    228         ", $post_type, get_current_user_id() ) );
    229 
    230         if ( $user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )
    231                 $_REQUEST['author'] = get_current_user_id();
    232 }
    233 
    234 if ( $user_posts ) {
    235         if ( isset( $_REQUEST['author'] ) && ( $_REQUEST['author'] == $current_user->ID ) )
    236                 $class = ' class="current"';
    237         $status_links[] = "<li><a href='edit.php?post_type=$post_type&author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
    238         $allposts = '&all_posts=1';
    239 }
    240 
    241 $total_posts = array_sum( (array) $num_posts );
    242 
    243 // Subtract post types that are not included in the admin all list.
    244 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
    245         $total_posts -= $num_posts->$state;
    246 
    247 $class = empty($class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';
    248 $status_links[] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
    249 
    250 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
    251         $class = '';
    252 
    253         $status_name = $status->name;
    254 
    255         if ( !in_array( $status_name, $avail_post_stati ) )
    256                 continue;
    257 
    258         if ( empty( $num_posts->$status_name ) )
    259                 continue;
    260 
    261         if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
    262                 $class = ' class="current"';
    263 
    264         $status_links[] = "<li><a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
    265 }
    266 echo implode( " |</li>\n", $status_links ) . '</li>';
    267 unset( $status_links );
    268 endif;
    269 ?>
    270 </ul>
    271 
    272213<p class="search-box">
    273214        <label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
  • trunk/wp-admin/includes/default-list-tables.php

    r15577 r15578  
    9595                else
    9696                        echo $post_type_object->labels->not_found;
     97        }
     98
     99        function get_views() {
     100                global $post_type, $post_type_object, $locked_post_status, $avail_post_stati;
     101       
     102                if ( !empty($locked_post_status) )
     103                        return array();
     104
     105                $status_links = array();
     106                $num_posts = wp_count_posts( $post_type, 'readable' );
     107                $class = '';
     108                $allposts = '';
     109
     110                $user_posts = false;
     111                if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
     112                        $user_posts = true;
     113
     114                        $user_posts_count = $wpdb->get_var( $wpdb->prepare( "
     115                                SELECT COUNT( 1 ) FROM $wpdb->posts
     116                                WHERE post_type = '%s' AND post_status NOT IN ( 'trash', 'auto-draft' )
     117                                AND post_author = %d
     118                        ", $post_type, get_current_user_id() ) );
     119
     120                        if ( $user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )
     121                                $_REQUEST['author'] = get_current_user_id();
     122                }
     123
     124                if ( $user_posts ) {
     125                        if ( isset( $_REQUEST['author'] ) && ( $_REQUEST['author'] == $current_user->ID ) )
     126                                $class = ' class="current"';
     127                        $status_links['author'] = "<li><a href='edit.php?post_type=$post_type&author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';
     128                        $allposts = '&all_posts=1';
     129                }
     130
     131                $total_posts = array_sum( (array) $num_posts );
     132
     133                // Subtract post types that are not included in the admin all list.
     134                foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
     135                        $total_posts -= $num_posts->$state;
     136
     137                $class = empty($class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';
     138                $status_links['all'] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
     139
     140                foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
     141                        $class = '';
     142
     143                        $status_name = $status->name;
     144
     145                        if ( !in_array( $status_name, $avail_post_stati ) )
     146                                continue;
     147
     148                        if ( empty( $num_posts->$status_name ) )
     149                                continue;
     150
     151                        if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
     152                                $class = ' class="current"';
     153
     154                        $status_links[$status_name] = "<li><a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
     155                }
     156               
     157                return $status_links;
    97158        }
    98159
    … …  
    9421003                        'per_page' => $wp_query->query_vars['posts_per_page'],
    9431004                ) );
     1005        }
     1006
     1007        function get_views() {
     1008                global $wpdb, $post_mime_types, $detached, $avail_post_mime_types;
     1009
     1010                $type_links = array();
     1011                $_num_posts = (array) wp_count_attachments();
     1012                $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
     1013                if ( !isset( $total_orphans ) )
     1014                                $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
     1015                $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
     1016                foreach ( $matches as $type => $reals )
     1017                        foreach ( $reals as $real )
     1018                                $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
     1019
     1020                $class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : '';
     1021                $type_links['all'] = "<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>';
     1022                foreach ( $post_mime_types as $mime_type => $label ) {
     1023                        $class = '';
     1024
     1025                        if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
     1026                                continue;
     1027
     1028                        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
     1029                                $class = ' class="current"';
     1030                        if ( !empty( $num_posts[$mime_type] ) )
     1031                                $type_links[$mime_type] = "<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>';
     1032                }
     1033                $type_links['detached'] = '<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>';
     1034
     1035                if ( !empty($_num_posts['trash']) )
     1036                        $type_links['trash'] = '<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>';
     1037
     1038                return $type_links;
    9441039        }
    9451040
    … …  
    16521747
    16531748        function WP_Users_Table() {
    1654                 global $role, $usersearch;
    1655 
    16561749                parent::WP_List_Table( array(
    16571750                        'screen' => 'users',
    … …  
    16661759
    16671760        function prepare_items() {
     1761                global $role, $usersearch;
     1762
    16681763                $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
    16691764
    … …  
    17001795        function no_items() {
    17011796                _e( 'No matching users were found.' );
     1797        }
     1798
     1799        function get_views() {
     1800                global $wp_roles, $role;
     1801
     1802                $users_of_blog = count_users();
     1803                $total_users = $users_of_blog['total_users'];
     1804                $avail_roles =& $users_of_blog['avail_roles'];
     1805                unset($users_of_blog);
     1806
     1807                $current_role = false;
     1808                $class = empty($role) ? ' class="current"' : '';
     1809                $role_links = array();
     1810                $role_links['all'] = "<li><a href='users.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
     1811                foreach ( $wp_roles->get_names() as $this_role => $name ) {
     1812                        if ( !isset($avail_roles[$this_role]) )
     1813                                continue;
     1814
     1815                        $class = '';
     1816
     1817                        if ( $this_role == $role ) {
     1818                                $current_role = $role;
     1819                                $class = ' class="current"';
     1820                        }
     1821
     1822                        $name = translate_user_role( $name );
     1823                        /* translators: User role name with count */
     1824                        $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
     1825                        $role_links[$this_role] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
     1826                }
     1827
     1828                return $role_links;
    17021829        }
    17031830
    … …  
    19562083                        'per_page' => $comments_per_page,
    19572084                ) );
     2085        }
     2086
     2087        function get_views() {
     2088                global $post_id, $comment_status;
     2089
     2090                $status_links = array();
     2091                $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
     2092                //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
     2093                //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
     2094                $stati = array(
     2095                                'all' => _nx_noop('All', 'All', 'comments'), // singular not used
     2096                                'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
     2097                                'approved' => _n_noop('Approved', 'Approved'), // singular not used
     2098                                'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
     2099                                'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
     2100                        );
     2101
     2102                if ( !EMPTY_TRASH_DAYS )
     2103                        unset($stati['trash']);
     2104
     2105                $link = 'edit-comments.php';
     2106                if ( !empty($comment_type) && 'all' != $comment_type )
     2107                        $link = add_query_arg( 'comment_type', $comment_type, $link );
     2108
     2109                foreach ( $stati as $status => $label ) {
     2110                        $class = ( $status == $comment_status ) ? ' class="current"' : '';
     2111
     2112                        if ( !isset( $num_comments->$status ) )
     2113                                $num_comments->$status = 10;
     2114                        $link = add_query_arg( 'comment_status', $status, $link );
     2115                        if ( $post_id )
     2116                                $link = add_query_arg( 'p', absint( $post_id ), $link );
     2117                        /*
     2118                        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
     2119                        if ( !empty( $_REQUEST['s'] ) )
     2120                                $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
     2121                        */
     2122                        $status_links[$status] = "<li class='$status'><a href='$link'$class>" . sprintf(
     2123                                _n( $label[0], $label[1], $num_comments->$status ),
     2124                                number_format_i18n( $num_comments->$status )
     2125                        ) . '</a>';
     2126                }
     2127
     2128                $status_links = apply_filters( 'comment_status_links', $status_links );
     2129                return $status_links;
    19582130        }
    19592131
    … …  
    31703342        }
    31713343
     3344        function get_views() {
     3345                global $totals, $status;
     3346       
     3347                $status_links = array();
     3348                foreach ( $totals as $type => $count ) {
     3349                        if ( !$count )
     3350                                continue;
     3351
     3352                        switch ( $type ) {
     3353                                case 'all':
     3354                                        $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
     3355                                        break;
     3356                                case 'active':
     3357                                        $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
     3358                                        break;
     3359                                case 'recently_activated':
     3360                                        $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
     3361                                        break;
     3362                                case 'inactive':
     3363                                        $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
     3364                                        break;
     3365                                case 'network':
     3366                                        $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );
     3367                                        break;
     3368                                case 'mustuse':
     3369                                        $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
     3370                                        break;
     3371                                case 'dropins':
     3372                                        $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
     3373                                        break;
     3374                                case 'upgrade':
     3375                                        $text = _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $count );
     3376                                        break;
     3377                                case 'search':
     3378                                        $text = _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $count );
     3379                                        break;
     3380                        }
     3381
     3382                        $status_links[$type] = sprintf( "<li><a href='%s' %s>%s</a>",
     3383                                add_query_arg('plugin_status', $type, 'plugins.php'),
     3384                                ( $type == $status ) ? ' class="current"' : '',
     3385                                sprintf( $text, number_format_i18n( $count ) )
     3386                        );
     3387                }
     3388
     3389                return $status_links;
     3390        }
     3391
    31723392        function get_bulk_actions() {
    31733393                global $status;
    … …  
    34283648        }
    34293649
     3650        function get_views() {
     3651                global $tabs, $tab;
     3652
     3653                $display_tabs = array();
     3654                foreach ( (array) $tabs as $action => $text ) {
     3655                        $class = ( $action == $tab ) ? ' class="current"' : '';
     3656                        $href = admin_url('plugin-install.php?tab=' . $action);
     3657                        $display_tabs[$action] = "<a href='$href'$class>$text</a>";
     3658                }
     3659
     3660                return $display_tabs;
     3661        }
     3662
    34303663        function display_tablenav( $which ) {
    34313664                if ( 'top' ==  $which ) { ?>
    … …  
    38004033                _e( 'No themes match your request.' );
    38014034        }
    3802        
     4035
     4036        function get_views() {
     4037                global $tabs, $tab;
     4038
     4039                $display_tabs = array();
     4040                foreach ( (array) $tabs as $action => $text ) {
     4041                        $class = ( $action == $tab ) ? ' class="current"' : '';
     4042                        $href = admin_url('theme-install.php?tab=' . $action);
     4043                        $display_tabs[$action] = "<a href='$href'$class>$text</a>";
     4044                }
     4045
     4046                return $display_tabs;
     4047        }
     4048
    38034049        function get_columns() {
    38044050                return array();
  • trunk/wp-admin/includes/list-table.php

    r15571 r15578  
    172172        function no_items() {
    173173                _e( 'No items found.' );
     174        }
     175
     176        /**
     177         * Get an associative array ( id => link ) with the list
     178         * of views available on this table.
     179         *
     180         * @since 3.1.0
     181         * @access protected
     182         *
     183         * @return array
     184         */
     185        function get_views() {
     186                return array();
     187        }
     188
     189        /**
     190         * Display the bulk actions dropdown.
     191         *
     192         * @since 3.1.0
     193         * @access public
     194         */
     195        function views() {
     196                $views = $this->get_views();
     197                $views = apply_filters( 'views_' . $this->_screen->base, $views );
     198
     199                if ( empty( $views ) )
     200                        return;
     201
     202                echo "<ul class='subsubsub'>\n";
     203                echo implode( " |</li>\n", $views ) . "</li>\n";
     204                echo "</ul>";
    174205        }
    175206
  • trunk/wp-admin/plugin-install.php

    r15528 r15578  
    4242<h2><?php echo esc_html( $title ); ?></h2>
    4343
    44         <ul class="subsubsub">
    45 <?php
    46 $display_tabs = array();
    47 foreach ( (array) $tabs as $action => $text ) {
    48         $sep = ( end($tabs) != $text ) ? ' | ' : '';
    49         $class = ( $action == $tab ) ? ' class="current"' : '';
    50         $href = admin_url('plugin-install.php?tab=' . $action);
    51         echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
    52 }
    53 ?>
    54         </ul>
    55         <br class="clear" />
    56         <?php do_action('install_plugins_' . $tab, $paged); ?>
     44<?php $wp_list_table->views(); ?>
     45
     46<br class="clear" />
     47<?php do_action('install_plugins_' . $tab, $paged); ?>
    5748</div>
    5849<?php
    5950include('./admin-footer.php');
     51
  • trunk/wp-admin/plugins.php

    r15528 r15578  
    368368<?php do_action( 'pre_current_active_plugins', $plugins['all'] ) ?>
    369369
     370<?php $wp_list_table->views(); ?>
     371
    370372<form method="post" action="">
    371373<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
    372374<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
    373 
    374 <ul class="subsubsub">
    375 <?php
    376 
    377 $status_links = array();
    378 foreach ( $totals as $type => $count ) {
    379         if ( !$count )
    380                 continue;
    381 
    382         switch ( $type ) {
    383                 case 'all':
    384                         $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
    385                         break;
    386                 case 'active':
    387                         $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
    388                         break;
    389                 case 'recently_activated':
    390                         $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
    391                         break;
    392                 case 'inactive':
    393                         $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
    394                         break;
    395                 case 'network':
    396                         $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );
    397                         break;
    398                 case 'mustuse':
    399                         $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
    400                         break;
    401                 case 'dropins':
    402                         $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
    403                         break;
    404                 case 'upgrade':
    405                         $text = _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $count );
    406                         break;
    407                 case 'search':
    408                         $text = _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $count );
    409                         break;
    410         }
    411 
    412         $status_links[] = sprintf( "<li><a href='%s' %s>%s</a>",
    413                 add_query_arg('plugin_status', $type, 'plugins.php'),
    414                 ( $type == $status ) ? ' class="current"' : '',
    415                 sprintf( $text, number_format_i18n( $count ) )
    416         );
    417 }
    418 echo implode( " |</li>\n", $status_links ) . '</li>';
    419 unset( $status_links );
    420 ?>
    421 </ul>
    422375
    423376<?php
  • trunk/wp-admin/theme-install.php

    r15528 r15578  
    4242<h2><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
    4343
    44         <ul class="subsubsub">
    45 <?php
    46 $display_tabs = array();
    47 foreach ( (array) $tabs as $action => $text ) {
    48         $sep = ( end($tabs) != $text ) ? ' | ' : '';
    49         $class = ( $action == $tab ) ? ' class="current"' : '';
    50         $href = admin_url('theme-install.php?tab='. $action);
    51         echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
    52 }
    53 ?>
    54         </ul>
    55         <br class="clear" />
    56         <?php do_action('install_themes_' . $tab, $paged); ?>
     44<?php $wp_list_table->views(); ?>
     45
     46<br class="clear" />
     47<?php do_action('install_themes_' . $tab, $paged); ?>
    5748</div>
    5849<?php
  • 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">
  • trunk/wp-admin/users.php

    r15576 r15578  
    360360</h2>
    361361
    362 <div class="filter">
    363 <form id="list-filter" action="" method="get">
    364 <ul class="subsubsub">
    365 <?php
    366 $users_of_blog = count_users();
    367 $total_users = $users_of_blog['total_users'];
    368 $avail_roles =& $users_of_blog['avail_roles'];
    369 unset($users_of_blog);
    370 
    371 $current_role = false;
    372 $class = empty($role) ? ' class="current"' : '';
    373 $role_links = array();
    374 $role_links[] = "<li><a href='users.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
    375 foreach ( $wp_roles->get_names() as $this_role => $name ) {
    376         if ( !isset($avail_roles[$this_role]) )
    377                 continue;
    378 
    379         $class = '';
    380 
    381         if ( $this_role == $role ) {
    382                 $current_role = $role;
    383                 $class = ' class="current"';
    384         }
    385 
    386         $name = translate_user_role( $name );
    387         /* translators: User role name with count */
    388         $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
    389         $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
    390 }
    391 echo implode( " |</li>\n", $role_links) . '</li>';
    392 unset($role_links);
    393 ?>
    394 </ul>
    395 </form>
    396 </div>
     362<?php $wp_list_table->views(); ?>
    397363
    398364<form class="search-form" action="" method="get">
Note: See TracChangeset for help on using the changeset viewer.