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
This commit is contained in:
parent
b274b643a1
commit
0590b75eec
|
@ -122,12 +122,10 @@ function deactivate_plugins($plugins, $silent= false) {
|
||||||
$plugins = array($plugins);
|
$plugins = array($plugins);
|
||||||
|
|
||||||
foreach ( $plugins as $plugin ) {
|
foreach ( $plugins as $plugin ) {
|
||||||
$item = array_search( $plugin, $current);
|
if( ! is_plugin_active($plugin) )
|
||||||
if( false === $item)
|
|
||||||
continue;
|
continue;
|
||||||
if ( ( $key = array_search( $plugin, $current) ) !== false )
|
array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
|
||||||
array_splice($current, $key, 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.
|
||||||
if ( ! $silent )
|
|
||||||
do_action('deactivate_' . trim( $plugin ));
|
do_action('deactivate_' . trim( $plugin ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue