-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHooks.php
More file actions
47 lines (38 loc) · 1.09 KB
/
Hooks.php
File metadata and controls
47 lines (38 loc) · 1.09 KB
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
<?php
namespace Fastdev;
class Hooks extends Tab {
public function settings() {
return array(
'label' => __( 'Hooks', 'fastdev' ),
);
}
public function makeTable( $options ) {
if ( is_array( $options ) ) {
// ksort($options);
$output = '<div class="fd-key-val-table">';
foreach ( $options as $key => $value ) {
$output .= '<div class="fd-kv-row cols-100">';
$output .= '<div class="filter-this"><div class="fd-kv-code"><a href="' . add_query_arg( 'fd-get-hook', $key ) . '">' . $key . '</a></div></div>';
$output .= '</div>';
}
$output .= '</div>';
echo $output;
} else {
fd_code( $options );
}
}
public function page() {
global $wp_filter;
if ( ! empty( $_GET['fd-get-hook'] ) ) {
$hook = esc_html( stripcslashes( urldecode( $_GET['fd-get-hook'] ) ) );
if ( empty( $hook ) || ! isset( $wp_filter[ $hook ] ) ) {
return;
}
echo '<h3><a href="https://developer.wordpress.org/reference/hooks/" target="_blank">' . $hook . '/</a></h3>';
fd_code( $wp_filter[ $hook ] );
} else {
fd_search();
$this->makeTable( $wp_filter );
}
}
}