X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/f9001779751f83dc8a10e478bfecb4d8dd5f964c..341dfbb66f24f5145174c373267f889c31615cc5:/wp-admin/includes/class-wp-posts-list-table.php diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index e623ab59..290939c2 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -45,17 +45,10 @@ class WP_Posts_List_Table extends WP_List_Table { */ var $sticky_posts_count = 0; - function WP_Posts_List_Table() { - global $post_type_object, $post_type, $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; + function __construct() { + global $post_type_object, $wpdb; + $post_type = get_current_screen()->post_type; $post_type_object = get_post_type_object( $post_type ); if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { @@ -74,7 +67,7 @@ class WP_Posts_List_Table extends WP_List_Table { $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) ); } - parent::WP_List_Table( array( + parent::__construct( array( 'plural' => 'posts', ) ); } @@ -86,7 +79,7 @@ class WP_Posts_List_Table extends WP_List_Table { } function prepare_items() { - global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode; + global $post_type_object, $avail_post_stati, $wp_query, $per_page, $mode; $avail_post_stati = wp_edit_posts_query(); @@ -94,6 +87,7 @@ class WP_Posts_List_Table extends WP_List_Table { $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; + $post_type = $post_type_object->name; $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type ); @@ -127,7 +121,9 @@ class WP_Posts_List_Table extends WP_List_Table { } function get_views() { - global $post_type, $post_type_object, $locked_post_status, $avail_post_stati; + global $post_type_object, $locked_post_status, $avail_post_stati; + + $post_type = $post_type_object->name; if ( !empty($locked_post_status) ) return array(); @@ -202,15 +198,15 @@ class WP_Posts_List_Table extends WP_List_Table { } function extra_tablenav( $which ) { - global $post_type, $post_type_object, $cat; + global $post_type_object, $cat; ?>