Woocommerce Products Slider - Version 1.13.38

Version Description

  • 2022-09-26 fix - jQuery UI tabs missing issue fixed.
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Woocommerce Products Slider
Version 1.13.38
Comparing to
See all releases

Code changes from version 1.13.37 to 1.13.38

includes/class-settings-tabs.php CHANGED
@@ -1,278 +1,282 @@
1
  <?php
2
- if ( ! defined('ABSPATH')) exit; // if direct access
3
 
4
- if( ! class_exists( 'settings_tabs_field' ) ) {
5
- class settings_tabs_field{
 
6
 
7
- //public $asset_dir_url = '';
8
- public $textdomain = 'settings-tabs';
9
 
10
- public function __construct(){
 
11
 
12
- // $this->asset_dir_url = isset($args['asset_dir_url']) ? $args['asset_dir_url'] : '';
13
- // $this->textdomain = isset($args['textdomain']) ? $args['textdomain'] : '';
14
 
15
- }
16
 
17
 
18
- function admin_scripts(){
 
19
 
20
 
21
- wp_enqueue_script('jquery');
22
- wp_enqueue_script('jquery-ui-sortable');
23
- wp_enqueue_script( 'jquery-ui-core' );
24
- wp_enqueue_script('jquery-ui-accordion');
25
- wp_enqueue_style( 'jquery-ui');
 
26
 
27
- wp_enqueue_script('wp-color-picker');
28
- wp_enqueue_style( 'wp-color-picker' );
29
 
30
 
31
- wp_enqueue_style( 'font-awesome-5' );
32
 
33
- wp_enqueue_style( 'settings-tabs' );
34
- wp_enqueue_script( 'settings-tabs' );
35
 
36
- wp_enqueue_script( 'code-editor' );
37
- wp_enqueue_style( 'code-editor' );
38
 
39
- wp_enqueue_script( 'jquery.lazy' );
40
 
41
- if (function_exists('wp_enqueue_editor')) {
42
- wp_enqueue_editor();
 
43
  }
44
 
 
 
45
 
46
- }
47
-
48
- function field_template($option){
49
-
50
- $id = isset( $option['id'] ) ? $option['id'] : "";
51
- $wraper_class = isset( $option['wraper_class'] ) ? $option['wraper_class'] : "";
52
- $conditions = isset( $option['conditions'] ) ? $option['conditions'] : array();
53
 
54
- $is_error = isset( $option['is_error'] ) ? $option['is_error'] : false;
55
- $error_details = isset( $option['error_details'] ) ? $option['error_details'] : '';
56
 
57
 
58
 
59
- if(!empty($conditions)):
60
 
61
- $depends = '';
62
 
63
- $field = isset($conditions['field']) ? $conditions['field'] :'';
64
- $cond_value = isset($conditions['value']) ? $conditions['value']: '';
65
- $type = isset($conditions['type']) ? $conditions['type'] : '';
66
- $pattern = isset($conditions['pattern']) ? $conditions['pattern'] : '';
67
- $modifier = isset($conditions['modifier']) ? $conditions['modifier'] : '';
68
- $like = isset($conditions['like']) ? $conditions['like'] : '';
69
- $strict = isset($conditions['strict']) ? $conditions['strict'] : '';
70
- $empty = isset($conditions['empty']) ? $conditions['empty'] : '';
71
- $sign = isset($conditions['sign']) ? $conditions['sign'] : '';
72
- $min = isset($conditions['min']) ? $conditions['min'] : '';
73
- $max = isset($conditions['max']) ? $conditions['max'] : '';
74
 
75
- $depends .= "{'[name=$field]':";
76
- $depends .= '{';
77
 
78
- if(!empty($type)):
79
- $depends .= "'type':";
80
- $depends .= "'".$type."'";
81
- endif;
82
 
83
- if(!empty($modifier)):
84
- $depends .= ",'modifier':";
85
- $depends .= "'".$modifier."'";
86
- endif;
87
 
88
- if(!empty($like)):
89
- $depends .= ",'like':";
90
- $depends .= "'".$like."'";
91
- endif;
92
 
93
- if(!empty($strict)):
94
- $depends .= ",'strict':";
95
- $depends .= "'".$strict."'";
96
- endif;
97
 
98
- if(!empty($empty)):
99
- $depends .= ",'empty':";
100
- $depends .= "'".$empty."'";
101
- endif;
102
 
103
- if(!empty($sign)):
104
- $depends .= ",'sign':";
105
- $depends .= "'".$sign."'";
106
- endif;
107
 
108
- if(!empty($min)):
109
- $depends .= ",'min':";
110
- $depends .= "'".$min."'";
111
- endif;
112
 
113
- if(!empty($max)):
114
- $depends .= ",'max':";
115
- $depends .= "'".$max."'";
116
- endif;
117
- if(!empty($cond_value)):
118
- $depends .= ",'value':";
119
- if(is_array($cond_value)):
120
- $count= count($cond_value);
121
- $i = 1;
122
- $depends .= "[";
123
- foreach ($cond_value as $val):
124
- $depends .= "'".$val."'";
125
- if($i<$count)
126
- $depends .= ",";
127
- $i++;
128
- endforeach;
129
- $depends .= "]";
130
- else:
131
- $depends .= "[";
132
- $depends .= "'".$cond_value."'";
133
- $depends .= "]";
134
  endif;
135
- endif;
136
- $depends .= '}}';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
- endif;
139
 
140
 
141
 
142
- ob_start();
143
 
144
- ?>
145
- <div <?php if(!empty($depends)) {?> data-depends="[<?php echo $depends; ?>]" <?php } ?> class="setting-field <?php if($is_error) echo 'field-error'; ?> <?php echo $wraper_class; ?> <?php if(!empty($depends)) echo 'dependency-field'; ?>">
146
- <div class="field-lable">%s</div>
147
- <div class="field-input">%s
148
- <p class="description">%s</p>
149
- <?php if($is_error && !empty($error_details)): ?>
150
- <p class="error-details"><i class="fas fa-exclamation-circle"></i> <?php echo $error_details; ?></p>
151
- <?php endif; ?>
152
 
 
153
  </div>
154
- </div>
155
  <?php
156
 
157
- return ob_get_clean();
158
-
159
- }
160
 
161
 
162
 
163
 
164
 
165
 
166
- function generate_field($option){
 
167
 
168
- $id = isset( $option['id'] ) ? $option['id'] : "";
169
- $type = isset( $option['type'] ) ? $option['type'] : "";
170
- $details = isset( $option['details'] ) ? $option['details'] : "";
171
 
172
 
173
 
174
 
175
 
176
 
177
- if( empty( $id ) ) return;
178
 
179
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
180
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
181
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
182
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
183
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
184
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
185
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
186
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
187
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
188
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
189
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
190
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
191
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
192
 
193
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
194
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
195
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
196
 
197
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
198
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
199
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
200
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
201
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
202
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
203
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
204
 
205
- elseif( isset($option['type']) && $option['type'] === 'option_group') $this->field_option_group( $option );
206
- elseif( isset($option['type']) && $option['type'] === 'option_group_accordion') $this->field_option_group_accordion( $option );
207
- elseif( isset($option['type']) && $option['type'] === 'wp_editor') $this->field_wp_editor( $option );
208
- elseif( isset($option['type']) && $option['type'] === 'textarea_editor') $this->field_textarea_editor( $option );
209
 
210
 
211
 
212
- elseif( isset($option['type']) && $option['type'] === $type ) do_action( "settings_tabs_field_$type", $option );
213
 
214
 
215
- //if( !empty( $details ) ) echo "<p class='description'>$details</p>";
216
 
217
 
218
 
219
 
220
 
221
- }
222
 
223
 
224
- public function field_option_group_accordion( $option ){
 
225
 
226
- $id = isset( $option['id'] ) ? $option['id'] : "";
227
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
228
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : false;
229
 
230
- $args_index = isset( $option['args_index'] ) ? $option['args_index'] : array();
231
- $args_index_default = isset( $option['args_index_default'] ) ? $option['args_index_default'] : array();
232
- $args_index_hide = isset( $option['args_index_hide'] ) ? $option['args_index_hide'] : array();
233
 
234
- $args_index = !empty($args_index) ? $args_index : $args_index_default;
235
 
236
- $args = isset( $option['args'] ) ? $option['args'] : array();
237
 
238
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
239
 
240
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
241
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
242
 
243
 
244
- $title = isset( $option['title'] ) ? $option['title'] : "";
245
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
246
 
247
- if($is_pro == true){
248
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
249
- }
250
 
251
 
252
- ob_start();
253
  ?>
254
- <div class="option-group-accordion-wrap" id="<?php echo $css_id; ?>">
255
- <div sortable="<?php echo ($sortable) ? 'true': 'false'; ?>" class='option-group-accordion accordion'>
256
- <?php
257
 
258
- if(!empty($args_index))
259
- foreach( $args_index as $index ):
260
 
261
- //foreach( $args as $key => $value ):
262
 
263
- $group_title = isset($args[$index]['title']) ? $args[$index]['title'] : '';
264
- $is_hide = isset($args_index_hide[$index]) ? $args_index_hide[$index] : false;
265
 
266
 
267
- //$link = $value['link'];
268
- $options = isset($args[$index]['options']) ? $args[$index]['options'] : array();
269
 
270
- ?>
271
  <div class="group">
272
  <h3 class="accordion-title">
273
 
274
 
275
- <?php if($sortable): ?>
276
  <span class="sort"><i class="fas fa-sort"></i></span>
277
  <?php endif; ?>
278
 
@@ -282,38 +286,38 @@ class settings_tabs_field{
282
 
283
  <?php
284
 
285
- if(!empty($options)):
286
- foreach ($options as $option):
287
-
288
- $id = isset( $option['id'] ) ? $option['id'] : "";
289
- $type = isset( $option['type'] ) ? $option['type'] : "";
290
- $details = isset( $option['details'] ) ? $option['details'] : "";
291
-
292
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
293
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
294
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
295
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
296
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
297
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
298
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
299
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
300
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
301
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
302
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
303
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
304
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
305
-
306
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
307
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
308
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
309
-
310
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
311
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
312
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
313
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
314
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
315
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
316
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
317
 
318
  endforeach;
319
  endif;
@@ -323,438 +327,433 @@ class settings_tabs_field{
323
 
324
 
325
  <?php
326
- //endforeach;
327
 
328
- endforeach;
329
 
330
 
331
- ?>
332
- </div> <!-- .option-group-accordion -->
333
- </div><!-- .option-group-accordion-wrap -->
334
 
335
  <?php
336
 
337
- $input_html = ob_get_clean();
338
-
339
- echo sprintf($field_template, $title, $input_html, $group_details);
340
-
341
 
342
- }
 
343
 
344
 
345
- public function field_option_group( $option ){
 
346
 
347
- $id = isset( $option['id'] ) ? $option['id'] : "";
348
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
349
- $options = isset( $option['options'] ) ? $option['options'] : array();
350
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
351
 
352
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
353
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
354
 
355
 
356
- $title = isset( $option['title'] ) ? $option['title'] : "";
357
- $group_details = isset( $option['details'] ) ? $option['details'] : "";
358
 
359
- if($is_pro == true){
360
- $group_details = '<span class="pro-feature">'.$pro_text.'</span> '.$group_details;
361
- }
362
 
363
 
364
- ob_start();
365
  ?>
366
- <div id="<?php echo $css_id; ?>">
367
- <?php
368
 
369
- if(!empty($options)):
370
- foreach ($options as $option):
371
-
372
- $id = isset( $option['id'] ) ? $option['id'] : "";
373
- $type = isset( $option['type'] ) ? $option['type'] : "";
374
- $details = isset( $option['details'] ) ? $option['details'] : "";
375
-
376
- if( isset($option['type']) && $option['type'] === 'select' ) $this->field_select( $option );
377
- elseif( isset($option['type']) && $option['type'] === 'select2') $this->field_select2( $option );
378
- elseif( isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox( $option );
379
- elseif( isset($option['type']) && $option['type'] === 'radio') $this->field_radio( $option );
380
- elseif( isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image( $option );
381
- elseif( isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea( $option );
382
- elseif( isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js( $option );
383
- elseif( isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css( $option );
384
- elseif( isset($option['type']) && $option['type'] === 'number' ) $this->field_number( $option );
385
- elseif( isset($option['type']) && $option['type'] === 'text' ) $this->field_text( $option );
386
- elseif( isset($option['type']) && $option['type'] === 'text_icon' ) $this->field_text_icon( $option );
387
- elseif( isset($option['type']) && $option['type'] === 'text_multi' ) $this->field_text_multi( $option );
388
- elseif( isset($option['type']) && $option['type'] === 'hidden' ) $this->field_hidden( $option );
389
-
390
- elseif( isset($option['type']) && $option['type'] === 'range' ) $this->field_range( $option );
391
- elseif( isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker( $option );
392
- elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi( $option );
393
-
394
- elseif( isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker( $option );
395
- elseif( isset($option['type']) && $option['type'] === 'faq') $this->field_faq( $option );
396
- elseif( isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid( $option );
397
- elseif( isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html( $option );
398
- elseif( isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable( $option );
399
- elseif( isset($option['type']) && $option['type'] === 'media') $this->field_media( $option );
400
- elseif( isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url( $option );
401
 
402
- endforeach;
403
- endif;
404
- ?>
405
- </div>
406
  <?php
407
 
408
- $input_html = ob_get_clean();
409
-
410
- echo sprintf($field_template, $title, $input_html, $group_details);
411
-
412
 
413
- }
 
414
 
415
 
416
- public function field_media( $option ){
 
417
 
418
 
419
 
420
- $id = isset( $option['id'] ) ? $option['id'] : "";
421
- if(empty($id)) return;
422
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
423
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
424
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
425
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
426
- $title = isset( $option['title'] ) ? $option['title'] : "";
427
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
428
 
429
- $details = isset( $option['details'] ) ? $option['details'] : "";
430
 
431
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
432
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
433
 
434
- $default = isset( $option['default'] ) ? $option['default'] : '';
435
- $value = isset( $option['value'] ) ? $option['value'] : '';
436
- $value = !empty($value) ? $value : $default;
437
 
438
- $media_url = wp_get_attachment_url( $value );
439
- $media_type = get_post_mime_type( $value );
440
- $media_title = !empty($value) ? get_the_title( $value ) : __('Placeholder.jpg', $this->textdomain);
441
 
442
 
443
- $media_url = !empty($media_url) ? $media_url : $default;
444
- $media_url = !empty($media_url) ? $media_url : $placeholder;
445
- $media_basename = wp_basename($media_type);
446
 
447
- $field_name = !empty( $field_name ) ? $field_name : $id;
448
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
449
 
450
 
451
 
452
- ob_start();
453
- //wp_enqueue_media();
454
 
455
  ?>
456
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-wrapper
457
  field-media-wrapper-<?php echo $css_id; ?>">
458
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;word-break: break-all;">
459
- <?php
460
 
461
- //var_dump($media_type);
462
 
463
- if( "audio/mpeg" == $media_type ){
464
  ?>
465
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
466
- <div class="media-title"><?php echo $media_title; ?></div>
467
  <?php
468
- }elseif( "images/png" == $media_type ||
469
- "image/png" == $media_type ||
470
- "images/gif" == $media_type ||
471
- "image/gif" == $media_type ||
472
- "images/jpeg" == $media_type ||
473
- "image/jpeg" == $media_type ||
474
- "images/jpg" == $media_type ||
475
- "image/jpg" == $media_type ||
476
- "images/ico" == $media_type||
477
- "image/ico" == $media_type
478
- ){
 
479
  ?>
480
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
481
- <div class="media-title"><?php echo $media_title; ?></div>
482
  <?php
483
- }else {
484
  ?>
485
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
486
- <div class="media-title"><?php echo $media_title; ?></div>
487
 
488
  <?php
489
- }
490
- ?>
 
 
 
 
 
491
  </div>
492
- <input class="media-input-value" type="hidden" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
493
- <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
494
- <div placeholder="<?php echo $placeholder; ?>" class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear', $this->textdomain);?></div>
495
- <div class="error-mgs"></div>
496
- </div>
497
 
498
  <?php
499
 
500
 
501
- $input_html = ob_get_clean();
502
 
503
- echo sprintf($field_template, $title, $input_html, $details);
504
-
505
- }
506
 
507
 
508
 
509
 
510
- public function field_media_url( $option ){
 
511
 
512
 
513
 
514
- $id = isset( $option['id'] ) ? $option['id'] : "";
515
- if(empty($id)) return;
516
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
517
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
518
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
519
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
520
- $placeholder_img = isset( $option['placeholder_img'] ) ? $option['placeholder_img'] : "";
521
 
522
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
523
- $title = isset( $option['title'] ) ? $option['title'] : "";
524
- $details = isset( $option['details'] ) ? $option['details'] : "";
525
 
526
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
527
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
528
 
529
- $default = isset( $option['default'] ) ? $option['default'] : '';
530
- $value = isset( $option['value'] ) ? $option['value'] : '';
531
- $value = !empty($value) ? $value : $default;
532
 
533
- $media_url = $value;
534
- $media_type = get_post_mime_type( $value );
535
- $media_title= get_the_title( $value );
536
- $media_url = !empty($media_url) ? $media_url : '';
537
- $media_url = !empty($media_url) ? $media_url : $placeholder_img;
538
 
539
- $field_name = !empty( $field_name ) ? $field_name : $id;
540
- $field_name = !empty($parent) ? $parent.'['.$field_name.']' : $field_name;
541
 
542
 
543
- wp_enqueue_media();
544
- ob_start();
545
 
546
 
547
  ?>
548
- <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-url-wrapper
549
  field-media-wrapper-<?php echo $css_id; ?>">
550
- <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;">
551
- <?php
552
 
553
- if( "audio/mpeg" == $media_type ){
554
  ?>
555
- <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
556
 
557
  <?php
558
- }
559
- elseif( "images/png" == $media_type || "images/jpg" == $media_type || "images/jpeg" == $media_type ||
560
- "images/gif" == $media_type ||
561
- "images/ico" == $media_type){
 
562
  ?>
563
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
564
 
565
  <?php
566
- }
567
-
568
- else {
569
  ?>
570
- <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%"/>
571
 
572
  <?php
573
- }
574
- ?>
 
 
 
 
 
575
  </div>
576
- <input type="text" placeholder="<?php echo $placeholder; ?>" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
577
- <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain);?></div>
578
- <div class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear','post-grid');?></div>
579
- <div class="error-mgs"></div>
580
- </div>
581
 
582
  <?php
583
 
584
 
585
- $input_html = ob_get_clean();
586
-
587
- echo sprintf($field_template, $title, $input_html, $details);
588
 
589
- }
 
590
 
591
 
592
 
593
- public function field_repeatable( $option ){
 
594
 
595
- $id = isset( $option['id'] ) ? $option['id'] : "";
596
- if(empty($id)) return;
597
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
598
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
599
- $field_name = isset( $option['field_name'] ) ? $option['field_name'] : $id;
600
- $field_name = !empty( $parent ) ? $parent.'['.$field_name.']' : $field_name;
601
 
602
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
603
- $collapsible = isset( $option['collapsible'] ) ? $option['collapsible'] : true;
604
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
605
- $values = isset( $option['value'] ) ? $option['value'] : array();
606
- $fields = isset( $option['fields'] ) ? $option['fields'] : array();
607
- $title_field = isset( $option['title_field'] ) ? $option['title_field'] : '';
608
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
609
- $limit = isset( $option['limit'] ) ? $option['limit'] : '';
610
 
611
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
612
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
613
 
614
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
615
- $title = isset( $option['title'] ) ? $option['title'] : "";
616
- $details = isset( $option['details'] ) ? $option['details'] : "";
617
 
618
- $settings_tabs_field = new settings_tabs_field();
619
 
620
 
621
- ob_start();
622
  ?>
623
- <div class="item-wrap collapsible">
624
- <div class="header">
625
- <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
626
- <?php
627
- if($sortable):
 
 
 
 
628
  ?>
629
- <span class="sort" ><i class="fas fa-arrows-alt"></i></span>
 
630
  <?php
631
- endif;
632
- ?>
633
- <span class="title-text">#TIMEINDEX</span>
634
- </div>
635
- <?php
636
 
637
 
638
- if(!empty($fields)):
639
- foreach ($fields as $field):
640
 
641
- $fieldType = isset($field['type']) ? $field['type'] : '';
642
- $field['parent'] = $field_name.'[TIMEINDEX]';
643
 
644
 
645
- ?>
646
- <div class="item">
647
- <?php if($collapsible):?>
648
- <div class="content">
 
 
 
 
 
 
 
649
  <?php endif; ?>
650
 
651
- <?php
652
- $settings_tabs_field->generate_field($field);
653
- ?>
654
- <?php if($collapsible):?>
655
  </div>
656
- <?php endif; ?>
657
-
658
- </div>
659
  <?php
660
 
661
- endforeach;
662
- endif;
663
- ?>
664
- </div>
665
- <?php
666
 
667
- $fieldHtml = ob_get_clean();
668
 
669
- $fieldHtml = preg_replace("/[\r\n]+/", "\n", $fieldHtml);
670
- $fieldHtml = preg_replace("/\s+/", ' ', $fieldHtml);
671
 
672
 
673
- ob_start();
674
- ?>
675
 
676
 
677
- <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
678
  field-repeatable-wrapper-<?php echo $css_id; ?>">
679
- <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add','post-grid'); ?></div>
680
- <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
681
- <?php
682
- if(!empty($values)):
683
- $count = 1;
684
- foreach ($values as $index=>$val):
685
- $title_field_val = !empty($val[$title_field]) ? $val[$title_field] : '#'.$count;
686
 
687
- //var_dump($index);
688
 
689
- ?>
690
- <div class="item-wrap <?php if($collapsible) echo 'collapsible'; ?>" index="<?php echo $index; ?>">
691
- <?php if($collapsible):?>
692
- <div class="header">
693
- <?php endif; ?>
694
- <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
695
- <?php if($sortable):?>
696
- <span class="sort"><i class="fas fa-arrows-alt"></i></span>
 
 
 
 
 
697
  <?php endif; ?>
698
-
699
- <span class="title-text"><?php echo $title_field_val; ?></span>
700
- <?php if($collapsible):?>
701
- </div>
702
- <?php endif; ?>
703
- <?php
704
 
705
 
706
 
707
- foreach ($fields as $field_index => $field):
708
- $fieldId = $field['id'];
709
- $field_css_id = isset($field['css_id']) ? str_replace('TIMEINDEX', $index, $field['css_id']) : '';
710
 
711
- //var_dump($field_css_id);
712
 
713
- $title_field_class = ($title_field == $field_index) ? 'title-field':'';
714
  ?>
715
- <div class="item <?php echo $title_field_class; ?>">
716
- <?php if($collapsible):?>
717
- <div class="content">
718
- <?php endif; ?>
719
 
720
- <?php
721
- $field['parent'] = $field_name.'['.$index.']';
722
- $field['css_id'] = $field_css_id;
723
 
724
- $field['value'] = isset($val[$fieldId]) ? $val[$fieldId] : '';
725
 
726
- $settings_tabs_field->generate_field($field);
727
 
728
 
729
- if($collapsible):?>
 
 
730
  </div>
731
- <?php endif; ?>
732
- </div>
733
- <?php
734
 
735
- endforeach; ?>
736
- </div>
737
  <?php
738
- $count++;
739
- endforeach;
740
- else:
 
 
 
741
  ?>
742
- <?php
743
- endif;
744
- ?>
745
  </div>
746
- <div class="error-mgs"></div>
747
- </div>
748
 
749
  <?php
750
 
751
- $input_html = ob_get_clean();
752
 
753
- echo sprintf($field_template, $title, $input_html, $details);
754
-
755
-
756
-
757
- }
758
 
759
 
760
 
@@ -763,1071 +762,1068 @@ class settings_tabs_field{
763
 
764
 
765
 
766
- public function field_select( $option ){
 
767
 
768
- $id = isset( $option['id'] ) ? $option['id'] : "";
769
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
770
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
771
- $args = isset( $option['args'] ) ? $option['args'] : array();
772
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
773
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : false;
774
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
775
 
776
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
777
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
778
 
779
 
780
- $title = isset( $option['title'] ) ? $option['title'] : "";
781
- $details = isset( $option['details'] ) ? $option['details'] : "";
782
 
783
- if($is_pro == true){
784
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
785
- }
786
 
787
 
788
- if($multiple){
789
- $value = isset( $option['value'] ) ? $option['value'] : array();
790
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
791
- $default = isset( $option['default'] ) ? $option['default'] : array();
792
- }else{
793
- $value = isset( $option['value'] ) ? $option['value'] : '';
794
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
795
- $default = isset( $option['default'] ) ? $option['default'] : '';
796
- }
797
 
798
 
799
- $value = !empty($value) ? $value : $default;
800
 
801
 
802
 
803
 
804
- ob_start();
805
  ?>
806
 
807
- <select <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
808
- <?php
809
- foreach( $args as $key => $name ):
810
- if($multiple){
811
- $selected = in_array($key, $value) ? "selected" : "";
812
- }else{
813
- $selected = $value == $key ? "selected" : "";
814
- }
815
 
816
 
817
  ?>
818
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
 
 
 
 
819
  <?php
820
- endforeach;
821
  ?>
822
- </select>
823
- <?php
824
- if($multiple):
825
  ?>
826
- <div class="button select-reset">Reset</div><br>
827
- <?php
828
- endif;
829
- ?>
830
 
831
  <?php
832
 
833
- $input_html = ob_get_clean();
834
-
835
- echo sprintf($field_template, $title, $input_html, $details);
836
-
837
 
838
- }
 
839
 
840
- public function field_select2( $option ){
 
841
 
842
- $id = isset( $option['id'] ) ? $option['id'] : "";
843
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
844
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
845
- $args = isset( $option['args'] ) ? $option['args'] : array();
846
- $multiple = isset( $option['multiple'] ) ? $option['multiple'] : "";
847
- $attributes = isset( $option['attributes'] ) ? $option['attributes'] : array();
848
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
849
 
850
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
851
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
852
 
853
 
854
- //var_dump($css_id);
855
 
856
- if($multiple){
857
- $value = isset( $option['value'] ) ? $option['value'] : array();
858
- $field_name = !empty($parent) ? $parent.'['.$id.'][]' : $id.'[]';
859
- $default = isset( $option['default'] ) ? $option['default'] : array();
860
- }else{
861
- $value = isset( $option['value'] ) ? $option['value'] : '';
862
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
863
- $default = isset( $option['default'] ) ? $option['default'] : '';
864
- }
865
 
866
- $value = !empty($value) ? $value : $default;
867
 
868
- //$value = get_post_meta( $post_id, $id, true );
869
- $title = isset( $option['title'] ) ? $option['title'] : "";
870
- $details = isset( $option['details'] ) ? $option['details'] : "";
871
 
872
- $attributes_html = '';
873
 
874
- foreach ($attributes as $attributeId=>$attribute):
875
 
876
- $attributes_html = $attributeId.'='.$attribute.' ';
877
 
878
- endforeach;
879
 
880
 
881
- ob_start();
882
  ?>
883
- <select <?php echo $attributes_html; ?> class="select2" <?php if($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
884
- <?php
885
- foreach( $args as $key => $name ):
886
 
887
- if($multiple){
888
- $selected = in_array($key, $value) ? "selected" : "";
889
- }else{
890
- $selected = ($key == $value) ? "selected" : "";
891
- }
892
 
893
  ?>
894
- <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
895
- <?php
896
- endforeach;
897
- ?>
898
- </select>
899
  <?php
900
 
901
- $input_html = ob_get_clean();
902
 
903
- echo sprintf($field_template, $title, $input_html, $details);
 
904
 
905
 
906
 
907
 
908
 
909
- }
 
910
 
 
 
 
 
911
 
 
 
912
 
 
913
 
 
 
 
914
 
915
- public function field_text_multi( $option ){
916
 
917
- $id = isset( $option['id'] ) ? $option['id'] : "";
918
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
919
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
920
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
921
 
922
- $default = isset( $option['default'] ) ? $option['default'] : array();
923
- $values = isset( $option['value'] ) ? $option['value'] : $default;
924
 
925
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
 
926
 
927
- $remove_text = isset( $option['remove_text'] ) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
928
- $sortable = isset( $option['sortable'] ) ? $option['sortable'] : true;
929
- $allow_clone = isset( $option['allow_clone'] ) ? $option['allow_clone'] : false;
930
 
 
931
 
932
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
933
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
934
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
 
936
- $title = isset( $option['title'] ) ? $option['title'] : "";
937
- $details = isset( $option['details'] ) ? $option['details'] : "";
938
 
939
- if($is_pro == true){
940
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
941
- }
942
 
943
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
 
 
944
 
 
945
 
946
- ob_start();
947
- ?>
948
- <div id="input-wrapper-<?php echo $id; ?>" class="input-wrapper input-text-multi-wrapper
949
- input-text-multi-wrapper-<?php echo $css_id; ?>">
950
- <span data-placeholder="<?php echo esc_attr($placeholder); ?>" data-sort="<?php echo $sortable; ?>" data-clone="<?php echo $allow_clone; ?>" data-name="<?php echo $field_name; ?>[]" class="button add-item"><?php echo __('Add', $this->textdomain); ?></span>
951
- <div class="field-list <?php if($sortable){ echo 'sortable'; }?>" id="<?php echo $css_id; ?>">
952
- <?php
953
- if(!empty($values)):
954
- foreach ($values as $value):
955
  ?>
956
  <div class="item">
957
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
958
- echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
959
 
960
- <?php if($allow_clone):?>
961
  <span class="button clone"><i class="far fa-clone"></i></span>
962
  <?php endif; ?>
963
 
964
 
965
- <?php if($sortable):?>
966
  <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
967
  <?php endif; ?>
968
 
969
  <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
970
  </div>
971
  <?php
972
- endforeach;
973
-
974
- else:
975
 
 
976
  ?>
977
- <div class="item">
978
- <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
979
- echo esc_attr($placeholder); ?>" value="" />
980
-
981
- <?php if($allow_clone):?>
982
- <span class="button clone"><i class="far fa-clone"></i></span>
983
- <?php endif; ?>
984
-
985
-
986
- <?php if($sortable):?>
987
- <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
988
- <?php endif; ?>
989
 
990
- <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
991
- </div>
992
- <?php
993
 
994
- endif;
995
- ?>
996
  </div>
997
- <div class="error-mgs"></div>
998
-
999
-
1000
- </div>
1001
 
1002
  <?php
1003
 
1004
- $input_html = ob_get_clean();
1005
-
1006
- echo sprintf($field_template, $title, $input_html, $details);
1007
 
1008
- }
 
1009
 
1010
- public function field_hidden( $option ){
 
1011
 
1012
- $id = isset( $option['id'] ) ? $option['id'] : "";
1013
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1014
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1015
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1016
- $value = isset( $option['value'] ) ? $option['value'] : '';
1017
- $default = isset( $option['default'] ) ? $option['default'] : '';
1018
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1019
 
1020
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1021
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1022
 
1023
- $value = !empty($value) ? $value : $default;
1024
 
1025
- $title = isset( $option['title'] ) ? $option['title'] : "";
1026
- $details = isset( $option['details'] ) ? $option['details'] : "";
1027
 
1028
- if($is_pro == true){
1029
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1030
- }
1031
 
1032
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1033
 
1034
 
1035
- ob_start();
1036
  ?>
1037
- <input type="hidden" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
1038
  <?php
1039
 
1040
- $input_html = ob_get_clean();
1041
-
1042
- echo sprintf($field_template, $title, $input_html, $details);
1043
 
1044
- }
 
1045
 
1046
 
1047
- public function field_text( $option ){
 
1048
 
1049
- $id = isset( $option['id'] ) ? $option['id'] : "";
1050
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1051
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1052
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1053
- $value = isset( $option['value'] ) ? $option['value'] : '';
1054
- $default = isset( $option['default'] ) ? $option['default'] : '';
1055
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1056
 
1057
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1058
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1059
 
1060
- $value = !empty($value) ? $value : $default;
1061
 
1062
- $title = isset( $option['title'] ) ? $option['title'] : "";
1063
- $details = isset( $option['details'] ) ? $option['details'] : "";
1064
 
1065
- if($is_pro == true){
1066
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1067
- }
1068
 
1069
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1070
 
1071
 
1072
- ob_start();
1073
  ?>
1074
- <input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
1075
  <?php
1076
 
1077
- $input_html = ob_get_clean();
1078
 
1079
- echo sprintf($field_template, $title, $input_html, $details);
1080
-
1081
- }
1082
 
1083
 
1084
 
1085
- public function field_wp_editor( $option ){
 
1086
 
1087
- $id = isset( $option['id'] ) ? $option['id'] : "";
1088
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1089
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1090
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1091
- $value = isset( $option['value'] ) ? $option['value'] : '';
1092
- $default = isset( $option['default'] ) ? $option['default'] : '';
1093
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1094
 
1095
 
1096
 
1097
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1098
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1099
 
1100
- $value = !empty($value) ? $value : $default;
1101
 
1102
- $title = isset( $option['title'] ) ? $option['title'] : "";
1103
- $details = isset( $option['details'] ) ? $option['details'] : "";
1104
 
1105
- if($is_pro == true){
1106
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1107
- }
1108
 
1109
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1110
 
1111
- $editor_settings= isset( $option['editor_settings'] ) ? $option['editor_settings'] : array('textarea_name'=>$field_name, 'teeny' => true, 'textarea_rows' => 15, );
1112
 
1113
- ob_start();
1114
 
1115
  ?>
1116
- <div id="field-wrapper-<?php echo $id; ?>" class="<?php if(!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1117
  field-wp_editor-wrapper-<?php echo $id; ?>">
1118
- <?php
1119
- wp_editor( $value, $css_id, $editor_settings);
1120
- ?>
1121
- <div class="error-mgs"></div>
1122
- </div>
1123
 
1124
  <?php
1125
 
1126
 
1127
 
1128
 
1129
- $input_html = ob_get_clean();
1130
-
1131
- echo sprintf($field_template, $title, $input_html, $details);
1132
 
1133
- }
 
1134
 
1135
 
1136
 
1137
 
1138
 
1139
 
1140
- public function field_text_icon( $option ){
 
1141
 
1142
- $id = isset( $option['id'] ) ? $option['id'] : "";
1143
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1144
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1145
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1146
- $value = isset( $option['value'] ) ? $option['value'] : '';
1147
- $default = isset( $option['default'] ) ? $option['default'] : '';
1148
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1149
 
1150
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1151
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1152
 
1153
- $title = isset( $option['title'] ) ? $option['title'] : "";
1154
- $details = isset( $option['details'] ) ? $option['details'] : "";
1155
 
1156
- $option_value = empty($value) ? $default : $value;
1157
 
1158
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1159
 
1160
 
1161
 
1162
 
1163
- ob_start();
1164
  ?>
1165
- <div class="text-icon">
1166
- <span class="icon"><?php echo $option_value; ?></span><input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($option_value); ?>" />
1167
- </div>
1168
- <style >
1169
- .text-icon{}
1170
- .text-icon .icon{
1171
- /* width: 30px; */
1172
- background: #ddd;
1173
- /* height: 28px; */
1174
- display: inline-block;
1175
- vertical-align: top;
1176
- text-align: center;
1177
- font-size: 14px;
1178
- padding: 5px 10px;
1179
- line-height: normal;
1180
- }
1181
- </style>
1182
- <script>
1183
- jQuery(document).ready(function($){
1184
- $(document).on("keyup", ".text-icon input", function () {
1185
- val = $(this).val();
1186
- if(val){
1187
- $(this).parent().children(".icon").html(val);
1188
- }
 
 
1189
  })
1190
- })
1191
- </script>
1192
  <?php
1193
 
1194
- $input_html = ob_get_clean();
1195
 
1196
- echo sprintf($field_template, $title, $input_html, $details);
1197
-
1198
- }
1199
 
1200
 
1201
 
1202
- public function field_range( $option ){
 
1203
 
1204
- $id = isset( $option['id'] ) ? $option['id'] : "";
1205
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1206
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1207
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1208
 
1209
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1210
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1211
 
1212
- $value = isset( $option['value'] ) ? $option['value'] : '';
1213
- $default = isset( $option['default'] ) ? $option['default'] : '';
1214
- $value = !empty($value) ? $value : $default;
1215
 
1216
- $args = isset( $option['args'] ) ? $option['args'] : "";
1217
 
1218
- $min = isset($args['min']) ? $args['min'] : '';
1219
- $max = isset($args['max']) ? $args['max'] : '';
1220
- $step = isset($args['step']) ? $args['step'] : '';
1221
 
1222
- $title = isset( $option['title'] ) ? $option['title'] : "";
1223
- $details = isset( $option['details'] ) ? $option['details'] : "";
1224
 
1225
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1226
 
1227
 
1228
- ob_start();
1229
  ?>
1230
- <div class="range-input">
1231
- <span class="range-value"><?php echo $value; ?></span><input type="range" min="<?php if($min) echo $min; ?>" max="<?php if($max) echo $max; ?>" step="<?php if($step) echo $step; ?>" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
1232
- </div>
1233
-
1234
- <script>
1235
- jQuery(document).ready(function($){
1236
- $(document).on("change", "#<?php echo $css_id; ?>", function () {
1237
- val = $(this).val();
1238
- if(val){
1239
- $(this).parent().children(".range-value").html(val);
1240
- }
 
1241
  })
1242
- })
1243
- </script>
1244
-
1245
- <style >
1246
- .range-input{}
1247
- .range-input .range-value{
1248
- display: inline-block;
1249
- vertical-align: top;
1250
- margin: 0 0;
1251
- padding: 4px 10px;
1252
- background: #eee;
1253
- }
1254
- </style>
1255
  <?php
1256
 
1257
- $input_html = ob_get_clean();
1258
- echo sprintf($field_template, $title, $input_html, $details);
1259
- }
1260
 
1261
 
1262
 
1263
- public function field_textarea( $option ){
 
1264
 
1265
- $id = isset( $option['id'] ) ? $option['id'] : "";
1266
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1267
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1268
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1269
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1270
- $value = isset( $option['value'] ) ? $option['value'] : '';
1271
- $default = isset( $option['default'] ) ? $option['default'] : '';
1272
- $value = !empty($value) ? $value : $default;
1273
 
1274
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1275
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1276
 
1277
- $title = isset( $option['title'] ) ? $option['title'] : "";
1278
- $details = isset( $option['details'] ) ? $option['details'] : "";
1279
 
1280
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1281
 
1282
- if($is_pro == true){
1283
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1284
- }
1285
 
1286
 
1287
- ob_start();
1288
  ?>
1289
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1290
  <?php
1291
 
1292
- $input_html = ob_get_clean();
1293
 
1294
- echo sprintf($field_template, $title, $input_html, $details);
1295
-
1296
- }
1297
 
1298
 
1299
 
1300
- public function field_textarea_editor( $option ){
 
1301
 
1302
- $id = isset( $option['id'] ) ? $option['id'] : "";
1303
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1304
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1305
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1306
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1307
- $value = isset( $option['value'] ) ? $option['value'] : '';
1308
- $default = isset( $option['default'] ) ? $option['default'] : '';
1309
- $value = !empty($value) ? $value : $default;
1310
 
1311
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1312
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1313
 
1314
- $title = isset( $option['title'] ) ? $option['title'] : "";
1315
- $details = isset( $option['details'] ) ? $option['details'] : "";
1316
 
1317
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1318
 
1319
- if($is_pro == true){
1320
- $details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
1321
- }
1322
 
1323
 
1324
- ob_start();
1325
  ?>
1326
- <textarea editor_enabled="no" class="textarea-editor" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1327
  <?php
1328
 
1329
- $input_html = ob_get_clean();
1330
-
1331
- echo sprintf($field_template, $title, $input_html, $details);
1332
 
1333
- }
 
1334
 
1335
 
1336
 
1337
- public function field_scripts_js( $option ){
 
1338
 
1339
- $id = isset( $option['id'] ) ? $option['id'] : "";
1340
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1341
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1342
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1343
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1344
- $value = isset( $option['value'] ) ? $option['value'] : '';
1345
- $default = isset( $option['default'] ) ? $option['default'] : '';
1346
- $value = !empty($value) ? $value : $default;
1347
 
1348
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1349
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1350
 
1351
- $title = isset( $option['title'] ) ? $option['title'] : "";
1352
- $details = isset( $option['details'] ) ? $option['details'] : "";
1353
 
1354
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1355
 
1356
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/javascript' ) );
1357
- $code_editor = wp_json_encode( $settings );
1358
 
1359
 
1360
- ob_start();
1361
  ?>
1362
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1363
 
1364
- <script>
1365
- jQuery(document).ready(function($){
1366
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1367
- })
1368
- </script>
1369
  <?php
1370
 
1371
- $input_html = ob_get_clean();
1372
-
1373
- echo sprintf($field_template, $title, $input_html, $details);
1374
-
1375
-
1376
 
1377
-
1378
- }
1379
 
1380
 
1381
- public function field_scripts_css( $option ){
 
1382
 
1383
- $id = isset( $option['id'] ) ? $option['id'] : "";
1384
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1385
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1386
 
1387
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1388
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1389
- $value = isset( $option['value'] ) ? $option['value'] : '';
1390
- $default = isset( $option['default'] ) ? $option['default'] : '';
1391
- $value = !empty($value) ? $value : $default;
1392
 
1393
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1394
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1395
 
1396
- $title = isset( $option['title'] ) ? $option['title'] : "";
1397
- $details = isset( $option['details'] ) ? $option['details'] : "";
1398
 
1399
- $settings = wp_enqueue_code_editor( array( 'type' => 'text/css' ) );
1400
- $code_editor = wp_json_encode( $settings );
1401
 
1402
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1403
  ?>
1404
 
1405
- <?php
1406
-
1407
- ob_start();
1408
- ?>
1409
- <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1410
- <script>
1411
-
1412
-
1413
- jQuery(document).ready(function($){
1414
-
1415
- wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1416
-
1417
-
1418
- })
1419
 
 
 
 
 
 
1420
 
 
1421
 
1422
 
1423
- </script>
 
1424
  <?php
1425
 
1426
- $input_html = ob_get_clean();
1427
-
1428
- echo sprintf($field_template, $title, $input_html, $details);
1429
 
1430
- }
 
1431
 
1432
 
1433
 
1434
 
1435
 
1436
- public function field_checkbox( $option ){
 
1437
 
1438
- $id = isset( $option['id'] ) ? $option['id'] : "";
1439
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1440
- $title = isset( $option['title'] ) ? $option['title'] : "";
1441
- $details = isset( $option['details'] ) ? $option['details'] : "";
1442
- $for = isset( $option['for'] ) ? $option['for'] : "";
1443
- $args = isset( $option['args'] ) ? $option['args'] : array();
1444
 
1445
- $style = isset( $option['style'] ) ? $option['style'] : array();
1446
- $style_inline = isset( $style['inline'] ) ? $style['inline'] : true;
1447
 
1448
 
1449
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1450
- $default = isset( $option['default'] ) ? $option['default'] : '';
1451
- $option_value = !empty($option_value) ? $option_value : $default;
1452
 
1453
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1454
 
1455
 
1456
 
1457
  ?>
1458
- <div class="setting-field">
1459
- <div class="field-lable"><?php if(!empty($title)) echo $title; ?></div>
1460
- <div class="field-input">
1461
- <?php
1462
 
1463
 
1464
 
1465
- if(!empty($args))
1466
- foreach( $args as $key => $value ):
1467
 
1468
 
1469
- //$checked = ( $key == $option_value ) ? "checked" : "";
1470
- $checked = in_array($key, $option_value) ? "checked" : "";
1471
 
1472
- $for = !empty($for) ? $for.'-'.$id."-".$key : $id."-".$key;
1473
 
1474
 
1475
- ?>
1476
- <label for='<?php echo $for;?>'><input name='<?php echo $field_name; ?>[]' type='checkbox' id='<?php echo $for; ?>' value='<?php echo $key;?>' <?php echo $checked;?>><span><?php echo $value;?></span></label>
1477
 
1478
  <?php
1479
 
1480
- if(!$style_inline){
1481
- ?>
1482
  <br>
1483
- <?php
1484
- }
1485
 
1486
- endforeach;
1487
 
1488
- ?>
1489
- <p class="description"><?php if(!empty($details)) echo $details; ?></p>
 
1490
  </div>
1491
- </div>
1492
- <?php
1493
-
1494
-
1495
- }
1496
 
1497
 
 
1498
 
1499
- public function field_radio( $option ){
1500
 
1501
- $id = isset( $option['id'] ) ? $option['id'] : "";
1502
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1503
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1504
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1505
- $title = isset( $option['title'] ) ? $option['title'] : "";
1506
- $details = isset( $option['details'] ) ? $option['details'] : "";
1507
- $for = isset( $option['for'] ) ? $option['for'] : "";
1508
- $args = isset( $option['args'] ) ? $option['args'] : array();
1509
 
1510
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1511
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1512
 
1513
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1514
- $default = isset( $option['default'] ) ? $option['default'] : '';
1515
- $option_value = !empty($option_value) ? $option_value : $default;
 
 
 
 
 
1516
 
1517
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
1518
 
 
 
 
1519
 
1520
- ob_start();
1521
 
1522
- if(!empty($args))
1523
- foreach( $args as $key => $value ):
1524
- $checked = ( $key == $option_value ) ? "checked" : "";
1525
- $for = !empty($for) ? $for.'-'.$css_id."-".$key : $css_id."-".$key;
1526
- ?>
1527
- <label for="<?php echo $for;?>"><input name="<?php echo $field_name; ?>" type="radio" id="<?php echo $for; ?>" value="<?php echo $key;?>" <?php echo $checked;?>><span><?php echo $value;?></span></label>
1528
 
1529
- <?php
1530
- endforeach;
1531
 
1532
- $input_html = ob_get_clean();
 
 
 
 
 
1533
 
1534
- echo sprintf($field_template, $title, $input_html, $details);
 
1535
 
 
1536
 
1537
- }
 
1538
 
1539
 
1540
 
1541
- public function field_radio_image( $option ){
 
1542
 
1543
- $id = isset( $option['id'] ) ? $option['id'] : "";
1544
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1545
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1546
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1547
- $args = isset( $option['args'] ) ? $option['args'] : array();
1548
- //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1549
- $option_value = isset( $option['value'] ) ? $option['value'] : '';
1550
- $default = isset( $option['default'] ) ? $option['default'] : '';
1551
- $lazy_load_img = isset( $option['lazy_load_img'] ) ? $option['lazy_load_img'] : '';
1552
 
1553
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1554
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1555
 
1556
- $title = isset( $option['title'] ) ? $option['title'] : "";
1557
- $details = isset( $option['details'] ) ? $option['details'] : "";
1558
- $width = isset( $option['width'] ) ? $option['width'] : "250px";
1559
 
1560
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1561
 
1562
- //var_dump($option_value);
1563
 
1564
- $option_value = empty($option_value) ? $default : $option_value;
1565
 
1566
 
1567
 
1568
- ob_start();
1569
- ?>
1570
- <div class="radio-img">
1571
- <?php
1572
- foreach( $args as $key => $value ):
1573
 
1574
- $name = $value['name'];
1575
- $thumb = $value['thumb'];
1576
- $disabled = isset($value['disabled']) ? $value['disabled'] : '';
1577
- $pro_msg = isset($value['pro_msg']) ? $value['pro_msg'] : '';
1578
- $link = isset($value['link']) ? $value['link'] : '';
1579
- $link_text = isset($value['link_text']) ? $value['link_text'] : 'Go';
1580
 
1581
- $checked = ($key == $option_value) ? "checked" : "";
1582
 
1583
- //var_dump($checked);
1584
 
1585
  ?>
1586
- <label style="width: <?php echo $width; ?>;" title="<?php echo $name; ?>" class="<?php if($checked =='checked') echo 'active';?> <?php if($disabled == true) echo 'disabled';?>">
1587
- <input <?php if($disabled) echo 'disabled'; ?> name="<?php echo $field_name; ?>" type="radio" id="<?php echo $css_id; ?>-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?>>
1588
 
1589
- <?php
1590
- if(!empty($thumb)):
1591
 
1592
  ?>
1593
- <img class="lazy" alt="<?php echo $name; ?>" data-src="<?php echo $thumb; ?>" src="<?php echo $lazy_load_img; ?>">
1594
- <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1595
 
1596
  <?php
1597
- else:
1598
- echo $name;
1599
- endif;
1600
- ?>
1601
 
1602
- <?php if($disabled == true):?>
1603
- <span class="pro-msg"><?php echo $pro_msg; ?></span>
1604
- <?php endif; ?>
1605
- <?php if(!empty($link)):?>
1606
- <a target="_blank" class="link" href="<?php echo $link; ?>"><?php echo $link_text; ?></a>
1607
- <?php endif; ?>
1608
 
1609
- </label>
1610
- <?php
1611
 
1612
- endforeach;
1613
- ?>
1614
- </div>
1615
-
1616
- <style >
1617
- .radio-img{}
1618
- .radio-img label{
1619
- display: inline-block;
1620
- vertical-align: top;
1621
- margin: 5px;
1622
- padding: 2px;
1623
- background: #eee;
1624
- position: relative;
1625
- }
1626
 
1627
- .radio-img label.active{
1628
- background: #fd730d;
1629
- }
1630
 
1631
- .radio-img label.disabled{
1632
- background: #e2e2e2;
 
 
 
 
 
 
1633
 
1634
- }
1635
- .radio-img label.disabled img{
1636
- background: #e2e2e2;
1637
- opacity: .3;
1638
- }
1639
 
1640
- .radio-img label.disabled .pro-msg{
1641
- background: #ffd87f;
1642
- position: absolute;
1643
- top: 50%;
1644
- left: 50%;
1645
- transform: translate(-50%,-50%);
1646
- padding: 0 10px;
1647
 
1648
- }
1649
 
1650
- .radio-img label .link{
1651
- background: hsl(200, 7%, 42%);
1652
- position: absolute;
1653
- top: 2px;
1654
- /* transform: translate(0%,-50%); */
1655
- padding: 3px 14px;
1656
- text-decoration: none;
1657
- font-size: 14px;
1658
- color: #fff;
1659
- right: 2px;
1660
 
1661
- }
 
 
 
 
 
 
1662
 
 
1663
 
1664
- .radio-img input[type=radio]{
1665
- display: none;
1666
- }
1667
- .radio-img img{
 
 
 
 
 
 
1668
 
1669
- vertical-align: top;
1670
- width: 100%;
1671
- }
1672
 
1673
- </style>
1674
- <?php
1675
 
1676
- $input_html = ob_get_clean();
 
 
 
 
1677
 
1678
- echo sprintf($field_template, $title, $input_html, $details);
 
 
 
 
1679
 
 
1680
 
1681
- }
 
1682
 
1683
- public function field_datepicker( $option ){
 
1684
 
1685
- $id = isset( $option['id'] ) ? $option['id'] : "";
1686
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1687
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1688
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1689
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1690
- $format = isset( $option['format'] ) ? $option['format'] : "";
1691
 
1692
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1693
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1694
 
1695
- $value = isset( $option['value'] ) ? $option['value'] : '';
1696
- $default = isset( $option['default'] ) ? $option['default'] : '';
1697
- $value = !empty($value) ? $value : $default;
1698
 
1699
- $title = isset( $option['title'] ) ? $option['title'] : "";
1700
- $details = isset( $option['details'] ) ? $option['details'] : "";
1701
 
1702
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1703
 
1704
 
1705
- wp_enqueue_script('jquery-ui-datepicker');
1706
- wp_enqueue_style( 'jquery-ui');
1707
 
1708
- ob_start();
1709
  ?>
1710
- <input type="text" autocomplete="off" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo $value; ?>" />
1711
- <script>jQuery(document).ready(function($) { $("#<?php echo $css_id; ?>").datepicker({ dateFormat: "<?php echo $format; ?>" });});</script>
 
 
 
 
 
 
1712
  <?php
1713
 
1714
- $input_html = ob_get_clean();
1715
 
1716
- echo sprintf($field_template, $title, $input_html, $details);
1717
- }
1718
 
1719
 
1720
 
1721
- public function field_colorpicker( $option ){
 
1722
 
1723
- $id = isset( $option['id'] ) ? $option['id'] : "";
1724
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1725
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1726
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1727
- $placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
1728
 
1729
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1730
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1731
 
1732
- $value = isset( $option['value'] ) ? $option['value'] : '';
1733
- $default = isset( $option['default'] ) ? $option['default'] : '';
1734
- $value = !empty($value) ? $value : $default;
1735
 
1736
- $title = isset( $option['title'] ) ? $option['title'] : "";
1737
- $details = isset( $option['details'] ) ? $option['details'] : "";
1738
 
1739
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1740
 
1741
- ob_start();
1742
  ?>
1743
- <input colorPicker="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1744
- <?php
1745
-
1746
- $input_html = ob_get_clean();
1747
-
1748
- echo sprintf($field_template, $title, $input_html, $details);
1749
- }
1750
-
1751
-
1752
- public function field_colorpicker_multi( $option ){
1753
-
1754
- $id = isset( $option['id'] ) ? $option['id'] : "";
1755
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1756
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1757
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1758
- $args = isset( $option['args'] ) ? $option['args'] : "";
1759
-
1760
 
1761
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1762
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1763
 
1764
- $value = isset( $option['value'] ) ? $option['value'] : '';
1765
- $default = isset( $option['default'] ) ? $option['default'] : '';
1766
- $value = !empty($value) ? $value : $default;
1767
 
1768
- $title = isset( $option['title'] ) ? $option['title'] : "";
1769
- $details = isset( $option['details'] ) ? $option['details'] : "";
1770
 
1771
- $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
 
1772
 
 
 
 
 
 
1773
 
1774
 
1775
- //echo '<pre>'.var_export($args, true).'</pre>';
 
1776
 
1777
- ob_start();
 
 
1778
 
1779
- if(!empty($args)):
 
1780
 
1781
- foreach ($args as $arg_key => $arg):
1782
 
1783
- $item_value = isset($value[$arg_key]) ? $value[$arg_key] : $arg;
1784
 
1785
 
1786
- ?>
1787
- <div class="">
1788
- <span><?php echo $arg_key; ?></span>
1789
- <input name="<?php echo $field_name; ?>[<?php echo $arg_key; ?>]" id="<?php echo $arg_key.'-'.$css_id; ?>" value="<?php echo $item_value; ?>" />
1790
- <script>jQuery(document).ready(function($) { $("#<?php echo $arg_key.'-'.$css_id; ?>").wpColorPicker();});</script>
1791
- </div>
1792
 
1793
- <?php
1794
- endforeach;
1795
 
1796
- endif;
1797
 
 
1798
 
1799
- $input_html = ob_get_clean();
1800
-
1801
- echo sprintf($field_template, $title, $input_html, $details);
1802
- }
1803
 
1804
 
 
 
 
 
 
 
 
 
 
 
1805
 
1806
- public function field_custom_html( $option ){
 
1807
 
1808
- $id = isset( $option['id'] ) ? $option['id'] : "";
1809
- $css_id = isset( $option['css_id'] ) ? $option['css_id'] : $id;
1810
- $parent = isset( $option['parent'] ) ? $option['parent'] : "";
1811
- $field_template = isset( $option['field_template'] ) ? $option['field_template'] : $this->field_template($option);
1812
- $html = isset( $option['html'] ) ? $option['html'] : "";
1813
 
1814
- $is_pro = isset( $option['is_pro'] ) ? $option['is_pro'] : false;
1815
- $pro_text = isset( $option['pro_text'] ) ? $option['pro_text'] : '';
1816
 
1817
- $title = isset( $option['title'] ) ? $option['title'] : "";
1818
- $details = isset( $option['details'] ) ? $option['details'] : "";
1819
 
 
 
1820
 
1821
- echo sprintf($field_template, $title, $html, $details);
1822
 
1823
 
 
 
1824
 
 
 
 
 
 
1825
 
 
 
1826
 
 
 
1827
 
1828
 
 
 
1829
  }
1830
-
1831
-
1832
-
1833
- }}
1
  <?php
2
+ if (!defined('ABSPATH')) exit; // if direct access
3
 
4
+ if (!class_exists('settings_tabs_field')) {
5
+ class settings_tabs_field
6
+ {
7
 
8
+ //public $asset_dir_url = '';
9
+ public $textdomain = 'settings-tabs';
10
 
11
+ public function __construct()
12
+ {
13
 
14
+ // $this->asset_dir_url = isset($args['asset_dir_url']) ? $args['asset_dir_url'] : '';
15
+ // $this->textdomain = isset($args['textdomain']) ? $args['textdomain'] : '';
16
 
17
+ }
18
 
19
 
20
+ function admin_scripts()
21
+ {
22
 
23
 
24
+ wp_enqueue_script('jquery');
25
+ wp_enqueue_script('jquery-ui-sortable');
26
+ wp_enqueue_script('jquery-ui-core');
27
+ wp_enqueue_script('jquery-ui-accordion');
28
+ wp_enqueue_style('jquery-ui');
29
+ wp_enqueue_script('jquery-ui-tabs');
30
 
31
+ wp_enqueue_script('wp-color-picker');
32
+ wp_enqueue_style('wp-color-picker');
33
 
34
 
35
+ wp_enqueue_style('font-awesome-5');
36
 
37
+ wp_enqueue_style('settings-tabs');
38
+ wp_enqueue_script('settings-tabs');
39
 
40
+ wp_enqueue_script('code-editor');
41
+ wp_enqueue_style('code-editor');
42
 
43
+ wp_enqueue_script('jquery.lazy');
44
 
45
+ if (function_exists('wp_enqueue_editor')) {
46
+ wp_enqueue_editor();
47
+ }
48
  }
49
 
50
+ function field_template($option)
51
+ {
52
 
53
+ $id = isset($option['id']) ? $option['id'] : "";
54
+ $wraper_class = isset($option['wraper_class']) ? $option['wraper_class'] : "";
55
+ $conditions = isset($option['conditions']) ? $option['conditions'] : array();
 
 
 
 
56
 
57
+ $is_error = isset($option['is_error']) ? $option['is_error'] : false;
58
+ $error_details = isset($option['error_details']) ? $option['error_details'] : '';
59
 
60
 
61
 
62
+ if (!empty($conditions)) :
63
 
64
+ $depends = '';
65
 
66
+ $field = isset($conditions['field']) ? $conditions['field'] : '';
67
+ $cond_value = isset($conditions['value']) ? $conditions['value'] : '';
68
+ $type = isset($conditions['type']) ? $conditions['type'] : '';
69
+ $pattern = isset($conditions['pattern']) ? $conditions['pattern'] : '';
70
+ $modifier = isset($conditions['modifier']) ? $conditions['modifier'] : '';
71
+ $like = isset($conditions['like']) ? $conditions['like'] : '';
72
+ $strict = isset($conditions['strict']) ? $conditions['strict'] : '';
73
+ $empty = isset($conditions['empty']) ? $conditions['empty'] : '';
74
+ $sign = isset($conditions['sign']) ? $conditions['sign'] : '';
75
+ $min = isset($conditions['min']) ? $conditions['min'] : '';
76
+ $max = isset($conditions['max']) ? $conditions['max'] : '';
77
 
78
+ $depends .= "{'[name=$field]':";
79
+ $depends .= '{';
80
 
81
+ if (!empty($type)) :
82
+ $depends .= "'type':";
83
+ $depends .= "'" . $type . "'";
84
+ endif;
85
 
86
+ if (!empty($modifier)) :
87
+ $depends .= ",'modifier':";
88
+ $depends .= "'" . $modifier . "'";
89
+ endif;
90
 
91
+ if (!empty($like)) :
92
+ $depends .= ",'like':";
93
+ $depends .= "'" . $like . "'";
94
+ endif;
95
 
96
+ if (!empty($strict)) :
97
+ $depends .= ",'strict':";
98
+ $depends .= "'" . $strict . "'";
99
+ endif;
100
 
101
+ if (!empty($empty)) :
102
+ $depends .= ",'empty':";
103
+ $depends .= "'" . $empty . "'";
104
+ endif;
105
 
106
+ if (!empty($sign)) :
107
+ $depends .= ",'sign':";
108
+ $depends .= "'" . $sign . "'";
109
+ endif;
110
 
111
+ if (!empty($min)) :
112
+ $depends .= ",'min':";
113
+ $depends .= "'" . $min . "'";
114
+ endif;
115
 
116
+ if (!empty($max)) :
117
+ $depends .= ",'max':";
118
+ $depends .= "'" . $max . "'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  endif;
120
+ if (!empty($cond_value)) :
121
+ $depends .= ",'value':";
122
+ if (is_array($cond_value)) :
123
+ $count = count($cond_value);
124
+ $i = 1;
125
+ $depends .= "[";
126
+ foreach ($cond_value as $val) :
127
+ $depends .= "'" . $val . "'";
128
+ if ($i < $count)
129
+ $depends .= ",";
130
+ $i++;
131
+ endforeach;
132
+ $depends .= "]";
133
+ else :
134
+ $depends .= "[";
135
+ $depends .= "'" . $cond_value . "'";
136
+ $depends .= "]";
137
+ endif;
138
+ endif;
139
+ $depends .= '}}';
140
 
141
+ endif;
142
 
143
 
144
 
145
+ ob_start();
146
 
147
+ ?>
148
+ <div <?php if (!empty($depends)) { ?> data-depends="[<?php echo $depends; ?>]" <?php } ?> class="setting-field <?php if ($is_error) echo 'field-error'; ?> <?php echo $wraper_class; ?> <?php if (!empty($depends)) echo 'dependency-field'; ?>">
149
+ <div class="field-lable">%s</div>
150
+ <div class="field-input">%s
151
+ <p class="description">%s</p>
152
+ <?php if ($is_error && !empty($error_details)) : ?>
153
+ <p class="error-details"><i class="fas fa-exclamation-circle"></i> <?php echo $error_details; ?></p>
154
+ <?php endif; ?>
155
 
156
+ </div>
157
  </div>
 
158
  <?php
159
 
160
+ return ob_get_clean();
161
+ }
 
162
 
163
 
164
 
165
 
166
 
167
 
168
+ function generate_field($option)
169
+ {
170
 
171
+ $id = isset($option['id']) ? $option['id'] : "";
172
+ $type = isset($option['type']) ? $option['type'] : "";
173
+ $details = isset($option['details']) ? $option['details'] : "";
174
 
175
 
176
 
177
 
178
 
179
 
180
+ if (empty($id)) return;
181
 
182
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
183
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
184
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
185
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
186
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
187
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
188
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
189
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
190
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
191
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
192
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
193
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
194
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
195
 
196
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
197
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
198
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
199
 
200
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
201
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
202
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
203
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
204
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
205
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
206
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
207
 
208
+ elseif (isset($option['type']) && $option['type'] === 'option_group') $this->field_option_group($option);
209
+ elseif (isset($option['type']) && $option['type'] === 'option_group_accordion') $this->field_option_group_accordion($option);
210
+ elseif (isset($option['type']) && $option['type'] === 'wp_editor') $this->field_wp_editor($option);
211
+ elseif (isset($option['type']) && $option['type'] === 'textarea_editor') $this->field_textarea_editor($option);
212
 
213
 
214
 
215
+ elseif (isset($option['type']) && $option['type'] === $type) do_action("settings_tabs_field_$type", $option);
216
 
217
 
218
+ //if( !empty( $details ) ) echo "<p class='description'>$details</p>";
219
 
220
 
221
 
222
 
223
 
224
+ }
225
 
226
 
227
+ public function field_option_group_accordion($option)
228
+ {
229
 
230
+ $id = isset($option['id']) ? $option['id'] : "";
231
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
232
+ $sortable = isset($option['sortable']) ? $option['sortable'] : false;
233
 
234
+ $args_index = isset($option['args_index']) ? $option['args_index'] : array();
235
+ $args_index_default = isset($option['args_index_default']) ? $option['args_index_default'] : array();
236
+ $args_index_hide = isset($option['args_index_hide']) ? $option['args_index_hide'] : array();
237
 
238
+ $args_index = !empty($args_index) ? $args_index : $args_index_default;
239
 
240
+ $args = isset($option['args']) ? $option['args'] : array();
241
 
242
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
243
 
244
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
245
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
246
 
247
 
248
+ $title = isset($option['title']) ? $option['title'] : "";
249
+ $group_details = isset($option['details']) ? $option['details'] : "";
250
 
251
+ if ($is_pro == true) {
252
+ $group_details = '<span class="pro-feature">' . $pro_text . '</span> ' . $group_details;
253
+ }
254
 
255
 
256
+ ob_start();
257
  ?>
258
+ <div class="option-group-accordion-wrap" id="<?php echo $css_id; ?>">
259
+ <div sortable="<?php echo ($sortable) ? 'true' : 'false'; ?>" class='option-group-accordion accordion'>
260
+ <?php
261
 
262
+ if (!empty($args_index))
263
+ foreach ($args_index as $index) :
264
 
265
+ //foreach( $args as $key => $value ):
266
 
267
+ $group_title = isset($args[$index]['title']) ? $args[$index]['title'] : '';
268
+ $is_hide = isset($args_index_hide[$index]) ? $args_index_hide[$index] : false;
269
 
270
 
271
+ //$link = $value['link'];
272
+ $options = isset($args[$index]['options']) ? $args[$index]['options'] : array();
273
 
274
+ ?>
275
  <div class="group">
276
  <h3 class="accordion-title">
277
 
278
 
279
+ <?php if ($sortable) : ?>
280
  <span class="sort"><i class="fas fa-sort"></i></span>
281
  <?php endif; ?>
282
 
286
 
287
  <?php
288
 
289
+ if (!empty($options)) :
290
+ foreach ($options as $option) :
291
+
292
+ $id = isset($option['id']) ? $option['id'] : "";
293
+ $type = isset($option['type']) ? $option['type'] : "";
294
+ $details = isset($option['details']) ? $option['details'] : "";
295
+
296
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
297
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
298
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
299
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
300
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
301
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
302
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
303
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
304
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
305
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
306
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
307
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
308
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
309
+
310
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
311
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
312
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
313
+
314
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
315
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
316
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
317
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
318
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
319
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
320
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
321
 
322
  endforeach;
323
  endif;
327
 
328
 
329
  <?php
330
+ //endforeach;
331
 
332
+ endforeach;
333
 
334
 
335
+ ?>
336
+ </div> <!-- .option-group-accordion -->
337
+ </div><!-- .option-group-accordion-wrap -->
338
 
339
  <?php
340
 
341
+ $input_html = ob_get_clean();
 
 
 
342
 
343
+ echo sprintf($field_template, $title, $input_html, $group_details);
344
+ }
345
 
346
 
347
+ public function field_option_group($option)
348
+ {
349
 
350
+ $id = isset($option['id']) ? $option['id'] : "";
351
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
352
+ $options = isset($option['options']) ? $option['options'] : array();
353
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
354
 
355
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
356
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
357
 
358
 
359
+ $title = isset($option['title']) ? $option['title'] : "";
360
+ $group_details = isset($option['details']) ? $option['details'] : "";
361
 
362
+ if ($is_pro == true) {
363
+ $group_details = '<span class="pro-feature">' . $pro_text . '</span> ' . $group_details;
364
+ }
365
 
366
 
367
+ ob_start();
368
  ?>
369
+ <div id="<?php echo $css_id; ?>">
370
+ <?php
371
 
372
+ if (!empty($options)) :
373
+ foreach ($options as $option) :
374
+
375
+ $id = isset($option['id']) ? $option['id'] : "";
376
+ $type = isset($option['type']) ? $option['type'] : "";
377
+ $details = isset($option['details']) ? $option['details'] : "";
378
+
379
+ if (isset($option['type']) && $option['type'] === 'select') $this->field_select($option);
380
+ elseif (isset($option['type']) && $option['type'] === 'select2') $this->field_select2($option);
381
+ elseif (isset($option['type']) && $option['type'] === 'checkbox') $this->field_checkbox($option);
382
+ elseif (isset($option['type']) && $option['type'] === 'radio') $this->field_radio($option);
383
+ elseif (isset($option['type']) && $option['type'] === 'radio_image') $this->field_radio_image($option);
384
+ elseif (isset($option['type']) && $option['type'] === 'textarea') $this->field_textarea($option);
385
+ elseif (isset($option['type']) && $option['type'] === 'scripts_js') $this->field_scripts_js($option);
386
+ elseif (isset($option['type']) && $option['type'] === 'scripts_css') $this->field_scripts_css($option);
387
+ elseif (isset($option['type']) && $option['type'] === 'number') $this->field_number($option);
388
+ elseif (isset($option['type']) && $option['type'] === 'text') $this->field_text($option);
389
+ elseif (isset($option['type']) && $option['type'] === 'text_icon') $this->field_text_icon($option);
390
+ elseif (isset($option['type']) && $option['type'] === 'text_multi') $this->field_text_multi($option);
391
+ elseif (isset($option['type']) && $option['type'] === 'hidden') $this->field_hidden($option);
392
+
393
+ elseif (isset($option['type']) && $option['type'] === 'range') $this->field_range($option);
394
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker') $this->field_colorpicker($option);
395
+ elseif (isset($option['type']) && $option['type'] === 'colorpicker_multi') $this->field_colorpicker_multi($option);
396
+
397
+ elseif (isset($option['type']) && $option['type'] === 'datepicker') $this->field_datepicker($option);
398
+ elseif (isset($option['type']) && $option['type'] === 'faq') $this->field_faq($option);
399
+ elseif (isset($option['type']) && $option['type'] === 'addons_grid') $this->field_addons_grid($option);
400
+ elseif (isset($option['type']) && $option['type'] === 'custom_html') $this->field_custom_html($option);
401
+ elseif (isset($option['type']) && $option['type'] === 'repeatable') $this->field_repeatable($option);
402
+ elseif (isset($option['type']) && $option['type'] === 'media') $this->field_media($option);
403
+ elseif (isset($option['type']) && $option['type'] === 'media_url') $this->field_media_url($option);
404
 
405
+ endforeach;
406
+ endif;
407
+ ?>
408
+ </div>
409
  <?php
410
 
411
+ $input_html = ob_get_clean();
 
 
 
412
 
413
+ echo sprintf($field_template, $title, $input_html, $group_details);
414
+ }
415
 
416
 
417
+ public function field_media($option)
418
+ {
419
 
420
 
421
 
422
+ $id = isset($option['id']) ? $option['id'] : "";
423
+ if (empty($id)) return;
424
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
425
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
426
+ $parent = isset($option['parent']) ? $option['parent'] : "";
427
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
428
+ $title = isset($option['title']) ? $option['title'] : "";
429
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
430
 
431
+ $details = isset($option['details']) ? $option['details'] : "";
432
 
433
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
434
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
435
 
436
+ $default = isset($option['default']) ? $option['default'] : '';
437
+ $value = isset($option['value']) ? $option['value'] : '';
438
+ $value = !empty($value) ? $value : $default;
439
 
440
+ $media_url = wp_get_attachment_url($value);
441
+ $media_type = get_post_mime_type($value);
442
+ $media_title = !empty($value) ? get_the_title($value) : __('Placeholder.jpg', $this->textdomain);
443
 
444
 
445
+ $media_url = !empty($media_url) ? $media_url : $default;
446
+ $media_url = !empty($media_url) ? $media_url : $placeholder;
447
+ $media_basename = wp_basename($media_type);
448
 
449
+ $field_name = !empty($field_name) ? $field_name : $id;
450
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
451
 
452
 
453
 
454
+ ob_start();
455
+ //wp_enqueue_media();
456
 
457
  ?>
458
+ <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-wrapper
459
  field-media-wrapper-<?php echo $css_id; ?>">
460
+ <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;word-break: break-all;">
461
+ <?php
462
 
463
+ //var_dump($media_type);
464
 
465
+ if ("audio/mpeg" == $media_type) {
466
  ?>
467
+ <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
468
+ <div class="media-title"><?php echo $media_title; ?></div>
469
  <?php
470
+ } elseif (
471
+ "images/png" == $media_type ||
472
+ "image/png" == $media_type ||
473
+ "images/gif" == $media_type ||
474
+ "image/gif" == $media_type ||
475
+ "images/jpeg" == $media_type ||
476
+ "image/jpeg" == $media_type ||
477
+ "images/jpg" == $media_type ||
478
+ "image/jpg" == $media_type ||
479
+ "images/ico" == $media_type ||
480
+ "image/ico" == $media_type
481
+ ) {
482
  ?>
483
+ <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%" />
484
+ <div class="media-title"><?php echo $media_title; ?></div>
485
  <?php
486
+ } else {
487
  ?>
488
+ <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%" />
489
+ <div class="media-title"><?php echo $media_title; ?></div>
490
 
491
  <?php
492
+ }
493
+ ?>
494
+ </div>
495
+ <input class="media-input-value" type="hidden" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
496
+ <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain); ?></div>
497
+ <div placeholder="<?php echo $placeholder; ?>" class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear', $this->textdomain); ?></div>
498
+ <div class="error-mgs"></div>
499
  </div>
 
 
 
 
 
500
 
501
  <?php
502
 
503
 
504
+ $input_html = ob_get_clean();
505
 
506
+ echo sprintf($field_template, $title, $input_html, $details);
507
+ }
 
508
 
509
 
510
 
511
 
512
+ public function field_media_url($option)
513
+ {
514
 
515
 
516
 
517
+ $id = isset($option['id']) ? $option['id'] : "";
518
+ if (empty($id)) return;
519
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
520
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
521
+ $parent = isset($option['parent']) ? $option['parent'] : "";
522
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
523
+ $placeholder_img = isset($option['placeholder_img']) ? $option['placeholder_img'] : "";
524
 
525
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
526
+ $title = isset($option['title']) ? $option['title'] : "";
527
+ $details = isset($option['details']) ? $option['details'] : "";
528
 
529
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
530
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
531
 
532
+ $default = isset($option['default']) ? $option['default'] : '';
533
+ $value = isset($option['value']) ? $option['value'] : '';
534
+ $value = !empty($value) ? $value : $default;
535
 
536
+ $media_url = $value;
537
+ $media_type = get_post_mime_type($value);
538
+ $media_title = get_the_title($value);
539
+ $media_url = !empty($media_url) ? $media_url : '';
540
+ $media_url = !empty($media_url) ? $media_url : $placeholder_img;
541
 
542
+ $field_name = !empty($field_name) ? $field_name : $id;
543
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
544
 
545
 
546
+ wp_enqueue_media();
547
+ ob_start();
548
 
549
 
550
  ?>
551
+ <div id="input-wrapper-<?php echo $css_id; ?>" class="input-wrapper field-media-url-wrapper
552
  field-media-wrapper-<?php echo $css_id; ?>">
553
+ <div class="media-preview-wrap" style="width: 150px;margin-bottom: 10px;background: #eee;padding: 5px; text-align: center;">
554
+ <?php
555
 
556
+ if ("audio/mpeg" == $media_type) {
557
  ?>
558
+ <div class="media-preview" class="dashicons dashicons-format-audio" style="font-size: 70px;display: inline;"></div>
559
 
560
  <?php
561
+ } elseif (
562
+ "images/png" == $media_type || "images/jpg" == $media_type || "images/jpeg" == $media_type ||
563
+ "images/gif" == $media_type ||
564
+ "images/ico" == $media_type
565
+ ) {
566
  ?>
567
+ <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%" />
568
 
569
  <?php
570
+ } else {
 
 
571
  ?>
572
+ <img class="media-preview" src="<?php echo $media_url; ?>" style="width:100%" />
573
 
574
  <?php
575
+ }
576
+ ?>
577
+ </div>
578
+ <input type="text" placeholder="<?php echo $placeholder; ?>" name="<?php echo $field_name; ?>" id="media_input_<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
579
+ <div class="media-upload button" id="media_upload_<?php echo $css_id; ?>"><?php echo __('Upload', $this->textdomain); ?></div>
580
+ <div class="clear button" id="media_clear_<?php echo $css_id; ?>"><?php echo __('Clear', 'post-grid'); ?></div>
581
+ <div class="error-mgs"></div>
582
  </div>
 
 
 
 
 
583
 
584
  <?php
585
 
586
 
587
+ $input_html = ob_get_clean();
 
 
588
 
589
+ echo sprintf($field_template, $title, $input_html, $details);
590
+ }
591
 
592
 
593
 
594
+ public function field_repeatable($option)
595
+ {
596
 
597
+ $id = isset($option['id']) ? $option['id'] : "";
598
+ if (empty($id)) return;
599
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
600
+ $parent = isset($option['parent']) ? $option['parent'] : "";
601
+ $field_name = isset($option['field_name']) ? $option['field_name'] : $id;
602
+ $field_name = !empty($parent) ? $parent . '[' . $field_name . ']' : $field_name;
603
 
604
+ $sortable = isset($option['sortable']) ? $option['sortable'] : true;
605
+ $collapsible = isset($option['collapsible']) ? $option['collapsible'] : true;
606
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
607
+ $values = isset($option['value']) ? $option['value'] : array();
608
+ $fields = isset($option['fields']) ? $option['fields'] : array();
609
+ $title_field = isset($option['title_field']) ? $option['title_field'] : '';
610
+ $remove_text = isset($option['remove_text']) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
611
+ $limit = isset($option['limit']) ? $option['limit'] : '';
612
 
613
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
614
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
615
 
616
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
617
+ $title = isset($option['title']) ? $option['title'] : "";
618
+ $details = isset($option['details']) ? $option['details'] : "";
619
 
620
+ $settings_tabs_field = new settings_tabs_field();
621
 
622
 
623
+ ob_start();
624
  ?>
625
+ <div class="item-wrap collapsible">
626
+ <div class="header">
627
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
628
+ <?php
629
+ if ($sortable) :
630
+ ?>
631
+ <span class="sort"><i class="fas fa-arrows-alt"></i></span>
632
+ <?php
633
+ endif;
634
  ?>
635
+ <span class="title-text">#TIMEINDEX</span>
636
+ </div>
637
  <?php
 
 
 
 
 
638
 
639
 
640
+ if (!empty($fields)) :
641
+ foreach ($fields as $field) :
642
 
643
+ $fieldType = isset($field['type']) ? $field['type'] : '';
644
+ $field['parent'] = $field_name . '[TIMEINDEX]';
645
 
646
 
647
+ ?>
648
+ <div class="item">
649
+ <?php if ($collapsible) : ?>
650
+ <div class="content">
651
+ <?php endif; ?>
652
+
653
+ <?php
654
+ $settings_tabs_field->generate_field($field);
655
+ ?>
656
+ <?php if ($collapsible) : ?>
657
+ </div>
658
  <?php endif; ?>
659
 
 
 
 
 
660
  </div>
 
 
 
661
  <?php
662
 
663
+ endforeach;
664
+ endif;
665
+ ?>
666
+ </div>
667
+ <?php
668
 
669
+ $fieldHtml = ob_get_clean();
670
 
671
+ $fieldHtml = preg_replace("/[\r\n]+/", "\n", $fieldHtml);
672
+ $fieldHtml = preg_replace("/\s+/", ' ', $fieldHtml);
673
 
674
 
675
+ ob_start();
676
+ ?>
677
 
678
 
679
+ <div id="input-wrapper-<?php echo $css_id; ?>" class=" input-wrapper field-repeatable-wrapper
680
  field-repeatable-wrapper-<?php echo $css_id; ?>">
681
+ <div add_html="<?php echo esc_attr($fieldHtml); ?>" class="add-repeat-field"><i class="far fa-plus-square"></i> <?php _e('Add', 'post-grid'); ?></div>
682
+ <div class="repeatable-field-list sortable" id="<?php echo $css_id; ?>">
683
+ <?php
684
+ if (!empty($values)) :
685
+ $count = 1;
686
+ foreach ($values as $index => $val) :
687
+ $title_field_val = !empty($val[$title_field]) ? $val[$title_field] : '#' . $count;
688
 
689
+ //var_dump($index);
690
 
691
+ ?>
692
+ <div class="item-wrap <?php if ($collapsible) echo 'collapsible'; ?>" index="<?php echo $index; ?>">
693
+ <?php if ($collapsible) : ?>
694
+ <div class="header">
695
+ <?php endif; ?>
696
+ <span class="remove" onclick="jQuery(this).parent().parent().remove()"><?php echo $remove_text; ?></span>
697
+ <?php if ($sortable) : ?>
698
+ <span class="sort"><i class="fas fa-arrows-alt"></i></span>
699
+ <?php endif; ?>
700
+
701
+ <span class="title-text"><?php echo $title_field_val; ?></span>
702
+ <?php if ($collapsible) : ?>
703
+ </div>
704
  <?php endif; ?>
705
+ <?php
 
 
 
 
 
706
 
707
 
708
 
709
+ foreach ($fields as $field_index => $field) :
710
+ $fieldId = $field['id'];
711
+ $field_css_id = isset($field['css_id']) ? str_replace('TIMEINDEX', $index, $field['css_id']) : '';
712
 
713
+ //var_dump($field_css_id);
714
 
715
+ $title_field_class = ($title_field == $field_index) ? 'title-field' : '';
716
  ?>
717
+ <div class="item <?php echo $title_field_class; ?>">
718
+ <?php if ($collapsible) : ?>
719
+ <div class="content">
720
+ <?php endif; ?>
721
 
722
+ <?php
723
+ $field['parent'] = $field_name . '[' . $index . ']';
724
+ $field['css_id'] = $field_css_id;
725
 
726
+ $field['value'] = isset($val[$fieldId]) ? $val[$fieldId] : '';
727
 
728
+ $settings_tabs_field->generate_field($field);
729
 
730
 
731
+ if ($collapsible) : ?>
732
+ </div>
733
+ <?php endif; ?>
734
  </div>
735
+ <?php
 
 
736
 
737
+ endforeach; ?>
738
+ </div>
739
  <?php
740
+ $count++;
741
+ endforeach;
742
+ else :
743
+ ?>
744
+ <?php
745
+ endif;
746
  ?>
747
+ </div>
748
+ <div class="error-mgs"></div>
 
749
  </div>
 
 
750
 
751
  <?php
752
 
753
+ $input_html = ob_get_clean();
754
 
755
+ echo sprintf($field_template, $title, $input_html, $details);
756
+ }
 
 
 
757
 
758
 
759
 
762
 
763
 
764
 
765
+ public function field_select($option)
766
+ {
767
 
768
+ $id = isset($option['id']) ? $option['id'] : "";
769
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
770
+ $parent = isset($option['parent']) ? $option['parent'] : "";
771
+ $args = isset($option['args']) ? $option['args'] : array();
772
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
773
+ $multiple = isset($option['multiple']) ? $option['multiple'] : false;
774
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
775
 
776
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
777
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
778
 
779
 
780
+ $title = isset($option['title']) ? $option['title'] : "";
781
+ $details = isset($option['details']) ? $option['details'] : "";
782
 
783
+ if ($is_pro == true) {
784
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
785
+ }
786
 
787
 
788
+ if ($multiple) {
789
+ $value = isset($option['value']) ? $option['value'] : array();
790
+ $field_name = !empty($parent) ? $parent . '[' . $id . '][]' : $id . '[]';
791
+ $default = isset($option['default']) ? $option['default'] : array();
792
+ } else {
793
+ $value = isset($option['value']) ? $option['value'] : '';
794
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
795
+ $default = isset($option['default']) ? $option['default'] : '';
796
+ }
797
 
798
 
799
+ $value = !empty($value) ? $value : $default;
800
 
801
 
802
 
803
 
804
+ ob_start();
805
  ?>
806
 
807
+ <select <?php if ($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
808
+ <?php
809
+ foreach ($args as $key => $name) :
810
+ if ($multiple) {
811
+ $selected = in_array($key, $value) ? "selected" : "";
812
+ } else {
813
+ $selected = $value == $key ? "selected" : "";
814
+ }
815
 
816
 
817
  ?>
818
+ <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
819
+ <?php
820
+ endforeach;
821
+ ?>
822
+ </select>
823
  <?php
824
+ if ($multiple) :
825
  ?>
826
+ <div class="button select-reset">Reset</div><br>
827
+ <?php
828
+ endif;
829
  ?>
 
 
 
 
830
 
831
  <?php
832
 
833
+ $input_html = ob_get_clean();
 
 
 
834
 
835
+ echo sprintf($field_template, $title, $input_html, $details);
836
+ }
837
 
838
+ public function field_select2($option)
839
+ {
840
 
841
+ $id = isset($option['id']) ? $option['id'] : "";
842
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
843
+ $parent = isset($option['parent']) ? $option['parent'] : "";
844
+ $args = isset($option['args']) ? $option['args'] : array();
845
+ $multiple = isset($option['multiple']) ? $option['multiple'] : "";
846
+ $attributes = isset($option['attributes']) ? $option['attributes'] : array();
847
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
848
 
849
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
850
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
851
 
852
 
853
+ //var_dump($css_id);
854
 
855
+ if ($multiple) {
856
+ $value = isset($option['value']) ? $option['value'] : array();
857
+ $field_name = !empty($parent) ? $parent . '[' . $id . '][]' : $id . '[]';
858
+ $default = isset($option['default']) ? $option['default'] : array();
859
+ } else {
860
+ $value = isset($option['value']) ? $option['value'] : '';
861
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
862
+ $default = isset($option['default']) ? $option['default'] : '';
863
+ }
864
 
865
+ $value = !empty($value) ? $value : $default;
866
 
867
+ //$value = get_post_meta( $post_id, $id, true );
868
+ $title = isset($option['title']) ? $option['title'] : "";
869
+ $details = isset($option['details']) ? $option['details'] : "";
870
 
871
+ $attributes_html = '';
872
 
873
+ foreach ($attributes as $attributeId => $attribute) :
874
 
875
+ $attributes_html = $attributeId . '=' . $attribute . ' ';
876
 
877
+ endforeach;
878
 
879
 
880
+ ob_start();
881
  ?>
882
+ <select <?php echo $attributes_html; ?> class="select2" <?php if ($multiple) echo 'multiple'; ?> name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>">
883
+ <?php
884
+ foreach ($args as $key => $name) :
885
 
886
+ if ($multiple) {
887
+ $selected = in_array($key, $value) ? "selected" : "";
888
+ } else {
889
+ $selected = ($key == $value) ? "selected" : "";
890
+ }
891
 
892
  ?>
893
+ <option <?php echo $selected; ?> value="<?php echo $key; ?>"><?php echo $name; ?></option>
894
+ <?php
895
+ endforeach;
896
+ ?>
897
+ </select>
898
  <?php
899
 
900
+ $input_html = ob_get_clean();
901
 
902
+ echo sprintf($field_template, $title, $input_html, $details);
903
+ }
904
 
905
 
906
 
907
 
908
 
909
+ public function field_text_multi($option)
910
+ {
911
 
912
+ $id = isset($option['id']) ? $option['id'] : "";
913
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
914
+ $parent = isset($option['parent']) ? $option['parent'] : "";
915
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
916
 
917
+ $default = isset($option['default']) ? $option['default'] : array();
918
+ $values = isset($option['value']) ? $option['value'] : $default;
919
 
920
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
921
 
922
+ $remove_text = isset($option['remove_text']) ? $option['remove_text'] : '<i class="fas fa-times"></i>';
923
+ $sortable = isset($option['sortable']) ? $option['sortable'] : true;
924
+ $allow_clone = isset($option['allow_clone']) ? $option['allow_clone'] : false;
925
 
 
926
 
927
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
928
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
 
 
929
 
 
 
930
 
931
+ $title = isset($option['title']) ? $option['title'] : "";
932
+ $details = isset($option['details']) ? $option['details'] : "";
933
 
934
+ if ($is_pro == true) {
935
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
936
+ }
937
 
938
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
939
 
 
 
940
 
941
+ ob_start();
942
+ ?>
943
+ <div id="input-wrapper-<?php echo $id; ?>" class="input-wrapper input-text-multi-wrapper
944
+ input-text-multi-wrapper-<?php echo $css_id; ?>">
945
+ <span data-placeholder="<?php echo esc_attr($placeholder); ?>" data-sort="<?php echo $sortable; ?>" data-clone="<?php echo $allow_clone; ?>" data-name="<?php echo $field_name; ?>[]" class="button add-item"><?php echo __('Add', $this->textdomain); ?></span>
946
+ <div class="field-list <?php if ($sortable) {
947
+ echo 'sortable';
948
+ } ?>" id="<?php echo $css_id; ?>">
949
+ <?php
950
+ if (!empty($values)) :
951
+ foreach ($values as $value) :
952
+ ?>
953
+ <div class="item">
954
+ <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
955
+ echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
956
+
957
+ <?php if ($allow_clone) : ?>
958
+ <span class="button clone"><i class="far fa-clone"></i></span>
959
+ <?php endif; ?>
960
 
 
 
961
 
962
+ <?php if ($sortable) : ?>
963
+ <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
964
+ <?php endif; ?>
965
 
966
+ <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
967
+ </div>
968
+ <?php
969
+ endforeach;
970
 
971
+ else :
972
 
 
 
 
 
 
 
 
 
 
973
  ?>
974
  <div class="item">
975
+ <input type="text" name="<?php echo esc_attr($field_name); ?>[]" placeholder="<?php
976
+ echo esc_attr($placeholder); ?>" value="" />
977
 
978
+ <?php if ($allow_clone) : ?>
979
  <span class="button clone"><i class="far fa-clone"></i></span>
980
  <?php endif; ?>
981
 
982
 
983
+ <?php if ($sortable) : ?>
984
  <span class="button sort"><i class="fas fa-arrows-alt"></i></span>
985
  <?php endif; ?>
986
 
987
  <span class="button remove" onclick="jQuery(this).parent().remove()"><?php echo ($remove_text); ?></span>
988
  </div>
989
  <?php
 
 
 
990
 
991
+ endif;
992
  ?>
993
+ </div>
994
+ <div class="error-mgs"></div>
 
 
 
 
 
 
 
 
 
 
995
 
 
 
 
996
 
 
 
997
  </div>
 
 
 
 
998
 
999
  <?php
1000
 
1001
+ $input_html = ob_get_clean();
 
 
1002
 
1003
+ echo sprintf($field_template, $title, $input_html, $details);
1004
+ }
1005
 
1006
+ public function field_hidden($option)
1007
+ {
1008
 
1009
+ $id = isset($option['id']) ? $option['id'] : "";
1010
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1011
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1012
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1013
+ $value = isset($option['value']) ? $option['value'] : '';
1014
+ $default = isset($option['default']) ? $option['default'] : '';
1015
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1016
 
1017
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1018
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1019
 
1020
+ $value = !empty($value) ? $value : $default;
1021
 
1022
+ $title = isset($option['title']) ? $option['title'] : "";
1023
+ $details = isset($option['details']) ? $option['details'] : "";
1024
 
1025
+ if ($is_pro == true) {
1026
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1027
+ }
1028
 
1029
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1030
 
1031
 
1032
+ ob_start();
1033
  ?>
1034
+ <input type="hidden" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
1035
  <?php
1036
 
1037
+ $input_html = ob_get_clean();
 
 
1038
 
1039
+ echo sprintf($field_template, $title, $input_html, $details);
1040
+ }
1041
 
1042
 
1043
+ public function field_text($option)
1044
+ {
1045
 
1046
+ $id = isset($option['id']) ? $option['id'] : "";
1047
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1048
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1049
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1050
+ $value = isset($option['value']) ? $option['value'] : '';
1051
+ $default = isset($option['default']) ? $option['default'] : '';
1052
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1053
 
1054
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1055
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1056
 
1057
+ $value = !empty($value) ? $value : $default;
1058
 
1059
+ $title = isset($option['title']) ? $option['title'] : "";
1060
+ $details = isset($option['details']) ? $option['details'] : "";
1061
 
1062
+ if ($is_pro == true) {
1063
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1064
+ }
1065
 
1066
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1067
 
1068
 
1069
+ ob_start();
1070
  ?>
1071
+ <input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo esc_attr($value); ?>" />
1072
  <?php
1073
 
1074
+ $input_html = ob_get_clean();
1075
 
1076
+ echo sprintf($field_template, $title, $input_html, $details);
1077
+ }
 
1078
 
1079
 
1080
 
1081
+ public function field_wp_editor($option)
1082
+ {
1083
 
1084
+ $id = isset($option['id']) ? $option['id'] : "";
1085
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1086
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1087
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1088
+ $value = isset($option['value']) ? $option['value'] : '';
1089
+ $default = isset($option['default']) ? $option['default'] : '';
1090
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1091
 
1092
 
1093
 
1094
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1095
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1096
 
1097
+ $value = !empty($value) ? $value : $default;
1098
 
1099
+ $title = isset($option['title']) ? $option['title'] : "";
1100
+ $details = isset($option['details']) ? $option['details'] : "";
1101
 
1102
+ if ($is_pro == true) {
1103
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1104
+ }
1105
 
1106
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1107
 
1108
+ $editor_settings = isset($option['editor_settings']) ? $option['editor_settings'] : array('textarea_name' => $field_name, 'teeny' => true, 'textarea_rows' => 15,);
1109
 
1110
+ ob_start();
1111
 
1112
  ?>
1113
+ <div id="field-wrapper-<?php echo $id; ?>" class="<?php if (!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1114
  field-wp_editor-wrapper-<?php echo $id; ?>">
1115
+ <?php
1116
+ wp_editor($value, $css_id, $editor_settings);
1117
+ ?>
1118
+ <div class="error-mgs"></div>
1119
+ </div>
1120
 
1121
  <?php
1122
 
1123
 
1124
 
1125
 
1126
+ $input_html = ob_get_clean();
 
 
1127
 
1128
+ echo sprintf($field_template, $title, $input_html, $details);
1129
+ }
1130
 
1131
 
1132
 
1133
 
1134
 
1135
 
1136
+ public function field_text_icon($option)
1137
+ {
1138
 
1139
+ $id = isset($option['id']) ? $option['id'] : "";
1140
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1141
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1142
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1143
+ $value = isset($option['value']) ? $option['value'] : '';
1144
+ $default = isset($option['default']) ? $option['default'] : '';
1145
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1146
 
1147
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1148
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1149
 
1150
+ $title = isset($option['title']) ? $option['title'] : "";
1151
+ $details = isset($option['details']) ? $option['details'] : "";
1152
 
1153
+ $option_value = empty($value) ? $default : $value;
1154
 
1155
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1156
 
1157
 
1158
 
1159
 
1160
+ ob_start();
1161
  ?>
1162
+ <div class="text-icon">
1163
+ <span class="icon"><?php echo $option_value; ?></span><input type="text" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($option_value); ?>" />
1164
+ </div>
1165
+ <style>
1166
+ .text-icon {}
1167
+
1168
+ .text-icon .icon {
1169
+ /* width: 30px; */
1170
+ background: #ddd;
1171
+ /* height: 28px; */
1172
+ display: inline-block;
1173
+ vertical-align: top;
1174
+ text-align: center;
1175
+ font-size: 14px;
1176
+ padding: 5px 10px;
1177
+ line-height: normal;
1178
+ }
1179
+ </style>
1180
+ <script>
1181
+ jQuery(document).ready(function($) {
1182
+ $(document).on("keyup", ".text-icon input", function() {
1183
+ val = $(this).val();
1184
+ if (val) {
1185
+ $(this).parent().children(".icon").html(val);
1186
+ }
1187
+ })
1188
  })
1189
+ </script>
 
1190
  <?php
1191
 
1192
+ $input_html = ob_get_clean();
1193
 
1194
+ echo sprintf($field_template, $title, $input_html, $details);
1195
+ }
 
1196
 
1197
 
1198
 
1199
+ public function field_range($option)
1200
+ {
1201
 
1202
+ $id = isset($option['id']) ? $option['id'] : "";
1203
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1204
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1205
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1206
 
1207
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1208
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1209
 
1210
+ $value = isset($option['value']) ? $option['value'] : '';
1211
+ $default = isset($option['default']) ? $option['default'] : '';
1212
+ $value = !empty($value) ? $value : $default;
1213
 
1214
+ $args = isset($option['args']) ? $option['args'] : "";
1215
 
1216
+ $min = isset($args['min']) ? $args['min'] : '';
1217
+ $max = isset($args['max']) ? $args['max'] : '';
1218
+ $step = isset($args['step']) ? $args['step'] : '';
1219
 
1220
+ $title = isset($option['title']) ? $option['title'] : "";
1221
+ $details = isset($option['details']) ? $option['details'] : "";
1222
 
1223
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1224
 
1225
 
1226
+ ob_start();
1227
  ?>
1228
+ <div class="range-input">
1229
+ <span class="range-value"><?php echo $value; ?></span><input type="range" min="<?php if ($min) echo $min; ?>" max="<?php if ($max) echo $max; ?>" step="<?php if ($step) echo $step; ?>" class="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" value="<?php echo $value; ?>" />
1230
+ </div>
1231
+
1232
+ <script>
1233
+ jQuery(document).ready(function($) {
1234
+ $(document).on("change", "#<?php echo $css_id; ?>", function() {
1235
+ val = $(this).val();
1236
+ if (val) {
1237
+ $(this).parent().children(".range-value").html(val);
1238
+ }
1239
+ })
1240
  })
1241
+ </script>
1242
+
1243
+ <style>
1244
+ .range-input {}
1245
+
1246
+ .range-input .range-value {
1247
+ display: inline-block;
1248
+ vertical-align: top;
1249
+ margin: 0 0;
1250
+ padding: 4px 10px;
1251
+ background: #eee;
1252
+ }
1253
+ </style>
1254
  <?php
1255
 
1256
+ $input_html = ob_get_clean();
1257
+ echo sprintf($field_template, $title, $input_html, $details);
1258
+ }
1259
 
1260
 
1261
 
1262
+ public function field_textarea($option)
1263
+ {
1264
 
1265
+ $id = isset($option['id']) ? $option['id'] : "";
1266
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1267
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1268
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1269
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1270
+ $value = isset($option['value']) ? $option['value'] : '';
1271
+ $default = isset($option['default']) ? $option['default'] : '';
1272
+ $value = !empty($value) ? $value : $default;
1273
 
1274
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1275
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1276
 
1277
+ $title = isset($option['title']) ? $option['title'] : "";
1278
+ $details = isset($option['details']) ? $option['details'] : "";
1279
 
1280
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1281
 
1282
+ if ($is_pro == true) {
1283
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1284
+ }
1285
 
1286
 
1287
+ ob_start();
1288
  ?>
1289
+ <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1290
  <?php
1291
 
1292
+ $input_html = ob_get_clean();
1293
 
1294
+ echo sprintf($field_template, $title, $input_html, $details);
1295
+ }
 
1296
 
1297
 
1298
 
1299
+ public function field_textarea_editor($option)
1300
+ {
1301
 
1302
+ $id = isset($option['id']) ? $option['id'] : "";
1303
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1304
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1305
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1306
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1307
+ $value = isset($option['value']) ? $option['value'] : '';
1308
+ $default = isset($option['default']) ? $option['default'] : '';
1309
+ $value = !empty($value) ? $value : $default;
1310
 
1311
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1312
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1313
 
1314
+ $title = isset($option['title']) ? $option['title'] : "";
1315
+ $details = isset($option['details']) ? $option['details'] : "";
1316
 
1317
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1318
 
1319
+ if ($is_pro == true) {
1320
+ $details = '<span class="pro-feature">' . $pro_text . '</span> ' . $details;
1321
+ }
1322
 
1323
 
1324
+ ob_start();
1325
  ?>
1326
+ <textarea editor_enabled="no" class="textarea-editor" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1327
  <?php
1328
 
1329
+ $input_html = ob_get_clean();
 
 
1330
 
1331
+ echo sprintf($field_template, $title, $input_html, $details);
1332
+ }
1333
 
1334
 
1335
 
1336
+ public function field_scripts_js($option)
1337
+ {
1338
 
1339
+ $id = isset($option['id']) ? $option['id'] : "";
1340
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1341
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1342
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1343
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1344
+ $value = isset($option['value']) ? $option['value'] : '';
1345
+ $default = isset($option['default']) ? $option['default'] : '';
1346
+ $value = !empty($value) ? $value : $default;
1347
 
1348
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1349
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1350
 
1351
+ $title = isset($option['title']) ? $option['title'] : "";
1352
+ $details = isset($option['details']) ? $option['details'] : "";
1353
 
1354
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1355
 
1356
+ $settings = wp_enqueue_code_editor(array('type' => 'text/javascript'));
1357
+ $code_editor = wp_json_encode($settings);
1358
 
1359
 
1360
+ ob_start();
1361
  ?>
1362
+ <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1363
 
1364
+ <script>
1365
+ jQuery(document).ready(function($) {
1366
+ wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1367
+ })
1368
+ </script>
1369
  <?php
1370
 
1371
+ $input_html = ob_get_clean();
 
 
 
 
1372
 
1373
+ echo sprintf($field_template, $title, $input_html, $details);
1374
+ }
1375
 
1376
 
1377
+ public function field_scripts_css($option)
1378
+ {
1379
 
1380
+ $id = isset($option['id']) ? $option['id'] : "";
1381
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1382
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1383
 
1384
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1385
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1386
+ $value = isset($option['value']) ? $option['value'] : '';
1387
+ $default = isset($option['default']) ? $option['default'] : '';
1388
+ $value = !empty($value) ? $value : $default;
1389
 
1390
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1391
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1392
 
1393
+ $title = isset($option['title']) ? $option['title'] : "";
1394
+ $details = isset($option['details']) ? $option['details'] : "";
1395
 
1396
+ $settings = wp_enqueue_code_editor(array('type' => 'text/css'));
1397
+ $code_editor = wp_json_encode($settings);
1398
 
1399
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1400
  ?>
1401
 
1402
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
1403
 
1404
+ ob_start();
1405
+ ?>
1406
+ <textarea name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" cols="40" rows="5" placeholder="<?php echo $placeholder; ?>"><?php echo $value; ?></textarea>
1407
+ <script>
1408
+ jQuery(document).ready(function($) {
1409
 
1410
+ wp.codeEditor.initialize($('#<?php echo $css_id; ?>'), <?php echo $code_editor; ?>);
1411
 
1412
 
1413
+ })
1414
+ </script>
1415
  <?php
1416
 
1417
+ $input_html = ob_get_clean();
 
 
1418
 
1419
+ echo sprintf($field_template, $title, $input_html, $details);
1420
+ }
1421
 
1422
 
1423
 
1424
 
1425
 
1426
+ public function field_checkbox($option)
1427
+ {
1428
 
1429
+ $id = isset($option['id']) ? $option['id'] : "";
1430
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1431
+ $title = isset($option['title']) ? $option['title'] : "";
1432
+ $details = isset($option['details']) ? $option['details'] : "";
1433
+ $for = isset($option['for']) ? $option['for'] : "";
1434
+ $args = isset($option['args']) ? $option['args'] : array();
1435
 
1436
+ $style = isset($option['style']) ? $option['style'] : array();
1437
+ $style_inline = isset($style['inline']) ? $style['inline'] : true;
1438
 
1439
 
1440
+ $option_value = isset($option['value']) ? $option['value'] : '';
1441
+ $default = isset($option['default']) ? $option['default'] : '';
1442
+ $option_value = !empty($option_value) ? $option_value : $default;
1443
 
1444
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1445
 
1446
 
1447
 
1448
  ?>
1449
+ <div class="setting-field">
1450
+ <div class="field-lable"><?php if (!empty($title)) echo $title; ?></div>
1451
+ <div class="field-input">
1452
+ <?php
1453
 
1454
 
1455
 
1456
+ if (!empty($args))
1457
+ foreach ($args as $key => $value) :
1458
 
1459
 
1460
+ //$checked = ( $key == $option_value ) ? "checked" : "";
1461
+ $checked = in_array($key, $option_value) ? "checked" : "";
1462
 
1463
+ $for = !empty($for) ? $for . '-' . $id . "-" . $key : $id . "-" . $key;
1464
 
1465
 
1466
+ ?>
1467
+ <label for='<?php echo $for; ?>'><input name='<?php echo $field_name; ?>[]' type='checkbox' id='<?php echo $for; ?>' value='<?php echo $key; ?>' <?php echo $checked; ?>><span><?php echo $value; ?></span></label>
1468
 
1469
  <?php
1470
 
1471
+ if (!$style_inline) {
1472
+ ?>
1473
  <br>
1474
+ <?php
1475
+ }
1476
 
1477
+ endforeach;
1478
 
1479
+ ?>
1480
+ <p class="description"><?php if (!empty($details)) echo $details; ?></p>
1481
+ </div>
1482
  </div>
1483
+ <?php
 
 
 
 
1484
 
1485
 
1486
+ }
1487
 
 
1488
 
 
 
 
 
 
 
 
 
1489
 
1490
+ public function field_radio($option)
1491
+ {
1492
 
1493
+ $id = isset($option['id']) ? $option['id'] : "";
1494
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1495
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1496
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1497
+ $title = isset($option['title']) ? $option['title'] : "";
1498
+ $details = isset($option['details']) ? $option['details'] : "";
1499
+ $for = isset($option['for']) ? $option['for'] : "";
1500
+ $args = isset($option['args']) ? $option['args'] : array();
1501
 
1502
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1503
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1504
 
1505
+ $option_value = isset($option['value']) ? $option['value'] : '';
1506
+ $default = isset($option['default']) ? $option['default'] : '';
1507
+ $option_value = !empty($option_value) ? $option_value : $default;
1508
 
1509
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1510
 
 
 
 
 
 
 
1511
 
1512
+ ob_start();
 
1513
 
1514
+ if (!empty($args))
1515
+ foreach ($args as $key => $value) :
1516
+ $checked = ($key == $option_value) ? "checked" : "";
1517
+ $for = !empty($for) ? $for . '-' . $css_id . "-" . $key : $css_id . "-" . $key;
1518
+ ?>
1519
+ <label for="<?php echo $for; ?>"><input name="<?php echo $field_name; ?>" type="radio" id="<?php echo $for; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?>><span><?php echo $value; ?></span></label>
1520
 
1521
+ <?php
1522
+ endforeach;
1523
 
1524
+ $input_html = ob_get_clean();
1525
 
1526
+ echo sprintf($field_template, $title, $input_html, $details);
1527
+ }
1528
 
1529
 
1530
 
1531
+ public function field_radio_image($option)
1532
+ {
1533
 
1534
+ $id = isset($option['id']) ? $option['id'] : "";
1535
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1536
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1537
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1538
+ $args = isset($option['args']) ? $option['args'] : array();
1539
+ //$args = is_array( $args ) ? $args : $this->generate_args_from_string( $args );
1540
+ $option_value = isset($option['value']) ? $option['value'] : '';
1541
+ $default = isset($option['default']) ? $option['default'] : '';
1542
+ $lazy_load_img = isset($option['lazy_load_img']) ? $option['lazy_load_img'] : '';
1543
 
1544
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1545
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1546
 
1547
+ $title = isset($option['title']) ? $option['title'] : "";
1548
+ $details = isset($option['details']) ? $option['details'] : "";
1549
+ $width = isset($option['width']) ? $option['width'] : "250px";
1550
 
1551
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1552
 
1553
+ //var_dump($option_value);
1554
 
1555
+ $option_value = empty($option_value) ? $default : $option_value;
1556
 
1557
 
1558
 
1559
+ ob_start();
1560
+ ?>
1561
+ <div class="radio-img">
1562
+ <?php
1563
+ foreach ($args as $key => $value) :
1564
 
1565
+ $name = $value['name'];
1566
+ $thumb = $value['thumb'];
1567
+ $disabled = isset($value['disabled']) ? $value['disabled'] : '';
1568
+ $pro_msg = isset($value['pro_msg']) ? $value['pro_msg'] : '';
1569
+ $link = isset($value['link']) ? $value['link'] : '';
1570
+ $link_text = isset($value['link_text']) ? $value['link_text'] : 'Go';
1571
 
1572
+ $checked = ($key == $option_value) ? "checked" : "";
1573
 
1574
+ //var_dump($checked);
1575
 
1576
  ?>
1577
+ <label style="width: <?php echo $width; ?>;" title="<?php echo $name; ?>" class="<?php if ($checked == 'checked') echo 'active'; ?> <?php if ($disabled == true) echo 'disabled'; ?>">
1578
+ <input <?php if ($disabled) echo 'disabled'; ?> name="<?php echo $field_name; ?>" type="radio" id="<?php echo $css_id; ?>-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?>>
1579
 
1580
+ <?php
1581
+ if (!empty($thumb)) :
1582
 
1583
  ?>
1584
+ <img class="lazy" alt="<?php echo $name; ?>" data-src="<?php echo $thumb; ?>" src="<?php echo $lazy_load_img; ?>">
1585
+ <div style="padding: 5px;" class="name"><?php echo $name; ?></div>
1586
 
1587
  <?php
1588
+ else :
1589
+ echo $name;
1590
+ endif;
1591
+ ?>
1592
 
1593
+ <?php if ($disabled == true) : ?>
1594
+ <span class="pro-msg"><?php echo $pro_msg; ?></span>
1595
+ <?php endif; ?>
1596
+ <?php if (!empty($link)) : ?>
1597
+ <a target="_blank" class="link" href="<?php echo $link; ?>"><?php echo $link_text; ?></a>
1598
+ <?php endif; ?>
1599
 
1600
+ </label>
1601
+ <?php
1602
 
1603
+ endforeach;
1604
+ ?>
1605
+ </div>
 
 
 
 
 
 
 
 
 
 
 
1606
 
1607
+ <style>
1608
+ .radio-img {}
 
1609
 
1610
+ .radio-img label {
1611
+ display: inline-block;
1612
+ vertical-align: top;
1613
+ margin: 5px;
1614
+ padding: 2px;
1615
+ background: #eee;
1616
+ position: relative;
1617
+ }
1618
 
1619
+ .radio-img label.active {
1620
+ background: #fd730d;
1621
+ }
 
 
1622
 
1623
+ .radio-img label.disabled {
1624
+ background: #e2e2e2;
 
 
 
 
 
1625
 
1626
+ }
1627
 
1628
+ .radio-img label.disabled img {
1629
+ background: #e2e2e2;
1630
+ opacity: .3;
1631
+ }
 
 
 
 
 
 
1632
 
1633
+ .radio-img label.disabled .pro-msg {
1634
+ background: #ffd87f;
1635
+ position: absolute;
1636
+ top: 50%;
1637
+ left: 50%;
1638
+ transform: translate(-50%, -50%);
1639
+ padding: 0 10px;
1640
 
1641
+ }
1642
 
1643
+ .radio-img label .link {
1644
+ background: hsl(200, 7%, 42%);
1645
+ position: absolute;
1646
+ top: 2px;
1647
+ /* transform: translate(0%,-50%); */
1648
+ padding: 3px 14px;
1649
+ text-decoration: none;
1650
+ font-size: 14px;
1651
+ color: #fff;
1652
+ right: 2px;
1653
 
1654
+ }
 
 
1655
 
 
 
1656
 
1657
+ .radio-img input[type=radio] {
1658
+ display: none;
1659
+ }
1660
+
1661
+ .radio-img img {
1662
 
1663
+ vertical-align: top;
1664
+ width: 100%;
1665
+ }
1666
+ </style>
1667
+ <?php
1668
 
1669
+ $input_html = ob_get_clean();
1670
 
1671
+ echo sprintf($field_template, $title, $input_html, $details);
1672
+ }
1673
 
1674
+ public function field_datepicker($option)
1675
+ {
1676
 
1677
+ $id = isset($option['id']) ? $option['id'] : "";
1678
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1679
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1680
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1681
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1682
+ $format = isset($option['format']) ? $option['format'] : "";
1683
 
1684
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1685
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1686
 
1687
+ $value = isset($option['value']) ? $option['value'] : '';
1688
+ $default = isset($option['default']) ? $option['default'] : '';
1689
+ $value = !empty($value) ? $value : $default;
1690
 
1691
+ $title = isset($option['title']) ? $option['title'] : "";
1692
+ $details = isset($option['details']) ? $option['details'] : "";
1693
 
1694
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1695
 
1696
 
1697
+ wp_enqueue_script('jquery-ui-datepicker');
1698
+ wp_enqueue_style('jquery-ui');
1699
 
1700
+ ob_start();
1701
  ?>
1702
+ <input type="text" autocomplete="off" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo $placeholder; ?>" value="<?php echo $value; ?>" />
1703
+ <script>
1704
+ jQuery(document).ready(function($) {
1705
+ $("#<?php echo $css_id; ?>").datepicker({
1706
+ dateFormat: "<?php echo $format; ?>"
1707
+ });
1708
+ });
1709
+ </script>
1710
  <?php
1711
 
1712
+ $input_html = ob_get_clean();
1713
 
1714
+ echo sprintf($field_template, $title, $input_html, $details);
1715
+ }
1716
 
1717
 
1718
 
1719
+ public function field_colorpicker($option)
1720
+ {
1721
 
1722
+ $id = isset($option['id']) ? $option['id'] : "";
1723
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1724
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1725
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1726
+ $placeholder = isset($option['placeholder']) ? $option['placeholder'] : "";
1727
 
1728
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1729
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1730
 
1731
+ $value = isset($option['value']) ? $option['value'] : '';
1732
+ $default = isset($option['default']) ? $option['default'] : '';
1733
+ $value = !empty($value) ? $value : $default;
1734
 
1735
+ $title = isset($option['title']) ? $option['title'] : "";
1736
+ $details = isset($option['details']) ? $option['details'] : "";
1737
 
1738
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1739
 
1740
+ ob_start();
1741
  ?>
1742
+ <input colorPicker="" name="<?php echo $field_name; ?>" id="<?php echo $css_id; ?>" placeholder="<?php echo esc_attr($placeholder); ?>" value="<?php echo esc_attr($value); ?>" />
1743
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1744
 
1745
+ $input_html = ob_get_clean();
 
1746
 
1747
+ echo sprintf($field_template, $title, $input_html, $details);
1748
+ }
 
1749
 
 
 
1750
 
1751
+ public function field_colorpicker_multi($option)
1752
+ {
1753
 
1754
+ $id = isset($option['id']) ? $option['id'] : "";
1755
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1756
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1757
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1758
+ $args = isset($option['args']) ? $option['args'] : "";
1759
 
1760
 
1761
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1762
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1763
 
1764
+ $value = isset($option['value']) ? $option['value'] : '';
1765
+ $default = isset($option['default']) ? $option['default'] : '';
1766
+ $value = !empty($value) ? $value : $default;
1767
 
1768
+ $title = isset($option['title']) ? $option['title'] : "";
1769
+ $details = isset($option['details']) ? $option['details'] : "";
1770
 
1771
+ $field_name = !empty($parent) ? $parent . '[' . $id . ']' : $id;
1772
 
 
1773
 
1774
 
1775
+ //echo '<pre>'.var_export($args, true).'</pre>';
 
 
 
 
 
1776
 
1777
+ ob_start();
 
1778
 
1779
+ if (!empty($args)) :
1780
 
1781
+ foreach ($args as $arg_key => $arg) :
1782
 
1783
+ $item_value = isset($value[$arg_key]) ? $value[$arg_key] : $arg;
 
 
 
1784
 
1785
 
1786
+ ?>
1787
+ <div class="">
1788
+ <span><?php echo $arg_key; ?></span>
1789
+ <input name="<?php echo $field_name; ?>[<?php echo $arg_key; ?>]" id="<?php echo $arg_key . '-' . $css_id; ?>" value="<?php echo $item_value; ?>" />
1790
+ <script>
1791
+ jQuery(document).ready(function($) {
1792
+ $("#<?php echo $arg_key . '-' . $css_id; ?>").wpColorPicker();
1793
+ });
1794
+ </script>
1795
+ </div>
1796
 
1797
+ <?php
1798
+ endforeach;
1799
 
1800
+ endif;
 
 
 
 
1801
 
 
 
1802
 
1803
+ $input_html = ob_get_clean();
 
1804
 
1805
+ echo sprintf($field_template, $title, $input_html, $details);
1806
+ }
1807
 
 
1808
 
1809
 
1810
+ public function field_custom_html($option)
1811
+ {
1812
 
1813
+ $id = isset($option['id']) ? $option['id'] : "";
1814
+ $css_id = isset($option['css_id']) ? $option['css_id'] : $id;
1815
+ $parent = isset($option['parent']) ? $option['parent'] : "";
1816
+ $field_template = isset($option['field_template']) ? $option['field_template'] : $this->field_template($option);
1817
+ $html = isset($option['html']) ? $option['html'] : "";
1818
 
1819
+ $is_pro = isset($option['is_pro']) ? $option['is_pro'] : false;
1820
+ $pro_text = isset($option['pro_text']) ? $option['pro_text'] : '';
1821
 
1822
+ $title = isset($option['title']) ? $option['title'] : "";
1823
+ $details = isset($option['details']) ? $option['details'] : "";
1824
 
1825
 
1826
+ echo sprintf($field_template, $title, $html, $details);
1827
+ }
1828
  }
1829
+ }
 
 
 
readme.txt CHANGED
@@ -3,8 +3,8 @@
3
  Donate link: https://www.pickplugins.com/item/woocommerce-products-slider-for-wordpress/?ref=wordpress.org
4
  Tags: product slider, woocommerce slider, carousel slider, product category slider, woo slider, carousel slider, woocommerce product slider
5
  Requires at least: 3.8
6
- Tested up to: 6.0
7
- Stable tag: 1.13.37
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -141,6 +141,10 @@ then paste this shortcode anywhere in your page to display slider<br />
141
 
142
  == Changelog ==
143
 
 
 
 
 
144
  = 1.13.37 =
145
  * 2022-08-10 fix - Scripts file loading issue fixed.
146
 
3
  Donate link: https://www.pickplugins.com/item/woocommerce-products-slider-for-wordpress/?ref=wordpress.org
4
  Tags: product slider, woocommerce slider, carousel slider, product category slider, woo slider, carousel slider, woocommerce product slider
5
  Requires at least: 3.8
6
+ Tested up to: 6.1
7
+ Stable tag: 1.13.38
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
141
 
142
  == Changelog ==
143
 
144
+
145
+ = 1.13.38 =
146
+ * 2022-09-26 fix - jQuery UI tabs missing issue fixed.
147
+
148
  = 1.13.37 =
149
  * 2022-08-10 fix - Scripts file loading issue fixed.
150
 
woocommerce-products-slider.php CHANGED
@@ -3,9 +3,9 @@
3
  Plugin Name: PickPlugins Product Slider for WooCommerce
4
  Plugin URI: http://pickplugins.com/items/woocommerce-product-slider-for-wordpress/
5
  Description: Fully responsive and mobile ready Carousel Slider for your WooCommerce product. unlimited slider anywhere via short-codes and easy admin setting.
6
- Version: 1.13.37
7
  WC requires at least: 3.0.0
8
- WC tested up to: 6.0
9
  Author: PickPlugins
10
  Text Domain: woocommerce-products-slider
11
  Author URI: http://pickplugins.com
3
  Plugin Name: PickPlugins Product Slider for WooCommerce
4
  Plugin URI: http://pickplugins.com/items/woocommerce-product-slider-for-wordpress/
5
  Description: Fully responsive and mobile ready Carousel Slider for your WooCommerce product. unlimited slider anywhere via short-codes and easy admin setting.
6
+ Version: 1.13.38
7
  WC requires at least: 3.0.0
8
+ WC tested up to: 7.1
9
  Author: PickPlugins
10
  Text Domain: woocommerce-products-slider
11
  Author URI: http://pickplugins.com