Kill a create_function by introducing is_plugin_inactive. see #14424.

git-svn-id: https://develop.svn.wordpress.org/trunk@16312 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-11-11 22:21:04 +00:00
parent 21a38007d8
commit 19bb470821
2 changed files with 16 additions and 1 deletions

View File

@@ -400,6 +400,21 @@ function is_plugin_active( $plugin ) {
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
}
/**
* Check whether the plugin is inactive.
*
* Reverse of is_plugin_active(). Used as a callback.
*
* @since 3.1.0
* @see is_plugin_active()
*
* @param string $plugin Base plugin path from plugins directory.
* @return bool True if inactive. False if active.
*/
function is_plugin_inactive( $plugin ) {
return ! is_plugin_active( $plugin );
}
/**
* Check whether the plugin is active for the entire network.
*

View File

@@ -186,7 +186,7 @@ if ( $action ) {
//$_POST = from the plugin form; $_GET = from the FTP details screen.
$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
$plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins.
$plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
if ( empty($plugins) ) {
wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
exit;