From 771de1c49e9699c4d52af44f48cc998bbeb54101 Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 11 Nov 2010 22:21:04 +0000 Subject: [PATCH] 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 --- wp-admin/includes/plugin.php | 15 +++++++++++++++ wp-admin/plugins.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index dcad28d90f..90b835fb7a 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -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. * diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index d22ea0cbf2..14318074cf 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -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;