Default to get_current_screen() in list table classes. See #14579
git-svn-id: http://svn.automattic.com/wordpress/trunk@16182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
20181ba697
commit
c5a9fd309d
|
@ -30,7 +30,6 @@ class WP_Comments_List_Table extends WP_List_Table {
|
|||
add_filter( 'comment_author', 'floated_admin_avatar' );
|
||||
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'edit-comments',
|
||||
'plural' => 'comments'
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ class WP_Links_List_Table extends WP_List_Table {
|
|||
|
||||
function WP_Links_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'link-manager',
|
||||
'plural' => 'bookmarks',
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -76,9 +76,9 @@ class WP_List_Table {
|
|||
* @param array $args An associative array with information about the current table
|
||||
* @access protected
|
||||
*/
|
||||
function WP_List_Table( $args ) {
|
||||
function WP_List_Table( $args = array() ) {
|
||||
$args = wp_parse_args( $args, array(
|
||||
'screen' => '',
|
||||
'screen' => get_current_screen(),
|
||||
'plural' => '',
|
||||
'singular' => '',
|
||||
'ajax' => true
|
||||
|
@ -632,9 +632,7 @@ class WP_List_Table {
|
|||
* @return array
|
||||
*/
|
||||
function get_table_classes() {
|
||||
extract( $this->_args );
|
||||
|
||||
return array( 'widefat', 'fixed', $plural );
|
||||
return array( 'widefat', 'fixed', $this->_args['plural'] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -807,13 +805,12 @@ class WP_List_Table {
|
|||
* @access private
|
||||
*/
|
||||
function _js_vars() {
|
||||
extract( $this->_args );
|
||||
|
||||
$class = get_class( $this );
|
||||
|
||||
printf( "<script type='text/javascript'>list_args = %s;</script>\n",
|
||||
json_encode( compact( 'screen', 'class' ) )
|
||||
$args = array(
|
||||
'class' => get_class( $this ),
|
||||
'screen' => $this->_screen
|
||||
);
|
||||
|
||||
printf( "<script type='text/javascript'>list_args = %s;</script>\n", json_encode( $args ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -10,7 +10,6 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||
|
||||
function WP_MS_Sites_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'sites-network',
|
||||
'plural' => 'sites',
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||
$page = $this->get_pagenum();
|
||||
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'themes',
|
||||
'plural' => 'plugins', // @todo replace with themes and add css
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
|||
|
||||
function WP_MS_Users_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'users-network',
|
||||
'plural' => 'users'
|
||||
) );
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
*/
|
||||
class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
|
||||
function WP_Plugin_Install_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'plugin-install',
|
||||
) );
|
||||
}
|
||||
|
||||
function check_permissions() {
|
||||
if ( ! current_user_can('install_plugins') )
|
||||
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
|
||||
|
|
|
@ -23,7 +23,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
|||
$page = $this->get_pagenum();
|
||||
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'plugins',
|
||||
'plural' => 'plugins',
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
var $sticky_posts_count = 0;
|
||||
|
||||
function WP_Posts_List_Table() {
|
||||
global $post_type_object, $post_type, $current_screen, $wpdb;
|
||||
global $post_type_object, $post_type, $wpdb;
|
||||
|
||||
if ( !isset( $_REQUEST['post_type'] ) )
|
||||
$post_type = 'post';
|
||||
|
@ -74,7 +74,6 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||
}
|
||||
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => $current_screen,
|
||||
'plural' => 'posts',
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
var $callback_args;
|
||||
|
||||
function WP_Terms_List_Table() {
|
||||
global $post_type, $taxonomy, $tax, $current_screen;
|
||||
global $post_type, $taxonomy, $tax;
|
||||
|
||||
wp_reset_vars( array( 'action', 'taxonomy', 'post_type' ) );
|
||||
|
||||
|
@ -26,11 +26,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
|||
if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
|
||||
$post_type = 'post';
|
||||
|
||||
if ( !isset( $current_screen ) )
|
||||
set_current_screen( 'edit-' . $taxonomy );
|
||||
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => $current_screen,
|
||||
'plural' => 'tags',
|
||||
'singular' => 'tag',
|
||||
) );
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
*/
|
||||
class WP_Theme_Install_List_Table extends WP_List_Table {
|
||||
|
||||
function WP_Theme_Install_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'theme-install',
|
||||
) );
|
||||
}
|
||||
|
||||
function check_permissions() {
|
||||
if ( ! current_user_can('install_themes') )
|
||||
wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
|
||||
|
|
|
@ -11,12 +11,6 @@ class WP_Themes_List_Table extends WP_List_Table {
|
|||
var $search = array();
|
||||
var $features = array();
|
||||
|
||||
function WP_Themes_List_Table() {
|
||||
parent::__construct( array(
|
||||
'screen' => 'themes',
|
||||
) );
|
||||
}
|
||||
|
||||
function check_permissions() {
|
||||
if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
|
||||
wp_die( __( 'Cheatin’ uh?' ) );
|
||||
|
|
|
@ -8,13 +8,6 @@
|
|||
*/
|
||||
class WP_Users_List_Table extends WP_List_Table {
|
||||
|
||||
function WP_Users_List_Table() {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => 'users',
|
||||
'plural' => 'users'
|
||||
) );
|
||||
}
|
||||
|
||||
function check_permissions() {
|
||||
if ( !current_user_can('list_users') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
|
|
@ -731,7 +731,7 @@ class _WP_List_Table_Compat extends WP_List_Table {
|
|||
|
||||
var $_columns = array();
|
||||
|
||||
function _WP_List_Table_Compat( $screen) {
|
||||
function _WP_List_Table_Compat( $screen ) {
|
||||
parent::WP_List_Table( array(
|
||||
'screen' => $screen,
|
||||
'ajax' => false
|
||||
|
|
Loading…
Reference in New Issue