Replace deprecated WP_Screen::is_network property with WP_Screen::in_admin( 'network' ). props bpetty. fixes #23215.

git-svn-id: https://develop.svn.wordpress.org/trunk@23658 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-03-09 03:52:27 +00:00
parent aa44600be8
commit aea7b67a2e
2 changed files with 34 additions and 34 deletions

View File

@ -53,7 +53,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
$screen = $this->screen; $screen = $this->screen;
if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) { if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
$plugins['mustuse'] = get_mu_plugins(); $plugins['mustuse'] = get_mu_plugins();
if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
@ -72,7 +72,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
if ( ! $screen->is_network ) { if ( ! $screen->in_admin( 'network' ) ) {
$recently_activated = get_option( 'recently_activated', array() ); $recently_activated = get_option( 'recently_activated', array() );
foreach ( $recently_activated as $key => $time ) foreach ( $recently_activated as $key => $time )
@ -83,15 +83,15 @@ class WP_Plugins_List_Table extends WP_List_Table {
foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
// Filter into individual sections // Filter into individual sections
if ( is_multisite() && ! $screen->is_network && is_network_only_plugin( $plugin_file ) ) { if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) ) {
unset( $plugins['all'][ $plugin_file ] ); unset( $plugins['all'][ $plugin_file ] );
} elseif ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) { } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
unset( $plugins['all'][ $plugin_file ] ); unset( $plugins['all'][ $plugin_file ] );
} elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) ) } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
|| ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) { || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
$plugins['active'][ $plugin_file ] = $plugin_data; $plugins['active'][ $plugin_file ] = $plugin_data;
} else { } else {
if ( ! $screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
$plugins['recently_activated'][ $plugin_file ] = $plugin_data; $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
$plugins['inactive'][ $plugin_file ] = $plugin_data; $plugins['inactive'][ $plugin_file ] = $plugin_data;
} }
@ -237,12 +237,12 @@ class WP_Plugins_List_Table extends WP_List_Table {
$actions = array(); $actions = array();
if ( 'active' != $status ) if ( 'active' != $status )
$actions['activate-selected'] = $this->screen->is_network ? __( 'Network Activate' ) : __( 'Activate' ); $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
if ( 'inactive' != $status && 'recent' != $status ) if ( 'inactive' != $status && 'recent' != $status )
$actions['deactivate-selected'] = $this->screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' ); $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
if ( !is_multisite() || $this->screen->is_network ) { if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) {
if ( current_user_can( 'update_plugins' ) ) if ( current_user_can( 'update_plugins' ) )
$actions['update-selected'] = __( 'Update' ); $actions['update-selected'] = __( 'Update' );
if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
@ -269,7 +269,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
echo '<div class="alignleft actions">'; echo '<div class="alignleft actions">';
if ( ! $this->screen->is_network && 'recently_activated' == $status ) if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status )
submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
elseif ( 'top' == $which && 'mustuse' == $status ) elseif ( 'top' == $which && 'mustuse' == $status )
echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>'; echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>';
@ -289,7 +289,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
function display_rows() { function display_rows() {
global $status; global $status;
if ( is_multisite() && ! $this->screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) ) if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
return; return;
foreach ( $this->items as $plugin_file => $plugin_data ) foreach ( $this->items as $plugin_file => $plugin_data )
@ -331,12 +331,12 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( $plugin_data['Description'] ) if ( $plugin_data['Description'] )
$description .= '<p>' . $plugin_data['Description'] . '</p>'; $description .= '<p>' . $plugin_data['Description'] . '</p>';
} else { } else {
if ( $screen->is_network ) if ( $screen->in_admin( 'network' ) )
$is_active = is_plugin_active_for_network( $plugin_file ); $is_active = is_plugin_active_for_network( $plugin_file );
else else
$is_active = is_plugin_active( $plugin_file ); $is_active = is_plugin_active( $plugin_file );
if ( $screen->is_network ) { if ( $screen->in_admin( 'network' ) ) {
if ( $is_active ) { if ( $is_active ) {
if ( current_user_can( 'manage_network_plugins' ) ) if ( current_user_can( 'manage_network_plugins' ) )
$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>'; $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
@ -355,13 +355,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( ! is_multisite() && current_user_can('delete_plugins') ) if ( ! is_multisite() && current_user_can('delete_plugins') )
$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
} // end if $is_active } // end if $is_active
} // end if $screen->is_network } // end if $screen->in_admin( 'network' )
if ( ( ! is_multisite() || $screen->is_network ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
$actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
} // end if $context } // end if $context
$prefix = $screen->is_network ? 'network_admin_' : ''; $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
$actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context ); $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
$actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );

View File

@ -319,20 +319,20 @@ final class WP_Screen {
/** /**
* The help tab data associated with the screen, if any. * The help tab data associated with the screen, if any.
* *
* @since 3.3.0 * @since 3.3.0
* @var array * @var array
* @access private * @access private
*/ */
private $_help_tabs = array(); private $_help_tabs = array();
/** /**
* The help sidebar data associated with screen, if any. * The help sidebar data associated with screen, if any.
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access private
*/ */
private $_help_sidebar = ''; private $_help_sidebar = '';
/** /**
@ -376,16 +376,16 @@ final class WP_Screen {
*/ */
private $_screen_settings; private $_screen_settings;
/** /**
* Fetches a screen object. * Fetches a screen object.
* *
* @since 3.3.0 * @since 3.3.0
* @access public * @access public
* *
* @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
* Defaults to the current $hook_suffix global. * Defaults to the current $hook_suffix global.
* @return WP_Screen Screen object. * @return WP_Screen Screen object.
*/ */
public static function get( $hook_name = '' ) { public static function get( $hook_name = '' ) {
if ( is_a( $hook_name, 'WP_Screen' ) ) if ( is_a( $hook_name, 'WP_Screen' ) )
@ -427,13 +427,13 @@ final class WP_Screen {
if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) { if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
$maybe = substr( $id, 5 ); $maybe = substr( $id, 5 );
if ( taxonomy_exists( $maybe ) ) { if ( taxonomy_exists( $maybe ) ) {
$id = 'edit-tags'; $id = 'edit-tags';
$taxonomy = $maybe; $taxonomy = $maybe;
} elseif ( post_type_exists( $maybe ) ) { } elseif ( post_type_exists( $maybe ) ) {
$id = 'edit'; $id = 'edit';
$post_type = $maybe; $post_type = $maybe;
} }
} }
if ( ! $in_admin ) if ( ! $in_admin )
$in_admin = 'site'; $in_admin = 'site';
@ -480,7 +480,7 @@ final class WP_Screen {
$post_type = 'post'; $post_type = 'post';
break; break;
} }
} }
switch ( $base ) { switch ( $base ) {
case 'post' : case 'post' :
@ -513,7 +513,7 @@ final class WP_Screen {
} elseif ( 'user' == $in_admin ) { } elseif ( 'user' == $in_admin ) {
$id .= '-user'; $id .= '-user';
$base .= '-user'; $base .= '-user';
} }
if ( isset( self::$_registry[ $id ] ) ) { if ( isset( self::$_registry[ $id ] ) ) {
$screen = self::$_registry[ $id ]; $screen = self::$_registry[ $id ];
@ -535,7 +535,7 @@ final class WP_Screen {
self::$_registry[ $id ] = $screen; self::$_registry[ $id ] = $screen;
return $screen; return $screen;
} }
/** /**
* Makes the screen object the current screen. * Makes the screen object the current screen.