diff --git a/debug-bar-cron.php b/debug-bar-cron.php index 9e2c730..9b5bdfa 100644 --- a/debug-bar-cron.php +++ b/debug-bar-cron.php @@ -27,6 +27,19 @@ 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 '

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

'; + } +} + + if ( ! function_exists( 'debug_bar_cron_has_parent_plugin' ) ) { /** * Show admin notice & de-activate if debug-bar plugin not active. @@ -35,8 +48,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.