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

git-svn-id: http://svn.automattic.com/wordpress/trunk@7456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-03-21 19:34:27 +00:00
parent e6e3b1aa35
commit 48da5c40ad
2 changed files with 4 additions and 2 deletions

View File

@ -119,7 +119,8 @@ function deactivate_plugins($plugins) {
$item = array_search( $plugin, $current);
if( false === $item)
continue;
array_splice($current, $item, 1 ); // Array-fu!
if ( ( $key = array_search( $plugin, $current) ) !== false )
array_splice($current, $key, 1 ); // Fixed Array-fu!
do_action('deactivate_' . trim( $plugin ));
}

View File

@ -40,7 +40,8 @@ case 'update':
$current = get_option('active_plugins');
if ( in_array($file, $current) || isset($_POST['phperror']) ) {
if ( in_array($file, $current) ) {
array_splice($current, array_search( $file, $current), 1 ); // Array-fu!
if ( ( $key = array_search( $plugin, $current) ) !== false )
array_splice($current, $key, 1 ); // Fixed Array-fu!
update_option('active_plugins', $current);
}
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1"));