Make WordPress Core

Changeset 23658


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

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

Location:
trunk/wp-admin/includes
Files:
2 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 );
  • trunk/wp-admin/includes/screen.php

    r23503 r23658  
    320320        /**
    321321         * The help tab data associated with the screen, if any.
    322          *
    323          * @since 3.3.0
    324          * @var array
    325          * @access private
    326          */
     322         *
     323         * @since 3.3.0
     324         * @var array
     325         * @access private
     326         */
    327327        private $_help_tabs = array();
    328328
    329         /**
     329        /**
    330330         * The help sidebar data associated with screen, if any.
    331331         *
     
    333333         * @var string
    334334         * @access private
    335          */
     335         */
    336336        private $_help_sidebar = '';
    337337
     
    377377        private $_screen_settings;
    378378
    379         /**
     379        /**
    380380         * Fetches a screen object.
    381          *
    382          * @since 3.3.0
     381         *
     382         * @since 3.3.0
    383383         * @access public
    384          *
     384         *
    385385         * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
    386386         *      Defaults to the current $hook_suffix global.
    387387         * @return WP_Screen Screen object.
    388          */
     388         */
    389389        public static function get( $hook_name = '' ) {
    390390
     
    428428                                $maybe = substr( $id, 5 );
    429429                                if ( taxonomy_exists( $maybe ) ) {
    430                                         $id = 'edit-tags';
     430                                        $id = 'edit-tags';
    431431                                        $taxonomy = $maybe;
    432432                                } elseif ( post_type_exists( $maybe ) ) {
     
    434434                                        $post_type = $maybe;
    435435                                }
    436                         }
     436                        }
    437437
    438438                        if ( ! $in_admin )
     
    481481                                        break;
    482482                        }
    483                 }
     483                }
    484484
    485485                switch ( $base ) {
     
    514514                        $id   .= '-user';
    515515                        $base .= '-user';
    516                 }
     516                }
    517517
    518518                if ( isset( self::$_registry[ $id ] ) ) {
     
    536536
    537537                return $screen;
    538         }
     538        }
    539539
    540540        /**
Note: See TracChangeset for help on using the changeset viewer.