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:
parent
2749e46178
commit
e6fc90f973
|
@ -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,8 +156,10 @@ class WP_List_Table {
|
|||
* @return mixed Property.
|
||||
*/
|
||||
public function __get( $name ) {
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties settable for backwards compatibility.
|
||||
|
@ -158,13 +167,15 @@ 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 ) {
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return $this->$name = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties checkable for backwards compatibility.
|
||||
|
@ -176,8 +187,10 @@ class WP_List_Table {
|
|||
* @return bool Whether the property is set.
|
||||
*/
|
||||
public function __isset( $name ) {
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
return isset( $this->$name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private properties un-settable for backwards compatibility.
|
||||
|
@ -188,8 +201,10 @@ class WP_List_Table {
|
|||
* @param string $name Property to unset.
|
||||
*/
|
||||
public function __unset( $name ) {
|
||||
if ( in_array( $name, $this->compat_fields ) ) {
|
||||
unset( $this->$name );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make private/protected methods readable for backwards compatibility.
|
||||
|
@ -202,8 +217,11 @@ class WP_List_Table {
|
|||
* @return mixed|bool Return value of the callback, false otherwise.
|
||||
*/
|
||||
public function __call( $name, $arguments ) {
|
||||
if ( in_array( $name, $this->compat_methods ) ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the current user's permissions
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue