In WP_List_Table
, only call magic method internals again whitelists of properties and methods, $compat_fields
and $compat_methods
.
See #30891. git-svn-id: https://develop.svn.wordpress.org/trunk@31146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ad6dd738b2
commit
274253629f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user