Make the class to filename mapping easier to read.

Ensure that we support PHP4 for now by passing references to objects in list tables code.
See #14579.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-11-01 08:37:02 +00:00
parent e1be64d2d0
commit a4d26eefc2
3 changed files with 23 additions and 12 deletions

View File

@ -89,7 +89,7 @@ class WP_List_Table {
if ( is_string( $this->_screen ) )
$this->_screen = convert_to_screen( $this->_screen );
add_filter( 'manage_' . $this->_screen->id . '_columns', array( $this, 'get_columns' ), 0 );
add_filter( 'manage_' . $this->_screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
if ( !$args['plural'] )
$args['plural'] = $this->_screen->base;
@ -98,7 +98,7 @@ class WP_List_Table {
if ( $args['ajax'] ) {
wp_enqueue_script( 'list-table' );
add_action( 'admin_footer', array( $this, '_js_vars' ) );
add_action( 'admin_footer', array( &$this, '_js_vars' ) );
}
}
@ -762,7 +762,7 @@ class WP_List_Table {
}
elseif ( method_exists( $this, 'column_' . $column_name ) ) {
echo "<td $attributes>";
echo call_user_func( array( $this, 'column_' . $column_name ), $item );
echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
echo "</td>";
}
else {
@ -846,11 +846,22 @@ function get_list_table( $class ) {
* @return bool True on success, false on failure.
*/
function require_list_table( $class ) {
$core_classes = array( 'WP_Posts_Table' => 'posts', 'WP_Media_Table' => 'media', 'WP_Terms_Table' => 'terms',
'WP_Users_Table' => 'users', 'WP_Comments_Table' => 'comments', 'WP_Post_Comments_Table' => 'comments',
'WP_Links_Table' => 'links', 'WP_Sites_Table' => 'sites', 'WP_MS_Users_Table' => 'ms-users',
'WP_Plugins_Table' => 'plugins', 'WP_Plugin_Install_Table' => 'plugin-install', 'WP_Themes_Table' => 'themes',
'WP_Theme_Install_Table' => 'theme-install', 'WP_MS_Themes_Table' => 'ms-themes' );
$core_classes = array(
'WP_Posts_Table' => 'posts',
'WP_Media_Table' => 'media',
'WP_Terms_Table' => 'terms',
'WP_Users_Table' => 'users',
'WP_Comments_Table' => 'comments',
'WP_Post_Comments_Table' => 'comments',
'WP_Links_Table' => 'links',
'WP_Sites_Table' => 'sites',
'WP_MS_Users_Table' => 'ms-users',
'WP_Plugins_Table' => 'plugins',
'WP_Plugin_Install_Table' => 'plugin-install',
'WP_Themes_Table' => 'themes',
'WP_Theme_Install_Table' => 'theme-install',
'WP_MS_Themes_Table' => 'ms-themes',
);
if ( isset( $core_classes[ $class ] ) ) {
require_once( ABSPATH . '/wp-admin/includes/list-table-' . $core_classes[ $class ] . '.php' );

View File

@ -76,7 +76,7 @@ class WP_MS_Themes_Table extends WP_List_Table {
if ( $s ) {
$status = 'search';
$themes['search'] = array_filter( $themes['all'], array( $this, '_search_callback' ) );
$themes['search'] = array_filter( $themes['all'], array( &$this, '_search_callback' ) );
}
$totals = array();
@ -93,7 +93,7 @@ class WP_MS_Themes_Table extends WP_List_Table {
$orderby = ucfirst( $orderby );
$order = strtoupper( $order );
uasort( $this->items, array( $this, '_order_callback' ) );
uasort( $this->items, array( &$this, '_order_callback' ) );
}
$themes_per_page = $this->get_items_per_page( 'themes_per_page', 999 );

View File

@ -109,7 +109,7 @@ class WP_Plugins_Table extends WP_List_Table {
if ( $s ) {
$status = 'search';
$plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
$plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );
}
$totals = array();
@ -126,7 +126,7 @@ class WP_Plugins_Table extends WP_List_Table {
$orderby = ucfirst( $orderby );
$order = strtoupper( $order );
uasort( $this->items, array( $this, '_order_callback' ) );
uasort( $this->items, array( &$this, '_order_callback' ) );
}
$plugins_per_page = $this->get_items_per_page( 'plugins_per_page', 999 );