Introduce get_list_table(). See #14579
git-svn-id: http://svn.automattic.com/wordpress/trunk@15528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
385dbb646d
commit
75219a5110
|
@ -51,12 +51,11 @@ if ( ! is_user_logged_in() ) {
|
||||||
if ( isset( $_GET['action'] ) ) :
|
if ( isset( $_GET['action'] ) ) :
|
||||||
switch ( $action = $_GET['action'] ) :
|
switch ( $action = $_GET['action'] ) :
|
||||||
case 'fetch-list' :
|
case 'fetch-list' :
|
||||||
require_once( './includes/default-list-tables.php' );
|
require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' );
|
||||||
|
|
||||||
$class = $_GET['list_args']['class'];
|
$class = $_GET['list_args']['class'];
|
||||||
|
|
||||||
if ( class_exists( $class ) ) {
|
if ( class_exists( $class ) ) {
|
||||||
global $current_screen;
|
|
||||||
$current_screen = (object) $_GET['list_args']['screen'];
|
$current_screen = (object) $_GET['list_args']['screen'];
|
||||||
$wp_list_table = new $class;
|
$wp_list_table = new $class;
|
||||||
$wp_list_table->ajax_response();
|
$wp_list_table->ajax_response();
|
||||||
|
@ -557,8 +556,7 @@ case 'add-tag' :
|
||||||
if ( isset($_POST['screen']) )
|
if ( isset($_POST['screen']) )
|
||||||
set_current_screen($_POST['screen']);
|
set_current_screen($_POST['screen']);
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('terms');
|
||||||
$wp_list_table = new WP_Terms_Table();
|
|
||||||
|
|
||||||
$level = 0;
|
$level = 0;
|
||||||
$tag_full_name = false;
|
$tag_full_name = false;
|
||||||
|
@ -625,8 +623,7 @@ case 'add-comment' :
|
||||||
if ( !current_user_can( 'edit_posts' ) )
|
if ( !current_user_can( 'edit_posts' ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table();
|
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
|
||||||
if ( !$wp_list_table->has_items() )
|
if ( !$wp_list_table->has_items() )
|
||||||
|
@ -654,8 +651,7 @@ case 'get-comments' :
|
||||||
if ( !current_user_can( 'edit_post', $post_ID ) )
|
if ( !current_user_can( 'edit_post', $post_ID ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table();
|
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
|
||||||
if ( !$wp_list_table->has_items() )
|
if ( !$wp_list_table->has_items() )
|
||||||
|
@ -679,8 +675,7 @@ case 'get-comments' :
|
||||||
case 'replyto-comment' :
|
case 'replyto-comment' :
|
||||||
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
|
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table();
|
|
||||||
|
|
||||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||||
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
|
||||||
|
@ -761,8 +756,7 @@ case 'edit-comment' :
|
||||||
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
|
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
|
||||||
$comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
|
$comments_listing = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table();
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$wp_list_table->single_row( $comment_id, $mode, $comments_listing, $checkbox );
|
$wp_list_table->single_row( $comment_id, $mode, $comments_listing, $checkbox );
|
||||||
|
@ -910,8 +904,7 @@ case 'add-user' :
|
||||||
}
|
}
|
||||||
$user_object = new WP_User( $user_id );
|
$user_object = new WP_User( $user_id );
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('users');
|
||||||
$wp_list_table = new WP_Users_Table();
|
|
||||||
|
|
||||||
$x = new WP_Ajax_Response( array(
|
$x = new WP_Ajax_Response( array(
|
||||||
'what' => 'user',
|
'what' => 'user',
|
||||||
|
@ -1203,8 +1196,7 @@ case 'inline-save':
|
||||||
// update the post
|
// update the post
|
||||||
edit_post();
|
edit_post();
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('posts');
|
||||||
$wp_list_table = new WP_Posts_Table();
|
|
||||||
|
|
||||||
$mode = $_POST['post_view'];
|
$mode = $_POST['post_view'];
|
||||||
$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) );
|
$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) );
|
||||||
|
@ -1214,8 +1206,7 @@ case 'inline-save':
|
||||||
case 'inline-save-tax':
|
case 'inline-save-tax':
|
||||||
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('terms');
|
||||||
$wp_list_table = new WP_Terms_Table();
|
|
||||||
|
|
||||||
$wp_list_table->check_permissions('edit');
|
$wp_list_table->check_permissions('edit');
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
|
|
||||||
$wp_list_table = new WP_Comments_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
if ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
|
if ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('terms');
|
||||||
|
|
||||||
$wp_list_table = new WP_Terms_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
$title = $tax->labels->name;
|
$title = $tax->labels->name;
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once( './admin.php' );
|
require_once( './admin.php' );
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('posts');
|
||||||
|
|
||||||
$wp_list_table = new WP_Posts_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
// Back-compat for viewing comments of an entry
|
// Back-compat for viewing comments of an entry
|
||||||
|
|
|
@ -628,8 +628,9 @@ class WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle an incoming ajax request ( called from admin-ajax.php )
|
* Handle an incoming ajax request (called from admin-ajax.php)
|
||||||
*
|
*
|
||||||
|
* @since 3.1.0
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function ajax_response() {
|
function ajax_response() {
|
||||||
|
@ -665,3 +666,23 @@ class WP_List_Table {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch an instance of a WP_List_Table class
|
||||||
|
*
|
||||||
|
* @since 3.1.0
|
||||||
|
*
|
||||||
|
* @param string $type The type of the list table
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function get_list_table( $type ) {
|
||||||
|
require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' );
|
||||||
|
|
||||||
|
$type = strtr( ucwords( strtr( $type, '-', ' ') ), ' ', '_' );
|
||||||
|
|
||||||
|
$class = "WP_{$type}_Table";
|
||||||
|
$class = apply_filters( "get_list_table_$type", $class );
|
||||||
|
|
||||||
|
return new $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -462,8 +462,7 @@ function post_comment_meta_box($post) {
|
||||||
add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
|
add_filter('manage_edit-comments_columns', 'post_comment_meta_box_thead', 8, 1);
|
||||||
add_filter('manage_edit-comments_sortable_columns', create_function('', 'return array();'), 8);
|
add_filter('manage_edit-comments_sortable_columns', create_function('', 'return array();'), 8);
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table;
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
|
<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
|
||||||
|
|
|
@ -293,8 +293,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('comments');
|
||||||
$wp_list_table = new WP_Comments_Table( 'reply' );
|
|
||||||
|
|
||||||
$columns = $wp_list_table->get_column_headers();
|
$columns = $wp_list_table->get_column_headers();
|
||||||
$hidden = array_intersect( array_keys( $columns ), array_filter( $wp_list_table->get_hidden_columns() ) );
|
$hidden = array_intersect( array_keys( $columns ), array_filter( $wp_list_table->get_hidden_columns() ) );
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** Load WordPress Administration Bootstrap */
|
/** Load WordPress Administration Bootstrap */
|
||||||
require_once ('admin.php');
|
require_once ('admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('links');
|
||||||
|
|
||||||
$wp_list_table = new WP_Links_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
// Handle bulk deletes
|
// Handle bulk deletes
|
||||||
|
|
|
@ -12,9 +12,7 @@ require_once( './admin.php' );
|
||||||
if ( ! is_multisite() )
|
if ( ! is_multisite() )
|
||||||
wp_die( __( 'Multisite support is not enabled.' ) );
|
wp_die( __( 'Multisite support is not enabled.' ) );
|
||||||
|
|
||||||
require_once( '../includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('sites');
|
||||||
|
|
||||||
$wp_list_table = new WP_Sites_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
$title = __( 'Sites' );
|
$title = __( 'Sites' );
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
|
|
||||||
require_once( './admin.php' );
|
require_once( './admin.php' );
|
||||||
|
|
||||||
require_once( '../includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('ms-users');
|
||||||
|
|
||||||
$wp_list_table = new WP_MS_Users_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('plugin-install');
|
||||||
|
|
||||||
$wp_list_table = new WP_Plugin_Install_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( ABSPATH . 'wp-admin/includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('plugins');
|
||||||
|
|
||||||
$wp_list_table = new WP_Plugins_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
if ( isset($_POST['clear-recent-list']) )
|
if ( isset($_POST['clear-recent-list']) )
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('theme-install');
|
||||||
|
|
||||||
$wp_list_table = new WP_Theme_Install_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
$wp_list_table->prepare_items();
|
$wp_list_table->prepare_items();
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once('./admin.php');
|
require_once('./admin.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('themes');
|
||||||
|
|
||||||
$wp_list_table = new WP_Themes_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
if ( current_user_can('switch_themes') && isset($_GET['action']) ) {
|
if ( current_user_can('switch_themes') && isset($_GET['action']) ) {
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
/** WordPress Administration Bootstrap */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once( './admin.php' );
|
require_once( './admin.php' );
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('media');
|
||||||
|
|
||||||
$wp_list_table = new WP_Media_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
// Handle bulk actions
|
// Handle bulk actions
|
||||||
|
|
|
@ -12,9 +12,7 @@ require_once( './admin.php' );
|
||||||
/** WordPress Registration API */
|
/** WordPress Registration API */
|
||||||
require_once( ABSPATH . WPINC . '/registration.php');
|
require_once( ABSPATH . WPINC . '/registration.php');
|
||||||
|
|
||||||
require_once( './includes/default-list-tables.php' );
|
$wp_list_table = get_list_table('users');
|
||||||
|
|
||||||
$wp_list_table = new WP_Users_Table;
|
|
||||||
$wp_list_table->check_permissions();
|
$wp_list_table->check_permissions();
|
||||||
|
|
||||||
$title = __('Users');
|
$title = __('Users');
|
||||||
|
|
Loading…
Reference in New Issue