PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.6.0
Shortcodes and extra features for Phlox theme v2.6.0
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / classes / class-auxin-widget.php
auxin-elements / includes / classes Last commit date
class-auxels-admin-assets.php 6 years ago class-auxels-archive-menu-links.php 6 years ago class-auxels-envato-elements.php 6 years ago class-auxels-import-parser.php 8 years ago class-auxels-import.php 6 years ago class-auxels-search-post-type.php 6 years ago class-auxin-admin-dashboard.php 6 years ago class-auxin-demo-importer.php 6 years ago class-auxin-dependency-sorting.php 8 years ago class-auxin-import.php 6 years ago class-auxin-install.php 6 years ago class-auxin-master-nav-menu-admin.php 6 years ago class-auxin-page-template.php 6 years ago class-auxin-permalink.php 6 years ago class-auxin-plugin-requirements.php 6 years ago class-auxin-post-type-base.php 6 years ago class-auxin-siteorigin-widget.php 6 years ago class-auxin-svg-support-allowedattributes.php 7 years ago class-auxin-svg-support-allowedtags.php 7 years ago class-auxin-svg-support.php 7 years ago class-auxin-walker-nav-menu-back.php 6 years ago class-auxin-welcome-sections.php 6 years ago class-auxin-welcome.php 6 years ago class-auxin-whitelabel.php 6 years ago class-auxin-widget-indie.php 6 years ago class-auxin-widget-shortcode-map.php 6 years ago class-auxin-widget.php 6 years ago
class-auxin-widget.php
522 lines
1 <?php
2 /**
3 * A class for creating widgets dynamically base of Master widget list
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2020 averta
11 */
12
13 // no direct access allowed
14 if ( ! defined('ABSPATH') ) exit;
15
16 /*--------------------------------*/
17
18
19 if( ! class_exists( 'Auxin_Widget' ) ) :
20
21
22 class Auxin_Widget extends WP_Widget {
23
24 private $defaults = array();
25 public $fields = array();
26
27 public $widget_fun_name;
28
29 private $dependency_list = array();
30 private $widget_info;
31
32 private $attach_ids_list = null;
33 private $att_ids = null;
34
35 /**
36 * Sets up the widgets name, Id, description and etc
37 */
38 function __construct( $widget_info ) {
39
40 parent::__construct( $widget_info['base_ID'] , $name = $widget_info['name'], $widget_info['args'] );
41
42 $this->widget_info = $widget_info;
43 $this->fields = $widget_info['params'];
44 $this->widget_fun_name = $widget_info['auxin_output_callback'];
45
46 $this->set_defaults();
47 }
48
49
50 private function set_defaults(){
51 foreach ( $this->fields as $field ) {
52 $this->defaults[ $field["id"] ] = $field["value"];
53 }
54 $this->defaults[ '__uid' ] = $this->widget_info['base_ID'] . '_' . substr( uniqid( ''. rand() ), -8 );
55 }
56
57 //
58 /**
59 * Outputs the content of the widget
60 *
61 * @param array $args The field keys and their real values
62 * @param array $instance The widget name, id and global configs
63 * @return string The widget output for front-end
64 */
65 function widget( $args, $instance ) {
66 // if the 'widget_info' was available in passed array, we can determine
67 // whether the array is from widget class or not
68
69 // make sure to pass same class name for wrapper to widget too
70 if( isset( $this->widget_info['base_class'] ) ){
71 $args['base_class'] = $this->widget_info['base_class'];
72 }
73 $instance['widget_info'] = $args;
74
75 if( function_exists( $this->widget_fun_name ) ){
76 echo call_user_func( $this->widget_fun_name, $instance );
77 } else {
78 auxin_error( __('The callback for widget does not exists.', 'auxin-elements') );
79 }
80 }
81
82
83 /**
84 * Outputs the options form on admin
85 *
86 * @param array $instance The widget options
87 */
88 function form( $instance ) {
89 $instance = wp_parse_args( (array) $instance, $this->defaults );
90
91 echo '<div id="'.$this->defaults[ '__uid' ].'" class="auxin-admin-widget-wrapper">';
92
93 // creates id attributes for fields to be saved by update()
94 foreach ( $this->fields as $field ) {
95 $id = $field['id'];
96 // make sure description is set
97 $field["description"] = ! isset( $field["description"] ) ? '': $field["description"];
98
99 $this->watch_for_field_dependencies( $field );
100
101 switch ( $field['type'] ) {
102
103 case 'aux_taxonomy':
104
105 $categories = get_terms( array(
106 'taxonomy' => $field['taxonomy'],
107 'orderby' => 'count',
108 'hide_empty' => true
109 ));
110
111
112 $categories_list = array( ' ' => __('All Categories', 'auxin-elements' ) ) ;
113 foreach ( $categories as $key => $value ) {
114 $categories_list[ $value->term_id ] = $value->name;
115 }
116
117 if( gettype( $instance[ $id ] ) === "string" ) {
118 $select = array( $instance[ $id ] );
119 } else {
120 $select = $instance[ $id ];
121 }
122
123 echo '<div class="aux-element-field aux-multiple-selector ">',
124 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
125 '<select multiple="multiple" name="' . $this->get_field_name($id) . '" id="' . $this->get_field_name($id) . '" class="aux-orig-select2 aux-admin-select2 aux-select2-multiple">';
126 echo '<option value="">' . __('Choose ..', 'auxin-elements') . '</option>';
127
128 foreach ( $categories_list as $key => $value ) {
129 printf(
130 '<option value="%s" class="hot-topic" %s style="margin-bottom:3px;">%s</option>',
131 $key,
132 in_array( $key, $select) ? 'selected="selected"' : '',
133 $value
134 );
135 }
136
137 echo '</select>';
138 if ( $field["description"] ) {
139 echo '<p class="option-description">' . $field["description"] . '</p>';
140 }
141 echo '</div>';
142
143 break;
144
145 case 'iconpicker':
146 case 'aux_iconpicker':
147 $font_icons = Auxin()->Font_Icons->get_icons_list('fontastic');
148 $output = '<div class="aux-element-field aux-iconpicker">';
149 $output .= '<label for="'.$this->get_field_name($id).'" >'.$field["name"].'</label><br />';
150 $output .= sprintf( '<select name="%1$s" id="%1$s" class="aux-fonticonpicker aux-select" >', $this->get_field_name($id) );
151 $output .= '<option value="">' . __('Choose ..', 'auxin-elements') . '</option>';
152
153 if( is_array( $font_icons ) ){
154 foreach ( $font_icons as $icon ) {
155 $icon_id = trim( $icon->classname, '.' );
156 $output .= '<option value="'. $icon_id .'" '. selected( $instance[$id], $icon_id, false ) .' >'. $icon->name . '</option>';
157
158 }
159 }
160
161 $output .= '</select>';
162 if ( $field["description"] ) {
163 $output .= '<p class="option-description">' . $field["description"] . '</p>';
164 }
165 $output .= '</div>';
166 echo $output;
167
168 break;
169
170
171
172 case 'textarea_html':
173 case 'textarea_raw_html':
174 echo '<div class="aux-element-field aux-visual-selector">',
175 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
176 '<textarea class="widefat" id="'.$this->get_field_id($id).'" name="'.$this->get_field_name($id).'" name="'.$this->get_field_name($id).'">',
177 $instance[$id].'</textarea>';
178 if ( $field["description"] ) {
179 echo '<p class="option-description textarea-desc">' . $field["description"] . '</p>';
180 }
181 echo '</div>';
182 break;
183
184 case 'textbox':
185 case 'textfield':
186 echo '<div class="aux-element-field aux-visual-selector">',
187 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
188 '<input class="widefat" id="'.$this->get_field_id($id).'" name="'.$this->get_field_name($id).'" type="text" value="'.$instance[$id].'" />';
189 if ( $field["description"] ) {
190 echo '<p class="option-description">' . $field["description"] . '</p>';
191 }
192 echo '</div>';
193 break;
194
195 case 'dropdown':
196 case 'select':
197 if( is_array( $instance[$id] ) ){
198 if( ! empty( $instance['def_value'] ) ){
199 $current_value = $instance['def_value'];
200 } else {
201 $default_value = array_keys( $instance[ $id ] );
202 $current_value = $default_value[0];
203 }
204 } else {
205 $current_value = $instance[ $id ];
206 }
207 echo '<div class="aux-element-field aux-dropdown">',
208 '<label for="'.$this->get_field_id( $id ).'" >'. $field['name']. '</label>',
209 '<select name="' .$this->get_field_name( $id ) . '" id="' . $this->get_field_id( $id ) . '" value="' . $current_value . '" >';
210 foreach ( $field['options'] as $key => $value ) {
211 printf( '<option value="%s" %s >%s</option>', $key, selected( $current_value, $key, false ), $value );
212 }
213 echo '</select>';
214
215 if ( $field["description"] ) {
216 echo '<p class="option-description">' . $field["description"] . '</p>';
217 }
218 echo '</div>';
219 break;
220
221 // Select2 single
222 case 'aux_select2_single' :
223 if( is_array( $instance[$id] ) ){
224 if( ! empty( $instance['def_value'] ) ){
225 $current_value = $instance['def_value'];
226 } else {
227 $default_value = array_keys( $instance[ $id ] );
228 $current_value = $default_value[0];
229 }
230 } else {
231 $current_value = $instance[ $id ];
232 }
233 echo '<div class="aux-element-field aux-multiple-selector ">',
234 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
235 '<div class="section-row-right" >' ,
236 '<select name="'.$this->get_field_name($id).'" id="'.$this->get_field_id($id).'" class="aux-orig-select2 aux-admin-select2 aux-select2-single" data-value="'.$current_value.'" value="'. $current_value .'" style="width:150px" >';
237 foreach ( $field['options'] as $key => $value ) {
238 printf( '<option value="%s" %s >%s</option>', $key, selected( $current_value, $key, false ), $value );
239 }
240 echo '</select></div>';
241 if ( $field["description"] ) {
242 echo '<p class="option-description">' . $field["description"] . '</p>';
243 }
244 echo '</div>' ;
245 break;
246
247 // defining of aux_select2_multiple field type for widget and siteorigin.
248 case 'aux_select2_multiple' :
249
250 if( gettype( $instance[ $id ] ) ==="string" ) {
251 $select = explode( ',', $instance[ $id ] );
252 } else {
253 $select = $instance[ $id ];
254 }
255
256 $output = '';
257 $output .= '<div class="aux-element-field aux-multiple-selector ">';
258 $output .= '<select multiple="multiple" name="'.$this->get_field_name($id).'" id="'.$this->get_field_id($id).'" style="width:100%" ' . ' class="wpb-multiselect wpb_vc_param_value aux-select2-multiple ' . esc_sql( $field['id'] ) . ' ' . $field['type'] . '_field">';
259
260 foreach ( $field['options'] as $key => $value ) {
261 $active_attr = in_array( $key, $select) ? 'selected="selected"' : '';
262 $output .= sprintf( '<option value="%s" %s >%s</option>', $key, $active_attr, $value );
263 }
264
265 $output .= '</select>';
266
267 if ( $field["description"] ) {
268
269 $output .= '<p class="option-description">' . $field["description"] . '</p>';
270 }
271
272 $output .= '</div>' ;
273 echo $output;
274
275 break;
276
277 case 'aux_visual_select':
278 $output = '<div class="aux-element-field aux-visual-selector">';
279 $output .= '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>';
280 $output .= '<select class="meta-select visual-select-wrapper" name="' . $this->get_field_name( $id ) . '" id="' . $this->get_field_id( $id ) . '" value="' . $instance[$id] . '" >';
281
282 $tmp_instance_id = $instance[$id];
283 foreach ( $field['choices'] as $id => $option_info ) {
284 $active_attr = ( $tmp_instance_id == $id ) ? ' selected ' : "";
285 $data_class = isset( $option_info['css_class'] ) && ! empty( $option_info['css_class'] ) ? 'data-class="'. $option_info['css_class'].'"' : '';
286 $data_symbol = empty( $data_class ) && isset( $option_info['image'] ) && ! empty( $option_info['image'] ) ? 'data-symbol="'. $option_info['image'].'"' : '';
287 $data_video = ! empty( $option_info['video_src'] ) ? 'data-video-src="'. esc_attr( $option_info['video_src'] ).'"' : '';
288
289 $output .= sprintf( '<option value="%s" %s %s %s %s>%s</option>', $id, $active_attr, $data_symbol,$data_video, $data_class, $option_info['label'] );
290 }
291 $output .= '</select>';
292 if ( $field["description"] ) {
293 $output .= '<p class="option-description visual-selector-desc">' . $field["description"] . '</p>';
294 }
295 $output .= '</div>';
296 echo $output;
297 break;
298
299 case 'checkbox':
300 case 'aux_switch':
301 $instance[$id] = isset( $instance[$id] ) ? (bool)$instance[$id] : false;
302 $tick = $instance[$id]? 'checked="checked"': '';
303 echo '<div class="aux-element-field aux_switch">',
304 '<input class="hidden_aux_switch" type="hidden" value="0" id="_'.$this->get_field_id($id) .'-hidden" name="'.$this->get_field_name($id).'" >',
305 '<input class="checkbox widefat aux_switch" type="checkbox" ' . $tick . ' id="'.$this->get_field_id($id).'" name="'.$this->get_field_name($id).'" >',
306 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>';
307
308 if ( $field["description"] ) {
309 echo '<p class="option-description">' . $field["description"] . '</p>';
310 }
311 echo '</div>';
312
313 break;
314
315 case 'color':
316 case 'colorpicker':
317 echo '<div class="aux-element-field aux-colorpicker">',
318 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
319 '<div class="mini-color-wrapper"><input id="'.$this->get_field_id($id).'" name="'.$this->get_field_name($id).'" type="text"type="text" value="'.$instance[$id].'" ></div>';
320 if ( $field["description"] ) {
321 echo '<p class="option-description">' . $field["description"] . '</p>';
322 }
323 echo '</div>';
324 break;
325
326 case 'aux_select_image':
327 case 'attach_image':
328 // Store attachment src for avertaAttachMedia field
329 if( !empty($instance[$id]) ) {
330 $att_ids = explode( ',', $instance[$id] );
331 $attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
332 if(!empty($att_ids)) {
333 printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
334 }
335 }
336 echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
337 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
338 '<input type="text" class="white" name="'. esc_attr( $this->get_field_name( $id ) ).'" ' . 'id="'. esc_attr( $this->get_field_id( $id ) ).'" ' . 'value="' . $instance[$id] .
339 '" data-media-type="image" data-limit="1" data-multiple="0"
340 data-add-to-list="'.__('Add Image', 'auxin-elements').'"
341 data-uploader-submit="'.__('Add Image', 'auxin-elements').'"
342 data-uploader-title="'.__('Select Image', 'auxin-elements').'"> ';
343 if ( $field["description"] ) {
344 echo '<p class="option-description">' . $field["description"] . '</p>';
345 }
346 echo '</div>';
347 break;
348
349 case 'aux_select_images':
350 case 'attach_images':
351 // Store attachment src for avertaAttachMedia field
352 if( !empty($instance[$id]) ) {
353 $att_ids = explode( ',', $instance[$id] );
354 $attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
355 if(!empty($att_ids)) {
356 printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
357 }
358 }
359 echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
360 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
361 '<input type="text" class="white" name="'.$this->get_field_name($id).'" ' . 'id="'.$this->get_field_id($id).'" ' . 'value="' . $instance[$id] .
362 '" data-media-type="image" data-limit="9999" data-multiple="1"
363 data-add-to-list="'.__('Add Image', 'auxin-elements').'"
364 data-uploader-submit="'.__('Add Image', 'auxin-elements').'"
365 data-uploader-title="'.__('Select Image', 'auxin-elements').'"> ';
366 if ( $field["description"] ) {
367 echo '<p class="option-description">' . $field["description"] . '</p>';
368 }
369 echo '</div>';
370 break;
371
372 case 'aux_select_video':
373 case 'attach_video':
374
375 // Store attachment src for avertaAttachMedia field
376 if( !empty($instance[$id]) ) {
377 $att_ids = explode( ',', $instance[$id] );
378 $attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
379 if(!empty($att_ids)) {
380 printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
381 }
382 }
383 echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
384 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
385 '<input type="text" class="white" name="'.$this->get_field_name($id).'" ' . 'id="'.$this->get_field_id($id).'" ' . 'value="' . $instance[$id] .
386 '" data-media-type="video" data-limit="1" data-multiple="0"
387 data-add-to-list="'.__('Add Video', 'auxin-elements').'"
388 data-uploader-submit="'.__('Add Video', 'auxin-elements').'"
389 data-uploader-title="'.__('Select Video', 'auxin-elements').'"> ';
390 if ( $field["description"] ) {
391 echo '<p class="option-description">' . $field["description"] . '</p>';
392 }
393 echo '</div>';
394 break;
395
396 case 'aux_select_audio':
397 case 'attach_audio':
398
399 // Store attachment src for avertaAttachMedia field
400 if( !empty($instance[$id]) ) {
401 $att_ids = explode( ',', $instance[$id] );
402 $attach_ids_list = auxin_get_the_resized_attachment_src( $att_ids, 80, 80, true );
403 if(!empty($att_ids)) {
404 printf( "<script>auxin.attachmedia = jQuery.extend( auxin.attachmedia, %s );</script>", wp_json_encode( array_unique( $attach_ids_list ) ) );
405 }
406 }
407 echo '<div class="aux-element-field av3_container aux_select_image axi-attachmedia-wrapper">',
408 '<label for="'.$this->get_field_id($id).'" >'.$field["name"].'</label>',
409 '<input type="text" class="white" name="'.$this->get_field_name($id).'" ' . 'id="'.$this->get_field_id($id).'" ' . 'value="' . $instance[$id] .
410 '" data-media-type="audio" data-limit="1" data-multiple="0"
411 data-add-to-list="'.__('Add Audio', 'auxin-elements').'"
412 data-uploader-submit="'.__('Add Audio', 'auxin-elements').'"
413 data-uploader-title="'.__('Select Audio', 'auxin-elements').'"> ';
414 if ( $field["description"] ) {
415 echo '<p class="option-description">' . $field["description"] . '</p>';
416 }
417 echo '</div>';
418
419 default:
420
421 break;
422 }
423
424 }
425
426 echo '</div>';
427
428
429 // axpp( $this->dependency_list );
430 $this->print_dependencies();
431 }
432
433
434 /**
435 * Loop to collect dependency map of metafields
436 *
437 * @param array $field field options
438 * @return void
439 */
440 public function watch_for_field_dependencies( $field = array() ){
441 if( empty( $field ) ){
442 return;
443 }
444
445 $field_dependencies = array();
446
447 if( isset( $field['dependency'] ) && ! empty( $field['dependency'] ) ){
448
449 $depend = $field['dependency'];
450
451 if( isset( $depend['element'] ) && ( isset( $depend['value'] ) && ! empty( $depend['value'] ) ) ){
452
453 unset( $depend['relation'] );
454 unset( $depend['callback'] );
455
456 $field_dependencies[ $depend['element'] ] = array( 'value' => (array)$depend['value'] );
457 }
458
459 }
460
461 if( $field_dependencies ){
462 $this->dependency_list[ $field['id'] ] = $field_dependencies;
463 }
464 }
465
466 /**
467 * Print metafield dependencies
468 *
469 * @return string JSON string containing metafield dependencies
470 */
471 public function print_dependencies(){
472 // echo js dependencies
473 printf( '<script>
474 function auxinCreateNamespace(n){for(var e=n.split("."),a=window,i="",r=e.length,t=0;r>t;t++)"window"!=e[t]&&(i=e[t],a[i]=a[i]||{},a=a[i]);return a;}
475 auxinCreateNamespace("auxin.elements.%3$s");
476 auxin.elements.%3$s.dependencies = %2$s;
477 auxin.elements.%3$s.baseid = "%1$s";</script>',
478 $this->widget_info['base_ID'],
479 wp_json_encode( $this->dependency_list ),
480 $this->defaults[ '__uid' ]
481 );
482 }
483
484
485 /**
486 * Processing widget options on save
487 *
488 * @param array $new_instance The new options
489 * @param array $old_instance The previous options
490 */
491 function update( $new_instance, $old_instance ) {
492 $instance = $old_instance;
493 // TODO: we exclode the defaults because on checkbox there is no this value on unchecked and it replaces with defaults
494 // $new_instance = wp_parse_args( (array) $new_instance, $this->defaults );
495 $new_instance = wp_parse_args( (array) $new_instance );
496 foreach ( $this->fields as $field ) {
497 $id = $field["id"];
498
499 if( ! isset( $new_instance[ $id ] ) ) {
500 continue;
501 }
502
503 if( $field["type"] == "aux_switch" ) {
504 $instance[ $id ] = !empty($new_instance[$id ] ) ? 1 : 0;
505 }
506 if( $field["type"] == "aux_select2_multiple" ) {
507 $instance[ $id ] = esc_sql( $new_instance[ $id ] );
508
509 } else {
510 $instance[ $id ] = is_array( $new_instance[ $id ] ) ? $new_instance[ $id ] : strip_tags( $new_instance[ $id ] );
511 }
512
513 }
514
515 return $instance;
516 }
517
518
519 } // end widget class
520
521 endif;
522