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

See #30891.

Built from https://develop.svn.wordpress.org/trunk@31146


git-svn-id: http://core.svn.wordpress.org/trunk@31127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-11 22:20:22 +00:00
parent 2749e46178
commit e6fc90f973
2 changed files with 25 additions and 7 deletions

View File

@ -80,6 +80,13 @@ class WP_List_Table {
*/
protected $_column_headers;
protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
protected $compat_methods = array( 'set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions',
'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination',
'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav',
'single_row_columns' );
/**
* Constructor.
*
@ -149,7 +156,9 @@ class WP_List_Table {
* @return mixed Property.
*/
public function __get( $name ) {
return $this->$name;
if ( in_array( $name, $this->compat_fields ) ) {
return $this->$name;
}
}
/**
@ -158,12 +167,14 @@ class WP_List_Table {
* @since 4.0.0
* @access public
*
* @param string $name Property to set.
* @param string $name Property to check if set.
* @param mixed $value Property value.
* @return mixed Newly-set property.
*/
public function __set( $name, $value ) {
return $this->$name = $value;
if ( in_array( $name, $this->compat_fields ) ) {
return $this->$name = $value;
}
}
/**
@ -176,7 +187,9 @@ class WP_List_Table {
* @return bool Whether the property is set.
*/
public function __isset( $name ) {
return isset( $this->$name );
if ( in_array( $name, $this->compat_fields ) ) {
return isset( $this->$name );
}
}
/**
@ -188,7 +201,9 @@ class WP_List_Table {
* @param string $name Property to unset.
*/
public function __unset( $name ) {
unset( $this->$name );
if ( in_array( $name, $this->compat_fields ) ) {
unset( $this->$name );
}
}
/**
@ -202,7 +217,10 @@ class WP_List_Table {
* @return mixed|bool Return value of the callback, false otherwise.
*/
public function __call( $name, $arguments ) {
return call_user_func_array( array( $this, $name ), $arguments );
if ( in_array( $name, $this->compat_methods ) ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
return false;
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31145';
$wp_version = '4.2-alpha-31146';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.