WordPress 3.4.2
[autoinstalls/wordpress.git] / wp-admin / plugins.php
index 1acad9cf4de9f37f68a8c921807ec3dcd315c61d..e9fb3b16d9c0482b1422bc134df7d13a5a795bb7 100644 (file)
@@ -51,6 +51,11 @@ if ( $action ) {
                        }
 
                        if ( ! is_network_admin() ) {
+                               if ( is_network_only_plugin( $plugin ) ) {
+                                       wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
+                                       exit;
+                               }
+
                                $recent = (array) get_option( 'recently_activated' );
                                unset( $recent[ $plugin ] );
                                update_option( 'recently_activated', $recent );
@@ -72,10 +77,17 @@ if ( $action ) {
                        $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
 
                        // Only activate plugins which are not already active.
-                       $check = is_network_admin() ? 'is_plugin_active_for_network' : 'is_plugin_active';
-                       foreach ( $plugins as $i => $plugin )
-                               if ( $check( $plugin ) )
-                                       unset( $plugins[ $i ] );
+                       if ( is_network_admin() ) {
+                               foreach ( $plugins as $i => $plugin ) {
+                                       if ( is_plugin_active_for_network( $plugin ) )
+                                               unset( $plugins[ $i ] );
+                               }
+                       } else {
+                               foreach ( $plugins as $i => $plugin ) {
+                                       if ( is_plugin_active( $plugin ) || is_network_only_plugin( $plugin ) )
+                                               unset( $plugins[ $i ] );
+                               }
+                       }
 
                        if ( empty($plugins) ) {
                                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );