<!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>[16235] trunk/wp-admin/includes: Use get_current_screen()
  in list table classes.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16235">16235</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-11-08 15:43:44 +0000 (Mon, 08 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use get_current_screen() in list table classes. Fixes <a href="http://trac.wordpress.org/ticket/15338">#15338</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpcommentslisttablephp">trunk/wp-admin/includes/class-wp-comments-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswplisttablephp">trunk/wp-admin/includes/class-wp-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswppluginslisttablephp">trunk/wp-admin/includes/class-wp-plugins-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswppostslisttablephp">trunk/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswptermslisttablephp">trunk/wp-admin/includes/class-wp-terms-list-table.php</a></li>
<li><a href="#trunkwpadminincludesdeprecatedphp">trunk/wp-admin/includes/deprecated.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpcommentslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-comments-list-table.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-comments-list-table.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/class-wp-comments-list-table.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx">                         add_filter( 'comment_author', 'floated_admin_avatar' );
</span><span class="cx"> 
</span><span class="cx">                 parent::WP_List_Table( array(
</span><del>-                        'screen' =&gt; 'edit-comments',
</del><span class="cx">                         'plural' =&gt; 'comments'
</span><span class="cx">                 ) );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpadminincludesclasswplisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-list-table.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-list-table.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/class-wp-list-table.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -78,21 +78,17 @@
</span><span class="cx">          */
</span><span class="cx">         function WP_List_Table( $args = array() ) {
</span><span class="cx">                 $args = wp_parse_args( $args, array(
</span><del>-                        'screen' =&gt; get_current_screen(),
</del><span class="cx">                         'plural' =&gt; '',
</span><span class="cx">                         'singular' =&gt; '',
</span><span class="cx">                         'ajax' =&gt; true
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><del>-                $this-&gt;screen = $args['screen'];
</del><ins>+                $screen = get_current_screen();
</ins><span class="cx"> 
</span><del>-                if ( is_string( $this-&gt;screen ) )
-                        $this-&gt;screen = convert_to_screen( $this-&gt;screen );
</del><ins>+                add_filter( &quot;manage_{$screen-&gt;id}_columns&quot;, array( &amp;$this, 'get_columns' ), 0 );
</ins><span class="cx"> 
</span><del>-                add_filter( 'manage_' . $this-&gt;screen-&gt;id . '_columns', array( &amp;$this, 'get_columns' ), 0 );
-
</del><span class="cx">                 if ( !$args['plural'] )
</span><del>-                        $args['plural'] = $this-&gt;screen-&gt;base;
</del><ins>+                        $args['plural'] = $screen-&gt;base;
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;_args = $args;
</span><span class="cx"> 
</span><span class="lines">@@ -203,8 +199,10 @@
</span><span class="cx">          * @access public
</span><span class="cx">          */
</span><span class="cx">         function views() {
</span><ins>+                $screen = get_current_screen();
+
</ins><span class="cx">                 $views = $this-&gt;get_views();
</span><del>-                $views = apply_filters( 'views_' . $this-&gt;screen-&gt;id, $views );
</del><ins>+                $views = apply_filters( 'views_' . $screen-&gt;id, $views );
</ins><span class="cx"> 
</span><span class="cx">                 if ( empty( $views ) )
</span><span class="cx">                         return;
</span><span class="lines">@@ -237,10 +235,11 @@
</span><span class="cx">          * @access public
</span><span class="cx">          */
</span><span class="cx">         function bulk_actions() {
</span><ins>+                $screen = get_current_screen();
</ins><span class="cx"> 
</span><span class="cx">                 if ( is_null( $this-&gt;_actions ) ) {
</span><span class="cx">                         $this-&gt;_actions = $this-&gt;get_bulk_actions();
</span><del>-                        $this-&gt;_actions = apply_filters( 'bulk_actions-' . $this-&gt;screen-&gt;id, $this-&gt;_actions );
</del><ins>+                        $this-&gt;_actions = apply_filters( 'bulk_actions-' . $screen-&gt;id, $this-&gt;_actions );
</ins><span class="cx">                         $two = '';
</span><span class="cx">                 }
</span><span class="cx">                 else {
</span><span class="lines">@@ -538,10 +537,12 @@
</span><span class="cx">          */
</span><span class="cx">         function get_column_info() {
</span><span class="cx">                 if ( !isset( $this-&gt;_column_headers ) ) {
</span><del>-                        $columns = get_column_headers( $this-&gt;screen );
-                        $hidden = get_hidden_columns( $this-&gt;screen );
-                        $sortable = apply_filters( 'manage_' . $this-&gt;screen-&gt;id . '_sortable_columns', $this-&gt;get_sortable_columns() );
</del><ins>+                        $screen = get_current_screen();
</ins><span class="cx"> 
</span><ins>+                        $columns = get_column_headers( $screen );
+                        $hidden = get_hidden_columns( $screen );
+                        $sortable = apply_filters( &quot;manage_{$screen-&gt;id}_sortable_columns&quot;, $this-&gt;get_sortable_columns() );
+
</ins><span class="cx">                         $this-&gt;_column_headers = array( $columns, $hidden, $sortable );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -557,7 +558,7 @@
</span><span class="cx">          * @param bool $with_id Whether to set the id attribute or not
</span><span class="cx">          */
</span><span class="cx">         function print_column_headers( $with_id = true ) {
</span><del>-                $screen = $this-&gt;screen;
</del><ins>+                $screen = get_current_screen();
</ins><span class="cx"> 
</span><span class="cx">                 list( $columns, $hidden, $sortable ) = $this-&gt;get_column_info();
</span><span class="cx"> 
</span><span class="lines">@@ -810,7 +811,7 @@
</span><span class="cx">         function _js_vars() {
</span><span class="cx">                 $args = array(
</span><span class="cx">                         'class' =&gt; get_class( $this ),
</span><del>-                        'screen' =&gt; $this-&gt;screen
</del><ins>+                        'screen' =&gt; get_current_screen()
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 printf( &quot;&lt;script type='text/javascript'&gt;list_args = %s;&lt;/script&gt;\n&quot;, json_encode( $args ) );
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppluginslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-plugins-list-table.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-plugins-list-table.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/class-wp-plugins-list-table.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -57,7 +57,9 @@
</span><span class="cx">                         'dropins' =&gt; array()
</span><span class="cx">                 );
</span><span class="cx"> 
</span><del>-                if ( ! is_multisite() || ( $this-&gt;screen-&gt;is_network &amp;&amp; current_user_can('manage_network_plugins') ) ) {
</del><ins>+                $screen = get_current_screen();
+
+                if ( ! is_multisite() || ( $screen-&gt;is_network &amp;&amp; current_user_can('manage_network_plugins') ) ) {
</ins><span class="cx">                         if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
</span><span class="cx">                                 $plugins['mustuse'] = get_mu_plugins();
</span><span class="cx">                         if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
</span><span class="lines">@@ -85,16 +87,16 @@
</span><span class="cx"> 
</span><span class="cx">                 foreach ( (array) $plugins['all'] as $plugin_file =&gt; $plugin_data ) {
</span><span class="cx">                         // Filter into individual sections
</span><del>-                        if ( is_plugin_active_for_network($plugin_file) &amp;&amp; !$this-&gt;screen-&gt;is_network ) {
</del><ins>+                        if ( is_plugin_active_for_network($plugin_file) &amp;&amp; !$screen-&gt;is_network ) {
</ins><span class="cx">                                 unset( $plugins['all'][ $plugin_file ] );
</span><span class="cx">                                 continue;
</span><span class="cx">                         } elseif ( is_multisite() &amp;&amp; is_network_only_plugin( $plugin_file ) &amp;&amp; !current_user_can( 'manage_network_plugins' ) ) {
</span><span class="cx">                                 $plugins['network'][ $plugin_file ] = $plugin_data;
</span><del>-                        } elseif ( ( !$this-&gt;screen-&gt;is_network &amp;&amp; is_plugin_active( $plugin_file ) )
-                                || ( $this-&gt;screen-&gt;is_network &amp;&amp; is_plugin_active_for_network( $plugin_file ) ) ) {
</del><ins>+                        } elseif ( ( !$screen-&gt;is_network &amp;&amp; is_plugin_active( $plugin_file ) )
+                                || ( $screen-&gt;is_network &amp;&amp; is_plugin_active_for_network( $plugin_file ) ) ) {
</ins><span class="cx">                                 $plugins['active'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                         } else {
</span><del>-                                if ( !$this-&gt;screen-&gt;is_network &amp;&amp; isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
</del><ins>+                                if ( !$screen-&gt;is_network &amp;&amp; isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
</ins><span class="cx">                                         $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                                 $plugins['inactive'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                         }
</span><span class="lines">@@ -128,7 +130,7 @@
</span><span class="cx">                         uasort( $this-&gt;items, array( &amp;$this, '_order_callback' ) );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $plugins_per_page = $this-&gt;get_items_per_page( str_replace( '-', '_', &quot;{$this-&gt;screen-&gt;id}_per_page&quot; ) );
</del><ins>+                $plugins_per_page = $this-&gt;get_items_per_page( str_replace( '-', '_', $screen-&gt;id . '_per_page' ) );
</ins><span class="cx"> 
</span><span class="cx">                 $start = ( $page - 1 ) * $plugins_per_page;
</span><span class="cx"> 
</span><span class="lines">@@ -253,15 +255,17 @@
</span><span class="cx"> 
</span><span class="cx">                 $actions = array();
</span><span class="cx"> 
</span><ins>+                $screen = get_current_screen();
+
</ins><span class="cx">                 if ( 'active' != $status ) {
</span><del>-                        $action = $this-&gt;screen-&gt;is_network ? 'network-activate-selected' : 'activate-selected'; 
</del><ins>+                        $action = $screen-&gt;is_network ? 'network-activate-selected' : 'activate-selected'; 
</ins><span class="cx">                         $actions[ $action ] = __( 'Activate' );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( 'inactive' != $status &amp;&amp; 'recent' != $status )
</span><span class="cx">                         $actions['deactivate-selected'] = __( 'Deactivate' );
</span><span class="cx"> 
</span><del>-                if ( !is_multisite() || $this-&gt;screen-&gt;is_network ) {
</del><ins>+                if ( !is_multisite() || $screen-&gt;is_network ) {
</ins><span class="cx">                         if ( current_user_can( 'update_plugins' ) )
</span><span class="cx">                                 $actions['update-selected'] = __( 'Update' );
</span><span class="cx">                         if ( current_user_can( 'delete_plugins' ) &amp;&amp; ( 'active' != $status ) )
</span><span class="lines">@@ -302,6 +306,8 @@
</span><span class="cx"> 
</span><span class="cx">                 $context = $status;
</span><span class="cx"> 
</span><ins>+                $screen = get_current_screen();
+
</ins><span class="cx">                 foreach ( $this-&gt;items as $plugin_file =&gt; $plugin_data ) {
</span><span class="cx">                         // preorder
</span><span class="cx">                         $actions = array(
</span><span class="lines">@@ -313,11 +319,11 @@
</span><span class="cx">                         );
</span><span class="cx"> 
</span><span class="cx">                         if ( 'mustuse' == $context ) {
</span><del>-                                if ( is_multisite() &amp;&amp; !$this-&gt;screen-&gt;is_network )
</del><ins>+                                if ( is_multisite() &amp;&amp; !$screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx">                                 $is_active = true;
</span><span class="cx">                         } elseif ( 'dropins' == $context ) {
</span><del>-                                if ( is_multisite() &amp;&amp; !$this-&gt;screen-&gt;is_network )
</del><ins>+                                if ( is_multisite() &amp;&amp; !$screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx">                                 $dropins = _get_dropins();
</span><span class="cx">                                 $plugin_name = $plugin_file;
</span><span class="lines">@@ -337,15 +343,15 @@
</span><span class="cx">                                         $description .= '&lt;p&gt;' . $plugin_data['Description'] . '&lt;/p&gt;';
</span><span class="cx">                         } else {
</span><span class="cx">                                 $is_active_for_network = is_plugin_active_for_network($plugin_file);
</span><del>-                                if ( $this-&gt;screen-&gt;is_network )
</del><ins>+                                if ( $screen-&gt;is_network )
</ins><span class="cx">                                         $is_active = $is_active_for_network;
</span><span class="cx">                                 else
</span><span class="cx">                                         $is_active = is_plugin_active( $plugin_file );
</span><span class="cx"> 
</span><del>-                                if ( $is_active_for_network &amp;&amp; !is_super_admin() &amp;&amp; !$this-&gt;screen-&gt;is_network )
</del><ins>+                                if ( $is_active_for_network &amp;&amp; !is_super_admin() &amp;&amp; !$screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx"> 
</span><del>-                                if ( $this-&gt;screen-&gt;is_network ) {
</del><ins>+                                if ( $screen-&gt;is_network ) {
</ins><span class="cx">                                         if ( $is_active_for_network ) {
</span><span class="cx">                                                 if ( current_user_can( 'manage_network_plugins' ) )
</span><span class="cx">                                                         $actions['network_deactivate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=deactivate&amp;amp;networkwide=1&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Deactivate this plugin') . '&quot;&gt;' . __('Network Deactivate') . '&lt;/a&gt;';
</span><span class="lines">@@ -359,7 +365,7 @@
</span><span class="cx">                                         if ( $is_active ) {
</span><span class="cx">                                                 $actions['deactivate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=deactivate&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Deactivate this plugin') . '&quot;&gt;' . __('Deactivate') . '&lt;/a&gt;';
</span><span class="cx">                                         } else {
</span><del>-                                                if ( is_network_only_plugin( $plugin_file ) &amp;&amp; !$this-&gt;screen-&gt;is_network )
</del><ins>+                                                if ( is_network_only_plugin( $plugin_file ) &amp;&amp; !$screen-&gt;is_network )
</ins><span class="cx">                                                         continue;
</span><span class="cx"> 
</span><span class="cx">                                                 $actions['activate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=activate&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Activate this plugin') . '&quot; class=&quot;edit&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</span><span class="lines">@@ -367,7 +373,7 @@
</span><span class="cx">                                                 if ( ! is_multisite() &amp;&amp; current_user_can('delete_plugins') )
</span><span class="cx">                                                         $actions['delete'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=delete-selected&amp;amp;checked[]=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'bulk-plugins') . '&quot; title=&quot;' . __('Delete this plugin') . '&quot; class=&quot;delete&quot;&gt;' . __('Delete') . '&lt;/a&gt;';
</span><span class="cx">                                         } // end if $is_active
</span><del>-                                 } // end if $this-&gt;screen-&gt;is_network
</del><ins>+                                 } // end if $screen-&gt;is_network
</ins><span class="cx"> 
</span><span class="cx">                                 if ( current_user_can('edit_plugins') &amp;&amp; is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
</span><span class="cx">                                         $actions['edit'] = '&lt;a href=&quot;plugin-editor.php?file=' . $plugin_file . '&quot; title=&quot;' . __('Open this file in the Plugin Editor') . '&quot; class=&quot;edit&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-posts-list-table.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-posts-list-table.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/class-wp-posts-list-table.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function get_columns() {
</span><del>-                $screen = $this-&gt;screen;
</del><ins>+                $screen = get_current_screen();
</ins><span class="cx"> 
</span><span class="cx">                 if ( empty( $screen ) )
</span><span class="cx">                         $post_type = 'post';
</span><span class="lines">@@ -681,7 +681,7 @@
</span><span class="cx">         function inline_edit() {
</span><span class="cx">                 global $mode;
</span><span class="cx"> 
</span><del>-                $screen = $this-&gt;screen;
</del><ins>+                $screen = get_current_screen();
</ins><span class="cx"> 
</span><span class="cx">                 $post = get_default_post_to_edit( $screen-&gt;post_type );
</span><span class="cx">                 $post_type_object = get_post_type_object( $screen-&gt;post_type );
</span></span></pre></div>
<a id="trunkwpadminincludesclasswptermslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-terms-list-table.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-terms-list-table.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/class-wp-terms-list-table.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -290,7 +290,9 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function column_default( $tag, $column_name ) {
</span><del>-                return apply_filters( &quot;manage_{$this-&gt;screen-&gt;taxonomy}_custom_column&quot;, '', $column_name, $tag-&gt;term_id );
</del><ins>+                $screen = get_current_screen();
+
+                return apply_filters( &quot;manage_{$screen-&gt;taxonomy}_custom_column&quot;, '', $column_name, $tag-&gt;term_id );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span></span></pre></div>
<a id="trunkwpadminincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/deprecated.php (16234 => 16235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/deprecated.php        2010-11-08 10:21:34 UTC (rev 16234)
+++ trunk/wp-admin/includes/deprecated.php        2010-11-08 15:43:44 UTC (rev 16235)
</span><span class="lines">@@ -703,10 +703,7 @@
</span><span class="cx"> function register_column_headers($screen, $columns) {
</span><span class="cx">         _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
</span><span class="cx"> 
</span><del>-        global $wp_list_table;
-
-        $wp_list_table = new _WP_List_Table_Compat($screen);
-        $wp_list_table-&gt;_columns = $columns;
</del><ins>+        $wp_list_table = new _WP_List_Table_Compat($screen, $columns);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -719,25 +716,36 @@
</span><span class="cx"> function print_column_headers($screen, $id = true) {
</span><span class="cx">         _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' );
</span><span class="cx"> 
</span><del>-        global $wp_list_table;
-        if ( !is_a($wp_list_table, 'WP_List_Table') )
-                $wp_list_table = new _WP_List_Table_Compat($screen);
</del><ins>+        $wp_list_table = new _WP_List_Table_Compat($screen);
</ins><span class="cx"> 
</span><span class="cx">         $wp_list_table-&gt;print_column_headers($id);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Helper class to be used only by deprecated functions
</span><span class="cx"> class _WP_List_Table_Compat extends WP_List_Table {
</span><ins>+        var $_screen;
+        var $_columns;
</ins><span class="cx"> 
</span><del>-        var $_columns = array();
</del><ins>+        function _WP_List_Table_Compat( $screen, $columns = array() ) {
+                if ( is_string( $screen ) )
+                        $screen = convert_to_screen( $screen );
</ins><span class="cx"> 
</span><del>-        function _WP_List_Table_Compat( $screen ) {
-                parent::WP_List_Table( array(
-                        'screen' =&gt; $screen,
-                        'ajax' =&gt; false
-                ) );
</del><ins>+                $this-&gt;_screen = $screen;
+
+                if ( !empty( $columns ) ) {
+                        $this-&gt;_columns = $columns;
+                        add_filter( 'manage_' . $screen-&gt;id . '_columns', array( &amp;$this, 'get_columns' ), 0 );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        function get_column_info() {
+                $columns = get_column_headers( $this-&gt;_screen );
+                $hidden = get_hidden_columns( $this-&gt;_screen );
+                $sortable = array();
+
+                return array( $columns, $hidden, $sortable );
+        }
+
</ins><span class="cx">         function get_columns() {
</span><span class="cx">                 return $this-&gt;_columns;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>