Make WordPress Core


Ignore:
Timestamp:
02/02/2010 09:41:17 PM (15 years ago)
Author:
ryan
Message:

Cleanup network plugin loading. Props nacin. see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/load.php

    r12888 r12930  
    375375 * @return array Files to include
    376376 */
    377 function wp_muplugins_to_load() {
     377function wp_load_mu_plugins() {
    378378    $mu_plugins = array();
    379379    if ( !is_dir( WPMU_PLUGIN_DIR ) )
     
    402402 * @return array Files to include
    403403 */
    404 function wp_plugins_to_load() {
     404function wp_load_plugins() {
    405405    $plugins = array();
    406406
     
    409409            $plugins[] = ABSPATH . 'my-hacks.php';
    410410
    411     $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
    412     if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) )
     411    $active_plugins = (array) apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
     412
     413    // Get active network plugins
     414    if ( is_multisite() ) {
     415        $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
     416        if ( !empty($active_sitewide_plugins) ) {
     417            $active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) );
     418            sort( $active_plugins );
     419        }
     420    }
     421
     422    if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
    413423        return $plugins;
     424
    414425    foreach ( $active_plugins as $plugin ) {
    415         if ( validate_file( $plugin ) // $plugin must validate as file
    416             || '.php' != substr( $plugin, -4 ) // $plugin must end with '.php'
    417             || !file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
     426        if ( ! validate_file( $plugin ) // $plugin must validate as file
     427            && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
     428            && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
    418429            )
    419             continue;
    420430        $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
    421431    }
Note: See TracChangeset for help on using the changeset viewer.