Add access modifiers to methods and members of list table classes:

* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`

See #27881, #22234.


git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-05-19 01:16:16 +00:00
parent 99c99b77e3
commit d6a3c2a0de
14 changed files with 239 additions and 188 deletions
@@ -16,7 +16,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @var bool
* @access protected
*/
var $hierarchical_display;
protected $hierarchical_display;
/**
* Holds the number of pending comments for each post
@@ -25,7 +25,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @var int
* @access protected
*/
var $comment_pending_count;
protected $comment_pending_count;
/**
* Holds the number of posts for this user
@@ -34,7 +34,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @var int
* @access private
*/
var $user_posts_count;
private $user_posts_count;
/**
* Holds the number of posts which are sticky.
@@ -43,9 +43,9 @@ class WP_Posts_List_Table extends WP_List_Table {
* @var int
* @access private
*/
var $sticky_posts_count = 0;
private $sticky_posts_count = 0;
function __construct( $args = array() ) {
public function __construct( $args = array() ) {
global $post_type_object, $wpdb;
parent::__construct( array(
@@ -74,11 +74,11 @@ class WP_Posts_List_Table extends WP_List_Table {
}
}
function ajax_user_can() {
public function ajax_user_can() {
return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
}
function prepare_items() {
public function prepare_items() {
global $avail_post_stati, $wp_query, $per_page, $mode;
$avail_post_stati = wp_edit_posts_query();
@@ -109,18 +109,18 @@ class WP_Posts_List_Table extends WP_List_Table {
) );
}
function has_items() {
public function has_items() {
return have_posts();
}
function no_items() {
public function no_items() {
if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
else
echo get_post_type_object( $this->screen->post_type )->labels->not_found;
}
function get_views() {
protected function get_views() {
global $locked_post_status, $avail_post_stati;
$post_type = $this->screen->post_type;
@@ -181,7 +181,7 @@ class WP_Posts_List_Table extends WP_List_Table {
return $status_links;
}
function get_bulk_actions() {
protected function get_bulk_actions() {
$actions = array();
if ( $this->is_trash )
@@ -197,7 +197,7 @@ class WP_Posts_List_Table extends WP_List_Table {
return $actions;
}
function extra_tablenav( $which ) {
protected function extra_tablenav( $which ) {
global $cat;
?>
<div class="alignleft actions">
@@ -239,14 +239,14 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php
}
function current_action() {
public function current_action() {
if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
return 'delete_all';
return parent::current_action();
}
function pagination( $which ) {
protected function pagination( $which ) {
global $mode;
parent::pagination( $which );
@@ -255,11 +255,11 @@ class WP_Posts_List_Table extends WP_List_Table {
$this->view_switcher( $mode );
}
function get_table_classes() {
protected function get_table_classes() {
return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
}
function get_columns() {
protected function get_columns() {
$post_type = $this->screen->post_type;
$posts_columns = array();
@@ -345,7 +345,7 @@ class WP_Posts_List_Table extends WP_List_Table {
return $posts_columns;
}
function get_sortable_columns() {
protected function get_sortable_columns() {
return array(
'title' => 'title',
'parent' => 'parent',
@@ -354,7 +354,7 @@ class WP_Posts_List_Table extends WP_List_Table {
);
}
function display_rows( $posts = array(), $level = 0 ) {
protected function display_rows( $posts = array(), $level = 0 ) {
global $wp_query, $per_page;
if ( empty( $posts ) )
@@ -369,7 +369,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
}
function _display_rows( $posts, $level = 0 ) {
private function _display_rows( $posts, $level = 0 ) {
global $mode;
// Create array of post IDs.
@@ -384,7 +384,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$this->single_row( $post, $level );
}
function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
global $wpdb;
$level = 0;
@@ -476,7 +476,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @param int $pagenum
* @param int $per_page
*/
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
if ( ! isset( $children_pages[$parent] ) )
return;
@@ -521,7 +521,7 @@ class WP_Posts_List_Table extends WP_List_Table {
unset( $children_pages[$parent] ); //required in order to keep track of orphans
}
function single_row( $post, $level = 0 ) {
protected function single_row( $post, $level = 0 ) {
global $mode;
static $alternate;
@@ -879,7 +879,7 @@ class WP_Posts_List_Table extends WP_List_Table {
*
* @since 3.1.0
*/
function inline_edit() {
public function inline_edit() {
global $mode;
$screen = $this->screen;