Version Description
- Updated Email Notifications settings design
- Updated add custom shipping provider design
- Fixed issue of Hebrew shipping provider not added in orders
- Added DHL Logistics Shipping provider as a default shipping provider
- Fixed bulk upload issue - if shipped date is null than it will take current date
- Added functionality for add multiple tracked into bulk upload for single order
- Setup tracking info display customizer with live preview in email
- Setup funvctionality for show Tracking Info only in completed order
Download this release
Release Info
Developer | zorem |
Plugin | Advanced Shipment Tracking for WooCommerce |
Version | 1.9.6 |
Comparing to | |
See all releases |
Code changes from version 1.9.5 to 1.9.6
- assets/css/admin.css +31 -71
- assets/css/customizer-styles.css +59 -0
- assets/css/customizer.css +623 -0
- assets/js/customizer-scripts.js +55 -0
- assets/js/customizer.js +607 -0
- assets/js/preview-scripts.js +122 -0
- assets/js/shipping_row.js +27 -3
- assets/shipment-provider-img/dhl-logistics.png +0 -0
- includes/class-wc-advanced-shipment-tracking-admin.php +78 -233
- includes/customizer/class-wc-tracking-info-customizer.php +739 -0
- includes/customizer/custom-controls.php +1076 -0
- includes/customizer/preview.php +30 -0
- includes/email-manager.php +25 -19
- includes/emails/class-shipment-delivered-email.php +3 -3
- readme.txt +20 -3
- templates/emails/tracking-info.php +49 -27
- templates/myaccount/view-order.php +25 -19
- woocommerce-advanced-shipment-tracking.php +87 -17
assets/css/admin.css
CHANGED
@@ -563,7 +563,8 @@ td.column-columnname.url-column {
|
|
563 |
background: rgba(255, 255, 255, 0.5);
|
564 |
margin-top: -1px;
|
565 |
overflow: hidden;
|
566 |
-
height: 0px
|
|
|
567 |
position: relative;
|
568 |
z-index: 10;
|
569 |
-webkit-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
@@ -572,14 +573,6 @@ td.column-columnname.url-column {
|
|
572 |
-ms-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
573 |
transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
574 |
}
|
575 |
-
.ac-container article table.form-table{
|
576 |
-
width: 65%;
|
577 |
-
float: left;
|
578 |
-
}
|
579 |
-
.ac-container article .variable_div {
|
580 |
-
width: 30%;
|
581 |
-
float: right;
|
582 |
-
}
|
583 |
.ac-container input:checked ~ article{
|
584 |
-webkit-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
|
585 |
-moz-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
|
@@ -589,8 +582,9 @@ td.column-columnname.url-column {
|
|
589 |
box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.3);
|
590 |
}
|
591 |
.ac-container input:checked ~ article.ac-small{
|
592 |
-
height: 880px
|
593 |
overflow: auto;
|
|
|
594 |
}
|
595 |
.ac-container table.form-table td input[type=text]{
|
596 |
width: 100%;
|
@@ -638,6 +632,7 @@ td.column-columnname.url-column {
|
|
638 |
background: #f5f5f5;
|
639 |
border-radius: 15px;
|
640 |
font-size: 12px;
|
|
|
641 |
}
|
642 |
.variable_div div.variable_tag span.copy{
|
643 |
color: #fff;
|
@@ -667,14 +662,6 @@ td.column-columnname.url-column {
|
|
667 |
.hide_default,.wp-core-ui .button-primary.hide_default{
|
668 |
display:none;
|
669 |
}
|
670 |
-
#add_new_status_email_form .form-table{
|
671 |
-
width: 65%;
|
672 |
-
float: left;
|
673 |
-
}
|
674 |
-
#add_new_status_email_form .variable_div{
|
675 |
-
width: 30%;
|
676 |
-
float: right;
|
677 |
-
}
|
678 |
.woocommerce #add_new_status_email_form table.form-table select{
|
679 |
width:100%;
|
680 |
}
|
@@ -718,45 +705,28 @@ span.email_status_span i.enable{
|
|
718 |
.woocommerce .zorem_admin_layout table.form-table th{
|
719 |
width: 30%;
|
720 |
}
|
721 |
-
.
|
722 |
-
|
723 |
-
padding: 12px;
|
724 |
}
|
725 |
-
|
726 |
-
|
|
|
|
|
727 |
}
|
728 |
-
|
729 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
}
|
731 |
-
@media screen and (max-width: 1260px) and (min-width: 1151px){
|
732 |
-
.ac-container article .variable_div{
|
733 |
-
display:none;
|
734 |
-
}
|
735 |
-
#add_new_status_email_form .variable_div{
|
736 |
-
display:none !important;
|
737 |
-
}
|
738 |
-
.ac-container article .variable_div.variable_before_content{
|
739 |
-
display:block;
|
740 |
-
}
|
741 |
-
#add_new_status_email_form .variable_div.variable_before_content{
|
742 |
-
display:block !important;
|
743 |
-
}
|
744 |
-
.ac-container article .variable_div.variable_before_content{
|
745 |
-
width: 625px;
|
746 |
-
float: none;
|
747 |
-
padding: 12px;
|
748 |
-
}
|
749 |
-
#add_new_status_email_form .variable_div.variable_before_content{
|
750 |
-
width: 625px;
|
751 |
-
float: none;
|
752 |
-
}
|
753 |
-
.ac-small .form-table .wp-editor-wrap,#add_new_status_email_form .form-table .wp-editor-wrap{
|
754 |
-
width: 625px;
|
755 |
-
}
|
756 |
-
.ac-container input:checked ~ article.ac-small{
|
757 |
-
height: 990px;
|
758 |
-
}
|
759 |
-
}
|
760 |
@media screen and (max-width: 1150px) {
|
761 |
.zorem_admin_layout {
|
762 |
display: block;
|
@@ -764,26 +734,16 @@ span.email_status_span i.enable{
|
|
764 |
.zorem_admin_sidebar {
|
765 |
width: auto;
|
766 |
display: block;
|
|
|
|
|
|
|
|
|
|
|
767 |
}
|
768 |
-
#add_new_status_email_form .
|
769 |
-
|
770 |
-
}
|
771 |
-
#add_new_status_email_form .variable_div.variable_before_content{
|
772 |
-
display:block !important;
|
773 |
-
}
|
774 |
-
.ac-container article .variable_div.variable_before_content{
|
775 |
-
display:block;
|
776 |
-
}
|
777 |
-
.ac-container article .variable_div.variable_before_content,#add_new_status_email_form .variable_div.variable_before_content{
|
778 |
-
width: 625px;
|
779 |
-
float: none;
|
780 |
-
padding: 12px;
|
781 |
-
}
|
782 |
-
.ac-small .form-table .wp-editor-wrap,#add_new_status_email_form .form-table .wp-editor-wrap{
|
783 |
-
width: 625px;
|
784 |
}
|
785 |
}
|
786 |
-
|
787 |
@media screen and (max-width: 650px) {
|
788 |
label.tab_label:before {
|
789 |
margin: 0;
|
563 |
background: rgba(255, 255, 255, 0.5);
|
564 |
margin-top: -1px;
|
565 |
overflow: hidden;
|
566 |
+
/*height: 0px;*/
|
567 |
+
display:none;
|
568 |
position: relative;
|
569 |
z-index: 10;
|
570 |
-webkit-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
573 |
-ms-transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
574 |
transition: height 0.3s ease-in-out, box-shadow 0.6s linear;
|
575 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
.ac-container input:checked ~ article{
|
577 |
-webkit-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
|
578 |
-moz-transition: height 0.5s ease-in-out, box-shadow 0.1s linear;
|
582 |
box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.3);
|
583 |
}
|
584 |
.ac-container input:checked ~ article.ac-small{
|
585 |
+
/*height: 880px;*/
|
586 |
overflow: auto;
|
587 |
+
display:block;
|
588 |
}
|
589 |
.ac-container table.form-table td input[type=text]{
|
590 |
width: 100%;
|
632 |
background: #f5f5f5;
|
633 |
border-radius: 15px;
|
634 |
font-size: 12px;
|
635 |
+
text-align:center;
|
636 |
}
|
637 |
.variable_div div.variable_tag span.copy{
|
638 |
color: #fff;
|
662 |
.hide_default,.wp-core-ui .button-primary.hide_default{
|
663 |
display:none;
|
664 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
.woocommerce #add_new_status_email_form table.form-table select{
|
666 |
width:100%;
|
667 |
}
|
705 |
.woocommerce .zorem_admin_layout table.form-table th{
|
706 |
width: 30%;
|
707 |
}
|
708 |
+
.woocommerce .zorem_admin_layout #content5 table.form-table th{
|
709 |
+
width:200px;
|
|
|
710 |
}
|
711 |
+
|
712 |
+
|
713 |
+
.shipping_provider_table .tr_add input[type=text]{
|
714 |
+
width: 50%;
|
715 |
}
|
716 |
+
.shipping_provider_table .tr_add .select2-container{
|
717 |
+
width: 50% !important;
|
718 |
+
}
|
719 |
+
.provider_tr.tr_add td:last-child{
|
720 |
+
text-align: left;
|
721 |
+
}
|
722 |
+
.shipping_provider_table a.remove{
|
723 |
+
line-height: 32px;
|
724 |
+
}
|
725 |
+
@media screen and (max-width: 780px) {
|
726 |
+
.woocommerce .zorem_admin_layout #content5 table.form-table th{
|
727 |
+
width:100%;
|
728 |
+
}
|
729 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
@media screen and (max-width: 1150px) {
|
731 |
.zorem_admin_layout {
|
732 |
display: block;
|
734 |
.zorem_admin_sidebar {
|
735 |
width: auto;
|
736 |
display: block;
|
737 |
+
}
|
738 |
+
}
|
739 |
+
@media screen and (min-width: 1000px) {
|
740 |
+
.woocommerce #add_new_status_email_form table.form-table input[type=text],.ac-container table.form-table td input[type=text]{
|
741 |
+
width: 60%;
|
742 |
}
|
743 |
+
.woocommerce #add_new_status_email_form table.form-table select,.ac-container table.form-table td select{
|
744 |
+
width: 60%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
}
|
746 |
}
|
|
|
747 |
@media screen and (max-width: 650px) {
|
748 |
label.tab_label:before {
|
749 |
margin: 0;
|
assets/css/customizer-styles.css
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#accordion-section-default_controls_section>h3:before{
|
2 |
+
font-family: 'Dashicons';
|
3 |
+
font-size: 20px;
|
4 |
+
font-weight: thin !important;
|
5 |
+
position: relative;
|
6 |
+
line-height: 0;
|
7 |
+
vertical-align: middle;
|
8 |
+
opacity: .6;
|
9 |
+
top: -1px;
|
10 |
+
content: "\f230";
|
11 |
+
}
|
12 |
+
|
13 |
+
/* Mobile preview */
|
14 |
+
.preview-mobile #customize-preview iframe {
|
15 |
+
width:606px;
|
16 |
+
height: 1500px;
|
17 |
+
-ms-transform: scale(0.50);
|
18 |
+
-moz-transform: scale(0.50);
|
19 |
+
-o-transform: scale(0.50);
|
20 |
+
-webkit-transform: scale(0.50);
|
21 |
+
transform: scale(0.50);
|
22 |
+
-ms-transform-origin: 0 0;
|
23 |
+
-moz-transform-origin: 0 0;
|
24 |
+
-o-transform-origin: 0 0;
|
25 |
+
-webkit-transform-origin: 0 0;
|
26 |
+
transform-origin: 0 0;
|
27 |
+
}
|
28 |
+
.preview-mobile .wp-full-overlay-main {
|
29 |
+
overflow-y:scroll;
|
30 |
+
overflow-x:auto;
|
31 |
+
}
|
32 |
+
|
33 |
+
/* Template Control */
|
34 |
+
.customize-control-kwdtemplateload .image-radio-select label {
|
35 |
+
display: block;
|
36 |
+
height: auto;
|
37 |
+
float: none;
|
38 |
+
width: 100%;
|
39 |
+
margin-bottom: 8px;
|
40 |
+
padding: 8px 8px 0;
|
41 |
+
box-shadow: none;
|
42 |
+
box-sizing: border-box;
|
43 |
+
}
|
44 |
+
#customize-controls .customize-control-kwdtemplateload label img {
|
45 |
+
border: 4px solid #ccc;
|
46 |
+
box-sizing: border-box;
|
47 |
+
cursor: pointer;
|
48 |
+
height: auto;
|
49 |
+
max-width: 100%;
|
50 |
+
padding: 1px;
|
51 |
+
}
|
52 |
+
#customize-controls .customize-control-kwdtemplateload label.ktactive img {
|
53 |
+
border-color: #00a0d2;
|
54 |
+
}
|
55 |
+
.customize-control-kwdtemplateload .kt-template-woomail-load-controls:after {
|
56 |
+
clear: both;
|
57 |
+
display: table;
|
58 |
+
content: '';
|
59 |
+
}
|
assets/css/customizer.css
ADDED
@@ -0,0 +1,623 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ==========================================================================
|
2 |
+
CSS for Customizer Custom Controls
|
3 |
+
========================================================================== */
|
4 |
+
|
5 |
+
/* ==========================================================================
|
6 |
+
Standard Selection
|
7 |
+
========================================================================== */
|
8 |
+
.customize-control select,
|
9 |
+
.select2-container--default .selection .select2-selection--single {
|
10 |
+
border: none;
|
11 |
+
background: #fcfcff;
|
12 |
+
position: relative;
|
13 |
+
border-radius: 0;
|
14 |
+
height: 27px;
|
15 |
+
line-height: 27px;
|
16 |
+
outline: none;
|
17 |
+
-webkit-box-shadow: none;
|
18 |
+
box-shadow: none;
|
19 |
+
}
|
20 |
+
|
21 |
+
.wp-customizer .select2-container--default .selection .select2-selection--multiple {
|
22 |
+
border: none;
|
23 |
+
background: #fcfcff;
|
24 |
+
border-radius: 0;
|
25 |
+
height: auto;
|
26 |
+
outline: none;
|
27 |
+
-webkit-box-shadow: none;
|
28 |
+
box-shadow: none;
|
29 |
+
}
|
30 |
+
|
31 |
+
.wp-customizer .select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
32 |
+
width: 95%;
|
33 |
+
}
|
34 |
+
|
35 |
+
.wp-customizer .select2-container--default .select2-selection--multiple .select2-selection__clear {
|
36 |
+
position: absolute;
|
37 |
+
right: 0;
|
38 |
+
}
|
39 |
+
|
40 |
+
.wp-customizer .select2-container .select2-dropdown {
|
41 |
+
z-index: 900000;
|
42 |
+
}
|
43 |
+
|
44 |
+
.customize-control select:active,
|
45 |
+
.customize-control select:focus {
|
46 |
+
outline: none;
|
47 |
+
-webkit-box-shadow: none;
|
48 |
+
box-shadow: none;
|
49 |
+
}
|
50 |
+
|
51 |
+
/* ==========================================================================
|
52 |
+
Standard Input
|
53 |
+
========================================================================== */
|
54 |
+
input[type="text"],
|
55 |
+
input[type="number"],
|
56 |
+
input[type="url"],
|
57 |
+
input[type="email"],
|
58 |
+
input[type="date"] {
|
59 |
+
background: #fcfcff;
|
60 |
+
position: relative;
|
61 |
+
border-radius: 0;
|
62 |
+
border: 1px solid #eee;
|
63 |
+
height: 27px;
|
64 |
+
line-height: 27px;
|
65 |
+
outline: none;
|
66 |
+
-webkit-box-shadow: none;
|
67 |
+
box-shadow: none;
|
68 |
+
}
|
69 |
+
|
70 |
+
input[type="text"]:active,
|
71 |
+
input[type="text"]:focus,
|
72 |
+
input[type="number"]:active,
|
73 |
+
input[type="number"]:focus {
|
74 |
+
outline: none;
|
75 |
+
-webkit-box-shadow: none;
|
76 |
+
box-shadow: none;
|
77 |
+
}
|
78 |
+
|
79 |
+
/* ==========================================================================
|
80 |
+
Simple Notice
|
81 |
+
========================================================================== */
|
82 |
+
|
83 |
+
.simple-notice-custom-control .customize-control-description {
|
84 |
+
line-height: 1.6
|
85 |
+
}
|
86 |
+
|
87 |
+
.simple-notice-custom-control code {
|
88 |
+
font-size: 90%;
|
89 |
+
padding: 2px 4px;
|
90 |
+
}
|
91 |
+
|
92 |
+
/* ==========================================================================
|
93 |
+
Textarea/TinyMCE
|
94 |
+
========================================================================== */
|
95 |
+
.tinymce-control textarea {
|
96 |
+
width: 100%;
|
97 |
+
padding: 10px;
|
98 |
+
}
|
99 |
+
|
100 |
+
/* ==========================================================================
|
101 |
+
Text Radio Buttons
|
102 |
+
========================================================================== */
|
103 |
+
.text_radio_button_control:after {
|
104 |
+
content: " ";
|
105 |
+
display: block;
|
106 |
+
clear: both;
|
107 |
+
}
|
108 |
+
.text_radio_button_control .radio-buttons {
|
109 |
+
display: inline-block;
|
110 |
+
border: 1px solid #f9f9fe;
|
111 |
+
}
|
112 |
+
.text_radio_button_control .radio-button-label {
|
113 |
+
cursor: pointer;
|
114 |
+
float: left;
|
115 |
+
}
|
116 |
+
.text_radio_button_control .radio-button-label > input {
|
117 |
+
display: none;
|
118 |
+
}
|
119 |
+
.text_radio_button_control .radio-button-label span {
|
120 |
+
cursor: pointer;
|
121 |
+
font-weight: 500;
|
122 |
+
border: 2px solid #f9f9fe;
|
123 |
+
margin: 0;
|
124 |
+
background-color: #eee;
|
125 |
+
padding: 5px 15px;
|
126 |
+
display: inline-block;
|
127 |
+
}
|
128 |
+
.text_radio_button_control .radio-button-label span:hover {
|
129 |
+
background-color: rgba(255, 255, 255, .2);
|
130 |
+
color: #2885bb;
|
131 |
+
}
|
132 |
+
.text_radio_button_control .radio-button-label > input:checked + span {
|
133 |
+
background-color: #2084bd;
|
134 |
+
color: #fff;
|
135 |
+
}
|
136 |
+
.text_radio_button_control .radio-button-label > input:checked + span:hover {
|
137 |
+
color: #fff;
|
138 |
+
}
|
139 |
+
|
140 |
+
/* ==========================================================================
|
141 |
+
Image Radio Buttons
|
142 |
+
========================================================================== */
|
143 |
+
.image_radio_button_control .radio-button-label > input {
|
144 |
+
display: none;
|
145 |
+
}
|
146 |
+
.image_radio_button_control .radio-button-label > img {
|
147 |
+
cursor: pointer;
|
148 |
+
border: 3px solid #ddd;
|
149 |
+
}
|
150 |
+
.image_radio_button_control .radio-button-label > input:checked + img {
|
151 |
+
border: 3px solid #2885bb;
|
152 |
+
}
|
153 |
+
|
154 |
+
/* ==========================================================================
|
155 |
+
Image Checkboxes
|
156 |
+
========================================================================== */
|
157 |
+
.image_checkbox_control .checkbox-label > input {
|
158 |
+
display: none;
|
159 |
+
}
|
160 |
+
.image_checkbox_control .checkbox-label > img {
|
161 |
+
cursor: pointer;
|
162 |
+
border: 3px solid #ddd;
|
163 |
+
}
|
164 |
+
.image_checkbox_control .checkbox-label > input:checked + img {
|
165 |
+
border: 3px solid #2885bb;
|
166 |
+
}
|
167 |
+
|
168 |
+
/* ==========================================================================
|
169 |
+
Slider
|
170 |
+
========================================================================== */
|
171 |
+
.slider-custom-control {
|
172 |
+
margin-bottom: 30px;
|
173 |
+
}
|
174 |
+
.slider-custom-control input[type=number]::-webkit-inner-spin-button,
|
175 |
+
.slider-custom-control input[type=number]::-webkit-outer-spin-button {
|
176 |
+
-webkit-appearance: none;
|
177 |
+
margin: 0;
|
178 |
+
}
|
179 |
+
.slider-custom-control input[type=number] {
|
180 |
+
-moz-appearance: textfield;
|
181 |
+
}
|
182 |
+
.slider-custom-control .customize-control-title {
|
183 |
+
display: inline-block;
|
184 |
+
}
|
185 |
+
.slider-custom-control input[type=number] {
|
186 |
+
width: 45px;
|
187 |
+
float: right;
|
188 |
+
margin: 7px 5px 0px 5px;
|
189 |
+
}
|
190 |
+
.slider-custom-control .slider {
|
191 |
+
width: 70%;
|
192 |
+
float: left;
|
193 |
+
margin: 20px 0 10px;
|
194 |
+
}
|
195 |
+
.slider-custom-control .slider-reset {
|
196 |
+
float: right;
|
197 |
+
cursor: pointer;
|
198 |
+
}
|
199 |
+
.slider-custom-control .slider-value {
|
200 |
+
border: none;
|
201 |
+
text-align: right;
|
202 |
+
width: 50px;
|
203 |
+
margin-right: 5px;
|
204 |
+
}
|
205 |
+
.slider-custom-control .slider-value,
|
206 |
+
.slider-custom-control .slider-unit {
|
207 |
+
float: right;
|
208 |
+
}
|
209 |
+
.slider-custom-control .ui-widget.ui-widget-content {
|
210 |
+
border: 1px solid #f4f4f4;
|
211 |
+
}
|
212 |
+
.slider-custom-control .ui-corner-all,
|
213 |
+
.slider-custom-control .ui-corner-bottom,
|
214 |
+
.slider-custom-control .ui-corner-right,
|
215 |
+
.slider-custom-control .ui-corner-br {
|
216 |
+
border-bottom-right-radius: 3px;
|
217 |
+
}
|
218 |
+
.slider-custom-control .ui-corner-all,
|
219 |
+
.slider-custom-control .ui-corner-bottom,
|
220 |
+
.slider-custom-control .ui-corner-left,
|
221 |
+
.slider-custom-control .ui-corner-bl {
|
222 |
+
border-bottom-left-radius: 3px;
|
223 |
+
}
|
224 |
+
.slider-custom-control .ui-corner-all,
|
225 |
+
.slider-custom-control .ui-corner-top,
|
226 |
+
.slider-custom-control .ui-corner-right,
|
227 |
+
.slider-custom-control .ui-corner-tr {
|
228 |
+
border-top-right-radius: 3px;
|
229 |
+
}
|
230 |
+
.slider-custom-control .ui-corner-all,
|
231 |
+
.slider-custom-control .ui-corner-top,
|
232 |
+
.slider-custom-control .ui-corner-left,
|
233 |
+
.slider-custom-control .ui-corner-tl {
|
234 |
+
border-top-left-radius: 3px;
|
235 |
+
}
|
236 |
+
.slider-custom-control .ui-widget-content {
|
237 |
+
background: #f4f4f4 none repeat scroll 0 0;
|
238 |
+
color: #333;
|
239 |
+
}
|
240 |
+
.slider-custom-control .ui-slider-horizontal {
|
241 |
+
height: 3px;
|
242 |
+
}
|
243 |
+
.slider-custom-control .ui-slider {
|
244 |
+
position: relative;
|
245 |
+
text-align: left;
|
246 |
+
}
|
247 |
+
.slider-custom-control .ui-state-default,
|
248 |
+
.slider-custom-control .ui-widget-content .ui-state-default,
|
249 |
+
.slider-custom-control .ui-widget-header .ui-state-default,
|
250 |
+
.slider-custom-control .ui-button,
|
251 |
+
.slider-custom-control .ui-button.ui-state-disabled:hover,
|
252 |
+
.slider-custom-control .ui-button.ui-state-disabled:active {
|
253 |
+
background: #2885bb none repeat scroll 0 0;
|
254 |
+
border: 1px solid #2885bb;
|
255 |
+
color: #454545;
|
256 |
+
font-weight: normal;
|
257 |
+
}
|
258 |
+
.slider-custom-control .ui-slider-horizontal .ui-slider-handle {
|
259 |
+
margin-left: -7px;
|
260 |
+
top: -7px;
|
261 |
+
border-radius: 50%;
|
262 |
+
}
|
263 |
+
.slider-custom-control .ui-slider .ui-slider-handle {
|
264 |
+
cursor: pointer;
|
265 |
+
height: 14px;
|
266 |
+
position: absolute;
|
267 |
+
width: 14px;
|
268 |
+
z-index: 2;
|
269 |
+
}
|
270 |
+
.slider-custom-control .dashicons-image-rotate {
|
271 |
+
margin-top: 10px;
|
272 |
+
color: #d4d4d4;
|
273 |
+
size: 16px;
|
274 |
+
}
|
275 |
+
.slider-custom-control .dashicons-image-rotate:hover {
|
276 |
+
color: #a7a7a7;
|
277 |
+
}
|
278 |
+
|
279 |
+
/* ==========================================================================
|
280 |
+
Toggle Switch
|
281 |
+
========================================================================== */
|
282 |
+
.toggle-switch-control .customize-control-title {
|
283 |
+
display: inline-block;
|
284 |
+
}
|
285 |
+
|
286 |
+
.toggle-switch {
|
287 |
+
position: relative;
|
288 |
+
width: 64px;
|
289 |
+
-webkit-user-select: none;
|
290 |
+
-moz-user-select: none;
|
291 |
+
-ms-user-select: none;
|
292 |
+
float: right;
|
293 |
+
}
|
294 |
+
|
295 |
+
.toggle-switch .toggle-switch-checkbox {
|
296 |
+
display: none;
|
297 |
+
}
|
298 |
+
|
299 |
+
.toggle-switch .toggle-switch-label {
|
300 |
+
display: block;
|
301 |
+
overflow: hidden;
|
302 |
+
cursor: pointer;
|
303 |
+
border: 2px solid #ddd;
|
304 |
+
border-radius: 20px;
|
305 |
+
padding: 0;
|
306 |
+
margin: 0;
|
307 |
+
}
|
308 |
+
|
309 |
+
.toggle-switch-inner {
|
310 |
+
display: block;
|
311 |
+
width: 200%;
|
312 |
+
margin-left: -100%;
|
313 |
+
transition: margin 0.3s ease-in 0s;
|
314 |
+
}
|
315 |
+
|
316 |
+
.toggle-switch-inner:before,
|
317 |
+
.toggle-switch-inner:after {
|
318 |
+
display: block;
|
319 |
+
float: left;
|
320 |
+
width: 50%;
|
321 |
+
height: 22px;
|
322 |
+
padding: 0;
|
323 |
+
line-height: 22px;
|
324 |
+
font-size: 14px;
|
325 |
+
color: white;
|
326 |
+
font-family: Trebuchet, Arial, sans-serif;
|
327 |
+
font-weight: bold;
|
328 |
+
box-sizing: border-box;
|
329 |
+
}
|
330 |
+
|
331 |
+
.toggle-switch-inner:before {
|
332 |
+
content: "ON";
|
333 |
+
padding-left: 8px;
|
334 |
+
background-color: #2885bb;
|
335 |
+
color: #FFFFFF;
|
336 |
+
}
|
337 |
+
|
338 |
+
.toggle-switch-inner:after {
|
339 |
+
content: "OFF";
|
340 |
+
padding-right: 8px;
|
341 |
+
background-color: #EEEEEE;
|
342 |
+
color: #999999;
|
343 |
+
text-align: right;
|
344 |
+
}
|
345 |
+
|
346 |
+
.toggle-switch-switch {
|
347 |
+
display: block;
|
348 |
+
width: 16px;
|
349 |
+
margin: 3px;
|
350 |
+
background: #FFFFFF;
|
351 |
+
position: absolute;
|
352 |
+
top: 0;
|
353 |
+
bottom: 0;
|
354 |
+
right: 38px;
|
355 |
+
border: 2px solid #ddd;
|
356 |
+
border-radius: 20px;
|
357 |
+
transition: all 0.3s ease-in 0s;
|
358 |
+
}
|
359 |
+
|
360 |
+
.toggle-switch-checkbox:checked + .toggle-switch-label .toggle-switch-inner {
|
361 |
+
margin-left: 0;
|
362 |
+
}
|
363 |
+
|
364 |
+
.toggle-switch-checkbox:checked + .toggle-switch-label .toggle-switch-switch {
|
365 |
+
right: 0px;
|
366 |
+
}
|
367 |
+
|
368 |
+
/* ==========================================================================
|
369 |
+
Sortable Repeater
|
370 |
+
========================================================================== */
|
371 |
+
.sortable {
|
372 |
+
list-style-type: none;
|
373 |
+
margin: 0;
|
374 |
+
padding: 0;
|
375 |
+
}
|
376 |
+
.sortable input[type="text"] {
|
377 |
+
margin: 5px 5px 5px 0;
|
378 |
+
width: 80%;
|
379 |
+
}
|
380 |
+
.sortable div {
|
381 |
+
cursor: move;
|
382 |
+
}
|
383 |
+
.customize-control-sortable-repeater-delete {
|
384 |
+
color: #d4d4d4;
|
385 |
+
}
|
386 |
+
.customize-control-sortable-repeater-delete:hover {
|
387 |
+
color: #f00;
|
388 |
+
}
|
389 |
+
.customize-control-sortable-repeater-delete .dashicons-no-alt {
|
390 |
+
text-decoration: none;
|
391 |
+
margin: 8px 0 0 0;
|
392 |
+
font-weight: 600;
|
393 |
+
}
|
394 |
+
.customize-control-sortable-repeater-delete:active,
|
395 |
+
.customize-control-sortable-repeater-delete:focus {
|
396 |
+
outline: none;
|
397 |
+
-webkit-box-shadow: none;
|
398 |
+
box-shadow: none;
|
399 |
+
}
|
400 |
+
.repeater .dashicons-sort {
|
401 |
+
margin: 8px 5px 0 5px;
|
402 |
+
color: #d4d4d4;
|
403 |
+
}
|
404 |
+
.repeater .dashicons-sort:hover {
|
405 |
+
color: #a7a7a7;
|
406 |
+
}
|
407 |
+
|
408 |
+
/* ==========================================================================
|
409 |
+
Single Accordion
|
410 |
+
========================================================================== */
|
411 |
+
.single-accordion-toggle {
|
412 |
+
font-size: 14px;
|
413 |
+
font-weight: 600;
|
414 |
+
line-height: 24px;
|
415 |
+
padding: 10px 5px 5px 0;
|
416 |
+
cursor: pointer;
|
417 |
+
}
|
418 |
+
.accordion-icon-toggle {
|
419 |
+
font-size: 18px;
|
420 |
+
margin-left: 5px;
|
421 |
+
margin-top: 5px;
|
422 |
+
-webkit-transition: -webkit-transform 0.3s ease-in-out;
|
423 |
+
-moz-transition: -moz-transform 0.3s ease-in-out;
|
424 |
+
-o-transition: -o-transform 0.3s ease-in-out;
|
425 |
+
transition: transform 0.3s ease-in-out;
|
426 |
+
}
|
427 |
+
.single-accordion-toggle-rotate .accordion-icon-toggle {
|
428 |
+
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=-0.5);
|
429 |
+
-webkit-transform: rotate(-45deg);
|
430 |
+
-moz-transform: rotate(-45deg);
|
431 |
+
-ms-transform: rotate(-45deg);
|
432 |
+
-o-transform: rotate(-45deg);
|
433 |
+
transform: rotate(-45deg);
|
434 |
+
display: inline-block;
|
435 |
+
}
|
436 |
+
.single-accordion {
|
437 |
+
display: none;
|
438 |
+
}
|
439 |
+
.single-accordion ul {
|
440 |
+
margin: 0;
|
441 |
+
padding: 0;
|
442 |
+
}
|
443 |
+
.single-accordion li {
|
444 |
+
background-color: #e4e4e4;
|
445 |
+
color: #888;
|
446 |
+
width: 115px;
|
447 |
+
display: inline-block;
|
448 |
+
padding: 5px;
|
449 |
+
margin: 5px;
|
450 |
+
text-align: center;
|
451 |
+
}
|
452 |
+
.single-accordion li i {
|
453 |
+
margin-left: 5px;
|
454 |
+
}
|
455 |
+
|
456 |
+
/* ==========================================================================
|
457 |
+
Alpha Color Picker
|
458 |
+
========================================================================== */
|
459 |
+
.customize-control-alpha-color .wp-picker-container .iris-picker {
|
460 |
+
border-bottom:none;
|
461 |
+
}
|
462 |
+
|
463 |
+
.customize-control-alpha-color .wp-picker-container {
|
464 |
+
max-width: 257px;
|
465 |
+
}
|
466 |
+
|
467 |
+
.customize-control-alpha-color .wp-picker-open + .wp-picker-input-wrap {
|
468 |
+
width: 100%;
|
469 |
+
}
|
470 |
+
|
471 |
+
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
|
472 |
+
float: left;
|
473 |
+
width: 195px;
|
474 |
+
}
|
475 |
+
|
476 |
+
.customize-control-alpha-color .wp-picker-input-wrap .button {
|
477 |
+
margin-left: 0;
|
478 |
+
float: right;
|
479 |
+
}
|
480 |
+
|
481 |
+
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .alpha-color-picker-container {
|
482 |
+
display: block;
|
483 |
+
}
|
484 |
+
|
485 |
+
.alpha-color-picker-container {
|
486 |
+
border: 1px solid #dfdfdf;
|
487 |
+
border-top: none;
|
488 |
+
display: none;
|
489 |
+
background: #FFF;
|
490 |
+
padding: 0 11px 10px;
|
491 |
+
position: relative;
|
492 |
+
}
|
493 |
+
|
494 |
+
.alpha-color-picker-container .ui-widget-content,
|
495 |
+
.alpha-color-picker-container .ui-widget-header,
|
496 |
+
.alpha-color-picker-wrap .ui-state-focus {
|
497 |
+
background: transparent;
|
498 |
+
border: none;
|
499 |
+
}
|
500 |
+
|
501 |
+
.alpha-color-picker-wrap a.iris-square-value:focus {
|
502 |
+
-webkit-box-shadow: none;
|
503 |
+
box-shadow: none;
|
504 |
+
}
|
505 |
+
|
506 |
+
.alpha-color-picker-container .ui-slider {
|
507 |
+
position: relative;
|
508 |
+
z-index: 1;
|
509 |
+
height: 24px;
|
510 |
+
text-align: center;
|
511 |
+
margin: 0 auto;
|
512 |
+
width: 88%;
|
513 |
+
width: calc( 100% - 28px );
|
514 |
+
}
|
515 |
+
|
516 |
+
.alpha-color-picker-container .ui-slider-handle,
|
517 |
+
.alpha-color-picker-container .ui-widget-content .ui-state-default {
|
518 |
+
color: #777;
|
519 |
+
background-color: #FFF;
|
520 |
+
text-shadow: 0 1px 0 #FFF;
|
521 |
+
text-decoration: none;
|
522 |
+
position: absolute;
|
523 |
+
z-index: 2;
|
524 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
|
525 |
+
border: 1px solid #aaa;
|
526 |
+
-webkit-border-radius: 4px;
|
527 |
+
-moz-border-radius: 4px;
|
528 |
+
border-radius: 4px;
|
529 |
+
margin-top: -2px;
|
530 |
+
top: 0;
|
531 |
+
height: 26px;
|
532 |
+
width: 26px;
|
533 |
+
cursor: ew-resize;
|
534 |
+
font-size: 0;
|
535 |
+
padding: 0;
|
536 |
+
line-height: 27px;
|
537 |
+
margin-left: -14px;
|
538 |
+
}
|
539 |
+
|
540 |
+
.alpha-color-picker-container .ui-slider-handle.show-opacity {
|
541 |
+
font-size: 12px;
|
542 |
+
}
|
543 |
+
|
544 |
+
.alpha-color-picker-container .click-zone {
|
545 |
+
width: 14px;
|
546 |
+
height: 24px;
|
547 |
+
display: block;
|
548 |
+
position: absolute;
|
549 |
+
left: 10px;
|
550 |
+
}
|
551 |
+
|
552 |
+
.alpha-color-picker-container .max-click-zone {
|
553 |
+
right: 10px;
|
554 |
+
left: auto;
|
555 |
+
}
|
556 |
+
|
557 |
+
.alpha-color-picker-container .transparency {
|
558 |
+
height: 24px;
|
559 |
+
width: 100%;
|
560 |
+
background-color: #FFF;
|
561 |
+
background-image: url(../images/color-picker-transparency-grid.png);
|
562 |
+
box-shadow: 0 0 5px rgba(0,0,0,0.4) inset;
|
563 |
+
-webkit-border-radius: 3px;
|
564 |
+
-moz-border-radius: 3px;
|
565 |
+
border-radius: 3px;
|
566 |
+
padding: 0;
|
567 |
+
margin-top: -24px;
|
568 |
+
}
|
569 |
+
|
570 |
+
@media only screen and (max-width: 782px) {
|
571 |
+
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
|
572 |
+
width: 184px;
|
573 |
+
}
|
574 |
+
}
|
575 |
+
|
576 |
+
@media only screen and (max-width: 640px) {
|
577 |
+
.customize-control-alpha-color .wp-picker-input-wrap input[type="text"].wp-color-picker.alpha-color-control {
|
578 |
+
width: 172px;
|
579 |
+
height: 33px;
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
/* ==========================================================================
|
584 |
+
Alpha Color Picker & Standard Color Picker
|
585 |
+
========================================================================== */
|
586 |
+
.customize-control-color .wp-color-result,
|
587 |
+
.customize-control-alpha-color .wp-color-result {
|
588 |
+
border: none;
|
589 |
+
box-shadow: none;
|
590 |
+
}
|
591 |
+
|
592 |
+
.customize-control-color .wp-color-result:after,
|
593 |
+
.customize-control-alpha-color .wp-color-result:after {
|
594 |
+
border: none;
|
595 |
+
}
|
596 |
+
|
597 |
+
.customize-control-color .wp-color-result .wp-color-result-text,
|
598 |
+
.customize-control-alpha-color .wp-color-result .wp-color-result-text {
|
599 |
+
line-height: 24px;
|
600 |
+
border-left: none;
|
601 |
+
}
|
602 |
+
|
603 |
+
.wp-picker-holder .iris-picker .iris-palette {
|
604 |
+
box-shadow: none;
|
605 |
+
}
|
606 |
+
|
607 |
+
.wp-picker-container .iris-picker,
|
608 |
+
.wp-picker-container .alpha-color-picker-container {
|
609 |
+
border-radius: 0;
|
610 |
+
border: none;
|
611 |
+
}
|
612 |
+
|
613 |
+
.wp-picker-container .alpha-color-picker-container {
|
614 |
+
width: 233px;
|
615 |
+
}
|
616 |
+
|
617 |
+
/* ==========================================================================
|
618 |
+
Google Fonts Select
|
619 |
+
========================================================================== */
|
620 |
+
.google_fonts_select_control .google-fonts,
|
621 |
+
.google_fonts_select_control .weight-style {
|
622 |
+
margin-bottom: 10px;
|
623 |
+
}
|
assets/js/customizer-scripts.js
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Customizer Scripts
|
3 |
+
* Need to rewrite and clean up this file.
|
4 |
+
*/
|
5 |
+
|
6 |
+
jQuery(document).ready(function() {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Change description
|
10 |
+
*/
|
11 |
+
// jQuery('#customize-info .customize-panel-description').html(kt_woomail.labels.description);
|
12 |
+
jQuery('#accordion-section-default_controls_section h3').trigger( "click" );
|
13 |
+
jQuery('#customize-info .panel-title.site-title').html(wcast_customizer.labels.customtitle);
|
14 |
+
jQuery('#customize-theme-controls #accordion-section-themes').hide();
|
15 |
+
|
16 |
+
});
|
17 |
+
// Handle mobile button click
|
18 |
+
function custom_size_mobile() {
|
19 |
+
// get email width.
|
20 |
+
var email_width = '684';
|
21 |
+
var ratio = email_width/304;
|
22 |
+
var framescale = 100/ratio;
|
23 |
+
var framescale = framescale/100;
|
24 |
+
jQuery('#customize-preview iframe').width(email_width+'px');
|
25 |
+
jQuery('#customize-preview iframe').css({
|
26 |
+
'-webkit-transform' : 'scale(' + framescale + ')',
|
27 |
+
'-moz-transform' : 'scale(' + framescale + ')',
|
28 |
+
'-ms-transform' : 'scale(' + framescale + ')',
|
29 |
+
'-o-transform' : 'scale(' + framescale + ')',
|
30 |
+
'transform' : 'scale(' + framescale + ')'
|
31 |
+
});
|
32 |
+
}
|
33 |
+
jQuery('#customize-footer-actions .preview-mobile').click(function(e) {
|
34 |
+
custom_size_mobile();
|
35 |
+
});
|
36 |
+
jQuery('#customize-footer-actions .preview-desktop').click(function(e) {
|
37 |
+
jQuery('#customize-preview iframe').width('100%');
|
38 |
+
jQuery('#customize-preview iframe').css({
|
39 |
+
'-webkit-transform' : 'scale(1)',
|
40 |
+
'-moz-transform' : 'scale(1)',
|
41 |
+
'-ms-transform' : 'scale(1)',
|
42 |
+
'-o-transform' : 'scale(1)',
|
43 |
+
'transform' : 'scale(1)'
|
44 |
+
});
|
45 |
+
});
|
46 |
+
jQuery('#customize-footer-actions .preview-tablet').click(function(e) {
|
47 |
+
jQuery('#customize-preview iframe').width('100%');
|
48 |
+
jQuery('#customize-preview iframe').css({
|
49 |
+
'-webkit-transform' : 'scale(1)',
|
50 |
+
'-moz-transform' : 'scale(1)',
|
51 |
+
'-ms-transform' : 'scale(1)',
|
52 |
+
'-o-transform' : 'scale(1)',
|
53 |
+
'transform' : 'scale(1)'
|
54 |
+
});
|
55 |
+
});
|
assets/js/customizer.js
ADDED
@@ -0,0 +1,607 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready(function($) {
|
2 |
+
"use strict";
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Sortable Repeater Custom Control
|
6 |
+
*
|
7 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
8 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
+
* @link https://github.com/maddisondesigns
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Update the values for all our input fields and initialise the sortable repeater
|
13 |
+
$('.sortable_repeater_control').each(function() {
|
14 |
+
// If there is an existing customizer value, populate our rows
|
15 |
+
var defaultValuesArray = $(this).find('.customize-control-sortable-repeater').val().split(',');
|
16 |
+
var numRepeaterItems = defaultValuesArray.length;
|
17 |
+
|
18 |
+
if(numRepeaterItems > 0) {
|
19 |
+
// Add the first item to our existing input field
|
20 |
+
$(this).find('.repeater-input').val(defaultValuesArray[0]);
|
21 |
+
// Create a new row for each new value
|
22 |
+
if(numRepeaterItems > 1) {
|
23 |
+
var i;
|
24 |
+
for (i = 1; i < numRepeaterItems; ++i) {
|
25 |
+
skyrocketAppendRow($(this), defaultValuesArray[i]);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
});
|
30 |
+
|
31 |
+
// Make our Repeater fields sortable
|
32 |
+
$(this).find('.sortable').sortable({
|
33 |
+
update: function(event, ui) {
|
34 |
+
skyrocketGetAllInputs($(this).parent());
|
35 |
+
}
|
36 |
+
});
|
37 |
+
|
38 |
+
// Remove item starting from it's parent element
|
39 |
+
$('.sortable').on('click', '.customize-control-sortable-repeater-delete', function(event) {
|
40 |
+
event.preventDefault();
|
41 |
+
var numItems = $(this).parent().parent().find('.repeater').length;
|
42 |
+
|
43 |
+
if(numItems > 1) {
|
44 |
+
$(this).parent().slideUp('fast', function() {
|
45 |
+
var parentContainer = $(this).parent().parent();
|
46 |
+
$(this).remove();
|
47 |
+
skyrocketGetAllInputs(parentContainer);
|
48 |
+
})
|
49 |
+
}
|
50 |
+
else {
|
51 |
+
$(this).parent().find('.repeater-input').val('');
|
52 |
+
skyrocketGetAllInputs($(this).parent().parent().parent());
|
53 |
+
}
|
54 |
+
});
|
55 |
+
|
56 |
+
// Add new item
|
57 |
+
$('.customize-control-sortable-repeater-add').click(function(event) {
|
58 |
+
event.preventDefault();
|
59 |
+
skyrocketAppendRow($(this).parent());
|
60 |
+
skyrocketGetAllInputs($(this).parent());
|
61 |
+
});
|
62 |
+
|
63 |
+
// Refresh our hidden field if any fields change
|
64 |
+
$('.sortable').change(function() {
|
65 |
+
skyrocketGetAllInputs($(this).parent());
|
66 |
+
})
|
67 |
+
|
68 |
+
// Add https:// to the start of the URL if it doesn't have it
|
69 |
+
$('.sortable').on('blur', '.repeater-input', function() {
|
70 |
+
var url = $(this);
|
71 |
+
var val = url.val();
|
72 |
+
if(val && !val.match(/^.+:\/\/.*/)) {
|
73 |
+
// Important! Make sure to trigger change event so Customizer knows it has to save the field
|
74 |
+
url.val('https://' + val).trigger('change');
|
75 |
+
}
|
76 |
+
});
|
77 |
+
|
78 |
+
// Append a new row to our list of elements
|
79 |
+
function skyrocketAppendRow($element, defaultValue = '') {
|
80 |
+
var newRow = '<div class="repeater" style="display:none"><input type="text" value="' + defaultValue + '" class="repeater-input" placeholder="https://" /><span class="dashicons dashicons-sort"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a></div>';
|
81 |
+
|
82 |
+
$element.find('.sortable').append(newRow);
|
83 |
+
$element.find('.sortable').find('.repeater:last').slideDown('slow', function(){
|
84 |
+
$(this).find('input').focus();
|
85 |
+
});
|
86 |
+
}
|
87 |
+
|
88 |
+
// Get the values from the repeater input fields and add to our hidden field
|
89 |
+
function skyrocketGetAllInputs($element) {
|
90 |
+
var inputValues = $element.find('.repeater-input').map(function() {
|
91 |
+
return $(this).val();
|
92 |
+
}).toArray();
|
93 |
+
// Add all the values from our repeater fields to the hidden field (which is the one that actually gets saved)
|
94 |
+
$element.find('.customize-control-sortable-repeater').val(inputValues);
|
95 |
+
// Important! Make sure to trigger change event so Customizer knows it has to save the field
|
96 |
+
$element.find('.customize-control-sortable-repeater').trigger('change');
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Slider Custom Control
|
101 |
+
*
|
102 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
103 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
104 |
+
* @link https://github.com/maddisondesigns
|
105 |
+
*/
|
106 |
+
|
107 |
+
// Set our slider defaults and initialise the slider
|
108 |
+
$('.slider-custom-control').each(function(){
|
109 |
+
var sliderValue = $(this).find('.customize-control-slider-value').val();
|
110 |
+
var newSlider = $(this).find('.slider');
|
111 |
+
var sliderMinValue = parseFloat(newSlider.attr('slider-min-value'));
|
112 |
+
var sliderMaxValue = parseFloat(newSlider.attr('slider-max-value'));
|
113 |
+
var sliderStepValue = parseFloat(newSlider.attr('slider-step-value'));
|
114 |
+
|
115 |
+
newSlider.slider({
|
116 |
+
value: sliderValue,
|
117 |
+
min: sliderMinValue,
|
118 |
+
max: sliderMaxValue,
|
119 |
+
step: sliderStepValue,
|
120 |
+
change: function(e,ui){
|
121 |
+
// Important! When slider stops moving make sure to trigger change event so Customizer knows it has to save the field
|
122 |
+
$(this).parent().find('.customize-control-slider-value').trigger('change');
|
123 |
+
}
|
124 |
+
});
|
125 |
+
});
|
126 |
+
|
127 |
+
// Change the value of the input field as the slider is moved
|
128 |
+
$('.slider').on('slide', function(event, ui) {
|
129 |
+
$(this).parent().find('.customize-control-slider-value').val(ui.value);
|
130 |
+
});
|
131 |
+
|
132 |
+
// Reset slider and input field back to the default value
|
133 |
+
$('.slider-reset').on('click', function() {
|
134 |
+
var resetValue = $(this).attr('slider-reset-value');
|
135 |
+
$(this).parent().find('.customize-control-slider-value').val(resetValue);
|
136 |
+
$(this).parent().find('.slider').slider('value', resetValue);
|
137 |
+
});
|
138 |
+
|
139 |
+
// Update slider if the input field loses focus as it's most likely changed
|
140 |
+
$('.customize-control-slider-value').blur(function() {
|
141 |
+
var resetValue = $(this).val();
|
142 |
+
var slider = $(this).parent().find('.slider');
|
143 |
+
var sliderMinValue = parseInt(slider.attr('slider-min-value'));
|
144 |
+
var sliderMaxValue = parseInt(slider.attr('slider-max-value'));
|
145 |
+
|
146 |
+
// Make sure our manual input value doesn't exceed the minimum & maxmium values
|
147 |
+
if(resetValue < sliderMinValue) {
|
148 |
+
resetValue = sliderMinValue;
|
149 |
+
$(this).val(resetValue);
|
150 |
+
}
|
151 |
+
if(resetValue > sliderMaxValue) {
|
152 |
+
resetValue = sliderMaxValue;
|
153 |
+
$(this).val(resetValue);
|
154 |
+
}
|
155 |
+
$(this).parent().find('.slider').slider('value', resetValue);
|
156 |
+
});
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Single Accordion Custom Control
|
160 |
+
*
|
161 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
162 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
163 |
+
* @link https://github.com/maddisondesigns
|
164 |
+
*/
|
165 |
+
|
166 |
+
$('.single-accordion-toggle').click(function() {
|
167 |
+
var $accordionToggle = $(this);
|
168 |
+
$(this).parent().find('.single-accordion').slideToggle('slow', function() {
|
169 |
+
$accordionToggle.toggleClass('single-accordion-toggle-rotate', $(this).is(':visible'));
|
170 |
+
});
|
171 |
+
});
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Image Check Box Custom Control
|
175 |
+
*
|
176 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
177 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
178 |
+
* @link https://github.com/maddisondesigns
|
179 |
+
*/
|
180 |
+
|
181 |
+
$('.multi-image-checkbox').on('change', function () {
|
182 |
+
getAllCheckboxes($(this).parent().parent());
|
183 |
+
});
|
184 |
+
|
185 |
+
// Get the values from the checkboxes and add to our hidden field
|
186 |
+
function getAllCheckboxes($element) {
|
187 |
+
var inputValues = $element.find('.multi-image-checkbox').map(function() {
|
188 |
+
if( $(this).is(':checked') ) {
|
189 |
+
return $(this).val();
|
190 |
+
// } else {
|
191 |
+
// return '';
|
192 |
+
}
|
193 |
+
}).toArray();
|
194 |
+
// Important! Make sure to trigger change event so Customizer knows it has to save the field
|
195 |
+
$element.find('.customize-control-multi-image-checkbox').val(inputValues).trigger('change');
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Dropdown Select2 Custom Control
|
200 |
+
*
|
201 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
202 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
203 |
+
* @link https://github.com/maddisondesigns
|
204 |
+
*/
|
205 |
+
|
206 |
+
$('.customize-control-dropdown-select2').each(function(){
|
207 |
+
$('.customize-control-select2').select2({
|
208 |
+
allowClear: true
|
209 |
+
});
|
210 |
+
});
|
211 |
+
|
212 |
+
$(".customize-control-select2").on("change", function() {
|
213 |
+
var select2Val = $(this).val();
|
214 |
+
$(this).parent().find('.customize-control-dropdown-select2').val(select2Val).trigger('change');
|
215 |
+
});
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Googe Font Select Custom Control
|
219 |
+
*
|
220 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
221 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
222 |
+
* @link https://github.com/maddisondesigns
|
223 |
+
*/
|
224 |
+
|
225 |
+
$('.google-fonts-list').each(function (i, obj) {
|
226 |
+
if (!$(obj).hasClass('select2-hidden-accessible')) {
|
227 |
+
$(obj).select2();
|
228 |
+
}
|
229 |
+
});
|
230 |
+
|
231 |
+
$('.google-fonts-list').on('change', function() {
|
232 |
+
var elementRegularWeight = $(this).parent().parent().find('.google-fonts-regularweight-style');
|
233 |
+
var elementItalicWeight = $(this).parent().parent().find('.google-fonts-italicweight-style');
|
234 |
+
var elementBoldWeight = $(this).parent().parent().find('.google-fonts-boldweight-style');
|
235 |
+
var selectedFont = $(this).val();
|
236 |
+
var customizerControlName = $(this).attr('control-name');
|
237 |
+
var elementItalicWeightCount = 0;
|
238 |
+
var elementBoldWeightCount = 0;
|
239 |
+
|
240 |
+
// Clear Weight/Style dropdowns
|
241 |
+
elementRegularWeight.empty();
|
242 |
+
elementItalicWeight.empty();
|
243 |
+
elementBoldWeight.empty();
|
244 |
+
// Make sure Italic & Bold dropdowns are enabled
|
245 |
+
elementItalicWeight.prop('disabled', false);
|
246 |
+
elementBoldWeight.prop('disabled', false);
|
247 |
+
|
248 |
+
// Get the Google Fonts control object
|
249 |
+
var bodyfontcontrol = _wpCustomizeSettings.controls[customizerControlName];
|
250 |
+
|
251 |
+
// Find the index of the selected font
|
252 |
+
var indexes = $.map(bodyfontcontrol.skyrocketfontslist, function(obj, index) {
|
253 |
+
if(obj.family === selectedFont) {
|
254 |
+
return index;
|
255 |
+
}
|
256 |
+
});
|
257 |
+
var index = indexes[0];
|
258 |
+
|
259 |
+
// For the selected Google font show the available weight/style variants
|
260 |
+
$.each(bodyfontcontrol.skyrocketfontslist[index].variants, function(val, text) {
|
261 |
+
elementRegularWeight.append(
|
262 |
+
$('<option></option>').val(text).html(text)
|
263 |
+
);
|
264 |
+
if (text.indexOf("italic") >= 0) {
|
265 |
+
elementItalicWeight.append(
|
266 |
+
$('<option></option>').val(text).html(text)
|
267 |
+
);
|
268 |
+
elementItalicWeightCount++;
|
269 |
+
} else {
|
270 |
+
elementBoldWeight.append(
|
271 |
+
$('<option></option>').val(text).html(text)
|
272 |
+
);
|
273 |
+
elementBoldWeightCount++;
|
274 |
+
}
|
275 |
+
});
|
276 |
+
|
277 |
+
if(elementItalicWeightCount == 0) {
|
278 |
+
elementItalicWeight.append(
|
279 |
+
$('<option></option>').val('').html('Not Available for this font')
|
280 |
+
);
|
281 |
+
elementItalicWeight.prop('disabled', 'disabled');
|
282 |
+
}
|
283 |
+
if(elementBoldWeightCount == 0) {
|
284 |
+
elementBoldWeight.append(
|
285 |
+
$('<option></option>').val('').html('Not Available for this font')
|
286 |
+
);
|
287 |
+
elementBoldWeight.prop('disabled', 'disabled');
|
288 |
+
}
|
289 |
+
|
290 |
+
// Update the font category based on the selected font
|
291 |
+
$(this).parent().parent().find('.google-fonts-category').val(bodyfontcontrol.skyrocketfontslist[index].category);
|
292 |
+
|
293 |
+
skyrocketGetAllSelects($(this).parent().parent());
|
294 |
+
});
|
295 |
+
|
296 |
+
$('.google_fonts_select_control select').on('change', function() {
|
297 |
+
skyrocketGetAllSelects($(this).parent().parent());
|
298 |
+
});
|
299 |
+
|
300 |
+
function skyrocketGetAllSelects($element) {
|
301 |
+
var selectedFont = {
|
302 |
+
font: $element.find('.google-fonts-list').val(),
|
303 |
+
regularweight: $element.find('.google-fonts-regularweight-style').val(),
|
304 |
+
italicweight: $element.find('.google-fonts-italicweight-style').val(),
|
305 |
+
boldweight: $element.find('.google-fonts-boldweight-style').val(),
|
306 |
+
category: $element.find('.google-fonts-category').val()
|
307 |
+
};
|
308 |
+
|
309 |
+
// Important! Make sure to trigger change event so Customizer knows it has to save the field
|
310 |
+
$element.find('.customize-control-google-font-selection').val(JSON.stringify(selectedFont)).trigger('change');
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* TinyMCE Custom Control
|
315 |
+
*
|
316 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
317 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
318 |
+
* @link https://github.com/maddisondesigns
|
319 |
+
*/
|
320 |
+
|
321 |
+
$('.customize-control-tinymce-editor').each(function(){
|
322 |
+
// Get the toolbar strings that were passed from the PHP Class
|
323 |
+
var tinyMCEToolbar1String = _wpCustomizeSettings.controls[$(this).attr('id')].skyrockettinymcetoolbar1;
|
324 |
+
var tinyMCEToolbar2String = _wpCustomizeSettings.controls[$(this).attr('id')].skyrockettinymcetoolbar2;
|
325 |
+
var tinyMCEMediaButtons = _wpCustomizeSettings.controls[$(this).attr('id')].skyrocketmediabuttons;
|
326 |
+
|
327 |
+
wp.editor.initialize( $(this).attr('id'), {
|
328 |
+
tinymce: {
|
329 |
+
wpautop: true,
|
330 |
+
toolbar1: tinyMCEToolbar1String,
|
331 |
+
toolbar2: tinyMCEToolbar2String
|
332 |
+
},
|
333 |
+
quicktags: true,
|
334 |
+
mediaButtons: tinyMCEMediaButtons
|
335 |
+
});
|
336 |
+
});
|
337 |
+
$(document).on( 'tinymce-editor-init', function( event, editor ) {
|
338 |
+
editor.on('change', function(e) {
|
339 |
+
tinyMCE.triggerSave();
|
340 |
+
$('#'+editor.id).trigger('change');
|
341 |
+
});
|
342 |
+
});
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Alpha Color Picker Custom Control
|
346 |
+
*
|
347 |
+
* @author Braad Martin <http://braadmartin.com>
|
348 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
349 |
+
* @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker
|
350 |
+
*/
|
351 |
+
|
352 |
+
// Loop over each control and transform it into our color picker.
|
353 |
+
$( '.alpha-color-control' ).each( function() {
|
354 |
+
|
355 |
+
// Scope the vars.
|
356 |
+
var $control, startingColor, paletteInput, showOpacity, defaultColor, palette,
|
357 |
+
colorPickerOptions, $container, $alphaSlider, alphaVal, sliderOptions;
|
358 |
+
|
359 |
+
// Store the control instance.
|
360 |
+
$control = $( this );
|
361 |
+
|
362 |
+
// Get a clean starting value for the option.
|
363 |
+
startingColor = $control.val().replace( /\s+/g, '' );
|
364 |
+
|
365 |
+
// Get some data off the control.
|
366 |
+
paletteInput = $control.attr( 'data-palette' );
|
367 |
+
showOpacity = $control.attr( 'data-show-opacity' );
|
368 |
+
defaultColor = $control.attr( 'data-default-color' );
|
369 |
+
|
370 |
+
// Process the palette.
|
371 |
+
if ( paletteInput.indexOf( '|' ) !== -1 ) {
|
372 |
+
palette = paletteInput.split( '|' );
|
373 |
+
} else if ( 'false' == paletteInput ) {
|
374 |
+
palette = false;
|
375 |
+
} else {
|
376 |
+
palette = true;
|
377 |
+
}
|
378 |
+
|
379 |
+
// Set up the options that we'll pass to wpColorPicker().
|
380 |
+
colorPickerOptions = {
|
381 |
+
change: function( event, ui ) {
|
382 |
+
var key, value, alpha, $transparency;
|
383 |
+
|
384 |
+
key = $control.attr( 'data-customize-setting-link' );
|
385 |
+
value = $control.wpColorPicker( 'color' );
|
386 |
+
|
387 |
+
// Set the opacity value on the slider handle when the default color button is clicked.
|
388 |
+
if ( defaultColor == value ) {
|
389 |
+
alpha = acp_get_alpha_value_from_color( value );
|
390 |
+
$alphaSlider.find( '.ui-slider-handle' ).text( alpha );
|
391 |
+
}
|
392 |
+
|
393 |
+
// Send ajax request to wp.customize to trigger the Save action.
|
394 |
+
wp.customize( key, function( obj ) {
|
395 |
+
obj.set( value );
|
396 |
+
});
|
397 |
+
|
398 |
+
$transparency = $container.find( '.transparency' );
|
399 |
+
|
400 |
+
// Always show the background color of the opacity slider at 100% opacity.
|
401 |
+
$transparency.css( 'background-color', ui.color.toString( 'no-alpha' ) );
|
402 |
+
},
|
403 |
+
palettes: palette // Use the passed in palette.
|
404 |
+
};
|
405 |
+
|
406 |
+
// Create the colorpicker.
|
407 |
+
$control.wpColorPicker( colorPickerOptions );
|
408 |
+
|
409 |
+
$container = $control.parents( '.wp-picker-container:first' );
|
410 |
+
|
411 |
+
// Insert our opacity slider.
|
412 |
+
$( '<div class="alpha-color-picker-container">' +
|
413 |
+
'<div class="min-click-zone click-zone"></div>' +
|
414 |
+
'<div class="max-click-zone click-zone"></div>' +
|
415 |
+
'<div class="alpha-slider"></div>' +
|
416 |
+
'<div class="transparency"></div>' +
|
417 |
+
'</div>' ).appendTo( $container.find( '.wp-picker-holder' ) );
|
418 |
+
|
419 |
+
$alphaSlider = $container.find( '.alpha-slider' );
|
420 |
+
|
421 |
+
// If starting value is in format RGBa, grab the alpha channel.
|
422 |
+
alphaVal = acp_get_alpha_value_from_color( startingColor );
|
423 |
+
|
424 |
+
// Set up jQuery UI slider() options.
|
425 |
+
sliderOptions = {
|
426 |
+
create: function( event, ui ) {
|
427 |
+
var value = $( this ).slider( 'value' );
|
428 |
+
|
429 |
+
// Set up initial values.
|
430 |
+
$( this ).find( '.ui-slider-handle' ).text( value );
|
431 |
+
$( this ).siblings( '.transparency ').css( 'background-color', startingColor );
|
432 |
+
},
|
433 |
+
value: alphaVal,
|
434 |
+
range: 'max',
|
435 |
+
step: 1,
|
436 |
+
min: 0,
|
437 |
+
max: 100,
|
438 |
+
animate: 300
|
439 |
+
};
|
440 |
+
|
441 |
+
// Initialize jQuery UI slider with our options.
|
442 |
+
$alphaSlider.slider( sliderOptions );
|
443 |
+
|
444 |
+
// Maybe show the opacity on the handle.
|
445 |
+
if ( 'true' == showOpacity ) {
|
446 |
+
$alphaSlider.find( '.ui-slider-handle' ).addClass( 'show-opacity' );
|
447 |
+
}
|
448 |
+
|
449 |
+
// Bind event handlers for the click zones.
|
450 |
+
$container.find( '.min-click-zone' ).on( 'click', function() {
|
451 |
+
acp_update_alpha_value_on_color_control( 0, $control, $alphaSlider, true );
|
452 |
+
});
|
453 |
+
$container.find( '.max-click-zone' ).on( 'click', function() {
|
454 |
+
acp_update_alpha_value_on_color_control( 100, $control, $alphaSlider, true );
|
455 |
+
});
|
456 |
+
|
457 |
+
// Bind event handler for clicking on a palette color.
|
458 |
+
$container.find( '.iris-palette' ).on( 'click', function() {
|
459 |
+
var color, alpha;
|
460 |
+
|
461 |
+
color = $( this ).css( 'background-color' );
|
462 |
+
alpha = acp_get_alpha_value_from_color( color );
|
463 |
+
|
464 |
+
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
465 |
+
|
466 |
+
// Sometimes Iris doesn't set a perfect background-color on the palette,
|
467 |
+
// for example rgba(20, 80, 100, 0.3) becomes rgba(20, 80, 100, 0.298039).
|
468 |
+
// To compensante for this we round the opacity value on RGBa colors here
|
469 |
+
// and save it a second time to the color picker object.
|
470 |
+
if ( alpha != 100 ) {
|
471 |
+
color = color.replace( /[^,]+(?=\))/, ( alpha / 100 ).toFixed( 2 ) );
|
472 |
+
}
|
473 |
+
|
474 |
+
$control.wpColorPicker( 'color', color );
|
475 |
+
});
|
476 |
+
|
477 |
+
// Bind event handler for clicking on the 'Clear' button.
|
478 |
+
$container.find( '.button.wp-picker-clear' ).on( 'click', function() {
|
479 |
+
var key = $control.attr( 'data-customize-setting-link' );
|
480 |
+
|
481 |
+
// The #fff color is delibrate here. This sets the color picker to white instead of the
|
482 |
+
// defult black, which puts the color picker in a better place to visually represent empty.
|
483 |
+
$control.wpColorPicker( 'color', '#ffffff' );
|
484 |
+
|
485 |
+
// Set the actual option value to empty string.
|
486 |
+
wp.customize( key, function( obj ) {
|
487 |
+
obj.set( '' );
|
488 |
+
});
|
489 |
+
|
490 |
+
acp_update_alpha_value_on_alpha_slider( 100, $alphaSlider );
|
491 |
+
});
|
492 |
+
|
493 |
+
// Bind event handler for clicking on the 'Default' button.
|
494 |
+
$container.find( '.button.wp-picker-default' ).on( 'click', function() {
|
495 |
+
var alpha = acp_get_alpha_value_from_color( defaultColor );
|
496 |
+
|
497 |
+
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
498 |
+
});
|
499 |
+
|
500 |
+
// Bind event handler for typing or pasting into the input.
|
501 |
+
$control.on( 'input', function() {
|
502 |
+
var value = $( this ).val();
|
503 |
+
var alpha = acp_get_alpha_value_from_color( value );
|
504 |
+
|
505 |
+
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
506 |
+
});
|
507 |
+
|
508 |
+
// Update all the things when the slider is interacted with.
|
509 |
+
$alphaSlider.slider().on( 'slide', function( event, ui ) {
|
510 |
+
var alpha = parseFloat( ui.value ) / 100.0;
|
511 |
+
|
512 |
+
acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, false );
|
513 |
+
|
514 |
+
// Change value shown on slider handle.
|
515 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
516 |
+
});
|
517 |
+
|
518 |
+
});
|
519 |
+
|
520 |
+
/**
|
521 |
+
* Override the stock color.js toString() method to add support for outputting RGBa or Hex.
|
522 |
+
*/
|
523 |
+
Color.prototype.toString = function( flag ) {
|
524 |
+
|
525 |
+
// If our no-alpha flag has been passed in, output RGBa value with 100% opacity.
|
526 |
+
// This is used to set the background color on the opacity slider during color changes.
|
527 |
+
if ( 'no-alpha' == flag ) {
|
528 |
+
return this.toCSS( 'rgba', '1' ).replace( /\s+/g, '' );
|
529 |
+
}
|
530 |
+
|
531 |
+
// If we have a proper opacity value, output RGBa.
|
532 |
+
if ( 1 > this._alpha ) {
|
533 |
+
return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
|
534 |
+
}
|
535 |
+
|
536 |
+
// Proceed with stock color.js hex output.
|
537 |
+
var hex = parseInt( this._color, 10 ).toString( 16 );
|
538 |
+
if ( this.error ) { return ''; }
|
539 |
+
if ( hex.length < 6 ) {
|
540 |
+
for ( var i = 6 - hex.length - 1; i >= 0; i-- ) {
|
541 |
+
hex = '0' + hex;
|
542 |
+
}
|
543 |
+
}
|
544 |
+
|
545 |
+
return '#' + hex;
|
546 |
+
};
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Given an RGBa, RGB, or hex color value, return the alpha channel value.
|
550 |
+
*/
|
551 |
+
function acp_get_alpha_value_from_color( value ) {
|
552 |
+
var alphaVal;
|
553 |
+
|
554 |
+
// Remove all spaces from the passed in value to help our RGBa regex.
|
555 |
+
value = value.replace( / /g, '' );
|
556 |
+
|
557 |
+
if ( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ ) ) {
|
558 |
+
alphaVal = parseFloat( value.match( /rgba\(\d+\,\d+\,\d+\,([^\)]+)\)/ )[1] ).toFixed(2) * 100;
|
559 |
+
alphaVal = parseInt( alphaVal );
|
560 |
+
} else {
|
561 |
+
alphaVal = 100;
|
562 |
+
}
|
563 |
+
|
564 |
+
return alphaVal;
|
565 |
+
}
|
566 |
+
|
567 |
+
/**
|
568 |
+
* Force update the alpha value of the color picker object and maybe the alpha slider.
|
569 |
+
*/
|
570 |
+
function acp_update_alpha_value_on_color_control( alpha, $control, $alphaSlider, update_slider ) {
|
571 |
+
var iris, colorPicker, color;
|
572 |
+
|
573 |
+
iris = $control.data( 'a8cIris' );
|
574 |
+
colorPicker = $control.data( 'wpWpColorPicker' );
|
575 |
+
|
576 |
+
// Set the alpha value on the Iris object.
|
577 |
+
iris._color._alpha = alpha;
|
578 |
+
|
579 |
+
// Store the new color value.
|
580 |
+
color = iris._color.toString();
|
581 |
+
|
582 |
+
// Set the value of the input.
|
583 |
+
$control.val( color );
|
584 |
+
|
585 |
+
// Update the background color of the color picker.
|
586 |
+
colorPicker.toggler.css({
|
587 |
+
'background-color': color
|
588 |
+
});
|
589 |
+
|
590 |
+
// Maybe update the alpha slider itself.
|
591 |
+
if ( update_slider ) {
|
592 |
+
acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider );
|
593 |
+
}
|
594 |
+
|
595 |
+
// Update the color value of the color picker object.
|
596 |
+
$control.wpColorPicker( 'color', color );
|
597 |
+
}
|
598 |
+
|
599 |
+
/**
|
600 |
+
* Update the slider handle position and label.
|
601 |
+
*/
|
602 |
+
function acp_update_alpha_value_on_alpha_slider( alpha, $alphaSlider ) {
|
603 |
+
$alphaSlider.slider( 'value', alpha );
|
604 |
+
$alphaSlider.find( '.ui-slider-handle' ).text( alpha.toString() );
|
605 |
+
}
|
606 |
+
|
607 |
+
});
|
assets/js/preview-scripts.js
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( $ ) {
|
2 |
+
$('.hide').hide();
|
3 |
+
/* Hide/Show Header */
|
4 |
+
wp.customize( 'display_shipment_provider_image', function( value ) {
|
5 |
+
value.bind( function( to ) {
|
6 |
+
if( to ){
|
7 |
+
$( '.tracking-provider img' ).show();
|
8 |
+
}
|
9 |
+
else{
|
10 |
+
$( '.tracking-provider img' ).hide();
|
11 |
+
}
|
12 |
+
});
|
13 |
+
});
|
14 |
+
wp.customize( 'remove_date_from_tracking', function( value ) {
|
15 |
+
value.bind( function( remove_date_from_tracking ) {
|
16 |
+
if( remove_date_from_tracking ){
|
17 |
+
$( '.date-shipped' ).hide();
|
18 |
+
}
|
19 |
+
else{
|
20 |
+
$( '.date-shipped' ).show();
|
21 |
+
}
|
22 |
+
});
|
23 |
+
});
|
24 |
+
wp.customize( 'header_text_change', function( value ) {
|
25 |
+
value.bind( function( header_text ) {
|
26 |
+
if( header_text ){
|
27 |
+
$( '.header_text' ).text(header_text);
|
28 |
+
} else{
|
29 |
+
$( '.header_text' ).text('Tracking Information');
|
30 |
+
}
|
31 |
+
});
|
32 |
+
});
|
33 |
+
wp.customize( 'additional_header_text', function( value ) {
|
34 |
+
value.bind( function( additional_header_text ) {
|
35 |
+
if( additional_header_text ){
|
36 |
+
$( '.addition_header' ).text(additional_header_text);
|
37 |
+
} else{
|
38 |
+
$( '.addition_header' ).text('');
|
39 |
+
}
|
40 |
+
});
|
41 |
+
});
|
42 |
+
wp.customize( 'table_bg_color', function( setting ) {
|
43 |
+
/* Deferred callback for when setting exists */
|
44 |
+
setting.bind( function( newValue ) {
|
45 |
+
/* Update callback for setting change */
|
46 |
+
$( '.tracking_table' ).css( 'background-color',newValue );
|
47 |
+
} );
|
48 |
+
} );
|
49 |
+
wp.customize( 'table_border_color', function( setting ) {
|
50 |
+
/* Deferred callback for when setting exists */
|
51 |
+
setting.bind( function( table_border_color ) {
|
52 |
+
/* Update callback for setting change */
|
53 |
+
$( '.tracking_table th' ).css( 'border-color',table_border_color );
|
54 |
+
$( '.tracking_table td' ).css( 'border-color',table_border_color );
|
55 |
+
} );
|
56 |
+
} );
|
57 |
+
wp.customize( 'table_border_size', function( setting ) {
|
58 |
+
/* Deferred callback for when setting exists */
|
59 |
+
setting.bind( function( table_border_size ) {
|
60 |
+
/* Update callback for setting change */
|
61 |
+
$( '.tracking_table th' ).css( 'border-width',table_border_size+'px' );
|
62 |
+
$( '.tracking_table td' ).css( 'border-width',table_border_size+'px' );
|
63 |
+
} );
|
64 |
+
} );
|
65 |
+
wp.customize( 'table_header_font_size', function( setting ) {
|
66 |
+
/* Deferred callback for when setting exists */
|
67 |
+
setting.bind( function( table_header_font_size ) {
|
68 |
+
/* Update callback for setting change */
|
69 |
+
$( '.tracking_table th' ).css( 'font-size',table_header_font_size+'px' );
|
70 |
+
} );
|
71 |
+
} );
|
72 |
+
wp.customize( 'table_header_font_color', function( setting ) {
|
73 |
+
/* Deferred callback for when setting exists */
|
74 |
+
setting.bind( function( table_header_font_color ) {
|
75 |
+
/* Update callback for setting change */
|
76 |
+
$( '.tracking_table th' ).css( 'color',table_header_font_color );
|
77 |
+
} );
|
78 |
+
} );
|
79 |
+
wp.customize( 'table_content_font_size', function( setting ) {
|
80 |
+
/* Deferred callback for when setting exists */
|
81 |
+
setting.bind( function( table_content_font_size ) {
|
82 |
+
/* Update callback for setting change */
|
83 |
+
$( '.tracking_table td' ).css( 'font-size',table_content_font_size+'px' );
|
84 |
+
} );
|
85 |
+
} );
|
86 |
+
wp.customize( 'table_content_font_color', function( setting ) {
|
87 |
+
/* Deferred callback for when setting exists */
|
88 |
+
setting.bind( function( table_content_font_color ) {
|
89 |
+
/* Update callback for setting change */
|
90 |
+
$( '.tracking_table td' ).css( 'color',table_content_font_color );
|
91 |
+
} );
|
92 |
+
} );
|
93 |
+
wp.customize( 'tracking_link_font_color', function( setting ) {
|
94 |
+
/* Deferred callback for when setting exists */
|
95 |
+
setting.bind( function( tracking_link_font_color ) {
|
96 |
+
/* Update callback for setting change */
|
97 |
+
$( '.tracking_table td a' ).css( 'color',tracking_link_font_color );
|
98 |
+
} );
|
99 |
+
} );
|
100 |
+
wp.customize( 'tracking_link_bg_color', function( setting ) {
|
101 |
+
/* Deferred callback for when setting exists */
|
102 |
+
setting.bind( function( tracking_link_bg_color ) {
|
103 |
+
/* Update callback for setting change */
|
104 |
+
$( '.tracking_table td a' ).css( 'background-color',tracking_link_bg_color );
|
105 |
+
} );
|
106 |
+
} );
|
107 |
+
wp.customize( 'table_content_line_height', function( value ) {
|
108 |
+
value.bind( function( table_content_line_height ) {
|
109 |
+
$( '.tracking_table' ).css( 'line-height',table_content_line_height+'px' );
|
110 |
+
});
|
111 |
+
});
|
112 |
+
wp.customize( 'table_content_font_weight', function( value ) {
|
113 |
+
value.bind( function( table_content_font_weight ) {
|
114 |
+
$( '.tracking_table td' ).css( 'font-weight',table_content_font_weight );
|
115 |
+
});
|
116 |
+
});
|
117 |
+
wp.customize( 'wcast_preview_order_id', function( value ) {
|
118 |
+
value.bind( function( wcast_preview_order_id ) {
|
119 |
+
});
|
120 |
+
});
|
121 |
+
|
122 |
+
} )( jQuery );
|
assets/js/shipping_row.js
CHANGED
@@ -112,7 +112,8 @@
|
|
112 |
return;
|
113 |
}
|
114 |
|
115 |
-
var
|
|
|
116 |
var provider_id = jQuery(this).data("pid");
|
117 |
|
118 |
var ajax_data = {
|
@@ -122,6 +123,7 @@
|
|
122 |
|
123 |
$.post( ajaxurl, ajax_data, function(response) {
|
124 |
provider_row.remove();
|
|
|
125 |
update_default_shipping_provider();
|
126 |
$(".shipping_provider_table ").unblock();
|
127 |
});
|
@@ -627,7 +629,8 @@ jQuery(document).on("submit", "#wc_ast_upload_csv_form", function(){
|
|
627 |
tracking_number: tracking_number,
|
628 |
date_shipped: date_shipped,
|
629 |
status_shipped: status_shipped,
|
630 |
-
replace_tracking_info: replace_tracking_info,
|
|
|
631 |
};
|
632 |
|
633 |
var option = {
|
@@ -918,4 +921,25 @@ function showerror(element){
|
|
918 |
}
|
919 |
function hideerror(element){
|
920 |
element.css("border","none");
|
921 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
return;
|
113 |
}
|
114 |
|
115 |
+
var provider_row1 = jQuery(this).parents("tr");
|
116 |
+
var provider_row = jQuery('.tr_add');
|
117 |
var provider_id = jQuery(this).data("pid");
|
118 |
|
119 |
var ajax_data = {
|
123 |
|
124 |
$.post( ajaxurl, ajax_data, function(response) {
|
125 |
provider_row.remove();
|
126 |
+
provider_row1.remove();
|
127 |
update_default_shipping_provider();
|
128 |
$(".shipping_provider_table ").unblock();
|
129 |
});
|
629 |
tracking_number: tracking_number,
|
630 |
date_shipped: date_shipped,
|
631 |
status_shipped: status_shipped,
|
632 |
+
replace_tracking_info: replace_tracking_info,
|
633 |
+
trackings: trackings,
|
634 |
};
|
635 |
|
636 |
var option = {
|
921 |
}
|
922 |
function hideerror(element){
|
923 |
element.css("border","none");
|
924 |
+
}
|
925 |
+
|
926 |
+
$.fn.textWidth = function(text, font) {
|
927 |
+
|
928 |
+
if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body);
|
929 |
+
|
930 |
+
$.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
|
931 |
+
|
932 |
+
return $.fn.textWidth.fakeEl.width();
|
933 |
+
};
|
934 |
+
jQuery(document).ready(function() {
|
935 |
+
jQuery(".site_title_tag").css('width',((jQuery(".site_title_tag").val().length + 1) * 8) + 'px');
|
936 |
+
jQuery(".customer_email_tag").css('width',((jQuery(".customer_email_tag").val().length + 1) * 8) + 'px');
|
937 |
+
jQuery(".first_name_tag").css('width',((jQuery(".first_name_tag").val().length + 1) * 8) + 'px');
|
938 |
+
jQuery(".last_name_tag").css('width',((jQuery(".last_name_tag").val().length + 1) * 8) + 'px');
|
939 |
+
jQuery(".username_tag").css('width',((jQuery(".username_tag").val().length + 1) * 8) + 'px');
|
940 |
+
jQuery(".order_number_tag").css('width',((jQuery(".order_number_tag").val().length + 1) * 8) + 'px');
|
941 |
+
jQuery(".order_details_tag").css('width',((jQuery(".order_details_tag").val().length + 1) * 8) + 'px');
|
942 |
+
jQuery(".tracking_details_tag").css('width',((jQuery(".tracking_details_tag").val().length + 1) * 8) + 'px');
|
943 |
+
jQuery(".shipping_address_tag").css('width',((jQuery(".shipping_address_tag").val().length + 1) * 8) + 'px');
|
944 |
+
jQuery(".billing_address_tag").css('width',((jQuery(".billing_address_tag").val().length + 1) * 8) + 'px');
|
945 |
+
});
|
assets/shipment-provider-img/dhl-logistics.png
ADDED
Binary file
|
includes/class-wc-advanced-shipment-tracking-admin.php
CHANGED
@@ -136,9 +136,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
136 |
|
137 |
add_action( 'wp_ajax_update_email_type', array( $this, 'update_email_type_fun') );
|
138 |
|
139 |
-
add_action( 'admin_footer', array( $this, 'footer_function') );
|
140 |
-
|
141 |
-
add_action( 'admin_init', array( $this, 'preview_emails' ) );
|
142 |
}
|
143 |
|
144 |
/*
|
@@ -815,16 +813,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
815 |
</form>
|
816 |
|
817 |
<script type="text/template" id="tmpl-shipping-provider-row-template">
|
818 |
-
<tr class="provider_tr tr_add">
|
819 |
-
<td class="column-columnname
|
820 |
-
<input type='text' placeholder='Image' name='data[{{{ data.index }}}][thumb_url]' class='image_path' value='' id='image_path'>
|
821 |
-
<input type='hidden' name='data[{{{ data.index }}}][thumb_id]' class='image_id' placeholder="Image" value='' id='image_id' style="">
|
822 |
-
<input id="upload_image_button" type="button" class="button" value="<?php _e( 'Upload' , 'woo-advanced-shipment-tracking'); ?>" />
|
823 |
-
</td>
|
824 |
-
<td class="column-columnname shipping_provider">
|
825 |
<input type="text" class="text" value="{{{ data.rate.provider_name }}}" placeholder="<?php _e( 'Shipping Provider', 'woo-advanced-shipment-tracking' ); ?>" name="data[{{{ data.index }}}][provider_name]" />
|
826 |
</td>
|
827 |
-
|
|
|
|
|
828 |
<select class="select wcast_shipping_country" name="data[{{{ data.index }}}][shipping_country]" >
|
829 |
<option value="" <# if ( "" === data.rate.rate_condition ) { #>selected="selected"<# } #>><?php _e( 'None', 'woo-advanced-shipment-tracking' ); ?></option>
|
830 |
<?php
|
@@ -834,16 +829,28 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
834 |
?>
|
835 |
</select>
|
836 |
</td>
|
837 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
<input type="text" class="text" name="data[{{{ data.index }}}][provider_url]" value="" placeholder="<?php _e( 'Tracking Page', 'woo-advanced-shipment-tracking' ); ?>">
|
839 |
<p><?php _e('You can add tracking number parameter like this - http://shippingprovider.com?tracking_number=%number% , %number% - parameter', 'woo-advanced-shipment-tracking'); ?></p>
|
840 |
</td>
|
841 |
-
|
|
|
|
|
842 |
<input type="hidden" name="data[{{{ data.index }}}][sort_order]" class="sort_order" value="{{{ data.sort_id }}}">
|
843 |
<button class="button button-primary add_new btn_green"><?php _e( 'Save', 'woo-advanced-shipment-tracking' ); ?></button>
|
844 |
-
<
|
|
|
845 |
</td>
|
846 |
-
|
847 |
</script>
|
848 |
</div>
|
849 |
</section>
|
@@ -851,25 +858,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
851 |
<div class="tab_inner_container">
|
852 |
<form method="post" id="wc_ast_settings_form" action="" enctype="multipart/form-data">
|
853 |
<?php #nonce?>
|
|
|
|
|
|
|
|
|
|
|
854 |
<h3><?php _e( 'Settings', 'woo-advanced-shipment-tracking' ); ?></h3>
|
855 |
-
<?php $this->get_html( $this->get_settings_data() );?>
|
856 |
-
<!--a class="status_label_color_th" href="<?php admin_url( 'admin.php?page=wc-settings&tab=email§ion=wc_email_customer_delivered_order' ); ?>" target="blank"><?php _e( 'Manage delivered order email', 'woo-advanced-shipment-tracking' ); ?></a-->
|
857 |
-
<hr style="margin:0;"></hr>
|
858 |
-
<h3><?php _e( 'Tracking info display', 'woo-advanced-shipment-tracking' ); ?></h3>
|
859 |
-
<?php
|
860 |
-
echo sprintf( __( 'This section lets you customize the Tracking Info display design.', 'woo-advanced-shipment-tracking' ));
|
861 |
-
?>
|
862 |
-
<div class="tracking_info_design"><?php $this->get_html( $this->get_email_settings_data() );?></div>
|
863 |
-
<div class="submit">
|
864 |
-
<button name="save" class="button-primary woocommerce-save-button btn_green" type="submit" value="Save changes"><?php _e( 'Save', 'woo-advanced-shipment-tracking' ); ?></button>
|
865 |
-
<div class="spinner" style="float:none"></div>
|
866 |
-
<div class="success_msg" style="display:none;"><?php _e( 'Data saved successfully.', 'woo-advanced-shipment-tracking' ); ?></div>
|
867 |
-
<div class="error_msg" style="display:none;"></div>
|
868 |
-
<?php wp_nonce_field( 'wc_ast_settings_form', 'wc_ast_settings_form' );?>
|
869 |
-
<input type="hidden" name="action" value="wc_ast_settings_form_update">
|
870 |
-
</div>
|
871 |
-
<a href="<?php echo wp_nonce_url( admin_url( '?preview_tracking_info_design=true' ), 'preview-mail' );?>" target="blank"><?php _e( 'Click here to preview your design', 'woo-advanced-shipment-tracking' ); ?></a>
|
872 |
-
|
873 |
</form>
|
874 |
</div>
|
875 |
</section>
|
@@ -1043,27 +1038,10 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1043 |
<td scope="row" class="">
|
1044 |
<input type="text" id="email_heading" name="email_heading" placeholder="<?php _e('Please enter email heading here', 'woo-advanced-shipment-tracking'); ?>">
|
1045 |
</td>
|
1046 |
-
</tr>
|
1047 |
-
<tr valign="top" class="hide_default show_if_any">
|
1048 |
-
<th scope="row" class="" colspan="2">
|
1049 |
-
<label for=""><?php _e('Email content', 'woo-advanced-shipment-tracking'); ?></label>
|
1050 |
-
</th>
|
1051 |
-
</tr>
|
1052 |
<tr valign="top" class="hide_default show_if_any" colspan="2">
|
1053 |
-
<th scope="row" class="" colspan="2">
|
1054 |
-
<
|
1055 |
-
<h4 style="margin:0;"><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
1056 |
-
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" value="{site_title}" style="width: 90px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1057 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_email}" style="width: 115px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1058 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_first_name}"style="width: 150px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1059 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_last_name}" style="width: 145px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1060 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_username}" style="width: 135px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1061 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_number}" style="width: 103px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1062 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_details}" style="width: 110px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1063 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{tracking_details}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1064 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{shipping_address}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1065 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{billing_address}"style="width: 125px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1066 |
-
</div>
|
1067 |
<?php
|
1068 |
$content = '';
|
1069 |
$editor_id = 'email_content';
|
@@ -1077,24 +1055,24 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1077 |
'quicktags' => true,
|
1078 |
'editor_height' => 200,
|
1079 |
]);
|
1080 |
-
//wp_editor( $content, $editor_id, $settings );?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1081 |
</th>
|
1082 |
</tr>
|
1083 |
</tbody>
|
1084 |
</table>
|
1085 |
-
<div class="variable_div hide_default show_if_any">
|
1086 |
-
<h4><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
1087 |
-
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" value="{site_title}" style="width: 90px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1088 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_email}" style="width: 115px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1089 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_first_name}"style="width: 150px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1090 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_last_name}" style="width: 145px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1091 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_username}" style="width: 135px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1092 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_number}" style="width: 103px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1093 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_details}" style="width: 110px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1094 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{tracking_details}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1095 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{shipping_address}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1096 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{billing_address}"style="width: 125px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1097 |
-
</div>
|
1098 |
<div class="" style="clear:both;">
|
1099 |
<input type="hidden" name="action" value="save_status_email">
|
1100 |
<button type="submit" class="button-primary btn_green hide_default show_if_any" name="save_shipment_status_email" id="save_shipment_status_email"><?php _e('Save', 'woo-advanced-shipment-tracking'); ?></button>
|
@@ -1388,105 +1366,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1388 |
);
|
1389 |
return $form_data;
|
1390 |
|
1391 |
-
}
|
1392 |
-
|
1393 |
-
/*
|
1394 |
-
* get settings tab array data
|
1395 |
-
* return array
|
1396 |
-
*/
|
1397 |
-
function get_email_settings_data(){
|
1398 |
-
$font_size_array[ '' ] = __( 'Select', 'woo-advanced-shipment-tracking' );
|
1399 |
-
for ( $i = 10; $i <= 30; $i++ ) {
|
1400 |
-
$font_size_array[ $i ] = $i."px";
|
1401 |
-
}
|
1402 |
-
|
1403 |
-
$form_data = array(
|
1404 |
-
'display_shipment_provider_thumbnail' => array(
|
1405 |
-
'type' => 'checkbox',
|
1406 |
-
'title' => __( 'Display Shipment Provider image/thumbnail', 'woo-advanced-shipment-tracking' ),
|
1407 |
-
'desc' => '',
|
1408 |
-
),
|
1409 |
-
'remove_date_from_tracking_info' => array(
|
1410 |
-
'type' => 'checkbox',
|
1411 |
-
'title' => __( 'Remove date from tracking info', 'woo-advanced-shipment-tracking' ),
|
1412 |
-
'desc' => '',
|
1413 |
-
),
|
1414 |
-
'email_shipment_tracking_header' => array(
|
1415 |
-
'type' => 'text',
|
1416 |
-
'title' => __( 'Header Text', 'woo-advanced-shipment-tracking' ),
|
1417 |
-
'desc' => '',
|
1418 |
-
'placeholder' => __( 'Tracking Information', 'woo-advanced-shipment-tracking' ),
|
1419 |
-
),
|
1420 |
-
'email_shipment_tracking_header_text' => array(
|
1421 |
-
'type' => 'textarea',
|
1422 |
-
'title' => __( 'Additional text after header', 'woo-advanced-shipment-tracking' ),
|
1423 |
-
'desc' => '',
|
1424 |
-
),
|
1425 |
-
'email_table_backgroud_color' => array(
|
1426 |
-
'type' => 'color',
|
1427 |
-
'title' => __( 'Table Background color', 'woo-advanced-shipment-tracking' ),
|
1428 |
-
'desc' => '',
|
1429 |
-
'class' => 'color_field',
|
1430 |
-
),
|
1431 |
-
'email_border_color' => array(
|
1432 |
-
'type' => 'text',
|
1433 |
-
'title' => __( 'Table Border color', 'woo-advanced-shipment-tracking' ),
|
1434 |
-
'desc' => '',
|
1435 |
-
'class' => 'color_field',
|
1436 |
-
),
|
1437 |
-
'email_border_size' => array(
|
1438 |
-
'type' => 'dropdown',
|
1439 |
-
'title' => __( 'Table Border size', 'woo-advanced-shipment-tracking' ),
|
1440 |
-
'desc' => '',
|
1441 |
-
'options' => array(
|
1442 |
-
'' => __( 'Select', 'woo-advanced-shipment-tracking' ),
|
1443 |
-
'1' => '1 px',
|
1444 |
-
'2' => '2 px',
|
1445 |
-
'3' => '3 px',
|
1446 |
-
'4' => '4 px',
|
1447 |
-
'5' => '5 px',
|
1448 |
-
)
|
1449 |
-
),
|
1450 |
-
'email_table_header_font_size' => array(
|
1451 |
-
'type' => 'dropdown',
|
1452 |
-
'title' => __( 'Table header font size', 'woo-advanced-shipment-tracking' ),
|
1453 |
-
'desc' => '',
|
1454 |
-
'options' => $font_size_array
|
1455 |
-
),
|
1456 |
-
'email_table_header_font_color' => array(
|
1457 |
-
'type' => 'color',
|
1458 |
-
'title' => __( 'Table header font color', 'woo-advanced-shipment-tracking' ),
|
1459 |
-
'desc' => '',
|
1460 |
-
'class' => 'color_field',
|
1461 |
-
),
|
1462 |
-
'email_table_content_font_size' => array(
|
1463 |
-
'type' => 'dropdown',
|
1464 |
-
'title' => __( 'Table content font size', 'woo-advanced-shipment-tracking' ),
|
1465 |
-
'desc' => '',
|
1466 |
-
'options' => $font_size_array
|
1467 |
-
),
|
1468 |
-
'email_table_content_font_color' => array(
|
1469 |
-
'type' => 'color',
|
1470 |
-
'title' => __( 'Table content font color', 'woo-advanced-shipment-tracking' ),
|
1471 |
-
'desc' => '',
|
1472 |
-
'class' => 'color_field',
|
1473 |
-
),
|
1474 |
-
'email_table_tracking_link_font_color' => array(
|
1475 |
-
'type' => 'color',
|
1476 |
-
'title' => __( 'Tracking link font color', 'woo-advanced-shipment-tracking' ),
|
1477 |
-
'desc' => '',
|
1478 |
-
'class' => 'color_field',
|
1479 |
-
),
|
1480 |
-
'email_table_tracking_link_bg_color' => array(
|
1481 |
-
'type' => 'color',
|
1482 |
-
'title' => __( 'Tracking link background color', 'woo-advanced-shipment-tracking' ),
|
1483 |
-
'desc' => '',
|
1484 |
-
'class' => 'color_field',
|
1485 |
-
)
|
1486 |
-
);
|
1487 |
-
return $form_data;
|
1488 |
-
|
1489 |
-
}
|
1490 |
|
1491 |
/*
|
1492 |
* settings form save
|
@@ -1748,34 +1628,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1748 |
}
|
1749 |
</style>
|
1750 |
<?php
|
1751 |
-
}
|
1752 |
-
|
1753 |
-
/**
|
1754 |
-
* Preview email template.
|
1755 |
-
*/
|
1756 |
-
public function preview_emails() {
|
1757 |
-
|
1758 |
-
if ( isset( $_GET['preview_tracking_info_design'] ) ) {
|
1759 |
-
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'preview-mail' ) ) {
|
1760 |
-
die( 'Security check' );
|
1761 |
-
}
|
1762 |
-
$mailer = WC()->mailer();
|
1763 |
-
|
1764 |
-
// get the preview email subject
|
1765 |
-
$email_heading = __( 'HTML email template', 'woocommerce' );
|
1766 |
-
ob_start();
|
1767 |
-
include 'views/html-tracking-info-design-preview.php';
|
1768 |
-
$message = ob_get_clean();
|
1769 |
-
// create a new email
|
1770 |
-
$email = new WC_Email();
|
1771 |
-
|
1772 |
-
// wrap the content with the email template and then add styles
|
1773 |
-
$message = apply_filters( 'woocommerce_mail_content', $email->style_inline( $mailer->wrap_message( $email_heading, $message ) ) );
|
1774 |
-
|
1775 |
-
echo $message;
|
1776 |
-
exit;
|
1777 |
-
}
|
1778 |
-
}
|
1779 |
|
1780 |
function upload_tracking_csv_fun(){
|
1781 |
|
@@ -1855,23 +1708,26 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1855 |
$tracking_provider = $_POST['tracking_provider'];
|
1856 |
$tracking_number = $_POST['tracking_number'];
|
1857 |
$date_shipped = str_replace("/","-",$_POST['date_shipped']);
|
|
|
|
|
|
|
1858 |
$replace_tracking_info = $_POST['replace_tracking_info'];
|
1859 |
-
|
1860 |
global $wpdb;
|
1861 |
$woo_shippment_table_name = $this->table;
|
1862 |
$shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
|
1863 |
|
1864 |
if($shippment_provider == 0){
|
1865 |
-
echo '<li class="error">Failed - Invalid Tracking Provider</li>';exit;
|
1866 |
}
|
1867 |
if(empty($tracking_number)){
|
1868 |
-
echo '<li class="error">Failed - Empty Tracking Number</li>';exit;
|
1869 |
}
|
1870 |
if(empty($date_shipped)){
|
1871 |
-
echo '<li class="error">Failed - Empty Date Shipped</li>';exit;
|
1872 |
}
|
1873 |
if(!$this->isDate($date_shipped)){
|
1874 |
-
echo '<li class="error">Failed - Invalid Date Shipped</li>';exit;
|
1875 |
}
|
1876 |
|
1877 |
if($replace_tracking_info == 1){
|
@@ -1882,7 +1738,13 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
1882 |
|
1883 |
if ( count( $tracking_items ) > 0 ) {
|
1884 |
foreach ( $tracking_items as $key => $item ) {
|
1885 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1886 |
}
|
1887 |
$wast->save_tracking_items( $order_id, $tracking_items );
|
1888 |
}
|
@@ -2125,26 +1987,9 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2125 |
<input type="text" id="email_heading_<?php echo $email_list->id; ?>" name="email_heading" value="<?php echo $email_list->email_heading; ?>" placeholder="<?php _e('Please enter email heading here', 'woo-advanced-shipment-tracking'); ?>">
|
2126 |
</td>
|
2127 |
</tr>
|
2128 |
-
<tr valign="top" class="">
|
2129 |
-
<th scope="row" class="" colspan="2">
|
2130 |
-
<label for=""><?php _e('Email content', 'woo-advanced-shipment-tracking'); ?></label>
|
2131 |
-
</th>
|
2132 |
-
</tr>
|
2133 |
<tr valign="top" class="">
|
2134 |
-
<th scope="row" class="" colspan="2">
|
2135 |
-
<
|
2136 |
-
<h4><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
2137 |
-
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" value="{site_title}" style="width: 90px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2138 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_email}" style="width: 115px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2139 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_first_name}"style="width: 150px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2140 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_last_name}" style="width: 145px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2141 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_username}" style="width: 135px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2142 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_number}" style="width: 103px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2143 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_details}" style="width: 110px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2144 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{tracking_details}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2145 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{shipping_address}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2146 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{billing_address}"style="width: 125px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2147 |
-
</div>
|
2148 |
<?php
|
2149 |
add_filter( 'wp_default_editor', create_function('', 'return "visual";') );
|
2150 |
$content = $email_list->email_content;
|
@@ -2162,6 +2007,19 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2162 |
]);
|
2163 |
?>
|
2164 |
<!--textarea name="<?php echo $editor_id; ?>"><?php echo $content; ?></textarea-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2165 |
</th>
|
2166 |
</tr>
|
2167 |
<tr valign="top" class="">
|
@@ -2171,20 +2029,7 @@ class WC_Advanced_Shipment_Tracking_Admin {
|
|
2171 |
</th>
|
2172 |
</tr>
|
2173 |
</tbody>
|
2174 |
-
</table>
|
2175 |
-
<div class="variable_div">
|
2176 |
-
<h4><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
2177 |
-
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" value="{site_title}" style="width: 90px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2178 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_email}" style="width: 115px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2179 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_first_name}"style="width: 150px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2180 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_last_name}" style="width: 145px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2181 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{customer_username}" style="width: 135px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2182 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_number}" style="width: 103px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2183 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{order_details}" style="width: 110px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2184 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{tracking_details}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2185 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{shipping_address}" style="width: 130px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2186 |
-
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" value="{billing_address}"style="width: 125px;"><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2187 |
-
</div>
|
2188 |
<input type="hidden" name="id_list" id="id_list" value="<?php echo $id_string; ?>">
|
2189 |
<input type="hidden" name="action" value="update_status_email">
|
2190 |
<input type="hidden" name="status_email_id" class="status_email_id" value="<?php echo $email_list->id; ?>">
|
136 |
|
137 |
add_action( 'wp_ajax_update_email_type', array( $this, 'update_email_type_fun') );
|
138 |
|
139 |
+
add_action( 'admin_footer', array( $this, 'footer_function') );
|
|
|
|
|
140 |
}
|
141 |
|
142 |
/*
|
813 |
</form>
|
814 |
|
815 |
<script type="text/template" id="tmpl-shipping-provider-row-template">
|
816 |
+
<tr class="provider_tr tr_add">
|
817 |
+
<td class="column-columnname shipping_provider" colspan="5">
|
|
|
|
|
|
|
|
|
|
|
818 |
<input type="text" class="text" value="{{{ data.rate.provider_name }}}" placeholder="<?php _e( 'Shipping Provider', 'woo-advanced-shipment-tracking' ); ?>" name="data[{{{ data.index }}}][provider_name]" />
|
819 |
</td>
|
820 |
+
</tr>
|
821 |
+
<tr class="provider_tr tr_add">
|
822 |
+
<td class="column-columnname shipping_country" colspan="5">
|
823 |
<select class="select wcast_shipping_country" name="data[{{{ data.index }}}][shipping_country]" >
|
824 |
<option value="" <# if ( "" === data.rate.rate_condition ) { #>selected="selected"<# } #>><?php _e( 'None', 'woo-advanced-shipment-tracking' ); ?></option>
|
825 |
<?php
|
829 |
?>
|
830 |
</select>
|
831 |
</td>
|
832 |
+
</tr>
|
833 |
+
<tr class="provider_tr tr_add">
|
834 |
+
<td class="column-columnname cusgtom_provider_thumb" colspan="5">
|
835 |
+
<input type='text' placeholder='Image' name='data[{{{ data.index }}}][thumb_url]' class='image_path' value='' id='image_path'>
|
836 |
+
<input type='hidden' name='data[{{{ data.index }}}][thumb_id]' class='image_id' placeholder="Image" value='' id='image_id' style="">
|
837 |
+
<input id="upload_image_button" type="button" class="button" value="<?php _e( 'Upload' , 'woo-advanced-shipment-tracking'); ?>" />
|
838 |
+
</td>
|
839 |
+
</tr>
|
840 |
+
<tr class="provider_tr tr_add">
|
841 |
+
<td class="column-columnname shipping_url" colspan="5">
|
842 |
<input type="text" class="text" name="data[{{{ data.index }}}][provider_url]" value="" placeholder="<?php _e( 'Tracking Page', 'woo-advanced-shipment-tracking' ); ?>">
|
843 |
<p><?php _e('You can add tracking number parameter like this - http://shippingprovider.com?tracking_number=%number% , %number% - parameter', 'woo-advanced-shipment-tracking'); ?></p>
|
844 |
</td>
|
845 |
+
</tr>
|
846 |
+
<tr class="provider_tr tr_add">
|
847 |
+
<td colspan="5">
|
848 |
<input type="hidden" name="data[{{{ data.index }}}][sort_order]" class="sort_order" value="{{{ data.sort_id }}}">
|
849 |
<button class="button button-primary add_new btn_green"><?php _e( 'Save', 'woo-advanced-shipment-tracking' ); ?></button>
|
850 |
+
<a href="JavaScript:Void(0);" class="remove" data-pid="{{{ data.index }}}"><?php _e( 'Cancel' , 'woo-advanced-shipment-tracking'); ?></a>
|
851 |
+
<!--span class="dashicons dashicons-trash remove" data-pid="{{{ data.index }}}"></span-->
|
852 |
</td>
|
853 |
+
</tr>
|
854 |
</script>
|
855 |
</div>
|
856 |
</section>
|
858 |
<div class="tab_inner_container">
|
859 |
<form method="post" id="wc_ast_settings_form" action="" enctype="multipart/form-data">
|
860 |
<?php #nonce?>
|
861 |
+
<ul class="subsubsub">
|
862 |
+
<li><a href="javascript:void(0)" class="current">General</a> | </li>
|
863 |
+
<li><a href="<?php echo wcast_initialise_customizer_settings::get_customizer_url() ?>" class=""><?php _e( 'Tracking Info Display Designer', 'woo-advanced-shipment-tracking' ); ?></a></li>
|
864 |
+
</ul>
|
865 |
+
<br class="clear">
|
866 |
<h3><?php _e( 'Settings', 'woo-advanced-shipment-tracking' ); ?></h3>
|
867 |
+
<?php $this->get_html( $this->get_settings_data() );?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
</form>
|
869 |
</div>
|
870 |
</section>
|
1038 |
<td scope="row" class="">
|
1039 |
<input type="text" id="email_heading" name="email_heading" placeholder="<?php _e('Please enter email heading here', 'woo-advanced-shipment-tracking'); ?>">
|
1040 |
</td>
|
1041 |
+
</tr>
|
|
|
|
|
|
|
|
|
|
|
1042 |
<tr valign="top" class="hide_default show_if_any" colspan="2">
|
1043 |
+
<th scope="row" class="" colspan="2">
|
1044 |
+
<p style="margin-top: 0;"><label for=""><?php _e('Email content', 'woo-advanced-shipment-tracking'); ?></label></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1045 |
<?php
|
1046 |
$content = '';
|
1047 |
$editor_id = 'email_content';
|
1055 |
'quicktags' => true,
|
1056 |
'editor_height' => 200,
|
1057 |
]);
|
1058 |
+
//wp_editor( $content, $editor_id, $settings );?>
|
1059 |
+
<div class="variable_div hide_default show_if_any">
|
1060 |
+
<h4 style=""><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
1061 |
+
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" class="site_title_tag" value="{site_title}" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1062 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="customer_email_tag" value="{customer_email}" style="width: 115px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1063 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="first_name_tag" value="{customer_first_name}"style="width: 150px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1064 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="last_name_tag" value="{customer_last_name}" style="width: 145px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1065 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="username_tag" value="{customer_username}" style="width: 135px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1066 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="order_number_tag" value="{order_number}" style="width: 103px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1067 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="order_details_tag" value="{order_details}" style="width: 110px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1068 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="tracking_details_tag" value="{tracking_details}" style="width: 130px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1069 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="shipping_address_tag" value="{shipping_address}" style="width: 130px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1070 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="billing_address_tag" value="{billing_address}"style="width: 125px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
1071 |
+
</div>
|
1072 |
</th>
|
1073 |
</tr>
|
1074 |
</tbody>
|
1075 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1076 |
<div class="" style="clear:both;">
|
1077 |
<input type="hidden" name="action" value="save_status_email">
|
1078 |
<button type="submit" class="button-primary btn_green hide_default show_if_any" name="save_shipment_status_email" id="save_shipment_status_email"><?php _e('Save', 'woo-advanced-shipment-tracking'); ?></button>
|
1366 |
);
|
1367 |
return $form_data;
|
1368 |
|
1369 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1370 |
|
1371 |
/*
|
1372 |
* settings form save
|
1628 |
}
|
1629 |
</style>
|
1630 |
<?php
|
1631 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1632 |
|
1633 |
function upload_tracking_csv_fun(){
|
1634 |
|
1708 |
$tracking_provider = $_POST['tracking_provider'];
|
1709 |
$tracking_number = $_POST['tracking_number'];
|
1710 |
$date_shipped = str_replace("/","-",$_POST['date_shipped']);
|
1711 |
+
if(empty($date_shipped)){
|
1712 |
+
$date_shipped = date("d-m-Y");
|
1713 |
+
}
|
1714 |
$replace_tracking_info = $_POST['replace_tracking_info'];
|
1715 |
+
// echo '<pre>';print_r($_POST['trackings']);echo '</pre>';
|
1716 |
global $wpdb;
|
1717 |
$woo_shippment_table_name = $this->table;
|
1718 |
$shippment_provider = $wpdb->get_var( "SELECT COUNT(*) FROM $woo_shippment_table_name WHERE provider_name = '".$tracking_provider."'" );
|
1719 |
|
1720 |
if($shippment_provider == 0){
|
1721 |
+
echo '<li class="error">Failed - Invalid Tracking Provider for Order Id - '.$_POST['order_id'].'</li>';exit;
|
1722 |
}
|
1723 |
if(empty($tracking_number)){
|
1724 |
+
echo '<li class="error">Failed - Empty Tracking Number for Order Id - '.$_POST['order_id'].'</li>';exit;
|
1725 |
}
|
1726 |
if(empty($date_shipped)){
|
1727 |
+
echo '<li class="error">Failed - Empty Date Shipped for Order Id - '.$_POST['order_id'].'</li>';exit;
|
1728 |
}
|
1729 |
if(!$this->isDate($date_shipped)){
|
1730 |
+
echo '<li class="error">Failed - Invalid Date Shipped for Order Id - '.$_POST['order_id'].'</li>';exit;
|
1731 |
}
|
1732 |
|
1733 |
if($replace_tracking_info == 1){
|
1738 |
|
1739 |
if ( count( $tracking_items ) > 0 ) {
|
1740 |
foreach ( $tracking_items as $key => $item ) {
|
1741 |
+
$tracking_number = $item['tracking_number'];
|
1742 |
+
|
1743 |
+
if(in_array($tracking_number, array_column($_POST['trackings'], 'tracking_number'))) {
|
1744 |
+
|
1745 |
+
} else{
|
1746 |
+
unset( $tracking_items[ $key ] );
|
1747 |
+
}
|
1748 |
}
|
1749 |
$wast->save_tracking_items( $order_id, $tracking_items );
|
1750 |
}
|
1987 |
<input type="text" id="email_heading_<?php echo $email_list->id; ?>" name="email_heading" value="<?php echo $email_list->email_heading; ?>" placeholder="<?php _e('Please enter email heading here', 'woo-advanced-shipment-tracking'); ?>">
|
1988 |
</td>
|
1989 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
1990 |
<tr valign="top" class="">
|
1991 |
+
<th scope="row" class="" colspan="2">
|
1992 |
+
<p style="margin-top: 0;"><label for=""><?php _e('Email content', 'woo-advanced-shipment-tracking'); ?></label></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1993 |
<?php
|
1994 |
add_filter( 'wp_default_editor', create_function('', 'return "visual";') );
|
1995 |
$content = $email_list->email_content;
|
2007 |
]);
|
2008 |
?>
|
2009 |
<!--textarea name="<?php echo $editor_id; ?>"><?php echo $content; ?></textarea-->
|
2010 |
+
<div class="variable_div">
|
2011 |
+
<h4><?php _e('Variables', 'woo-advanced-shipment-tracking'); ?></h4>
|
2012 |
+
<div class="variable_tag" id="variable_tag" ><input type="text" id="var_input" class="site_title_tag" value="{site_title}" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2013 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="customer_email_tag" value="{customer_email}" style="width: 115px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2014 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="first_name_tag" value="{customer_first_name}"style="width: 150px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2015 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="last_name_tag" value="{customer_last_name}" style="width: 145px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2016 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="username_tag" value="{customer_username}" style="width: 135px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2017 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="order_number_tag" value="{order_number}" style="width: 103px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2018 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="order_details_tag" value="{order_details}" style="width: 110px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2019 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="tracking_details_tag" value="{tracking_details}" style="width: 130px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2020 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="shipping_address_tag" value="{shipping_address}" style="width: 130px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2021 |
+
<div class="variable_tag" id="variable_tag"><input type="text" id="var_input" class="billing_address_tag" value="{billing_address}"style="width: 125px;" readonly><span class="copy"><?php _e('Copied', 'woo-advanced-shipment-tracking'); ?></span></div>
|
2022 |
+
</div>
|
2023 |
</th>
|
2024 |
</tr>
|
2025 |
<tr valign="top" class="">
|
2029 |
</th>
|
2030 |
</tr>
|
2031 |
</tbody>
|
2032 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2033 |
<input type="hidden" name="id_list" id="id_list" value="<?php echo $id_string; ?>">
|
2034 |
<input type="hidden" name="action" value="update_status_email">
|
2035 |
<input type="hidden" name="status_email_id" class="status_email_id" value="<?php echo $email_list->id; ?>">
|
includes/customizer/class-wc-tracking-info-customizer.php
ADDED
@@ -0,0 +1,739 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Customizer Setup and Custom Controls
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Adds the individual sections, settings, and controls to the theme customizer
|
9 |
+
*/
|
10 |
+
class wcast_initialise_customizer_settings {
|
11 |
+
// Get our default values
|
12 |
+
private $defaults;
|
13 |
+
private static $order_ids = null;
|
14 |
+
public function __construct() {
|
15 |
+
// Get our Customizer defaults
|
16 |
+
$this->defaults = $this->wcast_generate_defaults();
|
17 |
+
|
18 |
+
// Register our sample default controls
|
19 |
+
add_action( 'customize_register', array( $this, 'wcast_register_sample_default_controls' ) );
|
20 |
+
|
21 |
+
// Only proceed if this is own request.
|
22 |
+
if ( ! wcast_initialise_customizer_settings::is_own_customizer_request() && ! wcast_initialise_customizer_settings::is_own_preview_request() ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
// Set up preview.
|
26 |
+
|
27 |
+
// Register our Panels
|
28 |
+
add_action( 'customize_register', array( $this, 'wcast_add_customizer_panels' ) );
|
29 |
+
|
30 |
+
// Register our sections
|
31 |
+
add_action( 'customize_register', array( $this, 'wcast_add_customizer_sections' ) );
|
32 |
+
|
33 |
+
// Remove unrelated components.
|
34 |
+
add_filter( 'customize_loaded_components', array( $this, 'remove_unrelated_components' ), 99, 2 );
|
35 |
+
|
36 |
+
// Remove unrelated sections.
|
37 |
+
add_filter( 'customize_section_active', array( $this, 'remove_unrelated_sections' ), 10, 2 );
|
38 |
+
|
39 |
+
// Unhook divi front end.
|
40 |
+
add_action( 'woomail_footer', array( $this, 'unhook_divi' ), 10 );
|
41 |
+
|
42 |
+
// Unhook Flatsome js
|
43 |
+
add_action( 'customize_preview_init', array( $this, 'unhook_flatsome' ), 50 );
|
44 |
+
|
45 |
+
add_filter( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_customizer_scripts' ) );
|
46 |
+
|
47 |
+
add_action( 'parse_request', array( $this, 'set_up_preview' ) );
|
48 |
+
|
49 |
+
add_action( 'customize_preview_init', array( $this, 'enqueue_preview_scripts' ) );
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
public function enqueue_preview_scripts() {
|
54 |
+
wp_enqueue_script('wcast-preview-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/preview-scripts.js', array('jquery', 'customize-preview'), wc_advanced_shipment_tracking()->version, true);
|
55 |
+
}
|
56 |
+
/**
|
57 |
+
* Enqueue Customizer scripts
|
58 |
+
*
|
59 |
+
* @access public
|
60 |
+
* @return void
|
61 |
+
*/
|
62 |
+
public function enqueue_customizer_scripts() {
|
63 |
+
if(isset( $_REQUEST['wcast-tracking-customize'] ) && '1' === $_REQUEST['wcast-tracking-customize']){
|
64 |
+
wp_enqueue_style('wcast-customizer-styles', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/css/customizer-styles.css', wc_advanced_shipment_tracking()->version );
|
65 |
+
wp_enqueue_script('wcast-customizer-scripts', wc_advanced_shipment_tracking()->plugin_dir_url() . '/assets/js/customizer-scripts.js', array('jquery', 'customize-controls'), wc_advanced_shipment_tracking()->version, true);
|
66 |
+
|
67 |
+
// Send variables to Javascript
|
68 |
+
wp_localize_script('wcast-customizer-scripts', 'wcast_customizer', array(
|
69 |
+
'ajax_url' => admin_url('admin-ajax.php'),
|
70 |
+
'customizer_url' => $this->get_customizer_url(),
|
71 |
+
'labels' => array(
|
72 |
+
'customtitle' => __('Tracking info display', 'woo-advanced-shipment-tracking'),
|
73 |
+
),
|
74 |
+
));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
/**
|
78 |
+
* Checks to see if we are opening our custom customizer preview
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
public static function is_own_preview_request() {
|
84 |
+
return isset( $_REQUEST['wcast-tracking-preview'] ) && '1' === $_REQUEST['wcast-tracking-preview'];
|
85 |
+
}
|
86 |
+
/**
|
87 |
+
* Checks to see if we are opening our custom customizer controls
|
88 |
+
*
|
89 |
+
* @access public
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
public static function is_own_customizer_request() {
|
93 |
+
return isset( $_REQUEST['wcast-tracking-customize'] ) && $_REQUEST['wcast-tracking-customize'] === '1';
|
94 |
+
}
|
95 |
+
/*
|
96 |
+
* Unhook flatsome front end.
|
97 |
+
*/
|
98 |
+
public function unhook_flatsome() {
|
99 |
+
// Unhook flatsome issue.
|
100 |
+
wp_dequeue_style( 'flatsome-customizer-preview' );
|
101 |
+
wp_dequeue_script( 'flatsome-customizer-frontend-js' );
|
102 |
+
}
|
103 |
+
/*
|
104 |
+
* Unhook Divi front end.
|
105 |
+
*/
|
106 |
+
public function unhook_divi() {
|
107 |
+
// Divi Theme issue.
|
108 |
+
remove_action( 'wp_footer', 'et_builder_get_modules_js_data' );
|
109 |
+
remove_action( 'et_customizer_footer_preview', 'et_load_social_icons' );
|
110 |
+
}
|
111 |
+
/**
|
112 |
+
* Get Customizer URL
|
113 |
+
*
|
114 |
+
*/
|
115 |
+
public static function get_customizer_url() {
|
116 |
+
$customizer_url = add_query_arg( array(
|
117 |
+
'wcast-tracking-customize' => '1',
|
118 |
+
'url' => urlencode( add_query_arg( array( 'wcast-tracking-preview' => '1' ), home_url( '/' ) ) ),
|
119 |
+
'return' => urlencode( wcast_initialise_customizer_settings::get_email_settings_page_url() ),
|
120 |
+
), admin_url( 'customize.php' ) );
|
121 |
+
|
122 |
+
return $customizer_url;
|
123 |
+
}
|
124 |
+
/**
|
125 |
+
* Get WooCommerce email settings page URL
|
126 |
+
*
|
127 |
+
* @access public
|
128 |
+
* @return string
|
129 |
+
*/
|
130 |
+
public static function get_email_settings_page_url() {
|
131 |
+
return admin_url( 'admin.php?page=woocommerce-advanced-shipment-tracking' );
|
132 |
+
}
|
133 |
+
public function wcast_generate_defaults() {
|
134 |
+
$customizer_defaults = array(
|
135 |
+
'display_shipment_provider_image' => '',
|
136 |
+
'remove_date_from_tracking' => '',
|
137 |
+
'header_text_change' => '',
|
138 |
+
'additional_header_text' => '',
|
139 |
+
'table_bg_color' => '',
|
140 |
+
'table_border_color' => '',
|
141 |
+
'table_border_size' => '',
|
142 |
+
'table_header_font_size' => '',
|
143 |
+
'table_header_font_color' => '',
|
144 |
+
'table_content_font_size' => '',
|
145 |
+
'table_content_font_color' => '',
|
146 |
+
'tracking_link_font_color' => '',
|
147 |
+
'tracking_link_bg_color' => '',
|
148 |
+
'wcast_preview_order_id' => 'mockup',
|
149 |
+
'table_content_line_height' => '20',
|
150 |
+
'table_content_font_weight' => '100'
|
151 |
+
);
|
152 |
+
|
153 |
+
return apply_filters( 'skyrocket_customizer_defaults', $customizer_defaults );
|
154 |
+
}
|
155 |
+
/**
|
156 |
+
* Register the Customizer panels
|
157 |
+
*/
|
158 |
+
public function wcast_add_customizer_panels( $wp_customize ) {
|
159 |
+
/**
|
160 |
+
* Add our Header & Navigation Panel
|
161 |
+
*/
|
162 |
+
$wp_customize->add_panel( 'header_naviation_panel',
|
163 |
+
array(
|
164 |
+
'title' => __( 'Header & Navigation', 'woo-advanced-shipment-tracking' ),
|
165 |
+
'description' => esc_html__( 'Adjust your Header and Navigation sections.', 'woo-advanced-shipment-tracking' )
|
166 |
+
)
|
167 |
+
);
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Register the Customizer sections
|
172 |
+
*/
|
173 |
+
public function wcast_add_customizer_sections( $wp_customize ) {
|
174 |
+
$wp_customize->add_section( 'default_controls_section',
|
175 |
+
array(
|
176 |
+
'title' => __( 'Tracking info display', 'woo-advanced-shipment-tracking' ),
|
177 |
+
'description' => esc_html__( 'This section lets you customize the Tracking Info display design.', 'woo-advanced-shipment-tracking' )
|
178 |
+
)
|
179 |
+
);
|
180 |
+
}
|
181 |
+
/**
|
182 |
+
* Get Order Ids
|
183 |
+
*
|
184 |
+
* @access public
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
public static function get_order_ids() {
|
188 |
+
if ( is_null( wcast_initialise_customizer_settings::$order_ids ) ) {
|
189 |
+
$order_array = array();
|
190 |
+
$order_array['mockup'] = __( 'Mockup Order', 'woo-advanced-shipment-tracking' );
|
191 |
+
$orders = new WP_Query(
|
192 |
+
array(
|
193 |
+
'post_type' => 'shop_order',
|
194 |
+
'post_status' => array_keys( wc_get_order_statuses() ),
|
195 |
+
'posts_per_page' => 20,
|
196 |
+
)
|
197 |
+
);
|
198 |
+
if ( $orders->posts ) {
|
199 |
+
foreach ( $orders->posts as $order ) {
|
200 |
+
// Get order object.
|
201 |
+
$order_object = new WC_Order( $order->ID );
|
202 |
+
$order_array[ $order_object->get_id() ] = $order_object->get_id() . ' - ' . $order_object->get_billing_first_name() . ' ' . $order_object->get_billing_last_name();
|
203 |
+
}
|
204 |
+
}
|
205 |
+
wcast_initialise_customizer_settings::$order_ids = $order_array;
|
206 |
+
}
|
207 |
+
return wcast_initialise_customizer_settings::$order_ids;
|
208 |
+
}
|
209 |
+
/**
|
210 |
+
* Register our sample default controls
|
211 |
+
*/
|
212 |
+
public function wcast_register_sample_default_controls( $wp_customize ) {
|
213 |
+
/**
|
214 |
+
* Load all our Customizer Custom Controls
|
215 |
+
*/
|
216 |
+
require_once trailingslashit( dirname(__FILE__) ) . 'custom-controls.php';
|
217 |
+
// Preview Order
|
218 |
+
$wp_customize->add_setting( 'wcast_preview_order_id',
|
219 |
+
array(
|
220 |
+
'default' => $this->defaults['wcast_preview_order_id'],
|
221 |
+
'transport' => 'refresh',
|
222 |
+
'sanitize_callback' => ''
|
223 |
+
)
|
224 |
+
);
|
225 |
+
$wp_customize->add_control( 'wcast_preview_order_id',
|
226 |
+
array(
|
227 |
+
'label' => __( 'Preview order', 'woo-advanced-shipment-tracking' ),
|
228 |
+
'section' => 'default_controls_section',
|
229 |
+
'type' => 'select',
|
230 |
+
'choices' => wcast_initialise_customizer_settings::get_order_ids(),
|
231 |
+
)
|
232 |
+
);
|
233 |
+
// Display Shipment Provider image/thumbnail
|
234 |
+
$wp_customize->add_setting( 'display_shipment_provider_image',
|
235 |
+
array(
|
236 |
+
'default' => $this->defaults['display_shipment_provider_image'],
|
237 |
+
'transport' => 'postMessage',
|
238 |
+
'sanitize_callback' => ''
|
239 |
+
)
|
240 |
+
);
|
241 |
+
$wp_customize->add_control( 'display_shipment_provider_image',
|
242 |
+
array(
|
243 |
+
'label' => __( 'Shipment Provider image', 'woo-advanced-shipment-tracking' ),
|
244 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
245 |
+
'section' => 'default_controls_section',
|
246 |
+
'type' => 'checkbox'
|
247 |
+
)
|
248 |
+
);
|
249 |
+
|
250 |
+
// Remove date from tracking info
|
251 |
+
$wp_customize->add_setting( 'remove_date_from_tracking',
|
252 |
+
array(
|
253 |
+
'default' => $this->defaults['remove_date_from_tracking'],
|
254 |
+
'transport' => 'postMessage',
|
255 |
+
'sanitize_callback' => ''
|
256 |
+
)
|
257 |
+
);
|
258 |
+
$wp_customize->add_control( 'remove_date_from_tracking',
|
259 |
+
array(
|
260 |
+
'label' => __( 'Remove date from tracking info', 'woo-advanced-shipment-tracking' ),
|
261 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
262 |
+
'section' => 'default_controls_section',
|
263 |
+
'type' => 'checkbox'
|
264 |
+
)
|
265 |
+
);
|
266 |
+
|
267 |
+
// Header Text
|
268 |
+
$wp_customize->add_setting( 'header_text_change',
|
269 |
+
array(
|
270 |
+
'default' => $this->defaults['header_text_change'],
|
271 |
+
'transport' => 'postMessage',
|
272 |
+
'sanitize_callback' => ''
|
273 |
+
)
|
274 |
+
);
|
275 |
+
$wp_customize->add_control( 'header_text_change',
|
276 |
+
array(
|
277 |
+
'label' => __( 'Header Text', 'woo-advanced-shipment-tracking' ),
|
278 |
+
'description' => esc_html__( '', 'woo-advanced-shipment-tracking' ),
|
279 |
+
'section' => 'default_controls_section',
|
280 |
+
'type' => 'text',
|
281 |
+
'input_attrs' => array(
|
282 |
+
'class' => '',
|
283 |
+
'style' => '',
|
284 |
+
'placeholder' => __( 'Tracking Information', 'woo-advanced-shipment-tracking' ),
|
285 |
+
),
|
286 |
+
)
|
287 |
+
);
|
288 |
+
|
289 |
+
// Additional text after header
|
290 |
+
$wp_customize->add_setting( 'additional_header_text',
|
291 |
+
array(
|
292 |
+
'default' => $this->defaults['additional_header_text'],
|
293 |
+
'transport' => 'postMessage',
|
294 |
+
'sanitize_callback' => ''
|
295 |
+
)
|
296 |
+
);
|
297 |
+
$wp_customize->add_control( 'additional_header_text',
|
298 |
+
array(
|
299 |
+
'label' => __( 'Additional text after header', 'woo-advanced-shipment-tracking' ),
|
300 |
+
'section' => 'default_controls_section',
|
301 |
+
'type' => 'textarea',
|
302 |
+
'input_attrs' => array(
|
303 |
+
'class' => '',
|
304 |
+
'style' => '',
|
305 |
+
'placeholder' =>'',
|
306 |
+
),
|
307 |
+
)
|
308 |
+
);
|
309 |
+
|
310 |
+
// Test of Toggle Switch Custom Control
|
311 |
+
$wp_customize->add_setting( 'table_header',
|
312 |
+
array(
|
313 |
+
'default' => '',
|
314 |
+
'transport' => 'postMessage',
|
315 |
+
'sanitize_callback' => ''
|
316 |
+
)
|
317 |
+
);
|
318 |
+
$wp_customize->add_control( new WP_Customize_Heading_Control( $wp_customize, 'table_header',
|
319 |
+
array(
|
320 |
+
'label' => __( 'Table Design', 'woo-advanced-shipment-tracking' ),
|
321 |
+
'section' => 'default_controls_section'
|
322 |
+
)
|
323 |
+
) );
|
324 |
+
|
325 |
+
// Table Background color
|
326 |
+
$wp_customize->add_setting( 'table_bg_color',
|
327 |
+
array(
|
328 |
+
'default' => $this->defaults['table_bg_color'],
|
329 |
+
'transport' => 'postMessage',
|
330 |
+
'sanitize_callback' => 'sanitize_hex_color'
|
331 |
+
)
|
332 |
+
);
|
333 |
+
$wp_customize->add_control( 'table_bg_color',
|
334 |
+
array(
|
335 |
+
'label' => __( 'Background color', 'woo-advanced-shipment-tracking' ),
|
336 |
+
'section' => 'default_controls_section',
|
337 |
+
'type' => 'color',
|
338 |
+
)
|
339 |
+
);
|
340 |
+
|
341 |
+
// Table Border color
|
342 |
+
$wp_customize->add_setting( 'table_border_color',
|
343 |
+
array(
|
344 |
+
'default' => $this->defaults['table_border_color'],
|
345 |
+
'transport' => 'postMessage',
|
346 |
+
'sanitize_callback' => 'sanitize_hex_color'
|
347 |
+
)
|
348 |
+
);
|
349 |
+
$wp_customize->add_control( 'table_border_color',
|
350 |
+
array(
|
351 |
+
'label' => __( 'Border color', 'woo-advanced-shipment-tracking' ),
|
352 |
+
'section' => 'default_controls_section',
|
353 |
+
'type' => 'color'
|
354 |
+
)
|
355 |
+
);
|
356 |
+
|
357 |
+
// Table Border size
|
358 |
+
$wp_customize->add_setting( 'table_border_size',
|
359 |
+
array(
|
360 |
+
'default' => $this->defaults['table_border_size'],
|
361 |
+
'transport' => 'postMessage',
|
362 |
+
'sanitize_callback' => ''
|
363 |
+
)
|
364 |
+
);
|
365 |
+
$wp_customize->add_control( 'table_border_size',
|
366 |
+
array(
|
367 |
+
'label' => __( 'Border size', 'woo-advanced-shipment-tracking' ),
|
368 |
+
'section' => 'default_controls_section',
|
369 |
+
'type' => 'select',
|
370 |
+
'choices' => array(
|
371 |
+
'' => __( 'Select', 'woo-advanced-shipment-tracking' ),
|
372 |
+
'1' => '1 px',
|
373 |
+
'2' => '2 px',
|
374 |
+
'3' => '3 px',
|
375 |
+
'4' => '4 px',
|
376 |
+
'5' => '5 px',
|
377 |
+
)
|
378 |
+
)
|
379 |
+
);
|
380 |
+
$font_size_array[ '' ] = __( 'Select', 'woo-advanced-shipment-tracking' );
|
381 |
+
for ( $i = 10; $i <= 30; $i++ ) {
|
382 |
+
$font_size_array[ $i ] = $i."px";
|
383 |
+
}
|
384 |
+
// Table header font size
|
385 |
+
$wp_customize->add_setting( 'table_header_font_size',
|
386 |
+
array(
|
387 |
+
'default' => $this->defaults['table_header_font_size'],
|
388 |
+
'transport' => 'postMessage',
|
389 |
+
'sanitize_callback' => ''
|
390 |
+
)
|
391 |
+
);
|
392 |
+
$wp_customize->add_control( 'table_header_font_size',
|
393 |
+
array(
|
394 |
+
'label' => __( 'Header font size', 'woo-advanced-shipment-tracking' ),
|
395 |
+
'section' => 'default_controls_section',
|
396 |
+
'type' => 'select',
|
397 |
+
'choices' => $font_size_array
|
398 |
+
)
|
399 |
+
);
|
400 |
+
|
401 |
+
// Table header font color
|
402 |
+
$wp_customize->add_setting( 'table_header_font_color',
|
403 |
+
array(
|
404 |
+
'default' => $this->defaults['table_header_font_color'],
|
405 |
+
'transport' => 'postMessage',
|
406 |
+
'sanitize_callback' => ''
|
407 |
+
)
|
408 |
+
);
|
409 |
+
$wp_customize->add_control( 'table_header_font_color',
|
410 |
+
array(
|
411 |
+
'label' => __( 'Header font color', 'woo-advanced-shipment-tracking' ),
|
412 |
+
'section' => 'default_controls_section',
|
413 |
+
'type' => 'color'
|
414 |
+
)
|
415 |
+
);
|
416 |
+
|
417 |
+
// Table content font size
|
418 |
+
$wp_customize->add_setting( 'table_content_font_size',
|
419 |
+
array(
|
420 |
+
'default' => $this->defaults['table_content_font_size'],
|
421 |
+
'transport' => 'postMessage',
|
422 |
+
'sanitize_callback' => ''
|
423 |
+
)
|
424 |
+
);
|
425 |
+
$wp_customize->add_control( 'table_content_font_size',
|
426 |
+
array(
|
427 |
+
'label' => __( 'Content font size', 'woo-advanced-shipment-tracking' ),
|
428 |
+
'section' => 'default_controls_section',
|
429 |
+
'type' => 'select',
|
430 |
+
'choices' => $font_size_array
|
431 |
+
)
|
432 |
+
);
|
433 |
+
|
434 |
+
// Table content font color
|
435 |
+
$wp_customize->add_setting( 'table_content_font_color',
|
436 |
+
array(
|
437 |
+
'default' => $this->defaults['table_content_font_color'],
|
438 |
+
'transport' => 'postMessage',
|
439 |
+
'sanitize_callback' => ''
|
440 |
+
)
|
441 |
+
);
|
442 |
+
$wp_customize->add_control( 'table_content_font_color',
|
443 |
+
array(
|
444 |
+
'label' => __( 'Content font color', 'woo-advanced-shipment-tracking' ),
|
445 |
+
'section' => 'default_controls_section',
|
446 |
+
'type' => 'color'
|
447 |
+
)
|
448 |
+
);
|
449 |
+
|
450 |
+
// Table content line height
|
451 |
+
$wp_customize->add_setting( 'table_content_line_height',
|
452 |
+
array(
|
453 |
+
'default' => $this->defaults['table_content_line_height'],
|
454 |
+
'transport' => 'postMessage',
|
455 |
+
'sanitize_callback' => ''
|
456 |
+
)
|
457 |
+
);
|
458 |
+
$wp_customize->add_control( new Skyrocket_Slider_Custom_Control( $wp_customize, 'table_content_line_height',
|
459 |
+
array(
|
460 |
+
'label' => __( 'Content line height', 'woo-advanced-shipment-tracking' ),
|
461 |
+
'section' => 'default_controls_section',
|
462 |
+
'input_attrs' => array(
|
463 |
+
'default' => $this->defaults['table_content_line_height'],
|
464 |
+
'step' => 1,
|
465 |
+
'min' => 20,
|
466 |
+
'max' => 90,
|
467 |
+
),
|
468 |
+
)
|
469 |
+
));
|
470 |
+
|
471 |
+
// Table content font weight
|
472 |
+
$wp_customize->add_setting( 'table_content_font_weight',
|
473 |
+
array(
|
474 |
+
'default' => $this->defaults['table_content_font_weight'],
|
475 |
+
'transport' => 'postMessage',
|
476 |
+
'sanitize_callback' => ''
|
477 |
+
)
|
478 |
+
);
|
479 |
+
$wp_customize->add_control( new Skyrocket_Slider_Custom_Control( $wp_customize, 'table_content_font_weight',
|
480 |
+
array(
|
481 |
+
'label' => __( 'Content font weight', 'woo-advanced-shipment-tracking' ),
|
482 |
+
'section' => 'default_controls_section',
|
483 |
+
'input_attrs' => array(
|
484 |
+
'default' => $this->defaults['table_content_font_weight'],
|
485 |
+
'step' => 100,
|
486 |
+
'min' => 100,
|
487 |
+
'max' => 900,
|
488 |
+
),
|
489 |
+
)
|
490 |
+
));
|
491 |
+
|
492 |
+
// Tracking link font color
|
493 |
+
$wp_customize->add_setting( 'tracking_link_font_color',
|
494 |
+
array(
|
495 |
+
'default' => $this->defaults['tracking_link_font_color'],
|
496 |
+
'transport' => 'postMessage',
|
497 |
+
'sanitize_callback' => ''
|
498 |
+
)
|
499 |
+
);
|
500 |
+
$wp_customize->add_control( 'tracking_link_font_color',
|
501 |
+
array(
|
502 |
+
'label' => __( 'Link font color', 'woo-advanced-shipment-tracking' ),
|
503 |
+
'section' => 'default_controls_section',
|
504 |
+
'type' => 'color'
|
505 |
+
)
|
506 |
+
);
|
507 |
+
|
508 |
+
// Tracking link background color
|
509 |
+
$wp_customize->add_setting( 'tracking_link_bg_color',
|
510 |
+
array(
|
511 |
+
'default' => $this->defaults['tracking_link_bg_color'],
|
512 |
+
'transport' => 'postMessage',
|
513 |
+
'sanitize_callback' => ''
|
514 |
+
)
|
515 |
+
);
|
516 |
+
$wp_customize->add_control( 'tracking_link_bg_color',
|
517 |
+
array(
|
518 |
+
'label' => __( 'Link background color', 'woo-advanced-shipment-tracking' ),
|
519 |
+
'section' => 'default_controls_section',
|
520 |
+
'type' => 'color'
|
521 |
+
)
|
522 |
+
);
|
523 |
+
}
|
524 |
+
/**
|
525 |
+
* Remove unrelated components
|
526 |
+
*
|
527 |
+
* @access public
|
528 |
+
* @param array $components
|
529 |
+
* @param object $wp_customize
|
530 |
+
* @return array
|
531 |
+
*/
|
532 |
+
public function remove_unrelated_components($components, $wp_customize) {
|
533 |
+
// Iterate over components
|
534 |
+
foreach ($components as $component_key => $component) {
|
535 |
+
|
536 |
+
// Check if current component is own component
|
537 |
+
if ( ! wcast_initialise_customizer_settings::is_own_component( $component ) ) {
|
538 |
+
unset($components[$component_key]);
|
539 |
+
}
|
540 |
+
}
|
541 |
+
|
542 |
+
// Return remaining components
|
543 |
+
return $components;
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Remove unrelated sections
|
548 |
+
*
|
549 |
+
* @access public
|
550 |
+
* @param bool $active
|
551 |
+
* @param object $section
|
552 |
+
* @return bool
|
553 |
+
*/
|
554 |
+
public function remove_unrelated_sections( $active, $section ) {
|
555 |
+
// Check if current section is own section
|
556 |
+
if ( ! wcast_initialise_customizer_settings::is_own_section( $section->id ) ) {
|
557 |
+
return false;
|
558 |
+
}
|
559 |
+
|
560 |
+
// We can override $active completely since this runs only on own Customizer requests
|
561 |
+
return true;
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* Remove unrelated controls
|
566 |
+
*
|
567 |
+
* @access public
|
568 |
+
* @param bool $active
|
569 |
+
* @param object $control
|
570 |
+
* @return bool
|
571 |
+
*/
|
572 |
+
public function remove_unrelated_controls( $active, $control ) {
|
573 |
+
|
574 |
+
// Check if current control belongs to own section
|
575 |
+
if ( ! wcast_add_customizer_sections::is_own_section( $control->section ) ) {
|
576 |
+
return false;
|
577 |
+
}
|
578 |
+
|
579 |
+
// We can override $active completely since this runs only on own Customizer requests
|
580 |
+
return $active;
|
581 |
+
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* Check if current component is own component
|
585 |
+
*
|
586 |
+
* @access public
|
587 |
+
* @param string $component
|
588 |
+
* @return bool
|
589 |
+
*/
|
590 |
+
public static function is_own_component( $component ) {
|
591 |
+
return false;
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Check if current section is own section
|
596 |
+
*
|
597 |
+
* @access public
|
598 |
+
* @param string $key
|
599 |
+
* @return bool
|
600 |
+
*/
|
601 |
+
public static function is_own_section( $key ) {
|
602 |
+
|
603 |
+
if ($key === 'default_controls_section') {
|
604 |
+
return true;
|
605 |
+
}
|
606 |
+
|
607 |
+
// Section not found
|
608 |
+
return false;
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Set up preview
|
613 |
+
*
|
614 |
+
* @access public
|
615 |
+
* @return void
|
616 |
+
*/
|
617 |
+
public function set_up_preview() {
|
618 |
+
|
619 |
+
// Make sure this is own preview request.
|
620 |
+
if ( ! wcast_initialise_customizer_settings::is_own_preview_request() ) {
|
621 |
+
return;
|
622 |
+
}
|
623 |
+
include wc_advanced_shipment_tracking()->get_plugin_path() . '/includes/customizer/preview.php';
|
624 |
+
exit;
|
625 |
+
}
|
626 |
+
|
627 |
+
public function preview_completed_email(){
|
628 |
+
// Load WooCommerce emails.
|
629 |
+
$wc_emails = WC_Emails::instance();
|
630 |
+
$emails = $wc_emails->get_emails();
|
631 |
+
$email_template = 'customer_completed_order';
|
632 |
+
$preview_id = get_theme_mod('wcast_preview_order_id');
|
633 |
+
$email_type = 'WC_Email_Customer_Completed_Order';
|
634 |
+
if ( false === $email_type ) {
|
635 |
+
return false;
|
636 |
+
}
|
637 |
+
|
638 |
+
$order_status = 'completed';
|
639 |
+
|
640 |
+
if($preview_id == '' || $preview_id == 'mockup') {
|
641 |
+
$content = '<div style="padding: 35px 40px; background-color: white;">' . __( 'Please select preview order.', 'woo-advanced-shipment-tracking' ) . '</div>';
|
642 |
+
echo $content;
|
643 |
+
return;
|
644 |
+
}
|
645 |
+
|
646 |
+
// Reference email.
|
647 |
+
if ( isset( $emails[ $email_type ] ) && is_object( $emails[ $email_type ] ) ) {
|
648 |
+
$email = $emails[ $email_type ];
|
649 |
+
}
|
650 |
+
|
651 |
+
// Get an order
|
652 |
+
$order = self::get_wc_order_for_preview( $order_status, $preview_id );
|
653 |
+
|
654 |
+
// Make sure gateways are running in case the email needs to input content from them.
|
655 |
+
WC()->payment_gateways();
|
656 |
+
// Make sure shipping is running in case the email needs to input content from it.
|
657 |
+
WC()->shipping();
|
658 |
+
|
659 |
+
$email->object = $order;
|
660 |
+
$email->find['order-date'] = '{order_date}';
|
661 |
+
$email->find['order-number'] = '{order_number}';
|
662 |
+
if ( is_object( $order ) ) {
|
663 |
+
$email->replace['order-date'] = wc_format_datetime( $email->object->get_date_created() );
|
664 |
+
$email->replace['order-number'] = $email->object->get_order_number();
|
665 |
+
// Other properties
|
666 |
+
$email->recipient = $email->object->get_billing_email();
|
667 |
+
}
|
668 |
+
// Get email content and apply styles.
|
669 |
+
$content = $email->get_content();
|
670 |
+
$content = $email->style_inline( $content );
|
671 |
+
$content = apply_filters( 'woocommerce_mail_content', $content );
|
672 |
+
|
673 |
+
if ( 'plain' === $email->email_type ) {
|
674 |
+
$content = '<div style="padding: 35px 40px; background-color: white;">' . str_replace( "\n", '<br/>', $content ) . '</div>';
|
675 |
+
}
|
676 |
+
echo $content;
|
677 |
+
}
|
678 |
+
/**
|
679 |
+
* Get WooCommerce order for preview
|
680 |
+
*
|
681 |
+
* @access public
|
682 |
+
* @param string $order_status
|
683 |
+
* @return object
|
684 |
+
*/
|
685 |
+
public static function get_wc_order_for_preview( $order_status = null, $order_id = null ) {
|
686 |
+
if ( ! empty( $order_id ) && 'mockup' != $order_id ) {
|
687 |
+
return wc_get_order( $order_id );
|
688 |
+
} else {
|
689 |
+
// Use mockup order
|
690 |
+
|
691 |
+
// Instantiate order object
|
692 |
+
$order = new WC_Order();
|
693 |
+
|
694 |
+
// Other order properties
|
695 |
+
$order->set_props( array(
|
696 |
+
'id' => 1,
|
697 |
+
'status' => ( null === $order_status ? 'processing' : $order_status ),
|
698 |
+
'billing_first_name' => 'Sherlock',
|
699 |
+
'billing_last_name' => 'Holmes',
|
700 |
+
'billing_company' => 'Detectives Ltd.',
|
701 |
+
'billing_address_1' => '221B Baker Street',
|
702 |
+
'billing_city' => 'London',
|
703 |
+
'billing_postcode' => 'NW1 6XE',
|
704 |
+
'billing_country' => 'GB',
|
705 |
+
'billing_email' => 'sherlock@holmes.co.uk',
|
706 |
+
'billing_phone' => '02079304832',
|
707 |
+
'date_created' => date( 'Y-m-d H:i:s' ),
|
708 |
+
'total' => 24.90,
|
709 |
+
) );
|
710 |
+
|
711 |
+
// Item #1
|
712 |
+
$order_item = new WC_Order_Item_Product();
|
713 |
+
$order_item->set_props( array(
|
714 |
+
'name' => 'A Study in Scarlet',
|
715 |
+
'subtotal' => '9.95',
|
716 |
+
'sku' => 'kwd_ex_1',
|
717 |
+
) );
|
718 |
+
$order->add_item( $order_item );
|
719 |
+
|
720 |
+
// Item #2
|
721 |
+
$order_item = new WC_Order_Item_Product();
|
722 |
+
$order_item->set_props( array(
|
723 |
+
'name' => 'The Hound of the Baskervilles',
|
724 |
+
'subtotal' => '14.95',
|
725 |
+
'sku' => 'kwd_ex_2',
|
726 |
+
) );
|
727 |
+
$order->add_item( $order_item );
|
728 |
+
|
729 |
+
// Return mockup order
|
730 |
+
return $order;
|
731 |
+
}
|
732 |
+
|
733 |
+
}
|
734 |
+
}
|
735 |
+
/**
|
736 |
+
* Initialise our Customizer settings
|
737 |
+
*/
|
738 |
+
|
739 |
+
$wcast_customizer_settings = new wcast_initialise_customizer_settings();
|
includes/customizer/custom-controls.php
ADDED
@@ -0,0 +1,1076 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skyrocket Customizer Custom Controls
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
if ( class_exists( 'WP_Customize_Control' ) ) {
|
7 |
+
class WP_Customize_Heading_Control extends WP_Customize_Control {
|
8 |
+
|
9 |
+
public function render_content() {
|
10 |
+
?>
|
11 |
+
<label>
|
12 |
+
<h3 class="customize-control-title test"><?php echo esc_html( $this->label ); ?></h3>
|
13 |
+
<?php if ( ! empty( $this->description ) ) : ?>
|
14 |
+
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
15 |
+
<?php endif; ?>
|
16 |
+
</label>
|
17 |
+
<?php
|
18 |
+
}
|
19 |
+
}
|
20 |
+
/**
|
21 |
+
* Custom Control Base Class
|
22 |
+
*
|
23 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
24 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
25 |
+
* @link https://github.com/maddisondesigns
|
26 |
+
*/
|
27 |
+
class Skyrocket_Custom_Control extends WP_Customize_Control {
|
28 |
+
protected function get_skyrocket_resource_url() {
|
29 |
+
if( strpos( wp_normalize_path( __DIR__ ), wp_normalize_path( WP_PLUGIN_DIR ) ) === 0 ) {
|
30 |
+
// We're in a plugin directory and need to determine the url accordingly.
|
31 |
+
return plugin_dir_url( __DIR__ );
|
32 |
+
}
|
33 |
+
|
34 |
+
return trailingslashit( get_template_directory_uri() );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Image Check Box Custom Control
|
40 |
+
*
|
41 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
42 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
43 |
+
* @link https://github.com/maddisondesigns
|
44 |
+
*/
|
45 |
+
class Skyrocket_Image_Checkbox_Custom_Control extends Skyrocket_Custom_Control {
|
46 |
+
/**
|
47 |
+
* The type of control being rendered
|
48 |
+
*/
|
49 |
+
public $type = 'image_checkbox';
|
50 |
+
/**
|
51 |
+
* Enqueue our scripts and styles
|
52 |
+
*/
|
53 |
+
public function enqueue() {
|
54 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
55 |
+
}
|
56 |
+
/**
|
57 |
+
* Render the control in the customizer
|
58 |
+
*/
|
59 |
+
public function render_content() {
|
60 |
+
?>
|
61 |
+
<div class="image_checkbox_control">
|
62 |
+
<?php if( !empty( $this->label ) ) { ?>
|
63 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
64 |
+
<?php } ?>
|
65 |
+
<?php if( !empty( $this->description ) ) { ?>
|
66 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
67 |
+
<?php } ?>
|
68 |
+
<?php $chkboxValues = explode( ',', esc_attr( $this->value() ) ); ?>
|
69 |
+
<input type="hidden" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-multi-image-checkbox" <?php $this->link(); ?> />
|
70 |
+
<?php foreach ( $this->choices as $key => $value ) { ?>
|
71 |
+
<label class="checkbox-label">
|
72 |
+
<input type="checkbox" name="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php checked( in_array( esc_attr( $key ), $chkboxValues ), 1 ); ?> class="multi-image-checkbox"/>
|
73 |
+
<img src="<?php echo esc_attr( $value['image'] ); ?>" alt="<?php echo esc_attr( $value['name'] ); ?>" title="<?php echo esc_attr( $value['name'] ); ?>" />
|
74 |
+
</label>
|
75 |
+
<?php } ?>
|
76 |
+
</div>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Text Radio Button Custom Control
|
83 |
+
*
|
84 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
85 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
86 |
+
* @link https://github.com/maddisondesigns
|
87 |
+
*/
|
88 |
+
class Skyrocket_Text_Radio_Button_Custom_Control extends Skyrocket_Custom_Control {
|
89 |
+
/**
|
90 |
+
* The type of control being rendered
|
91 |
+
*/
|
92 |
+
public $type = 'text_radio_button';
|
93 |
+
/**
|
94 |
+
* Enqueue our scripts and styles
|
95 |
+
*/
|
96 |
+
public function enqueue() {
|
97 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
98 |
+
}
|
99 |
+
/**
|
100 |
+
* Render the control in the customizer
|
101 |
+
*/
|
102 |
+
public function render_content() {
|
103 |
+
?>
|
104 |
+
<div class="text_radio_button_control">
|
105 |
+
<?php if( !empty( $this->label ) ) { ?>
|
106 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
107 |
+
<?php } ?>
|
108 |
+
<?php if( !empty( $this->description ) ) { ?>
|
109 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
110 |
+
<?php } ?>
|
111 |
+
|
112 |
+
<div class="radio-buttons">
|
113 |
+
<?php foreach ( $this->choices as $key => $value ) { ?>
|
114 |
+
<label class="radio-button-label">
|
115 |
+
<input type="radio" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php $this->link(); ?> <?php checked( esc_attr( $key ), $this->value() ); ?>/>
|
116 |
+
<span><?php echo esc_attr( $value ); ?></span>
|
117 |
+
</label>
|
118 |
+
<?php } ?>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Image Radio Button Custom Control
|
127 |
+
*
|
128 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
129 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
130 |
+
* @link https://github.com/maddisondesigns
|
131 |
+
*/
|
132 |
+
class Skyrocket_Image_Radio_Button_Custom_Control extends Skyrocket_Custom_Control {
|
133 |
+
/**
|
134 |
+
* The type of control being rendered
|
135 |
+
*/
|
136 |
+
public $type = 'image_radio_button';
|
137 |
+
/**
|
138 |
+
* Enqueue our scripts and styles
|
139 |
+
*/
|
140 |
+
public function enqueue() {
|
141 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* Render the control in the customizer
|
145 |
+
*/
|
146 |
+
public function render_content() {
|
147 |
+
?>
|
148 |
+
<div class="image_radio_button_control">
|
149 |
+
<?php if( !empty( $this->label ) ) { ?>
|
150 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
151 |
+
<?php } ?>
|
152 |
+
<?php if( !empty( $this->description ) ) { ?>
|
153 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
154 |
+
<?php } ?>
|
155 |
+
|
156 |
+
<?php foreach ( $this->choices as $key => $value ) { ?>
|
157 |
+
<label class="radio-button-label">
|
158 |
+
<input type="radio" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php $this->link(); ?> <?php checked( esc_attr( $key ), $this->value() ); ?>/>
|
159 |
+
<img src="<?php echo esc_attr( $value['image'] ); ?>" alt="<?php echo esc_attr( $value['name'] ); ?>" title="<?php echo esc_attr( $value['name'] ); ?>" />
|
160 |
+
</label>
|
161 |
+
<?php } ?>
|
162 |
+
</div>
|
163 |
+
<?php
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Single Accordion Custom Control
|
169 |
+
*
|
170 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
171 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
172 |
+
* @link https://github.com/maddisondesigns
|
173 |
+
*/
|
174 |
+
class Skyrocket_Single_Accordion_Custom_Control extends Skyrocket_Custom_Control {
|
175 |
+
/**
|
176 |
+
* The type of control being rendered
|
177 |
+
*/
|
178 |
+
public $type = 'single_accordion';
|
179 |
+
/**
|
180 |
+
* Enqueue our scripts and styles
|
181 |
+
*/
|
182 |
+
public function enqueue() {
|
183 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'jquery' ), '1.0', true );
|
184 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
185 |
+
wp_enqueue_style( 'fontawesome', $this->get_skyrocket_resource_url() . 'css/font-awesome.min.css', array(), '4.6.3', 'all' );
|
186 |
+
}
|
187 |
+
/**
|
188 |
+
* Render the control in the customizer
|
189 |
+
*/
|
190 |
+
public function render_content() {
|
191 |
+
$allowed_html = array(
|
192 |
+
'a' => array(
|
193 |
+
'href' => array(),
|
194 |
+
'title' => array(),
|
195 |
+
'class' => array(),
|
196 |
+
'target' => array(),
|
197 |
+
),
|
198 |
+
'br' => array(),
|
199 |
+
'em' => array(),
|
200 |
+
'strong' => array(),
|
201 |
+
'i' => array(
|
202 |
+
'class' => array()
|
203 |
+
),
|
204 |
+
);
|
205 |
+
?>
|
206 |
+
<div class="single-accordion-custom-control">
|
207 |
+
<div class="single-accordion-toggle"><?php echo esc_html( $this->label ); ?><span class="accordion-icon-toggle dashicons dashicons-plus"></span></div>
|
208 |
+
<div class="single-accordion customize-control-description">
|
209 |
+
<?php
|
210 |
+
if ( is_array( $this->description ) ) {
|
211 |
+
echo '<ul class="single-accordion-description">';
|
212 |
+
foreach ( $this->description as $key => $value ) {
|
213 |
+
echo '<li>' . $key . wp_kses( $value, $allowed_html ) . '</li>';
|
214 |
+
}
|
215 |
+
echo '</ul>';
|
216 |
+
}
|
217 |
+
else {
|
218 |
+
echo wp_kses( $this->description, $allowed_html );
|
219 |
+
}
|
220 |
+
?>
|
221 |
+
</div>
|
222 |
+
</div>
|
223 |
+
<?php
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Simple Notice Custom Control
|
229 |
+
*
|
230 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
231 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
232 |
+
* @link https://github.com/maddisondesigns
|
233 |
+
*/
|
234 |
+
class Skyrocket_Simple_Notice_Custom_Control extends Skyrocket_Custom_Control {
|
235 |
+
/**
|
236 |
+
* The type of control being rendered
|
237 |
+
*/
|
238 |
+
public $type = 'simple_notice';
|
239 |
+
/**
|
240 |
+
* Render the control in the customizer
|
241 |
+
*/
|
242 |
+
public function render_content() {
|
243 |
+
$allowed_html = array(
|
244 |
+
'a' => array(
|
245 |
+
'href' => array(),
|
246 |
+
'title' => array(),
|
247 |
+
'class' => array(),
|
248 |
+
'target' => array(),
|
249 |
+
),
|
250 |
+
'br' => array(),
|
251 |
+
'em' => array(),
|
252 |
+
'strong' => array(),
|
253 |
+
'i' => array(
|
254 |
+
'class' => array()
|
255 |
+
),
|
256 |
+
'span' => array(
|
257 |
+
'class' => array(),
|
258 |
+
),
|
259 |
+
'code' => array(),
|
260 |
+
);
|
261 |
+
?>
|
262 |
+
<div class="simple-notice-custom-control">
|
263 |
+
<?php if( !empty( $this->label ) ) { ?>
|
264 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
265 |
+
<?php } ?>
|
266 |
+
<?php if( !empty( $this->description ) ) { ?>
|
267 |
+
<span class="customize-control-description"><?php echo wp_kses( $this->description, $allowed_html ); ?></span>
|
268 |
+
<?php } ?>
|
269 |
+
</div>
|
270 |
+
<?php
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Slider Custom Control
|
276 |
+
*
|
277 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
278 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
279 |
+
* @link https://github.com/maddisondesigns
|
280 |
+
*/
|
281 |
+
class Skyrocket_Slider_Custom_Control extends Skyrocket_Custom_Control {
|
282 |
+
/**
|
283 |
+
* The type of control being rendered
|
284 |
+
*/
|
285 |
+
public $type = 'slider_control';
|
286 |
+
/**
|
287 |
+
* Enqueue our scripts and styles
|
288 |
+
*/
|
289 |
+
public function enqueue() {
|
290 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/js/customizer.js', array( 'jquery', 'jquery-ui-core' ), wc_advanced_shipment_tracking()->version, true );
|
291 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', wc_advanced_shipment_tracking()->plugin_dir_url() . 'assets/css/customizer.css', array(), wc_advanced_shipment_tracking()->version, 'all' );
|
292 |
+
}
|
293 |
+
/**
|
294 |
+
* Render the control in the customizer
|
295 |
+
*/
|
296 |
+
public function render_content() {
|
297 |
+
?>
|
298 |
+
<div class="slider-custom-control">
|
299 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
300 |
+
<div class="slider" slider-min-value="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" slider-max-value="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" slider-step-value="<?php echo esc_attr( $this->input_attrs['step'] ); ?>">
|
301 |
+
</div>
|
302 |
+
<span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="<?php echo esc_attr( $this->input_attrs['default'] ); ?>"></span>
|
303 |
+
<input type="number" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-slider-value" <?php $this->link(); ?> />
|
304 |
+
</div>
|
305 |
+
<?php
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Toggle Switch Custom Control
|
311 |
+
*
|
312 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
313 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
314 |
+
* @link https://github.com/maddisondesigns
|
315 |
+
*/
|
316 |
+
class Skyrocket_Toggle_Switch_Custom_control extends Skyrocket_Custom_Control {
|
317 |
+
/**
|
318 |
+
* The type of control being rendered
|
319 |
+
*/
|
320 |
+
public $type = 'toggle_switch';
|
321 |
+
/**
|
322 |
+
* Enqueue our scripts and styles
|
323 |
+
*/
|
324 |
+
public function enqueue(){
|
325 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
326 |
+
}
|
327 |
+
/**
|
328 |
+
* Render the control in the customizer
|
329 |
+
*/
|
330 |
+
public function render_content(){
|
331 |
+
?>
|
332 |
+
<div class="toggle-switch-control">
|
333 |
+
<div class="toggle-switch">
|
334 |
+
<input type="checkbox" id="<?php echo esc_attr($this->id); ?>" name="<?php echo esc_attr($this->id); ?>" class="toggle-switch-checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?>>
|
335 |
+
<label class="toggle-switch-label" for="<?php echo esc_attr( $this->id ); ?>">
|
336 |
+
<span class="toggle-switch-inner"></span>
|
337 |
+
<span class="toggle-switch-switch"></span>
|
338 |
+
</label>
|
339 |
+
</div>
|
340 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
341 |
+
<?php if( !empty( $this->description ) ) { ?>
|
342 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
343 |
+
<?php } ?>
|
344 |
+
</div>
|
345 |
+
<?php
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Sortable Repeater Custom Control
|
351 |
+
*
|
352 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
353 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
354 |
+
* @link https://github.com/maddisondesigns
|
355 |
+
*/
|
356 |
+
class Skyrocket_Sortable_Repeater_Custom_Control extends Skyrocket_Custom_Control {
|
357 |
+
/**
|
358 |
+
* The type of control being rendered
|
359 |
+
*/
|
360 |
+
public $type = 'sortable_repeater';
|
361 |
+
/**
|
362 |
+
* Button labels
|
363 |
+
*/
|
364 |
+
public $button_labels = array();
|
365 |
+
/**
|
366 |
+
* Constructor
|
367 |
+
*/
|
368 |
+
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
369 |
+
parent::__construct( $manager, $id, $args );
|
370 |
+
// Merge the passed button labels with our default labels
|
371 |
+
$this->button_labels = wp_parse_args( $this->button_labels,
|
372 |
+
array(
|
373 |
+
'add' => __( 'Add', 'skyrocket' ),
|
374 |
+
)
|
375 |
+
);
|
376 |
+
}
|
377 |
+
/**
|
378 |
+
* Enqueue our scripts and styles
|
379 |
+
*/
|
380 |
+
public function enqueue() {
|
381 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'jquery', 'jquery-ui-core' ), '1.0', true );
|
382 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
383 |
+
}
|
384 |
+
/**
|
385 |
+
* Render the control in the customizer
|
386 |
+
*/
|
387 |
+
public function render_content() {
|
388 |
+
?>
|
389 |
+
<div class="sortable_repeater_control">
|
390 |
+
<?php if( !empty( $this->label ) ) { ?>
|
391 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
392 |
+
<?php } ?>
|
393 |
+
<?php if( !empty( $this->description ) ) { ?>
|
394 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
395 |
+
<?php } ?>
|
396 |
+
<input type="hidden" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-sortable-repeater" <?php $this->link(); ?> />
|
397 |
+
<div class="sortable">
|
398 |
+
<div class="repeater">
|
399 |
+
<input type="text" value="" class="repeater-input" placeholder="https://" /><span class="dashicons dashicons-sort"></span><a class="customize-control-sortable-repeater-delete" href="#"><span class="dashicons dashicons-no-alt"></span></a>
|
400 |
+
</div>
|
401 |
+
</div>
|
402 |
+
<button class="button customize-control-sortable-repeater-add" type="button"><?php echo $this->button_labels['add']; ?></button>
|
403 |
+
</div>
|
404 |
+
<?php
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Dropdown Select2 Custom Control
|
410 |
+
*
|
411 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
412 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
413 |
+
* @link https://github.com/maddisondesigns
|
414 |
+
*/
|
415 |
+
class Skyrocket_Dropdown_Select2_Custom_Control extends Skyrocket_Custom_Control {
|
416 |
+
/**
|
417 |
+
* The type of control being rendered
|
418 |
+
*/
|
419 |
+
public $type = 'dropdown_select2';
|
420 |
+
/**
|
421 |
+
* The type of Select2 Dropwdown to display. Can be either a single select dropdown or a multi-select dropdown. Either false for true. Default = false
|
422 |
+
*/
|
423 |
+
private $multiselect = false;
|
424 |
+
/**
|
425 |
+
* The Placeholder value to display. Select2 requires a Placeholder value to be set when using the clearall option. Default = 'Please select...'
|
426 |
+
*/
|
427 |
+
private $placeholder = 'Please select...';
|
428 |
+
/**
|
429 |
+
* Constructor
|
430 |
+
*/
|
431 |
+
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
432 |
+
parent::__construct( $manager, $id, $args );
|
433 |
+
// Check if this is a multi-select field
|
434 |
+
if ( isset( $this->input_attrs['multiselect'] ) && $this->input_attrs['multiselect'] ) {
|
435 |
+
$this->multiselect = true;
|
436 |
+
}
|
437 |
+
// Check if a placeholder string has been specified
|
438 |
+
if ( isset( $this->input_attrs['placeholder'] ) && $this->input_attrs['placeholder'] ) {
|
439 |
+
$this->placeholder = $this->input_attrs['placeholder'];
|
440 |
+
}
|
441 |
+
}
|
442 |
+
/**
|
443 |
+
* Enqueue our scripts and styles
|
444 |
+
*/
|
445 |
+
public function enqueue() {
|
446 |
+
wp_enqueue_script( 'skyrocket-select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js', array( 'jquery' ), '4.0.6', true );
|
447 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'skyrocket-select2-js' ), '1.0', true );
|
448 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.1', 'all' );
|
449 |
+
wp_enqueue_style( 'skyrocket-select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css', array(), '4.0.6', 'all' );
|
450 |
+
}
|
451 |
+
/**
|
452 |
+
* Render the control in the customizer
|
453 |
+
*/
|
454 |
+
public function render_content() {
|
455 |
+
$defaultValue = $this->value();
|
456 |
+
if ( $this->multiselect ) {
|
457 |
+
$defaultValue = explode( ',', $this->value() );
|
458 |
+
}
|
459 |
+
?>
|
460 |
+
<div class="dropdown_select2_control">
|
461 |
+
<?php if( !empty( $this->label ) ) { ?>
|
462 |
+
<label for="<?php echo esc_attr( $this->id ); ?>" class="customize-control-title">
|
463 |
+
<?php echo esc_html( $this->label ); ?>
|
464 |
+
</label>
|
465 |
+
<?php } ?>
|
466 |
+
<?php if( !empty( $this->description ) ) { ?>
|
467 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
468 |
+
<?php } ?>
|
469 |
+
<input type="hidden" id="<?php echo esc_attr( $this->id ); ?>" class="customize-control-dropdown-select2" value="<?php echo esc_attr( $this->value() ); ?>" name="<?php echo esc_attr( $this->id ); ?>" <?php $this->link(); ?> />
|
470 |
+
<select name="select2-list-<?php echo ( $this->multiselect ? 'multi[]' : 'single' ); ?>" class="customize-control-select2" data-placeholder="<?php echo $this->placeholder; ?>" <?php echo ( $this->multiselect ? 'multiple="multiple" ' : '' ); ?>>
|
471 |
+
<?php
|
472 |
+
if ( !$this->multiselect ) {
|
473 |
+
// When using Select2 for single selection, the Placeholder needs an empty <option> at the top of the list for it to work (multi-selects dont need this)
|
474 |
+
echo '<option></option>';
|
475 |
+
}
|
476 |
+
foreach ( $this->choices as $key => $value ) {
|
477 |
+
if ( is_array( $value ) ) {
|
478 |
+
echo '<optgroup label="' . esc_attr( $key ) . '">';
|
479 |
+
foreach ( $value as $optgroupkey => $optgroupvalue ) {
|
480 |
+
echo '<option value="' . esc_attr( $optgroupkey ) . '" ' . ( in_array( esc_attr( $optgroupkey ), $defaultValue ) ? 'selected="selected"' : '' ) . '>' . esc_attr( $optgroupvalue ) . '</option>';
|
481 |
+
}
|
482 |
+
echo '</optgroup>';
|
483 |
+
}
|
484 |
+
else {
|
485 |
+
echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $key ), $defaultValue, false ) . '>' . esc_attr( $value ) . '</option>';
|
486 |
+
}
|
487 |
+
}
|
488 |
+
?>
|
489 |
+
</select>
|
490 |
+
</div>
|
491 |
+
<?php
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Dropdown Posts Custom Control
|
497 |
+
*
|
498 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
499 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
500 |
+
* @link https://github.com/maddisondesigns
|
501 |
+
*/
|
502 |
+
class Skyrocket_Dropdown_Posts_Custom_Control extends Skyrocket_Custom_Control {
|
503 |
+
/**
|
504 |
+
* The type of control being rendered
|
505 |
+
*/
|
506 |
+
public $type = 'dropdown_posts';
|
507 |
+
/**
|
508 |
+
* Posts
|
509 |
+
*/
|
510 |
+
private $posts = array();
|
511 |
+
/**
|
512 |
+
* Constructor
|
513 |
+
*/
|
514 |
+
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
515 |
+
parent::__construct( $manager, $id, $args );
|
516 |
+
// Get our Posts
|
517 |
+
$this->posts = get_posts( $this->input_attrs );
|
518 |
+
}
|
519 |
+
/**
|
520 |
+
* Render the control in the customizer
|
521 |
+
*/
|
522 |
+
public function render_content() {
|
523 |
+
?>
|
524 |
+
<div class="dropdown_posts_control">
|
525 |
+
<?php if( !empty( $this->label ) ) { ?>
|
526 |
+
<label for="<?php echo esc_attr( $this->id ); ?>" class="customize-control-title">
|
527 |
+
<?php echo esc_html( $this->label ); ?>
|
528 |
+
</label>
|
529 |
+
<?php } ?>
|
530 |
+
<?php if( !empty( $this->description ) ) { ?>
|
531 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
532 |
+
<?php } ?>
|
533 |
+
<select name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>" <?php $this->link(); ?>>
|
534 |
+
<?php
|
535 |
+
if( !empty( $this->posts ) ) {
|
536 |
+
foreach ( $this->posts as $post ) {
|
537 |
+
printf( '<option value="%s" %s>%s</option>',
|
538 |
+
$post->ID,
|
539 |
+
selected( $this->value(), $post->ID, false ),
|
540 |
+
$post->post_title
|
541 |
+
);
|
542 |
+
}
|
543 |
+
}
|
544 |
+
?>
|
545 |
+
</select>
|
546 |
+
</div>
|
547 |
+
<?php
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
/**
|
552 |
+
* TinyMCE Custom Control
|
553 |
+
*
|
554 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
555 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
556 |
+
* @link https://github.com/maddisondesigns
|
557 |
+
*/
|
558 |
+
class Skyrocket_TinyMCE_Custom_control extends Skyrocket_Custom_Control {
|
559 |
+
/**
|
560 |
+
* The type of control being rendered
|
561 |
+
*/
|
562 |
+
public $type = 'tinymce_editor';
|
563 |
+
/**
|
564 |
+
* Enqueue our scripts and styles
|
565 |
+
*/
|
566 |
+
public function enqueue(){
|
567 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'jquery' ), '1.0', true );
|
568 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.0', 'all' );
|
569 |
+
wp_enqueue_editor();
|
570 |
+
}
|
571 |
+
/**
|
572 |
+
* Pass our TinyMCE toolbar string to JavaScript
|
573 |
+
*/
|
574 |
+
public function to_json() {
|
575 |
+
parent::to_json();
|
576 |
+
$this->json['skyrockettinymcetoolbar1'] = isset( $this->input_attrs['toolbar1'] ) ? esc_attr( $this->input_attrs['toolbar1'] ) : 'bold italic bullist numlist alignleft aligncenter alignright link';
|
577 |
+
$this->json['skyrockettinymcetoolbar2'] = isset( $this->input_attrs['toolbar2'] ) ? esc_attr( $this->input_attrs['toolbar2'] ) : '';
|
578 |
+
$this->json['skyrocketmediabuttons'] = isset( $this->input_attrs['mediaButtons'] ) && ( $this->input_attrs['mediaButtons'] === true ) ? true : false;
|
579 |
+
}
|
580 |
+
/**
|
581 |
+
* Render the control in the customizer
|
582 |
+
*/
|
583 |
+
public function render_content(){
|
584 |
+
?>
|
585 |
+
<div class="tinymce-control">
|
586 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
587 |
+
<?php if( !empty( $this->description ) ) { ?>
|
588 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
589 |
+
<?php } ?>
|
590 |
+
<textarea id="<?php echo esc_attr( $this->id ); ?>" class="customize-control-tinymce-editor" <?php $this->link(); ?>><?php echo esc_attr( $this->value() ); ?></textarea>
|
591 |
+
</div>
|
592 |
+
<?php
|
593 |
+
}
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Google Font Select Custom Control
|
598 |
+
*
|
599 |
+
* @author Anthony Hortin <http://maddisondesigns.com>
|
600 |
+
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
601 |
+
* @link https://github.com/maddisondesigns
|
602 |
+
*/
|
603 |
+
class Skyrocket_Google_Font_Select_Custom_Control extends Skyrocket_Custom_Control {
|
604 |
+
/**
|
605 |
+
* The type of control being rendered
|
606 |
+
*/
|
607 |
+
public $type = 'google_fonts';
|
608 |
+
/**
|
609 |
+
* The list of Google Fonts
|
610 |
+
*/
|
611 |
+
private $fontList = false;
|
612 |
+
/**
|
613 |
+
* The saved font values decoded from json
|
614 |
+
*/
|
615 |
+
private $fontValues = [];
|
616 |
+
/**
|
617 |
+
* The index of the saved font within the list of Google fonts
|
618 |
+
*/
|
619 |
+
private $fontListIndex = 0;
|
620 |
+
/**
|
621 |
+
* The number of fonts to display from the json file. Either positive integer or 'all'. Default = 'all'
|
622 |
+
*/
|
623 |
+
private $fontCount = 'all';
|
624 |
+
/**
|
625 |
+
* The font list sort order. Either 'alpha' or 'popular'. Default = 'alpha'
|
626 |
+
*/
|
627 |
+
private $fontOrderBy = 'alpha';
|
628 |
+
/**
|
629 |
+
* Get our list of fonts from the json file
|
630 |
+
*/
|
631 |
+
public function __construct( $manager, $id, $args = array(), $options = array() ) {
|
632 |
+
parent::__construct( $manager, $id, $args );
|
633 |
+
// Get the font sort order
|
634 |
+
if ( isset( $this->input_attrs['orderby'] ) && strtolower( $this->input_attrs['orderby'] ) === 'popular' ) {
|
635 |
+
$this->fontOrderBy = 'popular';
|
636 |
+
}
|
637 |
+
// Get the list of Google fonts
|
638 |
+
if ( isset( $this->input_attrs['font_count'] ) ) {
|
639 |
+
if ( 'all' != strtolower( $this->input_attrs['font_count'] ) ) {
|
640 |
+
$this->fontCount = ( abs( (int) $this->input_attrs['font_count'] ) > 0 ? abs( (int) $this->input_attrs['font_count'] ) : 'all' );
|
641 |
+
}
|
642 |
+
}
|
643 |
+
$this->fontList = $this->skyrocket_getGoogleFonts( 'all' );
|
644 |
+
// Decode the default json font value
|
645 |
+
$this->fontValues = json_decode( $this->value() );
|
646 |
+
// Find the index of our default font within our list of Google fonts
|
647 |
+
$this->fontListIndex = $this->skyrocket_getFontIndex( $this->fontList, $this->fontValues->font );
|
648 |
+
}
|
649 |
+
/**
|
650 |
+
* Enqueue our scripts and styles
|
651 |
+
*/
|
652 |
+
public function enqueue() {
|
653 |
+
wp_enqueue_script( 'skyrocket-select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js', array( 'jquery' ), '4.0.6', true );
|
654 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'skyrocket-select2-js' ), '1.0', true );
|
655 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array(), '1.1', 'all' );
|
656 |
+
wp_enqueue_style( 'skyrocket-select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css', array(), '4.0.6', 'all' );
|
657 |
+
}
|
658 |
+
/**
|
659 |
+
* Export our List of Google Fonts to JavaScript
|
660 |
+
*/
|
661 |
+
public function to_json() {
|
662 |
+
parent::to_json();
|
663 |
+
$this->json['skyrocketfontslist'] = $this->fontList;
|
664 |
+
}
|
665 |
+
/**
|
666 |
+
* Render the control in the customizer
|
667 |
+
*/
|
668 |
+
public function render_content() {
|
669 |
+
$fontCounter = 0;
|
670 |
+
$isFontInList = false;
|
671 |
+
$fontListStr = '';
|
672 |
+
|
673 |
+
if( !empty($this->fontList) ) {
|
674 |
+
?>
|
675 |
+
<div class="google_fonts_select_control">
|
676 |
+
<?php if( !empty( $this->label ) ) { ?>
|
677 |
+
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
678 |
+
<?php } ?>
|
679 |
+
<?php if( !empty( $this->description ) ) { ?>
|
680 |
+
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
681 |
+
<?php } ?>
|
682 |
+
<input type="hidden" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-google-font-selection" <?php $this->link(); ?> />
|
683 |
+
<div class="google-fonts">
|
684 |
+
<select class="google-fonts-list" control-name="<?php echo esc_attr( $this->id ); ?>">
|
685 |
+
<?php
|
686 |
+
foreach( $this->fontList as $key => $value ) {
|
687 |
+
$fontCounter++;
|
688 |
+
$fontListStr .= '<option value="' . $value->family . '" ' . selected( $this->fontValues->font, $value->family, false ) . '>' . $value->family . '</option>';
|
689 |
+
if ( $this->fontValues->font === $value->family ) {
|
690 |
+
$isFontInList = true;
|
691 |
+
}
|
692 |
+
if ( is_int( $this->fontCount ) && $fontCounter === $this->fontCount ) {
|
693 |
+
break;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
if ( !$isFontInList && $this->fontListIndex ) {
|
697 |
+
// If the default or saved font value isn't in the list of displayed fonts, add it to the top of the list as the default font
|
698 |
+
$fontListStr = '<option value="' . $this->fontList[$this->fontListIndex]->family . '" ' . selected( $this->fontValues->font, $this->fontList[$this->fontListIndex]->family, false ) . '>' . $this->fontList[$this->fontListIndex]->family . ' (default)</option>' . $fontListStr;
|
699 |
+
}
|
700 |
+
// Display our list of font options
|
701 |
+
echo $fontListStr;
|
702 |
+
?>
|
703 |
+
</select>
|
704 |
+
</div>
|
705 |
+
<div class="customize-control-description">Select weight & style for regular text</div>
|
706 |
+
<div class="weight-style">
|
707 |
+
<select class="google-fonts-regularweight-style">
|
708 |
+
<?php
|
709 |
+
foreach( $this->fontList[$this->fontListIndex]->variants as $key => $value ) {
|
710 |
+
echo '<option value="' . $value . '" ' . selected( $this->fontValues->regularweight, $value, false ) . '>' . $value . '</option>';
|
711 |
+
}
|
712 |
+
?>
|
713 |
+
</select>
|
714 |
+
</div>
|
715 |
+
<div class="customize-control-description">Select weight for <italic>italic text</italic></div>
|
716 |
+
<div class="weight-style">
|
717 |
+
<select class="google-fonts-italicweight-style" <?php disabled( in_array( 'italic', $this->fontList[$this->fontListIndex]->variants ), false ); ?>>
|
718 |
+
<?php
|
719 |
+
$optionCount = 0;
|
720 |
+
foreach( $this->fontList[$this->fontListIndex]->variants as $key => $value ) {
|
721 |
+
// Only add options that are italic
|
722 |
+
if( strpos( $value, 'italic' ) !== false ) {
|
723 |
+
echo '<option value="' . $value . '" ' . selected( $this->fontValues->italicweight, $value, false ) . '>' . $value . '</option>';
|
724 |
+
$optionCount++;
|
725 |
+
}
|
726 |
+
}
|
727 |
+
if( $optionCount == 0 ) {
|
728 |
+
echo '<option value="">Not Available for this font</option>';
|
729 |
+
}
|
730 |
+
?>
|
731 |
+
</select>
|
732 |
+
</div>
|
733 |
+
<div class="customize-control-description">Select weight for <strong>bold text</strong></div>
|
734 |
+
<div class="weight-style">
|
735 |
+
<select class="google-fonts-boldweight-style">
|
736 |
+
<?php
|
737 |
+
$optionCount = 0;
|
738 |
+
foreach( $this->fontList[$this->fontListIndex]->variants as $key => $value ) {
|
739 |
+
// Only add options that aren't italic
|
740 |
+
if( strpos( $value, 'italic' ) === false ) {
|
741 |
+
echo '<option value="' . $value . '" ' . selected( $this->fontValues->boldweight, $value, false ) . '>' . $value . '</option>';
|
742 |
+
$optionCount++;
|
743 |
+
}
|
744 |
+
}
|
745 |
+
// This should never evaluate as there'll always be at least a 'regular' weight
|
746 |
+
if( $optionCount == 0 ) {
|
747 |
+
echo '<option value="">Not Available for this font</option>';
|
748 |
+
}
|
749 |
+
?>
|
750 |
+
</select>
|
751 |
+
</div>
|
752 |
+
<input type="hidden" class="google-fonts-category" value="<?php echo $this->fontValues->category; ?>">
|
753 |
+
</div>
|
754 |
+
<?php
|
755 |
+
}
|
756 |
+
}
|
757 |
+
|
758 |
+
/**
|
759 |
+
* Find the index of the saved font in our multidimensional array of Google Fonts
|
760 |
+
*/
|
761 |
+
public function skyrocket_getFontIndex( $haystack, $needle ) {
|
762 |
+
foreach( $haystack as $key => $value ) {
|
763 |
+
if( $value->family == $needle ) {
|
764 |
+
return $key;
|
765 |
+
}
|
766 |
+
}
|
767 |
+
return false;
|
768 |
+
}
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Return the list of Google Fonts from our json file. Unless otherwise specfied, list will be limited to 30 fonts.
|
772 |
+
*/
|
773 |
+
public function skyrocket_getGoogleFonts( $count = 30 ) {
|
774 |
+
// Google Fonts json generated from https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=YOUR-API-KEY
|
775 |
+
$fontFile = $this->get_skyrocket_resource_url() . 'inc/google-fonts-alphabetical.json';
|
776 |
+
if ( $this->fontOrderBy === 'popular' ) {
|
777 |
+
$fontFile = $this->get_skyrocket_resource_url() . 'inc/google-fonts-popularity.json';
|
778 |
+
}
|
779 |
+
|
780 |
+
$request = wp_remote_get( $fontFile );
|
781 |
+
if( is_wp_error( $request ) ) {
|
782 |
+
return "";
|
783 |
+
}
|
784 |
+
|
785 |
+
$body = wp_remote_retrieve_body( $request );
|
786 |
+
$content = json_decode( $body );
|
787 |
+
|
788 |
+
if( $count == 'all' ) {
|
789 |
+
return $content->items;
|
790 |
+
} else {
|
791 |
+
return array_slice( $content->items, 0, $count );
|
792 |
+
}
|
793 |
+
}
|
794 |
+
}
|
795 |
+
|
796 |
+
/**
|
797 |
+
* Alpha Color Picker Custom Control
|
798 |
+
*
|
799 |
+
* @author Braad Martin <http://braadmartin.com>
|
800 |
+
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
801 |
+
* @link https://github.com/BraadMartin/components/tree/master/customizer/alpha-color-picker
|
802 |
+
*/
|
803 |
+
class Skyrocket_Customize_Alpha_Color_Control extends Skyrocket_Custom_Control {
|
804 |
+
/**
|
805 |
+
* The type of control being rendered
|
806 |
+
*/
|
807 |
+
public $type = 'alpha-color';
|
808 |
+
/**
|
809 |
+
* Add support for palettes to be passed in.
|
810 |
+
*
|
811 |
+
* Supported palette values are true, false, or an array of RGBa and Hex colors.
|
812 |
+
*/
|
813 |
+
public $palette;
|
814 |
+
/**
|
815 |
+
* Add support for showing the opacity value on the slider handle.
|
816 |
+
*/
|
817 |
+
public $show_opacity;
|
818 |
+
/**
|
819 |
+
* Enqueue our scripts and styles
|
820 |
+
*/
|
821 |
+
public function enqueue() {
|
822 |
+
wp_enqueue_script( 'skyrocket-custom-controls-js', $this->get_skyrocket_resource_url() . 'js/customizer.js', array( 'jquery', 'wp-color-picker' ), '1.0', true );
|
823 |
+
wp_enqueue_style( 'skyrocket-custom-controls-css', $this->get_skyrocket_resource_url() . 'css/customizer.css', array( 'wp-color-picker' ), '1.0', 'all' );
|
824 |
+
}
|
825 |
+
/**
|
826 |
+
* Render the control in the customizer
|
827 |
+
*/
|
828 |
+
public function render_content() {
|
829 |
+
|
830 |
+
// Process the palette
|
831 |
+
if ( is_array( $this->palette ) ) {
|
832 |
+
$palette = implode( '|', $this->palette );
|
833 |
+
} else {
|
834 |
+
// Default to true.
|
835 |
+
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
|
836 |
+
}
|
837 |
+
|
838 |
+
// Support passing show_opacity as string or boolean. Default to true.
|
839 |
+
$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
|
840 |
+
|
841 |
+
?>
|
842 |
+
<label>
|
843 |
+
<?php // Output the label and description if they were passed in.
|
844 |
+
if ( isset( $this->label ) && '' !== $this->label ) {
|
845 |
+
echo '<span class="customize-control-title">' . sanitize_text_field( $this->label ) . '</span>';
|
846 |
+
}
|
847 |
+
if ( isset( $this->description ) && '' !== $this->description ) {
|
848 |
+
echo '<span class="description customize-control-description">' . sanitize_text_field( $this->description ) . '</span>';
|
849 |
+
} ?>
|
850 |
+
</label>
|
851 |
+
<input class="alpha-color-control" type="text" data-show-opacity="<?php echo $show_opacity; ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php $this->link(); ?> />
|
852 |
+
<?php
|
853 |
+
}
|
854 |
+
}
|
855 |
+
|
856 |
+
/**
|
857 |
+
* URL sanitization
|
858 |
+
*
|
859 |
+
* @param string Input to be sanitized (either a string containing a single url or multiple, separated by commas)
|
860 |
+
* @return string Sanitized input
|
861 |
+
*/
|
862 |
+
if ( ! function_exists( 'skyrocket_url_sanitization' ) ) {
|
863 |
+
function skyrocket_url_sanitization( $input ) {
|
864 |
+
if ( strpos( $input, ',' ) !== false) {
|
865 |
+
$input = explode( ',', $input );
|
866 |
+
}
|
867 |
+
if ( is_array( $input ) ) {
|
868 |
+
foreach ($input as $key => $value) {
|
869 |
+
$input[$key] = esc_url_raw( $value );
|
870 |
+
}
|
871 |
+
$input = implode( ',', $input );
|
872 |
+
}
|
873 |
+
else {
|
874 |
+
$input = esc_url_raw( $input );
|
875 |
+
}
|
876 |
+
return $input;
|
877 |
+
}
|
878 |
+
}
|
879 |
+
|
880 |
+
/**
|
881 |
+
* Switch sanitization
|
882 |
+
*
|
883 |
+
* @param string Switch value
|
884 |
+
* @return integer Sanitized value
|
885 |
+
*/
|
886 |
+
if ( ! function_exists( 'skyrocket_switch_sanitization' ) ) {
|
887 |
+
function skyrocket_switch_sanitization( $input ) {
|
888 |
+
if ( true === $input ) {
|
889 |
+
return 1;
|
890 |
+
} else {
|
891 |
+
return 0;
|
892 |
+
}
|
893 |
+
}
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Radio Button and Select sanitization
|
898 |
+
*
|
899 |
+
* @param string Radio Button value
|
900 |
+
* @return integer Sanitized value
|
901 |
+
*/
|
902 |
+
if ( ! function_exists( 'skyrocket_radio_sanitization' ) ) {
|
903 |
+
function skyrocket_radio_sanitization( $input, $setting ) {
|
904 |
+
//get the list of possible radio box or select options
|
905 |
+
$choices = $setting->manager->get_control( $setting->id )->choices;
|
906 |
+
|
907 |
+
if ( array_key_exists( $input, $choices ) ) {
|
908 |
+
return $input;
|
909 |
+
} else {
|
910 |
+
return $setting->default;
|
911 |
+
}
|
912 |
+
}
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Integer sanitization
|
917 |
+
*
|
918 |
+
* @param string Input value to check
|
919 |
+
* @return integer Returned integer value
|
920 |
+
*/
|
921 |
+
if ( ! function_exists( 'skyrocket_sanitize_integer' ) ) {
|
922 |
+
function skyrocket_sanitize_integer( $input ) {
|
923 |
+
return (int) $input;
|
924 |
+
}
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Text sanitization
|
929 |
+
*
|
930 |
+
* @param string Input to be sanitized (either a string containing a single string or multiple, separated by commas)
|
931 |
+
* @return string Sanitized input
|
932 |
+
*/
|
933 |
+
if ( ! function_exists( 'skyrocket_text_sanitization' ) ) {
|
934 |
+
function skyrocket_text_sanitization( $input ) {
|
935 |
+
if ( strpos( $input, ',' ) !== false) {
|
936 |
+
$input = explode( ',', $input );
|
937 |
+
}
|
938 |
+
if( is_array( $input ) ) {
|
939 |
+
foreach ( $input as $key => $value ) {
|
940 |
+
$input[$key] = sanitize_text_field( $value );
|
941 |
+
}
|
942 |
+
$input = implode( ',', $input );
|
943 |
+
}
|
944 |
+
else {
|
945 |
+
$input = sanitize_text_field( $input );
|
946 |
+
}
|
947 |
+
return $input;
|
948 |
+
}
|
949 |
+
}
|
950 |
+
|
951 |
+
/**
|
952 |
+
* Array sanitization
|
953 |
+
*
|
954 |
+
* @param array Input to be sanitized
|
955 |
+
* @return array Sanitized input
|
956 |
+
*/
|
957 |
+
if ( ! function_exists( 'skyrocket_array_sanitization' ) ) {
|
958 |
+
function skyrocket_array_sanitization( $input ) {
|
959 |
+
if( is_array( $input ) ) {
|
960 |
+
foreach ( $input as $key => $value ) {
|
961 |
+
$input[$key] = sanitize_text_field( $value );
|
962 |
+
}
|
963 |
+
}
|
964 |
+
else {
|
965 |
+
$input = '';
|
966 |
+
}
|
967 |
+
return $input;
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
+
/**
|
972 |
+
* Alpha Color (Hex & RGBa) sanitization
|
973 |
+
*
|
974 |
+
* @param string Input to be sanitized
|
975 |
+
* @return string Sanitized input
|
976 |
+
*/
|
977 |
+
if ( ! function_exists( 'skyrocket_hex_rgba_sanitization' ) ) {
|
978 |
+
function skyrocket_hex_rgba_sanitization( $input, $setting ) {
|
979 |
+
if ( empty( $input ) || is_array( $input ) ) {
|
980 |
+
return $setting->default;
|
981 |
+
}
|
982 |
+
|
983 |
+
if ( false === strpos( $input, 'rgba' ) ) {
|
984 |
+
// If string doesn't start with 'rgba' then santize as hex color
|
985 |
+
$input = sanitize_hex_color( $input );
|
986 |
+
} else {
|
987 |
+
// Sanitize as RGBa color
|
988 |
+
$input = str_replace( ' ', '', $input );
|
989 |
+
sscanf( $input, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
|
990 |
+
$input = 'rgba(' . skyrocket_in_range( $red, 0, 255 ) . ',' . skyrocket_in_range( $green, 0, 255 ) . ',' . skyrocket_in_range( $blue, 0, 255 ) . ',' . skyrocket_in_range( $alpha, 0, 1 ) . ')';
|
991 |
+
}
|
992 |
+
return $input;
|
993 |
+
}
|
994 |
+
}
|
995 |
+
|
996 |
+
/**
|
997 |
+
* Only allow values between a certain minimum & maxmium range
|
998 |
+
*
|
999 |
+
* @param number Input to be sanitized
|
1000 |
+
* @return number Sanitized input
|
1001 |
+
*/
|
1002 |
+
if ( ! function_exists( 'skyrocket_in_range' ) ) {
|
1003 |
+
function skyrocket_in_range( $input, $min, $max ){
|
1004 |
+
if ( $input < $min ) {
|
1005 |
+
$input = $min;
|
1006 |
+
}
|
1007 |
+
if ( $input > $max ) {
|
1008 |
+
$input = $max;
|
1009 |
+
}
|
1010 |
+
return $input;
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
/**
|
1015 |
+
* Google Font sanitization
|
1016 |
+
*
|
1017 |
+
* @param string JSON string to be sanitized
|
1018 |
+
* @return string Sanitized input
|
1019 |
+
*/
|
1020 |
+
if ( ! function_exists( 'skyrocket_google_font_sanitization' ) ) {
|
1021 |
+
function skyrocket_google_font_sanitization( $input ) {
|
1022 |
+
$val = json_decode( $input, true );
|
1023 |
+
if( is_array( $val ) ) {
|
1024 |
+
foreach ( $val as $key => $value ) {
|
1025 |
+
$val[$key] = sanitize_text_field( $value );
|
1026 |
+
}
|
1027 |
+
$input = json_encode( $val );
|
1028 |
+
}
|
1029 |
+
else {
|
1030 |
+
$input = json_encode( sanitize_text_field( $val ) );
|
1031 |
+
}
|
1032 |
+
return $input;
|
1033 |
+
}
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
/**
|
1037 |
+
* Date Time sanitization
|
1038 |
+
*
|
1039 |
+
* @param string Date/Time string to be sanitized
|
1040 |
+
* @return string Sanitized input
|
1041 |
+
*/
|
1042 |
+
if ( ! function_exists( 'skyrocket_date_time_sanitization' ) ) {
|
1043 |
+
function skyrocket_date_time_sanitization( $input, $setting ) {
|
1044 |
+
$datetimeformat = 'Y-m-d';
|
1045 |
+
if ( $setting->manager->get_control( $setting->id )->include_time ) {
|
1046 |
+
$datetimeformat = 'Y-m-d H:i:s';
|
1047 |
+
}
|
1048 |
+
$date = DateTime::createFromFormat( $datetimeformat, $input );
|
1049 |
+
if ( $date === false ) {
|
1050 |
+
$date = DateTime::createFromFormat( $datetimeformat, $setting->default );
|
1051 |
+
}
|
1052 |
+
return $date->format( $datetimeformat );
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
/**
|
1057 |
+
* Slider sanitization
|
1058 |
+
*
|
1059 |
+
* @param string Slider value to be sanitized
|
1060 |
+
* @return string Sanitized input
|
1061 |
+
*/
|
1062 |
+
if ( ! function_exists( 'skyrocket_range_sanitization' ) ) {
|
1063 |
+
function skyrocket_range_sanitization( $input, $setting ) {
|
1064 |
+
$attrs = $setting->manager->get_control( $setting->id )->input_attrs;
|
1065 |
+
|
1066 |
+
$min = ( isset( $attrs['min'] ) ? $attrs['min'] : $input );
|
1067 |
+
$max = ( isset( $attrs['max'] ) ? $attrs['max'] : $input );
|
1068 |
+
$step = ( isset( $attrs['step'] ) ? $attrs['step'] : 1 );
|
1069 |
+
|
1070 |
+
$number = floor( $input / $attrs['step'] ) * $attrs['step'];
|
1071 |
+
|
1072 |
+
return skyrocket_in_range( $number, $min, $max );
|
1073 |
+
}
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
}
|
includes/customizer/preview.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
?>
|
8 |
+
|
9 |
+
<head>
|
10 |
+
|
11 |
+
<meta charset="<?php bloginfo('charset'); ?>" />
|
12 |
+
<meta name="viewport" content="width=device-width" />
|
13 |
+
<style type="text/css" id="kadence_woomail_designer_custom_css">.woocommerce-store-notice.demo_store, .mfp-hide {display: none;}</style>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body>
|
17 |
+
|
18 |
+
<div id="kt_woomail_preview_wrapper" style="display: block;">
|
19 |
+
|
20 |
+
<?php wcast_initialise_customizer_settings::preview_completed_email(); ?>
|
21 |
+
|
22 |
+
</div>
|
23 |
+
|
24 |
+
<?php
|
25 |
+
do_action( 'woomail_footer' );
|
26 |
+
wp_footer(); ?>
|
27 |
+
|
28 |
+
</body>
|
29 |
+
|
30 |
+
</html>
|
includes/email-manager.php
CHANGED
@@ -9,7 +9,7 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
9 |
*/
|
10 |
public function __construct() {
|
11 |
// template path
|
12 |
-
if (!defined('AST_TEMPLATE_PATH')) define('AST_TEMPLATE_PATH', SHIPMENT_TRACKING_PATH . '/templates/');
|
13 |
// hook for when order status is changed
|
14 |
// include the email class files
|
15 |
add_filter( 'woocommerce_email_classes', array( $this, 'custom_init_emails' ));
|
@@ -261,35 +261,43 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
261 |
$email_table_backgroud_color = '';
|
262 |
$tracking_link_font_color = '';
|
263 |
$tracking_link_bg_color = '';
|
264 |
-
$
|
265 |
-
|
266 |
-
if(get_option('email_border_size')){ $email_border_size = get_option('email_border_size'); } else{ $email_border_size = "1"; }
|
267 |
-
if(get_option('email_shipment_tracking_header')){ $shipment_tracking_header = get_option('email_shipment_tracking_header'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
268 |
-
if(get_option('email_shipment_tracking_header_text')){ $shipment_tracking_header_text = get_option('email_shipment_tracking_header_text'); }
|
269 |
-
$email_table_backgroud_color = get_option('email_table_backgroud_color');
|
270 |
|
271 |
-
|
272 |
-
if(
|
|
|
|
|
273 |
|
274 |
-
if(
|
275 |
|
276 |
-
|
|
|
|
|
277 |
|
278 |
-
if(
|
|
|
279 |
|
280 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
$th_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
283 |
|
284 |
-
$td_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-size:".$table_content_font_size."px; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
285 |
|
286 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";padding: 10px;";
|
287 |
-
|
|
|
288 |
|
289 |
?>
|
290 |
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
291 |
<p><?php echo $shipment_tracking_header_text; ?></p>
|
292 |
-
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;background:<?php echo $email_table_backgroud_color; ?>" border="1">
|
293 |
|
294 |
<thead>
|
295 |
<tr>
|
@@ -324,9 +332,7 @@ class WC_Advanced_Shipment_Tracking_Email_Manager {
|
|
324 |
}
|
325 |
}
|
326 |
?>
|
327 |
-
<img style="width: 50px;" src="<?php echo $src; ?>"
|
328 |
-
<?php }
|
329 |
-
echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
330 |
</td>
|
331 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
332 |
<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
|
9 |
*/
|
10 |
public function __construct() {
|
11 |
// template path
|
12 |
+
if (!defined('AST_TEMPLATE_PATH')) define('AST_TEMPLATE_PATH', SHIPMENT_TRACKING_PATH . '/templates/');
|
13 |
// hook for when order status is changed
|
14 |
// include the email class files
|
15 |
add_filter( 'woocommerce_email_classes', array( $this, 'custom_init_emails' ));
|
261 |
$email_table_backgroud_color = '';
|
262 |
$tracking_link_font_color = '';
|
263 |
$tracking_link_bg_color = '';
|
264 |
+
$table_content_line_height = '';
|
265 |
+
$table_content_font_weight = '';
|
|
|
|
|
|
|
|
|
266 |
|
267 |
+
$display_thumbnail = get_theme_mod('display_shipment_provider_image');
|
268 |
+
if(get_theme_mod('table_border_color')){ $email_border_color = get_theme_mod('table_border_color'); } else{ $email_border_color = "#e4e4e4"; }
|
269 |
+
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
270 |
+
if(get_theme_mod('header_text_change')){ $shipment_tracking_header = get_theme_mod('header_text_change'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
271 |
|
272 |
+
if(get_theme_mod('additional_header_text')){ $shipment_tracking_header_text = get_theme_mod('additional_header_text'); }
|
273 |
|
274 |
+
$email_table_backgroud_color = get_theme_mod('table_bg_color');
|
275 |
+
$table_content_line_height = get_theme_mod('table_content_line_height');
|
276 |
+
$table_content_font_weight = get_theme_mod('table_content_font_weight');
|
277 |
|
278 |
+
if(get_theme_mod('table_header_font_size')){ $table_header_font_size = get_theme_mod('table_header_font_size'); }
|
279 |
+
if(get_theme_mod('table_header_font_color')){ $table_header_font_color = get_theme_mod('table_header_font_color'); } else{ $table_header_font_color = "#737373"; }
|
280 |
|
281 |
+
if(get_theme_mod('table_content_font_size')){ $table_content_font_size = get_theme_mod('table_content_font_size'); }
|
282 |
+
|
283 |
+
if(get_theme_mod('table_content_font_color')){ $table_content_font_color = get_theme_mod('table_content_font_color'); } else{ $table_content_font_color = "#737373"; }
|
284 |
+
|
285 |
+
if(get_theme_mod('tracking_link_font_color')){ $tracking_link_font_color = get_theme_mod('tracking_link_font_color'); }
|
286 |
+
|
287 |
+
if(get_theme_mod('tracking_link_bg_color')){ $tracking_link_bg_color = get_theme_mod('tracking_link_bg_color'); }
|
288 |
|
289 |
$th_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
290 |
|
291 |
+
$td_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-size:".$table_content_font_size."px;font-weight:".$table_content_font_weight."; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
292 |
|
293 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";padding: 10px;";
|
294 |
+
|
295 |
+
$remove_date_from_tracking_info = get_theme_mod('remove_date_from_tracking');
|
296 |
|
297 |
?>
|
298 |
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
299 |
<p><?php echo $shipment_tracking_header_text; ?></p>
|
300 |
+
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;line-height:<?php echo $table_content_line_height; ?>px;background:<?php echo $email_table_backgroud_color; ?>" border="1">
|
301 |
|
302 |
<thead>
|
303 |
<tr>
|
332 |
}
|
333 |
}
|
334 |
?>
|
335 |
+
<img style="width: 50px;margin-right: 5px;vertical-align: middle;" src="<?php echo $src; ?>"><?php } echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
|
|
|
|
336 |
</td>
|
337 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
338 |
<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
|
includes/emails/class-shipment-delivered-email.php
CHANGED
@@ -38,7 +38,8 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
|
|
38 |
'{order_date}' => '',
|
39 |
'{order_number}' => '',
|
40 |
);
|
41 |
-
$this->template_base =
|
|
|
42 |
// Triggers for this email.
|
43 |
|
44 |
// Call parent constructor.
|
@@ -101,8 +102,7 @@ if ( ! class_exists( 'WC_Email_Customer_Delivered_Order', false ) ) :
|
|
101 |
*/
|
102 |
public function get_content_html() {
|
103 |
$template = $this->get_template( 'template_html' );
|
104 |
-
$local_file = $this->get_theme_template_file( $template );
|
105 |
-
|
106 |
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
107 |
//echo $local_file;exit;
|
108 |
return wc_get_template_html(
|
38 |
'{order_date}' => '',
|
39 |
'{order_number}' => '',
|
40 |
);
|
41 |
+
$this->template_base = AST_TEMPLATE_PATH;
|
42 |
+
//echo $this->template_base;exit;
|
43 |
// Triggers for this email.
|
44 |
|
45 |
// Call parent constructor.
|
102 |
*/
|
103 |
public function get_content_html() {
|
104 |
$template = $this->get_template( 'template_html' );
|
105 |
+
$local_file = $this->get_theme_template_file( $template );
|
|
|
106 |
if ( file_exists( $local_file ) && is_writable( $local_file )){
|
107 |
//echo $local_file;exit;
|
108 |
return wc_get_template_html(
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Advanced Shipment Tracking for WooCommerce ===
|
2 |
Contributors: zorem
|
3 |
Donate link: https://www.zorem.com
|
4 |
-
Tags:
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 5.
|
9 |
License: GPLv2
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -89,6 +89,23 @@ For all REST API functions, [please see our documentation](https://www.zorem.com
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 1.9.5 =
|
93 |
* Update design of email notification section for small screen
|
94 |
* Update design of bulk upload section
|
1 |
=== Advanced Shipment Tracking for WooCommerce ===
|
2 |
Contributors: zorem
|
3 |
Donate link: https://www.zorem.com
|
4 |
+
Tags: woocommerce, delivery, shipping, shipment tracking, tracking, fedex, ups, usps
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
+
Tested up to: 5.2
|
8 |
+
Stable tag: 5.2
|
9 |
License: GPLv2
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 1.9.6 =
|
93 |
+
|
94 |
+
* Updated Email Notifications settings design
|
95 |
+
* Updated add custom shipping provider design
|
96 |
+
* Fixed issue of Hebrew shipping provider not added in orders
|
97 |
+
* Added DHL Logistics Shipping provider as a default shipping provider
|
98 |
+
* Fixed bulk upload issue - if shipped date is null than it will take current date
|
99 |
+
* Added functionality for add multiple tracked into bulk upload for single order
|
100 |
+
* Setup tracking info display customizer with live preview in email
|
101 |
+
* Setup funvctionality for show Tracking Info only in completed order
|
102 |
+
|
103 |
+
= 1.9.5.2 =
|
104 |
+
* Added DTDC Shipping provider as a default shipping provider
|
105 |
+
|
106 |
+
= 1.9.5.1 =
|
107 |
+
* Bug Fixed - Fixed email template issue for WooCommerce Delivered order.
|
108 |
+
|
109 |
= 1.9.5 =
|
110 |
* Update design of email notification section for small screen
|
111 |
* Update design of bulk upload section
|
templates/emails/tracking-info.php
CHANGED
@@ -25,44 +25,59 @@ if ( $tracking_items ) :
|
|
25 |
$email_table_backgroud_color = '';
|
26 |
$tracking_link_font_color = '';
|
27 |
$tracking_link_bg_color = '';
|
28 |
-
|
29 |
-
$
|
30 |
-
if(get_option('email_border_color')){ $email_border_color = get_option('email_border_color'); } else{ $email_border_color = "#e4e4e4"; }
|
31 |
-
if(get_option('email_border_size')){ $email_border_size = get_option('email_border_size'); } else{ $email_border_size = "1"; }
|
32 |
-
if(get_option('email_shipment_tracking_header')){ $shipment_tracking_header = get_option('email_shipment_tracking_header'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
33 |
-
if(get_option('email_shipment_tracking_header_text')){ $shipment_tracking_header_text = get_option('email_shipment_tracking_header_text'); }
|
34 |
-
$email_table_backgroud_color = get_option('email_table_backgroud_color');
|
35 |
|
36 |
-
|
37 |
-
if(
|
|
|
|
|
38 |
|
39 |
-
if(
|
40 |
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
if(
|
|
|
44 |
|
45 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
$th_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
48 |
|
49 |
-
$td_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-size:".$table_content_font_size."px; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
50 |
|
51 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";padding: 10px;";
|
52 |
|
53 |
-
$remove_date_from_tracking_info =
|
|
|
|
|
|
|
|
|
|
|
54 |
?>
|
55 |
-
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
56 |
-
<p><?php echo $shipment_tracking_header_text; ?></p>
|
57 |
-
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;background:<?php echo $email_table_backgroud_color; ?>" border="1">
|
58 |
|
59 |
<thead>
|
60 |
<tr>
|
61 |
<th class="tracking-provider" scope="col" class="td" style="<?php echo $th_column_style; ?>"><?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?></th>
|
62 |
<th class="tracking-number" scope="col" class="td" style="<?php echo $th_column_style; ?>"><?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?></th>
|
63 |
-
<?php if($
|
64 |
-
|
65 |
-
<?php }
|
|
|
|
|
|
|
|
|
66 |
<th class="order-actions" scope="col" class="td" style="<?php echo $th_column_style; ?>"> </th>
|
67 |
</tr>
|
68 |
</thead>
|
@@ -89,18 +104,25 @@ if ( $tracking_items ) :
|
|
89 |
}
|
90 |
}
|
91 |
?>
|
92 |
-
<img style="width: 50px;" src="<?php echo $src; ?>">
|
93 |
<?php }
|
94 |
echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
95 |
</td>
|
96 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
97 |
<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
|
98 |
</td>
|
99 |
-
<?php if($
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
<td class="order-actions" style="<?php echo $td_column_style; ?>">
|
105 |
<?php $url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
|
106 |
<a href="<?php echo esc_url( $url ); ?>" style="<?php echo $tracking_link_style; ?>" target="_blank"><?php _e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
25 |
$email_table_backgroud_color = '';
|
26 |
$tracking_link_font_color = '';
|
27 |
$tracking_link_bg_color = '';
|
28 |
+
$table_content_line_height = '';
|
29 |
+
$table_content_font_weight = '';
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
$display_thumbnail = get_theme_mod('display_shipment_provider_image');
|
32 |
+
if(get_theme_mod('table_border_color')){ $email_border_color = get_theme_mod('table_border_color'); } else{ $email_border_color = "#e4e4e4"; }
|
33 |
+
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
34 |
+
if(get_theme_mod('header_text_change')){ $shipment_tracking_header = get_theme_mod('header_text_change'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
35 |
|
36 |
+
if(get_theme_mod('additional_header_text')){ $shipment_tracking_header_text = get_theme_mod('additional_header_text'); }
|
37 |
|
38 |
+
$email_table_backgroud_color = get_theme_mod('table_bg_color');
|
39 |
+
$table_content_line_height = get_theme_mod('table_content_line_height');
|
40 |
+
$table_content_font_weight = get_theme_mod('table_content_font_weight');
|
41 |
|
42 |
+
if(get_theme_mod('table_header_font_size')){ $table_header_font_size = get_theme_mod('table_header_font_size'); }
|
43 |
+
if(get_theme_mod('table_header_font_color')){ $table_header_font_color = get_theme_mod('table_header_font_color'); } else{ $table_header_font_color = "#737373"; }
|
44 |
|
45 |
+
if(get_theme_mod('table_content_font_size')){ $table_content_font_size = get_theme_mod('table_content_font_size'); }
|
46 |
+
|
47 |
+
if(get_theme_mod('table_content_font_color')){ $table_content_font_color = get_theme_mod('table_content_font_color'); } else{ $table_content_font_color = "#737373"; }
|
48 |
+
|
49 |
+
if(get_theme_mod('tracking_link_font_color')){ $tracking_link_font_color = get_theme_mod('tracking_link_font_color'); }
|
50 |
+
|
51 |
+
if(get_theme_mod('tracking_link_bg_color')){ $tracking_link_bg_color = get_theme_mod('tracking_link_bg_color'); }
|
52 |
|
53 |
$th_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
54 |
|
55 |
+
$td_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-size:".$table_content_font_size."px;font-weight:".$table_content_font_weight."; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
56 |
|
57 |
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";padding: 10px;";
|
58 |
|
59 |
+
$remove_date_from_tracking_info = get_theme_mod('remove_date_from_tracking');
|
60 |
+
if(isset( $_REQUEST['wcast-tracking-preview'] ) && '1' === $_REQUEST['wcast-tracking-preview']){
|
61 |
+
$preview = true;
|
62 |
+
} else{
|
63 |
+
$preview = false;
|
64 |
+
}
|
65 |
?>
|
66 |
+
<h2 class="header_text"><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
67 |
+
<p class="addition_header"><?php echo $shipment_tracking_header_text; ?></p>
|
68 |
+
<table class="td tracking_table" cellspacing="0" cellpadding="6" style="width: 100%;border-collapse: collapse;line-height:<?php echo $table_content_line_height; ?>px;background:<?php echo $email_table_backgroud_color; ?>" border="1">
|
69 |
|
70 |
<thead>
|
71 |
<tr>
|
72 |
<th class="tracking-provider" scope="col" class="td" style="<?php echo $th_column_style; ?>"><?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?></th>
|
73 |
<th class="tracking-number" scope="col" class="td" style="<?php echo $th_column_style; ?>"><?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?></th>
|
74 |
+
<?php if($preview){ ?>
|
75 |
+
<th class="date-shipped <?php if($remove_date_from_tracking_info == 1){ echo 'hide'; } ?>" scope="col" class="td" style="<?php echo $th_column_style; ?>"><?php _e( 'Date', 'woocommerce' ); ?></th>
|
76 |
+
<?php } else{
|
77 |
+
if($remove_date_from_tracking_info != 1){ ?>
|
78 |
+
<th class="date-shipped" style="<?php echo $th_column_style; ?>"><span class="nobr"><?php _e( 'Date', 'woocommerce' ); ?></span></th>
|
79 |
+
<?php }
|
80 |
+
} ?>
|
81 |
<th class="order-actions" scope="col" class="td" style="<?php echo $th_column_style; ?>"> </th>
|
82 |
</tr>
|
83 |
</thead>
|
104 |
}
|
105 |
}
|
106 |
?>
|
107 |
+
<img style="width: 50px;margin-right: 5px;vertical-align: middle;" src="<?php echo $src; ?>">
|
108 |
<?php }
|
109 |
echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
110 |
</td>
|
111 |
<td class="tracking-number" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
112 |
<?php echo esc_html( $tracking_item['tracking_number'] ); ?>
|
113 |
</td>
|
114 |
+
<?php if($preview){ ?>
|
115 |
+
<td class="date-shipped <?php if($remove_date_from_tracking_info == 1){ echo 'hide'; } ?>" data-title="<?php _e( 'Status', 'woo-advanced-shipment-tracking' ); ?>" style="<?php echo $td_column_style; ?>">
|
116 |
+
<time datetime="<?php echo date( 'Y-m-d', $tracking_item['date_shipped'] ); ?>" title="<?php echo date( 'Y-m-d', $tracking_item['date_shipped'] ); ?>"><?php echo date_i18n( get_option( 'date_format' ), $tracking_item['date_shipped'] ); ?></time>
|
117 |
+
</td>
|
118 |
+
<?php } else{
|
119 |
+
if($remove_date_from_tracking_info != 1){ ?>
|
120 |
+
<td class="date-shipped" style="<?php echo $td_column_style; ?>" data-title="<?php _e( 'Date', 'woocommerce' ); ?>" style="text-align:left; white-space:nowrap;">
|
121 |
+
<time datetime="<?php echo date( 'Y-m-d', $tracking_item['date_shipped'] ); ?>" title="<?php echo date( 'Y-m-d', $tracking_item['date_shipped'] ); ?>"><?php echo date_i18n( get_option( 'date_format' ), $tracking_item['date_shipped'] ); ?></time>
|
122 |
+
</td>
|
123 |
+
<?php }
|
124 |
+
} ?>
|
125 |
+
|
126 |
<td class="order-actions" style="<?php echo $td_column_style; ?>">
|
127 |
<?php $url = str_replace('%number%',$tracking_item['tracking_number'],$tracking_item['formatted_tracking_link']); ?>
|
128 |
<a href="<?php echo esc_url( $url ); ?>" style="<?php echo $tracking_link_style; ?>" target="_blank"><?php _e( 'Track', 'woo-advanced-shipment-tracking' ); ?></a>
|
templates/myaccount/view-order.php
CHANGED
@@ -23,33 +23,39 @@ if ( $tracking_items ) :
|
|
23 |
$shipment_tracking_header_text = '';
|
24 |
$email_table_backgroud_color = '';
|
25 |
$tracking_link_font_color = '';
|
26 |
-
$tracking_link_bg_color = '';
|
|
|
|
|
27 |
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
$
|
30 |
-
if(get_option('email_border_color')){ $email_border_color = get_option('email_border_color'); }
|
31 |
-
if(get_option('email_border_size')){ $email_border_size = get_option('email_border_size'); }
|
32 |
-
if(get_option('email_shipment_tracking_header')){ $shipment_tracking_header = get_option('email_shipment_tracking_header'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
33 |
-
if(get_option('email_shipment_tracking_header_text')){ $shipment_tracking_header_text = get_option('email_shipment_tracking_header_text'); }
|
34 |
-
$email_table_backgroud_color = get_option('email_table_backgroud_color');
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
if(
|
40 |
|
41 |
-
if(
|
42 |
|
43 |
-
if(
|
44 |
|
45 |
-
if(
|
46 |
|
47 |
-
$th_column_style = "font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color.";";
|
48 |
|
49 |
-
$td_column_style = "font-size:".$table_content_font_size."px; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color.";";
|
50 |
|
51 |
-
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";";
|
52 |
-
|
|
|
53 |
?>
|
54 |
|
55 |
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
@@ -60,7 +66,7 @@ if ( $tracking_items ) :
|
|
60 |
padding-left: 10px;
|
61 |
}
|
62 |
</style>
|
63 |
-
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;background:<?php echo $email_table_backgroud_color; ?>">
|
64 |
<thead>
|
65 |
<tr>
|
66 |
<th class="tracking-provider" style="<?php echo $th_column_style; ?>"><span class="nobr"><?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?></span></th>
|
@@ -93,7 +99,7 @@ if ( $tracking_items ) :
|
|
93 |
}
|
94 |
}
|
95 |
?>
|
96 |
-
<img style="width: 50px;" src="<?php echo $src; ?>">
|
97 |
<?php } echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
98 |
</td>
|
99 |
<td class="tracking-number" style="<?php echo $td_column_style; ?>" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>">
|
23 |
$shipment_tracking_header_text = '';
|
24 |
$email_table_backgroud_color = '';
|
25 |
$tracking_link_font_color = '';
|
26 |
+
$tracking_link_bg_color = '';
|
27 |
+
$table_content_line_height = '';
|
28 |
+
$table_content_font_weight = '';
|
29 |
|
30 |
+
$display_thumbnail = get_theme_mod('display_shipment_provider_image');
|
31 |
+
if(get_theme_mod('table_border_color')){ $email_border_color = get_theme_mod('table_border_color'); } else{ $email_border_color = "#e4e4e4"; }
|
32 |
+
if(get_theme_mod('table_border_size')){ $email_border_size = get_theme_mod('table_border_size'); } else{ $email_border_size = "1"; }
|
33 |
+
if(get_theme_mod('header_text_change')){ $shipment_tracking_header = get_theme_mod('header_text_change'); } else{ $shipment_tracking_header = "Tracking Information"; }
|
34 |
|
35 |
+
if(get_theme_mod('additional_header_text')){ $shipment_tracking_header_text = get_theme_mod('additional_header_text'); }
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
$email_table_backgroud_color = get_theme_mod('table_bg_color');
|
38 |
+
$table_content_line_height = get_theme_mod('table_content_line_height');
|
39 |
+
$table_content_font_weight = get_theme_mod('table_content_font_weight');
|
40 |
+
|
41 |
+
if(get_theme_mod('table_header_font_size')){ $table_header_font_size = get_theme_mod('table_header_font_size'); }
|
42 |
+
if(get_theme_mod('table_header_font_color')){ $table_header_font_color = get_theme_mod('table_header_font_color'); } else{ $table_header_font_color = "#737373"; }
|
43 |
|
44 |
+
if(get_theme_mod('table_content_font_size')){ $table_content_font_size = get_theme_mod('table_content_font_size'); }
|
45 |
|
46 |
+
if(get_theme_mod('table_content_font_color')){ $table_content_font_color = get_theme_mod('table_content_font_color'); } else{ $table_content_font_color = "#737373"; }
|
47 |
|
48 |
+
if(get_theme_mod('tracking_link_font_color')){ $tracking_link_font_color = get_theme_mod('tracking_link_font_color'); }
|
49 |
|
50 |
+
if(get_theme_mod('tracking_link_bg_color')){ $tracking_link_bg_color = get_theme_mod('tracking_link_bg_color'); }
|
51 |
|
52 |
+
$th_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size:".$table_header_font_size."px; color: ".$table_header_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
53 |
|
54 |
+
$td_column_style = "text-align: center; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; font-size:".$table_content_font_size."px;font-weight:".$table_content_font_weight."; color: ".$table_content_font_color." ; border: ".$email_border_size."px solid ".$email_border_color."; padding: 12px;";
|
55 |
|
56 |
+
$tracking_link_style = "color: ".$tracking_link_font_color." ;background:".$tracking_link_bg_color.";padding: 10px;";
|
57 |
+
|
58 |
+
$remove_date_from_tracking_info = get_theme_mod('remove_date_from_tracking');
|
59 |
?>
|
60 |
|
61 |
<h2><?php echo apply_filters( 'woocommerce_shipment_tracking_my_orders_title', __( $shipment_tracking_header, 'woo-advanced-shipment-tracking' ) ); ?></h2>
|
66 |
padding-left: 10px;
|
67 |
}
|
68 |
</style>
|
69 |
+
<table class="shop_table shop_table_responsive my_account_tracking" style="width: 100%;border-collapse: collapse;line-height:<?php echo $table_content_line_height; ?>px;background:<?php echo $email_table_backgroud_color; ?>">
|
70 |
<thead>
|
71 |
<tr>
|
72 |
<th class="tracking-provider" style="<?php echo $th_column_style; ?>"><span class="nobr"><?php _e( 'Provider', 'woo-advanced-shipment-tracking' ); ?></span></th>
|
99 |
}
|
100 |
}
|
101 |
?>
|
102 |
+
<img style="width: 50px;margin-right: 5px;vertical-align: middle;" src="<?php echo $src; ?>">
|
103 |
<?php } echo esc_html( $tracking_item['formatted_tracking_provider'] ); ?>
|
104 |
</td>
|
105 |
<td class="tracking-number" style="<?php echo $td_column_style; ?>" data-title="<?php _e( 'Tracking Number', 'woo-advanced-shipment-tracking' ); ?>">
|
woocommerce-advanced-shipment-tracking.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/shop/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
-
* Version: 1.9.
|
8 |
* Author: zorem
|
9 |
* Author URI: http://www.zorem.com/
|
10 |
* License: GPL-2.0+
|
@@ -22,7 +22,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
-
public $version = '1.9.
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
@@ -360,15 +360,16 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
360 |
if ( is_a( $email, 'WC_Email_Customer_Refunded_Order' ) ) {
|
361 |
return;
|
362 |
}
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
|
|
372 |
}
|
373 |
|
374 |
/**
|
@@ -540,7 +541,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
540 |
*/
|
541 |
public function save_meta_box_ajax() {
|
542 |
check_ajax_referer( 'create-tracking-item', 'security', true );
|
543 |
-
|
544 |
if ( isset( $_POST['tracking_number'] ) && $_POST['tracking_provider'] != '' && isset( $_POST['tracking_provider'] ) && strlen( $_POST['tracking_number'] ) > 0 ) {
|
545 |
|
546 |
$order_id = wc_clean( $_POST['order_id'] );
|
@@ -588,7 +589,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
588 |
|
589 |
$tracking_item = array();
|
590 |
|
591 |
-
$tracking_item['tracking_provider'] =
|
592 |
$tracking_item['custom_tracking_provider'] = wc_clean( $args['custom_tracking_provider'] );
|
593 |
$tracking_item['custom_tracking_link'] = wc_clean( $args['custom_tracking_link'] );
|
594 |
$tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
|
@@ -903,7 +904,10 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
903 |
/*
|
904 |
* include files
|
905 |
*/
|
906 |
-
private function includes(){
|
|
|
|
|
|
|
907 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking.php';
|
908 |
$this->actions = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
909 |
|
@@ -913,7 +917,7 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
913 |
//cron function
|
914 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-cron.php';
|
915 |
//api call function
|
916 |
-
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-api-call.php';
|
917 |
|
918 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
919 |
if($wc_ast_status_delivered == 1) require_once $this->get_plugin_path() . '/includes/email-manager.php';
|
@@ -1272,7 +1276,13 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
1272 |
"provider_url" => 'https://tracking.i-parcel.com/?TrackingNumber=%number%',
|
1273 |
"shipping_country" => 'US',
|
1274 |
"shipping_default" => '1'
|
1275 |
-
),
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
);
|
1277 |
$woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
|
1278 |
foreach($updated_providers as $shipping_provider){
|
@@ -1331,6 +1341,54 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
1331 |
|
1332 |
$result = $wpdb->update( $woo_shippment_table_name, $data_array, $where_array );
|
1333 |
update_option( 'wc_advanced_shipment_tracking', '1.7');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1334 |
}
|
1335 |
}
|
1336 |
}
|
@@ -1797,7 +1855,19 @@ class zorem_woocommerce_advanced_shipment_tracking {
|
|
1797 |
"provider_url" => 'https://tracking.i-parcel.com/?TrackingNumber=%number%',
|
1798 |
"shipping_country" => 'US',
|
1799 |
"shipping_default" => '1'
|
1800 |
-
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1801 |
);
|
1802 |
return $providers;
|
1803 |
}
|
4 |
* Plugin Name: Advanced Shipment Tracking for WooCommerce
|
5 |
* Plugin URI: https://www.zorem.com/shop/woocommerce-advanced-shipment-tracking/
|
6 |
* Description: Add shipment tracking information to your WooCommerce orders and provide customers with an easy way to track their orders. Shipment tracking Info will appear in customers accounts (in the order panel) and in WooCommerce order complete email.
|
7 |
+
* Version: 1.9.6
|
8 |
* Author: zorem
|
9 |
* Author URI: http://www.zorem.com/
|
10 |
* License: GPL-2.0+
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
+
public $version = '1.9.6';
|
26 |
|
27 |
/**
|
28 |
* Initialize the main plugin function
|
360 |
if ( is_a( $email, 'WC_Email_Customer_Refunded_Order' ) ) {
|
361 |
return;
|
362 |
}
|
363 |
+
if ( is_a( $email, 'WC_Email_Customer_Completed_Order' ) ) {
|
364 |
+
$order_id = is_callable( array( $order, 'get_id' ) ) ? $order->get_id() : $order->id;
|
365 |
+
$tracking_items = $this->get_tracking_items( $order_id, true );
|
366 |
+
|
367 |
+
if ( true === $plain_text ) {
|
368 |
+
wc_get_template( 'emails/plain/tracking-info.php', array( 'tracking_items' => $this->get_tracking_items( $order_id, true ) ), 'woocommerce-advanced-shipment-tracking/', $this->get_plugin_path() . '/templates/' );
|
369 |
+
} else {
|
370 |
+
wc_get_template( 'emails/tracking-info.php', array( 'tracking_items' => $this->get_tracking_items( $order_id, true ) ), 'woocommerce-advanced-shipment-tracking/', $this->get_plugin_path() . '/templates/' );
|
371 |
+
}
|
372 |
+
}
|
373 |
}
|
374 |
|
375 |
/**
|
541 |
*/
|
542 |
public function save_meta_box_ajax() {
|
543 |
check_ajax_referer( 'create-tracking-item', 'security', true );
|
544 |
+
//echo '<pre>';print_r($_POST);echo '</pre>';exit;
|
545 |
if ( isset( $_POST['tracking_number'] ) && $_POST['tracking_provider'] != '' && isset( $_POST['tracking_provider'] ) && strlen( $_POST['tracking_number'] ) > 0 ) {
|
546 |
|
547 |
$order_id = wc_clean( $_POST['order_id'] );
|
589 |
|
590 |
$tracking_item = array();
|
591 |
|
592 |
+
$tracking_item['tracking_provider'] = $args['tracking_provider'] ;
|
593 |
$tracking_item['custom_tracking_provider'] = wc_clean( $args['custom_tracking_provider'] );
|
594 |
$tracking_item['custom_tracking_link'] = wc_clean( $args['custom_tracking_link'] );
|
595 |
$tracking_item['tracking_number'] = wc_clean( $args['tracking_number'] );
|
904 |
/*
|
905 |
* include files
|
906 |
*/
|
907 |
+
private function includes(){
|
908 |
+
|
909 |
+
require_once $this->get_plugin_path() . '/includes/customizer/class-wc-tracking-info-customizer.php';
|
910 |
+
|
911 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking.php';
|
912 |
$this->actions = WC_Advanced_Shipment_Tracking_Actions::get_instance();
|
913 |
|
917 |
//cron function
|
918 |
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-cron.php';
|
919 |
//api call function
|
920 |
+
require_once $this->get_plugin_path() . '/includes/class-wc-advanced-shipment-tracking-api-call.php';
|
921 |
|
922 |
$wc_ast_status_delivered = get_option('wc_ast_status_delivered');
|
923 |
if($wc_ast_status_delivered == 1) require_once $this->get_plugin_path() . '/includes/email-manager.php';
|
1276 |
"provider_url" => 'https://tracking.i-parcel.com/?TrackingNumber=%number%',
|
1277 |
"shipping_country" => 'US',
|
1278 |
"shipping_default" => '1'
|
1279 |
+
),
|
1280 |
+
86 => array (
|
1281 |
+
"provider_name" => 'DTDC',
|
1282 |
+
"provider_url" => 'http://www.dtdc.in/tracking/tracking_results.asp?Ttype=awb_no&strCnno=%number%&TrkType2=awb_no',
|
1283 |
+
"shipping_country" => 'IN',
|
1284 |
+
"shipping_default" => '1'
|
1285 |
+
),
|
1286 |
);
|
1287 |
$woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
|
1288 |
foreach($updated_providers as $shipping_provider){
|
1341 |
|
1342 |
$result = $wpdb->update( $woo_shippment_table_name, $data_array, $where_array );
|
1343 |
update_option( 'wc_advanced_shipment_tracking', '1.7');
|
1344 |
+
}
|
1345 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'1.8', '>=') ){
|
1346 |
+
}
|
1347 |
+
else{
|
1348 |
+
global $wpdb;
|
1349 |
+
$DTDC = array(
|
1350 |
+
86 => array (
|
1351 |
+
"provider_name" => 'DTDC',
|
1352 |
+
"provider_url" => 'http://www.dtdc.in/tracking/tracking_results.asp?Ttype=awb_no&strCnno=%number%&TrkType2=awb_no',
|
1353 |
+
"shipping_country" => 'IN',
|
1354 |
+
"shipping_default" => '1'
|
1355 |
+
),
|
1356 |
+
);
|
1357 |
+
$woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
|
1358 |
+
foreach($DTDC as $shipping_provider){
|
1359 |
+
$shipping_provider['provider_name'];
|
1360 |
+
$success = $wpdb->insert($woo_shippment_table_name, array(
|
1361 |
+
"provider_name" => $shipping_provider['provider_name'],
|
1362 |
+
"provider_url" => $shipping_provider['provider_url'],
|
1363 |
+
"shipping_country" => $shipping_provider['shipping_country'],
|
1364 |
+
"shipping_default" => $shipping_provider['shipping_default'],
|
1365 |
+
));
|
1366 |
+
}
|
1367 |
+
update_option( 'wc_advanced_shipment_tracking', '1.8');
|
1368 |
+
}
|
1369 |
+
if(version_compare(get_option( 'wc_advanced_shipment_tracking' ),'1.9', '>=') ){
|
1370 |
+
}
|
1371 |
+
else{
|
1372 |
+
global $wpdb;
|
1373 |
+
$DTDC = array(
|
1374 |
+
87 => array (
|
1375 |
+
"provider_name" => 'DHL Logistics',
|
1376 |
+
"provider_url" => 'https://www.logistics.dhl/us-en/home/tracking/tracking-ecommerce.html?tracking-id=%number%',
|
1377 |
+
"shipping_country" => 'US',
|
1378 |
+
"shipping_default" => '1'
|
1379 |
+
),
|
1380 |
+
);
|
1381 |
+
$woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider';
|
1382 |
+
foreach($DTDC as $shipping_provider){
|
1383 |
+
$shipping_provider['provider_name'];
|
1384 |
+
$success = $wpdb->insert($woo_shippment_table_name, array(
|
1385 |
+
"provider_name" => $shipping_provider['provider_name'],
|
1386 |
+
"provider_url" => $shipping_provider['provider_url'],
|
1387 |
+
"shipping_country" => $shipping_provider['shipping_country'],
|
1388 |
+
"shipping_default" => $shipping_provider['shipping_default'],
|
1389 |
+
));
|
1390 |
+
}
|
1391 |
+
update_option( 'wc_advanced_shipment_tracking', '1.9');
|
1392 |
}
|
1393 |
}
|
1394 |
}
|
1855 |
"provider_url" => 'https://tracking.i-parcel.com/?TrackingNumber=%number%',
|
1856 |
"shipping_country" => 'US',
|
1857 |
"shipping_default" => '1'
|
1858 |
+
),
|
1859 |
+
86 => array (
|
1860 |
+
"provider_name" => 'DTDC',
|
1861 |
+
"provider_url" => 'http://www.dtdc.in/tracking/tracking_results.asp?Ttype=awb_no&strCnno=%number%&TrkType2=awb_no',
|
1862 |
+
"shipping_country" => 'IN',
|
1863 |
+
"shipping_default" => '1'
|
1864 |
+
),
|
1865 |
+
87 => array (
|
1866 |
+
"provider_name" => 'DHL Logistics',
|
1867 |
+
"provider_url" => 'https://www.logistics.dhl/us-en/home/tracking/tracking-ecommerce.html?tracking-id=%number%',
|
1868 |
+
"shipping_country" => 'US',
|
1869 |
+
"shipping_default" => '1'
|
1870 |
+
),
|
1871 |
);
|
1872 |
return $providers;
|
1873 |
}
|