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