WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/19/2010 09:53:24 PM (8 years ago)
Author:
nacin
Message:

Full Multisite support for dropins/mu-plugins in admin area. Ensure that network, drop-ins and mu-plugins are only shown and counted to super admins. See #11644, #11861

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r13233 r13235  
    366366$upgrade_plugins = array();
    367367$network_plugins = array();
    368 $mustuse_plugins = get_mu_plugins();
    369 $dropins_plugins = get_dropins();
     368$mustuse_plugins = ( is_multisite() && is_super_admin() ) || ! is_multisite() ? get_mu_plugins() : array();
     369$dropins_plugins = ( is_multisite() && is_super_admin() ) || ! is_multisite() ? get_dropins() : array();
    370370
    371371set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 );
     
    390390foreach ( (array) $all_plugins as $plugin_file => $plugin_data) {
    391391    // Filter into individual sections
    392     if ( is_plugin_active_for_network($plugin_file) && is_super_admin() ) {
    393         $network_plugins[ $plugin_file ] = $plugin_data;
     392    if ( is_plugin_active_for_network($plugin_file) ) {
     393        if ( is_super_admin() )
     394            $network_plugins[ $plugin_file ] = $plugin_data;
    394395    } elseif ( is_plugin_active($plugin_file) ) {
    395396        $active_plugins[ $plugin_file ] = $plugin_data;
     
    400401    }
    401402
    402     if ( isset( $current->response[ $plugin_file ] ) )
    403         $upgrade_plugins[ $plugin_file ] = $plugin_data;
     403    if ( isset( $current->response[ $plugin_file ] ) )
     404        $upgrade_plugins[ $plugin_file ] = $plugin_data;
    404405}
    405406
     
    539540                }
    540541            } else {
    541                 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
     542                if ( is_multisite() && is_network_only_plugin( $plugin_file ) )
     543                    $actions[] = '<span title="' . __('This plugin can only be activated for all sites in a network') . '">' . __('Network Only') . '</span>';
     544                else
     545                    $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
    542546                if ( is_multisite() && is_super_admin() )
    543547                    $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
    544             }
    545 
    546             if ( is_multisite() && is_network_only_plugin( $plugin_file ) )
    547                 $actions[] = '<span title="' . __('This plugin can only be activated for all sites in a network') . '">' . __('Network Only') . '</span>';
    548             else
    549                 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
    550             if ( is_multisite() && is_super_admin() )
    551                 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
    552 
    553             if ( !is_multisite() && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    554                 $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
    555 
    556             if ( ! $is_active && current_user_can('delete_plugins') )
    557                 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
    558 
     548   
     549                if ( !is_multisite() && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
     550                    $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
     551   
     552                if ( ! $is_active && current_user_can('delete_plugins') )
     553                    $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
     554            }
    559555        }
    560556
Note: See TracChangeset for help on using the changeset viewer.