WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/19/2014 01:16:16 AM (7 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r27964 r28493  
    1717     * @access protected
    1818     */
    19     var $hierarchical_display;
     19    protected $hierarchical_display;
    2020
    2121    /**
     
    2626     * @access protected
    2727     */
    28     var $comment_pending_count;
     28    protected $comment_pending_count;
    2929
    3030    /**
     
    3535     * @access private
    3636     */
    37     var $user_posts_count;
     37    private $user_posts_count;
    3838
    3939    /**
     
    4444     * @access private
    4545     */
    46     var $sticky_posts_count = 0;
    47 
    48     function __construct( $args = array() ) {
     46    private $sticky_posts_count = 0;
     47
     48    public function __construct( $args = array() ) {
    4949        global $post_type_object, $wpdb;
    5050
     
    7575    }
    7676
    77     function ajax_user_can() {
     77    public function ajax_user_can() {
    7878        return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
    7979    }
    8080
    81     function prepare_items() {
     81    public function prepare_items() {
    8282        global $avail_post_stati, $wp_query, $per_page, $mode;
    8383
     
    110110    }
    111111
    112     function has_items() {
     112    public function has_items() {
    113113        return have_posts();
    114114    }
    115115
    116     function no_items() {
     116    public function no_items() {
    117117        if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
    118118            echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
     
    121121    }
    122122
    123     function get_views() {
     123    protected function get_views() {
    124124        global $locked_post_status, $avail_post_stati;
    125125
     
    182182    }
    183183
    184     function get_bulk_actions() {
     184    protected function get_bulk_actions() {
    185185        $actions = array();
    186186
     
    198198    }
    199199
    200     function extra_tablenav( $which ) {
     200    protected function extra_tablenav( $which ) {
    201201        global $cat;
    202202?>
     
    240240    }
    241241
    242     function current_action() {
     242    public function current_action() {
    243243        if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
    244244            return 'delete_all';
     
    247247    }
    248248
    249     function pagination( $which ) {
     249    protected function pagination( $which ) {
    250250        global $mode;
    251251
     
    256256    }
    257257
    258     function get_table_classes() {
     258    protected function get_table_classes() {
    259259        return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
    260260    }
    261261
    262     function get_columns() {
     262    protected function get_columns() {
    263263        $post_type = $this->screen->post_type;
    264264
     
    346346    }
    347347
    348     function get_sortable_columns() {
     348    protected function get_sortable_columns() {
    349349        return array(
    350350            'title'    => 'title',
     
    355355    }
    356356
    357     function display_rows( $posts = array(), $level = 0 ) {
     357    protected function display_rows( $posts = array(), $level = 0 ) {
    358358        global $wp_query, $per_page;
    359359
     
    370370    }
    371371
    372     function _display_rows( $posts, $level = 0 ) {
     372    private function _display_rows( $posts, $level = 0 ) {
    373373        global $mode;
    374374
     
    385385    }
    386386
    387     function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
     387    private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
    388388        global $wpdb;
    389389
     
    477477     * @param int $per_page
    478478     */
    479     function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
     479    private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
    480480
    481481        if ( ! isset( $children_pages[$parent] ) )
     
    522522    }
    523523
    524     function single_row( $post, $level = 0 ) {
     524    protected function single_row( $post, $level = 0 ) {
    525525        global $mode;
    526526        static $alternate;
     
    880880     * @since 3.1.0
    881881     */
    882     function inline_edit() {
     882    public function inline_edit() {
    883883        global $mode;
    884884
Note: See TracChangeset for help on using the changeset viewer.