diff --git a/src/wp-admin/includes/class-wp-links-list-table.php b/src/wp-admin/includes/class-wp-links-list-table.php index 98281b0367..4d5885976a 100644 --- a/src/wp-admin/includes/class-wp-links-list-table.php +++ b/src/wp-admin/includes/class-wp-links-list-table.php @@ -9,18 +9,18 @@ */ class WP_Links_List_Table extends WP_List_Table { - function __construct( $args = array() ) { + public function __construct( $args = array() ) { parent::__construct( array( 'plural' => 'bookmarks', 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } - function ajax_user_can() { + public function ajax_user_can() { return current_user_can( 'manage_links' ); } - function prepare_items() { + public function prepare_items() { global $cat_id, $s, $orderby, $order; wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) ); @@ -39,18 +39,18 @@ class WP_Links_List_Table extends WP_List_Table { $this->items = get_bookmarks( $args ); } - function no_items() { + public function no_items() { _e( 'No links found.' ); } - function get_bulk_actions() { + protected function get_bulk_actions() { $actions = array(); $actions['delete'] = __( 'Delete' ); return $actions; } - function extra_tablenav( $which ) { + protected function extra_tablenav( $which ) { global $cat_id; if ( 'top' != $which ) @@ -75,7 +75,7 @@ class WP_Links_List_Table extends WP_List_Table { '', 'name' => _x( 'Name', 'link name' ), @@ -87,7 +87,7 @@ class WP_Links_List_Table extends WP_List_Table { ); } - function get_sortable_columns() { + protected function get_sortable_columns() { return array( 'name' => 'name', 'url' => 'url', @@ -96,7 +96,7 @@ class WP_Links_List_Table extends WP_List_Table { ); } - function display_rows() { + protected function display_rows() { global $cat_id; $alt = 0; diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 1dd01663e6..0e2456380e 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -16,7 +16,7 @@ class WP_List_Table { * @var array * @access protected */ - var $items; + protected $items; /** * Various information about the current table @@ -25,7 +25,7 @@ class WP_List_Table { * @var array * @access private */ - var $_args; + private $_args; /** * Various information needed for displaying the pagination @@ -34,7 +34,7 @@ class WP_List_Table { * @var array * @access private */ - var $_pagination_args = array(); + private $_pagination_args = array(); /** * The current screen @@ -43,7 +43,7 @@ class WP_List_Table { * @var object * @access protected */ - var $screen; + protected $screen; /** * Cached bulk actions @@ -52,7 +52,7 @@ class WP_List_Table { * @var array * @access private */ - var $_actions; + private $_actions; /** * Cached pagination output @@ -61,7 +61,7 @@ class WP_List_Table { * @var string * @access private */ - var $_pagination; + private $_pagination; /** * Constructor. The child class should call this constructor from its own constructor @@ -69,7 +69,7 @@ class WP_List_Table { * @param array $args An associative array with information about the current table * @access protected */ - function __construct( $args = array() ) { + public function __construct( $args = array() ) { $args = wp_parse_args( $args, array( 'plural' => '', 'singular' => '', @@ -95,6 +95,29 @@ class WP_List_Table { } } + /** + * Make private properties readable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @return mixed + */ + public function __get( $name ) { + return $this->$name; + } + + /** + * Make private/protected methods readable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call( $name, $arguments ) { + return call_user_func_array( array( $this, $name ), $arguments ); + } + /** * Checks the current user's permissions * @uses wp_die() @@ -103,7 +126,7 @@ class WP_List_Table { * @access public * @abstract */ - function ajax_user_can() { + public function ajax_user_can() { die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' ); } @@ -115,7 +138,7 @@ class WP_List_Table { * @access public * @abstract */ - function prepare_items() { + public function prepare_items() { die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' ); } @@ -125,7 +148,7 @@ class WP_List_Table { * @param array $args An associative array with information about the pagination * @access protected */ - function set_pagination_args( $args ) { + protected function set_pagination_args( $args ) { $args = wp_parse_args( $args, array( 'total_items' => 0, 'total_pages' => 0, @@ -153,7 +176,7 @@ class WP_List_Table { * @param string $key * @return array */ - function get_pagination_arg( $key ) { + public function get_pagination_arg( $key ) { if ( 'page' == $key ) return $this->get_pagenum(); @@ -169,7 +192,7 @@ class WP_List_Table { * * @return bool */ - function has_items() { + public function has_items() { return !empty( $this->items ); } @@ -179,7 +202,7 @@ class WP_List_Table { * @since 3.1.0 * @access public */ - function no_items() { + public function no_items() { _e( 'No items found.' ); } @@ -192,7 +215,7 @@ class WP_List_Table { * @param string $text The search button text * @param string $input_id The search input id */ - function search_box( $text, $input_id ) { + public function search_box( $text, $input_id ) { if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) return; @@ -224,7 +247,7 @@ class WP_List_Table { * * @return array */ - function get_views() { + protected function get_views() { return array(); } @@ -234,7 +257,7 @@ class WP_List_Table { * @since 3.1.0 * @access public */ - function views() { + public function views() { $views = $this->get_views(); /** * Filter the list of available list table views. @@ -268,7 +291,7 @@ class WP_List_Table { * * @return array */ - function get_bulk_actions() { + protected function get_bulk_actions() { return array(); } @@ -278,7 +301,7 @@ class WP_List_Table { * @since 3.1.0 * @access public */ - function bulk_actions() { + public function bulk_actions() { if ( is_null( $this->_actions ) ) { $no_new_actions = $this->_actions = $this->get_bulk_actions(); /** @@ -326,7 +349,7 @@ class WP_List_Table { * * @return string|bool The action name or False if no action was selected */ - function current_action() { + public function current_action() { if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) return $_REQUEST['action']; @@ -346,7 +369,7 @@ class WP_List_Table { * @param bool $always_visible Whether the actions should be always visible * @return string */ - function row_actions( $actions, $always_visible = false ) { + protected function row_actions( $actions, $always_visible = false ) { $action_count = count( $actions ); $i = 0; @@ -370,7 +393,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function months_dropdown( $post_type ) { + protected function months_dropdown( $post_type ) { global $wpdb, $wp_locale; $months = $wpdb->get_results( $wpdb->prepare( " @@ -425,7 +448,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function view_switcher( $current_mode ) { + protected function view_switcher( $current_mode ) { $modes = array( 'list' => __( 'List View' ), 'excerpt' => __( 'Excerpt View' ) @@ -453,7 +476,7 @@ class WP_List_Table { * @param int $post_id * @param int $pending_comments */ - function comments_bubble( $post_id, $pending_comments ) { + protected function comments_bubble( $post_id, $pending_comments ) { $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) ); if ( $pending_comments ) @@ -473,7 +496,7 @@ class WP_List_Table { * * @return int */ - function get_pagenum() { + protected function get_pagenum() { $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) @@ -490,7 +513,7 @@ class WP_List_Table { * * @return int */ - function get_items_per_page( $option, $default = 20 ) { + protected function get_items_per_page( $option, $default = 20 ) { $per_page = (int) get_user_option( $option ); if ( empty( $per_page ) || $per_page < 1 ) $per_page = $default; @@ -516,7 +539,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function pagination( $which ) { + protected function pagination( $which ) { if ( empty( $this->_pagination_args ) ) { return; } @@ -611,7 +634,7 @@ class WP_List_Table { * * @return array */ - function get_columns() { + protected function get_columns() { die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' ); } @@ -628,7 +651,7 @@ class WP_List_Table { * * @return array */ - function get_sortable_columns() { + protected function get_sortable_columns() { return array(); } @@ -640,7 +663,7 @@ class WP_List_Table { * * @return array */ - function get_column_info() { + protected function get_column_info() { if ( isset( $this->_column_headers ) ) return $this->_column_headers; @@ -685,7 +708,7 @@ class WP_List_Table { * * @return int */ - function get_column_count() { + public function get_column_count() { list ( $columns, $hidden ) = $this->get_column_info(); $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) ); return count( $columns ) - count( $hidden ); @@ -699,7 +722,7 @@ class WP_List_Table { * * @param bool $with_id Whether to set the id attribute or not */ - function print_column_headers( $with_id = true ) { + protected function print_column_headers( $with_id = true ) { list( $columns, $hidden, $sortable ) = $this->get_column_info(); $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); @@ -767,7 +790,7 @@ class WP_List_Table { * @since 3.1.0 * @access public */ - function display() { + public function display() { $singular = $this->_args['singular']; $this->display_tablenav( 'top' ); @@ -805,7 +828,7 @@ class WP_List_Table { * * @return array */ - function get_table_classes() { + protected function get_table_classes() { return array( 'widefat', 'fixed', $this->_args['plural'] ); } @@ -815,7 +838,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function display_tablenav( $which ) { + protected function display_tablenav( $which ) { if ( 'top' == $which ) wp_nonce_field( 'bulk-' . $this->_args['plural'] ); ?> @@ -840,7 +863,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function extra_tablenav( $which ) {} + protected function extra_tablenav( $which ) {} /** * Generate the
part of the table @@ -848,7 +871,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function display_rows_or_placeholder() { + protected function display_rows_or_placeholder() { if ( $this->has_items() ) { $this->display_rows(); } else { @@ -864,7 +887,7 @@ class WP_List_Table { * @since 3.1.0 * @access protected */ - function display_rows() { + protected function display_rows() { foreach ( $this->items as $item ) $this->single_row( $item ); } @@ -877,7 +900,7 @@ class WP_List_Table { * * @param object $item The current item */ - function single_row( $item ) { + protected function single_row( $item ) { static $row_class = ''; $row_class = ( $row_class == '' ? ' class="alternate"' : '' ); @@ -894,7 +917,7 @@ class WP_List_Table { * * @param object $item The current item */ - function single_row_columns( $item ) { + protected function single_row_columns( $item ) { list( $columns, $hidden ) = $this->get_column_info(); foreach ( $columns as $column_name => $column_display_name ) { @@ -930,7 +953,7 @@ class WP_List_Table { * @since 3.1.0 * @access public */ - function ajax_response() { + public function ajax_response() { $this->prepare_items(); ob_start(); @@ -963,7 +986,7 @@ class WP_List_Table { * * @access private */ - function _js_vars() { + private function _js_vars() { $args = array( 'class' => get_class( $this ), 'screen' => array( diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 0a19848ce3..9be8f1bc96 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -9,7 +9,7 @@ */ class WP_Media_List_Table extends WP_List_Table { - function __construct( $args = array() ) { + public function __construct( $args = array() ) { $this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] ); parent::__construct( array( @@ -18,11 +18,11 @@ class WP_Media_List_Table extends WP_List_Table { ) ); } - function ajax_user_can() { + public function ajax_user_can() { return current_user_can('upload_files'); } - function prepare_items() { + public function prepare_items() { global $lost, $wp_query, $post_mime_types, $avail_post_mime_types; $q = $_REQUEST; @@ -41,7 +41,7 @@ class WP_Media_List_Table extends WP_List_Table { ) ); } - function get_views() { + protected function get_views() { global $wpdb, $post_mime_types, $avail_post_mime_types; $type_links = array(); @@ -74,7 +74,7 @@ class WP_Media_List_Table extends WP_List_Table { return $type_links; } - function get_bulk_actions() { + protected function get_bulk_actions() { $actions = array(); $actions['delete'] = __( 'Delete Permanently' ); if ( $this->detached ) @@ -83,7 +83,7 @@ class WP_Media_List_Table extends WP_List_Table { return $actions; } - function extra_tablenav( $which ) { + protected function extra_tablenav( $which ) { ?>