mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 13:41:24 +01:00
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:
parent
5a529cd216
commit
bffd07f0a7
@ -215,7 +215,7 @@ function is_plugin_active($plugin) {
|
|||||||
*/
|
*/
|
||||||
function activate_plugin($plugin, $redirect = '') {
|
function activate_plugin($plugin, $redirect = '') {
|
||||||
$current = get_option('active_plugins');
|
$current = get_option('active_plugins');
|
||||||
$plugin = trim($plugin);
|
$plugin = plugin_basename(trim($plugin));
|
||||||
|
|
||||||
$valid = validate_plugin($plugin);
|
$valid = validate_plugin($plugin);
|
||||||
if ( is_wp_error($valid) )
|
if ( is_wp_error($valid) )
|
||||||
@ -254,6 +254,7 @@ function deactivate_plugins($plugins, $silent= false) {
|
|||||||
$plugins = array($plugins);
|
$plugins = array($plugins);
|
||||||
|
|
||||||
foreach ( $plugins as $plugin ) {
|
foreach ( $plugins as $plugin ) {
|
||||||
|
$plugin = plugin_basename($plugin);
|
||||||
if( ! is_plugin_active($plugin) )
|
if( ! is_plugin_active($plugin) )
|
||||||
continue;
|
continue;
|
||||||
array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
|
array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
|
||||||
|
Loading…
Reference in New Issue
Block a user