tollmanz /
debug-bar-cron
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Debug Bar Cron, a WordPress plugin. |
||
| 4 | * |
||
| 5 | * @package WordPress\Plugins\Debug Bar Cron |
||
| 6 | * @author Zack Tollman, Helen Hou-Sandi, Juliette Reinders Folmer |
||
| 7 | * @link https://github.com/tollmanz/debug-bar-cron |
||
| 8 | * @version 0.1.2 |
||
| 9 | * @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher |
||
| 10 | * |
||
| 11 | * @wordpress-plugin |
||
| 12 | * Plugin Name: Debug Bar Cron |
||
| 13 | * Plugin URI: http://wordpress.org/extend/plugins/debug-bar-cron/ |
||
| 14 | * Description: Debug Bar Cron adds information about WP scheduled events to the Debug Bar. |
||
| 15 | * Version: 0.1.2 |
||
| 16 | * Author: Zack Tollman, Helen Hou-Sandi |
||
| 17 | * Author URI: http://github.com/tollmanz/ |
||
| 18 | * Depends: Debug Bar |
||
| 19 | * Text Domain: debug-bar-cron |
||
| 20 | * Domain Path: /languages/ |
||
| 21 | */ |
||
| 22 | |||
| 23 | // Avoid direct calls to this file. |
||
| 24 | if ( ! function_exists( 'add_action' ) ) { |
||
| 25 | header( 'Status: 403 Forbidden' ); |
||
| 26 | header( 'HTTP/1.1 403 Forbidden' ); |
||
| 27 | exit(); |
||
| 28 | } |
||
| 29 | |||
| 30 | if ( ! function_exists( 'debug_bar_cron_has_parent_plugin' ) ) { |
||
| 31 | /** |
||
| 32 | * Show admin notice & de-activate if debug-bar plugin not active. |
||
| 33 | */ |
||
| 34 | function debug_bar_cron_has_parent_plugin() { |
||
| 35 | if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) ) { |
||
| 36 | add_action( 'admin_notices', create_function( null, 'echo \'<div class="error"><p>\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar Cron</strong> Plugin. %sVisit your plugins page to activate.\', \'debug-bar-cron\' ), \'<a href="\' . esc_url( admin_url( \'plugins.php#debug-bar\' ) ) . \'">\' ), \'</a></p></div>\';' ) ); |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
The use of
create_function is highly discouraged, better use a closure.
// Instead of
$function = create_function('$a, $b', 'return $a + $b');
// Better use
$function = function($a, $b) { return $a + $b; }
Loading history...
|
|||
| 37 | |||
| 38 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
||
| 39 | if ( isset( $_GET['activate'] ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 40 | unset( $_GET['activate'] ); |
||
|
0 ignored issues
–
show
|
|||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | add_action( 'admin_init', 'debug_bar_cron_has_parent_plugin' ); |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | if ( ! function_exists( 'zt_add_debug_bar_cron_panel' ) ) { |
||
| 49 | /** |
||
| 50 | * Adds panel, as defined in the included class, to Debug Bar. |
||
| 51 | * |
||
| 52 | * @param array $panels Existing debug bar panels. |
||
| 53 | * |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | function zt_add_debug_bar_cron_panel( $panels ) { |
||
| 57 | if ( ! class_exists( 'ZT_Debug_Bar_Cron' ) ) { |
||
| 58 | require_once 'class-debug-bar-cron.php'; |
||
| 59 | $panels[] = new ZT_Debug_Bar_Cron(); |
||
| 60 | } |
||
| 61 | return $panels; |
||
| 62 | } |
||
| 63 | add_filter( 'debug_bar_panels', 'zt_add_debug_bar_cron_panel' ); |
||
| 64 | } |
||
| 65 |