Post Grid - Version 2.1.23

Version Description

  • 2022-04-23 - fix - Custom scripts & CSS field issue fixed.
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Post Grid
Version 2.1.23
Comparing to
See all releases

Code changes from version 2.1.22 to 2.1.23

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