Make WordPress Core

Ticket #20104: 20104.3.diff

File 20104.3.diff, 3.6 KB (added by johnbillion, 9 years ago)
  • src/wp-admin/css/list-tables.css

     
    869869        padding: 2px 0 0;
    870870}
    871871
     872.row-actions .network_active {
     873        color: #000;
     874}
     875
    872876tr:hover .row-actions,
    873877.mobile .row-actions,
    874878.row-actions.visible,
  • src/wp-admin/includes/class-wp-plugins-list-table.php

     
    127127                        }
    128128                }
    129129
     130                if ( ! $screen->in_admin( 'network' ) ) {
     131                        $show = current_user_can( 'manage_network_plugins' );
     132                        /**
     133                         * Filter whether to display network-activated plugins alongside site-activated plugins.
     134                         *
     135                         * @since 4.4.0
     136                         *
     137                         * @param bool $show Whether to show network-active plugins. Default is whether the current
     138                         *                   user can manage network plugins (ie. a Super Admin).
     139                         */
     140                        $show_network_active = apply_filters( 'show_network_active_plugins', $show );
     141                }
     142
    130143                set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
    131144
    132145                if ( $screen->in_admin( 'network' ) ) {
     
    171184                                // On the non-network screen, filter out network-only plugins as long as they're not individually activated
    172185                                unset( $plugins['all'][ $plugin_file ] );
    173186                        } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
    174                                 // On the non-network screen, filter out network activated plugins
    175                                 unset( $plugins['all'][ $plugin_file ] );
     187                                if ( $show_network_active ) {
     188                                        // On the non-network screen, show network-activated plugins if allowed
     189                                        $plugins['active'][ $plugin_file ] = $plugin_data;
     190                                } else {
     191                                        // On the non-network screen, filter out network activated plugins
     192                                        unset( $plugins['all'][ $plugin_file ] );
     193                                }
    176194                        } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
    177195                                || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
    178196                                // On the non-network screen, populate the active list with plugins that are individually activated
     
    492510                        else
    493511                                $is_active = is_plugin_active( $plugin_file );
    494512
     513                        $is_network_active = is_plugin_active_for_network( $plugin_file );
     514
    495515                        if ( $screen->in_admin( 'network' ) ) {
    496516                                if ( $is_active ) {
    497517                                        if ( current_user_can( 'manage_network_plugins' ) ) {
     
    509529                                        }
    510530                                }
    511531                        } else {
    512                                 if ( $is_active ) {
     532                                if ( $is_network_active ) {
     533                                        $actions = array(
     534                                                'network_active' => __( 'Network Active' ),
     535                                        );
     536                                } elseif ( $is_active ) {
    513537                                        /* translators: %s: plugin name */
    514538                                        $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 ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
    515539                                } else {
     
    582606
    583607                $class = $is_active ? 'active' : 'inactive';
    584608                $checkbox_id =  "checkbox_" . md5($plugin_data['Name']);
    585                 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
     609                if ( $is_network_active || in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
    586610                        $checkbox = '';
    587611                } else {
    588612                        $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>"