From bffd07f0a7030f6030a6e4fde95bada84d8cbd85 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 21 Oct 2008 23:55:58 +0000 Subject: [PATCH] Allow __FILE__ to be passed to activate_plugin()/deactivate_plugin(). Props DD32. fixes #7878 git-svn-id: http://svn.automattic.com/wordpress/trunk@9271 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/plugin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 79f81232d1..a87810d514 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -215,7 +215,7 @@ function is_plugin_active($plugin) { */ function activate_plugin($plugin, $redirect = '') { $current = get_option('active_plugins'); - $plugin = trim($plugin); + $plugin = plugin_basename(trim($plugin)); $valid = validate_plugin($plugin); if ( is_wp_error($valid) ) @@ -254,6 +254,7 @@ function deactivate_plugins($plugins, $silent= false) { $plugins = array($plugins); foreach ( $plugins as $plugin ) { + $plugin = plugin_basename($plugin); if( ! is_plugin_active($plugin) ) continue; array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!