From cae0e969ce1cc1e39ba46b947403c00b801b2df4 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 22 Aug 2010 11:22:46 +0000 Subject: [PATCH] replace $table with $wp_list_table. See #14651 git-svn-id: http://svn.automattic.com/wordpress/trunk@15519 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 52 ++++++++++++++-------------- wp-admin/edit-comments.php | 16 ++++----- wp-admin/edit-tags.php | 10 +++--- wp-admin/edit.php | 10 +++--- wp-admin/includes/deprecated.php | 39 ++++++++++----------- wp-admin/includes/meta-boxes.php | 4 +-- wp-admin/includes/plugin-install.php | 4 +-- wp-admin/includes/template.php | 16 ++++----- wp-admin/includes/theme-install.php | 4 +-- wp-admin/link-manager.php | 8 ++--- wp-admin/network/sites.php | 8 ++--- wp-admin/network/users.php | 8 ++--- wp-admin/plugin-install.php | 6 ++-- wp-admin/plugins.php | 8 ++--- wp-admin/theme-install.php | 6 ++-- wp-admin/themes.php | 8 ++--- wp-admin/upload.php | 8 ++--- wp-admin/users.php | 8 ++--- 18 files changed, 111 insertions(+), 112 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 4ef0eb8919..d0cbae7f59 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -58,8 +58,8 @@ case 'fetch-list' : if ( class_exists( $class ) ) { global $current_screen; $current_screen = (object) $_GET['list_args']['screen']; - $table = new $class; - $table->ajax_response(); + $wp_list_table = new $class; + $wp_list_table->ajax_response(); } die('0'); @@ -558,7 +558,7 @@ case 'add-tag' : set_current_screen($_POST['screen']); require_once( './includes/default-list-tables.php' ); - $table = new WP_Terms_Table(); + $wp_list_table = new WP_Terms_Table(); $level = 0; $tag_full_name = false; @@ -570,10 +570,10 @@ case 'add-tag' : $tag_full_name = $_tag->name . ' — ' . $tag_full_name; $level++; } - $noparents = $table->single_row( $tag, $level, $taxonomy ); + $noparents = $wp_list_table->single_row( $tag, $level, $taxonomy ); } $tag->name = $tag_full_name; - $parents = $table->single_row( $tag, 0, $taxonomy); + $parents = $wp_list_table->single_row( $tag, 0, $taxonomy); $x->add( array( 'what' => 'taxonomy', @@ -626,17 +626,17 @@ case 'add-comment' : die('-1'); require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table(); - $table->prepare_items(); + $wp_list_table = new WP_Comments_Table(); + $wp_list_table->prepare_items(); - if ( !$table->has_items() ) + if ( !$wp_list_table->has_items() ) die('1'); $x = new WP_Ajax_Response(); - foreach ( $table->items as $comment ) { + foreach ( $wp_list_table->items as $comment ) { get_comment( $comment ); ob_start(); - $table->single_row( $comment->comment_ID, $mode, $comment_status, true, true ); + $wp_list_table->single_row( $comment->comment_ID, $mode, $comment_status, true, true ); $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( @@ -655,18 +655,18 @@ case 'get-comments' : die('-1'); require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table(); - $table->prepare_items(); + $wp_list_table = new WP_Comments_Table(); + $wp_list_table->prepare_items(); - if ( !$table->has_items() ) + if ( !$wp_list_table->has_items() ) die('1'); $comment_list_item = ''; $x = new WP_Ajax_Response(); - foreach ( $table->items as $comment ) { + foreach ( $wp_list_table->items as $comment ) { get_comment( $comment ); ob_start(); - $table->single_row( $comment->comment_ID, 'single', false, false ); + $wp_list_table->single_row( $comment->comment_ID, 'single', false, false ); $comment_list_item .= ob_get_contents(); ob_end_clean(); } @@ -680,7 +680,7 @@ case 'replyto-comment' : check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table(); + $wp_list_table = new WP_Comments_Table(); $comment_post_ID = (int) $_POST['comment_post_ID']; if ( !current_user_can( 'edit_post', $comment_post_ID ) ) @@ -729,7 +729,7 @@ case 'replyto-comment' : require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); _wp_dashboard_recent_comments_row( $comment, false ); } else { - $table->single_row( $comment->comment_ID, $mode, false, $checkbox ); + $wp_list_table->single_row( $comment->comment_ID, $mode, false, $checkbox ); } $comment_list_item = ob_get_contents(); ob_end_clean(); @@ -762,10 +762,10 @@ case 'edit-comment' : $comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : ''; require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table(); + $wp_list_table = new WP_Comments_Table(); ob_start(); - $table->single_row( $comment_id, $mode, $comments_listing, $checkbox ); + $wp_list_table->single_row( $comment_id, $mode, $comments_listing, $checkbox ); $comment_list_item = ob_get_contents(); ob_end_clean(); @@ -911,12 +911,12 @@ case 'add-user' : $user_object = new WP_User( $user_id ); require_once( './includes/default-list-tables.php' ); - $table = new WP_Users_Table(); + $wp_list_table = new WP_Users_Table(); $x = new WP_Ajax_Response( array( 'what' => 'user', 'id' => $user_id, - 'data' => $table->single_row( $user_object, '', $user_object->roles[0] ), + 'data' => $wp_list_table->single_row( $user_object, '', $user_object->roles[0] ), 'supplemental' => array( 'show-link' => sprintf(__( 'User %s added' ), "user-$user_id", $user_object->user_login), 'role' => $user_object->roles[0] @@ -1204,10 +1204,10 @@ case 'inline-save': edit_post(); require_once( './includes/default-list-tables.php' ); - $table = new WP_Posts_Table(); + $wp_list_table = new WP_Posts_Table(); $mode = $_POST['post_view']; - $table->display_rows( array( get_post( $_POST['post_ID'] ) ) ); + $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) ); exit; break; @@ -1215,9 +1215,9 @@ case 'inline-save-tax': check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' ); require_once( './includes/default-list-tables.php' ); - $table = new WP_Terms_Table(); + $wp_list_table = new WP_Terms_Table(); - $table->check_permissions('edit'); + $wp_list_table->check_permissions('edit'); if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) ) die(-1); @@ -1234,7 +1234,7 @@ case 'inline-save-tax': die( __('Item not updated.') ); } - echo $table->single_row( $tag, 0, $taxonomy ); + echo $wp_list_table->single_row( $tag, 0, $taxonomy ); } else { if ( is_wp_error($updated) && $updated->get_error_message() ) die( $updated->get_error_message() ); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 2ba0061f44..10a64801c9 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -11,8 +11,8 @@ require_once('./admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Comments_Table; -$table->check_permissions(); +$wp_list_table = new WP_Comments_Table; +$wp_list_table->check_permissions(); if ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { check_admin_referer( 'bulk-comments' ); @@ -97,7 +97,7 @@ if ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset exit; } -$table->prepare_items(); +$wp_list_table->prepare_items(); wp_enqueue_script('admin-comments'); enqueue_comment_hotkeys_js(); @@ -257,17 +257,17 @@ unset($status_links); - - - + + + -has_items() ) { ?> +has_items() ) { ?> -display_table(); ?> +display_table(); ?>
diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index b157a6c7f2..a099210043 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -11,8 +11,8 @@ require_once('./admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Terms_Table; -$table->check_permissions(); +$wp_list_table = new WP_Terms_Table; +$wp_list_table->check_permissions(); $title = $tax->labels->name; @@ -152,7 +152,7 @@ if ( ! empty($_REQUEST['_wp_http_referer']) ) { exit; } -$table->prepare_items(); +$wp_list_table->prepare_items(); wp_enqueue_script('admin-tags'); if ( current_user_can($tax->cap->edit_terms) ) @@ -241,7 +241,7 @@ endif; ?> -display_table(); ?> +display_table(); ?>
@@ -351,7 +351,7 @@ do_action($taxonomy . '_add_form', $taxonomy); -inline_edit(); ?> +inline_edit(); ?> check_permissions(); +$wp_list_table = new WP_Posts_Table; +$wp_list_table->check_permissions(); // Back-compat for viewing comments of an entry if ( $_redirect = intval( max( @$_REQUEST['p'], @$_REQUEST['attachment_id'], @$_REQUEST['page_id'] ) ) ) { @@ -119,7 +119,7 @@ if ( 'post' != $post_type ) { $post_new_file = 'post-new.php'; } -$table->prepare_items(); +$wp_list_table->prepare_items(); wp_enqueue_script('inline-edit-post'); @@ -280,11 +280,11 @@ endif; -display(); ?> +display(); ?> -inline_edit(); ?> +inline_edit(); ?>

diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index 3f9e991a68..63506b7181 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -211,15 +211,10 @@ function use_codepress() { function register_column_headers($screen, $columns) { _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' ); - global $_wp_column_headers; + global $wp_list_table; - if ( is_string($screen) ) - $screen = convert_to_screen($screen); - - if ( !isset($_wp_column_headers) ) - $_wp_column_headers = array(); - - $_wp_column_headers[$screen->id] = $columns; + $wp_list_table = new _WP_List_Table_Compat($screen); + $wp_list_table->_columns = $columns; } /** @@ -235,8 +230,11 @@ function register_column_headers($screen, $columns) { function get_column_headers($screen) { _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' ); - $table = new _WP_List_Table_Compat($screen); - list( $columns ) = $table->get_column_headers(); + global $wp_list_table; + if ( !is_a($wp_list_table, 'WP_List_Table') ) + $wp_list_table = new _WP_List_Table_Compat($screen); + + list( $columns ) = $wp_list_table->get_column_headers(); return $columns; } @@ -251,9 +249,11 @@ function get_column_headers($screen) { function print_column_headers($screen, $id = true) { _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' ); - $table = new _WP_List_Table_Compat($screen); + global $wp_list_table; + if ( !is_a($wp_list_table, 'WP_List_Table') ) + $wp_list_table = new _WP_List_Table_Compat($screen); - $table->print_column_headers($id); + $wp_list_table->print_column_headers($id); } /** @@ -269,14 +269,18 @@ function print_column_headers($screen, $id = true) { function get_hidden_columns($screen) { _deprecated_function( __FUNCTION__, '3.1', 'WP_List_Table' ); - $table = new _WP_List_Table_Compat($screen); + global $wp_list_table; + if ( !is_a($wp_list_table, 'WP_List_Table') ) + $wp_list_table = new _WP_List_Table_Compat($screen); - return $table->get_hidden_columns(); + return $wp_list_table->get_hidden_columns(); } // Helper class to be used only by deprecated functions class _WP_List_Table_Compat extends WP_List_Table { + var $_columns = array(); + function _WP_List_Table_Compat( $screen) { parent::WP_List_Table( array( 'screen' => $screen, @@ -285,12 +289,7 @@ class _WP_List_Table_Compat extends WP_List_Table { } function get_columns() { - global $_wp_column_headers; - - if ( isset($_wp_column_headers[$this->_screen->id]) ) - return $_wp_column_headers[$this->_screen->id]; - - return array(); + return $this->_columns; } } diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 71c871a2e7..284a2ece1b 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -463,12 +463,12 @@ function post_comment_meta_box($post) { add_filter('manage_edit-comments_sortable_columns', create_function('', 'return array();'), 8); require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table; + $wp_list_table = new WP_Comments_Table; ?> - print_column_headers(); ?> + print_column_headers(); ?> diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 31a63680a9..1fc59434b7 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -162,9 +162,9 @@ add_action('install_plugins_upload', 'install_plugins_upload', 10, 1); * @param int $total_plugins Number of plugins. */ function display_plugins_table() { - global $table; + global $wp_list_table; - $table->display(); + $wp_list_table->display(); } add_action('install_plugins_search', 'display_plugins_table'); add_action('install_plugins_featured', 'display_plugins_table'); diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index c1b898adf4..0b00c7ca85 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -294,10 +294,10 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', } require_once( './includes/default-list-tables.php' ); - $table = new WP_Comments_Table( 'reply' ); + $wp_list_table = new WP_Comments_Table( 'reply' ); - $columns = $table->get_column_headers(); - $hidden = array_intersect( array_keys( $columns ), array_filter( $table->get_hidden_columns() ) ); + $columns = $wp_list_table->get_column_headers(); + $hidden = array_intersect( array_keys( $columns ), array_filter( $wp_list_table->get_hidden_columns() ) ); $col_count = count($columns) - count($hidden); ?> @@ -1293,9 +1293,9 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F * @param unknown_type $page */ function manage_columns_prefs( $page ) { - global $table; + global $wp_list_table; - list( $columns, $hidden ) = $table->get_column_headers(); + list( $columns, $hidden ) = $wp_list_table->get_column_headers(); $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username'); @@ -1629,13 +1629,13 @@ function convert_to_screen( $screen ) { } function screen_meta($screen) { - global $wp_meta_boxes, $_wp_contextual_help, $title, $table; + global $wp_meta_boxes, $_wp_contextual_help, $title, $wp_list_table; if ( is_string($screen) ) $screen = convert_to_screen($screen); - if ( is_a($table, 'WP_List_Table') ) - list( $screen_columns ) = $table->get_column_headers(); + if ( is_a($wp_list_table, 'WP_List_Table') ) + list( $screen_columns ) = $wp_list_table->get_column_headers(); $meta_screens = array('index' => 'dashboard'); if ( isset($meta_screens[$screen->id]) ) { diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index 675428dda9..e135622306 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -261,9 +261,9 @@ function display_theme($theme, $actions = null, $show_details = true) { * @since 2.8.0 */ function display_themes() { - global $table; + global $wp_list_table; - $table->display(); + $wp_list_table->display(); } add_action('install_themes_search', 'display_themes'); add_action('install_themes_featured', 'display_themes'); diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index dd5540f3a7..19455b0f78 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -11,8 +11,8 @@ require_once ('admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Links_Table; -$table->check_permissions(); +$wp_list_table = new WP_Links_Table; +$wp_list_table->check_permissions(); // Handle bulk deletes if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['linkcheck'] ) ) { @@ -35,7 +35,7 @@ if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['linkcheck'] ) ) { exit; } -$table->prepare_items(); +$wp_list_table->prepare_items(); $title = __('Links'); $this_file = $parent_file = 'link-manager.php'; @@ -84,7 +84,7 @@ if ( isset($_REQUEST['deleted']) ) {
-display(); ?> +display(); ?>
diff --git a/wp-admin/network/sites.php b/wp-admin/network/sites.php index 2681fb0b67..97a6c0d624 100644 --- a/wp-admin/network/sites.php +++ b/wp-admin/network/sites.php @@ -14,8 +14,8 @@ if ( ! is_multisite() ) require_once( '../includes/default-list-tables.php' ); -$table = new WP_Sites_Table; -$table->check_permissions(); +$wp_list_table = new WP_Sites_Table; +$wp_list_table->check_permissions(); $title = __( 'Sites' ); $parent_file = 'sites.php'; @@ -350,7 +350,7 @@ switch ( $action ) { // List sites case 'list': default: - $table->prepare_items(); + $wp_list_table->prepare_items(); require_once( '../admin-header.php' ); ?> @@ -378,7 +378,7 @@ switch ( $action ) {
- display(); ?> + display(); ?>
diff --git a/wp-admin/network/users.php b/wp-admin/network/users.php index 6378c74b5a..b5d49d0a1d 100644 --- a/wp-admin/network/users.php +++ b/wp-admin/network/users.php @@ -11,9 +11,9 @@ require_once( './admin.php' ); require_once( '../includes/default-list-tables.php' ); -$table = new WP_MS_Users_Table; -$table->check_permissions(); -$table->prepare_items(); +$wp_list_table = new WP_MS_Users_Table; +$wp_list_table->check_permissions(); +$wp_list_table->prepare_items(); $title = __( 'Users' ); $parent_file = 'users.php'; @@ -78,7 +78,7 @@ if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty(
- display(); ?> + display(); ?>
diff --git a/wp-admin/plugin-install.php b/wp-admin/plugin-install.php index a298975bf0..8abbf1930b 100644 --- a/wp-admin/plugin-install.php +++ b/wp-admin/plugin-install.php @@ -11,9 +11,9 @@ require_once('./admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Plugin_Install_Table; -$table->check_permissions(); -$table->prepare_items(); +$wp_list_table = new WP_Plugin_Install_Table; +$wp_list_table->check_permissions(); +$wp_list_table->prepare_items(); $title = __('Install Plugins'); $parent_file = 'plugins.php'; diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index e1c44d8dfc..e1637cad8a 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,8 +11,8 @@ require_once('./admin.php'); require_once( ABSPATH . 'wp-admin/includes/default-list-tables.php' ); -$table = new WP_Plugins_Table; -$table->check_permissions(); +$wp_list_table = new WP_Plugins_Table; +$wp_list_table->check_permissions(); if ( isset($_POST['clear-recent-list']) ) $action = 'clear-recent-list'; @@ -302,7 +302,7 @@ if ( !in_array( $status, array( 'all', 'active', 'inactive', 'recently_activated if ( $status != $default_status && 'search' != $status ) update_user_meta( get_current_user_id(), 'plugins_last_view', $status ); -$table->prepare_items(); +$wp_list_table->prepare_items(); wp_enqueue_script('plugin-install'); add_thickbox(); @@ -438,7 +438,7 @@ elseif ( 'dropins' == $status ) echo '

' . __( 'Drop-ins are advanced plugins in the /wp-content directory that replace WordPress functionality when present.' ) . '

'; ?> -display(); ?> +display(); ?> diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index 0bca50950e..bc1cd47ffc 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -11,9 +11,9 @@ require_once('./admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Theme_Install_Table; -$table->check_permissions(); -$table->prepare_items(); +$wp_list_table = new WP_Theme_Install_Table; +$wp_list_table->check_permissions(); +$wp_list_table->prepare_items(); $title = __('Install Themes'); $parent_file = 'themes.php'; diff --git a/wp-admin/themes.php b/wp-admin/themes.php index f0de761126..15f5068663 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -11,8 +11,8 @@ require_once('./admin.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Themes_Table; -$table->check_permissions(); +$wp_list_table = new WP_Themes_Table; +$wp_list_table->check_permissions(); if ( current_user_can('switch_themes') && isset($_GET['action']) ) { if ( 'activate' == $_GET['action'] ) { @@ -30,7 +30,7 @@ if ( current_user_can('switch_themes') && isset($_GET['action']) ) { } } -$table->prepare_items(); +$wp_list_table->prepare_items(); $title = __('Manage Themes'); $parent_file = 'themes.php'; @@ -105,7 +105,7 @@ if ( ! current_user_can( 'switch_themes' ) ) { ?>

-display(); ?> +display(); ?>
diff --git a/wp-admin/upload.php b/wp-admin/upload.php index d488f4f356..6623288f08 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -11,8 +11,8 @@ require_once( './admin.php' ); require_once( './includes/default-list-tables.php' ); -$table = new WP_Media_Table; -$table->check_permissions(); +$wp_list_table = new WP_Media_Table; +$wp_list_table->check_permissions(); // Handle bulk actions if ( isset($_REQUEST['find_detached']) ) { @@ -130,7 +130,7 @@ if ( isset($_REQUEST['find_detached']) ) { exit; } -$table->prepare_items(); +$wp_list_table->prepare_items(); $title = __('Media Library'); $parent_file = 'upload.php'; @@ -247,7 +247,7 @@ unset($type_links);
-display(); ?> +display(); ?>

diff --git a/wp-admin/users.php b/wp-admin/users.php index a7c761b4b4..08c72df0ed 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -14,8 +14,8 @@ require_once( ABSPATH . WPINC . '/registration.php'); require_once( './includes/default-list-tables.php' ); -$table = new WP_Users_Table; -$table->check_permissions(); +$wp_list_table = new WP_Users_Table; +$wp_list_table->check_permissions(); $title = __('Users'); $parent_file = 'users.php'; @@ -308,7 +308,7 @@ default: exit; } - $table->prepare_items(); + $wp_list_table->prepare_items(); include('./admin-header.php'); @@ -412,7 +412,7 @@ unset($role_links);
-display(); ?> +display(); ?>