diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index c2aa989e12..8eed276a54 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -52,6 +52,8 @@ if ( isset( $_GET['action'] ) ) : switch ( $action = $_GET['action'] ) : case 'fetch-list' : require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' ); + // Temp + require_once( ABSPATH . '/wp-admin/includes/list-table-posts.php' ); $class = $_GET['list_args']['class']; diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php index dde7a881c5..449085b27b 100644 --- a/wp-admin/includes/admin.php +++ b/wp-admin/includes/admin.php @@ -40,7 +40,7 @@ require_once(ABSPATH . 'wp-admin/includes/taxonomy.php'); require_once(ABSPATH . 'wp-admin/includes/template.php'); /** WordPress List Table Administration API */ -require_once(ABSPATH . 'wp-admin/includes/list-table.php'); +require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); /** WordPress Theme Administration API */ require_once(ABSPATH . 'wp-admin/includes/theme.php'); diff --git a/wp-admin/includes/list-table.php b/wp-admin/includes/class-wp-list-table.php similarity index 99% rename from wp-admin/includes/list-table.php rename to wp-admin/includes/class-wp-list-table.php index b945311c65..9dda644d5c 100644 --- a/wp-admin/includes/list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -820,6 +820,8 @@ class WP_List_Table { */ function get_list_table( $type ) { require_once( ABSPATH . '/wp-admin/includes/default-list-tables.php' ); + // Temp + require_once( ABSPATH . '/wp-admin/includes/list-table-posts.php' ); $class = 'WP_' . strtr( ucwords( strtr( $type, '-', ' ') ), ' ', '_' ) . '_Table'; $class = apply_filters( "get_list_table_$type", $class ); diff --git a/wp-admin/includes/default-list-tables.php b/wp-admin/includes/default-list-tables.php index f55f391d00..d6efc7afbd 100644 --- a/wp-admin/includes/default-list-tables.php +++ b/wp-admin/includes/default-list-tables.php @@ -9,979 +9,6 @@ * @subpackage Administration */ -class WP_Posts_Table extends WP_List_Table { - - /** - * Whether the items should be displayed hierarchically or linearly - * - * @since 3.1.0 - * @var bool - * @access protected - */ - var $hierarchical_display; - - /** - * Holds the number of pending comments for each post - * - * @since 3.1.0 - * @var bool - * @access protected - */ - var $comment_pending_count; - - /** - * Holds the number of posts for this user - * - * @since 3.1.0 - * @var bool - * @access private - */ - var $user_posts_count; - - function WP_Posts_Table() { - global $post_type_object, $post_type, $current_screen, $wpdb; - - if ( !isset( $_REQUEST['post_type'] ) ) - $post_type = 'post'; - elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) ) - $post_type = $_REQUEST['post_type']; - else - wp_die( __( 'Invalid post type' ) ); - $_REQUEST['post_type'] = $post_type; - - $post_type_object = get_post_type_object( $post_type ); - - if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { - $this->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 ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) ) - $_GET['author'] = get_current_user_id(); - } - - parent::WP_List_Table( array( - 'screen' => $current_screen, - 'plural' => 'posts', - ) ); - } - - function check_permissions() { - global $post_type_object; - - if ( !current_user_can( $post_type_object->cap->edit_posts ) ) - wp_die( __( 'Cheatin’ uh?' ) ); - } - - function prepare_items() { - global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode; - - $avail_post_stati = wp_edit_posts_query(); - - $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] ); - - $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; - - $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); - $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); - - if ( $this->hierarchical_display ) - $total_pages = ceil( $total_items / $per_page ); - else - $total_pages = $wp_query->max_num_pages; - - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; - - $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash'; - - $this->set_pagination_args( array( - 'total_items' => $total_items, - 'total_pages' => $total_pages, - 'per_page' => $per_page - ) ); - } - - function has_items() { - return have_posts(); - } - - function no_items() { - global $post_type_object; - - if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] ) - echo $post_type_object->labels->not_found_in_trash; - else - echo $post_type_object->labels->not_found; - } - - 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 = ''; - - $current_user_id = get_current_user_id(); - - if ( $this->user_posts_count ) { - if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) ) - $class = ' class="current"'; - $status_links['mine'] = "