Version Description
- 2022-04-23 - fix - Custom scripts & CSS field issue fixed.
Download this release
Release Info
Developer | pickplugins |
Plugin | Post Grid |
Version | 2.1.23 |
Comparing to | |
See all releases |
Code changes from version 2.1.22 to 2.1.23
- includes/classes/class-settings-tabs.php +1210 -1222
- post-grid.php +48 -48
- readme.txt +6 -2
includes/classes/class-settings-tabs.php
CHANGED
@@ -1,277 +1,273 @@
|
|
1 |
<?php
|
2 |
-
if (
|
3 |
|
4 |
-
if(
|
5 |
-
class settings_tabs_field
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
|
|
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 |
-
|
|
|
19 |
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
|
|
43 |
}
|
44 |
|
|
|
|
|
45 |
|
46 |
-
|
|
|
|
|
47 |
|
48 |
-
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
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 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
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 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
-
|
139 |
|
140 |
|
141 |
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
|
|
|
153 |
</div>
|
154 |
-
</div>
|
155 |
<?php
|
156 |
|
157 |
-
|
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 |
-
|
|
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
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 |
-
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
|
|
|
|
|
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
|
|
|
|
|
|
|
|
217 |
|
218 |
|
219 |
|
220 |
-
|
|
|
221 |
|
222 |
|
223 |
-
|
|
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
|
233 |
-
|
234 |
|
235 |
-
|
236 |
|
237 |
-
|
238 |
|
239 |
-
|
240 |
-
|
241 |
|
242 |
|
243 |
-
|
244 |
-
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
|
250 |
|
251 |
-
|
252 |
?>
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
|
257 |
-
|
258 |
-
|
259 |
|
260 |
-
|
261 |
|
262 |
-
|
263 |
-
|
264 |
|
265 |
|
266 |
-
|
267 |
-
|
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
|
288 |
-
$type
|
289 |
-
$details
|
290 |
-
|
291 |
-
if(
|
292 |
-
elseif(
|
293 |
-
elseif(
|
294 |
-
elseif(
|
295 |
-
elseif(
|
296 |
-
elseif(
|
297 |
-
elseif(
|
298 |
-
elseif(
|
299 |
-
elseif(
|
300 |
-
elseif(
|
301 |
-
elseif(
|
302 |
-
elseif(
|
303 |
-
elseif(
|
304 |
-
|
305 |
-
elseif(
|
306 |
-
elseif(
|
307 |
-
elseif(
|
308 |
-
|
309 |
-
elseif(
|
310 |
-
elseif(
|
311 |
-
elseif(
|
312 |
-
elseif(
|
313 |
-
elseif(
|
314 |
-
elseif(
|
315 |
-
elseif(
|
316 |
|
317 |
endforeach;
|
318 |
endif;
|
@@ -322,438 +318,433 @@ class settings_tabs_field{
|
|
322 |
|
323 |
|
324 |
<?php
|
325 |
-
|
326 |
|
327 |
-
|
328 |
|
329 |
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
|
334 |
<?php
|
335 |
|
336 |
-
|
337 |
-
|
338 |
-
echo sprintf($field_template, $title, $input_html, $group_details);
|
339 |
|
340 |
-
|
341 |
-
|
342 |
|
343 |
|
344 |
-
|
|
|
345 |
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
|
351 |
-
|
352 |
-
|
353 |
|
354 |
|
355 |
-
|
356 |
-
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
|
362 |
|
363 |
-
|
364 |
?>
|
365 |
-
|
366 |
-
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
<?php
|
406 |
|
407 |
-
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
}
|
413 |
|
414 |
|
415 |
-
|
|
|
416 |
|
417 |
|
418 |
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
|
428 |
-
|
429 |
|
430 |
-
|
431 |
-
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
|
446 |
-
|
447 |
-
|
448 |
|
449 |
|
450 |
|
451 |
-
|
452 |
-
|
453 |
|
454 |
?>
|
455 |
-
|
456 |
field-media-wrapper-<?php echo esc_attr($css_id); ?>">
|
457 |
-
|
458 |
-
|
459 |
|
460 |
-
|
461 |
|
462 |
-
|
463 |
?>
|
464 |
-
|
465 |
-
|
466 |
<?php
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
|
|
478 |
?>
|
479 |
-
|
480 |
-
|
481 |
<?php
|
482 |
-
|
483 |
?>
|
484 |
-
|
485 |
-
|
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 |
-
|
501 |
-
|
502 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
503 |
|
504 |
-
|
|
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
-
|
|
|
510 |
|
511 |
|
512 |
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
|
525 |
-
|
526 |
-
|
527 |
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
|
538 |
-
|
539 |
-
|
540 |
|
541 |
|
542 |
-
|
543 |
-
|
544 |
|
545 |
|
546 |
?>
|
547 |
-
|
548 |
field-media-wrapper-<?php echo esc_attr($css_id); ?>">
|
549 |
-
|
550 |
-
|
551 |
|
552 |
-
|
553 |
?>
|
554 |
-
|
555 |
|
556 |
<?php
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
|
|
561 |
?>
|
562 |
-
|
563 |
|
564 |
<?php
|
565 |
-
|
566 |
-
|
567 |
-
else {
|
568 |
?>
|
569 |
-
|
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 |
-
|
585 |
|
586 |
-
|
587 |
-
|
588 |
-
}
|
589 |
|
590 |
|
591 |
|
592 |
-
|
|
|
593 |
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
|
610 |
-
|
611 |
-
|
612 |
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
|
617 |
-
|
618 |
|
619 |
|
620 |
-
|
621 |
?>
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
|
|
|
|
|
|
|
|
627 |
?>
|
628 |
-
<span class="
|
|
|
629 |
<?php
|
630 |
-
endif;
|
631 |
-
?>
|
632 |
-
<span class="title-text">#TIMEINDEX</span>
|
633 |
-
</div>
|
634 |
-
<?php
|
635 |
|
636 |
|
637 |
-
|
638 |
-
|
639 |
|
640 |
-
|
641 |
-
|
642 |
|
643 |
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
|
666 |
-
|
667 |
|
668 |
-
|
669 |
-
|
670 |
|
671 |
|
672 |
-
|
673 |
-
|
674 |
|
675 |
|
676 |
-
|
677 |
field-repeatable-wrapper-<?php echo esc_attr($css_id); ?>">
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
|
686 |
-
|
687 |
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
707 |
-
|
708 |
-
|
709 |
|
710 |
-
|
711 |
|
712 |
-
|
713 |
?>
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
|
723 |
-
|
724 |
|
725 |
-
|
726 |
|
727 |
|
728 |
-
|
|
|
|
|
729 |
</div>
|
730 |
-
<?php
|
731 |
-
</div>
|
732 |
-
<?php
|
733 |
|
734 |
-
|
735 |
-
|
736 |
<?php
|
737 |
-
|
738 |
-
|
739 |
-
|
|
|
|
|
|
|
740 |
?>
|
741 |
-
|
742 |
-
|
743 |
-
?>
|
744 |
</div>
|
745 |
-
<div class="error-mgs"></div>
|
746 |
-
</div>
|
747 |
|
748 |
<?php
|
749 |
|
750 |
-
|
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 |
-
|
|
|
766 |
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
|
775 |
-
|
776 |
-
|
777 |
|
778 |
|
779 |
-
|
780 |
-
|
781 |
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
|
786 |
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
|
797 |
|
798 |
-
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
-
|
804 |
?>
|
805 |
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
|
815 |
|
816 |
?>
|
817 |
-
|
|
|
|
|
|
|
|
|
818 |
<?php
|
819 |
-
|
820 |
?>
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
?>
|
825 |
-
<div class="button select-reset"><?php echo __('Reset', $this->textdomain); ?></div><br>
|
826 |
-
<?php
|
827 |
-
endif;
|
828 |
-
?>
|
829 |
|
830 |
<?php
|
831 |
|
832 |
-
|
833 |
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
}
|
838 |
|
839 |
-
|
|
|
840 |
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
|
849 |
-
|
850 |
-
|
851 |
|
852 |
|
853 |
-
|
854 |
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
|
865 |
-
|
866 |
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
|
871 |
-
|
872 |
|
873 |
-
|
874 |
|
875 |
-
|
876 |
|
877 |
-
|
878 |
|
879 |
|
880 |
-
|
881 |
?>
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
|
892 |
?>
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
<?php
|
899 |
|
900 |
-
|
901 |
|
902 |
-
|
|
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
-
|
|
|
909 |
|
|
|
|
|
|
|
|
|
910 |
|
|
|
|
|
911 |
|
|
|
912 |
|
|
|
|
|
|
|
913 |
|
914 |
-
public function field_text_multi( $option ){
|
915 |
|
916 |
-
|
917 |
-
|
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 |
-
|
|
|
925 |
|
926 |
-
|
927 |
-
|
928 |
-
|
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 |
-
|
936 |
-
|
|
|
937 |
|
938 |
-
if($is_pro == true){
|
939 |
-
$details = '<span class="pro-feature">'.$pro_text.'</span> '.$details;
|
940 |
-
}
|
941 |
|
942 |
-
|
|
|
|
|
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); ?>[]"
|
957 |
-
|
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 |
-
|
977 |
-
|
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 |
-
|
1004 |
-
|
1005 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1006 |
|
1007 |
-
|
|
|
1008 |
|
1009 |
-
|
|
|
1010 |
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
|
1019 |
-
|
1020 |
-
|
1021 |
|
1022 |
-
|
1023 |
|
1024 |
-
|
1025 |
-
|
1026 |
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
|
1031 |
-
|
1032 |
|
1033 |
|
1034 |
-
|
1035 |
?>
|
1036 |
-
|
1037 |
<?php
|
1038 |
|
1039 |
-
|
1040 |
-
|
1041 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1042 |
|
1043 |
-
|
|
|
1044 |
|
1045 |
|
1046 |
-
|
|
|
1047 |
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
|
1056 |
-
|
1057 |
-
|
1058 |
|
1059 |
-
|
1060 |
|
1061 |
-
|
1062 |
-
|
1063 |
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
|
1068 |
-
|
1069 |
|
1070 |
|
1071 |
-
|
1072 |
?>
|
1073 |
-
|
1074 |
<?php
|
1075 |
|
1076 |
-
|
1077 |
|
1078 |
-
|
1079 |
-
|
1080 |
-
}
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
-
|
|
|
1087 |
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
|
1096 |
-
|
1097 |
-
|
1098 |
|
1099 |
-
|
1100 |
|
1101 |
-
|
1102 |
-
|
1103 |
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
|
1108 |
-
|
1109 |
|
1110 |
|
1111 |
-
|
1112 |
?>
|
1113 |
-
|
1114 |
<?php
|
1115 |
|
1116 |
-
|
1117 |
|
1118 |
-
|
|
|
1119 |
|
1120 |
-
}
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
-
|
1127 |
|
1128 |
|
1129 |
-
|
|
|
1130 |
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
|
1139 |
|
1140 |
|
1141 |
-
|
1142 |
-
|
1143 |
|
1144 |
-
|
1145 |
|
1146 |
-
|
1147 |
-
|
1148 |
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
|
1153 |
-
|
1154 |
|
1155 |
-
|
1156 |
|
1157 |
-
|
1158 |
|
1159 |
?>
|
1160 |
-
|
1161 |
field-wp_editor-wrapper-<?php echo esc_attr($id); ?>">
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
|
1168 |
<?php
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
-
|
1174 |
-
|
1175 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1176 |
|
1177 |
-
|
|
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
-
|
|
|
1185 |
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
|
1194 |
-
|
1195 |
-
|
1196 |
|
1197 |
-
|
1198 |
-
|
1199 |
|
1200 |
-
|
1201 |
|
1202 |
-
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
-
|
1208 |
?>
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
|
|
|
|
1233 |
})
|
1234 |
-
|
1235 |
-
</script>
|
1236 |
<?php
|
1237 |
|
1238 |
-
|
1239 |
-
|
1240 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1241 |
|
1242 |
-
|
|
|
1243 |
|
1244 |
|
1245 |
|
1246 |
-
|
|
|
1247 |
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
|
1253 |
-
|
1254 |
-
|
1255 |
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
|
1260 |
-
|
1261 |
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
|
1266 |
-
|
1267 |
-
|
1268 |
|
1269 |
-
|
1270 |
|
1271 |
|
1272 |
-
|
1273 |
?>
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
|
|
1285 |
})
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
<?php
|
1300 |
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
|
1305 |
|
1306 |
|
1307 |
-
|
|
|
1308 |
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
|
1318 |
-
|
1319 |
-
|
1320 |
|
1321 |
-
|
1322 |
-
|
1323 |
|
1324 |
-
|
1325 |
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
|
1330 |
|
1331 |
-
|
1332 |
?>
|
1333 |
-
|
1334 |
<?php
|
1335 |
|
1336 |
-
|
1337 |
-
|
1338 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1339 |
|
1340 |
-
|
|
|
1341 |
|
1342 |
|
1343 |
|
1344 |
-
|
|
|
1345 |
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
|
1355 |
-
|
1356 |
-
|
1357 |
|
1358 |
-
|
1359 |
-
|
1360 |
|
1361 |
-
|
1362 |
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
|
1367 |
|
1368 |
-
|
1369 |
?>
|
1370 |
-
|
1371 |
<?php
|
1372 |
|
1373 |
-
|
1374 |
|
1375 |
-
|
1376 |
-
|
1377 |
-
}
|
1378 |
|
1379 |
|
1380 |
|
1381 |
-
|
|
|
1382 |
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
|
1392 |
-
|
1393 |
-
|
1394 |
|
1395 |
-
|
1396 |
-
|
1397 |
|
1398 |
-
|
1399 |
|
1400 |
-
|
1401 |
-
|
1402 |
|
1403 |
|
1404 |
-
|
1405 |
?>
|
1406 |
-
|
1407 |
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
<?php
|
1414 |
|
1415 |
-
|
1416 |
-
|
1417 |
-
echo (sprintf($field_template, $title, $input_html, $details));
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
}
|
1423 |
-
|
1424 |
|
1425 |
-
|
|
|
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 |
-
|
1432 |
-
|
1433 |
-
$value = isset( $option['value'] ) ? $option['value'] : '';
|
1434 |
-
$default = isset( $option['default'] ) ? $option['default'] : '';
|
1435 |
-
$value = !empty($value) ? $value : $default;
|
1436 |
|
1437 |
-
|
1438 |
-
|
|
|
1439 |
|
1440 |
-
|
1441 |
-
|
|
|
|
|
|
|
1442 |
|
1443 |
-
|
1444 |
-
|
1445 |
|
1446 |
-
|
1447 |
-
|
1448 |
|
1449 |
-
|
|
|
1450 |
|
1451 |
-
|
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 |
-
|
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 |
-
|
|
|
1468 |
<?php
|
1469 |
|
1470 |
-
|
1471 |
|
1472 |
-
|
1473 |
-
|
1474 |
-
}
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
-
|
|
|
1481 |
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
|
1489 |
-
|
1490 |
-
|
1491 |
|
1492 |
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
|
1497 |
-
|
1498 |
|
1499 |
|
1500 |
|
1501 |
?>
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
|
1507 |
|
1508 |
|
1509 |
-
|
1510 |
-
|
1511 |
|
1512 |
|
1513 |
-
|
1514 |
-
|
1515 |
|
1516 |
-
|
1517 |
|
1518 |
|
1519 |
-
|
1520 |
-
<label for='<?php echo esc_attr($for)
|
1521 |
|
1522 |
<?php
|
1523 |
|
1524 |
-
|
1525 |
-
|
1526 |
<br>
|
1527 |
-
|
1528 |
-
|
1529 |
|
1530 |
-
|
1531 |
|
1532 |
-
|
1533 |
-
|
|
|
1534 |
</div>
|
1535 |
-
|
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 |
-
|
1555 |
-
|
1556 |
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
|
|
|
|
|
|
|
|
|
|
1560 |
|
1561 |
-
|
|
|
1562 |
|
|
|
|
|
|
|
1563 |
|
1564 |
-
|
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 |
-
|
1574 |
-
endforeach;
|
1575 |
|
1576 |
-
|
|
|
|
|
|
|
|
|
|
|
1577 |
|
1578 |
-
|
|
|
1579 |
|
|
|
1580 |
|
1581 |
-
|
|
|
1582 |
|
1583 |
|
1584 |
|
1585 |
-
|
|
|
1586 |
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
|
1597 |
-
|
1598 |
-
|
1599 |
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
|
1604 |
-
|
1605 |
|
1606 |
-
|
1607 |
|
1608 |
-
|
1609 |
|
1610 |
|
1611 |
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
|
1625 |
-
|
1626 |
|
1627 |
-
|
1628 |
|
1629 |
?>
|
1630 |
-
|
1631 |
-
|
1632 |
|
1633 |
-
|
1634 |
-
|
1635 |
|
1636 |
?>
|
1637 |
-
|
1638 |
-
|
1639 |
|
1640 |
<?php
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
|
1653 |
-
|
1654 |
-
|
1655 |
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
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 |
-
|
1672 |
-
|
1673 |
-
}
|
1674 |
|
1675 |
-
|
1676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1677 |
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
opacity: .3;
|
1682 |
-
}
|
1683 |
|
1684 |
-
|
1685 |
-
|
1686 |
-
position: absolute;
|
1687 |
-
top: 50%;
|
1688 |
-
left: 50%;
|
1689 |
-
transform: translate(-50%,-50%);
|
1690 |
-
padding: 0 10px;
|
1691 |
|
1692 |
-
|
1693 |
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
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 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1712 |
|
1713 |
-
|
1714 |
-
width: 100%;
|
1715 |
-
}
|
1716 |
|
1717 |
-
</style>
|
1718 |
-
<?php
|
1719 |
|
1720 |
-
|
|
|
|
|
1721 |
|
1722 |
-
|
1723 |
|
|
|
|
|
|
|
|
|
|
|
1724 |
|
1725 |
-
|
1726 |
|
1727 |
-
|
|
|
|
|
|
|
|
|
1728 |
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
|
1736 |
-
|
1737 |
-
|
1738 |
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
|
1743 |
-
|
1744 |
-
|
1745 |
|
1746 |
-
|
1747 |
|
1748 |
|
1749 |
-
|
1750 |
-
|
1751 |
|
1752 |
-
|
1753 |
?>
|
1754 |
-
|
1755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1756 |
<?php
|
1757 |
|
1758 |
-
|
1759 |
|
1760 |
-
|
1761 |
-
|
1762 |
|
1763 |
|
1764 |
|
1765 |
-
|
|
|
1766 |
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
|
1773 |
-
|
1774 |
-
|
1775 |
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
|
1780 |
-
|
1781 |
-
|
1782 |
|
1783 |
-
|
1784 |
|
1785 |
-
|
1786 |
?>
|
1787 |
-
|
1788 |
-
|
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 |
-
|
1809 |
-
$default = isset( $option['default'] ) ? $option['default'] : '';
|
1810 |
-
$value = !empty($value) ? $value : $default;
|
1811 |
|
1812 |
-
|
1813 |
-
|
1814 |
|
1815 |
-
$field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
|
1816 |
|
|
|
|
|
1817 |
|
|
|
|
|
|
|
|
|
|
|
1818 |
|
1819 |
-
//echo '<pre>'.var_export($args, true).'</pre>';
|
1820 |
|
1821 |
-
|
|
|
1822 |
|
1823 |
-
|
|
|
|
|
1824 |
|
1825 |
-
|
|
|
1826 |
|
1827 |
-
|
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 |
-
|
1838 |
-
endforeach;
|
1839 |
|
1840 |
-
|
1841 |
|
|
|
1842 |
|
1843 |
-
|
1844 |
|
1845 |
-
|
1846 |
-
}
|
1847 |
|
1848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1849 |
|
1850 |
-
|
|
|
1851 |
|
1852 |
-
|
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 |
-
|
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.
|
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 (
|
14 |
|
15 |
-
if(
|
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.
|
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(
|
152 |
-
wp_register_style(
|
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(
|
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'
|
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(
|
|
|
|
|
|
|
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:
|
7 |
-
Stable tag: 2.1.
|
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 |
|