Changeset 35151
- Timestamp:
- 10/13/2015 10:11:36 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/list-tables.css
r35009 r35151 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, -
trunk/src/wp-admin/includes/class-wp-plugins-list-table.php
r34912 r35151 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-active plugins alongside plugins active for the current site. 134 * 135 * This also controls the display of inactive 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 … … 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 ) ) ) { … … 488 516 $description .= '<p>' . $plugin_data['Description'] . '</p>'; 489 517 } else { 490 if ( $screen->in_admin( 'network' ) ) 518 if ( $screen->in_admin( 'network' ) ) { 491 519 $is_active = is_plugin_active_for_network( $plugin_file ); 492 else 520 $restrict_network_active = false; 521 $restrict_network_only = false; 522 } else { 493 523 $is_active = is_plugin_active( $plugin_file ); 524 $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); 525 $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); 526 } 494 527 495 528 if ( $screen->in_admin( 'network' ) ) { … … 510 543 } 511 544 } else { 512 if ( $is_active ) { 545 if ( $restrict_network_active ) { 546 $actions = array( 547 'network_active' => __( 'Network Active' ), 548 ); 549 } elseif ( $restrict_network_only ) { 550 $actions = array( 551 'network_only' => __( 'Network Only' ), 552 ); 553 } elseif ( $is_active ) { 513 554 /* translators: %s: plugin name */ 514 555 $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>'; … … 614 655 $class = $is_active ? 'active' : 'inactive'; 615 656 $checkbox_id = "checkbox_" . md5($plugin_data['Name']); 616 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) {657 if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { 617 658 $checkbox = ''; 618 659 } else {
Note: See TracChangeset
for help on using the changeset viewer.