-
Notifications
You must be signed in to change notification settings - Fork 0
/
wonderflux-hook-displayer.php
277 lines (243 loc) · 14.2 KB
/
wonderflux-hook-displayer.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?php
/*
Plugin Name: Wonderflux hook displayer
Plugin URI: http://wonderflux.com
Description: When logged in as a user has capability of manage_options (can be override with wflux_debug_show_hooks filter) and WF_DEBUG constant defined as true, this plugin reveals the location of all relevant Wonderflux display hooks within your theme. NOTE: NOT REQUIRED WITH WONDERFLUX v1.2 or above - it's included in the Wonderflux core code!
Author: Jonny Allbut
Version: 0.21
Author URI: http://jonnya.net
License: GPL v2 or later
*/
/**
*
* Activate plugin
*
*/
function wfx_hookd_activate() {
add_option( 'wpcms_wc_activate', 'Y' );
}
register_activation_hook( __FILE__, 'wfx_hookd_activate' );
/**
*
* Deactivate plugin
*
*/
function wfx_hookd_deactivate() {
delete_option('wpcms_wc_activate');
}
register_activation_hook( __FILE__, 'wfx_hookd_deactivate' );
/**
*
* Checks for Wonderflux use and version on activation
* Have to do it this way as activation hook is too early for some conditional checks
*
*/
function wfx_hookd_admin_wf_check() {
global $pagenow;
if ( is_admin() && current_user_can('activate_plugins') && $pagenow == 'plugins.php' ) {
$this_theme = wp_get_theme();
$this_framework = $this_theme->get( 'Template' );
if ( $this_framework != 'wonderflux' ){
if ( get_option( 'wpcms_wc_activate' ) == 'Y'){
unset( $_GET['activate'] );
add_action( 'admin_notices', 'wfx_hookd_admin_notice_no_wfx' );
deactivate_plugins( plugin_basename( __FILE__ ) );
}
} elseif ( $this_framework == 'wonderflux' && intval( WF_VERSION ) >= 2 ){
unset( $_GET['activate'] );
add_action( 'admin_notices', 'wfx_hookd_admin_notice_version_wfx' );
deactivate_plugins( plugin_basename( __FILE__ ) );
}
}
delete_option( 'wpcms_wc_activate' );
}
add_action( 'admin_init', 'wfx_hookd_admin_wf_check' );
/**
*
* Activation admin notice for if not using Wonderflux
*
*/
function wfx_hookd_admin_notice_no_wfx(){
echo '<div class="error">';
echo '<p>Ooops - you need to be using the Wonderflux theme framework to use the <b>Wonderflux hook displayer</b> plugin!</p>';
echo '<p>Plugin has been deactivated.</p>';
echo '</div>';
}
/**
*
* Activation admin notice for Wonderflux version check
*
*/
function wfx_hookd_admin_notice_version_wfx(){
echo '<div class="error">';
echo '<p>You no longer need the <b>Wonderflux hook displayer</b> plugin.</p>';
echo '<p>This code has been incorporated into the Wonderflux core - cool!</p>';
echo '<p>Plugin has been deactivated.</p>';
echo '</div>';
}
function wfx_hookd_show_hooks(){
$debug_style = apply_filters( 'wflux_debug_show_hooks_css', 'display: inline-block; background-color: rgba(127, 127, 127, 0.7); border: 1px solid #212121; margin: 0; font-size: 0.8em; color: #fff;' );
echo '<p style="'.esc_attr($debug_style).'">Wonderflux hook: '' . current_filter() . ''</p>';
}
function wfx_hookd_do_show_hooks(){
// Wonderflux includes this functionality in the core from version 1.2
if ( function_exists('wfx_show_hooks') ) return;
$user_priv = ( has_filter('wflux_debug_show_hooks') ) ? apply_filters( 'wflux_debug_show_hooks', false ) : current_user_can( 'manage_options' );
if ( !is_admin() && $user_priv && WF_DEBUG ){
add_action( 'wf_output_start', 'wfx_hookd_show_hooks', 1 );
add_action( 'wf_head_meta', 'wfx_hookd_show_hooks', 1 );
add_action( 'wf_after_head', 'wfx_hookd_show_hooks', 1 );
add_action( 'wf_footer', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfbody_before_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfbody_after_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_before_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_before_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_before_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_after_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_after_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfheader_after_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_before_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_before_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_before_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_after_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_after_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wffooter_after_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_all', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_all', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_all', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_all', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_wrapper', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_all_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_all_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_all_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_all_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_all_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_index', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_index', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_index_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_index_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_index_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_index_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_index_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_index', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_index', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_home', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_home', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_home_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_home_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_home_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_home_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_home_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_home', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_home', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_page', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_page', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_page_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_page_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_page_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_page_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_page_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_page', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_page', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_single', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_single', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_single_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_single_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_single_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_single_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_single_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_single', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_single', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_category', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_category', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_category_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_category_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_category_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_category_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_category_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_category', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_category', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_date', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_date', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_date_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_date_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_date_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_date_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_date_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_date', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_date', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_author', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_author', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_author_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_author_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_author_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_author_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_author_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_author', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_author', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_tag', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_tag', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_tag_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_tag_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_tag_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_tag_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_tag_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_tag', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_tag', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_taxonomy', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_taxonomy', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_taxonomy_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_taxonomy_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_taxonomy_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_taxonomy_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_taxonomy_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_taxonomy', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_taxonomy', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_archive', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_archive', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_archive_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_archive_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_archive_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_archive_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_archive_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_archive', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_archive', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_search', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_search', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_search_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_search_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_search_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_search_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_search_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_search', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_search', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_attachment', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_attachment', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_attachment_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_attachment_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_attachment_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_attachment_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_attachment_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_attachment', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_attachment', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_before_404', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfsidebar_after_404', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_404_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_404_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_404_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_404_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_404_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_before_found_posts_404', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfloop_after_found_posts_404', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_bp_container', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_before_bp_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_bp_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_bp_main_content', 'wfx_hookd_show_hooks', 1 );
add_action( 'wfmain_after_bp_container', 'wfx_hookd_show_hooks', 1 );
}
}
add_action('init','wfx_hookd_do_show_hooks');
?>