<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15578] trunk/wp-admin: introduce WP_List_Table::views().</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15578">15578</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-09-05 21:26:27 +0000 (Sun, 05 Sep 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>introduce WP_List_Table::views(). See <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmineditcommentsphp">trunk/wp-admin/edit-comments.php</a></li>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
<li><a href="#trunkwpadminincludeslisttablephp">trunk/wp-admin/includes/list-table.php</a></li>
<li><a href="#trunkwpadminplugininstallphp">trunk/wp-admin/plugin-install.php</a></li>
<li><a href="#trunkwpadminpluginsphp">trunk/wp-admin/plugins.php</a></li>
<li><a href="#trunkwpadminthemeinstallphp">trunk/wp-admin/theme-install.php</a></li>
<li><a href="#trunkwpadminuploadphp">trunk/wp-admin/upload.php</a></li>
<li><a href="#trunkwpadminusersphp">trunk/wp-admin/users.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmineditcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-comments.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-comments.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/edit-comments.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -194,54 +194,9 @@
</span><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx">
</span><del>-<form id="comments-form" action="" method="post">
-<ul class="subsubsub">
-<?php
-$status_links = array();
-$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
-//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
-//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
-$stati = array(
-                'all' => _nx_noop('All', 'All', 'comments'), // singular not used
-                '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>'),
-                'approved' => _n_noop('Approved', 'Approved'), // singular not used
-                '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>'),
-                '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>')
-        );
</del><ins>+<?php $wp_list_table->views(); ?>
</ins><span class="cx">
</span><del>-if ( !EMPTY_TRASH_DAYS )
-        unset($stati['trash']);
-
-$link = 'edit-comments.php';
-if ( !empty($comment_type) && 'all' != $comment_type )
-        $link = add_query_arg( 'comment_type', $comment_type, $link );
-
-foreach ( $stati as $status => $label ) {
-        $class = ( $status == $comment_status ) ? ' class="current"' : '';
-
-        if ( !isset( $num_comments->$status ) )
-                $num_comments->$status = 10;
-        $link = add_query_arg( 'comment_status', $status, $link );
-        if ( $post_id )
-                $link = add_query_arg( 'p', absint( $post_id ), $link );
-        /*
-        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
-        if ( !empty( $_REQUEST['s'] ) )
-                $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
-        */
-        $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
-                _n( $label[0], $label[1], $num_comments->$status ),
-                number_format_i18n( $num_comments->$status )
-        ) . '</a>';
-}
-
-$status_links = apply_filters( 'comment_status_links', $status_links );
-
-echo implode( " |</li>\n", $status_links) . '</li>';
-unset($status_links);
-?>
-</ul>
-
</del><ins>+<form id="comments-form" action="" method="post">
</ins><span class="cx"> <p class="search-box">
</span><span class="cx">         <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
</span><span class="cx">         <input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
</span></span></pre></div>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/edit.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -207,68 +207,9 @@
</span><span class="cx"> </p></div>
</span><span class="cx"> <?php } ?>
</span><span class="cx">
</span><del>-<form id="posts-filter" action="" method="get">
</del><ins>+<?php $wp_list_table->views(); ?>
</ins><span class="cx">
</span><del>-<ul class="subsubsub">
-<?php
-if ( empty($locked_post_status) ) :
-$status_links = array();
-$num_posts = wp_count_posts( $post_type, 'readable' );
-$class = '';
-$allposts = '';
-
-$user_posts = false;
-if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
-        $user_posts = true;
-
-        $user_posts_count = $wpdb->get_var( $wpdb->prepare( "
-                SELECT COUNT( 1 ) FROM $wpdb->posts
-                WHERE post_type = '%s' AND post_status NOT IN ( 'trash', 'auto-draft' )
-                AND post_author = %d
-        ", $post_type, get_current_user_id() ) );
-
-        if ( $user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )
-                $_REQUEST['author'] = get_current_user_id();
-}
-
-if ( $user_posts ) {
-        if ( isset( $_REQUEST['author'] ) && ( $_REQUEST['author'] == $current_user->ID ) )
-                $class = ' class="current"';
-        $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>';
-        $allposts = '&all_posts=1';
-}
-
-$total_posts = array_sum( (array) $num_posts );
-
-// Subtract post types that are not included in the admin all list.
-foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
-        $total_posts -= $num_posts->$state;
-
-$class = empty($class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';
-$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>';
-
-foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
-        $class = '';
-
-        $status_name = $status->name;
-
-        if ( !in_array( $status_name, $avail_post_stati ) )
-                continue;
-
-        if ( empty( $num_posts->$status_name ) )
-                continue;
-
-        if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
-                $class = ' class="current"';
-
-        $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>';
-}
-echo implode( " |</li>\n", $status_links ) . '</li>';
-unset( $status_links );
-endif;
-?>
-</ul>
-
</del><ins>+<form id="posts-filter" action="" method="get">
</ins><span class="cx"> <p class="search-box">
</span><span class="cx">         <label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
</span><span class="cx">         <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
</span></span></pre></div>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -96,6 +96,67 @@
</span><span class="cx">                         echo $post_type_object->labels->not_found;
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $post_type, $post_type_object, $locked_post_status, $avail_post_stati;
+        
+                if ( !empty($locked_post_status) )
+                        return array();
+
+                $status_links = array();
+                $num_posts = wp_count_posts( $post_type, 'readable' );
+                $class = '';
+                $allposts = '';
+
+                $user_posts = false;
+                if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+                        $user_posts = true;
+
+                        $user_posts_count = $wpdb->get_var( $wpdb->prepare( "
+                                SELECT COUNT( 1 ) FROM $wpdb->posts
+                                WHERE post_type = '%s' AND post_status NOT IN ( 'trash', 'auto-draft' )
+                                AND post_author = %d
+                        ", $post_type, get_current_user_id() ) );
+
+                        if ( $user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )
+                                $_REQUEST['author'] = get_current_user_id();
+                }
+
+                if ( $user_posts ) {
+                        if ( isset( $_REQUEST['author'] ) && ( $_REQUEST['author'] == $current_user->ID ) )
+                                $class = ' class="current"';
+                        $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>';
+                        $allposts = '&all_posts=1';
+                }
+
+                $total_posts = array_sum( (array) $num_posts );
+
+                // Subtract post types that are not included in the admin all list.
+                foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
+                        $total_posts -= $num_posts->$state;
+
+                $class = empty($class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';
+                $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>';
+
+                foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
+                        $class = '';
+
+                        $status_name = $status->name;
+
+                        if ( !in_array( $status_name, $avail_post_stati ) )
+                                continue;
+
+                        if ( empty( $num_posts->$status_name ) )
+                                continue;
+
+                        if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
+                                $class = ' class="current"';
+
+                        $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>';
+                }
+                
+                return $status_links;
+        }
+
</ins><span class="cx">         function get_bulk_actions() {
</span><span class="cx">                 $actions = array();
</span><span class="cx">
</span><span class="lines">@@ -943,6 +1004,40 @@
</span><span class="cx">                 ) );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $wpdb, $post_mime_types, $detached, $avail_post_mime_types;
+
+                $type_links = array();
+                $_num_posts = (array) wp_count_attachments();
+                $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
+                if ( !isset( $total_orphans ) )
+                                $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));
+                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];
+
+                $class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : '';
+                $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>';
+                foreach ( $post_mime_types as $mime_type => $label ) {
+                        $class = '';
+
+                        if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
+                                continue;
+
+                        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
+                                $class = ' class="current"';
+                        if ( !empty( $num_posts[$mime_type] ) )
+                                $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>';
+                }
+                $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>';
+
+                if ( !empty($_num_posts['trash']) )
+                        $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>';
+
+                return $type_links;
+        }
+
</ins><span class="cx">         function get_bulk_actions() {
</span><span class="cx">                 global $detached;
</span><span class="cx">
</span><span class="lines">@@ -1651,8 +1746,6 @@
</span><span class="cx"> class WP_Users_Table extends WP_List_Table {
</span><span class="cx">
</span><span class="cx">         function WP_Users_Table() {
</span><del>-                global $role, $usersearch;
-
</del><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'screen' => 'users',
</span><span class="cx">                         'plural' => 'users'
</span><span class="lines">@@ -1665,6 +1758,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function prepare_items() {
</span><ins>+                global $role, $usersearch;
+
</ins><span class="cx">                 $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
</span><span class="cx">
</span><span class="cx">                 $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
</span><span class="lines">@@ -1701,6 +1796,38 @@
</span><span class="cx">                 _e( 'No matching users were found.' );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $wp_roles, $role;
+
+                $users_of_blog = count_users();
+                $total_users = $users_of_blog['total_users'];
+                $avail_roles =& $users_of_blog['avail_roles'];
+                unset($users_of_blog);
+
+                $current_role = false;
+                $class = empty($role) ? ' class="current"' : '';
+                $role_links = array();
+                $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>';
+                foreach ( $wp_roles->get_names() as $this_role => $name ) {
+                        if ( !isset($avail_roles[$this_role]) )
+                                continue;
+
+                        $class = '';
+
+                        if ( $this_role == $role ) {
+                                $current_role = $role;
+                                $class = ' class="current"';
+                        }
+
+                        $name = translate_user_role( $name );
+                        /* translators: User role name with count */
+                        $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
+                        $role_links[$this_role] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
+                }
+
+                return $role_links;
+        }
+
</ins><span class="cx">         function get_bulk_actions() {
</span><span class="cx">                 $actions = array();
</span><span class="cx">
</span><span class="lines">@@ -1957,6 +2084,51 @@
</span><span class="cx">                 ) );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $post_id, $comment_status;
+
+                $status_links = array();
+                $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
+                //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
+                //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
+                $stati = array(
+                                'all' => _nx_noop('All', 'All', 'comments'), // singular not used
+                                '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>'),
+                                'approved' => _n_noop('Approved', 'Approved'), // singular not used
+                                '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>'),
+                                '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>')
+                        );
+
+                if ( !EMPTY_TRASH_DAYS )
+                        unset($stati['trash']);
+
+                $link = 'edit-comments.php';
+                if ( !empty($comment_type) && 'all' != $comment_type )
+                        $link = add_query_arg( 'comment_type', $comment_type, $link );
+
+                foreach ( $stati as $status => $label ) {
+                        $class = ( $status == $comment_status ) ? ' class="current"' : '';
+
+                        if ( !isset( $num_comments->$status ) )
+                                $num_comments->$status = 10;
+                        $link = add_query_arg( 'comment_status', $status, $link );
+                        if ( $post_id )
+                                $link = add_query_arg( 'p', absint( $post_id ), $link );
+                        /*
+                        // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
+                        if ( !empty( $_REQUEST['s'] ) )
+                                $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
+                        */
+                        $status_links[$status] = "<li class='$status'><a href='$link'$class>" . sprintf(
+                                _n( $label[0], $label[1], $num_comments->$status ),
+                                number_format_i18n( $num_comments->$status )
+                        ) . '</a>';
+                }
+
+                $status_links = apply_filters( 'comment_status_links', $status_links );
+                return $status_links;
+        }
+
</ins><span class="cx">         function get_bulk_actions() {
</span><span class="cx">                 global $comment_status;
</span><span class="cx">
</span><span class="lines">@@ -3169,6 +3341,54 @@
</span><span class="cx">                         parent::display_tablenav( $which );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $totals, $status;
+        
+                $status_links = array();
+                foreach ( $totals as $type => $count ) {
+                        if ( !$count )
+                                continue;
+
+                        switch ( $type ) {
+                                case 'all':
+                                        $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
+                                        break;
+                                case 'active':
+                                        $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'recently_activated':
+                                        $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'inactive':
+                                        $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'network':
+                                        $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'mustuse':
+                                        $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'dropins':
+                                        $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'upgrade':
+                                        $text = _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $count );
+                                        break;
+                                case 'search':
+                                        $text = _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $count );
+                                        break;
+                        }
+
+                        $status_links[$type] = sprintf( "<li><a href='%s' %s>%s</a>",
+                                add_query_arg('plugin_status', $type, 'plugins.php'),
+                                ( $type == $status ) ? ' class="current"' : '',
+                                sprintf( $text, number_format_i18n( $count ) )
+                        );
+                }
+
+                return $status_links;
+        }
+
</ins><span class="cx">         function get_bulk_actions() {
</span><span class="cx">                 global $status;
</span><span class="cx">
</span><span class="lines">@@ -3427,6 +3647,19 @@
</span><span class="cx">                 _e( 'No plugins match your request.' );
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+        function get_views() {
+                global $tabs, $tab;
+
+                $display_tabs = array();
+                foreach ( (array) $tabs as $action => $text ) {
+                        $class = ( $action == $tab ) ? ' class="current"' : '';
+                        $href = admin_url('plugin-install.php?tab=' . $action);
+                        $display_tabs[$action] = "<a href='$href'$class>$text</a>";
+                }
+
+                return $display_tabs;
+        }
+
</ins><span class="cx">         function display_tablenav( $which ) {
</span><span class="cx">                 if ( 'top' == $which ) { ?>
</span><span class="cx">                         <div class="tablenav">
</span><span class="lines">@@ -3799,7 +4032,20 @@
</span><span class="cx">         function no_items() {
</span><span class="cx">                 _e( 'No themes match your request.' );
</span><span class="cx">         }
</span><del>-        
</del><ins>+
+        function get_views() {
+                global $tabs, $tab;
+
+                $display_tabs = array();
+                foreach ( (array) $tabs as $action => $text ) {
+                        $class = ( $action == $tab ) ? ' class="current"' : '';
+                        $href = admin_url('theme-install.php?tab=' . $action);
+                        $display_tabs[$action] = "<a href='$href'$class>$text</a>";
+                }
+
+                return $display_tabs;
+        }
+
</ins><span class="cx">         function get_columns() {
</span><span class="cx">                 return array();
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpadminincludeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/list-table.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/list-table.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/includes/list-table.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -174,6 +174,37 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Get an associative array ( id => link ) with the list
+         * of views available on this table.
+         *
+         * @since 3.1.0
+         * @access protected
+         *
+         * @return array
+         */
+        function get_views() {
+                return array();
+        }
+
+        /**
+         * Display the bulk actions dropdown.
+         *
+         * @since 3.1.0
+         * @access public
+         */
+        function views() {
+                $views = $this->get_views();
+                $views = apply_filters( 'views_' . $this->_screen->base, $views );
+
+                if ( empty( $views ) )
+                        return;
+
+                echo "<ul class='subsubsub'>\n";
+                echo implode( " |</li>\n", $views ) . "</li>\n";
+                echo "</ul>";
+        }
+
+        /**
</ins><span class="cx">          * Get an associative array ( option_name => option_title ) with the list
</span><span class="cx">          * of bulk actions available on this table.
</span><span class="cx">          *
</span></span></pre></div>
<a id="trunkwpadminplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugin-install.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugin-install.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/plugin-install.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -41,19 +41,11 @@
</span><span class="cx"> <?php screen_icon(); ?>
</span><span class="cx"> <h2><?php echo esc_html( $title ); ?></h2>
</span><span class="cx">
</span><del>-        <ul class="subsubsub">
-<?php
-$display_tabs = array();
-foreach ( (array) $tabs as $action => $text ) {
-        $sep = ( end($tabs) != $text ) ? ' | ' : '';
-        $class = ( $action == $tab ) ? ' class="current"' : '';
-        $href = admin_url('plugin-install.php?tab=' . $action);
-        echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
-}
-?>
-        </ul>
-        <br class="clear" />
-        <?php do_action('install_plugins_' . $tab, $paged); ?>
</del><ins>+<?php $wp_list_table->views(); ?>
+
+<br class="clear" />
+<?php do_action('install_plugins_' . $tab, $paged); ?>
</ins><span class="cx"> </div>
</span><span class="cx"> <?php
</span><span class="cx"> include('./admin-footer.php');
</span><ins>+
</ins></span></pre></div>
<a id="trunkwpadminpluginsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugins.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugins.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/plugins.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -367,60 +367,13 @@
</span><span class="cx">
</span><span class="cx"> <?php do_action( 'pre_current_active_plugins', $plugins['all'] ) ?>
</span><span class="cx">
</span><ins>+<?php $wp_list_table->views(); ?>
+
</ins><span class="cx"> <form method="post" action="">
</span><span class="cx"> <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
</span><span class="cx"> <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
</span><span class="cx">
</span><del>-<ul class="subsubsub">
</del><span class="cx"> <?php
</span><del>-
-$status_links = array();
-foreach ( $totals as $type => $count ) {
-        if ( !$count )
-                continue;
-
-        switch ( $type ) {
-                case 'all':
-                        $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
-                        break;
-                case 'active':
-                        $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
-                        break;
-                case 'recently_activated':
-                        $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
-                        break;
-                case 'inactive':
-                        $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
-                        break;
-                case 'network':
-                        $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );
-                        break;
-                case 'mustuse':
-                        $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
-                        break;
-                case 'dropins':
-                        $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
-                        break;
-                case 'upgrade':
-                        $text = _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $count );
-                        break;
-                case 'search':
-                        $text = _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $count );
-                        break;
-        }
-
-        $status_links[] = sprintf( "<li><a href='%s' %s>%s</a>",
-                add_query_arg('plugin_status', $type, 'plugins.php'),
-                ( $type == $status ) ? ' class="current"' : '',
-                sprintf( $text, number_format_i18n( $count ) )
-        );
-}
-echo implode( " |</li>\n", $status_links ) . '</li>';
-unset( $status_links );
-?>
-</ul>
-
-<?php
</del><span class="cx"> if ( 'mustuse' == $status )
</span><span class="cx">         echo '<br class="clear"><p>' . __( 'Files in the <code>/wp-content/mu-plugins</code> directory are executed automatically.' ) . '</p>';
</span><span class="cx"> elseif ( 'dropins' == $status )
</span></span></pre></div>
<a id="trunkwpadminthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/theme-install.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/theme-install.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/theme-install.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -41,19 +41,10 @@
</span><span class="cx"> <?php screen_icon(); ?>
</span><span class="cx"> <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>
</span><span class="cx">
</span><del>-        <ul class="subsubsub">
-<?php
-$display_tabs = array();
-foreach ( (array) $tabs as $action => $text ) {
-        $sep = ( end($tabs) != $text ) ? ' | ' : '';
-        $class = ( $action == $tab ) ? ' class="current"' : '';
-        $href = admin_url('theme-install.php?tab='. $action);
-        echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n";
-}
-?>
-        </ul>
-        <br class="clear" />
-        <?php do_action('install_themes_' . $tab, $paged); ?>
</del><ins>+<?php $wp_list_table->views(); ?>
+
+<br class="clear" />
+<?php do_action('install_themes_' . $tab, $paged); ?>
</ins><span class="cx"> </div>
</span><span class="cx"> <?php
</span><span class="cx"> include('./admin-footer.php');
</span></span></pre></div>
<a id="trunkwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/upload.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/upload.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/upload.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -201,41 +201,8 @@
</span><span class="cx"> <div id="message" class="updated"><p><?php echo $message; ?></p></div>
</span><span class="cx"> <?php } ?>
</span><span class="cx">
</span><del>-<ul class="subsubsub">
-<?php
-$type_links = array();
-$_num_posts = (array) wp_count_attachments();
-$_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
-if ( !isset( $total_orphans ) )
-                $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));
-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];
</del><ins>+<?php $wp_list_table->views(); ?>
</ins><span class="cx">
</span><del>-$class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : '';
-$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>';
-foreach ( $post_mime_types as $mime_type => $label ) {
-        $class = '';
-
-        if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
-                continue;
-
-        if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
-                $class = ' class="current"';
-        if ( !empty( $num_posts[$mime_type] ) )
-                $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>';
-}
-$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>';
-
-if ( !empty($_num_posts['trash']) )
-        $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>';
-
-echo implode( " |</li>\n", $type_links) . '</li>';
-unset($type_links);
-?>
-</ul>
-
</del><span class="cx"> <form class="search-form" action="" method="get">
</span><span class="cx"> <p class="search-box">
</span><span class="cx">         <label class="screen-reader-text" for="media-search-input"><?php _e( 'Search Media' ); ?>:</label>
</span></span></pre></div>
<a id="trunkwpadminusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/users.php (15577 => 15578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/users.php        2010-09-05 19:26:01 UTC (rev 15577)
+++ trunk/wp-admin/users.php        2010-09-05 21:26:27 UTC (rev 15578)
</span><span class="lines">@@ -359,42 +359,8 @@
</span><span class="cx">         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $usersearch ) ); ?>
</span><span class="cx"> </h2>
</span><span class="cx">
</span><del>-<div class="filter">
-<form id="list-filter" action="" method="get">
-<ul class="subsubsub">
-<?php
-$users_of_blog = count_users();
-$total_users = $users_of_blog['total_users'];
-$avail_roles =& $users_of_blog['avail_roles'];
-unset($users_of_blog);
</del><ins>+<?php $wp_list_table->views(); ?>
</ins><span class="cx">
</span><del>-$current_role = false;
-$class = empty($role) ? ' class="current"' : '';
-$role_links = array();
-$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>';
-foreach ( $wp_roles->get_names() as $this_role => $name ) {
-        if ( !isset($avail_roles[$this_role]) )
-                continue;
-
-        $class = '';
-
-        if ( $this_role == $role ) {
-                $current_role = $role;
-                $class = ' class="current"';
-        }
-
-        $name = translate_user_role( $name );
-        /* translators: User role name with count */
-        $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] );
-        $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
-}
-echo implode( " |</li>\n", $role_links) . '</li>';
-unset($role_links);
-?>
-</ul>
-</form>
-</div>
-
</del><span class="cx"> <form class="search-form" action="" method="get">
</span><span class="cx"> <p class="search-box">
</span><span class="cx">         <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label>
</span></span></pre>
</div>
</div>
</body>
</html>