Make WordPress Core


Ignore:
Timestamp:
01/11/2015 10:19:58 PM (12 years ago)
Author:
wonderboymusic
Message:

In WP_List_Table, only call magic method internals again whitelists of properties and methods, $compat_fields and $compat_methods.

See #30891.

File:
1 edited

Legend:

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

    r31127 r31146  
    8080         */
    8181        protected $_column_headers;
     82
     83        protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
     84
     85        protected $compat_methods = array( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
     86                'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
     87                'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
     88                'single_row_columns' );
    8289
    8390        /**
    … …  
    150157         */
    151158        public function __get( $name ) {
    152                 return $this->$name;
     159                if ( in_array( $name, $this->compat_fields ) ) {
     160                        return $this->$name;
     161                }
    153162        }
    154163
    … …  
    159168         * @access public
    160169         *
    161          * @param string $name  Property to set.
     170         * @param string $name  Property to check if set.
    162171         * @param mixed  $value Property value.
    163172         * @return mixed Newly-set property.
    164173         */
    165174        public function __set( $name, $value ) {
    166                 return $this->$name = $value;
     175                if ( in_array( $name, $this->compat_fields ) ) {
     176                        return $this->$name = $value;
     177                }
    167178        }
    168179
    … …  
    177188         */
    178189        public function __isset( $name ) {
    179                 return isset( $this->$name );
     190                if ( in_array( $name, $this->compat_fields ) ) {
     191                        return isset( $this->$name );
     192                }
    180193        }
    181194
    … …  
    189202         */
    190203        public function __unset( $name ) {
    191                 unset( $this->$name );
     204                if ( in_array( $name, $this->compat_fields ) ) {
     205                        unset( $this->$name );
     206                }
    192207        }
    193208
    … …  
    203218         */
    204219        public function __call( $name, $arguments ) {
    205                 return call_user_func_array( array( $this, $name ), $arguments );
     220                if ( in_array( $name, $this->compat_methods ) ) {
     221                        return call_user_func_array( array( $this, $name ), $arguments );
     222                }
     223                return false;
    206224        }
    207225
Note: See TracChangeset for help on using the changeset viewer.