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' );
|
add_filter( 'comment_author', 'floated_admin_avatar' );
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'edit-comments',
|
|
||||||
'plural' => 'comments'
|
'plural' => 'comments'
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
function WP_Links_List_Table() {
|
function WP_Links_List_Table() {
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'link-manager',
|
|
||||||
'plural' => 'bookmarks',
|
'plural' => 'bookmarks',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
@ -189,4 +188,4 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -76,9 +76,9 @@ class WP_List_Table {
|
||||||
* @param array $args An associative array with information about the current table
|
* @param array $args An associative array with information about the current table
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
function WP_List_Table( $args ) {
|
function WP_List_Table( $args = array() ) {
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args( $args, array(
|
||||||
'screen' => '',
|
'screen' => get_current_screen(),
|
||||||
'plural' => '',
|
'plural' => '',
|
||||||
'singular' => '',
|
'singular' => '',
|
||||||
'ajax' => true
|
'ajax' => true
|
||||||
|
@ -632,9 +632,7 @@ class WP_List_Table {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_table_classes() {
|
function get_table_classes() {
|
||||||
extract( $this->_args );
|
return array( 'widefat', 'fixed', $this->_args['plural'] );
|
||||||
|
|
||||||
return array( 'widefat', 'fixed', $plural );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -807,13 +805,12 @@ class WP_List_Table {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _js_vars() {
|
function _js_vars() {
|
||||||
extract( $this->_args );
|
$args = array(
|
||||||
|
'class' => get_class( $this ),
|
||||||
$class = get_class( $this );
|
'screen' => $this->_screen
|
||||||
|
|
||||||
printf( "<script type='text/javascript'>list_args = %s;</script>\n",
|
|
||||||
json_encode( compact( 'screen', 'class' ) )
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
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() {
|
function WP_MS_Sites_List_Table() {
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'sites-network',
|
|
||||||
'plural' => 'sites',
|
'plural' => 'sites',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
@ -330,4 +329,4 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,7 +23,6 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
$page = $this->get_pagenum();
|
$page = $this->get_pagenum();
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'themes',
|
|
||||||
'plural' => 'plugins', // @todo replace with themes and add css
|
'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() {
|
function WP_MS_Users_List_Table() {
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'users-network',
|
'plural' => 'users'
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,4 +234,4 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,12 +8,6 @@
|
||||||
*/
|
*/
|
||||||
class WP_Plugin_Install_List_Table extends WP_List_Table {
|
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() {
|
function check_permissions() {
|
||||||
if ( ! current_user_can('install_plugins') )
|
if ( ! current_user_can('install_plugins') )
|
||||||
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
|
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
|
||||||
|
@ -231,4 +225,4 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,7 +23,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
|
||||||
$page = $this->get_pagenum();
|
$page = $this->get_pagenum();
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => 'plugins',
|
|
||||||
'plural' => 'plugins',
|
'plural' => 'plugins',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
var $sticky_posts_count = 0;
|
var $sticky_posts_count = 0;
|
||||||
|
|
||||||
function WP_Posts_List_Table() {
|
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'] ) )
|
if ( !isset( $_REQUEST['post_type'] ) )
|
||||||
$post_type = 'post';
|
$post_type = 'post';
|
||||||
|
@ -74,7 +74,6 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => $current_screen,
|
|
||||||
'plural' => 'posts',
|
'plural' => 'posts',
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
var $callback_args;
|
var $callback_args;
|
||||||
|
|
||||||
function WP_Terms_List_Table() {
|
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' ) );
|
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 ) ) ) )
|
if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
|
||||||
$post_type = 'post';
|
$post_type = 'post';
|
||||||
|
|
||||||
if ( !isset( $current_screen ) )
|
|
||||||
set_current_screen( 'edit-' . $taxonomy );
|
|
||||||
|
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => $current_screen,
|
|
||||||
'plural' => 'tags',
|
'plural' => 'tags',
|
||||||
'singular' => 'tag',
|
'singular' => 'tag',
|
||||||
) );
|
) );
|
||||||
|
@ -362,4 +358,4 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,12 +8,6 @@
|
||||||
*/
|
*/
|
||||||
class WP_Theme_Install_List_Table extends WP_List_Table {
|
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() {
|
function check_permissions() {
|
||||||
if ( ! current_user_can('install_themes') )
|
if ( ! current_user_can('install_themes') )
|
||||||
wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
|
wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
|
||||||
|
@ -184,4 +178,4 @@ class WP_Theme_Install_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -11,12 +11,6 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||||
var $search = array();
|
var $search = array();
|
||||||
var $features = array();
|
var $features = array();
|
||||||
|
|
||||||
function WP_Themes_List_Table() {
|
|
||||||
parent::__construct( array(
|
|
||||||
'screen' => 'themes',
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
|
|
||||||
function check_permissions() {
|
function check_permissions() {
|
||||||
if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
|
if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
|
||||||
wp_die( __( 'Cheatin’ uh?' ) );
|
wp_die( __( 'Cheatin’ uh?' ) );
|
||||||
|
@ -216,4 +210,4 @@ foreach ( $cols as $col => $theme_name ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,13 +8,6 @@
|
||||||
*/
|
*/
|
||||||
class WP_Users_List_Table extends WP_List_Table {
|
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() {
|
function check_permissions() {
|
||||||
if ( !current_user_can('list_users') )
|
if ( !current_user_can('list_users') )
|
||||||
wp_die(__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
@ -275,4 +268,4 @@ class WP_Users_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -731,7 +731,7 @@ class _WP_List_Table_Compat extends WP_List_Table {
|
||||||
|
|
||||||
var $_columns = array();
|
var $_columns = array();
|
||||||
|
|
||||||
function _WP_List_Table_Compat( $screen) {
|
function _WP_List_Table_Compat( $screen ) {
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'screen' => $screen,
|
'screen' => $screen,
|
||||||
'ajax' => false
|
'ajax' => false
|
||||||
|
|
Loading…
Reference in New Issue