-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug-bar.php
85 lines (77 loc) · 1.89 KB
/
debug-bar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Debug Bar Rewrite Rules. Debug Bar Panel Class.
*
* @package WordPress\Plugins\Debug Bar Rewrite Rules\Debug Bar Panel
* @author Oleg Butuzov
* @link https://github.com/butuzov/Debug-Bar-Rewrite-Rules
* @version 0.6.5
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License, version 2 or higher
*/
// Avoid direct calls to this file.
if ( ! function_exists( 'add_action' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/**
* Debug Bar Rewrite Rule Panel.
*/
class Debug_Bar_Rewrite_Rules_Panel extends Debug_Bar_Panel {
/**
* Parent Object.
*
* @var $parent Class Instance.
*/
private $parent;
/**
* Give the panel a title and set the enqueues.
*
* @return void
*/
public function init() {
$this->title( UA_Made_Rewrite_Rules::i()->title );
add_action( 'wp_enqueue_scripts', array( UA_Made_Rewrite_Rules::i(), 'assets' ) );
add_action( 'admin_enqueue_scripts', array( UA_Made_Rewrite_Rules::i(), 'assets' ) );
}
/**
* Give the panel a title and set the enqueues.
*
* @return bool
*/
public function is_visible() {
return $this->_visible;
}
/**
* Show the menu item in Debug Bar.
*
* @return void
*/
public function prerender() {
$this->set_visible( get_option( 'permalink_structure' ) !== '' );
}
/**
* Set Visible function.
*
* Determine to set visible or not a panel.
*
* @param bool $visible True or False, Visible or Not for rewrite rules panel.
* @return void
*/
public function set_visible( $visible ) {
$this->_visible = $visible;
}
/**
* Renders the Debug Bar panel
*
* @return void
*/
public function render() {
echo // WPCS: XSS OK.
'<div class="debug-bar-rewrites-urls">',
UA_Made_Rewrite_Rules::i()->stats(),
UA_Made_Rewrite_Rules::i()->rules(),
UA_Made_Rewrite_Rules::i()->filters(),
'</div>';
}
}