PluginProbe
Widget Context / 1.0.7
Widget Context v1.0.7
1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 trunk 0.4.1 0.4.2 0.4.3 0.4.4 0.4.5 0.6 0.7 0.7.1 0.7.2 0.8 0.8.1 All 30 releases
widget-context / debug / debug-bar.php

debug-bar.php in Widget Context 1.0.7, at debug/debug-bar.php

110 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Debug_Widget_Context extends Debug_Bar_Panel {
4
5 function init() {
6
7 $this->title( __( 'Widget Context', 'widget-context' ) );
8
9 }
10
11 function prerender() {
12
13 $this->set_visible( ! is_admin() );
14
15 }
16
17 function render() {
18
19 $wc = widget_context::instance();
20
21 $sidebars_widgets = $wc->get_sidebars_widgets_copy();
22
23 $map = array(
24 'show' => __( 'Show widget everywhere', 'widget-context' ),
25 'selected' => __( 'Show widget on selected', 'widget-context' ),
26 'notselected' => __( 'Hide widget on selected', 'widget-context' ),
27 'hide' => __( 'Hide widget everywhere', 'widget-context' )
28 );
29
30 foreach ( $sidebars_widgets as $widget_area => $widgets ) {
31
32 if ( 'wp_inactive_widgets' == $widget_area )
33 continue;
34
35 foreach ( $widgets as $widget_i => $widget_id ) {
36
37 $a = array(); // sorry
38 $context_options = $wc->get_context_options( $widget_id );
39
40 foreach ( $wc->get_contexts() as $context_id => $context ) {
41
42 if ( isset( $context_options[ $context_id ] ) )
43 $widget_context_args = $context_options[ $context_id ];
44 else
45 $widget_context_args = array();
46
47 if ( $context_id == 'incexc' ) {
48 if ( isset( $widget_context_args['condition'] ) && isset( $map[ $widget_context_args['condition'] ] ) )
49 $set = $map[ $widget_context_args['condition'] ];
50 else
51 $set = __( 'Default', 'widget-context' );
52 }
53
54 $check = apply_filters(
55 'widget_context_check-' . $context_id,
56 null,
57 $widget_context_args
58 );
59
60 $a[] = sprintf(
61 '<tr>
62 <th><strong>%s</strong></th>
63 <td>%s</td>
64 <td><pre>%s</pre></td>
65 </tr>',
66 $context_id,
67 $check ? __( 'Yes', 'widget-context' ) : __( 'No', 'widget-context' ),
68 esc_html( print_r( $widget_context_args, true ) )
69 );
70
71 }
72
73 if ( $wc->check_widget_visibility( $widget_id ) )
74 $status = sprintf( __( 'Showing <strong>%s</strong> in "%s"' ), esc_html( $widget_id ), esc_html( $widget_area ) );
75 else
76 $status = sprintf( __( 'Hiding <strong>%s</strong> in "%s"' ), esc_html( $widget_id ), esc_html( $widget_area ) );
77
78 $out[] = sprintf(
79 '<h3><a href="#widget-%d" class="toggle">%s</a> <strong>%s</strong> &mdash; %s</h3>
80 <table width="100%%" id="widget-%d" style="display:none;">
81 <tr>
82 <th>Context</th>
83 <th>Match</th>
84 <th>Settings</th>
85 </tr>
86 %s
87 </table>',
88 $widget_i,
89 __( 'Toggle', 'widget-context' ),
90 esc_html( $set ),
91 $status,
92 $widget_i,
93 implode( '', $a )
94 );
95
96 }
97 }
98
99 printf(
100 '%s
101 <h3>Registered Contexts:</h3>
102 <pre>%s</pre>',
103 implode( '', $out ),
104 esc_html( print_r( $wc->get_contexts(), true ) )
105 );
106
107 }
108
109 }
110