From 5879ad6f3943972aff1e10d1621eb07fb3ad9af4 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Mon, 23 Nov 2020 11:39:46 +0100 Subject: [PATCH 1/2] Replaces create_function with regular function --- debug-bar-cron.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/debug-bar-cron.php b/debug-bar-cron.php index 9e2c730..8790b8d 100644 --- a/debug-bar-cron.php +++ b/debug-bar-cron.php @@ -27,6 +27,21 @@ exit(); } +if ( ! function_exists( 'debug_bar_cron_print_parent_plugin_notice' ) ) { + /** + * Show admin notice + */ + function debug_bar_cron_print_parent_plugin_notice() { + $plugin_url = admin_url( 'plugin-install.php?tab=search&s=debug+bar' ); + echo '

'; + echo 'Activation failed: Debug Bar must be activated to use the Debug Bar Cron Plugin. '; + sprintf( '', esc_url( $plugin_url ) ); + echo 'Visit your plugins page to install & activate.'; + echo '

'; + } +} + + if ( ! function_exists( 'debug_bar_cron_has_parent_plugin' ) ) { /** * Show admin notice & de-activate if debug-bar plugin not active. @@ -35,8 +50,7 @@ function debug_bar_cron_has_parent_plugin() { $file = plugin_basename( __FILE__ ); if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) && is_plugin_active( $file ) ) { - add_action( 'admin_notices', create_function( null, 'echo \'

\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the Debug Bar Cron Plugin. %sVisit your plugins page to install & activate.\', \'debug-bar-cron\' ), \'\' ), \'

\';' ) ); - + add_action( 'admin_notices', 'debug_bar_cron_print_parent_plugin_notice' ); deactivate_plugins( $file, false, is_network_admin() ); // Add to recently active plugins list. From 64d49d9520ad59180878deb4920e9ac9695e1168 Mon Sep 17 00:00:00 2001 From: Pavel Schoffer Date: Mon, 23 Nov 2020 13:44:10 +0100 Subject: [PATCH 2/2] Returns gettext back --- debug-bar-cron.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/debug-bar-cron.php b/debug-bar-cron.php index 8790b8d..9b5bdfa 100644 --- a/debug-bar-cron.php +++ b/debug-bar-cron.php @@ -34,9 +34,7 @@ function debug_bar_cron_print_parent_plugin_notice() { $plugin_url = admin_url( 'plugin-install.php?tab=search&s=debug+bar' ); echo ''; } }