From 0590b75eeccf63a6df1c258fbe50ff42729f5498 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 23 Mar 2008 16:36:05 +0000 Subject: [PATCH] Use is_plugin_active() and remove double searching. Props DD32. fixes #6332 git-svn-id: http://svn.automattic.com/wordpress/trunk@7488 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index a05f0deb10..a862c5106c 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -122,12 +122,10 @@ function deactivate_plugins($plugins, $silent= false) { $plugins = array($plugins); foreach ( $plugins as $plugin ) { - $item = array_search( $plugin, $current); - if( false === $item) + if( ! is_plugin_active($plugin) ) continue; - if ( ( $key = array_search( $plugin, $current) ) !== false ) - array_splice($current, $key, 1 ); // Fixed Array-fu! - if ( ! $silent ) + array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu! + if ( ! $silent ) //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output. do_action('deactivate_' . trim( $plugin )); }