WordPress.org

Make WordPress Core

Changeset 12947


Ignore:
Timestamp:
02/04/2010 06:50:36 PM (10 years ago)
Author:
ryan
Message:

Sitewide plugins cleanup. Props nacin. see #11644

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r12930 r12947  
    260260 */
    261261function is_plugin_active( $plugin ) {
    262     return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
     262    return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
    263263}
    264264
     
    271271 * @return bool True, if active for the network, otherwise false.
    272272 */
    273 function is_plugin_active_for_network( $plugin ){
     273function is_plugin_active_for_network( $plugin ) {
    274274    if ( !is_multisite() )
    275275        return false;
     
    554554 */
    555555function validate_active_plugins() {
    556     $plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
     556    $plugins = get_option( 'active_plugins', array() );
    557557    // validate vartype: array
    558558    if ( ! is_array( $plugins ) ) {
     
    563563    if ( is_multisite() && is_super_admin() ) {
    564564        $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
    565         $plugins = array_merge( (array) $plugins, $network_plugins );
     565        $plugins = array_merge( $plugins, $network_plugins );
    566566    }
    567567
  • trunk/wp-admin/includes/upgrade.php

    r12933 r12947  
    10991099 */
    11001100function upgrade_network() {
     1101    global $wp_current_db_version;
    11011102    // 2.8
    11021103    if ( $wp_current_db_version < 11549 ) {
     
    11111112            update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
    11121113        }
    1113         update_site_option( 'wpmu_sitewide_plugins', '' );
    1114         update_site_option( 'deactivated_sitewide_plugins', '' );
     1114        delete_site_option( 'wpmu_sitewide_plugins' );
     1115        delete_site_option( 'deactivated_sitewide_plugins' );
    11151116    }
    11161117}
  • trunk/wp-includes/load.php

    r12930 r12947  
    404404function wp_load_plugins() {
    405405    $plugins = array();
    406 
    407     // Check for hacks file if the option is enabled
    408     if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) )
    409             $plugins[] = ABSPATH . 'my-hacks.php';
    410 
    411     $active_plugins = (array) apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
     406    $active_plugins = (array) get_option( 'active_plugins', array() );
    412407
    413408    // Get active network plugins
     
    420415    }
    421416
     417    // Check for hacks file if the option is enabled
     418    if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
     419        _deprecated_file( 'my-hacks.php', '1.5' );
     420        array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
     421    }
     422
    422423    if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
    423424        return $plugins;
Note: See TracChangeset for help on using the changeset viewer.