-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhook_debugging_functions.php
More file actions
62 lines (43 loc) · 1.53 KB
/
Copy pathhook_debugging_functions.php
File metadata and controls
62 lines (43 loc) · 1.53 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
function list_hooks( $filter = false ){
global $wp_filter;
$hooks = $wp_filter;
ksort( $hooks );
foreach( $hooks as $tag => $hook )
if ( false === $filter || false !== strpos( $tag, $filter ) )
dump_hook($tag, $hook);
}
function list_live_hooks( $hook = false ) {
if ( false === $hook )
$hook = 'all';
add_action( $hook, 'list_hook_details', -1 );
}
function list_hook_details( $input = NULL ) {
global $wp_filter;
$tag = current_filter();
if( isset( $wp_filter[$tag] ) )
dump_hook( $tag, $wp_filter[$tag] );
return $input;
}
function dump_hook( $tag, $hook ) {
ksort($hook);
echo "<pre>>>>>>\t<strong>$tag</strong><br />";
foreach( $hook as $priority => $functions ) {
echo $priority;
foreach( $functions as $function )
if( $function['function'] != 'list_hook_details' ) {
echo "\t";
if( is_string( $function['function'] ) )
echo $function['function'];
elseif( is_string( $function['function'][0] ) )
echo $function['function'][0] . ' -> ' . $function['function'][1];
elseif( is_object( $function['function'][0] ) )
echo "(object) " . get_class( $function['function'][0] ) . ' -> ' . $function['function'][1];
else
print_r($function);
echo ' (' . $function['accepted_args'] . ') <br />';
}
}
echo '</pre>';
}
?>