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