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 | $file = plugin_basename( __FILE__ ); |
||
36 | |||
37 | if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) && is_plugin_active( $file ) ) { |
||
38 | 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
![]() 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; }
![]() |
|||
39 | |||
40 | deactivate_plugins( $file, false, is_network_admin() ); |
||
41 | |||
42 | // Add to recently active plugins list. |
||
43 | if ( ! is_network_admin() ) { |
||
44 | update_option( 'recently_activated', ( array( $file => time() ) + (array) get_option( 'recently_activated' ) ) ); |
||
45 | } else { |
||
46 | update_site_option( 'recently_activated', ( array( $file => time() ) + (array) get_site_option( 'recently_activated' ) ) ); |
||
47 | } |
||
48 | |||
49 | // Prevent trying again on page reload. |
||
50 | if ( isset( $_GET['activate'] ) ) { |
||
0 ignored issues
–
show
|
|||
51 | unset( $_GET['activate'] ); |
||
0 ignored issues
–
show
|
|||
52 | } |
||
53 | } |
||
54 | } |
||
55 | add_action( 'admin_init', 'debug_bar_cron_has_parent_plugin' ); |
||
56 | } |
||
57 | |||
58 | |||
59 | if ( ! function_exists( 'zt_add_debug_bar_cron_panel' ) ) { |
||
60 | /** |
||
61 | * Adds panel, as defined in the included class, to Debug Bar. |
||
62 | * |
||
63 | * @param array $panels Existing debug bar panels. |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | function zt_add_debug_bar_cron_panel( $panels ) { |
||
68 | if ( ! class_exists( 'ZT_Debug_Bar_Cron' ) ) { |
||
69 | require_once 'class-debug-bar-cron.php'; |
||
70 | $panels[] = new ZT_Debug_Bar_Cron(); |
||
71 | } |
||
72 | return $panels; |
||
73 | } |
||
74 | add_filter( 'debug_bar_panels', 'zt_add_debug_bar_cron_panel' ); |
||
75 | } |
||
76 |