Ticket #20104: 20104.4.diff
File 20104.4.diff, 4.6 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/class-wp-plugins-list-table.php
127 127 } 128 128 } 129 129 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 * This also controls the display of non-activated network-only plugins (plugins with 136 * "Network: true" in the plugin header). 137 * 138 * Plugins cannot be network-activated or network-deactivated from this screen. 139 * 140 * @since 4.4.0 141 * 142 * @param bool $show Whether to show network-active plugins. Default is whether the current 143 * user can manage network plugins (ie. a Super Admin). 144 */ 145 $show_network_active = apply_filters( 'show_network_active_plugins', $show ); 146 } 147 130 148 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); 131 149 132 150 if ( $screen->in_admin( 'network' ) ) { … … 168 186 169 187 // Filter into individual sections 170 188 if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { 171 // On the non-network screen, filter out network-only plugins as long as they're not individually activated 172 unset( $plugins['all'][ $plugin_file ] ); 189 if ( $show_network_active ) { 190 // On the non-network screen, show inactive network-only plugins if allowed 191 $plugins['inactive'][ $plugin_file ] = $plugin_data; 192 } else { 193 // On the non-network screen, filter out network-only plugins as long as they're not individually active 194 unset( $plugins['all'][ $plugin_file ] ); 195 } 173 196 } 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 ] ); 197 if ( $show_network_active ) { 198 // On the non-network screen, show network-active plugins if allowed 199 $plugins['active'][ $plugin_file ] = $plugin_data; 200 } else { 201 // On the non-network screen, filter out network-active plugins 202 unset( $plugins['all'][ $plugin_file ] ); 203 } 176 204 } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) 177 205 || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { 178 206 // On the non-network screen, populate the active list with plugins that are individually activated … … 492 520 else 493 521 $is_active = is_plugin_active( $plugin_file ); 494 522 523 $is_network_active = is_plugin_active_for_network( $plugin_file ); 524 $is_network_only = is_network_only_plugin( $plugin_file ); 525 495 526 if ( $screen->in_admin( 'network' ) ) { 496 527 if ( $is_active ) { 497 528 if ( current_user_can( 'manage_network_plugins' ) ) { … … 509 540 } 510 541 } 511 542 } else { 512 if ( $is_active ) { 543 if ( $is_network_active ) { 544 $actions = array( 545 'network_active' => __( 'Network Active' ), 546 ); 547 } elseif ( $is_network_only && ! $is_active ) { 548 $actions = array( 549 'network_only' => __( 'Network Only' ), 550 ); 551 } elseif ( $is_active ) { 513 552 /* translators: %s: plugin name */ 514 553 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; 515 554 } else { … … 613 652 614 653 $class = $is_active ? 'active' : 'inactive'; 615 654 $checkbox_id = "checkbox_" . md5($plugin_data['Name']); 616 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) {655 if ( $is_network_active || ( $is_network_only && ! $is_active ) || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { 617 656 $checkbox = ''; 618 657 } else { 619 658 $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" -
src/wp-admin/css/list-tables.css
881 881 padding: 2px 0 0; 882 882 } 883 883 884 .row-actions .network_only, 885 .row-actions .network_active { 886 color: #000; 887 } 888 884 889 tr:hover .row-actions, 885 890 .mobile .row-actions, 886 891 .row-actions.visible,