@@ -11,9 +11,24 @@ class QM_Output_Html_Hooks extends QM_Output_Html {
11
11
12
12
public function __construct ( QM_Collector $ collector ) {
13
13
parent ::__construct ( $ collector );
14
+ add_filter ( 'qm/output/panel_menus ' , array ( $ this , 'panel_menus ' ) );
14
15
add_filter ( 'qm/output/menus ' , array ( $ this , 'admin_menu ' ), 80 );
15
16
}
16
17
18
+ public function panel_menus ( $ panel_menu ) {
19
+ $ data = $ this ->collector ->get_data ();
20
+
21
+ if ( empty ( $ data ['discovered_hooks ' ] ) )
22
+ return ;
23
+
24
+ $ panel_menu [ 'qm- ' . $ this ->id ]['children ' ][ 'qm- ' . $ this ->id . '-discovered_hooks ' ] = array (
25
+ 'href ' => esc_attr ( '# ' . $ this ->collector ->id () . '-discovered_hooks ' ),
26
+ 'title ' => '└ ' . __ ( 'Discovered Hooks ' , 'query-monitor ' ),
27
+ );
28
+
29
+ return $ panel_menu ;
30
+ }
31
+
17
32
public function output () {
18
33
19
34
$ data = $ this ->collector ->get_data ();
@@ -178,6 +193,58 @@ public static function output_hook_table( array $hooks ) {
178
193
179
194
}
180
195
196
+ protected function after_tabular_output () {
197
+ echo '</table> ' ;
198
+ echo '</div> ' ;
199
+
200
+ $ this ->output_discovered ();
201
+ }
202
+
203
+ function output_discovered () {
204
+ printf (
205
+ '<div class="qm qm-discovered" id="%1$s" role="group" aria-labelledby="%1$s" tabindex="-1"> ' ,
206
+ esc_attr ( $ this ->current_id . '-discovered_hooks ' )
207
+ );
208
+
209
+ echo '<div><table> ' ;
210
+
211
+ printf (
212
+ '<caption><h2 id="%1$s-caption">%2$s</h2></caption> ' ,
213
+ esc_attr ( $ this ->current_id . '-discovered_hooks ' ),
214
+ esc_html__ ( 'Discovered Hooks ' , 'query-monitor ' )
215
+ );
216
+
217
+ echo '<thead> ' ;
218
+ echo '<tr> ' ;
219
+ echo '<th scope="col"> ' . esc_html__ ( 'Label ' , 'query-monitor ' ) . '</th> ' ;
220
+ echo '<th scope="col"> ' . esc_html__ ( 'Hook ' , 'query-monitor ' ) . '</th> ' ;
221
+ echo '<th scope="col"> ' . esc_html__ ( 'Successive Uses ' , 'query-monitor ' ) . '</th> ' ;
222
+ echo '</tr> ' ;
223
+ echo '</thead> ' ;
224
+
225
+ echo '<tbody> ' ;
226
+
227
+ $ data = $ this ->collector ->get_data ();
228
+
229
+ foreach ( $ data ['discovered_hooks ' ] as $ label => $ hooks ) {
230
+ foreach ( $ hooks as $ i => $ hook ) {
231
+ echo '<tr> ' ;
232
+
233
+ if ( 0 === $ i )
234
+ echo '<th scope="row" rowspan=" ' . esc_attr ( count ( $ hooks ) ) . '" class="qm-nowrap"><span class="qm-sticky"> ' . esc_html ( $ label ) . '</span></th> ' ;
235
+
236
+ echo '<td><code> ' . esc_html ( $ hook ['action ' ] ) . '</code></td> ' ;
237
+ echo '<td class="qm-num"> ' . esc_html ( $ hook ['count ' ] ) . '</td> ' ;
238
+ echo '</tr> ' ;
239
+ }
240
+ }
241
+
242
+ echo '</tbody> ' ;
243
+ echo '</table></div> ' ;
244
+
245
+ echo '</div> ' ;
246
+ }
247
+
181
248
}
182
249
183
250
function register_qm_output_html_hooks ( array $ output , QM_Collectors $ collectors ) {
0 commit comments