GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#51)
by Juliette
02:10
created

debug-bar-cron.php ➔ zt_add_debug_bar_cron_panel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 7
rs 9.4285
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
create_function is discouraged, please use Anonymous functions instead.
Loading history...
Security Best Practice introduced by
The use of create_function is highly discouraged, better use a closure.

create_function can pose a great security vulnerability as it is similar to eval, and could be used for arbitrary code execution. We highly recommend to use a closure instead.

// 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
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
40
				unset( $_GET['activate'] );
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
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