Make WordPress Core


Ignore:
Timestamp:
05/19/2014 01:16:16 AM (11 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-terms-list-table.php

    r28390 r28493  
    1010class WP_Terms_List_Table extends WP_List_Table {
    1111
    12     var $callback_args;
    13 
    14     function __construct( $args = array() ) {
     12    public $callback_args;
     13
     14    public function __construct( $args = array() ) {
    1515        global $post_type, $taxonomy, $action, $tax;
    1616
     
    3939    }
    4040
    41     function ajax_user_can() {
     41    public function ajax_user_can() {
    4242        return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
    4343    }
    4444
    45     function prepare_items() {
     45    public function prepare_items() {
    4646        $tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' );
    4747
     
    9898    }
    9999
    100     function has_items() {
     100    public function has_items() {
    101101        // todo: populate $this->items in prepare_items()
    102102        return true;
    103103    }
    104104
    105     function get_bulk_actions() {
     105    protected function get_bulk_actions() {
    106106        $actions = array();
    107107        $actions['delete'] = __( 'Delete' );
     
    110110    }
    111111
    112     function current_action() {
     112    public function current_action() {
    113113        if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) )
    114114            return 'bulk-delete';
     
    117117    }
    118118
    119     function get_columns() {
     119    protected function get_columns() {
    120120        $columns = array(
    121121            'cb'          => '<input type="checkbox" />',
     
    135135    }
    136136
    137     function get_sortable_columns() {
     137    protected function get_sortable_columns() {
    138138        return array(
    139139            'name'        => 'name',
     
    145145    }
    146146
    147     function display_rows_or_placeholder() {
     147    protected function display_rows_or_placeholder() {
    148148        $taxonomy = $this->screen->taxonomy;
    149149
     
    194194    }
    195195
    196     function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
     196    private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
    197197
    198198        $end = $start + $per_page;
     
    242242    }
    243243
    244     function single_row( $tag, $level = 0 ) {
     244    protected function single_row( $tag, $level = 0 ) {
    245245        global $taxonomy;
    246246        $tag = sanitize_term( $tag, $taxonomy );
     
    256256    }
    257257
    258     function column_cb( $tag ) {
     258    public function column_cb( $tag ) {
    259259        $default_term = get_option( 'default_' . $this->screen->taxonomy );
    260260
     
    266266    }
    267267
    268     function column_name( $tag ) {
     268    public function column_name( $tag ) {
    269269        $taxonomy = $this->screen->taxonomy;
    270270        $tax = get_taxonomy( $taxonomy );
     
    340340    }
    341341
    342     function column_description( $tag ) {
     342    public function column_description( $tag ) {
    343343        return $tag->description;
    344344    }
    345345
    346     function column_slug( $tag ) {
     346    public function column_slug( $tag ) {
    347347        /** This filter is documented in wp-admin/edit-tag-form.php */
    348348        return apply_filters( 'editable_slug', $tag->slug );
    349349    }
    350350
    351     function column_posts( $tag ) {
     351    public function column_posts( $tag ) {
    352352        $count = number_format_i18n( $tag->count );
    353353
     
    373373    }
    374374
    375     function column_links( $tag ) {
     375    public function column_links( $tag ) {
    376376        $count = number_format_i18n( $tag->count );
    377377        if ( $count )
     
    380380    }
    381381
    382     function column_default( $tag, $column_name ) {
     382    public function column_default( $tag, $column_name ) {
    383383        /**
    384384         * Filter the displayed columns in the terms list table.
     
    401401     * @since 3.1.0
    402402     */
    403     function inline_edit() {
     403    public function inline_edit() {
    404404        $tax = get_taxonomy( $this->screen->taxonomy );
    405405
Note: See TracChangeset for help on using the changeset viewer.