Kill a create_function by introducing is_plugin_inactive. see #14424.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7ec4e83dc5
commit
771de1c49e
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue