PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.5
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.5
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / widgets / option-tabs / behavior.php
widget-options / includes / widgets / option-tabs Last commit date
alignment.php 2 years ago animation.php 2 years ago behavior.php 2 years ago days-dates.php 2 years ago devices.php 2 years ago settings.php 2 years ago state.php 2 years ago styling.php 2 years ago upsell.php 2 years ago visibility.php 2 years ago
behavior.php
178 lines
1 <?php
2
3 /**
4 * Settings Widget Options
5 *
6 * @copyright Copyright (c) 2015, Jeffrey Carandang
7 * @since 1.0
8 */
9
10 // Exit if accessed directly
11 if (!defined('ABSPATH')) exit;
12
13 /**
14 * Add Settings Widget Options Tab
15 *
16 * @since 1.0
17 * @return void
18 */
19
20 /**
21 * Called on 'extended_widget_opts_tabs'
22 * create new tab navigation for alignment options
23 */
24 function widgetopts_tab_behavior($args)
25 { ?>
26 <li class="extended-widget-opts-tab-behavior">
27 <a href="#extended-widget-opts-tab-<?php echo $args['id']; ?>-behavior" title="<?php _e('Misc & Class,ID', 'widget-options'); ?>"><span class="dashicons dashicons-admin-generic"></span> <span class="tabtitle"><?php _e('Behavior', 'widget-options'); ?></span></a>
28 </li>
29 <?php
30 }
31 add_action('extended_widget_opts_tabs', 'widgetopts_tab_behavior', 7);
32
33 /**
34 * Called on 'extended_widget_opts_tabcontent'
35 * create new tab content options for alignment options
36 */
37 if (!function_exists('widgetopts_tabcontent_behavior')) :
38 function widgetopts_tabcontent_behavior($args)
39 {
40 global $widget_options;
41
42 $id = '';
43 $classes = '';
44 $logic = '';
45 $selected = 0;
46 $check = '';
47 if (isset($args['params']) && isset($args['params']['class'])) {
48 if (isset($args['params']['class']['id'])) {
49 $id = $args['params']['class']['id'];
50 }
51 if (isset($args['params']['class']['classes'])) {
52 $classes = $args['params']['class']['classes'];
53 }
54 if (isset($args['params']['class']['selected'])) {
55 $selected = $args['params']['class']['selected'];
56 }
57 if (isset($args['params']['class']['logic'])) {
58 $logic = $args['params']['class']['logic'];
59 }
60 if (isset($args['params']['class']['title']) && $args['params']['class']['title'] == '1') {
61 $check = 'checked="checked"';
62 }
63 }
64
65 $predefined = array();
66 if (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['classlists']) && !empty($widget_options['settings']['classes']['classlists'])) {
67 $predefined = $widget_options['settings']['classes']['classlists'];
68 }
69 ?>
70 <div id="extended-widget-opts-tab-<?php echo $args['id']; ?>-behavior" class="extended-widget-opts-tabcontent extended-widget-opts-inside-tabcontent extended-widget-opts-tabcontent-class">
71
72 <div class="extended-widget-opts-settings-tabs extended-widget-opts-inside-tabs">
73 <input type="hidden" id="extended-widget-opts-settings-selectedtab" value="<?php echo $selected; ?>" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][selected]" />
74 <!-- start tab nav -->
75 <ul style="margin-top: 10px;" class="extended-widget-opts-settings-tabnav-ul">
76 <?php if ('activate' == $widget_options['hide_title']) { ?>
77 <li class="extended-widget-opts-settings-tab-title">
78 <a href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-title" title="<?php _e('Misc', 'widget-options'); ?>"><?php _e('Misc', 'widget-options'); ?></a>
79 </li>
80 <?php } ?>
81
82 <?php if ('activate' == $widget_options['classes']) { ?>
83 <li class="extended-widget-opts-settings-tab-class">
84 <a href="#extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-class" title="<?php _e('Class & ID', 'widget-options'); ?>"><?php _e('Class & ID', 'widget-options'); ?></a>
85 </li>
86 <?php } ?>
87 <div class="extended-widget-opts-clearfix"></div>
88 </ul><!-- end tab nav -->
89 <div class="extended-widget-opts-clearfix"></div>
90
91 <?php if ('activate' == $widget_options['hide_title']) { ?>
92 <!-- start title tab content -->
93 <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-title" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent">
94 <div class="widget-opts-title">
95 <?php if ('activate' == $widget_options['hide_title']) { ?>
96 <p class="widgetopts-subtitle"><?php _e('Hide Widget Title', 'widget-options'); ?></p>
97 <p>
98 <input type="checkbox" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][title]" id="opts-class-title-<?php echo $args['id']; ?>" value="1" <?php echo $check; ?> />
99 <label for="opts-class-title-<?php echo $args['id']; ?>"><?php _e('Check to hide widget title', 'widget-options'); ?></label>
100 </p>
101 <?php } ?>
102 </div>
103 </div><!-- end title tab content -->
104 <?php } ?>
105
106 <?php if ('activate' == $widget_options['classes']) { ?>
107 <!-- start class tab content -->
108 <div id="extended-widget-opts-settings-tab-<?php echo $args['id']; ?>-class" class="extended-widget-opts-settings-tabcontent extended-widget-opts-inner-tabcontent">
109 <div class="widget-opts-class">
110 <table class="form-table">
111 <tbody>
112 <?php if (isset($widget_options['settings']['classes']) && (isset($widget_options['settings']['classes']['id']) && '1' == $widget_options['settings']['classes']['id'])) { ?>
113 <tr valign="top" class="widgetopts_id_fld">
114 <td scope="row">
115 <strong><?php _e('Widget CSS ID:', 'widget-options'); ?></strong><br />
116 <input type="text" id="opts-class-id-<?php echo $args['id']; ?>" class="widefat" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][id]" value="<?php echo $id; ?>" />
117 </td>
118 </tr>
119 <?php } ?>
120
121 <?php if (
122 !isset($widget_options['settings']['classes']) ||
123 (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['type']) && !in_array($widget_options['settings']['classes']['type'], array('hide', 'predefined')))
124 ) { ?>
125 <tr valign="top">
126 <td scope="row">
127 <strong><?php _e('Widget CSS Classes:', 'widget-options'); ?></strong><br />
128 <input type="text" id="opts-class-classes-<?php echo $args['id']; ?>" class="widefat" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][classes]" value="<?php echo $classes; ?>" />
129 <small><em><?php _e('Separate each class with space.', 'widget-options'); ?></em></small>
130 </td>
131 </tr>
132 <?php } ?>
133 <?php if (
134 !isset($widget_options['settings']['classes']) ||
135 (isset($widget_options['settings']['classes']) && isset($widget_options['settings']['classes']['type']) && !in_array($widget_options['settings']['classes']['type'], array('hide', 'text')))
136 ) { ?>
137 <?php if (is_array($predefined) && !empty($predefined)) {
138 $predefined = array_unique($predefined); //remove dups
139 ?>
140 <tr valign="top">
141 <td scope="row">
142 <strong><?php _e('Available Widget Classes:', 'widget-options'); ?></strong><br />
143 <div class="extended-widget-opts-class-lists" style="max-height: 230px;padding: 5px;overflow:auto;">
144 <?php foreach ($predefined as $key => $value) {
145 if (
146 isset($args['params']['class']['predefined']) &&
147 is_array($args['params']['class']['predefined']) &&
148 in_array($value, $args['params']['class']['predefined'])
149 ) {
150 $checked = 'checked="checked"';
151 } else {
152 $checked = '';
153 }
154 ?>
155 <p>
156 <input type="checkbox" name="<?php echo $args['namespace']; ?>[extended_widget_opts][class][predefined][]" id="<?php echo $args['id']; ?>-opts-class-<?php echo $key; ?>" value="<?php echo $value; ?>" <?php echo $checked; ?> />
157 <label for="<?php echo $args['id']; ?>-opts-class-<?php echo $key; ?>"><?php echo $value; ?></label>
158 </p>
159 <?php } ?>
160 </div>
161 </td>
162 </tr>
163 <?php } ?>
164 <?php } ?>
165 </tbody>
166 </table>
167 </div>
168 </div><!-- end class tab content -->
169 <?php } ?>
170
171 </div><!-- end .extended-widget-opts-settings-tabs -->
172
173
174 </div>
175 <?php
176 }
177 add_action('extended_widget_opts_tabcontent', 'widgetopts_tabcontent_behavior');
178 endif; ?>