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
This commit is contained in:
ryan 2008-10-21 23:55:58 +00:00
parent 5a529cd216
commit bffd07f0a7
1 changed files with 2 additions and 1 deletions

View File

@ -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!