Make WordPress Core


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

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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.