WordPress.org

Make WordPress Core

Changeset 7456


Ignore:
Timestamp:
03/21/08 19:34:27 (6 years ago)
Author:
markjaquith
Message:

Better plugin-deactivation array-fu from Denis-de-Bernardy. fixes #6332

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r7416 r7456  
    120120        if( false === $item) 
    121121            continue; 
    122         array_splice($current, $item, 1 ); // Array-fu! 
     122        if ( ( $key = array_search( $plugin, $current) ) !== false ) 
     123            array_splice($current, $key, 1 ); // Fixed Array-fu! 
    123124        do_action('deactivate_' . trim( $plugin )); 
    124125    } 
  • trunk/wp-admin/plugin-editor.php

    r7304 r7456  
    4141        if ( in_array($file, $current) || isset($_POST['phperror']) ) { 
    4242            if ( in_array($file, $current) ) { 
    43                 array_splice($current, array_search( $file, $current), 1 ); // Array-fu! 
     43                if ( ( $key = array_search( $plugin, $current) ) !== false ) 
     44                    array_splice($current, $key, 1 ); // Fixed Array-fu! 
    4445                update_option('active_plugins', $current); 
    4546            } 
Note: See TracChangeset for help on using the changeset viewer.