Make WordPress Core

Changeset 11966


Ignore:
Timestamp:
09/24/2009 04:15:37 AM (17 years ago)
Author:
markjaquith
Message:

Active plugin filter, plugin deactivation array_splice() protection. props apeatling. fixes #10839

Location:
trunk
Files:
2 edited

Legend:

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

    r11930 r11966  
    273273 */
    274274function is_plugin_active($plugin) {
    275         return in_array($plugin, get_option('active_plugins'));
     275        return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
    276276}
    277277
     
    348348                if ( ! $silent )
    349349                        do_action( 'deactivate_plugin', trim( $plugin ) );
    350                 array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
     350                       
     351                $key = array_search( $plugin, (array) $current );
     352               
     353                if ( false !== $key )
     354                        array_splice( $current, $key, 1 );
     355                       
    351356                //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.
    352357                if ( ! $silent ) {
     
    485490
    486491function validate_active_plugins() {
    487         $check_plugins = get_option('active_plugins');
     492        $check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') );
    488493
    489494        // Sanity check.  If the active plugin list is not an array, make it an
  • trunk/wp-settings.php

    r11943 r11966  
    553553}
    554554
    555 $current_plugins = get_option('active_plugins');
     555$current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
    556556if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {
    557557        foreach ( $current_plugins as $plugin ) {
Note: See TracChangeset for help on using the changeset viewer.