WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/09/2013 03:52:27 AM (7 years ago)
Author:
SergeyBiryukov
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-plugins-list-table.php

    r23563 r23658  
    5454        $screen = $this->screen;
    5555
    56         if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) {
     56        if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
    5757            if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
    5858                $plugins['mustuse'] = get_mu_plugins();
     
    7373        set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
    7474
    75         if ( ! $screen->is_network ) {
     75        if ( ! $screen->in_admin( 'network' ) ) {
    7676            $recently_activated = get_option( 'recently_activated', array() );
    7777
     
    8484        foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
    8585            // Filter into individual sections
    86             if ( is_multisite() && ! $screen->is_network && is_network_only_plugin( $plugin_file ) ) {
     86            if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) ) {
    8787                unset( $plugins['all'][ $plugin_file ] );
    88             } elseif ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) {
     88            } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
    8989                unset( $plugins['all'][ $plugin_file ] );
    90             } elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) )
    91                 || ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) {
     90            } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
     91                || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
    9292                $plugins['active'][ $plugin_file ] = $plugin_data;
    9393            } else {
    94                 if ( ! $screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
     94                if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
    9595                    $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
    9696                $plugins['inactive'][ $plugin_file ] = $plugin_data;
     
    238238
    239239        if ( 'active' != $status )
    240             $actions['activate-selected'] = $this->screen->is_network ? __( 'Network Activate' ) : __( 'Activate' );
     240            $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
    241241
    242242        if ( 'inactive' != $status && 'recent' != $status )
    243             $actions['deactivate-selected'] = $this->screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' );
    244 
    245         if ( !is_multisite() || $this->screen->is_network ) {
     243            $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
     244
     245        if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) {
    246246            if ( current_user_can( 'update_plugins' ) )
    247247                $actions['update-selected'] = __( 'Update' );
     
    270270        echo '<div class="alignleft actions">';
    271271
    272         if ( ! $this->screen->is_network && 'recently_activated' == $status )
     272        if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status )
    273273            submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
    274274        elseif ( 'top' == $which && 'mustuse' == $status )
     
    290290        global $status;
    291291
    292         if ( is_multisite() && ! $this->screen->is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) )
     292        if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
    293293            return;
    294294
     
    332332                $description .= '<p>' . $plugin_data['Description'] . '</p>';
    333333        } else {
    334             if ( $screen->is_network )
     334            if ( $screen->in_admin( 'network' ) )
    335335                $is_active = is_plugin_active_for_network( $plugin_file );
    336336            else
    337337                $is_active = is_plugin_active( $plugin_file );
    338338
    339             if ( $screen->is_network ) {
     339            if ( $screen->in_admin( 'network' ) ) {
    340340                if ( $is_active ) {
    341341                    if ( current_user_can( 'manage_network_plugins' ) )
     
    356356                        $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>';
    357357                } // end if $is_active
    358              } // end if $screen->is_network
    359 
    360             if ( ( ! is_multisite() || $screen->is_network ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
     358             } // end if $screen->in_admin( 'network' )
     359
     360            if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    361361                $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
    362362        } // end if $context
    363363
    364         $prefix = $screen->is_network ? 'network_admin_' : '';
     364        $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
    365365        $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
    366366        $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
Note: See TracChangeset for help on using the changeset viewer.