Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress - Version 1.3.5

Version Description

Download this release

Release Info

Developer sandesh055
Plugin Icon Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

Files changed (36) hide show
  1. admin/meta-assets/js/admin-edit.js +26 -0
  2. assets/css/checkout-template-divi-rtl.css +3 -7
  3. assets/css/checkout-template-divi.css +3 -7
  4. assets/css/frontend-divi-rtl.css +195 -0
  5. assets/css/frontend-divi.css +195 -0
  6. assets/min-css/checkout-template-divi-rtl.min.css +1 -1
  7. assets/min-css/checkout-template-divi.min.css +1 -1
  8. assets/min-css/frontend-divi-rtl.min.css +1 -0
  9. assets/min-css/frontend-divi.min.css +1 -0
  10. cartflows.php +1 -1
  11. changelog.txt +5 -0
  12. classes/class-cartflows-admin.php +620 -620
  13. classes/class-cartflows-cloning.php +465 -465
  14. classes/class-cartflows-compatibility.php +410 -410
  15. classes/class-cartflows-default-meta.php +12 -4
  16. classes/class-cartflows-frontend.php +15 -9
  17. classes/class-cartflows-functions.php +3 -3
  18. classes/class-cartflows-importer.php +4 -3
  19. classes/class-cartflows-learndash-compatibility.php +140 -140
  20. classes/class-cartflows-loader.php +1 -13
  21. classes/class-cartflows-metabox.php +97 -97
  22. classes/class-cartflows-session.php +0 -245
  23. classes/class-cartflows-utils.php +425 -425
  24. classes/class-cartflows-wizard.php +679 -679
  25. includes/admin/cartflows-admin.php +35 -35
  26. includes/admin/cartflows-general.php +370 -370
  27. languages/cartflows.pot +79 -66
  28. modules/checkout/classes/class-cartflows-checkout-markup.php +9 -41
  29. modules/checkout/classes/class-cartflows-checkout-meta.php +881 -881
  30. modules/flow/classes/class-cartflows-flow-post-type.php +3 -3
  31. modules/flow/classes/class-cartflows-permalink.php +159 -159
  32. modules/flow/classes/class-cartflows-step-post-type.php +1 -1
  33. modules/flow/view/meta-flow-steps.php +8 -2
  34. modules/thankyou/classes/class-cartflows-thankyou-markup.php +338 -296
  35. modules/thankyou/classes/class-cartflows-thankyou-meta.php +400 -371
  36. readme.txt +6 -1
admin/meta-assets/js/admin-edit.js CHANGED
@@ -674,6 +674,7 @@
674
  /* Ready */
675
  wcf_advance_style_fields();
676
  wcf_thankyou_advance_style_fields();
 
677
 
678
  /* Change Advance Style Field*/
679
  $('.wcf-column-right .wcf-checkout-style .wcf-cs-fields .wcf-cs-checkbox-field input:checkbox').on('change', function(e) {
@@ -684,6 +685,12 @@
684
  $('.wcf-thankyou-table [name="wcf-tq-advance-options-fields"]').on('change', function(e) {
685
  wcf_thankyou_advance_style_fields();
686
  });
 
 
 
 
 
 
687
  }
688
 
689
  var wcf_thankyou_advance_style_fields = function() {
@@ -705,6 +712,25 @@
705
  });
706
  }
707
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
 
709
  /* Disable/Enable Advance Style Field section*/
710
  var wcf_advance_style_fields = function() {
674
  /* Ready */
675
  wcf_advance_style_fields();
676
  wcf_thankyou_advance_style_fields();
677
+ wcf_thankyou_settings_fields();
678
 
679
  /* Change Advance Style Field*/
680
  $('.wcf-column-right .wcf-checkout-style .wcf-cs-fields .wcf-cs-checkbox-field input:checkbox').on('change', function(e) {
685
  $('.wcf-thankyou-table [name="wcf-tq-advance-options-fields"]').on('change', function(e) {
686
  wcf_thankyou_advance_style_fields();
687
  });
688
+
689
+ $('.wcf-thankyou-table [name="wcf-show-tq-redirect-section"]').on('change', function(e) {
690
+ wcf_thankyou_settings_fields();
691
+ });
692
+
693
+
694
  }
695
 
696
  var wcf_thankyou_advance_style_fields = function() {
712
  });
713
  }
714
  }
715
+
716
+ var wcf_thankyou_settings_fields = function() {
717
+ var wrap = $('.wcf-thankyou-table'),
718
+ checkbox_field = $('.wcf-thankyou-table [name="wcf-show-tq-redirect-section"]');
719
+
720
+ var field_names = [
721
+ '.field-wcf-tq-redirect-link'
722
+ ];
723
+
724
+ if ( checkbox_field.is(":checked") ) {
725
+ $.each( field_names, function(i, val) {
726
+ wrap.find( val ).show();
727
+ })
728
+ } else {
729
+ $.each( field_names, function(i, val) {
730
+ wrap.find( val ).hide();
731
+ });
732
+ }
733
+ }
734
 
735
  /* Disable/Enable Advance Style Field section*/
736
  var wcf_advance_style_fields = function() {
assets/css/checkout-template-divi-rtl.css CHANGED
@@ -100,8 +100,8 @@
100
 
101
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
102
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
103
- content: "\f147";
104
- margin: -3px -4px 0 0;
105
  color: #F16334;
106
  }
107
 
@@ -156,7 +156,7 @@
156
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
157
  display: inline-block;
158
  float: right;
159
- font: normal 21px/1 dashicons;
160
  speak: none;
161
  vertical-align: middle;
162
  width: 6px;
@@ -301,10 +301,6 @@
301
  display: none !important;
302
  }
303
 
304
- .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-order-wrap{
305
- display: none;
306
- }
307
-
308
  .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
309
  float: none;
310
  width: 100%;
100
 
101
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
102
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
103
+ content: "\e600";
104
+ margin: 0px;
105
  color: #F16334;
106
  }
107
 
156
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
157
  display: inline-block;
158
  float: right;
159
+ font: normal 15px/1 cartflows-icon;
160
  speak: none;
161
  vertical-align: middle;
162
  width: 6px;
301
  display: none !important;
302
  }
303
 
 
 
 
 
304
  .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
305
  float: none;
306
  width: 100%;
assets/css/checkout-template-divi.css CHANGED
@@ -100,8 +100,8 @@
100
 
101
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
102
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
103
- content: "\f147";
104
- margin: -3px 0 0 -4px;
105
  color: #F16334;
106
  }
107
 
@@ -156,7 +156,7 @@
156
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
157
  display: inline-block;
158
  float: left;
159
- font: normal 21px/1 dashicons;
160
  speak: none;
161
  vertical-align: middle;
162
  width: 6px;
@@ -301,10 +301,6 @@
301
  display: none !important;
302
  }
303
 
304
- .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-order-wrap{
305
- display: none;
306
- }
307
-
308
  .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
309
  float: none;
310
  width: 100%;
100
 
101
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
102
  .et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type="checkbox"]:checked:before{
103
+ content: "\e600";
104
+ margin: 0px;
105
  color: #F16334;
106
  }
107
 
156
  .et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
157
  display: inline-block;
158
  float: left;
159
+ font: normal 15px/1 cartflows-icon;
160
  speak: none;
161
  vertical-align: middle;
162
  width: 6px;
301
  display: none !important;
302
  }
303
 
 
 
 
 
304
  .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
305
  float: none;
306
  width: 100%;
assets/css/frontend-divi-rtl.css ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Only Divi compatibility
2
+ */
3
+ .et_pb_module #wcf-thankyou-wrap {
4
+ padding: 0;
5
+ margin: 0 auto;
6
+ width: 100%;
7
+ max-width: 55em;
8
+ font-size: 13px;
9
+ }
10
+
11
+ .et_pb_module #wcf-thankyou-wrap a {
12
+ color: inherit;
13
+ padding: 0px;
14
+ border: none;
15
+ font-size: inherit;
16
+ }
17
+
18
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::before,
19
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after {
20
+ content: ' ';
21
+ display: table;
22
+ }
23
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after {
24
+ clear: both;
25
+ }
26
+
27
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
28
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li {
29
+ list-style: none;
30
+ line-height: 1;
31
+ }
32
+
33
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li {
34
+ display: inline-block;
35
+ border-left: 1px dashed #cccccc;
36
+ padding: 0.5em 0 0.5em 1em;
37
+ margin: 0.5em 0 0.5em 0.5em;
38
+ list-style-type: none;
39
+ }
40
+
41
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:first-child {
42
+ padding-right: 0;
43
+ }
44
+
45
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:last-child {
46
+ border-left:0px;
47
+ padding-left: 0;
48
+ }
49
+
50
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li strong {
51
+ display: block;
52
+ margin-top: 0.7em;
53
+ }
54
+
55
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
56
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,
57
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,
58
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,
59
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details {
60
+ margin: 0 0 2em;
61
+ -webkit-border-radius: 3px;
62
+ border-radius: 3px;
63
+ width: 100%;
64
+ display: block;
65
+ }
66
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{
67
+ padding: 0px;
68
+ }
69
+
70
+ /* Section Background & Padding
71
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
72
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,
73
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,
74
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,
75
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details {
76
+ background: #f1f1f1;
77
+ padding: 1.5em 2.5em;
78
+ }
79
+
80
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.woocommerce-column__title,
81
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.woocommerce-order-details__title,
82
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-thankyou-order-received,
83
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads__title,
84
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.wc-bacs-bank-details-heading {
85
+ padding: 0.8em 0;
86
+ margin: 0 0 0.5em;
87
+ font-size: 1.5em;
88
+ font-weight: 600;
89
+ color: #404040;
90
+ }
91
+
92
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-thankyou-order-received {
93
+ margin: 0 0 1.5em;
94
+ padding: 0 0.5em;
95
+ text-align: center;
96
+ }
97
+
98
+ /* Order Details Form */
99
+ .woocommerce-order-details table.shop_table,
100
+ .woocommerce-order-downloads table.shop_table {
101
+ border:none;
102
+ border-bottom: 0;
103
+ background-color: inherit;
104
+ -webkit-border-radius: 0;
105
+ border-radius: 0;
106
+ font-family: inherit;
107
+ font-weight:inherit;
108
+ font-size: 0.95em;
109
+ margin: 0 0 0px 0 !important;
110
+ border-collapse: collapse;
111
+ text-align: right;
112
+ }
113
+ .woocommerce-order-details table.shop_table #shipping_method{
114
+ margin: 0;
115
+ padding: 0;
116
+ list-style: none;
117
+ }
118
+ .woocommerce-order-details table.shop_table th,
119
+ .woocommerce-order-downloads table.shop_table th{
120
+ border: none;
121
+ font-weight: 600;
122
+ padding: 9px 0px;
123
+ line-height: 1.2em;
124
+ }
125
+ .woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount {
126
+ font-size: 1em;
127
+ }
128
+ .woocommerce-order-details table.shop_table td,
129
+ .woocommerce-order-details table.shop_table th {
130
+ padding: 0.6em 0;
131
+ line-height: 1.4em;
132
+ border: none;
133
+ }
134
+ .woocommerce-order-details table.shop_table tbody th,
135
+ .woocommerce-order-details table.shop_table tfoot td,
136
+ .woocommerce-order-details table.shop_table tfoot th {
137
+ font-weight: normal;
138
+ border: none;
139
+ }
140
+ .woocommerce-order-details table.shop_table tbody {
141
+ border-top: 1px dashed #cccccc;
142
+ border-bottom: 1px dashed #cccccc;
143
+ }
144
+ .woocommerce-order-details table.shop_table th.product-name,
145
+ .woocommerce-order-details table.shop_table th.product-total{
146
+ font-weight: 600;
147
+ }
148
+ .woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th,
149
+ .woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td {
150
+ font-weight: 600;
151
+ border-top: 1px dashed #cccccc;
152
+ }
153
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-totals th {
154
+ padding-top: 1.8em;
155
+ font-weight: 600;
156
+ }
157
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-totals th,
158
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-total th,
159
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-total td {
160
+ vertical-align: top;
161
+ }
162
+
163
+ /**/
164
+
165
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set{
166
+ -js-display: flex;
167
+ display: -webkit-box;
168
+ display: -webkit-flex;
169
+ display: -moz-box;
170
+ display: -ms-flexbox;
171
+ display: flex;
172
+ }
173
+
174
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1{
175
+ margin-left: 2%;
176
+ }
177
+
178
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1,
179
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-2 {
180
+ width: 49%;
181
+ display: inline-block;
182
+ }
183
+
184
+
185
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address {
186
+ border-left-width: 1px;
187
+ border-bottom-width: 1px;
188
+ -webkit-border-radius: 0;
189
+ border-radius: 0;
190
+ font-style: normal;
191
+ }
192
+
193
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address p{
194
+ margin: 0;
195
+ }
assets/css/frontend-divi.css ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Only Divi compatibility
2
+ */
3
+ .et_pb_module #wcf-thankyou-wrap {
4
+ padding: 0;
5
+ margin: 0 auto;
6
+ width: 100%;
7
+ max-width: 55em;
8
+ font-size: 13px;
9
+ }
10
+
11
+ .et_pb_module #wcf-thankyou-wrap a {
12
+ color: inherit;
13
+ padding: 0px;
14
+ border: none;
15
+ font-size: inherit;
16
+ }
17
+
18
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::before,
19
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after {
20
+ content: ' ';
21
+ display: table;
22
+ }
23
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after {
24
+ clear: both;
25
+ }
26
+
27
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
28
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li {
29
+ list-style: none;
30
+ line-height: 1;
31
+ }
32
+
33
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li {
34
+ display: inline-block;
35
+ border-right: 1px dashed #cccccc;
36
+ padding: 0.5em 1em 0.5em 0;
37
+ margin: 0.5em 0.5em 0.5em 0;
38
+ list-style-type: none;
39
+ }
40
+
41
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:first-child {
42
+ padding-left: 0;
43
+ }
44
+
45
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:last-child {
46
+ border-right:0px;
47
+ padding-right: 0;
48
+ }
49
+
50
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li strong {
51
+ display: block;
52
+ margin-top: 0.7em;
53
+ }
54
+
55
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
56
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,
57
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,
58
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,
59
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details {
60
+ margin: 0 0 2em;
61
+ -webkit-border-radius: 3px;
62
+ border-radius: 3px;
63
+ width: 100%;
64
+ display: block;
65
+ }
66
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{
67
+ padding: 0px;
68
+ }
69
+
70
+ /* Section Background & Padding
71
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,
72
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,
73
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,
74
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,
75
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details {
76
+ background: #f1f1f1;
77
+ padding: 1.5em 2.5em;
78
+ }
79
+
80
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.woocommerce-column__title,
81
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.woocommerce-order-details__title,
82
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-thankyou-order-received,
83
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads__title,
84
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order h2.wc-bacs-bank-details-heading {
85
+ padding: 0.8em 0;
86
+ margin: 0 0 0.5em;
87
+ font-size: 1.5em;
88
+ font-weight: 600;
89
+ color: #404040;
90
+ }
91
+
92
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-thankyou-order-received {
93
+ margin: 0 0 1.5em;
94
+ padding: 0 0.5em;
95
+ text-align: center;
96
+ }
97
+
98
+ /* Order Details Form */
99
+ .woocommerce-order-details table.shop_table,
100
+ .woocommerce-order-downloads table.shop_table {
101
+ border:none;
102
+ border-bottom: 0;
103
+ background-color: inherit;
104
+ -webkit-border-radius: 0;
105
+ border-radius: 0;
106
+ font-family: inherit;
107
+ font-weight:inherit;
108
+ font-size: 0.95em;
109
+ margin: 0 0 0px 0 !important;
110
+ border-collapse: collapse;
111
+ text-align: left;
112
+ }
113
+ .woocommerce-order-details table.shop_table #shipping_method{
114
+ margin: 0;
115
+ padding: 0;
116
+ list-style: none;
117
+ }
118
+ .woocommerce-order-details table.shop_table th,
119
+ .woocommerce-order-downloads table.shop_table th{
120
+ border: none;
121
+ font-weight: 600;
122
+ padding: 9px 0px;
123
+ line-height: 1.2em;
124
+ }
125
+ .woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount {
126
+ font-size: 1em;
127
+ }
128
+ .woocommerce-order-details table.shop_table td,
129
+ .woocommerce-order-details table.shop_table th {
130
+ padding: 0.6em 0;
131
+ line-height: 1.4em;
132
+ border: none;
133
+ }
134
+ .woocommerce-order-details table.shop_table tbody th,
135
+ .woocommerce-order-details table.shop_table tfoot td,
136
+ .woocommerce-order-details table.shop_table tfoot th {
137
+ font-weight: normal;
138
+ border: none;
139
+ }
140
+ .woocommerce-order-details table.shop_table tbody {
141
+ border-top: 1px dashed #cccccc;
142
+ border-bottom: 1px dashed #cccccc;
143
+ }
144
+ .woocommerce-order-details table.shop_table th.product-name,
145
+ .woocommerce-order-details table.shop_table th.product-total{
146
+ font-weight: 600;
147
+ }
148
+ .woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th,
149
+ .woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td {
150
+ font-weight: 600;
151
+ border-top: 1px dashed #cccccc;
152
+ }
153
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-totals th {
154
+ padding-top: 1.8em;
155
+ font-weight: 600;
156
+ }
157
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-totals th,
158
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-total th,
159
+ .woocommerce-order-details table.shop_table tfoot tr.recurring-total td {
160
+ vertical-align: top;
161
+ }
162
+
163
+ /**/
164
+
165
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set{
166
+ -js-display: flex;
167
+ display: -webkit-box;
168
+ display: -webkit-flex;
169
+ display: -moz-box;
170
+ display: -ms-flexbox;
171
+ display: flex;
172
+ }
173
+
174
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1{
175
+ margin-right: 2%;
176
+ }
177
+
178
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1,
179
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-2 {
180
+ width: 49%;
181
+ display: inline-block;
182
+ }
183
+
184
+
185
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address {
186
+ border-right-width: 1px;
187
+ border-bottom-width: 1px;
188
+ -webkit-border-radius: 0;
189
+ border-radius: 0;
190
+ font-style: normal;
191
+ }
192
+
193
+ .et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address p{
194
+ margin: 0;
195
+ }
assets/min-css/checkout-template-divi-rtl.min.css CHANGED
@@ -1 +1 @@
1
- .et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c!important}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:inline-block;width:55%;float:right;padding-left:40px;margin:50px 0 0}.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row select,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea{display:block;width:100%;min-height:34px;padding:11px 12px;font-family:inherit;font-weight:inherit;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid #d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row{margin-bottom:1.1em;padding:3px 3px 0 3px}.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .form-row label{font-size:13px;line-height:1em;letter-spacing:.3px;font-family:inherit;font-weight:inherit;text-transform:capitalize;margin-bottom:8px}.cartflows-canvas #page-container{padding-top:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{color:inherit!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6!important;border:dashed 1px #a00!important;padding:25px 25px 20px!important;color:#a00!important;margin:1rem 0 1rem!important;font-size:14px!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{font-weight:400!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\f147";margin:-3px -4px 0 0;color:#f16334}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio],.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]{border:1px solid #b4b9be;background:#fff;color:#555;clear:none;cursor:pointer;display:inline-block;line-height:0;height:16px;margin:-4px 0 0 4px;outline:0;padding:0!important;text-align:center;vertical-align:middle;width:16px;min-width:16px;-webkit-appearance:none;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:focus{border-color:#f16334;-webkit-box-shadow:0 0 2px rgba(241,99,52,.8);box-shadow:0 0 2px rgba(241,99,52,.8)}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{background-color:#f16334;-webkit-border-radius:50px;border-radius:50px;content:"\2022";font-size:24px;height:6px;line-height:16px;margin:4px;text-indent:-9999px;width:6px}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{display:inline-block;float:right;font:normal 21px/1 dashicons;speak:none;vertical-align:middle;width:6px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.et_pb_module #wcf-embed-checkout-form #order_review_heading,.et_pb_module #wcf-embed-checkout-form .woocommerce #ship-to-different-address,.et_pb_module #wcf-embed-checkout-form .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-family:inherit;font-weight:600;font-size:20px;text-transform:capitalize;margin:0 0 25px 0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block!important;font-family:inherit;font-weight:600;width:45%;margin:50px 0 0;padding:0 10px 20px;border:none;border-bottom:none}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0;margin:0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #add_payment_method #payment ul.payment_methods li,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li{line-height:2;text-align:right;margin:0;list-style:none;font-weight:inherit}.et_pb_module #wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;color:#444;margin-top:0;margin-bottom:1.5em}.et_pb_module #wcf-embed-checkout-form .woocommerce .shop_table #shipping_method li{list-style:none}.et_pb_module #wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.et_pb_module #wcf-embed-checkout-form .wcf-custom-coupon-field{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:25px;margin-top:25px;border-top:1px solid #dcdcdc;padding-top:25px}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{color:inherit!important;border:none!important;background-color:transparent!important;padding:0 2em 1.2em 2em!important;font-size:14px!important;margin:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{display:block!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .wcf-col2-set{display:block;margin-top:10px;padding-left:0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce-checkout #order_review_heading{display:block!important;margin:20px 0 0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-product-option-wrap{display:block;width:100%;float:none;padding-left:0;padding:0;-webkit-border-radius:0;border-radius:0;margin-top:10px;margin-bottom:20px}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step #order_review_heading,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-billing-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review_heading{display:none!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-order-wrap{display:none}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-wrap{display:block;float:none;margin:1em auto 1em;overflow:hidden}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1{background:#f1f1f1;border-style:none;border-width:2px;border-color:red;-webkit-border-radius:3px;border-radius:3px;display:inline-block}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2{border:2px red dashed;-webkit-border-radius:3px;border-radius:3px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-field-wrap{border-style:none;border-width:2px;border-color:red;padding:20px 25px;margin:0;font-size:1.1em;display:block;background:#ddd}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-content-container{padding:25px 0}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-offer{padding:0 25px 10px;font-size:1.2em}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-desc{padding:0 25px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-offer{padding:20px 25px;font-size:1.1em;font-weight:600}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-desc{padding:0 25px 20px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-field-wrap{border-top:2px red dashed;padding:15px 25px;margin:0;font-size:1.1em;display:block}.et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:block;float:none;padding-left:0;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:block!important;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review{display:block;float:none;width:100%}}@media (max-width:767px){.et_pb_module #wcf-embed-checkout-form .woocommerce .form-row{width:100%!important}}
1
+ .et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c!important}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:inline-block;width:55%;float:right;padding-left:40px;margin:50px 0 0}.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row select,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea{display:block;width:100%;min-height:34px;padding:11px 12px;font-family:inherit;font-weight:inherit;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid #d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row{margin-bottom:1.1em;padding:3px 3px 0 3px}.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .form-row label{font-size:13px;line-height:1em;letter-spacing:.3px;font-family:inherit;font-weight:inherit;text-transform:capitalize;margin-bottom:8px}.cartflows-canvas #page-container{padding-top:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{color:inherit!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6!important;border:dashed 1px #a00!important;padding:25px 25px 20px!important;color:#a00!important;margin:1rem 0 1rem!important;font-size:14px!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{font-weight:400!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\e600";margin:0;color:#f16334}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio],.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]{border:1px solid #b4b9be;background:#fff;color:#555;clear:none;cursor:pointer;display:inline-block;line-height:0;height:16px;margin:-4px 0 0 4px;outline:0;padding:0!important;text-align:center;vertical-align:middle;width:16px;min-width:16px;-webkit-appearance:none;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:focus{border-color:#f16334;-webkit-box-shadow:0 0 2px rgba(241,99,52,.8);box-shadow:0 0 2px rgba(241,99,52,.8)}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{background-color:#f16334;-webkit-border-radius:50px;border-radius:50px;content:"\2022";font-size:24px;height:6px;line-height:16px;margin:4px;text-indent:-9999px;width:6px}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{display:inline-block;float:right;font:normal 15px/1 cartflows-icon;speak:none;vertical-align:middle;width:6px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.et_pb_module #wcf-embed-checkout-form #order_review_heading,.et_pb_module #wcf-embed-checkout-form .woocommerce #ship-to-different-address,.et_pb_module #wcf-embed-checkout-form .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-family:inherit;font-weight:600;font-size:20px;text-transform:capitalize;margin:0 0 25px 0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block!important;font-family:inherit;font-weight:600;width:45%;margin:50px 0 0;padding:0 10px 20px;border:none;border-bottom:none}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0;margin:0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #add_payment_method #payment ul.payment_methods li,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li{line-height:2;text-align:right;margin:0;list-style:none;font-weight:inherit}.et_pb_module #wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;color:#444;margin-top:0;margin-bottom:1.5em}.et_pb_module #wcf-embed-checkout-form .woocommerce .shop_table #shipping_method li{list-style:none}.et_pb_module #wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.et_pb_module #wcf-embed-checkout-form .wcf-custom-coupon-field{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:25px;margin-top:25px;border-top:1px solid #dcdcdc;padding-top:25px}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{color:inherit!important;border:none!important;background-color:transparent!important;padding:0 2em 1.2em 2em!important;font-size:14px!important;margin:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{display:block!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .wcf-col2-set{display:block;margin-top:10px;padding-left:0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce-checkout #order_review_heading{display:block!important;margin:20px 0 0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-product-option-wrap{display:block;width:100%;float:none;padding-left:0;padding:0;-webkit-border-radius:0;border-radius:0;margin-top:10px;margin-bottom:20px}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step #order_review_heading,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-billing-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review_heading{display:none!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-wrap{display:block;float:none;margin:1em auto 1em;overflow:hidden}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1{background:#f1f1f1;border-style:none;border-width:2px;border-color:red;-webkit-border-radius:3px;border-radius:3px;display:inline-block}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2{border:2px red dashed;-webkit-border-radius:3px;border-radius:3px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-field-wrap{border-style:none;border-width:2px;border-color:red;padding:20px 25px;margin:0;font-size:1.1em;display:block;background:#ddd}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-content-container{padding:25px 0}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-offer{padding:0 25px 10px;font-size:1.2em}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-desc{padding:0 25px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-offer{padding:20px 25px;font-size:1.1em;font-weight:600}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-desc{padding:0 25px 20px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-field-wrap{border-top:2px red dashed;padding:15px 25px;margin:0;font-size:1.1em;display:block}.et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:block;float:none;padding-left:0;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:block!important;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review{display:block;float:none;width:100%}}@media (max-width:767px){.et_pb_module #wcf-embed-checkout-form .woocommerce .form-row{width:100%!important}}
assets/min-css/checkout-template-divi.min.css CHANGED
@@ -1 +1 @@
1
- .et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c!important}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:inline-block;width:55%;float:left;padding-right:40px;margin:50px 0 0}.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row select,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea{display:block;width:100%;min-height:34px;padding:11px 12px;font-family:inherit;font-weight:inherit;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid #d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row{margin-bottom:1.1em;padding:3px 3px 0 3px}.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .form-row label{font-size:13px;line-height:1em;letter-spacing:.3px;font-family:inherit;font-weight:inherit;text-transform:capitalize;margin-bottom:8px}.cartflows-canvas #page-container{padding-top:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{color:inherit!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6!important;border:dashed 1px #a00!important;padding:25px 25px 20px!important;color:#a00!important;margin:1rem 0 1rem!important;font-size:14px!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{font-weight:400!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\f147";margin:-3px 0 0 -4px;color:#f16334}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio],.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]{border:1px solid #b4b9be;background:#fff;color:#555;clear:none;cursor:pointer;display:inline-block;line-height:0;height:16px;margin:-4px 4px 0 0;outline:0;padding:0!important;text-align:center;vertical-align:middle;width:16px;min-width:16px;-webkit-appearance:none;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:focus{border-color:#f16334;-webkit-box-shadow:0 0 2px rgba(241,99,52,.8);box-shadow:0 0 2px rgba(241,99,52,.8)}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{background-color:#f16334;-webkit-border-radius:50px;border-radius:50px;content:"\2022";font-size:24px;height:6px;line-height:16px;margin:4px;text-indent:-9999px;width:6px}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{display:inline-block;float:left;font:normal 21px/1 dashicons;speak:none;vertical-align:middle;width:6px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.et_pb_module #wcf-embed-checkout-form #order_review_heading,.et_pb_module #wcf-embed-checkout-form .woocommerce #ship-to-different-address,.et_pb_module #wcf-embed-checkout-form .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-family:inherit;font-weight:600;font-size:20px;text-transform:capitalize;margin:0 0 25px 0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block!important;font-family:inherit;font-weight:600;width:45%;margin:50px 0 0;padding:0 10px 20px;border:none;border-bottom:none}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0;margin:0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #add_payment_method #payment ul.payment_methods li,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li{line-height:2;text-align:left;margin:0;list-style:none;font-weight:inherit}.et_pb_module #wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;color:#444;margin-top:0;margin-bottom:1.5em}.et_pb_module #wcf-embed-checkout-form .woocommerce .shop_table #shipping_method li{list-style:none}.et_pb_module #wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.et_pb_module #wcf-embed-checkout-form .wcf-custom-coupon-field{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:25px;margin-top:25px;border-top:1px solid #dcdcdc;padding-top:25px}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{color:inherit!important;border:none!important;background-color:transparent!important;padding:0 2em 1.2em 2em!important;font-size:14px!important;margin:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{display:block!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .wcf-col2-set{display:block;margin-top:10px;padding-right:0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce-checkout #order_review_heading{display:block!important;margin:20px 0 0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-product-option-wrap{display:block;width:100%;float:none;padding-right:0;padding:0;-webkit-border-radius:0;border-radius:0;margin-top:10px;margin-bottom:20px}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step #order_review_heading,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-billing-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review_heading{display:none!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-order-wrap{display:none}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-wrap{display:block;float:none;margin:1em auto 1em;overflow:hidden}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1{background:#f1f1f1;border-style:none;border-width:2px;border-color:red;-webkit-border-radius:3px;border-radius:3px;display:inline-block}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2{border:2px red dashed;-webkit-border-radius:3px;border-radius:3px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-field-wrap{border-style:none;border-width:2px;border-color:red;padding:20px 25px;margin:0;font-size:1.1em;display:block;background:#ddd}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-content-container{padding:25px 0}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-offer{padding:0 25px 10px;font-size:1.2em}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-desc{padding:0 25px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-offer{padding:20px 25px;font-size:1.1em;font-weight:600}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-desc{padding:0 25px 20px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-field-wrap{border-top:2px red dashed;padding:15px 25px;margin:0;font-size:1.1em;display:block}.et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:block;float:none;padding-right:0;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:block!important;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review{display:block;float:none;width:100%}}@media (max-width:767px){.et_pb_module #wcf-embed-checkout-form .woocommerce .form-row{width:100%!important}}
1
+ .et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c!important}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:inline-block;width:55%;float:left;padding-right:40px;margin:50px 0 0}.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row select,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea{display:block;width:100%;min-height:34px;padding:11px 12px;font-family:inherit;font-weight:inherit;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid #d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row{margin-bottom:1.1em;padding:3px 3px 0 3px}.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .form-row label{font-size:13px;line-height:1em;letter-spacing:.3px;font-family:inherit;font-weight:inherit;text-transform:capitalize;margin-bottom:8px}.cartflows-canvas #page-container{padding-top:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{color:inherit!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6!important;border:dashed 1px #a00!important;padding:25px 25px 20px!important;color:#a00!important;margin:1rem 0 1rem!important;font-size:14px!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error li{font-weight:400!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\e600";margin:0;color:#f16334}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio],.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]{border:1px solid #b4b9be;background:#fff;color:#555;clear:none;cursor:pointer;display:inline-block;line-height:0;height:16px;margin:-4px 4px 0 0;outline:0;padding:0!important;text-align:center;vertical-align:middle;width:16px;min-width:16px;-webkit-appearance:none;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:focus{border-color:#f16334;-webkit-box-shadow:0 0 2px rgba(241,99,52,.8);box-shadow:0 0 2px rgba(241,99,52,.8)}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{background-color:#f16334;-webkit-border-radius:50px;border-radius:50px;content:"\2022";font-size:24px;height:6px;line-height:16px;margin:4px;text-indent:-9999px;width:6px}.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{display:inline-block;float:left;font:normal 15px/1 cartflows-icon;speak:none;vertical-align:middle;width:6px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.et_pb_module #wcf-embed-checkout-form #order_review_heading,.et_pb_module #wcf-embed-checkout-form .woocommerce #ship-to-different-address,.et_pb_module #wcf-embed-checkout-form .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-family:inherit;font-weight:600;font-size:20px;text-transform:capitalize;margin:0 0 25px 0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block!important;font-family:inherit;font-weight:600;width:45%;margin:50px 0 0;padding:0 10px 20px;border:none;border-bottom:none}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0;margin:0}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #add_payment_method #payment ul.payment_methods li,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li{line-height:2;text-align:left;margin:0;list-style:none;font-weight:inherit}.et_pb_module #wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;color:#444;margin-top:0;margin-bottom:1.5em}.et_pb_module #wcf-embed-checkout-form .woocommerce .shop_table #shipping_method li{list-style:none}.et_pb_module #wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.et_pb_module #wcf-embed-checkout-form .wcf-custom-coupon-field{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:25px;margin-top:25px;border-top:1px solid #dcdcdc;padding-top:25px}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{color:inherit!important;border:none!important;background-color:transparent!important;padding:0 2em 1.2em 2em!important;font-size:14px!important;margin:0!important}.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{display:block!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce .wcf-col2-set{display:block;margin-top:10px;padding-right:0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-one-column .woocommerce-checkout #order_review_heading{display:block!important;margin:20px 0 0;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-product-option-wrap{display:block;width:100%;float:none;padding-right:0;padding:0;-webkit-border-radius:0;border-radius:0;margin-top:10px;margin-bottom:20px}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout .wcf-col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step #order_review_heading,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-additional-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-billing-fields>h3,.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review_heading{display:none!important}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-wrap{display:block;float:none;margin:1em auto 1em;overflow:hidden}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1{background:#f1f1f1;border-style:none;border-width:2px;border-color:red;-webkit-border-radius:3px;border-radius:3px;display:inline-block}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2{border:2px red dashed;-webkit-border-radius:3px;border-radius:3px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-field-wrap{border-style:none;border-width:2px;border-color:red;padding:20px 25px;margin:0;font-size:1.1em;display:block;background:#ddd}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-content-container{padding:25px 0}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-offer{padding:0 25px 10px;font-size:1.2em}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-1 .wcf-bump-order-desc{padding:0 25px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-offer{padding:20px 25px;font-size:1.1em;font-weight:600}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-desc{padding:0 25px 20px}.et_pb_module #wcf-embed-checkout-form .wcf-bump-order-style-2 .wcf-bump-order-field-wrap{border-top:2px red dashed;padding:15px 25px;margin:0;font-size:1.1em;display:block}.et_pb_module #wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .col2-set,.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .wcf-col2-set{display:block;float:none;padding-right:0;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:block!important;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review{display:block;float:none;width:100%}}@media (max-width:767px){.et_pb_module #wcf-embed-checkout-form .woocommerce .form-row{width:100%!important}}
assets/min-css/frontend-divi-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .et_pb_module #wcf-thankyou-wrap{padding:0;margin:0 auto;width:100%;max-width:55em;font-size:13px}.et_pb_module #wcf-thankyou-wrap a{color:inherit;padding:0;border:none;font-size:inherit}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::before{content:' ';display:table}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after{clear:both}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li{list-style:none;line-height:1}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li{display:inline-block;border-left:1px dashed #ccc;padding:.5em 0 .5em 1em;margin:.5em 0 .5em .5em;list-style-type:none}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:first-child{padding-right:0}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:last-child{border-left:0;padding-left:0}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li strong{display:block;margin-top:.7em}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{padding:0}.woocommerce-order-details table.shop_table,.woocommerce-order-downloads table.shop_table{border:none;border-bottom:0;background-color:inherit;-webkit-border-radius:0;border-radius:0;font-family:inherit;font-weight:inherit;font-size:.95em;margin:0!important;border-collapse:collapse;text-align:right}.woocommerce-order-details table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.woocommerce-order-details table.shop_table th,.woocommerce-order-downloads table.shop_table th{border:none;font-weight:600;padding:9px 0;line-height:1.2em}.woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.woocommerce-order-details table.shop_table td,.woocommerce-order-details table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.woocommerce-order-details table.shop_table tbody th,.woocommerce-order-details table.shop_table tfoot td,.woocommerce-order-details table.shop_table tfoot th{font-weight:400;border:none}.woocommerce-order-details table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.woocommerce-order-details table.shop_table th.product-name,.woocommerce-order-details table.shop_table th.product-total{font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td,.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.recurring-total td,.woocommerce-order-details table.shop_table tfoot tr.recurring-total th,.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1{margin-left:2%}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-2{width:49%;display:inline-block}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address{border-left-width:1px;border-bottom-width:1px;-webkit-border-radius:0;border-radius:0;font-style:normal}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address p{margin:0}
assets/min-css/frontend-divi.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .et_pb_module #wcf-thankyou-wrap{padding:0;margin:0 auto;width:100%;max-width:55em;font-size:13px}.et_pb_module #wcf-thankyou-wrap a{color:inherit;padding:0;border:none;font-size:inherit}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::before{content:' ';display:table}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details::after{clear:both}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li{list-style:none;line-height:1}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li{display:inline-block;border-right:1px dashed #ccc;padding:.5em 1em .5em 0;margin:.5em .5em .5em 0;list-style-type:none}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:first-child{padding-left:0}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li:last-child{border-right:0;padding-right:0}.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details li strong{display:block;margin-top:.7em}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-details,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-order-downloads,.et_pb_module #wcf-thankyou-wrap .woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{padding:0}.woocommerce-order-details table.shop_table,.woocommerce-order-downloads table.shop_table{border:none;border-bottom:0;background-color:inherit;-webkit-border-radius:0;border-radius:0;font-family:inherit;font-weight:inherit;font-size:.95em;margin:0!important;border-collapse:collapse;text-align:left}.woocommerce-order-details table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.woocommerce-order-details table.shop_table th,.woocommerce-order-downloads table.shop_table th{border:none;font-weight:600;padding:9px 0;line-height:1.2em}.woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.woocommerce-order-details table.shop_table td,.woocommerce-order-details table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.woocommerce-order-details table.shop_table tbody th,.woocommerce-order-details table.shop_table tfoot td,.woocommerce-order-details table.shop_table tfoot th{font-weight:400;border:none}.woocommerce-order-details table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.woocommerce-order-details table.shop_table th.product-name,.woocommerce-order-details table.shop_table th.product-total{font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td,.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.recurring-total td,.woocommerce-order-details table.shop_table tfoot tr.recurring-total th,.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1{margin-right:2%}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-1,.et_pb_module #wcf-thankyou-wrap .woocommerce-order .wcf-col2-set .wcf-col-2{width:49%;display:inline-block}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address{border-right-width:1px;border-bottom-width:1px;-webkit-border-radius:0;border-radius:0;font-style:normal}.et_pb_module #wcf-thankyou-wrap .woocommerce-order .woocommerce-customer-details address p{margin:0}
cartflows.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
- * Version: 1.3.4
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
+ * Version: 1.3.5
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  Version 1.3.4 - Tuesday, 14th January 2020
2
  - New: Option added to change order button text for each flow.
3
  - Improvement: WooCommerce Google Analytics Integration plugin's compatibility added.
1
+ Version 1.3.5 - Tuesday, 28th January 2020
2
+ - New: Option added for thank you page redirection.
3
+ - Fix: Pro version's two-step CSS conflict with the DIVI, the second tab was not displaying.
4
+ - Fix: Checkbox icon for terms & conditions was not displaying for DIVI Builder & Theme.
5
+
6
  Version 1.3.4 - Tuesday, 14th January 2020
7
  - New: Option added to change order button text for each flow.
8
  - Improvement: WooCommerce Google Analytics Integration plugin's compatibility added.
classes/class-cartflows-admin.php CHANGED
@@ -1,620 +1,620 @@
1
- <?php
2
- /**
3
- * CartFlows Admin.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Class Cartflows_Admin.
10
- */
11
- class Cartflows_Admin {
12
-
13
- /**
14
- * Calls on initialization
15
- *
16
- * @since 1.0.0
17
- */
18
- public static function init() {
19
-
20
- self::initialise_plugin();
21
- self::init_hooks();
22
- }
23
-
24
- /**
25
- * Init Hooks.
26
- *
27
- * @since 1.0.0
28
- * @return void
29
- */
30
- public static function init_hooks() {
31
-
32
- if ( ! is_admin() ) {
33
- return;
34
- }
35
-
36
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin-fields.php';
37
-
38
- /*
39
- Add CARTFLOWS menu option to admin.
40
- add_action( 'network_admin_menu', __CLASS__ . '::menu' );
41
- */
42
- add_action( 'admin_menu', __CLASS__ . '::menu' );
43
- add_action( 'admin_menu', __CLASS__ . '::submenu', 999 );
44
-
45
- add_action( 'cartflows_render_admin_content', __CLASS__ . '::render_content' );
46
-
47
- add_action( 'admin_init', __CLASS__ . '::settings_admin_scripts' );
48
-
49
- /* Global Addmin Script */
50
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::global_admin_scripts', 20 );
51
-
52
- add_action( 'admin_footer', __CLASS__ . '::global_admin_data', 9555 );
53
-
54
- /* Add lite version class to body */
55
- add_action( 'admin_body_class', __CLASS__ . '::add_admin_body_class' );
56
-
57
- add_filter( 'plugin_action_links_' . CARTFLOWS_BASE, __CLASS__ . '::add_action_links' );
58
-
59
- add_action( 'admin_init', __CLASS__ . '::cartflows_after_save_permalinks' );
60
-
61
- }
62
-
63
- /**
64
- * After save of permalinks.
65
- */
66
- public static function cartflows_after_save_permalinks() {
67
-
68
- $has_saved_permalinks = get_option( 'cartflows_permalink_saved' );
69
- if ( $has_saved_permalinks ) {
70
- flush_rewrite_rules();
71
- delete_option( 'cartflows_permalink_saved' );
72
- }
73
- }
74
-
75
-
76
- /**
77
- * Initialize after Cartflows pro get loaded.
78
- */
79
- public static function settings_admin_scripts() {
80
- // Enqueue admin scripts.
81
- if ( isset( $_REQUEST['page'] ) && CARTFLOWS_SETTINGS == $_REQUEST['page'] ) {
82
- add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
83
-
84
- self::save_settings();
85
- }
86
- }
87
- /**
88
- * Show action on plugin page.
89
- *
90
- * @param array $links links.
91
- * @return array
92
- */
93
- public static function add_action_links( $links ) {
94
- $mylinks = array(
95
- '<a href="' . admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS ) . '">Settings</a>',
96
- '<a target="_blank" href="' . esc_url( 'https://cartflows.com/docs' ) . '">Docs</a>',
97
- );
98
-
99
- if ( ! _is_cartflows_pro() ) {
100
- array_push( $mylinks, '<a style="color: #39b54a; font-weight: bold;" target="_blank" href="' . esc_url( 'https://cartflows.com/pricing/' ) . '"> Go Pro </a>' );
101
- }
102
-
103
- return array_merge( $links, $mylinks );
104
- }
105
-
106
- /**
107
- * Initialises the Plugin Name.
108
- *
109
- * @since 1.0.0
110
- * @return void
111
- */
112
- public static function initialise_plugin() {
113
-
114
- $name = 'Cartflows';
115
- $short_name = 'Cflows';
116
-
117
- define( 'CARTFLOWS_PLUGIN_NAME', $name );
118
- define( 'CARTFLOWS_PLUGIN_SHORT_NAME', $short_name );
119
- }
120
-
121
- /**
122
- * Renders the admin settings menu.
123
- *
124
- * @since 1.0.0
125
- * @return void
126
- */
127
- public static function menu() {
128
-
129
- if ( ! current_user_can( 'manage_options' ) ) {
130
- return;
131
- }
132
-
133
- add_menu_page(
134
- 'CartFlows',
135
- 'CartFlows',
136
- 'manage_options',
137
- CARTFLOWS_SLUG,
138
- __CLASS__ . '::render',
139
- 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( CARTFLOWS_DIR . 'assets/images/cartflows-icon.svg' ) ),//phpcs:ignore
140
- 39.7
141
- );
142
-
143
- }
144
-
145
- /**
146
- * Add submenu to admin menu.
147
- *
148
- * @since 1.0.0
149
- */
150
- public static function submenu() {
151
-
152
- $parent_slug = CARTFLOWS_SLUG;
153
- $page_title = __( 'Settings', 'cartflows' );
154
- $menu_title = __( 'Settings', 'cartflows' );
155
- $capability = 'manage_options';
156
- $menu_slug = 'cartflows_settings';
157
- $callback = __CLASS__ . '::render';
158
-
159
- add_submenu_page(
160
- $parent_slug,
161
- $page_title,
162
- $menu_title,
163
- $capability,
164
- $menu_slug,
165
- $callback
166
- );
167
- }
168
-
169
- /**
170
- * Renders the admin settings.
171
- *
172
- * @since 1.0.0
173
- * @return void
174
- */
175
- public static function render() {
176
- $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
177
- $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
178
- $action = str_replace( '_', '-', $action );
179
-
180
- // Enable header icon filter below.
181
- $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
182
-
183
- include_once CARTFLOWS_DIR . 'includes/admin/cartflows-admin.php';
184
- }
185
-
186
- /**
187
- * Renders the admin settings content.
188
- *
189
- * @since 1.0.0
190
- * @return void
191
- */
192
- public static function render_content() {
193
-
194
- $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : '';
195
- $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
196
- $action = str_replace( '_', '-', $action );
197
- $action = 'general';
198
-
199
- $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
200
-
201
- include_once CARTFLOWS_DIR . 'includes/admin/cartflows-general.php';
202
- }
203
-
204
- /**
205
- * Save Global Setting options.
206
- *
207
- * @since 1.0.0
208
- */
209
- public static function save_common_settings() {
210
-
211
- if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-common-settings-nonce'] ) ), 'cartflows-common-settings' ) ) {
212
-
213
- $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
214
- $new_settings = array();
215
-
216
- if ( isset( $_POST['_cartflows_common'] ) ) {
217
- // Loop through the input and sanitize each of the values.
218
- $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_common'] ) ); //phpcs:ignore
219
- }
220
-
221
- Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, false );
222
-
223
- $query = array(
224
- 'message' => 'saved',
225
- );
226
-
227
- $redirect_to = add_query_arg( $query, $url );
228
-
229
- wp_safe_redirect( $redirect_to );
230
- exit;
231
- } // End if statement.
232
- }
233
-
234
- /**
235
- * Save Debug Setting options.
236
- *
237
- * @since 1.1.14
238
- */
239
- public static function save_debug_settings() {
240
-
241
- if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-debug-settings-nonce'] ) ), 'cartflows-debug-settings' ) ) {
242
-
243
- $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
244
- $new_settings = array();
245
-
246
- if ( isset( $_POST['_cartflows_debug_data'] ) ) {
247
- $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_debug_data'] ) ); //phpcs:ignore
248
- }
249
-
250
- Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, false );
251
-
252
- $query = array(
253
- 'message' => 'saved',
254
- );
255
-
256
- $redirect_to = add_query_arg( $query, $url );
257
-
258
- wp_safe_redirect( $redirect_to );
259
- exit;
260
-
261
- }
262
- }
263
-
264
-
265
- /**
266
- * Save permalink Setting options.
267
- *
268
- * @since 1.1.14
269
- */
270
- public static function save_permalink_settings() {
271
-
272
- if ( isset( $_POST['cartflows-permalink-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-permalink-settings-nonce'] ) ), 'cartflows-permalink-settings' ) ) {
273
-
274
- $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
275
- $new_settings = array();
276
-
277
- if ( isset( $_POST['reset'] ) ) {
278
- $_POST['_cartflows_permalink'] = array(
279
- 'permalink' => CARTFLOWS_STEP_POST_TYPE,
280
- 'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
281
- 'permalink_structure' => '',
282
- );
283
-
284
- }
285
-
286
- if ( isset( $_POST['_cartflows_permalink'] ) ) {
287
- $cartflows_permalink_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_permalink'] ) ); //phpcs:ignore
288
-
289
- if ( empty( $cartflows_permalink_settings['permalink'] ) ) {
290
- $new_settings['permalink'] = CARTFLOWS_STEP_POST_TYPE;
291
- } else {
292
- $new_settings['permalink'] = $cartflows_permalink_settings['permalink'];
293
- }
294
-
295
- if ( empty( $cartflows_permalink_settings['permalink_flow_base'] ) ) {
296
- $new_settings['permalink_flow_base'] = CARTFLOWS_FLOW_POST_TYPE;
297
- } else {
298
- $new_settings['permalink_flow_base'] = $cartflows_permalink_settings['permalink_flow_base'];
299
- }
300
-
301
- $new_settings['permalink_structure'] = $cartflows_permalink_settings['permalink_structure'];
302
-
303
- }
304
-
305
- Cartflows_Helper::update_admin_settings_option( '_cartflows_permalink', $new_settings, false );
306
-
307
- $query = array(
308
- 'message' => 'saved',
309
- );
310
-
311
- $redirect_to = add_query_arg( $query, $url );
312
-
313
- update_option( 'cartflows_permalink_saved', true );
314
-
315
- wp_safe_redirect( $redirect_to );
316
- exit;
317
-
318
- }
319
- }
320
-
321
- /**
322
- * Loop through the input and sanitize each of the values.
323
- *
324
- * @param array $input_settings input settings.
325
- * @return array
326
- */
327
- public static function sanitize_form_inputs( $input_settings = array() ) {
328
- $new_settings = array();
329
- foreach ( $input_settings as $key => $val ) {
330
-
331
- if ( is_array( $val ) ) {
332
- foreach ( $val as $k => $v ) {
333
- $new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
334
- }
335
- } else {
336
- $new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
337
- }
338
- }
339
- return $new_settings;
340
- }
341
-
342
- /**
343
- * Check is cartflows admin.
344
- *
345
- * @since 1.0.0
346
- * @return boolean
347
- */
348
- public static function is_global_admin() {
349
-
350
- $current_screen = get_current_screen();
351
-
352
- if (
353
- is_object( $current_screen ) &&
354
- isset( $current_screen->post_type ) &&
355
- ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ||
356
- CARTFLOWS_STEP_POST_TYPE === $current_screen->post_type
357
- )
358
- ) {
359
- return true;
360
- }
361
- return false;
362
- }
363
-
364
- /**
365
- * Check is flow admin.
366
- *
367
- * @since 1.0.0
368
- * @return boolean
369
- */
370
- public static function is_flow_edit_admin() {
371
-
372
- $current_screen = get_current_screen();
373
-
374
- if (
375
- is_object( $current_screen ) &&
376
- isset( $current_screen->post_type ) &&
377
- ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ) &&
378
- isset( $current_screen->base ) &&
379
- ( 'post' === $current_screen->base )
380
- ) {
381
- return true;
382
- }
383
- return false;
384
- }
385
-
386
- /**
387
- * Global Admin Scripts.
388
- *
389
- * @since 1.0.0
390
- */
391
- public static function global_admin_scripts() {
392
-
393
- $installed_plugins = get_plugins();
394
- $is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? true : false;
395
- $edit_test_mode = filter_input( INPUT_GET, 'edit_test_mode', FILTER_SANITIZE_STRING );
396
- $edit_test_mode = 'yes' === $edit_test_mode ? true : false;
397
-
398
- $localize = array(
399
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
400
- 'ajax_nonce' => wp_create_nonce( 'cartflows-nonce' ),
401
- 'wc_status' => array(
402
- 'installed' => $is_wc_installed,
403
- 'active' => wcf()->is_woo_active,
404
- ),
405
- 'wc_activating_message' => __( 'Installing and activating..', 'cartflows' ),
406
- 'wc_install_error' => __( 'There was an error with the installation of plugin.', 'cartflows' ),
407
- 'wcf_edit_test_mode' => $edit_test_mode,
408
- );
409
-
410
- wp_localize_script( 'jquery', 'cartflows_admin', apply_filters( 'cartflows_admin_js_localize', $localize ) );
411
-
412
- if ( self::is_global_admin() ) {
413
-
414
- // Styles.
415
- wp_enqueue_style( 'cartflows-global-admin', CARTFLOWS_URL . 'admin/assets/css/global-admin.css', array(), CARTFLOWS_VER );
416
- wp_style_add_data( 'cartflows-global-admin', 'rtl', 'replace' );
417
-
418
- wp_enqueue_script(
419
- 'wcf-global-admin',
420
- CARTFLOWS_URL . 'admin/assets/js/global-admin.js',
421
- array( 'jquery' ),
422
- CARTFLOWS_VER,
423
- true
424
- );
425
-
426
- do_action( 'cartflows_global_admin_scripts' );
427
- }
428
- }
429
-
430
- /**
431
- * Global Admin Data.
432
- *
433
- * @since 1.0.0
434
- */
435
- public static function global_admin_data() {
436
-
437
- $current_screen = get_current_screen();
438
-
439
- if ( ! $current_screen ) {
440
- return;
441
- }
442
-
443
- if ( 'edit-' . CARTFLOWS_FLOW_POST_TYPE != $current_screen->id ) {
444
- return;
445
- }
446
-
447
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
448
- ?>
449
-
450
- <div id="wcf-remote-flow-importer" class="wcf-templates-popup-overlay">
451
- <div class="wcf-templates-popup-content">
452
- <div class="spinner"></div>
453
- <div class="wcf-templates-wrap wcf-templates-wrap-flows">
454
-
455
- <div id="wcf-remote-flow-actions" class="wcf-template-header">
456
- <div class="wcf-template-logo-wrap">
457
- <span class="wcf-cartflows-logo-img">
458
- <span class="cartflows-logo-icon"></span>
459
- </span>
460
- <span class="wcf-cartflows-title"><?php esc_html_e( 'Flows Library', 'cartflows' ); ?></span>
461
- </div>
462
- <div class="wcf-tab-wrapper">
463
- <?php if ( 'other' !== $default_page_builder ) { ?>
464
- <div id="wcf-get-started-steps">
465
- <ul class="filter-links ">
466
- <li>
467
- <a href="#" class="current" data-slug="ready-templates" data-title="<?php esc_html_e( 'Ready Templates', 'cartflows' ); ?>"><?php esc_html_e( 'Ready Templates', 'cartflows' ); ?></a>
468
- </li>
469
- <li>
470
- <a href="#" data-slug="canvas" data-title="<?php esc_html_e( 'Create Your Own', 'cartflows' ); ?>"><?php esc_html_e( 'Create Your Own', 'cartflows' ); ?></a>
471
- </li>
472
- </ul>
473
- </div>
474
- <?php } ?>
475
- </div>
476
- <div class="wcf-popup-close-wrap">
477
- <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
478
- </div>
479
- </div>
480
- <!-- <div class="wcf-search-form">
481
- <label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'cartflows' ); ?> </label>
482
- <input placeholder="<?php esc_html_e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
483
- </div> -->
484
-
485
- <div id="wcf-remote-content">
486
- <?php if ( 'other' !== $default_page_builder ) { ?>
487
- <div id="wcf-ready-templates">
488
- <div id="wcf-remote-filters">
489
- <div id="wcf-page-builders"></div>
490
- <div id="wcf-categories"></div>
491
- </div>
492
- <div class="wcf-page-builder-notice"></div>
493
- <div id="wcf-remote-flow-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
494
- <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
495
- </div>
496
- <?php } ?>
497
- <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
498
- <div class="inner">
499
- <a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php esc_html_e( 'Design Your Flow', 'cartflows' ); ?></a>
500
- <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php esc_html_e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
501
- </div>
502
- </div>
503
- </div>
504
- </div>
505
- </div>
506
- </div>
507
-
508
- <?php
509
- }
510
-
511
- /**
512
- * Enqueues the needed CSS/JS for the builder's admin settings page.
513
- *
514
- * @since 1.0.0
515
- */
516
- public static function styles_scripts() {
517
-
518
- // Styles.
519
- wp_enqueue_style( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/css/admin-menu-settings.css', array(), CARTFLOWS_VER );
520
- wp_style_add_data( 'cartflows-admin-settings', 'rtl', 'replace' );
521
-
522
- // Script.
523
- wp_enqueue_script( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/js/admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
524
-
525
- $localize = array(
526
- 'ajax_nonce' => wp_create_nonce( 'cartflows-widget-nonce' ),
527
- );
528
-
529
- wp_localize_script( 'cartflows-admin-settings', 'cartflows', apply_filters( 'cartflows_js_localize', $localize ) );
530
-
531
- do_action( 'cartflows_admin_settings_after_enqueue_scripts' );
532
- }
533
-
534
- /**
535
- * Save All admin settings here
536
- */
537
- public static function save_settings() {
538
-
539
- // Only admins can save settings.
540
- if ( ! current_user_can( 'manage_options' ) ) {
541
- return;
542
- }
543
-
544
- self::save_common_settings();
545
- self::save_debug_settings();
546
- self::save_permalink_settings();
547
- self::save_facebook_settings();
548
-
549
- // Let extensions hook into saving.
550
- do_action( 'cartflows_admin_settings_save' );
551
- }
552
-
553
- /**
554
- * Get and return page URL
555
- *
556
- * @param string $menu_slug Menu name.
557
- * @since 1.0.0
558
- * @return string page url
559
- */
560
- public static function get_page_url( $menu_slug ) {
561
-
562
- $parent_page = self::$default_menu_position;
563
-
564
- if ( strpos( $parent_page, '?' ) !== false ) {
565
- $query_var = '&page=' . self::$plugin_slug;
566
- } else {
567
- $query_var = '?page=' . self::$plugin_slug;
568
- }
569
-
570
- $parent_page_url = admin_url( $parent_page . $query_var );
571
-
572
- $url = $parent_page_url . '&action=' . $menu_slug;
573
-
574
- return esc_url( $url );
575
- }
576
-
577
- /**
578
- * Admin body classes.
579
- *
580
- * Body classes to be added to <body> tag in admin page
581
- *
582
- * @param String $classes body classes returned from the filter.
583
- * @return String body classes to be added to <body> tag in admin page
584
- */
585
- public static function add_admin_body_class( $classes ) {
586
-
587
- $classes .= ' cartflows-' . CARTFLOWS_VER;
588
-
589
- return $classes;
590
- }
591
-
592
- /**
593
- * Save Global Setting options.
594
- *
595
- * @since 1.0.0
596
- */
597
- public static function save_facebook_settings() {
598
-
599
- if ( isset( $_POST['cartflows-facebook-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-facebook-settings-nonce'] ) ), 'cartflows-facebook-settings' ) ) {
600
-
601
- $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
602
- $new_settings = array();
603
-
604
- if ( isset( $_POST['_cartflows_facebook'] ) ) {
605
- $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_facebook'] ) ); //phpcs:ignore
606
- }
607
-
608
- Cartflows_Helper::update_admin_settings_option( '_cartflows_facebook', $new_settings, false );
609
- $query = array(
610
- 'message' => 'saved',
611
- );
612
- $redirect_to = add_query_arg( $query, $url );
613
- wp_safe_redirect( $redirect_to );
614
- exit;
615
- }
616
- }
617
-
618
- }
619
-
620
- Cartflows_Admin::init();
1
+ <?php
2
+ /**
3
+ * CartFlows Admin.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class Cartflows_Admin.
10
+ */
11
+ class Cartflows_Admin {
12
+
13
+ /**
14
+ * Calls on initialization
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ public static function init() {
19
+
20
+ self::initialise_plugin();
21
+ self::init_hooks();
22
+ }
23
+
24
+ /**
25
+ * Init Hooks.
26
+ *
27
+ * @since 1.0.0
28
+ * @return void
29
+ */
30
+ public static function init_hooks() {
31
+
32
+ if ( ! is_admin() ) {
33
+ return;
34
+ }
35
+
36
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin-fields.php';
37
+
38
+ /*
39
+ Add CARTFLOWS menu option to admin.
40
+ add_action( 'network_admin_menu', __CLASS__ . '::menu' );
41
+ */
42
+ add_action( 'admin_menu', __CLASS__ . '::menu' );
43
+ add_action( 'admin_menu', __CLASS__ . '::submenu', 999 );
44
+
45
+ add_action( 'cartflows_render_admin_content', __CLASS__ . '::render_content' );
46
+
47
+ add_action( 'admin_init', __CLASS__ . '::settings_admin_scripts' );
48
+
49
+ /* Global Addmin Script */
50
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::global_admin_scripts', 20 );
51
+
52
+ add_action( 'admin_footer', __CLASS__ . '::global_admin_data', 9555 );
53
+
54
+ /* Add lite version class to body */
55
+ add_action( 'admin_body_class', __CLASS__ . '::add_admin_body_class' );
56
+
57
+ add_filter( 'plugin_action_links_' . CARTFLOWS_BASE, __CLASS__ . '::add_action_links' );
58
+
59
+ add_action( 'admin_init', __CLASS__ . '::cartflows_after_save_permalinks' );
60
+
61
+ }
62
+
63
+ /**
64
+ * After save of permalinks.
65
+ */
66
+ public static function cartflows_after_save_permalinks() {
67
+
68
+ $has_saved_permalinks = get_option( 'cartflows_permalink_saved' );
69
+ if ( $has_saved_permalinks ) {
70
+ flush_rewrite_rules();
71
+ delete_option( 'cartflows_permalink_saved' );
72
+ }
73
+ }
74
+
75
+
76
+ /**
77
+ * Initialize after Cartflows pro get loaded.
78
+ */
79
+ public static function settings_admin_scripts() {
80
+ // Enqueue admin scripts.
81
+ if ( isset( $_REQUEST['page'] ) && CARTFLOWS_SETTINGS === $_REQUEST['page'] ) { //phpcs:ignore
82
+ add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
83
+
84
+ self::save_settings();
85
+ }
86
+ }
87
+ /**
88
+ * Show action on plugin page.
89
+ *
90
+ * @param array $links links.
91
+ * @return array
92
+ */
93
+ public static function add_action_links( $links ) {
94
+ $mylinks = array(
95
+ '<a href="' . admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS ) . '">Settings</a>',
96
+ '<a target="_blank" href="' . esc_url( 'https://cartflows.com/docs' ) . '">Docs</a>',
97
+ );
98
+
99
+ if ( ! _is_cartflows_pro() ) {
100
+ array_push( $mylinks, '<a style="color: #39b54a; font-weight: bold;" target="_blank" href="' . esc_url( 'https://cartflows.com/pricing/' ) . '"> Go Pro </a>' );
101
+ }
102
+
103
+ return array_merge( $links, $mylinks );
104
+ }
105
+
106
+ /**
107
+ * Initialises the Plugin Name.
108
+ *
109
+ * @since 1.0.0
110
+ * @return void
111
+ */
112
+ public static function initialise_plugin() {
113
+
114
+ $name = 'Cartflows';
115
+ $short_name = 'Cflows';
116
+
117
+ define( 'CARTFLOWS_PLUGIN_NAME', $name );
118
+ define( 'CARTFLOWS_PLUGIN_SHORT_NAME', $short_name );
119
+ }
120
+
121
+ /**
122
+ * Renders the admin settings menu.
123
+ *
124
+ * @since 1.0.0
125
+ * @return void
126
+ */
127
+ public static function menu() {
128
+
129
+ if ( ! current_user_can( 'manage_options' ) ) {
130
+ return;
131
+ }
132
+
133
+ add_menu_page(
134
+ 'CartFlows',
135
+ 'CartFlows',
136
+ 'manage_options',
137
+ CARTFLOWS_SLUG,
138
+ __CLASS__ . '::render',
139
+ 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( CARTFLOWS_DIR . 'assets/images/cartflows-icon.svg' ) ),//phpcs:ignore
140
+ 39.7
141
+ );
142
+
143
+ }
144
+
145
+ /**
146
+ * Add submenu to admin menu.
147
+ *
148
+ * @since 1.0.0
149
+ */
150
+ public static function submenu() {
151
+
152
+ $parent_slug = CARTFLOWS_SLUG;
153
+ $page_title = __( 'Settings', 'cartflows' );
154
+ $menu_title = __( 'Settings', 'cartflows' );
155
+ $capability = 'manage_options';
156
+ $menu_slug = 'cartflows_settings';
157
+ $callback = __CLASS__ . '::render';
158
+
159
+ add_submenu_page(
160
+ $parent_slug,
161
+ $page_title,
162
+ $menu_title,
163
+ $capability,
164
+ $menu_slug,
165
+ $callback
166
+ );
167
+ }
168
+
169
+ /**
170
+ * Renders the admin settings.
171
+ *
172
+ * @since 1.0.0
173
+ * @return void
174
+ */
175
+ public static function render() {
176
+ $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; //phpcs:ignore
177
+ $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
178
+ $action = str_replace( '_', '-', $action );
179
+
180
+ // Enable header icon filter below.
181
+ $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
182
+
183
+ include_once CARTFLOWS_DIR . 'includes/admin/cartflows-admin.php';
184
+ }
185
+
186
+ /**
187
+ * Renders the admin settings content.
188
+ *
189
+ * @since 1.0.0
190
+ * @return void
191
+ */
192
+ public static function render_content() {
193
+
194
+ $action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; //phpcs:ignore
195
+ $action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
196
+ $action = str_replace( '_', '-', $action );
197
+ $action = 'general';
198
+
199
+ $header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
200
+
201
+ include_once CARTFLOWS_DIR . 'includes/admin/cartflows-general.php';
202
+ }
203
+
204
+ /**
205
+ * Save Global Setting options.
206
+ *
207
+ * @since 1.0.0
208
+ */
209
+ public static function save_common_settings() {
210
+
211
+ if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-common-settings-nonce'] ) ), 'cartflows-common-settings' ) ) {
212
+
213
+ $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
214
+ $new_settings = array();
215
+
216
+ if ( isset( $_POST['_cartflows_common'] ) ) {
217
+ // Loop through the input and sanitize each of the values.
218
+ $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_common'] ) ); //phpcs:ignore
219
+ }
220
+
221
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, false );
222
+
223
+ $query = array(
224
+ 'message' => 'saved',
225
+ );
226
+
227
+ $redirect_to = add_query_arg( $query, $url );
228
+
229
+ wp_safe_redirect( $redirect_to );
230
+ exit;
231
+ } // End if statement.
232
+ }
233
+
234
+ /**
235
+ * Save Debug Setting options.
236
+ *
237
+ * @since 1.1.14
238
+ */
239
+ public static function save_debug_settings() {
240
+
241
+ if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-debug-settings-nonce'] ) ), 'cartflows-debug-settings' ) ) {
242
+
243
+ $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
244
+ $new_settings = array();
245
+
246
+ if ( isset( $_POST['_cartflows_debug_data'] ) ) {
247
+ $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_debug_data'] ) ); //phpcs:ignore
248
+ }
249
+
250
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, false );
251
+
252
+ $query = array(
253
+ 'message' => 'saved',
254
+ );
255
+
256
+ $redirect_to = add_query_arg( $query, $url );
257
+
258
+ wp_safe_redirect( $redirect_to );
259
+ exit;
260
+
261
+ }
262
+ }
263
+
264
+
265
+ /**
266
+ * Save permalink Setting options.
267
+ *
268
+ * @since 1.1.14
269
+ */
270
+ public static function save_permalink_settings() {
271
+
272
+ if ( isset( $_POST['cartflows-permalink-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-permalink-settings-nonce'] ) ), 'cartflows-permalink-settings' ) ) {
273
+
274
+ $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
275
+ $new_settings = array();
276
+
277
+ if ( isset( $_POST['reset'] ) ) {
278
+ $_POST['_cartflows_permalink'] = array(
279
+ 'permalink' => CARTFLOWS_STEP_POST_TYPE,
280
+ 'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
281
+ 'permalink_structure' => '',
282
+ );
283
+
284
+ }
285
+
286
+ if ( isset( $_POST['_cartflows_permalink'] ) ) {
287
+ $cartflows_permalink_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_permalink'] ) ); //phpcs:ignore
288
+
289
+ if ( empty( $cartflows_permalink_settings['permalink'] ) ) {
290
+ $new_settings['permalink'] = CARTFLOWS_STEP_POST_TYPE;
291
+ } else {
292
+ $new_settings['permalink'] = $cartflows_permalink_settings['permalink'];
293
+ }
294
+
295
+ if ( empty( $cartflows_permalink_settings['permalink_flow_base'] ) ) {
296
+ $new_settings['permalink_flow_base'] = CARTFLOWS_FLOW_POST_TYPE;
297
+ } else {
298
+ $new_settings['permalink_flow_base'] = $cartflows_permalink_settings['permalink_flow_base'];
299
+ }
300
+
301
+ $new_settings['permalink_structure'] = $cartflows_permalink_settings['permalink_structure'];
302
+
303
+ }
304
+
305
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_permalink', $new_settings, false );
306
+
307
+ $query = array(
308
+ 'message' => 'saved',
309
+ );
310
+
311
+ $redirect_to = add_query_arg( $query, $url );
312
+
313
+ update_option( 'cartflows_permalink_saved', true );
314
+
315
+ wp_safe_redirect( $redirect_to );
316
+ exit;
317
+
318
+ }
319
+ }
320
+
321
+ /**
322
+ * Loop through the input and sanitize each of the values.
323
+ *
324
+ * @param array $input_settings input settings.
325
+ * @return array
326
+ */
327
+ public static function sanitize_form_inputs( $input_settings = array() ) {
328
+ $new_settings = array();
329
+ foreach ( $input_settings as $key => $val ) {
330
+
331
+ if ( is_array( $val ) ) {
332
+ foreach ( $val as $k => $v ) {
333
+ $new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
334
+ }
335
+ } else {
336
+ $new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
337
+ }
338
+ }
339
+ return $new_settings;
340
+ }
341
+
342
+ /**
343
+ * Check is cartflows admin.
344
+ *
345
+ * @since 1.0.0
346
+ * @return boolean
347
+ */
348
+ public static function is_global_admin() {
349
+
350
+ $current_screen = get_current_screen();
351
+
352
+ if (
353
+ is_object( $current_screen ) &&
354
+ isset( $current_screen->post_type ) &&
355
+ ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ||
356
+ CARTFLOWS_STEP_POST_TYPE === $current_screen->post_type
357
+ )
358
+ ) {
359
+ return true;
360
+ }
361
+ return false;
362
+ }
363
+
364
+ /**
365
+ * Check is flow admin.
366
+ *
367
+ * @since 1.0.0
368
+ * @return boolean
369
+ */
370
+ public static function is_flow_edit_admin() {
371
+
372
+ $current_screen = get_current_screen();
373
+
374
+ if (
375
+ is_object( $current_screen ) &&
376
+ isset( $current_screen->post_type ) &&
377
+ ( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ) &&
378
+ isset( $current_screen->base ) &&
379
+ ( 'post' === $current_screen->base )
380
+ ) {
381
+ return true;
382
+ }
383
+ return false;
384
+ }
385
+
386
+ /**
387
+ * Global Admin Scripts.
388
+ *
389
+ * @since 1.0.0
390
+ */
391
+ public static function global_admin_scripts() {
392
+
393
+ $installed_plugins = get_plugins();
394
+ $is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? true : false;
395
+ $edit_test_mode = filter_input( INPUT_GET, 'edit_test_mode', FILTER_SANITIZE_STRING );
396
+ $edit_test_mode = 'yes' === $edit_test_mode ? true : false;
397
+
398
+ $localize = array(
399
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
400
+ 'ajax_nonce' => wp_create_nonce( 'cartflows-nonce' ),
401
+ 'wc_status' => array(
402
+ 'installed' => $is_wc_installed,
403
+ 'active' => wcf()->is_woo_active,
404
+ ),
405
+ 'wc_activating_message' => __( 'Installing and activating..', 'cartflows' ),
406
+ 'wc_install_error' => __( 'There was an error with the installation of plugin.', 'cartflows' ),
407
+ 'wcf_edit_test_mode' => $edit_test_mode,
408
+ );
409
+
410
+ wp_localize_script( 'jquery', 'cartflows_admin', apply_filters( 'cartflows_admin_js_localize', $localize ) );
411
+
412
+ if ( self::is_global_admin() ) {
413
+
414
+ // Styles.
415
+ wp_enqueue_style( 'cartflows-global-admin', CARTFLOWS_URL . 'admin/assets/css/global-admin.css', array(), CARTFLOWS_VER );
416
+ wp_style_add_data( 'cartflows-global-admin', 'rtl', 'replace' );
417
+
418
+ wp_enqueue_script(
419
+ 'wcf-global-admin',
420
+ CARTFLOWS_URL . 'admin/assets/js/global-admin.js',
421
+ array( 'jquery' ),
422
+ CARTFLOWS_VER,
423
+ true
424
+ );
425
+
426
+ do_action( 'cartflows_global_admin_scripts' );
427
+ }
428
+ }
429
+
430
+ /**
431
+ * Global Admin Data.
432
+ *
433
+ * @since 1.0.0
434
+ */
435
+ public static function global_admin_data() {
436
+
437
+ $current_screen = get_current_screen();
438
+
439
+ if ( ! $current_screen ) {
440
+ return;
441
+ }
442
+
443
+ if ( 'edit-' . CARTFLOWS_FLOW_POST_TYPE != $current_screen->id ) {
444
+ return;
445
+ }
446
+
447
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
448
+ ?>
449
+
450
+ <div id="wcf-remote-flow-importer" class="wcf-templates-popup-overlay">
451
+ <div class="wcf-templates-popup-content">
452
+ <div class="spinner"></div>
453
+ <div class="wcf-templates-wrap wcf-templates-wrap-flows">
454
+
455
+ <div id="wcf-remote-flow-actions" class="wcf-template-header">
456
+ <div class="wcf-template-logo-wrap">
457
+ <span class="wcf-cartflows-logo-img">
458
+ <span class="cartflows-logo-icon"></span>
459
+ </span>
460
+ <span class="wcf-cartflows-title"><?php esc_html_e( 'Flows Library', 'cartflows' ); ?></span>
461
+ </div>
462
+ <div class="wcf-tab-wrapper">
463
+ <?php if ( 'other' !== $default_page_builder ) { ?>
464
+ <div id="wcf-get-started-steps">
465
+ <ul class="filter-links ">
466
+ <li>
467
+ <a href="#" class="current" data-slug="ready-templates" data-title="<?php esc_html_e( 'Ready Templates', 'cartflows' ); ?>"><?php esc_html_e( 'Ready Templates', 'cartflows' ); ?></a>
468
+ </li>
469
+ <li>
470
+ <a href="#" data-slug="canvas" data-title="<?php esc_html_e( 'Create Your Own', 'cartflows' ); ?>"><?php esc_html_e( 'Create Your Own', 'cartflows' ); ?></a>
471
+ </li>
472
+ </ul>
473
+ </div>
474
+ <?php } ?>
475
+ </div>
476
+ <div class="wcf-popup-close-wrap">
477
+ <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
478
+ </div>
479
+ </div>
480
+ <!-- <div class="wcf-search-form">
481
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'cartflows' ); ?> </label>
482
+ <input placeholder="<?php esc_html_e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
483
+ </div> -->
484
+
485
+ <div id="wcf-remote-content">
486
+ <?php if ( 'other' !== $default_page_builder ) { ?>
487
+ <div id="wcf-ready-templates">
488
+ <div id="wcf-remote-filters">
489
+ <div id="wcf-page-builders"></div>
490
+ <div id="wcf-categories"></div>
491
+ </div>
492
+ <div class="wcf-page-builder-notice"></div>
493
+ <div id="wcf-remote-flow-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
494
+ <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
495
+ </div>
496
+ <?php } ?>
497
+ <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
498
+ <div class="inner">
499
+ <a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php esc_html_e( 'Design Your Flow', 'cartflows' ); ?></a>
500
+ <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php esc_html_e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
501
+ </div>
502
+ </div>
503
+ </div>
504
+ </div>
505
+ </div>
506
+ </div>
507
+
508
+ <?php
509
+ }
510
+
511
+ /**
512
+ * Enqueues the needed CSS/JS for the builder's admin settings page.
513
+ *
514
+ * @since 1.0.0
515
+ */
516
+ public static function styles_scripts() {
517
+
518
+ // Styles.
519
+ wp_enqueue_style( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/css/admin-menu-settings.css', array(), CARTFLOWS_VER );
520
+ wp_style_add_data( 'cartflows-admin-settings', 'rtl', 'replace' );
521
+
522
+ // Script.
523
+ wp_enqueue_script( 'cartflows-admin-settings', CARTFLOWS_URL . 'admin/assets/js/admin-menu-settings.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
524
+
525
+ $localize = array(
526
+ 'ajax_nonce' => wp_create_nonce( 'cartflows-widget-nonce' ),
527
+ );
528
+
529
+ wp_localize_script( 'cartflows-admin-settings', 'cartflows', apply_filters( 'cartflows_js_localize', $localize ) );
530
+
531
+ do_action( 'cartflows_admin_settings_after_enqueue_scripts' );
532
+ }
533
+
534
+ /**
535
+ * Save All admin settings here
536
+ */
537
+ public static function save_settings() {
538
+
539
+ // Only admins can save settings.
540
+ if ( ! current_user_can( 'manage_options' ) ) {
541
+ return;
542
+ }
543
+
544
+ self::save_common_settings();
545
+ self::save_debug_settings();
546
+ self::save_permalink_settings();
547
+ self::save_facebook_settings();
548
+
549
+ // Let extensions hook into saving.
550
+ do_action( 'cartflows_admin_settings_save' );
551
+ }
552
+
553
+ /**
554
+ * Get and return page URL
555
+ *
556
+ * @param string $menu_slug Menu name.
557
+ * @since 1.0.0
558
+ * @return string page url
559
+ */
560
+ public static function get_page_url( $menu_slug ) {
561
+
562
+ $parent_page = self::$default_menu_position;
563
+
564
+ if ( strpos( $parent_page, '?' ) !== false ) {
565
+ $query_var = '&page=' . self::$plugin_slug;
566
+ } else {
567
+ $query_var = '?page=' . self::$plugin_slug;
568
+ }
569
+
570
+ $parent_page_url = admin_url( $parent_page . $query_var );
571
+
572
+ $url = $parent_page_url . '&action=' . $menu_slug;
573
+
574
+ return esc_url( $url );
575
+ }
576
+
577
+ /**
578
+ * Admin body classes.
579
+ *
580
+ * Body classes to be added to <body> tag in admin page
581
+ *
582
+ * @param String $classes body classes returned from the filter.
583
+ * @return String body classes to be added to <body> tag in admin page
584
+ */
585
+ public static function add_admin_body_class( $classes ) {
586
+
587
+ $classes .= ' cartflows-' . CARTFLOWS_VER;
588
+
589
+ return $classes;
590
+ }
591
+
592
+ /**
593
+ * Save Global Setting options.
594
+ *
595
+ * @since 1.0.0
596
+ */
597
+ public static function save_facebook_settings() {
598
+
599
+ if ( isset( $_POST['cartflows-facebook-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-facebook-settings-nonce'] ) ), 'cartflows-facebook-settings' ) ) {
600
+
601
+ $url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
602
+ $new_settings = array();
603
+
604
+ if ( isset( $_POST['_cartflows_facebook'] ) ) {
605
+ $new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_facebook'] ) ); //phpcs:ignore
606
+ }
607
+
608
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_facebook', $new_settings, false );
609
+ $query = array(
610
+ 'message' => 'saved',
611
+ );
612
+ $redirect_to = add_query_arg( $query, $url );
613
+ wp_safe_redirect( $redirect_to );
614
+ exit;
615
+ }
616
+ }
617
+
618
+ }
619
+
620
+ Cartflows_Admin::init();
classes/class-cartflows-cloning.php CHANGED
@@ -1,465 +1,465 @@
1
- <?php
2
- /**
3
- * Cloning.
4
- *
5
- * @package cartflows-pro
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Cloning {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Initiator
25
- */
26
- public static function get_instance() {
27
- if ( ! isset( self::$instance ) ) {
28
- self::$instance = new self();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- /**
34
- * Constructor
35
- */
36
- public function __construct() {
37
-
38
- add_filter( 'post_row_actions', array( $this, 'clone_link' ), 99, 2 );
39
- add_action( 'admin_action_cartflows_clone_flow', array( $this, 'clone_flow' ) );
40
- add_action( 'admin_action_cartflows_clone_step', array( $this, 'clone_step' ) );
41
- }
42
-
43
- /**
44
- * Clone flow with steps and its meta.
45
- */
46
- public function clone_flow() {
47
-
48
- global $wpdb;
49
-
50
- if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_flow' === $_REQUEST['action'] ) ) ) {
51
- wp_die( 'No post to duplicate has been supplied!' );
52
- }
53
-
54
- /*
55
- * Nonce verification
56
- */
57
- if ( ! isset( $_GET['flow_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['flow_clone_nonce'] ) ), basename( __FILE__ ) ) ) {
58
- return;
59
- }
60
-
61
- /**
62
- * Get the original post id
63
- */
64
- $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
65
-
66
- /**
67
- * And all the original post data then
68
- */
69
- $post = get_post( $post_id );
70
-
71
- /**
72
- * Assign current user to be the new post author
73
- */
74
- $current_user = wp_get_current_user();
75
- $new_post_author = $current_user->ID;
76
-
77
- /**
78
- * If post data exists, create the post duplicate
79
- */
80
- if ( isset( $post ) && null !== $post ) {
81
-
82
- /**
83
- * New post data array
84
- */
85
-
86
- $args = array(
87
- 'comment_status' => $post->comment_status,
88
- 'ping_status' => $post->ping_status,
89
- 'post_author' => $new_post_author,
90
- 'post_content' => $post->post_content,
91
- 'post_excerpt' => $post->post_excerpt,
92
- 'post_name' => $post->post_name,
93
- 'post_parent' => $post->post_parent,
94
- 'post_password' => $post->post_password,
95
- 'post_status' => $post->post_status,
96
- 'post_title' => $post->post_title . ' Clone',
97
- 'post_type' => $post->post_type,
98
- 'to_ping' => $post->to_ping,
99
- 'menu_order' => $post->menu_order,
100
- );
101
-
102
- /**
103
- * Insert the post
104
- */
105
- $new_flow_id = wp_insert_post( $args );
106
-
107
- /**
108
- * Get all current post terms ad set them to the new post
109
- */
110
- // returns array of taxonomy names for post type, ex array("category", "post_tag");.
111
- $taxonomies = get_object_taxonomies( $post->post_type );
112
-
113
- foreach ( $taxonomies as $taxonomy ) {
114
-
115
- $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
116
-
117
- wp_set_object_terms( $new_flow_id, $post_terms, $taxonomy, false );
118
- }
119
-
120
- /**
121
- * Duplicate all post meta just in two SQL queries
122
- */
123
- // @codingStandardsIgnoreStart
124
- $post_meta_infos = $wpdb->get_results(
125
- "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
126
- );
127
- // @codingStandardsIgnoreEnd
128
-
129
- if ( ! empty( $post_meta_infos ) ) {
130
-
131
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
132
-
133
- $sql_query_sel = array();
134
-
135
- foreach ( $post_meta_infos as $meta_info ) {
136
-
137
- $meta_key = $meta_info->meta_key;
138
-
139
- if ( '_wp_old_slug' === $meta_key ) {
140
- continue;
141
- }
142
-
143
- $meta_value = addslashes( $meta_info->meta_value );
144
-
145
- $sql_query_sel[] = "($new_flow_id, '$meta_key', '$meta_value')";
146
- }
147
-
148
- $sql_query .= implode( ',', $sql_query_sel );
149
-
150
- // @codingStandardsIgnoreStart
151
- $wpdb->query( $sql_query );
152
- // @codingStandardsIgnoreEnd
153
- }
154
-
155
- /* Steps Cloning */
156
- $flow_steps = get_post_meta( $post_id, 'wcf-steps', true );
157
- $new_flow_steps = array();
158
-
159
- /* Set Steps Empty */
160
- update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
161
-
162
- if ( is_array( $flow_steps ) && ! empty( $flow_steps ) ) {
163
-
164
- foreach ( $flow_steps as $index => $step_data ) {
165
-
166
- $step_id = $step_data['id'];
167
- $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
168
-
169
- $step_object = get_post( $step_id );
170
-
171
- /**
172
- * New step post data array
173
- */
174
- $step_args = array(
175
- 'comment_status' => $step_object->comment_status,
176
- 'ping_status' => $step_object->ping_status,
177
- 'post_author' => $new_post_author,
178
- 'post_content' => $step_object->post_content,
179
- 'post_excerpt' => $step_object->post_excerpt,
180
- 'post_name' => $step_object->post_name,
181
- 'post_parent' => $step_object->post_parent,
182
- 'post_password' => $step_object->post_password,
183
- 'post_status' => $step_object->post_status,
184
- 'post_title' => $step_object->post_title,
185
- 'post_type' => $step_object->post_type,
186
- 'to_ping' => $step_object->to_ping,
187
- 'menu_order' => $step_object->menu_order,
188
- );
189
-
190
- /**
191
- * Insert the post
192
- */
193
- $new_step_id = wp_insert_post( $step_args );
194
-
195
- /**
196
- * Duplicate all step meta
197
- */
198
- // @codingStandardsIgnoreStart
199
- $post_meta_infos = $wpdb->get_results(
200
- "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$step_id"
201
- );
202
- // @codingStandardsIgnoreEnd
203
-
204
- if ( ! empty( $post_meta_infos ) ) {
205
-
206
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
207
-
208
- $sql_query_sel = array();
209
-
210
- foreach ( $post_meta_infos as $meta_info ) {
211
-
212
- $meta_key = $meta_info->meta_key;
213
-
214
- if ( '_wp_old_slug' === $meta_key ) {
215
- continue;
216
- }
217
-
218
- $meta_value = addslashes( $meta_info->meta_value );
219
-
220
- $sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
221
- }
222
-
223
- $sql_query .= implode( ',', $sql_query_sel );
224
-
225
- // @codingStandardsIgnoreStart
226
- $wpdb->query( $sql_query );
227
- // @codingStandardsIgnoreEnd
228
- }
229
-
230
- // insert post meta.
231
- update_post_meta( $new_step_id, 'wcf-flow-id', $new_flow_id );
232
- update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
233
-
234
- wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
235
- wp_set_object_terms( $new_step_id, 'flow-' . $new_flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
236
-
237
- /* Add New Flow Steps */
238
- $new_flow_steps[] = array(
239
- 'id' => $new_step_id,
240
- 'title' => $step_object->post_title,
241
- 'type' => $step_type,
242
- );
243
- }
244
- }
245
-
246
- /* Update New Flow Step Post Meta */
247
- update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
248
-
249
- /* Clear Page Builder Cache */
250
- $this->clear_cache();
251
-
252
- /**
253
- * Redirect to the new flow edit screen
254
- */
255
- wp_safe_redirect( admin_url( 'post.php?action=edit&post=' . $new_flow_id ) );
256
- exit;
257
- } else {
258
- wp_die( 'Post creation failed, could not find original post: ' . $post_id );
259
- }
260
- }
261
-
262
- /**
263
- * Clone step with its meta.
264
- */
265
- public function clone_step() {
266
-
267
- global $wpdb;
268
-
269
- if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_step' === $_REQUEST['action'] ) ) ) {
270
- wp_die( 'No post to duplicate has been supplied!' );
271
- }
272
-
273
- /*
274
- * Nonce verification
275
- */
276
- if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['step_clone_nonce'] ) ), 'step_clone' ) ) {
277
- return;
278
- }
279
-
280
- /**
281
- * Get the original post id
282
- */
283
- $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
284
-
285
- /**
286
- * And all the original post data then
287
- */
288
- $post = get_post( $post_id );
289
-
290
- /**
291
- * Assign current user to be the new post author
292
- */
293
- $current_user = wp_get_current_user();
294
- $new_post_author = $current_user->ID;
295
-
296
- /**
297
- * If post data exists, create the post duplicate
298
- */
299
- if ( isset( $post ) && null !== $post ) {
300
-
301
- /**
302
- * New post data array
303
- */
304
- $args = array(
305
- 'comment_status' => $post->comment_status,
306
- 'ping_status' => $post->ping_status,
307
- 'post_author' => $new_post_author,
308
- 'post_content' => $post->post_content,
309
- 'post_excerpt' => $post->post_excerpt,
310
- 'post_name' => $post->post_name,
311
- 'post_parent' => $post->post_parent,
312
- 'post_password' => $post->post_password,
313
- 'post_status' => $post->post_status,
314
- 'post_title' => $post->post_title . ' Clone',
315
- 'post_type' => $post->post_type,
316
- 'to_ping' => $post->to_ping,
317
- 'menu_order' => $post->menu_order,
318
- );
319
-
320
- /**
321
- * Insert the post
322
- */
323
- $new_step_id = wp_insert_post( $args );
324
-
325
- /**
326
- * Get all current post terms ad set them to the new post
327
- */
328
- // returns array of taxonomy names for post type, ex array("category", "post_tag");.
329
- $taxonomies = get_object_taxonomies( $post->post_type );
330
-
331
- foreach ( $taxonomies as $taxonomy ) {
332
-
333
- $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
334
-
335
- wp_set_object_terms( $new_step_id, $post_terms, $taxonomy, false );
336
- }
337
-
338
- /**
339
- * Duplicate all post meta just in two SQL queries
340
- */
341
- // @codingStandardsIgnoreStart
342
- $post_meta_infos = $wpdb->get_results(
343
- "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
344
- );
345
- // @codingStandardsIgnoreEnd
346
-
347
- if ( ! empty( $post_meta_infos ) ) {
348
-
349
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
350
-
351
- $sql_query_sel = array();
352
-
353
- foreach ( $post_meta_infos as $meta_info ) {
354
-
355
- $meta_key = $meta_info->meta_key;
356
-
357
- if ( '_wp_old_slug' === $meta_key ) {
358
- continue;
359
- }
360
-
361
- $meta_value = addslashes( $meta_info->meta_value );
362
-
363
- $sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
364
- }
365
-
366
- $sql_query .= implode( ',', $sql_query_sel );
367
-
368
- // @codingStandardsIgnoreStart
369
- $wpdb->query( $sql_query );
370
- // @codingStandardsIgnoreEnd
371
- }
372
-
373
- $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
374
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
375
- $step_type = get_post_meta( $post_id, 'wcf-step-type', true );
376
-
377
- if ( ! is_array( $flow_steps ) ) {
378
- $flow_steps = array();
379
- }
380
-
381
- $flow_steps[] = array(
382
- 'id' => $new_step_id,
383
- 'title' => $post->post_title,
384
- 'type' => $step_type,
385
- );
386
-
387
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
388
-
389
- /* Clear Page Builder Cache */
390
- $this->clear_cache();
391
-
392
- /**
393
- * Redirect to the new flow edit screen
394
- */
395
- $redirect_url = add_query_arg( 'highlight-step-id', $new_step_id, get_edit_post_link( $flow_id, 'default' ) );
396
-
397
- wp_safe_redirect( $redirect_url );
398
- exit;
399
- } else {
400
- wp_die( 'Post creation failed, could not find original post: ' . $post_id );
401
- }
402
- }
403
-
404
- /**
405
- * Add the clone link to action list for flows row actions
406
- *
407
- * @param array $actions Actions array.
408
- * @param object $post Post object.
409
- *
410
- * @return array
411
- */
412
- public function clone_link( $actions, $post ) {
413
-
414
- if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
415
-
416
- if ( isset( $actions['duplicate'] ) ) { // Duplicate page plugin remove.
417
- unset( $actions['duplicate'] );
418
- }
419
- if ( isset( $actions['edit_as_new_draft'] ) ) { // Duplicate post plugin remove.
420
- unset( $actions['edit_as_new_draft'] );
421
- }
422
-
423
- $actions['clone'] = '<a href="' . wp_nonce_url( 'admin.php?action=cartflows_clone_flow&post=' . $post->ID, basename( __FILE__ ), 'flow_clone_nonce' ) . '" title="' . __( 'Clone this flow', 'cartflows' ) . '" rel="permalink">' . __( 'Clone', 'cartflows' ) . '</a>';
424
-
425
- if ( ! _is_cartflows_pro() ) {
426
-
427
- $flow_posts = get_posts(
428
- array(
429
- 'posts_per_page' => 4,
430
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
431
- 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
432
- )
433
- );
434
-
435
- if ( is_array( $flow_posts ) ) {
436
-
437
- $flow_count = count( $flow_posts );
438
-
439
- if ( $flow_count > 3 || 3 === $flow_count ) {
440
- unset( $actions['clone'] );
441
- }
442
- }
443
- }
444
- }
445
-
446
- return $actions;
447
- }
448
-
449
- /**
450
- * Clear Page Builder Cache
451
- */
452
- public function clear_cache() {
453
-
454
- // Clear 'Elementor' file cache.
455
- if ( class_exists( '\Elementor\Plugin' ) ) {
456
- Elementor\Plugin::$instance->files_manager->clear_cache();
457
- }
458
- }
459
-
460
- }
461
-
462
- /**
463
- * Kicking this off by calling 'get_instance()' method
464
- */
465
- Cartflows_Cloning::get_instance();
1
+ <?php
2
+ /**
3
+ * Cloning.
4
+ *
5
+ * @package cartflows-pro
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Cloning {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Initiator
25
+ */
26
+ public static function get_instance() {
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new self();
29
+ }
30
+ return self::$instance;
31
+ }
32
+
33
+ /**
34
+ * Constructor
35
+ */
36
+ public function __construct() {
37
+
38
+ add_filter( 'post_row_actions', array( $this, 'clone_link' ), 99, 2 );
39
+ add_action( 'admin_action_cartflows_clone_flow', array( $this, 'clone_flow' ) );
40
+ add_action( 'admin_action_cartflows_clone_step', array( $this, 'clone_step' ) );
41
+ }
42
+
43
+ /**
44
+ * Clone flow with steps and its meta.
45
+ */
46
+ public function clone_flow() {
47
+
48
+ global $wpdb;
49
+
50
+ if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_flow' === $_REQUEST['action'] ) ) ) {
51
+ wp_die( 'No post to duplicate has been supplied!' );
52
+ }
53
+
54
+ /*
55
+ * Nonce verification
56
+ */
57
+ if ( ! isset( $_GET['flow_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['flow_clone_nonce'] ) ), basename( __FILE__ ) ) ) {
58
+ return;
59
+ }
60
+
61
+ /**
62
+ * Get the original post id
63
+ */
64
+ $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
65
+
66
+ /**
67
+ * And all the original post data then
68
+ */
69
+ $post = get_post( $post_id );
70
+
71
+ /**
72
+ * Assign current user to be the new post author
73
+ */
74
+ $current_user = wp_get_current_user();
75
+ $new_post_author = $current_user->ID;
76
+
77
+ /**
78
+ * If post data exists, create the post duplicate
79
+ */
80
+ if ( isset( $post ) && null !== $post ) {
81
+
82
+ /**
83
+ * New post data array
84
+ */
85
+
86
+ $args = array(
87
+ 'comment_status' => $post->comment_status,
88
+ 'ping_status' => $post->ping_status,
89
+ 'post_author' => $new_post_author,
90
+ 'post_content' => $post->post_content,
91
+ 'post_excerpt' => $post->post_excerpt,
92
+ 'post_name' => $post->post_name,
93
+ 'post_parent' => $post->post_parent,
94
+ 'post_password' => $post->post_password,
95
+ 'post_status' => $post->post_status,
96
+ 'post_title' => $post->post_title . ' Clone',
97
+ 'post_type' => $post->post_type,
98
+ 'to_ping' => $post->to_ping,
99
+ 'menu_order' => $post->menu_order,
100
+ );
101
+
102
+ /**
103
+ * Insert the post
104
+ */
105
+ $new_flow_id = wp_insert_post( $args );
106
+
107
+ /**
108
+ * Get all current post terms ad set them to the new post
109
+ */
110
+ // returns array of taxonomy names for post type, ex array("category", "post_tag");.
111
+ $taxonomies = get_object_taxonomies( $post->post_type );
112
+
113
+ foreach ( $taxonomies as $taxonomy ) {
114
+
115
+ $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
116
+
117
+ wp_set_object_terms( $new_flow_id, $post_terms, $taxonomy, false );
118
+ }
119
+
120
+ /**
121
+ * Duplicate all post meta just in two SQL queries
122
+ */
123
+ // @codingStandardsIgnoreStart
124
+ $post_meta_infos = $wpdb->get_results(
125
+ "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
126
+ );
127
+ // @codingStandardsIgnoreEnd
128
+
129
+ if ( ! empty( $post_meta_infos ) ) {
130
+
131
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
132
+
133
+ $sql_query_sel = array();
134
+
135
+ foreach ( $post_meta_infos as $meta_info ) {
136
+
137
+ $meta_key = $meta_info->meta_key;
138
+
139
+ if ( '_wp_old_slug' === $meta_key ) {
140
+ continue;
141
+ }
142
+
143
+ $meta_value = addslashes( $meta_info->meta_value );
144
+
145
+ $sql_query_sel[] = "($new_flow_id, '$meta_key', '$meta_value')";
146
+ }
147
+
148
+ $sql_query .= implode( ',', $sql_query_sel );
149
+
150
+ // @codingStandardsIgnoreStart
151
+ $wpdb->query( $sql_query );
152
+ // @codingStandardsIgnoreEnd
153
+ }
154
+
155
+ /* Steps Cloning */
156
+ $flow_steps = get_post_meta( $post_id, 'wcf-steps', true );
157
+ $new_flow_steps = array();
158
+
159
+ /* Set Steps Empty */
160
+ update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
161
+
162
+ if ( is_array( $flow_steps ) && ! empty( $flow_steps ) ) {
163
+
164
+ foreach ( $flow_steps as $index => $step_data ) {
165
+
166
+ $step_id = $step_data['id'];
167
+ $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
168
+
169
+ $step_object = get_post( $step_id );
170
+
171
+ /**
172
+ * New step post data array
173
+ */
174
+ $step_args = array(
175
+ 'comment_status' => $step_object->comment_status,
176
+ 'ping_status' => $step_object->ping_status,
177
+ 'post_author' => $new_post_author,
178
+ 'post_content' => $step_object->post_content,
179
+ 'post_excerpt' => $step_object->post_excerpt,
180
+ 'post_name' => $step_object->post_name,
181
+ 'post_parent' => $step_object->post_parent,
182
+ 'post_password' => $step_object->post_password,
183
+ 'post_status' => $step_object->post_status,
184
+ 'post_title' => $step_object->post_title,
185
+ 'post_type' => $step_object->post_type,
186
+ 'to_ping' => $step_object->to_ping,
187
+ 'menu_order' => $step_object->menu_order,
188
+ );
189
+
190
+ /**
191
+ * Insert the post
192
+ */
193
+ $new_step_id = wp_insert_post( $step_args );
194
+
195
+ /**
196
+ * Duplicate all step meta
197
+ */
198
+ // @codingStandardsIgnoreStart
199
+ $post_meta_infos = $wpdb->get_results(
200
+ "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$step_id"
201
+ );
202
+ // @codingStandardsIgnoreEnd
203
+
204
+ if ( ! empty( $post_meta_infos ) ) {
205
+
206
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
207
+
208
+ $sql_query_sel = array();
209
+
210
+ foreach ( $post_meta_infos as $meta_info ) {
211
+
212
+ $meta_key = $meta_info->meta_key;
213
+
214
+ if ( '_wp_old_slug' === $meta_key ) {
215
+ continue;
216
+ }
217
+
218
+ $meta_value = addslashes( $meta_info->meta_value );
219
+
220
+ $sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
221
+ }
222
+
223
+ $sql_query .= implode( ',', $sql_query_sel );
224
+
225
+ // @codingStandardsIgnoreStart
226
+ $wpdb->query( $sql_query );
227
+ // @codingStandardsIgnoreEnd
228
+ }
229
+
230
+ // insert post meta.
231
+ update_post_meta( $new_step_id, 'wcf-flow-id', $new_flow_id );
232
+ update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
233
+
234
+ wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
235
+ wp_set_object_terms( $new_step_id, 'flow-' . $new_flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
236
+
237
+ /* Add New Flow Steps */
238
+ $new_flow_steps[] = array(
239
+ 'id' => $new_step_id,
240
+ 'title' => $step_object->post_title,
241
+ 'type' => $step_type,
242
+ );
243
+ }
244
+ }
245
+
246
+ /* Update New Flow Step Post Meta */
247
+ update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
248
+
249
+ /* Clear Page Builder Cache */
250
+ $this->clear_cache();
251
+
252
+ /**
253
+ * Redirect to the new flow edit screen
254
+ */
255
+ wp_safe_redirect( admin_url( 'post.php?action=edit&post=' . $new_flow_id ) );
256
+ exit;
257
+ } else {
258
+ wp_die( 'Post creation failed, could not find original post: ' . $post_id );
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Clone step with its meta.
264
+ */
265
+ public function clone_step() {
266
+
267
+ global $wpdb;
268
+
269
+ if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_step' === $_REQUEST['action'] ) ) ) {
270
+ wp_die( 'No post to duplicate has been supplied!' );
271
+ }
272
+
273
+ /*
274
+ * Nonce verification
275
+ */
276
+ if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['step_clone_nonce'] ) ), 'step_clone' ) ) {
277
+ return;
278
+ }
279
+
280
+ /**
281
+ * Get the original post id
282
+ */
283
+ $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
284
+
285
+ /**
286
+ * And all the original post data then
287
+ */
288
+ $post = get_post( $post_id );
289
+
290
+ /**
291
+ * Assign current user to be the new post author
292
+ */
293
+ $current_user = wp_get_current_user();
294
+ $new_post_author = $current_user->ID;
295
+
296
+ /**
297
+ * If post data exists, create the post duplicate
298
+ */
299
+ if ( isset( $post ) && null !== $post ) {
300
+
301
+ /**
302
+ * New post data array
303
+ */
304
+ $args = array(
305
+ 'comment_status' => $post->comment_status,
306
+ 'ping_status' => $post->ping_status,
307
+ 'post_author' => $new_post_author,
308
+ 'post_content' => $post->post_content,
309
+ 'post_excerpt' => $post->post_excerpt,
310
+ 'post_name' => $post->post_name,
311
+ 'post_parent' => $post->post_parent,
312
+ 'post_password' => $post->post_password,
313
+ 'post_status' => $post->post_status,
314
+ 'post_title' => $post->post_title . ' Clone',
315
+ 'post_type' => $post->post_type,
316
+ 'to_ping' => $post->to_ping,
317
+ 'menu_order' => $post->menu_order,
318
+ );
319
+
320
+ /**
321
+ * Insert the post
322
+ */
323
+ $new_step_id = wp_insert_post( $args );
324
+
325
+ /**
326
+ * Get all current post terms ad set them to the new post
327
+ */
328
+ // returns array of taxonomy names for post type, ex array("category", "post_tag");.
329
+ $taxonomies = get_object_taxonomies( $post->post_type );
330
+
331
+ foreach ( $taxonomies as $taxonomy ) {
332
+
333
+ $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
334
+
335
+ wp_set_object_terms( $new_step_id, $post_terms, $taxonomy, false );
336
+ }
337
+
338
+ /**
339
+ * Duplicate all post meta just in two SQL queries
340
+ */
341
+ // @codingStandardsIgnoreStart
342
+ $post_meta_infos = $wpdb->get_results(
343
+ "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
344
+ );
345
+ // @codingStandardsIgnoreEnd
346
+
347
+ if ( ! empty( $post_meta_infos ) ) {
348
+
349
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
350
+
351
+ $sql_query_sel = array();
352
+
353
+ foreach ( $post_meta_infos as $meta_info ) {
354
+
355
+ $meta_key = $meta_info->meta_key;
356
+
357
+ if ( '_wp_old_slug' === $meta_key ) {
358
+ continue;
359
+ }
360
+
361
+ $meta_value = addslashes( $meta_info->meta_value );
362
+
363
+ $sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
364
+ }
365
+
366
+ $sql_query .= implode( ',', $sql_query_sel );
367
+
368
+ // @codingStandardsIgnoreStart
369
+ $wpdb->query( $sql_query );
370
+ // @codingStandardsIgnoreEnd
371
+ }
372
+
373
+ $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
374
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
375
+ $step_type = get_post_meta( $post_id, 'wcf-step-type', true );
376
+
377
+ if ( ! is_array( $flow_steps ) ) {
378
+ $flow_steps = array();
379
+ }
380
+
381
+ $flow_steps[] = array(
382
+ 'id' => $new_step_id,
383
+ 'title' => $post->post_title,
384
+ 'type' => $step_type,
385
+ );
386
+
387
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
388
+
389
+ /* Clear Page Builder Cache */
390
+ $this->clear_cache();
391
+
392
+ /**
393
+ * Redirect to the new flow edit screen
394
+ */
395
+ $redirect_url = add_query_arg( 'highlight-step-id', $new_step_id, get_edit_post_link( $flow_id, 'default' ) );
396
+
397
+ wp_safe_redirect( $redirect_url );
398
+ exit;
399
+ } else {
400
+ wp_die( 'Post creation failed, could not find original post: ' . $post_id );
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Add the clone link to action list for flows row actions
406
+ *
407
+ * @param array $actions Actions array.
408
+ * @param object $post Post object.
409
+ *
410
+ * @return array
411
+ */
412
+ public function clone_link( $actions, $post ) {
413
+
414
+ if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
415
+
416
+ if ( isset( $actions['duplicate'] ) ) { // Duplicate page plugin remove.
417
+ unset( $actions['duplicate'] );
418
+ }
419
+ if ( isset( $actions['edit_as_new_draft'] ) ) { // Duplicate post plugin remove.
420
+ unset( $actions['edit_as_new_draft'] );
421
+ }
422
+
423
+ $actions['clone'] = '<a href="' . wp_nonce_url( 'admin.php?action=cartflows_clone_flow&post=' . $post->ID, basename( __FILE__ ), 'flow_clone_nonce' ) . '" title="' . __( 'Clone this flow', 'cartflows' ) . '" rel="permalink">' . __( 'Clone', 'cartflows' ) . '</a>';
424
+
425
+ if ( ! _is_cartflows_pro() ) {
426
+
427
+ $flow_posts = get_posts(
428
+ array(
429
+ 'posts_per_page' => 4,
430
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
431
+ 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
432
+ )
433
+ );
434
+
435
+ if ( is_array( $flow_posts ) ) {
436
+
437
+ $flow_count = count( $flow_posts );
438
+
439
+ if ( $flow_count > 3 || 3 === $flow_count ) {
440
+ unset( $actions['clone'] );
441
+ }
442
+ }
443
+ }
444
+ }
445
+
446
+ return $actions;
447
+ }
448
+
449
+ /**
450
+ * Clear Page Builder Cache
451
+ */
452
+ public function clear_cache() {
453
+
454
+ // Clear 'Elementor' file cache.
455
+ if ( class_exists( '\Elementor\Plugin' ) ) {
456
+ Elementor\Plugin::$instance->files_manager->clear_cache();
457
+ }
458
+ }
459
+
460
+ }
461
+
462
+ /**
463
+ * Kicking this off by calling 'get_instance()' method
464
+ */
465
+ Cartflows_Cloning::get_instance();
classes/class-cartflows-compatibility.php CHANGED
@@ -1,410 +1,410 @@
1
- <?php
2
- /**
3
- * Page builder compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
9
-
10
- /**
11
- * Class for page builder compatibility
12
- */
13
- class Cartflows_Compatibility {
14
-
15
- /**
16
- * Member Variable
17
- *
18
- * @var object instance
19
- */
20
- private static $instance;
21
-
22
- /**
23
- * Initiator
24
- */
25
- public static function get_instance() {
26
- if ( ! isset( self::$instance ) ) {
27
- self::$instance = new self();
28
- }
29
- return self::$instance;
30
- }
31
-
32
- /**
33
- * Constructor
34
- */
35
- public function __construct() {
36
-
37
- $this->load_files();
38
-
39
- // Override post meta.
40
- add_action( 'wp', array( $this, 'override_meta' ), 0 );
41
-
42
- add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
43
- }
44
-
45
- /**
46
- * Load page builder compatibility files
47
- */
48
- public function load_files() {
49
- if ( class_exists( '\Elementor\Plugin' ) ) {
50
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
51
- }
52
-
53
- if ( $this->is_divi_enabled() ) {
54
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
- }
56
-
57
- if ( $this->is_bb_enabled() ) {
58
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
59
- }
60
-
61
- if ( class_exists( 'TCB_Post' ) ) {
62
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
63
- }
64
-
65
- if ( defined( 'LEARNDASH_VERSION' ) ) {
66
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
67
- }
68
- }
69
-
70
- /**
71
- * Check if it is beaver builder enabled.
72
- *
73
- * @since 1.1.4
74
- */
75
- public function is_bb_enabled() {
76
-
77
- if ( class_exists( 'FLBuilderModel' ) ) {
78
- return true;
79
- }
80
-
81
- return false;
82
- }
83
-
84
- /**
85
- * Check if elementor preview mode is on.
86
- */
87
- public function is_elementor_preview_mode() {
88
-
89
- if ( class_exists( '\Elementor\Plugin' ) ) {
90
-
91
- if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
92
- return true;
93
- }
94
- }
95
-
96
- return false;
97
- }
98
-
99
- /**
100
- * Get Current Theme.
101
- */
102
- public function get_current_theme() {
103
-
104
- $theme_name = '';
105
- $theme = wp_get_theme();
106
-
107
- if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
108
- $theme_name = $theme->parent_theme;
109
- } else {
110
- $theme_name = $theme->name;
111
- }
112
-
113
- return $theme_name;
114
- }
115
-
116
- /**
117
- * Check if it is beaver builder preview mode
118
- */
119
- public function is_bb_preview_mode() {
120
-
121
- if ( class_exists( 'FLBuilderModel' ) ) {
122
- if ( FLBuilderModel::is_builder_active() ) {
123
- return true;
124
- } else {
125
- return false;
126
- }
127
- }
128
-
129
- return false;
130
- }
131
-
132
- /**
133
- * Check for page builder preview mode.
134
- */
135
- public function is_page_builder_preview() {
136
-
137
- if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
138
- return true;
139
- }
140
-
141
- return false;
142
- }
143
-
144
- /**
145
- * Check if divi builder enabled for post id.
146
- */
147
- public function is_divi_builder_preview() {
148
-
149
- if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
150
- return true;
151
- }
152
-
153
- return false;
154
- }
155
-
156
- /**
157
- * Check if divi builder enabled for post id.
158
- *
159
- * @param int $post_id post id.
160
- */
161
- public function is_divi_builder_enabled( $post_id ) {
162
-
163
- if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
164
- return true;
165
- }
166
-
167
- return false;
168
- }
169
-
170
- /**
171
- * Check if compatibility theme enabled.
172
- */
173
- public function is_compatibility_theme_enabled() {
174
-
175
- $theme = wp_get_theme();
176
-
177
- $is_compatibility = false;
178
-
179
- if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
180
-
181
- $is_compatibility = true;
182
- }
183
-
184
- return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
185
- }
186
-
187
- /**
188
- * Check if divi builder enabled for post id.
189
- *
190
- * @param object $theme theme data.
191
- * @return boolean
192
- */
193
- public function is_divi_enabled( $theme = false ) {
194
-
195
- if ( ! $theme ) {
196
- $theme = wp_get_theme();
197
- }
198
-
199
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
200
- return true;
201
- }
202
-
203
- return false;
204
- }
205
-
206
- /**
207
- * Check if Divi theme is install status.
208
- *
209
- * @return boolean
210
- */
211
- public function is_divi_theme_installed() {
212
- foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
213
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
214
- return true;
215
- }
216
- }
217
- return false;
218
- }
219
-
220
- /**
221
- * Check if Flatsome enabled for post id.
222
- *
223
- * @param object $theme theme data.
224
- * @return boolean
225
- */
226
- public function is_flatsome_enabled( $theme = false ) {
227
-
228
- if ( ! $theme ) {
229
- $theme = wp_get_theme();
230
- }
231
-
232
- if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
233
- return true;
234
- }
235
-
236
- return false;
237
- }
238
-
239
- /**
240
- * Check if The7 enabled for post id.
241
- *
242
- * @param object $theme theme data.
243
- * @return boolean
244
- */
245
- public function is_the_seven_enabled( $theme = false ) {
246
-
247
- if ( ! $theme ) {
248
- $theme = wp_get_theme();
249
- }
250
-
251
- if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
252
- return true;
253
- }
254
-
255
- return false;
256
- }
257
-
258
- /**
259
- * Check if OceanWp enabled for post id.
260
- *
261
- * @param object $theme theme data.
262
- * @return boolean
263
- */
264
- public function is_oceanwp_enabled( $theme = false ) {
265
-
266
- if ( ! $theme ) {
267
- $theme = wp_get_theme();
268
- }
269
-
270
- if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
271
- return true;
272
- }
273
-
274
- return false;
275
- }
276
-
277
- /**
278
- * Check for thrive architect edit page.
279
- *
280
- * @param int $post_id post id.
281
- */
282
- public function is_thrive_edit_page( $post_id ) {
283
-
284
- if ( true === $this->is_thrive_builder_page( $post_id ) ) {
285
- return true;
286
- } else {
287
- return false;
288
- }
289
- }
290
-
291
- /**
292
- * Check if the page being rendered is the main ID on the editor page.
293
- *
294
- * @since 1.0.0
295
- * @param String $post_id Post ID which is to be rendered.
296
- * @return boolean True if current if is being rendered is not being edited.
297
- */
298
- private function is_thrive_builder_page( $post_id ) {
299
- $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
300
- $post = isset( $_GET['post'] ) ? sanitize_text_field( wp_unslash( $_GET['post'] ) ) : false;
301
-
302
- return ( true == $tve && $post_id !== $post );
303
- }
304
-
305
- /**
306
- * Overwrite meta for page
307
- */
308
- public function override_meta() {
309
-
310
- // don't override meta for `elementor_library` post type.
311
- if ( 'elementor_library' == get_post_type() ) {
312
- return;
313
- }
314
-
315
- if ( ! is_singular() ) {
316
- return;
317
- }
318
-
319
- global $post;
320
- $post_id = $post->ID;
321
- $post_type = get_post_type();
322
-
323
- if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
324
- || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
325
- || $this->is_divi_builder_enabled( $post_id ) ) ) {
326
-
327
- if ( '' == $post->post_content ) {
328
-
329
- $this->overwrite_template( $post_id );
330
- }
331
- }
332
- }
333
-
334
- /**
335
- * Assign cartflow canvas template to page.
336
- *
337
- * @param int $post_id post ID.
338
- */
339
- public function overwrite_template( $post_id ) {
340
-
341
- $template = 'cartflows-canvas';
342
- $key = '_wp_page_template';
343
-
344
- $record_exists = get_post_meta( $post_id, $key, true );
345
-
346
- if ( 'cartflows-canvas' == $record_exists ) {
347
- return;
348
- }
349
-
350
- // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
351
- if ( class_exists( '\Elementor\Plugin' ) ) {
352
-
353
- global $wpdb;
354
-
355
- if ( '' == $record_exists || ! $record_exists ) {
356
-
357
- $wpdb->insert(
358
- $wpdb->prefix . 'postmeta',
359
- array(
360
- 'post_id' => $post_id,
361
- 'meta_key' => $key,//phpcs:ignore
362
- 'meta_value' => $template, //phpcs:ignore
363
- )
364
- );// db call ok;.
365
-
366
- // alternative query to above query.
367
- // $table = $wpdb->prefix . 'postmeta';
368
- // $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
369
- // VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
370
-
371
- } else {
372
-
373
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
374
- }
375
- } else {
376
-
377
- update_post_meta( $post_id, $key, $template );
378
- }
379
- }
380
-
381
- /**
382
- * Load font awesome style from oceanwp on checkout page.
383
- */
384
- public function load_fontawesome() {
385
-
386
- $theme = get_template();
387
-
388
- if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
389
-
390
- $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
391
-
392
- if ( $load_fa ) {
393
-
394
- wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
395
- }
396
-
397
- $custom_css = '
398
- #oceanwp-cart-sidebar-wrap,
399
- #owp-qv-wrap{
400
- display: none;
401
- }';
402
-
403
- wp_add_inline_style( 'wcf-frontend-global', $custom_css );
404
- }
405
- }
406
- }
407
- }
408
-
409
- Cartflows_Compatibility::get_instance();
410
-
1
+ <?php
2
+ /**
3
+ * Page builder compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
9
+
10
+ /**
11
+ * Class for page builder compatibility
12
+ */
13
+ class Cartflows_Compatibility {
14
+
15
+ /**
16
+ * Member Variable
17
+ *
18
+ * @var object instance
19
+ */
20
+ private static $instance;
21
+
22
+ /**
23
+ * Initiator
24
+ */
25
+ public static function get_instance() {
26
+ if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new self();
28
+ }
29
+ return self::$instance;
30
+ }
31
+
32
+ /**
33
+ * Constructor
34
+ */
35
+ public function __construct() {
36
+
37
+ $this->load_files();
38
+
39
+ // Override post meta.
40
+ add_action( 'wp', array( $this, 'override_meta' ), 0 );
41
+
42
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
43
+ }
44
+
45
+ /**
46
+ * Load page builder compatibility files
47
+ */
48
+ public function load_files() {
49
+ if ( class_exists( '\Elementor\Plugin' ) ) {
50
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
51
+ }
52
+
53
+ if ( $this->is_divi_enabled() ) {
54
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
+ }
56
+
57
+ if ( $this->is_bb_enabled() ) {
58
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
59
+ }
60
+
61
+ if ( class_exists( 'TCB_Post' ) ) {
62
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
63
+ }
64
+
65
+ if ( defined( 'LEARNDASH_VERSION' ) ) {
66
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Check if it is beaver builder enabled.
72
+ *
73
+ * @since 1.1.4
74
+ */
75
+ public function is_bb_enabled() {
76
+
77
+ if ( class_exists( 'FLBuilderModel' ) ) {
78
+ return true;
79
+ }
80
+
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * Check if elementor preview mode is on.
86
+ */
87
+ public function is_elementor_preview_mode() {
88
+
89
+ if ( class_exists( '\Elementor\Plugin' ) ) {
90
+
91
+ if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
92
+ return true;
93
+ }
94
+ }
95
+
96
+ return false;
97
+ }
98
+
99
+ /**
100
+ * Get Current Theme.
101
+ */
102
+ public function get_current_theme() {
103
+
104
+ $theme_name = '';
105
+ $theme = wp_get_theme();
106
+
107
+ if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
108
+ $theme_name = $theme->parent_theme;
109
+ } else {
110
+ $theme_name = $theme->name;
111
+ }
112
+
113
+ return $theme_name;
114
+ }
115
+
116
+ /**
117
+ * Check if it is beaver builder preview mode
118
+ */
119
+ public function is_bb_preview_mode() {
120
+
121
+ if ( class_exists( 'FLBuilderModel' ) ) {
122
+ if ( FLBuilderModel::is_builder_active() ) {
123
+ return true;
124
+ } else {
125
+ return false;
126
+ }
127
+ }
128
+
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Check for page builder preview mode.
134
+ */
135
+ public function is_page_builder_preview() {
136
+
137
+ if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
138
+ return true;
139
+ }
140
+
141
+ return false;
142
+ }
143
+
144
+ /**
145
+ * Check if divi builder enabled for post id.
146
+ */
147
+ public function is_divi_builder_preview() {
148
+
149
+ if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) { //phpcs:ignore
150
+ return true;
151
+ }
152
+
153
+ return false;
154
+ }
155
+
156
+ /**
157
+ * Check if divi builder enabled for post id.
158
+ *
159
+ * @param int $post_id post id.
160
+ */
161
+ public function is_divi_builder_enabled( $post_id ) {
162
+
163
+ if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
164
+ return true;
165
+ }
166
+
167
+ return false;
168
+ }
169
+
170
+ /**
171
+ * Check if compatibility theme enabled.
172
+ */
173
+ public function is_compatibility_theme_enabled() {
174
+
175
+ $theme = wp_get_theme();
176
+
177
+ $is_compatibility = false;
178
+
179
+ if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
180
+
181
+ $is_compatibility = true;
182
+ }
183
+
184
+ return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
185
+ }
186
+
187
+ /**
188
+ * Check if divi builder enabled for post id.
189
+ *
190
+ * @param object $theme theme data.
191
+ * @return boolean
192
+ */
193
+ public function is_divi_enabled( $theme = false ) {
194
+
195
+ if ( ! $theme ) {
196
+ $theme = wp_get_theme();
197
+ }
198
+
199
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
200
+ return true;
201
+ }
202
+
203
+ return false;
204
+ }
205
+
206
+ /**
207
+ * Check if Divi theme is install status.
208
+ *
209
+ * @return boolean
210
+ */
211
+ public function is_divi_theme_installed() {
212
+ foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
213
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
214
+ return true;
215
+ }
216
+ }
217
+ return false;
218
+ }
219
+
220
+ /**
221
+ * Check if Flatsome enabled for post id.
222
+ *
223
+ * @param object $theme theme data.
224
+ * @return boolean
225
+ */
226
+ public function is_flatsome_enabled( $theme = false ) {
227
+
228
+ if ( ! $theme ) {
229
+ $theme = wp_get_theme();
230
+ }
231
+
232
+ if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
233
+ return true;
234
+ }
235
+
236
+ return false;
237
+ }
238
+
239
+ /**
240
+ * Check if The7 enabled for post id.
241
+ *
242
+ * @param object $theme theme data.
243
+ * @return boolean
244
+ */
245
+ public function is_the_seven_enabled( $theme = false ) {
246
+
247
+ if ( ! $theme ) {
248
+ $theme = wp_get_theme();
249
+ }
250
+
251
+ if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
252
+ return true;
253
+ }
254
+
255
+ return false;
256
+ }
257
+
258
+ /**
259
+ * Check if OceanWp enabled for post id.
260
+ *
261
+ * @param object $theme theme data.
262
+ * @return boolean
263
+ */
264
+ public function is_oceanwp_enabled( $theme = false ) {
265
+
266
+ if ( ! $theme ) {
267
+ $theme = wp_get_theme();
268
+ }
269
+
270
+ if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
271
+ return true;
272
+ }
273
+
274
+ return false;
275
+ }
276
+
277
+ /**
278
+ * Check for thrive architect edit page.
279
+ *
280
+ * @param int $post_id post id.
281
+ */
282
+ public function is_thrive_edit_page( $post_id ) {
283
+
284
+ if ( true === $this->is_thrive_builder_page( $post_id ) ) {
285
+ return true;
286
+ } else {
287
+ return false;
288
+ }
289
+ }
290
+
291
+ /**
292
+ * Check if the page being rendered is the main ID on the editor page.
293
+ *
294
+ * @since 1.0.0
295
+ * @param String $post_id Post ID which is to be rendered.
296
+ * @return boolean True if current if is being rendered is not being edited.
297
+ */
298
+ private function is_thrive_builder_page( $post_id ) {
299
+ $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false; //phpcs:ignore
300
+ $post = isset( $_GET['post'] ) ? intval( wp_unslash( $_GET['post'] ) ) : false; //phpcs:ignore
301
+
302
+ return ( true == $tve && $post_id !== $post );
303
+ }
304
+
305
+ /**
306
+ * Overwrite meta for page
307
+ */
308
+ public function override_meta() {
309
+
310
+ // don't override meta for `elementor_library` post type.
311
+ if ( 'elementor_library' == get_post_type() ) {
312
+ return;
313
+ }
314
+
315
+ if ( ! is_singular() ) {
316
+ return;
317
+ }
318
+
319
+ global $post;
320
+ $post_id = $post->ID;
321
+ $post_type = get_post_type();
322
+
323
+ if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
324
+ || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
325
+ || $this->is_divi_builder_enabled( $post_id ) ) ) {
326
+
327
+ if ( '' == $post->post_content ) {
328
+
329
+ $this->overwrite_template( $post_id );
330
+ }
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Assign cartflow canvas template to page.
336
+ *
337
+ * @param int $post_id post ID.
338
+ */
339
+ public function overwrite_template( $post_id ) {
340
+
341
+ $template = 'cartflows-canvas';
342
+ $key = '_wp_page_template';
343
+
344
+ $record_exists = get_post_meta( $post_id, $key, true );
345
+
346
+ if ( 'cartflows-canvas' == $record_exists ) {
347
+ return;
348
+ }
349
+
350
+ // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
351
+ if ( class_exists( '\Elementor\Plugin' ) ) {
352
+
353
+ global $wpdb;
354
+
355
+ if ( '' == $record_exists || ! $record_exists ) {
356
+
357
+ $wpdb->insert(
358
+ $wpdb->prefix . 'postmeta',
359
+ array(
360
+ 'post_id' => $post_id,
361
+ 'meta_key' => $key,//phpcs:ignore
362
+ 'meta_value' => $template, //phpcs:ignore
363
+ )
364
+ );// db call ok;.
365
+
366
+ // alternative query to above query.
367
+ // $table = $wpdb->prefix . 'postmeta';
368
+ // $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
369
+ // VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
370
+
371
+ } else {
372
+
373
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
374
+ }
375
+ } else {
376
+
377
+ update_post_meta( $post_id, $key, $template );
378
+ }
379
+ }
380
+
381
+ /**
382
+ * Load font awesome style from oceanwp on checkout page.
383
+ */
384
+ public function load_fontawesome() {
385
+
386
+ $theme = get_template();
387
+
388
+ if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
389
+
390
+ $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
391
+
392
+ if ( $load_fa ) {
393
+
394
+ wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
395
+ }
396
+
397
+ $custom_css = '
398
+ #oceanwp-cart-sidebar-wrap,
399
+ #owp-qv-wrap{
400
+ display: none;
401
+ }';
402
+
403
+ wp_add_inline_style( 'wcf-frontend-global', $custom_css );
404
+ }
405
+ }
406
+ }
407
+ }
408
+
409
+ Cartflows_Compatibility::get_instance();
410
+
classes/class-cartflows-default-meta.php CHANGED
@@ -357,13 +357,13 @@ class Cartflows_Default_Meta {
357
  break;
358
 
359
  case 'FILTER_CARTFLOWS_ARRAY':
360
- if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
361
- $meta_value = array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) );
362
  }
363
  break;
364
 
365
  case 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS':
366
- if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
367
  $i = 0;
368
  $q = 0;
369
 
@@ -389,7 +389,7 @@ class Cartflows_Default_Meta {
389
  $ordered_fields = array();
390
  $billing_fields = array();
391
 
392
- if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
393
  $post_data = wp_unslash( $_POST[ $key ] ); //phpcs:ignore
394
 
395
  if ( 'wcf_field_order_billing' == $key ) {
@@ -794,6 +794,14 @@ class Cartflows_Default_Meta {
794
  'default' => 'yes',
795
  'sanitize' => 'FILTER_DEFAULT',
796
  ),
 
 
 
 
 
 
 
 
797
  'wcf-custom-script' => array(
798
  'default' => '',
799
  'sanitize' => 'FILTER_DEFAULT',
357
  break;
358
 
359
  case 'FILTER_CARTFLOWS_ARRAY':
360
+ if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
361
+ $meta_value = array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ); //phpcs:ignore
362
  }
363
  break;
364
 
365
  case 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS':
366
+ if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
367
  $i = 0;
368
  $q = 0;
369
 
389
  $ordered_fields = array();
390
  $billing_fields = array();
391
 
392
+ if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
393
  $post_data = wp_unslash( $_POST[ $key ] ); //phpcs:ignore
394
 
395
  if ( 'wcf_field_order_billing' == $key ) {
794
  'default' => 'yes',
795
  'sanitize' => 'FILTER_DEFAULT',
796
  ),
797
+ 'wcf-show-tq-redirect-section' => array(
798
+ 'default' => '',
799
+ 'sanitize' => 'FILTER_DEFAULT',
800
+ ),
801
+ 'wcf-tq-redirect-link' => array(
802
+ 'default' => '',
803
+ 'sanitize' => 'FILTER_SANITIZE_URL',
804
+ ),
805
  'wcf-custom-script' => array(
806
  'default' => '',
807
  'sanitize' => 'FILTER_DEFAULT',
classes/class-cartflows-frontend.php CHANGED
@@ -252,19 +252,25 @@ class Cartflows_Frontend {
252
  wcf()->utils->do_not_cache();
253
 
254
  /* Set key to support pixel */
255
- if ( isset( $_GET['wcf-key'] ) ) {
256
- $_GET['key'] = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) );
257
- $_REQUEST['key'] = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) );
 
 
 
258
  }
259
 
260
- if ( isset( $_GET['wcf-order'] ) ) {
261
- $_GET['order'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
262
- $_REQUEST['order'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
263
- $_GET['order-received'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
264
- $_REQUEST['order-received'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
 
 
 
265
 
266
  if ( _is_wcf_thankyou_type() ) {
267
- $wp->set_query_var( 'order-received', intval( wp_unslash( $_GET['wcf-order'] ) ) );
268
  }
269
  }
270
  }
252
  wcf()->utils->do_not_cache();
253
 
254
  /* Set key to support pixel */
255
+ if ( isset( $_GET['wcf-key'] ) ) { //phpcs:ignore
256
+
257
+ $wcf_key = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
258
+
259
+ $_GET['key'] = $wcf_key;
260
+ $_REQUEST['key'] = $wcf_key;
261
  }
262
 
263
+ if ( isset( $_GET['wcf-order'] ) ) { //phpcs:ignore
264
+
265
+ $wcf_order = intval( wp_unslash( $_GET['wcf-order'] ) ); //phpcs:ignore
266
+
267
+ $_GET['order'] = $wcf_order;
268
+ $_REQUEST['order'] = $wcf_order;
269
+ $_GET['order-received'] = $wcf_order;
270
+ $_REQUEST['order-received'] = $wcf_order;
271
 
272
  if ( _is_wcf_thankyou_type() ) {
273
+ $wp->set_query_var( 'order-received', $wcf_order );
274
  }
275
  }
276
  }
classes/class-cartflows-functions.php CHANGED
@@ -174,9 +174,9 @@ function _is_wcf_doing_checkout_ajax() {
174
 
175
  if ( wp_doing_ajax() ) {
176
 
177
- if ( isset( $_GET['wc-ajax'] ) &&
178
- 'checkout' === $_GET['wc-ajax'] &&
179
- isset( $_POST['_wcf_checkout_id'] )
180
  ) {
181
  return true;
182
  }
174
 
175
  if ( wp_doing_ajax() ) {
176
 
177
+ if ( isset( $_GET['wc-ajax'] ) && //phpcs:ignore
178
+ 'checkout' === $_GET['wc-ajax'] && //phpcs:ignore
179
+ isset( $_POST['_wcf_checkout_id'] ) //phpcs:ignore
180
  ) {
181
  return true;
182
  }
classes/class-cartflows-importer.php CHANGED
@@ -874,7 +874,8 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
874
  </ul>
875
 
876
  <?php
877
- /*
 
878
  <# } else { #>
879
  <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
880
 
@@ -891,7 +892,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
891
  <# } #>
892
 
893
  </select>
894
- */
895
  ?>
896
 
897
  <?php /* <# } #> */ ?>
@@ -1019,7 +1020,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
1019
  'admin_url' => admin_url(),
1020
  'licence_args' => CartFlows_API::get_instance()->get_licence_args(),
1021
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
1022
- 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
1023
 
1024
  'required_plugins' => Cartflows_Helper::get_plugins_groupby_page_builders(),
1025
 
874
  </ul>
875
 
876
  <?php
877
+
878
+ /**
879
  <# } else { #>
880
  <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
881
 
892
  <# } #>
893
 
894
  </select>
895
+ */
896
  ?>
897
 
898
  <?php /* <# } #> */ ?>
1020
  'admin_url' => admin_url(),
1021
  'licence_args' => CartFlows_API::get_instance()->get_licence_args(),
1022
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
1023
+ 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false, //phpcs:ignore
1024
 
1025
  'required_plugins' => Cartflows_Helper::get_plugins_groupby_page_builders(),
1026
 
classes/class-cartflows-learndash-compatibility.php CHANGED
@@ -1,140 +1,140 @@
1
- <?php
2
- /**
3
- * LearnDash compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Class for LearnDash compatibility
10
- */
11
- class Cartflows_Learndash_Compatibility {
12
-
13
- /**
14
- * Member Variable
15
- *
16
- * @var instance
17
- */
18
- private static $instance;
19
-
20
- /**
21
- * Initiator
22
- */
23
- public static function get_instance() {
24
- if ( ! isset( self::$instance ) ) {
25
- self::$instance = new self();
26
- }
27
- return self::$instance;
28
- }
29
-
30
- /**
31
- * Constructor
32
- */
33
- public function __construct() {
34
- add_filter( 'learndash_post_args', array( $this, 'cartflows_course_setting_fields' ) );
35
- add_action( 'template_redirect', array( $this, 'cartflows_override_course_template' ) );
36
-
37
- }
38
-
39
- /**
40
- * Override course cartflows template.
41
- *
42
- * @return bool
43
- */
44
- public function cartflows_override_course_template() {
45
-
46
- // Don't run any code in admin area.
47
- if ( is_admin() ) {
48
- return false;
49
- }
50
-
51
- // Don't override the template if the post type is not `course`.
52
- if ( ! is_singular( 'sfwd-courses' ) ) {
53
- return false;
54
- }
55
-
56
- $course_id = learndash_get_course_id();
57
- $user_id = get_current_user_id();
58
- if ( is_user_logged_in() && sfwd_lms_has_access( $course_id, $user_id ) ) {
59
- return false;
60
- }
61
-
62
- if ( defined( LEARNDASH_VERSION ) && version_compare( LEARNDASH_VERSION, '2.6.4', '>' ) ) {
63
-
64
- $template = learndash_get_course_meta_setting( get_the_id(), 'wcf_course_template' );
65
- } else {
66
-
67
- $template = get_course_meta_setting( get_the_id(), 'wcf_course_template' );
68
- }
69
-
70
- if ( 'none' !== $template && $template ) {
71
- $link = get_permalink( $template );
72
- wp_safe_redirect( $link );
73
- }
74
- }
75
-
76
- /**
77
- * Add settings inside learndash settings.
78
- *
79
- * @param array $fields fields.
80
- * @return mixed
81
- */
82
- public function cartflows_course_setting_fields( $fields ) {
83
- global $post;
84
-
85
- $all_posts = array(
86
- 'none' => __( 'None', 'cartflows' ),
87
- );
88
-
89
- $landing_steps = get_posts(
90
- array(
91
- 'posts_per_page' => -1,
92
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
93
- 'post_status' => 'publish',
94
- 'orderby' => 'ID',
95
- 'order' => 'DESC',
96
- 'meta_query' => array( //phpcs:ignore
97
- array(
98
- 'key' => 'wcf-step-type',
99
- 'value' => array( 'landing', 'checkout' ),
100
- 'compare' => 'IN',
101
- ),
102
- ),
103
- )
104
- );
105
-
106
- foreach ( $landing_steps as $landing_step ) {
107
- $all_posts[ $landing_step->ID ] = get_the_title( $landing_step->ID ) . ' ( #' . $landing_step->ID . ')';
108
- }
109
-
110
- $selected = get_post_meta( get_the_ID(), 'wcf_course_template', true );
111
- $description = sprintf(
112
- /* translators: 1: anchor start, 2: anchor close */
113
- __( 'Non-enrolled students will redirect to the selected CartFlows template. If you have not created any Flow already, add new Flow from %1$shere%2$s.', 'cartflows' ),
114
- '<a href="' . esc_url( admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&add-new-flow' ) ) . '">',
115
- '</a>'
116
- );
117
-
118
- $fields['sfwd-courses']['fields']['wcf_course_template'] = array(
119
- 'name' => __( 'Select CartFlows Template for this Course', 'cartflows' ),
120
- 'type' => 'select',
121
- 'initial_options' => $all_posts,
122
- 'default' => 'none',
123
- 'help_text' => $description,
124
- 'show_in_rest' => true,
125
- 'rest_args' => array(
126
- 'schema' => array(
127
- 'type' => 'string',
128
- ),
129
- ),
130
- );
131
-
132
- return $fields;
133
- }
134
-
135
- }
136
-
137
- /**
138
- * Kicking this off by calling 'get_instance()' method
139
- */
140
- Cartflows_Learndash_Compatibility::get_instance();
1
+ <?php
2
+ /**
3
+ * LearnDash compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class for LearnDash compatibility
10
+ */
11
+ class Cartflows_Learndash_Compatibility {
12
+
13
+ /**
14
+ * Member Variable
15
+ *
16
+ * @var instance
17
+ */
18
+ private static $instance;
19
+
20
+ /**
21
+ * Initiator
22
+ */
23
+ public static function get_instance() {
24
+ if ( ! isset( self::$instance ) ) {
25
+ self::$instance = new self();
26
+ }
27
+ return self::$instance;
28
+ }
29
+
30
+ /**
31
+ * Constructor
32
+ */
33
+ public function __construct() {
34
+ add_filter( 'learndash_post_args', array( $this, 'cartflows_course_setting_fields' ) );
35
+ add_action( 'template_redirect', array( $this, 'cartflows_override_course_template' ) );
36
+
37
+ }
38
+
39
+ /**
40
+ * Override course cartflows template.
41
+ *
42
+ * @return bool
43
+ */
44
+ public function cartflows_override_course_template() {
45
+
46
+ // Don't run any code in admin area.
47
+ if ( is_admin() ) {
48
+ return false;
49
+ }
50
+
51
+ // Don't override the template if the post type is not `course`.
52
+ if ( ! is_singular( 'sfwd-courses' ) ) {
53
+ return false;
54
+ }
55
+
56
+ $course_id = learndash_get_course_id();
57
+ $user_id = get_current_user_id();
58
+ if ( is_user_logged_in() && sfwd_lms_has_access( $course_id, $user_id ) ) {
59
+ return false;
60
+ }
61
+
62
+ if ( defined( LEARNDASH_VERSION ) && version_compare( LEARNDASH_VERSION, '2.6.4', '>' ) ) {
63
+
64
+ $template = learndash_get_course_meta_setting( get_the_id(), 'wcf_course_template' );
65
+ } else {
66
+
67
+ $template = get_course_meta_setting( get_the_id(), 'wcf_course_template' );
68
+ }
69
+
70
+ if ( 'none' !== $template && $template ) {
71
+ $link = get_permalink( $template );
72
+ wp_safe_redirect( $link );
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Add settings inside learndash settings.
78
+ *
79
+ * @param array $fields fields.
80
+ * @return mixed
81
+ */
82
+ public function cartflows_course_setting_fields( $fields ) {
83
+ global $post;
84
+
85
+ $all_posts = array(
86
+ 'none' => __( 'None', 'cartflows' ),
87
+ );
88
+
89
+ $landing_steps = get_posts(
90
+ array(
91
+ 'posts_per_page' => -1,
92
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
93
+ 'post_status' => 'publish',
94
+ 'orderby' => 'ID',
95
+ 'order' => 'DESC',
96
+ 'meta_query' => array( //phpcs:ignore
97
+ array(
98
+ 'key' => 'wcf-step-type',
99
+ 'value' => array( 'landing', 'checkout' ),
100
+ 'compare' => 'IN',
101
+ ),
102
+ ),
103
+ )
104
+ );
105
+
106
+ foreach ( $landing_steps as $landing_step ) {
107
+ $all_posts[ $landing_step->ID ] = get_the_title( $landing_step->ID ) . ' ( #' . $landing_step->ID . ')';
108
+ }
109
+
110
+ $selected = get_post_meta( get_the_ID(), 'wcf_course_template', true );
111
+ $description = sprintf(
112
+ /* translators: 1: anchor start, 2: anchor close */
113
+ __( 'Non-enrolled students will redirect to the selected CartFlows template. If you have not created any Flow already, add new Flow from %1$shere%2$s.', 'cartflows' ),
114
+ '<a href="' . esc_url( admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&add-new-flow' ) ) . '">',
115
+ '</a>'
116
+ );
117
+
118
+ $fields['sfwd-courses']['fields']['wcf_course_template'] = array(
119
+ 'name' => __( 'Select CartFlows Template for this Course', 'cartflows' ),
120
+ 'type' => 'select',
121
+ 'initial_options' => $all_posts,
122
+ 'default' => 'none',
123
+ 'help_text' => $description,
124
+ 'show_in_rest' => true,
125
+ 'rest_args' => array(
126
+ 'schema' => array(
127
+ 'type' => 'string',
128
+ ),
129
+ ),
130
+ );
131
+
132
+ return $fields;
133
+ }
134
+
135
+ }
136
+
137
+ /**
138
+ * Kicking this off by calling 'get_instance()' method
139
+ */
140
+ Cartflows_Learndash_Compatibility::get_instance();
classes/class-cartflows-loader.php CHANGED
@@ -33,14 +33,6 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
33
  */
34
  public $logger = null;
35
 
36
- /**
37
- * Member Variable
38
- *
39
- * @var session
40
- */
41
- public $session = null;
42
-
43
-
44
  /**
45
  * Member Variable
46
  *
@@ -126,7 +118,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
126
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
127
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
128
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
129
- define( 'CARTFLOWS_VER', '1.3.4' );
130
  define( 'CARTFLOWS_SLUG', 'cartflows' );
131
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
132
 
@@ -258,9 +250,6 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
258
  /* Public Utils */
259
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-utils.php';
260
 
261
- /* Public Session */
262
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-session.php';
263
-
264
  /* Public Global Namespace Function */
265
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
266
 
@@ -271,7 +260,6 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
271
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-default-meta.php';
272
 
273
  $this->utils = Cartflows_Utils::get_instance();
274
- $this->session = Cartflows_Session::get_instance();
275
  $this->options = Cartflows_Default_Meta::get_instance();
276
  }
277
 
33
  */
34
  public $logger = null;
35
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Member Variable
38
  *
118
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
119
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
120
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
121
+ define( 'CARTFLOWS_VER', '1.3.5' );
122
  define( 'CARTFLOWS_SLUG', 'cartflows' );
123
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
124
 
250
  /* Public Utils */
251
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-utils.php';
252
 
 
 
 
253
  /* Public Global Namespace Function */
254
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
255
 
260
  include_once CARTFLOWS_DIR . 'classes/class-cartflows-default-meta.php';
261
 
262
  $this->utils = Cartflows_Utils::get_instance();
 
263
  $this->options = Cartflows_Default_Meta::get_instance();
264
  }
265
 
classes/class-cartflows-metabox.php CHANGED
@@ -1,97 +1,97 @@
1
- <?php
2
- /**
3
- * Update Compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_Metabox' ) ) :
9
-
10
- /**
11
- * CartFlows Update initial setup
12
- *
13
- * @since 1.0.0
14
- */
15
- class Cartflows_Metabox {
16
-
17
- /**
18
- * Class instance.
19
- *
20
- * @access private
21
- * @var $instance Class instance.
22
- */
23
- private static $instance;
24
-
25
- /**
26
- * Initiator
27
- */
28
- public static function get_instance() {
29
- if ( ! isset( self::$instance ) ) {
30
- self::$instance = new self();
31
- }
32
- return self::$instance;
33
- }
34
-
35
- /**
36
- * Constructor
37
- */
38
- public function __construct() {
39
- add_action( 'admin_init', array( $this, 'add_wcf_order_metabox' ) );
40
- }
41
-
42
- /**
43
- *
44
- * Add Analytics Metabox
45
- *
46
- * @return void
47
- */
48
- public function add_wcf_order_metabox() {
49
-
50
- if ( ! isset( $_GET['cartflows_debug'] ) ) {
51
- return;
52
- }
53
-
54
- $debug = filter_input( INPUT_GET, 'cartflows_debug', FILTER_SANITIZE_STRING );
55
-
56
- if ( $debug ) {
57
- add_meta_box(
58
- 'wcf-order-details',
59
- __( 'Flow Details', 'cartflows' ),
60
- array( $this, 'flow_metabox_markup' ),
61
- 'shop_order',
62
- 'side',
63
- 'low'
64
- );
65
- }
66
-
67
- }
68
-
69
-
70
- /**
71
- * Flow metabox markup.
72
- */
73
- public function flow_metabox_markup() {
74
- global $post;
75
- $flow_id = wcf()->utils->get_flow_id_from_order( $post->ID );
76
- $checkout_id = wcf()->utils->get_checkout_id_from_order( $post->ID );
77
-
78
- $html_data = "
79
- <div>
80
- <p> This is for debugging only. </p>
81
- <p> <strong>Flow ID:</strong>: <a href='" . admin_url( 'post.php?post=' . $flow_id . '&action=edit' ) . "'> " . $flow_id . " </a> </p>
82
- <p> <strong>Checkout ID:</strong> <a href='" . admin_url( 'post.php?post=' . $checkout_id . '&action=edit' ) . "'> " . $checkout_id . ' </a></p>
83
- </div>
84
- ';
85
-
86
- echo $html_data;
87
- }
88
-
89
-
90
- }
91
-
92
- /**
93
- * Kicking this off by calling 'get_instance()' method
94
- */
95
- Cartflows_Metabox::get_instance();
96
-
97
- endif;
1
+ <?php
2
+ /**
3
+ * Update Compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_Metabox' ) ) :
9
+
10
+ /**
11
+ * CartFlows Update initial setup
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ class Cartflows_Metabox {
16
+
17
+ /**
18
+ * Class instance.
19
+ *
20
+ * @access private
21
+ * @var $instance Class instance.
22
+ */
23
+ private static $instance;
24
+
25
+ /**
26
+ * Initiator
27
+ */
28
+ public static function get_instance() {
29
+ if ( ! isset( self::$instance ) ) {
30
+ self::$instance = new self();
31
+ }
32
+ return self::$instance;
33
+ }
34
+
35
+ /**
36
+ * Constructor
37
+ */
38
+ public function __construct() {
39
+ add_action( 'admin_init', array( $this, 'add_wcf_order_metabox' ) );
40
+ }
41
+
42
+ /**
43
+ *
44
+ * Add Analytics Metabox
45
+ *
46
+ * @return void
47
+ */
48
+ public function add_wcf_order_metabox() {
49
+
50
+ if ( ! isset( $_GET['cartflows_debug'] ) ) { //phpcs:ignore
51
+ return;
52
+ }
53
+
54
+ $debug = filter_input( INPUT_GET, 'cartflows_debug', FILTER_SANITIZE_STRING );
55
+
56
+ if ( $debug ) {
57
+ add_meta_box(
58
+ 'wcf-order-details',
59
+ __( 'Flow Details', 'cartflows' ),
60
+ array( $this, 'flow_metabox_markup' ),
61
+ 'shop_order',
62
+ 'side',
63
+ 'low'
64
+ );
65
+ }
66
+
67
+ }
68
+
69
+
70
+ /**
71
+ * Flow metabox markup.
72
+ */
73
+ public function flow_metabox_markup() {
74
+ global $post;
75
+ $flow_id = wcf()->utils->get_flow_id_from_order( $post->ID );
76
+ $checkout_id = wcf()->utils->get_checkout_id_from_order( $post->ID );
77
+
78
+ $html_data = "
79
+ <div>
80
+ <p> This is for debugging only. </p>
81
+ <p> <strong>Flow ID:</strong>: <a href='" . admin_url( 'post.php?post=' . $flow_id . '&action=edit' ) . "'> " . $flow_id . " </a> </p>
82
+ <p> <strong>Checkout ID:</strong> <a href='" . admin_url( 'post.php?post=' . $checkout_id . '&action=edit' ) . "'> " . $checkout_id . ' </a></p>
83
+ </div>
84
+ ';
85
+
86
+ echo $html_data;
87
+ }
88
+
89
+
90
+ }
91
+
92
+ /**
93
+ * Kicking this off by calling 'get_instance()' method
94
+ */
95
+ Cartflows_Metabox::get_instance();
96
+
97
+ endif;
classes/class-cartflows-session.php DELETED
@@ -1,245 +0,0 @@
1
- <?php
2
- /**
3
- * Session
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Session {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Initiator
25
- */
26
- public static function get_instance() {
27
- if ( ! isset( self::$instance ) ) {
28
- self::$instance = new self();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- /**
34
- * Constructor
35
- */
36
- public function __construct() {
37
-
38
- }
39
-
40
- /**
41
- * Set session
42
- *
43
- * @param int $flow_id flow ID.
44
- * @param array $data trasient data.
45
- */
46
- public function set_session( $flow_id, $data = array() ) {
47
-
48
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
49
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
50
- } else {
51
- $key = $flow_id . '_' . md5( time() . wp_rand() );
52
- }
53
-
54
- // Set the browser cookie to expire in 30 minutes.
55
- setcookie( 'cartflows_session_' . $flow_id, $key, time() + 30 * MINUTE_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
56
-
57
- // Try to grab the transient from the database, if it exists.
58
- $transient = $data;
59
-
60
- // Store the transient, but expire in 30 minutes.
61
- set_transient( 'cartflows_data_' . $key, $transient, 30 * MINUTE_IN_SECONDS );
62
-
63
- wp_cache_set( 'cartflows_data_' . $key, $transient );
64
-
65
- wcf()->logger->log( 'Flow-' . $flow_id . ' Session Set : ' . $key . ' ' . wp_json_encode( $transient ) );
66
- }
67
-
68
- /**
69
- * Update session
70
- *
71
- * @param int $flow_id flow ID.
72
- * @param array $data trasient data.
73
- */
74
- public function update_session( $flow_id, $data = array() ) {
75
-
76
- if ( ! isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
77
-
78
- $this->set_session( $flow_id, $data );
79
- }
80
-
81
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
82
-
83
- // Try to grab the transient from the database, if it exists.
84
- $transient = get_transient( 'cartflows_data_' . $key );
85
-
86
- // Set the browser cookie to expire in 30 minutes.
87
- setcookie( 'cartflows_session_' . $flow_id, $key, time() + 30 * MINUTE_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
88
-
89
- // Store the transient, but expire in 30 minutes.
90
- set_transient( 'cartflows_data_' . $key, $transient, 30 * MINUTE_IN_SECONDS );
91
-
92
- wp_cache_set( 'cartflows_data_' . $key, $transient );
93
- }
94
-
95
- /**
96
- * Destroy session
97
- *
98
- * @param int $flow_id flow ID.
99
- */
100
- public function destroy_session( $flow_id ) {
101
-
102
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
103
-
104
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
105
-
106
- // Delete Transient.
107
- delete_transient( 'cartflows_data_' . $key );
108
-
109
- wp_cache_delete( 'cartflows_data_' . $key );
110
-
111
- unset( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
112
-
113
- // empty value and expiration one hour before.
114
- setcookie( 'cartflows_session_' . $flow_id, $key, time() - 3600, COOKIEPATH, COOKIE_DOMAIN );
115
-
116
- wcf()->logger->log( 'Flow-' . $flow_id . ' Session Destroyed : ' . $key );
117
- }
118
- }
119
-
120
- /**
121
- * Get session
122
- */
123
- public function get_session() {
124
-
125
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
126
-
127
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
128
-
129
- $data = get_transient( 'cartflows_data_' . $key );
130
- }
131
- }
132
-
133
- /**
134
- * Update transient data for cart flows.
135
- *
136
- * @param int $flow_id flow ID.
137
- * @param array $data data.
138
- */
139
- public function update_data( $flow_id, $data = array() ) {
140
-
141
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
142
-
143
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
144
-
145
- // Try to grab the transient from the database, if it exists.
146
- $transient = get_transient( 'cartflows_data_' . $key );
147
-
148
- if ( ! is_array( $transient ) ) {
149
- $transient = array();
150
- }
151
-
152
- $transient = array_merge( $transient, $data );
153
-
154
- // Store the transient, but expire in 30 minutes.
155
- set_transient( 'cartflows_data_' . $key, $transient, 30 * MINUTE_IN_SECONDS );
156
-
157
- wp_cache_set( 'cartflows_data_' . $key, $transient );
158
- }
159
- }
160
-
161
- /**
162
- * Update transient data for cart flows.
163
- *
164
- * @param int $flow_id flow ID.
165
- * @return bool
166
- */
167
- public function get_data( $flow_id ) {
168
-
169
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
170
-
171
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
172
-
173
- // Try to grab the transient from the database, if it exists.
174
- $transient = get_transient( 'cartflows_data_' . $key );
175
-
176
- if ( is_array( $transient ) ) {
177
- return $transient;
178
- }
179
- }
180
-
181
- return false;
182
- }
183
-
184
-
185
- /**
186
- * Check if session is active.
187
- *
188
- * @param int $flow_id flow ID.
189
- * @return bool
190
- */
191
- public function is_active_session( $flow_id ) {
192
-
193
- $is_active = false;
194
-
195
- if ( isset( $_GET['wcf-sk'] ) && isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
196
-
197
- $sk = sanitize_text_field( wp_unslash( $_GET['wcf-sk'] ) );
198
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
199
-
200
- if ( $sk === $key ) {
201
-
202
- if ( isset( $_GET['wcf-order'] ) && isset( $_GET['wcf-key'] ) ) {
203
-
204
- // Get the order.
205
- $order_id = empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] );
206
- $order_key = empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
207
-
208
- if ( $order_id > 0 ) {
209
-
210
- $order = wc_get_order( $order_id );
211
-
212
- if ( $order && $order->get_order_key() === $order_key ) {
213
- $is_active = true;
214
- }
215
- }
216
- }
217
- }
218
- }
219
-
220
- return $is_active;
221
- }
222
-
223
- /**
224
- * Get session key for flow
225
- *
226
- * @param int $flow_id flow ID.
227
- * @return bool
228
- */
229
- public function get_session_key( $flow_id ) {
230
-
231
- if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
232
-
233
- $key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
234
-
235
- return $key;
236
- }
237
-
238
- return false;
239
- }
240
- }
241
-
242
- /**
243
- * Kicking this off by calling 'get_instance()' method
244
- */
245
- Cartflows_Session::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-cartflows-utils.php CHANGED
@@ -1,425 +1,425 @@
1
- <?php
2
- /**
3
- * Utils.
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit; // Exit if accessed directly.
10
- }
11
-
12
- /**
13
- * Class Cartflows_Utils.
14
- */
15
- class Cartflows_Utils {
16
-
17
- /**
18
- * Member Variable
19
- *
20
- * @var instance
21
- */
22
- private static $instance;
23
-
24
- /**
25
- * Initiator
26
- */
27
- public static function get_instance() {
28
- if ( ! isset( self::$instance ) ) {
29
- self::$instance = new self();
30
- }
31
- return self::$instance;
32
- }
33
-
34
- /**
35
- * Constructor
36
- */
37
- public function __construct() {
38
- }
39
-
40
- /**
41
- * Get current post type
42
- *
43
- * @param string $post_type post type.
44
- * @return string
45
- */
46
- public function current_post_type( $post_type = '' ) {
47
-
48
- if ( '' === $post_type ) {
49
- $post_type = get_post_type();
50
- }
51
-
52
- return $post_type;
53
- }
54
-
55
- /**
56
- * Check if post type is of step.
57
- *
58
- * @param string $post_type post type.
59
- * @return bool
60
- */
61
- public function is_step_post_type( $post_type = '' ) {
62
-
63
- if ( $this->get_step_post_type() === $this->current_post_type( $post_type ) ) {
64
-
65
- return true;
66
- }
67
-
68
- return false;
69
- }
70
-
71
- /**
72
- * Check if post type is of flow.
73
- *
74
- * @param string $post_type post type.
75
- * @return bool
76
- */
77
- public function is_flow_post_type( $post_type = '' ) {
78
-
79
- if ( $this->get_flow_post_type() === $this->current_post_type( $post_type ) ) {
80
-
81
- return true;
82
- }
83
-
84
- return false;
85
- }
86
-
87
- /**
88
- * Get post type of step.
89
- *
90
- * @return string
91
- */
92
- public function get_step_post_type() {
93
-
94
- return CARTFLOWS_STEP_POST_TYPE;
95
- }
96
-
97
- /**
98
- * Get post type of flow.
99
- *
100
- * @return string
101
- */
102
- public function get_flow_post_type() {
103
-
104
- return CARTFLOWS_FLOW_POST_TYPE;
105
- }
106
-
107
- /**
108
- * Get flow id
109
- *
110
- * @return int
111
- */
112
- public function get_flow_id() {
113
-
114
- global $post;
115
-
116
- return get_post_meta( $post->ID, 'wcf-flow-id', true );
117
- }
118
-
119
- /**
120
- * Get flow id by step
121
- *
122
- * @param int $step_id step ID.
123
- * @return int
124
- */
125
- public function get_flow_id_from_step_id( $step_id ) {
126
-
127
- return get_post_meta( $step_id, 'wcf-flow-id', true );
128
- }
129
-
130
- /**
131
- * Get flow steps by id
132
- *
133
- * @param int $flow_id flow ID.
134
- * @return int
135
- */
136
- public function get_flow_steps( $flow_id ) {
137
-
138
- $steps = get_post_meta( $flow_id, 'wcf-steps', true );
139
-
140
- if ( is_array( $steps ) && ! empty( $steps ) ) {
141
- return $steps;
142
- }
143
-
144
- return false;
145
- }
146
-
147
- /**
148
- * Get template type of step
149
- *
150
- * @param int $step_id step ID.
151
- * @return int
152
- */
153
- public function get_step_type( $step_id ) {
154
-
155
- return get_post_meta( $step_id, 'wcf-step-type', true );
156
- }
157
-
158
- /**
159
- * Get next id for step
160
- *
161
- * @param int $flow_id flow ID.
162
- * @param int $step_id step ID.
163
- * @return bool
164
- */
165
- public function get_next_step_id( $flow_id, $step_id ) {
166
-
167
- $steps = $this->get_flow_steps( $flow_id );
168
- $step_id = intval( $step_id );
169
-
170
- if ( ! $steps ) {
171
- return false;
172
- }
173
-
174
- foreach ( $steps as $i => $step ) {
175
-
176
- if ( intval( $step['id'] ) === $step_id ) {
177
-
178
- $next_i = $i + 1;
179
-
180
- if ( isset( $steps[ $next_i ] ) ) {
181
-
182
- $navigation = $steps[ $next_i ];
183
-
184
- return intval( $navigation['id'] );
185
- }
186
-
187
- break;
188
- }
189
- }
190
-
191
- return false;
192
- }
193
-
194
- /**
195
- * Get next id for step
196
- *
197
- * @param int $order_id order ID.
198
- * @return int
199
- */
200
- public function get_flow_id_from_order( $order_id ) {
201
-
202
- $flow_id = get_post_meta( $order_id, '_wcf_flow_id', true );
203
-
204
- return intval( $flow_id );
205
- }
206
-
207
- /**
208
- * Get checkout id for order
209
- *
210
- * @param int $order_id order ID.
211
- * @return int
212
- */
213
- public function get_checkout_id_from_order( $order_id ) {
214
-
215
- $checkout_id = get_post_meta( $order_id, '_wcf_checkout_id', true );
216
-
217
- return intval( $checkout_id );
218
- }
219
-
220
- /**
221
- * We are using this function mostly in ajax on checkout page
222
- *
223
- * @return bool
224
- */
225
- public function get_checkout_id_from_post_data() {
226
-
227
- if ( isset( $_POST['_wcf_checkout_id'] ) ) {
228
-
229
- $checkout_id = filter_var( wp_unslash( $_POST['_wcf_checkout_id'] ), FILTER_SANITIZE_NUMBER_INT );
230
-
231
- return intval( $checkout_id );
232
- }
233
-
234
- return false;
235
- }
236
-
237
- /**
238
- * We are using this function mostly in ajax on checkout page
239
- *
240
- * @return bool
241
- */
242
- public function get_flow_id_from_post_data() {
243
-
244
- if ( isset( $_POST['_wcf_flow_id'] ) ) {
245
-
246
- $flow_id = filter_var( wp_unslash( $_POST['_wcf_flow_id'] ), FILTER_SANITIZE_NUMBER_INT );
247
-
248
- return intval( $flow_id );
249
- }
250
-
251
- return false;
252
- }
253
-
254
- /**
255
- * Check for thank you page
256
- *
257
- * @param int $step_id step ID.
258
- * @return bool
259
- */
260
- public function check_is_thankyou_page( $step_id ) {
261
-
262
- $step_type = $this->get_step_type( $step_id );
263
-
264
- if ( 'thankyou' === $step_type ) {
265
-
266
- return true;
267
- }
268
-
269
- return false;
270
- }
271
-
272
- /**
273
- * Check for offer page
274
- *
275
- * @param int $step_id step ID.
276
- * @return bool
277
- */
278
- public function check_is_offer_page( $step_id ) {
279
-
280
- $step_type = $this->get_step_type( $step_id );
281
-
282
- if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
283
-
284
- return true;
285
- }
286
-
287
- return false;
288
- }
289
-
290
- /**
291
- * Check if loaded page requires woo.
292
- *
293
- * @return bool
294
- */
295
- public function check_is_woo_required_page() {
296
-
297
- global $post;
298
- $step_id = $post->ID;
299
- $woo_not_required_type = array( 'landing' );
300
- $step_type = $this->get_step_type( $step_id );
301
- return ( ! in_array( $step_type, $woo_not_required_type, true ) );
302
- }
303
-
304
- /**
305
- * Define constant for cache
306
- *
307
- * @return void
308
- */
309
- public function do_not_cache() {
310
-
311
- wcf_maybe_define_constant( 'DONOTCACHEPAGE', true );
312
- wcf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
313
- wcf_maybe_define_constant( 'DONOTCACHEDB', true );
314
-
315
- nocache_headers();
316
- }
317
-
318
- /**
319
- * Get linking url
320
- *
321
- * @param array $args query args.
322
- * @return string
323
- */
324
- public function get_linking_url( $args = array() ) {
325
-
326
- $url = get_home_url();
327
-
328
- $url = add_query_arg( $args, $url );
329
-
330
- return $url;
331
- }
332
-
333
- /**
334
- * Get assets urls
335
- *
336
- * @return array
337
- * @since 1.1.6
338
- */
339
- public function get_assets_path() {
340
-
341
- $rtl = '';
342
-
343
- if ( is_rtl() ) {
344
- $rtl = '-rtl';
345
- }
346
-
347
- $file_prefix = '';
348
- $dir_name = '';
349
-
350
- $is_min = apply_filters( 'cartflows_load_min_assets', false );
351
-
352
- if ( $is_min ) {
353
- $file_prefix = '.min';
354
- $dir_name = 'min-';
355
- }
356
-
357
- $js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
358
- $css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
359
-
360
- return array(
361
- 'css' => $css_gen_path,
362
- 'js' => $js_gen_path,
363
- 'file_prefix' => $file_prefix,
364
- 'rtl' => $rtl,
365
- );
366
- }
367
-
368
- /**
369
- * Get assets css url
370
- *
371
- * @param string $file file name.
372
- * @return string
373
- * @since 1.1.6
374
- */
375
- public function get_css_url( $file ) {
376
-
377
- $assets_vars = wcf()->assets_vars;
378
-
379
- $url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
380
-
381
- return $url;
382
- }
383
-
384
- /**
385
- * Get assets js url
386
- *
387
- * @param string $file file name.
388
- * @return string
389
- * @since 1.1.6
390
- */
391
- public function get_js_url( $file ) {
392
-
393
- $assets_vars = wcf()->assets_vars;
394
-
395
- $url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
396
-
397
- return $url;
398
- }
399
- }
400
-
401
- /**
402
- * Get a specific property of an array without needing to check if that property exists.
403
- *
404
- * Provide a default value if you want to return a specific value if the property is not set.
405
- *
406
- * @param array $array Array from which the property's value should be retrieved.
407
- * @param string $prop Name of the property to be retrieved.
408
- * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
409
- *
410
- * @return null|string|mixed The value
411
- */
412
- function wcf_get_prop( $array, $prop, $default = null ) {
413
-
414
- if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
415
- return $default;
416
- }
417
-
418
- if ( isset( $array[ $prop ] ) ) {
419
- $value = $array[ $prop ];
420
- } else {
421
- $value = '';
422
- }
423
-
424
- return empty( $value ) && null !== $default ? $default : $value;
425
- }
1
+ <?php
2
+ /**
3
+ * Utils.
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+
12
+ /**
13
+ * Class Cartflows_Utils.
14
+ */
15
+ class Cartflows_Utils {
16
+
17
+ /**
18
+ * Member Variable
19
+ *
20
+ * @var instance
21
+ */
22
+ private static $instance;
23
+
24
+ /**
25
+ * Initiator
26
+ */
27
+ public static function get_instance() {
28
+ if ( ! isset( self::$instance ) ) {
29
+ self::$instance = new self();
30
+ }
31
+ return self::$instance;
32
+ }
33
+
34
+ /**
35
+ * Constructor
36
+ */
37
+ public function __construct() {
38
+ }
39
+
40
+ /**
41
+ * Get current post type
42
+ *
43
+ * @param string $post_type post type.
44
+ * @return string
45
+ */
46
+ public function current_post_type( $post_type = '' ) {
47
+
48
+ if ( '' === $post_type ) {
49
+ $post_type = get_post_type();
50
+ }
51
+
52
+ return $post_type;
53
+ }
54
+
55
+ /**
56
+ * Check if post type is of step.
57
+ *
58
+ * @param string $post_type post type.
59
+ * @return bool
60
+ */
61
+ public function is_step_post_type( $post_type = '' ) {
62
+
63
+ if ( $this->get_step_post_type() === $this->current_post_type( $post_type ) ) {
64
+
65
+ return true;
66
+ }
67
+
68
+ return false;
69
+ }
70
+
71
+ /**
72
+ * Check if post type is of flow.
73
+ *
74
+ * @param string $post_type post type.
75
+ * @return bool
76
+ */
77
+ public function is_flow_post_type( $post_type = '' ) {
78
+
79
+ if ( $this->get_flow_post_type() === $this->current_post_type( $post_type ) ) {
80
+
81
+ return true;
82
+ }
83
+
84
+ return false;
85
+ }
86
+
87
+ /**
88
+ * Get post type of step.
89
+ *
90
+ * @return string
91
+ */
92
+ public function get_step_post_type() {
93
+
94
+ return CARTFLOWS_STEP_POST_TYPE;
95
+ }
96
+
97
+ /**
98
+ * Get post type of flow.
99
+ *
100
+ * @return string
101
+ */
102
+ public function get_flow_post_type() {
103
+
104
+ return CARTFLOWS_FLOW_POST_TYPE;
105
+ }
106
+
107
+ /**
108
+ * Get flow id
109
+ *
110
+ * @return int
111
+ */
112
+ public function get_flow_id() {
113
+
114
+ global $post;
115
+
116
+ return get_post_meta( $post->ID, 'wcf-flow-id', true );
117
+ }
118
+
119
+ /**
120
+ * Get flow id by step
121
+ *
122
+ * @param int $step_id step ID.
123
+ * @return int
124
+ */
125
+ public function get_flow_id_from_step_id( $step_id ) {
126
+
127
+ return get_post_meta( $step_id, 'wcf-flow-id', true );
128
+ }
129
+
130
+ /**
131
+ * Get flow steps by id
132
+ *
133
+ * @param int $flow_id flow ID.
134
+ * @return int
135
+ */
136
+ public function get_flow_steps( $flow_id ) {
137
+
138
+ $steps = get_post_meta( $flow_id, 'wcf-steps', true );
139
+
140
+ if ( is_array( $steps ) && ! empty( $steps ) ) {
141
+ return $steps;
142
+ }
143
+
144
+ return false;
145
+ }
146
+
147
+ /**
148
+ * Get template type of step
149
+ *
150
+ * @param int $step_id step ID.
151
+ * @return int
152
+ */
153
+ public function get_step_type( $step_id ) {
154
+
155
+ return get_post_meta( $step_id, 'wcf-step-type', true );
156
+ }
157
+
158
+ /**
159
+ * Get next id for step
160
+ *
161
+ * @param int $flow_id flow ID.
162
+ * @param int $step_id step ID.
163
+ * @return bool
164
+ */
165
+ public function get_next_step_id( $flow_id, $step_id ) {
166
+
167
+ $steps = $this->get_flow_steps( $flow_id );
168
+ $step_id = intval( $step_id );
169
+
170
+ if ( ! $steps ) {
171
+ return false;
172
+ }
173
+
174
+ foreach ( $steps as $i => $step ) {
175
+
176
+ if ( intval( $step['id'] ) === $step_id ) {
177
+
178
+ $next_i = $i + 1;
179
+
180
+ if ( isset( $steps[ $next_i ] ) ) {
181
+
182
+ $navigation = $steps[ $next_i ];
183
+
184
+ return intval( $navigation['id'] );
185
+ }
186
+
187
+ break;
188
+ }
189
+ }
190
+
191
+ return false;
192
+ }
193
+
194
+ /**
195
+ * Get next id for step
196
+ *
197
+ * @param int $order_id order ID.
198
+ * @return int
199
+ */
200
+ public function get_flow_id_from_order( $order_id ) {
201
+
202
+ $flow_id = get_post_meta( $order_id, '_wcf_flow_id', true );
203
+
204
+ return intval( $flow_id );
205
+ }
206
+
207
+ /**
208
+ * Get checkout id for order
209
+ *
210
+ * @param int $order_id order ID.
211
+ * @return int
212
+ */
213
+ public function get_checkout_id_from_order( $order_id ) {
214
+
215
+ $checkout_id = get_post_meta( $order_id, '_wcf_checkout_id', true );
216
+
217
+ return intval( $checkout_id );
218
+ }
219
+
220
+ /**
221
+ * We are using this function mostly in ajax on checkout page
222
+ *
223
+ * @return bool
224
+ */
225
+ public function get_checkout_id_from_post_data() {
226
+
227
+ if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
228
+
229
+ $checkout_id = filter_var( wp_unslash( $_POST['_wcf_checkout_id'] ), FILTER_SANITIZE_NUMBER_INT ); //phpcs:ignore
230
+
231
+ return intval( $checkout_id );
232
+ }
233
+
234
+ return false;
235
+ }
236
+
237
+ /**
238
+ * We are using this function mostly in ajax on checkout page
239
+ *
240
+ * @return bool
241
+ */
242
+ public function get_flow_id_from_post_data() {
243
+
244
+ if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
245
+
246
+ $flow_id = filter_var( wp_unslash( $_POST['_wcf_flow_id'] ), FILTER_SANITIZE_NUMBER_INT ); //phpcs:ignore
247
+
248
+ return intval( $flow_id );
249
+ }
250
+
251
+ return false;
252
+ }
253
+
254
+ /**
255
+ * Check for thank you page
256
+ *
257
+ * @param int $step_id step ID.
258
+ * @return bool
259
+ */
260
+ public function check_is_thankyou_page( $step_id ) {
261
+
262
+ $step_type = $this->get_step_type( $step_id );
263
+
264
+ if ( 'thankyou' === $step_type ) {
265
+
266
+ return true;
267
+ }
268
+
269
+ return false;
270
+ }
271
+
272
+ /**
273
+ * Check for offer page
274
+ *
275
+ * @param int $step_id step ID.
276
+ * @return bool
277
+ */
278
+ public function check_is_offer_page( $step_id ) {
279
+
280
+ $step_type = $this->get_step_type( $step_id );
281
+
282
+ if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
283
+
284
+ return true;
285
+ }
286
+
287
+ return false;
288
+ }
289
+
290
+ /**
291
+ * Check if loaded page requires woo.
292
+ *
293
+ * @return bool
294
+ */
295
+ public function check_is_woo_required_page() {
296
+
297
+ global $post;
298
+ $step_id = $post->ID;
299
+ $woo_not_required_type = array( 'landing' );
300
+ $step_type = $this->get_step_type( $step_id );
301
+ return ( ! in_array( $step_type, $woo_not_required_type, true ) );
302
+ }
303
+
304
+ /**
305
+ * Define constant for cache
306
+ *
307
+ * @return void
308
+ */
309
+ public function do_not_cache() {
310
+
311
+ wcf_maybe_define_constant( 'DONOTCACHEPAGE', true );
312
+ wcf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
313
+ wcf_maybe_define_constant( 'DONOTCACHEDB', true );
314
+
315
+ nocache_headers();
316
+ }
317
+
318
+ /**
319
+ * Get linking url
320
+ *
321
+ * @param array $args query args.
322
+ * @return string
323
+ */
324
+ public function get_linking_url( $args = array() ) {
325
+
326
+ $url = get_home_url();
327
+
328
+ $url = add_query_arg( $args, $url );
329
+
330
+ return $url;
331
+ }
332
+
333
+ /**
334
+ * Get assets urls
335
+ *
336
+ * @return array
337
+ * @since 1.1.6
338
+ */
339
+ public function get_assets_path() {
340
+
341
+ $rtl = '';
342
+
343
+ if ( is_rtl() ) {
344
+ $rtl = '-rtl';
345
+ }
346
+
347
+ $file_prefix = '';
348
+ $dir_name = '';
349
+
350
+ $is_min = apply_filters( 'cartflows_load_min_assets', false );
351
+
352
+ if ( $is_min ) {
353
+ $file_prefix = '.min';
354
+ $dir_name = 'min-';
355
+ }
356
+
357
+ $js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
358
+ $css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
359
+
360
+ return array(
361
+ 'css' => $css_gen_path,
362
+ 'js' => $js_gen_path,
363
+ 'file_prefix' => $file_prefix,
364
+ 'rtl' => $rtl,
365
+ );
366
+ }
367
+
368
+ /**
369
+ * Get assets css url
370
+ *
371
+ * @param string $file file name.
372
+ * @return string
373
+ * @since 1.1.6
374
+ */
375
+ public function get_css_url( $file ) {
376
+
377
+ $assets_vars = wcf()->assets_vars;
378
+
379
+ $url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
380
+
381
+ return $url;
382
+ }
383
+
384
+ /**
385
+ * Get assets js url
386
+ *
387
+ * @param string $file file name.
388
+ * @return string
389
+ * @since 1.1.6
390
+ */
391
+ public function get_js_url( $file ) {
392
+
393
+ $assets_vars = wcf()->assets_vars;
394
+
395
+ $url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
396
+
397
+ return $url;
398
+ }
399
+ }
400
+
401
+ /**
402
+ * Get a specific property of an array without needing to check if that property exists.
403
+ *
404
+ * Provide a default value if you want to return a specific value if the property is not set.
405
+ *
406
+ * @param array $array Array from which the property's value should be retrieved.
407
+ * @param string $prop Name of the property to be retrieved.
408
+ * @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
409
+ *
410
+ * @return null|string|mixed The value
411
+ */
412
+ function wcf_get_prop( $array, $prop, $default = null ) {
413
+
414
+ if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
415
+ return $default;
416
+ }
417
+
418
+ if ( isset( $array[ $prop ] ) ) {
419
+ $value = $array[ $prop ];
420
+ } else {
421
+ $value = '';
422
+ }
423
+
424
+ return empty( $value ) && null !== $default ? $default : $value;
425
+ }
classes/class-cartflows-wizard.php CHANGED
@@ -1,679 +1,679 @@
1
- <?php
2
- /**
3
- * CartFlows- Onboarding Wizard
4
- *
5
- * @package cartflows
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- if ( ! class_exists( 'CartFlows_Wizard' ) ) :
13
-
14
- /**
15
- * CartFlows_Wizard class.
16
- */
17
- class CartFlows_Wizard {
18
-
19
- /**
20
- * Hook in tabs.
21
- */
22
- public function __construct() {
23
-
24
- if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
25
- add_action( 'admin_menu', array( $this, 'admin_menus' ) );
26
- add_action( 'admin_init', array( $this, 'setup_wizard' ) );
27
- add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
28
- add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
29
- add_action( 'wp_ajax_page_builder_save_option', array( $this, 'save_page_builder_option' ) );
30
- add_action( 'admin_head', array( $this, 'add_mautic_form_script' ) );
31
- add_action( 'woocommerce_installed', array( $this, 'disable_woo_setup_redirect' ) );
32
-
33
- add_action( 'wp_ajax_wcf_activate_wc_plugins', array( $this, 'activate_wc_plugins' ) );
34
-
35
- add_action( 'admin_init', array( $this, 'hide_notices' ) );
36
-
37
- }
38
- }
39
-
40
-
41
- /**
42
- * Hide a notice if the GET variable is set.
43
- */
44
- public function hide_notices() {
45
-
46
- if ( ! isset( $_GET['wcf-hide-notice'] ) ) {
47
- return;
48
- }
49
-
50
- $wcf_hide_notice = filter_input( INPUT_GET, 'wcf-hide-notice', FILTER_SANITIZE_STRING );
51
- $_wcf_notice_nonce = filter_input( INPUT_GET, '_wcf_notice_nonce', FILTER_SANITIZE_STRING );
52
-
53
- if ( $wcf_hide_notice && $_wcf_notice_nonce && wp_verify_nonce( sanitize_key( wp_unslash( $_wcf_notice_nonce ) ), 'wcf_hide_notices_nonce' ) ) {
54
- update_option( 'wcf_setup_skipped', true );
55
- }
56
- }
57
-
58
- /**
59
- * Disable the woo redirect for new setup.
60
- */
61
- public function disable_woo_setup_redirect() {
62
-
63
- if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) {
64
- return;
65
- }
66
-
67
- delete_transient( '_wc_activation_redirect' );
68
- }
69
-
70
- /**
71
- * Show action links on the plugin screen.
72
- *
73
- * @since 1.0.0
74
- * @return void
75
- */
76
- public function show_setup_wizard() {
77
-
78
- $status = get_option( 'wcf_setup_complete', false );
79
- $skip_setup = get_option( 'wcf_setup_skipped', false );
80
-
81
- if ( false === $status && ! $skip_setup ) { ?>
82
- <div class="notice notice-info">
83
- <p><b><?php esc_html_e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
84
- <p><?php esc_html_e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
85
- <p>
86
- <a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php esc_html_e( 'Start Wizard', 'cartflows' ); ?></a>
87
- <a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'cartflows' ); ?></a>
88
- </p>
89
- </div>
90
- <?php
91
- }
92
- }
93
-
94
- /**
95
- * Add admin menus/screens.
96
- */
97
- public function admin_menus() {
98
-
99
- if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) {
100
- return;
101
- }
102
-
103
- add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
104
- }
105
-
106
- /**
107
- * Show the setup wizard.
108
- */
109
- public function setup_wizard() {
110
-
111
- if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) {
112
- return;
113
- }
114
-
115
- $this->steps = array(
116
- 'basic-config' => array(
117
- 'name' => __( 'Welcome', 'cartflows' ),
118
- 'view' => array( $this, 'welcome_step' ),
119
- 'handler' => array( $this, 'welcome_step_save' ),
120
- ),
121
- 'page-builder' => array(
122
- 'name' => __( 'Page Builder', 'cartflows' ),
123
- 'view' => array( $this, 'page_builder_step' ),
124
- ),
125
- 'checkout' => array(
126
- 'name' => __( 'Checkout', 'cartflows' ),
127
- 'view' => array( $this, 'checkout_step' ),
128
- ),
129
- 'training' => array(
130
- 'name' => __( 'Training', 'cartflows' ),
131
- 'view' => array( $this, 'training_step' ),
132
- ),
133
- 'setup-ready' => array(
134
- 'name' => __( 'Ready!', 'cartflows' ),
135
- 'view' => array( $this, 'ready_step' ),
136
- 'handler' => '',
137
- ),
138
- );
139
-
140
- $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
141
-
142
- wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
143
- wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
144
-
145
- wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
146
-
147
- wp_localize_script( 'cartflows-setup', 'cartflows_setup_vars', self::localize_vars() );
148
-
149
- wp_enqueue_media();
150
-
151
- if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
152
- call_user_func( $this->steps[ $this->step ]['handler'] );
153
- }
154
-
155
- ob_start();
156
- $this->setup_wizard_header();
157
- $this->setup_wizard_steps();
158
- $this->setup_wizard_content();
159
- $this->setup_wizard_footer();
160
- exit;
161
- }
162
-
163
- /**
164
- * Get current step slug
165
- */
166
- public function get_current_step_slug() {
167
- $keys = array_keys( $this->steps );
168
- return $keys[ array_search( $this->step, array_keys( $this->steps ), true ) ];
169
- }
170
-
171
- /**
172
- * Get previous step link
173
- */
174
- public function get_prev_step_link() {
175
- $keys = array_keys( $this->steps );
176
- return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) - 1 ] );
177
- }
178
-
179
- /**
180
- * Get next step link
181
- */
182
- public function get_next_step_link() {
183
- $keys = array_keys( $this->steps );
184
- return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ] );
185
- }
186
-
187
- /**
188
- * Get next step link
189
- */
190
- public function get_next_step_plain_link() {
191
- $keys = array_keys( $this->steps );
192
- $step_index = array_search( $this->step, $keys, true );
193
- $step_index = ( count( $keys ) == $step_index + 1 ) ? $step_index : $step_index + 1;
194
- $step = $keys[ $step_index ];
195
- return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
196
- }
197
-
198
- /**
199
- * Setup Wizard Header.
200
- */
201
- public function setup_wizard_header() {
202
- ?>
203
- <!DOCTYPE html>
204
- <html>
205
- <head>
206
- <meta name="viewport" content="width=device-width" />
207
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
208
- <title><?php esc_html_e( 'CartFlows Setup', 'cartflows' ); ?></title>
209
-
210
- <script type="text/javascript">
211
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
212
- var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
213
- var pagenow = '';
214
- </script>
215
- <?php wp_print_scripts( array( 'cartflows-setup' ) ); ?>
216
- <?php do_action( 'admin_print_styles' ); ?>
217
- <?php do_action( 'admin_head' ); ?>
218
- </head>
219
- <body class="cartflows-setup wp-core-ui cartflows-step-<?php echo esc_attr( $this->get_current_step_slug() ); ?>">
220
- <div id="cartflows-logo">
221
- <img height="40" class="wcf-logo" src="<?php echo CARTFLOWS_URL . 'assets/images/cartflows-logo.svg'; ?>" />
222
- </div>
223
- <?php
224
- }
225
-
226
- /**
227
- * Setup Wizard Footer.
228
- */
229
- public function setup_wizard_footer() {
230
-
231
- $admin_url = admin_url( 'admin.php?page=cartflows_settings' );
232
- ?>
233
- <div class="close-button-wrapper">
234
- <a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
235
- </div>
236
- </body>
237
- </html>
238
- <?php
239
- }
240
-
241
- /**
242
- * Output the steps.
243
- */
244
- public function setup_wizard_steps() {
245
-
246
- $ouput_steps = $this->steps;
247
- ?>
248
- <ol class="cartflows-setup-steps">
249
- <?php
250
- foreach ( $ouput_steps as $step_key => $step ) :
251
- $classes = '';
252
- $activated = false;
253
- if ( $step_key === $this->step ) {
254
- $classes = 'active';
255
- $activated = true;
256
- } elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
257
- $classes = 'done';
258
- $activated = true;
259
- }
260
- ?>
261
- <li class="<?php echo esc_attr( $classes ); ?>">
262
- <span><?php echo esc_html( $step['name'] ); ?></span>
263
- </li>
264
- <?php endforeach; ?>
265
- </ol>
266
- <?php
267
- }
268
-
269
- /**
270
- * Output the content for the current step.
271
- */
272
- public function setup_wizard_content() {
273
- ?>
274
- <input type="hidden" class="wcf-redirect-link" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" >
275
- <?php
276
-
277
- echo '<div class="cartflows-setup-content">';
278
- call_user_func( $this->steps[ $this->step ]['view'] );
279
- echo '</div>';
280
- }
281
-
282
- /**
283
- * Introduction step.
284
- */
285
- public function welcome_step() {
286
- ?>
287
- <h1><?php esc_html_e( 'Welcome to CartFlows!', 'cartflows' ); ?></h1>
288
- <p><?php esc_html_e( 'Thank you for choosing CartFlows to get more leads, increase conversions, & maximize profits. This short setup wizard will guide you though configuring CartFlows and creating your first funnel.', 'cartflows' ); ?></p>
289
- <form method="post">
290
- <div class="cartflows-setup-actions step">
291
- <div class="button-prev-wrap">
292
- </div>
293
- <div class="button-next-wrap">
294
- <input type="submit" class="uct-activate button-primary button button-large " value="<?php esc_html_e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
295
- </div>
296
- <?php wp_nonce_field( 'cartflow-setup' ); ?>
297
- </div>
298
- </form>
299
- <?php
300
- }
301
-
302
- /**
303
- * Save Locale Settings.
304
- */
305
- public function welcome_step_save() {
306
- check_admin_referer( 'cartflow-setup' );
307
-
308
- // Update site title & tagline.
309
- $redirect_url = $this->get_next_step_link();
310
-
311
- wp_safe_redirect( esc_url_raw( $redirect_url ) );
312
- exit;
313
- }
314
-
315
- /**
316
- * Locale settings
317
- */
318
- public function page_builder_step() {
319
- ?>
320
-
321
- <h1><?php esc_html_e( 'Page Builder Setup', 'cartflows' ); ?></h1>
322
- <p class="description"><?php esc_html_e( 'Please select a page builder you would like to use with CartFlows.', 'cartflows' ); ?></p>
323
- <form method="post">
324
- <table class="cartflows-table widefat">
325
- <tr class="cartflows-row">
326
- <td class="cartflows-row-heading">
327
- <label><?php esc_html_e( 'Select Page Builder', 'cartflows' ); ?></label>
328
- </td>
329
- <td class="cartflows-row-content">
330
- <?php
331
- $installed_plugins = get_plugins();
332
- $plugins = array(
333
- array(
334
- 'title' => __( 'Elementor', 'cartflows' ),
335
- 'value' => 'elementor',
336
- 'data' => array(
337
- 'slug' => 'elementor',
338
- 'init' => 'elementor/elementor.php',
339
- 'active' => is_plugin_active( 'elementor/elementor.php' ) ? 'yes' : 'no',
340
- 'install' => isset( $installed_plugins['elementor/elementor.php'] ) ? 'yes' : 'no',
341
- ),
342
- ),
343
- array(
344
- 'title' => __( 'Beaver Builder Plugin (Lite Version)', 'cartflows' ),
345
- 'value' => 'beaver-builder',
346
- 'data' => array(
347
- 'slug' => 'beaver-builder-lite-version',
348
- 'init' => 'beaver-builder-lite-version/fl-builder.php',
349
- 'active' => is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ? 'yes' : 'no',
350
- 'install' => isset( $installed_plugins['beaver-builder-lite-version/fl-builder.php'] ) ? 'yes' : 'no',
351
- ),
352
- ),
353
- array(
354
- 'title' => __( 'Divi', 'cartflows' ),
355
- 'value' => 'divi',
356
- 'data' => array(
357
- 'slug' => 'divi',
358
- 'init' => 'divi',
359
- 'active' => 'yes',
360
- 'install' => 'NA',
361
- ),
362
- ),
363
- array(
364
- 'title' => __( 'Other', 'cartflows' ),
365
- 'value' => 'other',
366
- 'data' => array(
367
- 'slug' => 'other',
368
- 'init' => false,
369
- 'active' => 'yes',
370
- 'install' => 'NA',
371
- ),
372
- ),
373
- );
374
- ?>
375
- <input type="hidden" name="save-pb-input" id="save-pb-option" value="1" />
376
- <select name="page-builder" class="page-builder-list" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>">
377
- <?php
378
- foreach ( $plugins as $key => $plugin ) {
379
- echo '<option value="' . esc_attr( $plugin['value'] ) . '" data-install="' . esc_attr( $plugin['data']['install'] ) . '" data-active="' . esc_attr( $plugin['data']['active'] ) . '" data-slug="' . esc_attr( $plugin['data']['slug'] ) . '" data-init="' . esc_attr( $plugin['data']['init'] ) . '">' . esc_html( $plugin['title'] ) . '</option>';
380
- }
381
- ?>
382
- </select>
383
- </td>
384
- </tr>
385
- </table>
386
- <p><?php esc_html_e( 'While CartFlows Should work with most page builders, we offer templates for the above page builders.', 'cartflows' ); ?></p>
387
- <div class="cartflows-setup-actions step">
388
- <div class="button-prev-wrap">
389
- <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
390
- </div>
391
- <div class="button-next-wrap">
392
- <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next" ><?php esc_html_e( 'Skip this step', 'cartflows' ); ?></a>
393
- <a href="#" class="button button-primary wcf-install-plugins"><?php esc_html_e( 'Next »', 'cartflows' ); ?></a>
394
- </div>
395
- <?php wp_nonce_field( 'cartflow-setup' ); ?>
396
- </div>
397
- </form>
398
- <?php
399
- }
400
-
401
- /**
402
- * Render checkout step.
403
- */
404
- public function checkout_step() {
405
-
406
- $installed_plugins = get_plugins();
407
- $is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? 'yes' : 'no';
408
- $is_wcf_ca_installed = isset( $installed_plugins['woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php'] ) ? 'yes' : 'no';
409
- $is_active = class_exists( 'WooCommerce' ) ? 'yes' : 'no';
410
- $is_wcf_ca_active = class_exists( 'CARTFLOWS_CA_Loader' ) ? 'yes' : 'no';
411
- ?>
412
- <h1><?php esc_html_e( 'Choose a checkout', 'cartflows' ); ?></h1>
413
- <div class="cartflows-setup-message">
414
- <p>
415
- <?php esc_html_e( 'While CartFlows is designed to use WooCommerce sell digital and physical products, not all funnels need a checkout system.', 'cartflows' ); ?>
416
- </p>
417
- <h4 class="cartflows-setup-message-title"><?php esc_html_e( 'Would you like to install WooCommerce to sell digital and physical products in your funnels?', 'cartflows' ); ?></h4>
418
- <span><input data-wcf-ca-active="<?php echo esc_attr( $is_wcf_ca_active ); ?>" data-wcf-ca-install="<?php echo esc_attr( $is_wcf_ca_installed ); ?>" data-woo-active="<?php echo esc_attr( $is_active ); ?>" data-woo-install="<?php echo esc_attr( $is_wc_installed ); ?>" type="hidden" class="wcf-install-wc-input" name="installl-woocommerce" value="" checked></span>
419
- </div>
420
-
421
- <div class="cartflows-setup-extra-notice">
422
-
423
- <span>
424
- <?php esc_html_e( 'The following plugin will be installed and activated for you:', 'cartflows' ); ?>
425
- <a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce', 'cartflows' ); ?></a>,
426
- <a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce Cart Abandonment Recovery', 'cartflows' ); ?></a>
427
-
428
- </span>
429
-
430
- </div>
431
-
432
- <div class="cartflows-setup-actions step">
433
- <div class="button-prev-wrap">
434
- <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
435
- </div>
436
- <div class="button-next-wrap">
437
- <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
438
- <a class="wcf-install-wc button-primary button button-large" name="save_step" > <?php esc_html_e( 'Yes', 'cartflows' ); ?> </a>
439
- </div>
440
- </div>
441
-
442
- <?php
443
- }
444
-
445
- /**
446
- * Save Locale Settings.
447
- */
448
- public function activate_wc_plugins() {
449
-
450
- check_ajax_referer( 'wcf-wc-plugins-activate', 'security' );
451
-
452
- $plugin_slug_arr = array(
453
- 'woocommerce/woocommerce.php' => true,
454
- 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
455
- );
456
-
457
- $activate = array(
458
- 'woocommerce/woocommerce.php' => false,
459
- 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
460
- );
461
-
462
- foreach ( $plugin_slug_arr as $slug => $do_silently ) {
463
-
464
- $activate[ $slug ] = activate_plugin( $slug, '', false, $do_silently );
465
- }
466
-
467
- foreach ( $activate as $slug => $data ) {
468
-
469
- if ( is_wp_error( $data ) ) {
470
- wp_send_json_error(
471
- array(
472
- 'success' => false,
473
- 'message' => $data->get_error_message(),
474
- )
475
- );
476
- }
477
- }
478
-
479
- wp_send_json_success();
480
- }
481
-
482
- /**
483
- * Save Locale Settings.
484
- */
485
- public function page_builder_step_save() {
486
-
487
- check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
488
-
489
- $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_init'] ) ) : '';
490
- $save_option = ( isset( $_POST['save_builder_option'] ) && 'true' == $_POST['save_builder_option'] ) ? true : false;
491
- $plugin_slug = filter_input( INPUT_POST, 'page_builder', FILTER_SANITIZE_STRING );
492
-
493
- $do_sliently = true;
494
- if ( 'woo-cart-abandonment-recovery' === $plugin_slug ) {
495
- $do_sliently = false;
496
- }
497
-
498
- $activate = activate_plugin( $plugin_init, '', false, $do_sliently );
499
-
500
- if ( $save_option ) {
501
- $this->save_page_builder_option();
502
- }
503
-
504
- if ( is_wp_error( $activate ) ) {
505
- wp_send_json_error(
506
- array(
507
- 'success' => false,
508
- 'message' => $activate->get_error_message(),
509
- )
510
- );
511
- }
512
-
513
- wp_send_json_success(
514
- array( 'plugin' => $plugin_slug )
515
- );
516
- }
517
-
518
- /**
519
- * Save selected page builder in options database.
520
- */
521
- public function save_page_builder_option() {
522
-
523
- $page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( wp_unslash( $_POST['page_builder'] ) ) : '';
524
-
525
- $wcf_settings = get_option( '_cartflows_common', array() );
526
-
527
- if ( false !== strpos( $page_builder, 'beaver-builder' ) ) {
528
- $page_builder = 'beaver-builder';
529
- }
530
-
531
- $wcf_settings['default_page_builder'] = $page_builder;
532
-
533
- update_option( '_cartflows_common', $wcf_settings );
534
-
535
- wp_send_json_success(
536
- array( 'plugin' => $page_builder )
537
- );
538
-
539
- }
540
-
541
- /**
542
- * Final step.
543
- */
544
- public function ready_step() {
545
-
546
- // Set setup wizard status to complete.
547
- update_option( 'wcf_setup_complete', true );
548
- ?>
549
- <h1><?php esc_html_e( 'Congratulations, You Did It!', 'cartflows' ); ?></h1>
550
-
551
- <div class="cartflows-setup-next-steps">
552
- <div class="cartflows-setup-next-steps-last">
553
-
554
- <p class="success">
555
- <?php
556
- esc_html_e( 'CartFlows is ready to use on your website. You\'ve successfully completed the setup process and all that is left for you to do is create your first flow.', 'cartflows' )
557
- ?>
558
- </p>
559
-
560
-
561
- <ul class="wcf-wizard-next-steps">
562
- <li class="wcf-wizard-next-step-item">
563
- <div class="wcf-wizard-next-step-description">
564
- <p class="next-step-heading">Next step</p>
565
- <h3 class="next-step-description">Create First Flow</h3>
566
- <p class="next-step-extra-info">You're ready to add flows to your website.</p>
567
- </div>
568
- <div class="wcf-wizard-next-step-action">
569
- <p class="wc-setup-actions step">
570
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=cartflows_flow&add-new-flow' ) ); ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Create a flow', 'cartflows' ); ?></a>
571
- </p>
572
- </div>
573
- </li>
574
- </ul>
575
-
576
- </div>
577
- </div>
578
- <?php
579
- }
580
-
581
- /**
582
- * Training course step.
583
- */
584
- public function training_step() {
585
- $current_user = wp_get_current_user();
586
- ?>
587
- <h1><?php esc_html_e( 'Exclusive CartFlows Training Course Offer', 'cartflows' ); ?></h1>
588
-
589
- <div id="mauticform_wrapper_cartflowsonboarding" class="mauticform_wrapper">
590
- <form autocomplete="false" role="form" method="post" action="https://go.cartflows.com/form/submit?formId=2" id="mauticform_cartflowsonboarding" data-mautic-form="cartflowsonboarding" enctype="multipart/form-data">
591
- <div class="mauticform-error" id="mauticform_cartflowsonboarding_error"></div>
592
- <div class="mauticform-message" id="mauticform_cartflowsonboarding_message"></div>
593
- <div class="mauticform-innerform">
594
- <div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">
595
- <div id="mauticform_cartflowsonboarding_enter_your_email" class="mauticform-row mauticform-email mauticform-field-1">
596
- <div class="cartflows-setup-message">
597
- <p>
598
- <?php esc_html_e( 'We want you to get off to a great start using CartFlows, so we would like to give access to our exclusive training course.', 'cartflows' ); ?>
599
- <?php esc_html_e( 'Get access to this couse, for free, by entering your email below.', 'cartflows' ); ?>
600
- </p>
601
- <input id="mauticform_input_cartflowsonboarding_enter_your_email" name="mauticform[enter_your_email]" placeholder="<?php esc_html_e( 'Enter Email address', 'cartflows' ); ?>" value="<?php echo $current_user->user_email; ?>" class="mauticform-input" type="email">
602
- </div>
603
- <span class="mauticform-errormsg" style="display: none;"></span>
604
- </div>
605
- </div>
606
- </div>
607
-
608
- <input type="hidden" name="mauticform[formId]" id="mauticform_cartflowsonboarding_id" value="2">
609
- <input type="hidden" name="mauticform[return]" id="mauticform_cartflowsonboarding_return" value="">
610
- <input type="hidden" name="mauticform[formName]" id="mauticform_cartflowsonboarding_name" value="cartflowsonboarding">
611
- <div class="cartflows-setup-actions step">
612
- <div class="button-prev-wrap">
613
- <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
614
- </div>
615
- <div class="button-next-wrap">
616
- <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
617
- <button type="submit" name="mauticform[submit]" id="mauticform_input_cartflowsonboarding_submit" value="<?php esc_html_e( 'Allow', 'cartflows' ); ?>" class="mautic-form-submit btn btn-default button-primary button button-large button-next" name="save_step"><?php esc_html_e( 'Allow', 'cartflows' ); ?></button>
618
- </div>
619
- </div>
620
- </form>
621
- </div>
622
- <?php
623
- }
624
-
625
- /**
626
- * Localize variables in admin
627
- */
628
- public function localize_vars() {
629
-
630
- $vars = array();
631
-
632
- $ajax_actions = array(
633
- 'wcf_page_builder_step_save',
634
- 'wcf_wc_plugins_activate',
635
- );
636
-
637
- foreach ( $ajax_actions as $action ) {
638
-
639
- $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
640
- }
641
-
642
- return $vars;
643
- }
644
-
645
- /**
646
- * Add JS script for mautic form
647
- */
648
- public function add_mautic_form_script() {
649
-
650
- if ( ! isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && 'cartflow-setup' != $_REQUEST['page'] ) ) {
651
- return;
652
- }
653
- ?>
654
-
655
- <script type="text/javascript">
656
- /** This section is only needed once per page if manually copying **/
657
- if (typeof MauticSDKLoaded == 'undefined') {
658
- var MauticSDKLoaded = true;
659
- var head = document.getElementsByTagName('head')[0];
660
- var script = document.createElement('script');
661
- script.type = 'text/javascript';
662
- script.src = 'https://go.cartflows.com/media/js/mautic-form.js';
663
- script.onload = function() {
664
- MauticSDK.onLoad();
665
- };
666
- head.appendChild(script);
667
- var MauticDomain = 'https://go.cartflows.com';
668
- var MauticLang = {
669
- 'submittingMessage': "Please wait..."
670
- };
671
- }
672
- </script>
673
- <?php
674
- }
675
- }
676
-
677
- new CartFlows_Wizard();
678
-
679
- endif;
1
+ <?php
2
+ /**
3
+ * CartFlows- Onboarding Wizard
4
+ *
5
+ * @package cartflows
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
13
+
14
+ /**
15
+ * CartFlows_Wizard class.
16
+ */
17
+ class CartFlows_Wizard {
18
+
19
+ /**
20
+ * Hook in tabs.
21
+ */
22
+ public function __construct() {
23
+
24
+ if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
25
+ add_action( 'admin_menu', array( $this, 'admin_menus' ) );
26
+ add_action( 'admin_init', array( $this, 'setup_wizard' ) );
27
+ add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
28
+ add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
29
+ add_action( 'wp_ajax_page_builder_save_option', array( $this, 'save_page_builder_option' ) );
30
+ add_action( 'admin_head', array( $this, 'add_mautic_form_script' ) );
31
+ add_action( 'woocommerce_installed', array( $this, 'disable_woo_setup_redirect' ) );
32
+
33
+ add_action( 'wp_ajax_wcf_activate_wc_plugins', array( $this, 'activate_wc_plugins' ) );
34
+
35
+ add_action( 'admin_init', array( $this, 'hide_notices' ) );
36
+
37
+ }
38
+ }
39
+
40
+
41
+ /**
42
+ * Hide a notice if the GET variable is set.
43
+ */
44
+ public function hide_notices() {
45
+
46
+ if ( ! isset( $_GET['wcf-hide-notice'] ) ) {
47
+ return;
48
+ }
49
+
50
+ $wcf_hide_notice = filter_input( INPUT_GET, 'wcf-hide-notice', FILTER_SANITIZE_STRING );
51
+ $_wcf_notice_nonce = filter_input( INPUT_GET, '_wcf_notice_nonce', FILTER_SANITIZE_STRING );
52
+
53
+ if ( $wcf_hide_notice && $_wcf_notice_nonce && wp_verify_nonce( sanitize_text_field( wp_unslash( $_wcf_notice_nonce ) ), 'wcf_hide_notices_nonce' ) ) {
54
+ update_option( 'wcf_setup_skipped', true );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Disable the woo redirect for new setup.
60
+ */
61
+ public function disable_woo_setup_redirect() {
62
+
63
+ if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
64
+ return;
65
+ }
66
+
67
+ delete_transient( '_wc_activation_redirect' );
68
+ }
69
+
70
+ /**
71
+ * Show action links on the plugin screen.
72
+ *
73
+ * @since 1.0.0
74
+ * @return void
75
+ */
76
+ public function show_setup_wizard() {
77
+
78
+ $status = get_option( 'wcf_setup_complete', false );
79
+ $skip_setup = get_option( 'wcf_setup_skipped', false );
80
+
81
+ if ( false === $status && ! $skip_setup ) { ?>
82
+ <div class="notice notice-info">
83
+ <p><b><?php esc_html_e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
84
+ <p><?php esc_html_e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
85
+ <p>
86
+ <a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php esc_html_e( 'Start Wizard', 'cartflows' ); ?></a>
87
+ <a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'cartflows' ); ?></a>
88
+ </p>
89
+ </div>
90
+ <?php
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Add admin menus/screens.
96
+ */
97
+ public function admin_menus() {
98
+
99
+ if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
100
+ return;
101
+ }
102
+
103
+ add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
104
+ }
105
+
106
+ /**
107
+ * Show the setup wizard.
108
+ */
109
+ public function setup_wizard() {
110
+
111
+ if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
112
+ return;
113
+ }
114
+
115
+ $this->steps = array(
116
+ 'basic-config' => array(
117
+ 'name' => __( 'Welcome', 'cartflows' ),
118
+ 'view' => array( $this, 'welcome_step' ),
119
+ 'handler' => array( $this, 'welcome_step_save' ),
120
+ ),
121
+ 'page-builder' => array(
122
+ 'name' => __( 'Page Builder', 'cartflows' ),
123
+ 'view' => array( $this, 'page_builder_step' ),
124
+ ),
125
+ 'checkout' => array(
126
+ 'name' => __( 'Checkout', 'cartflows' ),
127
+ 'view' => array( $this, 'checkout_step' ),
128
+ ),
129
+ 'training' => array(
130
+ 'name' => __( 'Training', 'cartflows' ),
131
+ 'view' => array( $this, 'training_step' ),
132
+ ),
133
+ 'setup-ready' => array(
134
+ 'name' => __( 'Ready!', 'cartflows' ),
135
+ 'view' => array( $this, 'ready_step' ),
136
+ 'handler' => '',
137
+ ),
138
+ );
139
+
140
+ $this->step = isset( $_GET['step'] ) ? sanitize_text_field( $_GET['step'] ) : current( array_keys( $this->steps ) ); //phpcs:ignore
141
+
142
+ wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
143
+ wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
144
+
145
+ wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
146
+
147
+ wp_localize_script( 'cartflows-setup', 'cartflows_setup_vars', self::localize_vars() );
148
+
149
+ wp_enqueue_media();
150
+
151
+ if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { //phpcs:ignore
152
+ call_user_func( $this->steps[ $this->step ]['handler'] );
153
+ }
154
+
155
+ ob_start();
156
+ $this->setup_wizard_header();
157
+ $this->setup_wizard_steps();
158
+ $this->setup_wizard_content();
159
+ $this->setup_wizard_footer();
160
+ exit;
161
+ }
162
+
163
+ /**
164
+ * Get current step slug
165
+ */
166
+ public function get_current_step_slug() {
167
+ $keys = array_keys( $this->steps );
168
+ return $keys[ array_search( $this->step, array_keys( $this->steps ), true ) ];
169
+ }
170
+
171
+ /**
172
+ * Get previous step link
173
+ */
174
+ public function get_prev_step_link() {
175
+ $keys = array_keys( $this->steps );
176
+ return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) - 1 ] );
177
+ }
178
+
179
+ /**
180
+ * Get next step link
181
+ */
182
+ public function get_next_step_link() {
183
+ $keys = array_keys( $this->steps );
184
+ return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ] );
185
+ }
186
+
187
+ /**
188
+ * Get next step link
189
+ */
190
+ public function get_next_step_plain_link() {
191
+ $keys = array_keys( $this->steps );
192
+ $step_index = array_search( $this->step, $keys, true );
193
+ $step_index = ( count( $keys ) == $step_index + 1 ) ? $step_index : $step_index + 1;
194
+ $step = $keys[ $step_index ];
195
+ return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
196
+ }
197
+
198
+ /**
199
+ * Setup Wizard Header.
200
+ */
201
+ public function setup_wizard_header() {
202
+ ?>
203
+ <!DOCTYPE html>
204
+ <html>
205
+ <head>
206
+ <meta name="viewport" content="width=device-width" />
207
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
208
+ <title><?php esc_html_e( 'CartFlows Setup', 'cartflows' ); ?></title>
209
+
210
+ <script type="text/javascript">
211
+ addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
212
+ var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
213
+ var pagenow = '';
214
+ </script>
215
+ <?php wp_print_scripts( array( 'cartflows-setup' ) ); ?>
216
+ <?php do_action( 'admin_print_styles' ); ?>
217
+ <?php do_action( 'admin_head' ); ?>
218
+ </head>
219
+ <body class="cartflows-setup wp-core-ui cartflows-step-<?php echo esc_attr( $this->get_current_step_slug() ); ?>">
220
+ <div id="cartflows-logo">
221
+ <img height="40" class="wcf-logo" src="<?php echo CARTFLOWS_URL . 'assets/images/cartflows-logo.svg'; ?>" />
222
+ </div>
223
+ <?php
224
+ }
225
+
226
+ /**
227
+ * Setup Wizard Footer.
228
+ */
229
+ public function setup_wizard_footer() {
230
+
231
+ $admin_url = admin_url( 'admin.php?page=cartflows_settings' );
232
+ ?>
233
+ <div class="close-button-wrapper">
234
+ <a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
235
+ </div>
236
+ </body>
237
+ </html>
238
+ <?php
239
+ }
240
+
241
+ /**
242
+ * Output the steps.
243
+ */
244
+ public function setup_wizard_steps() {
245
+
246
+ $ouput_steps = $this->steps;
247
+ ?>
248
+ <ol class="cartflows-setup-steps">
249
+ <?php
250
+ foreach ( $ouput_steps as $step_key => $step ) :
251
+ $classes = '';
252
+ $activated = false;
253
+ if ( $step_key === $this->step ) {
254
+ $classes = 'active';
255
+ $activated = true;
256
+ } elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
257
+ $classes = 'done';
258
+ $activated = true;
259
+ }
260
+ ?>
261
+ <li class="<?php echo esc_attr( $classes ); ?>">
262
+ <span><?php echo esc_html( $step['name'] ); ?></span>
263
+ </li>
264
+ <?php endforeach; ?>
265
+ </ol>
266
+ <?php
267
+ }
268
+
269
+ /**
270
+ * Output the content for the current step.
271
+ */
272
+ public function setup_wizard_content() {
273
+ ?>
274
+ <input type="hidden" class="wcf-redirect-link" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" >
275
+ <?php
276
+
277
+ echo '<div class="cartflows-setup-content">';
278
+ call_user_func( $this->steps[ $this->step ]['view'] );
279
+ echo '</div>';
280
+ }
281
+
282
+ /**
283
+ * Introduction step.
284
+ */
285
+ public function welcome_step() {
286
+ ?>
287
+ <h1><?php esc_html_e( 'Welcome to CartFlows!', 'cartflows' ); ?></h1>
288
+ <p><?php esc_html_e( 'Thank you for choosing CartFlows to get more leads, increase conversions, & maximize profits. This short setup wizard will guide you though configuring CartFlows and creating your first funnel.', 'cartflows' ); ?></p>
289
+ <form method="post">
290
+ <div class="cartflows-setup-actions step">
291
+ <div class="button-prev-wrap">
292
+ </div>
293
+ <div class="button-next-wrap">
294
+ <input type="submit" class="uct-activate button-primary button button-large " value="<?php esc_html_e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
295
+ </div>
296
+ <?php wp_nonce_field( 'cartflow-setup' ); ?>
297
+ </div>
298
+ </form>
299
+ <?php
300
+ }
301
+
302
+ /**
303
+ * Save Locale Settings.
304
+ */
305
+ public function welcome_step_save() {
306
+ check_admin_referer( 'cartflow-setup' );
307
+
308
+ // Update site title & tagline.
309
+ $redirect_url = $this->get_next_step_link();
310
+
311
+ wp_safe_redirect( esc_url_raw( $redirect_url ) );
312
+ exit;
313
+ }
314
+
315
+ /**
316
+ * Locale settings
317
+ */
318
+ public function page_builder_step() {
319
+ ?>
320
+
321
+ <h1><?php esc_html_e( 'Page Builder Setup', 'cartflows' ); ?></h1>
322
+ <p class="description"><?php esc_html_e( 'Please select a page builder you would like to use with CartFlows.', 'cartflows' ); ?></p>
323
+ <form method="post">
324
+ <table class="cartflows-table widefat">
325
+ <tr class="cartflows-row">
326
+ <td class="cartflows-row-heading">
327
+ <label><?php esc_html_e( 'Select Page Builder', 'cartflows' ); ?></label>
328
+ </td>
329
+ <td class="cartflows-row-content">
330
+ <?php
331
+ $installed_plugins = get_plugins();
332
+ $plugins = array(
333
+ array(
334
+ 'title' => __( 'Elementor', 'cartflows' ),
335
+ 'value' => 'elementor',
336
+ 'data' => array(
337
+ 'slug' => 'elementor',
338
+ 'init' => 'elementor/elementor.php',
339
+ 'active' => is_plugin_active( 'elementor/elementor.php' ) ? 'yes' : 'no',
340
+ 'install' => isset( $installed_plugins['elementor/elementor.php'] ) ? 'yes' : 'no',
341
+ ),
342
+ ),
343
+ array(
344
+ 'title' => __( 'Beaver Builder Plugin (Lite Version)', 'cartflows' ),
345
+ 'value' => 'beaver-builder',
346
+ 'data' => array(
347
+ 'slug' => 'beaver-builder-lite-version',
348
+ 'init' => 'beaver-builder-lite-version/fl-builder.php',
349
+ 'active' => is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ? 'yes' : 'no',
350
+ 'install' => isset( $installed_plugins['beaver-builder-lite-version/fl-builder.php'] ) ? 'yes' : 'no',
351
+ ),
352
+ ),
353
+ array(
354
+ 'title' => __( 'Divi', 'cartflows' ),
355
+ 'value' => 'divi',
356
+ 'data' => array(
357
+ 'slug' => 'divi',
358
+ 'init' => 'divi',
359
+ 'active' => 'yes',
360
+ 'install' => 'NA',
361
+ ),
362
+ ),
363
+ array(
364
+ 'title' => __( 'Other', 'cartflows' ),
365
+ 'value' => 'other',
366
+ 'data' => array(
367
+ 'slug' => 'other',
368
+ 'init' => false,
369
+ 'active' => 'yes',
370
+ 'install' => 'NA',
371
+ ),
372
+ ),
373
+ );
374
+ ?>
375
+ <input type="hidden" name="save-pb-input" id="save-pb-option" value="1" />
376
+ <select name="page-builder" class="page-builder-list" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>">
377
+ <?php
378
+ foreach ( $plugins as $key => $plugin ) {
379
+ echo '<option value="' . esc_attr( $plugin['value'] ) . '" data-install="' . esc_attr( $plugin['data']['install'] ) . '" data-active="' . esc_attr( $plugin['data']['active'] ) . '" data-slug="' . esc_attr( $plugin['data']['slug'] ) . '" data-init="' . esc_attr( $plugin['data']['init'] ) . '">' . esc_html( $plugin['title'] ) . '</option>';
380
+ }
381
+ ?>
382
+ </select>
383
+ </td>
384
+ </tr>
385
+ </table>
386
+ <p><?php esc_html_e( 'While CartFlows Should work with most page builders, we offer templates for the above page builders.', 'cartflows' ); ?></p>
387
+ <div class="cartflows-setup-actions step">
388
+ <div class="button-prev-wrap">
389
+ <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
390
+ </div>
391
+ <div class="button-next-wrap">
392
+ <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next" ><?php esc_html_e( 'Skip this step', 'cartflows' ); ?></a>
393
+ <a href="#" class="button button-primary wcf-install-plugins"><?php esc_html_e( 'Next »', 'cartflows' ); ?></a>
394
+ </div>
395
+ <?php wp_nonce_field( 'cartflow-setup' ); ?>
396
+ </div>
397
+ </form>
398
+ <?php
399
+ }
400
+
401
+ /**
402
+ * Render checkout step.
403
+ */
404
+ public function checkout_step() {
405
+
406
+ $installed_plugins = get_plugins();
407
+ $is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? 'yes' : 'no';
408
+ $is_wcf_ca_installed = isset( $installed_plugins['woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php'] ) ? 'yes' : 'no';
409
+ $is_active = class_exists( 'WooCommerce' ) ? 'yes' : 'no';
410
+ $is_wcf_ca_active = class_exists( 'CARTFLOWS_CA_Loader' ) ? 'yes' : 'no';
411
+ ?>
412
+ <h1><?php esc_html_e( 'Choose a checkout', 'cartflows' ); ?></h1>
413
+ <div class="cartflows-setup-message">
414
+ <p>
415
+ <?php esc_html_e( 'While CartFlows is designed to use WooCommerce sell digital and physical products, not all funnels need a checkout system.', 'cartflows' ); ?>
416
+ </p>
417
+ <h4 class="cartflows-setup-message-title"><?php esc_html_e( 'Would you like to install WooCommerce to sell digital and physical products in your funnels?', 'cartflows' ); ?></h4>
418
+ <span><input data-wcf-ca-active="<?php echo esc_attr( $is_wcf_ca_active ); ?>" data-wcf-ca-install="<?php echo esc_attr( $is_wcf_ca_installed ); ?>" data-woo-active="<?php echo esc_attr( $is_active ); ?>" data-woo-install="<?php echo esc_attr( $is_wc_installed ); ?>" type="hidden" class="wcf-install-wc-input" name="installl-woocommerce" value="" checked></span>
419
+ </div>
420
+
421
+ <div class="cartflows-setup-extra-notice">
422
+
423
+ <span>
424
+ <?php esc_html_e( 'The following plugin will be installed and activated for you:', 'cartflows' ); ?>
425
+ <a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce', 'cartflows' ); ?></a>,
426
+ <a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce Cart Abandonment Recovery', 'cartflows' ); ?></a>
427
+
428
+ </span>
429
+
430
+ </div>
431
+
432
+ <div class="cartflows-setup-actions step">
433
+ <div class="button-prev-wrap">
434
+ <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
435
+ </div>
436
+ <div class="button-next-wrap">
437
+ <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
438
+ <a class="wcf-install-wc button-primary button button-large" name="save_step" > <?php esc_html_e( 'Yes', 'cartflows' ); ?> </a>
439
+ </div>
440
+ </div>
441
+
442
+ <?php
443
+ }
444
+
445
+ /**
446
+ * Save Locale Settings.
447
+ */
448
+ public function activate_wc_plugins() {
449
+
450
+ check_ajax_referer( 'wcf-wc-plugins-activate', 'security' );
451
+
452
+ $plugin_slug_arr = array(
453
+ 'woocommerce/woocommerce.php' => true,
454
+ 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
455
+ );
456
+
457
+ $activate = array(
458
+ 'woocommerce/woocommerce.php' => false,
459
+ 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
460
+ );
461
+
462
+ foreach ( $plugin_slug_arr as $slug => $do_silently ) {
463
+
464
+ $activate[ $slug ] = activate_plugin( $slug, '', false, $do_silently );
465
+ }
466
+
467
+ foreach ( $activate as $slug => $data ) {
468
+
469
+ if ( is_wp_error( $data ) ) {
470
+ wp_send_json_error(
471
+ array(
472
+ 'success' => false,
473
+ 'message' => $data->get_error_message(),
474
+ )
475
+ );
476
+ }
477
+ }
478
+
479
+ wp_send_json_success();
480
+ }
481
+
482
+ /**
483
+ * Save Locale Settings.
484
+ */
485
+ public function page_builder_step_save() {
486
+
487
+ check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
488
+
489
+ $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_init'] ) ) : '';
490
+ $save_option = ( isset( $_POST['save_builder_option'] ) && 'true' == $_POST['save_builder_option'] ) ? true : false;
491
+ $plugin_slug = filter_input( INPUT_POST, 'page_builder', FILTER_SANITIZE_STRING );
492
+
493
+ $do_sliently = true;
494
+ if ( 'woo-cart-abandonment-recovery' === $plugin_slug ) {
495
+ $do_sliently = false;
496
+ }
497
+
498
+ $activate = activate_plugin( $plugin_init, '', false, $do_sliently );
499
+
500
+ if ( $save_option ) {
501
+ $this->save_page_builder_option();
502
+ }
503
+
504
+ if ( is_wp_error( $activate ) ) {
505
+ wp_send_json_error(
506
+ array(
507
+ 'success' => false,
508
+ 'message' => $activate->get_error_message(),
509
+ )
510
+ );
511
+ }
512
+
513
+ wp_send_json_success(
514
+ array( 'plugin' => $plugin_slug )
515
+ );
516
+ }
517
+
518
+ /**
519
+ * Save selected page builder in options database.
520
+ */
521
+ public function save_page_builder_option() {
522
+
523
+ $page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( wp_unslash( $_POST['page_builder'] ) ) : ''; //phpcs:ignore
524
+
525
+ $wcf_settings = get_option( '_cartflows_common', array() );
526
+
527
+ if ( false !== strpos( $page_builder, 'beaver-builder' ) ) {
528
+ $page_builder = 'beaver-builder';
529
+ }
530
+
531
+ $wcf_settings['default_page_builder'] = $page_builder;
532
+
533
+ update_option( '_cartflows_common', $wcf_settings );
534
+
535
+ wp_send_json_success(
536
+ array( 'plugin' => $page_builder )
537
+ );
538
+
539
+ }
540
+
541
+ /**
542
+ * Final step.
543
+ */
544
+ public function ready_step() {
545
+
546
+ // Set setup wizard status to complete.
547
+ update_option( 'wcf_setup_complete', true );
548
+ ?>
549
+ <h1><?php esc_html_e( 'Congratulations, You Did It!', 'cartflows' ); ?></h1>
550
+
551
+ <div class="cartflows-setup-next-steps">
552
+ <div class="cartflows-setup-next-steps-last">
553
+
554
+ <p class="success">
555
+ <?php
556
+ esc_html_e( 'CartFlows is ready to use on your website. You\'ve successfully completed the setup process and all that is left for you to do is create your first flow.', 'cartflows' )
557
+ ?>
558
+ </p>
559
+
560
+
561
+ <ul class="wcf-wizard-next-steps">
562
+ <li class="wcf-wizard-next-step-item">
563
+ <div class="wcf-wizard-next-step-description">
564
+ <p class="next-step-heading">Next step</p>
565
+ <h3 class="next-step-description">Create First Flow</h3>
566
+ <p class="next-step-extra-info">You're ready to add flows to your website.</p>
567
+ </div>
568
+ <div class="wcf-wizard-next-step-action">
569
+ <p class="wc-setup-actions step">
570
+ <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=cartflows_flow&add-new-flow' ) ); ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Create a flow', 'cartflows' ); ?></a>
571
+ </p>
572
+ </div>
573
+ </li>
574
+ </ul>
575
+
576
+ </div>
577
+ </div>
578
+ <?php
579
+ }
580
+
581
+ /**
582
+ * Training course step.
583
+ */
584
+ public function training_step() {
585
+ $current_user = wp_get_current_user();
586
+ ?>
587
+ <h1><?php esc_html_e( 'Exclusive CartFlows Training Course Offer', 'cartflows' ); ?></h1>
588
+
589
+ <div id="mauticform_wrapper_cartflowsonboarding" class="mauticform_wrapper">
590
+ <form autocomplete="false" role="form" method="post" action="https://go.cartflows.com/form/submit?formId=2" id="mauticform_cartflowsonboarding" data-mautic-form="cartflowsonboarding" enctype="multipart/form-data">
591
+ <div class="mauticform-error" id="mauticform_cartflowsonboarding_error"></div>
592
+ <div class="mauticform-message" id="mauticform_cartflowsonboarding_message"></div>
593
+ <div class="mauticform-innerform">
594
+ <div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">
595
+ <div id="mauticform_cartflowsonboarding_enter_your_email" class="mauticform-row mauticform-email mauticform-field-1">
596
+ <div class="cartflows-setup-message">
597
+ <p>
598
+ <?php esc_html_e( 'We want you to get off to a great start using CartFlows, so we would like to give access to our exclusive training course.', 'cartflows' ); ?>
599
+ <?php esc_html_e( 'Get access to this couse, for free, by entering your email below.', 'cartflows' ); ?>
600
+ </p>
601
+ <input id="mauticform_input_cartflowsonboarding_enter_your_email" name="mauticform[enter_your_email]" placeholder="<?php esc_html_e( 'Enter Email address', 'cartflows' ); ?>" value="<?php echo $current_user->user_email; ?>" class="mauticform-input" type="email">
602
+ </div>
603
+ <span class="mauticform-errormsg" style="display: none;"></span>
604
+ </div>
605
+ </div>
606
+ </div>
607
+
608
+ <input type="hidden" name="mauticform[formId]" id="mauticform_cartflowsonboarding_id" value="2">
609
+ <input type="hidden" name="mauticform[return]" id="mauticform_cartflowsonboarding_return" value="">
610
+ <input type="hidden" name="mauticform[formName]" id="mauticform_cartflowsonboarding_name" value="cartflowsonboarding">
611
+ <div class="cartflows-setup-actions step">
612
+ <div class="button-prev-wrap">
613
+ <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
614
+ </div>
615
+ <div class="button-next-wrap">
616
+ <a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
617
+ <button type="submit" name="mauticform[submit]" id="mauticform_input_cartflowsonboarding_submit" value="<?php esc_html_e( 'Allow', 'cartflows' ); ?>" class="mautic-form-submit btn btn-default button-primary button button-large button-next" name="save_step"><?php esc_html_e( 'Allow', 'cartflows' ); ?></button>
618
+ </div>
619
+ </div>
620
+ </form>
621
+ </div>
622
+ <?php
623
+ }
624
+
625
+ /**
626
+ * Localize variables in admin
627
+ */
628
+ public function localize_vars() {
629
+
630
+ $vars = array();
631
+
632
+ $ajax_actions = array(
633
+ 'wcf_page_builder_step_save',
634
+ 'wcf_wc_plugins_activate',
635
+ );
636
+
637
+ foreach ( $ajax_actions as $action ) {
638
+
639
+ $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
640
+ }
641
+
642
+ return $vars;
643
+ }
644
+
645
+ /**
646
+ * Add JS script for mautic form
647
+ */
648
+ public function add_mautic_form_script() {
649
+
650
+ if ( ! isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && 'cartflow-setup' !== $_REQUEST['page'] ) ) { //phpcs:ignore
651
+ return;
652
+ }
653
+ ?>
654
+
655
+ <script type="text/javascript">
656
+ /** This section is only needed once per page if manually copying **/
657
+ if (typeof MauticSDKLoaded == 'undefined') {
658
+ var MauticSDKLoaded = true;
659
+ var head = document.getElementsByTagName('head')[0];
660
+ var script = document.createElement('script');
661
+ script.type = 'text/javascript';
662
+ script.src = 'https://go.cartflows.com/media/js/mautic-form.js';
663
+ script.onload = function() {
664
+ MauticSDK.onLoad();
665
+ };
666
+ head.appendChild(script);
667
+ var MauticDomain = 'https://go.cartflows.com';
668
+ var MauticLang = {
669
+ 'submittingMessage': "Please wait..."
670
+ };
671
+ }
672
+ </script>
673
+ <?php
674
+ }
675
+ }
676
+
677
+ new CartFlows_Wizard();
678
+
679
+ endif;
includes/admin/cartflows-admin.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
- /**
3
- * CARTFLOWS Admin HTML.
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- ?>
9
- <div class="wcf-menu-page-wrapper">
10
- <div id="wcf-menu-page">
11
- <div class="wcf-menu-page-header <?php echo esc_attr( implode( ' ', $header_wrapper_class ) ); ?>">
12
- <div class="wcf-container wcf-flex">
13
- <div class="wcf-title">
14
- <span class="screen-reader-text"><?php echo esc_attr( CARTFLOWS_PLUGIN_NAME ); ?></span>
15
- <img class="wcf-logo" src="<?php echo esc_attr( CARTFLOWS_URL ) . 'assets/images/cartflows-logo.svg'; ?>" />
16
- </div>
17
- <div class="wcf-top-links">
18
- <?php
19
- esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
20
- ?>
21
- </div>
22
- </div>
23
- </div>
24
-
25
- <?php
26
- // Settings update message.
27
- if ( isset( $_REQUEST['message'] ) && ( 'saved' == $_REQUEST['message'] || 'saved_ext' == $_REQUEST['message'] ) ) {
28
- ?>
29
- <div id="message" class="notice notice-success is-dismissive wcf-notice"><p> <?php esc_html_e( 'Settings saved successfully.', 'cartflows' ); ?> </p></div>
30
- <?php
31
- }
32
- ?>
33
- <?php do_action( 'cartflows_render_admin_content' ); ?>
34
- </div>
35
- </div>
1
+ <?php
2
+ /**
3
+ * CARTFLOWS Admin HTML.
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ ?>
9
+ <div class="wcf-menu-page-wrapper">
10
+ <div id="wcf-menu-page">
11
+ <div class="wcf-menu-page-header <?php echo esc_attr( implode( ' ', $header_wrapper_class ) ); ?>">
12
+ <div class="wcf-container wcf-flex">
13
+ <div class="wcf-title">
14
+ <span class="screen-reader-text"><?php echo esc_attr( CARTFLOWS_PLUGIN_NAME ); ?></span>
15
+ <img class="wcf-logo" src="<?php echo esc_attr( CARTFLOWS_URL ) . 'assets/images/cartflows-logo.svg'; ?>" />
16
+ </div>
17
+ <div class="wcf-top-links">
18
+ <?php
19
+ esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
20
+ ?>
21
+ </div>
22
+ </div>
23
+ </div>
24
+
25
+ <?php
26
+ // Settings update message.
27
+ if ( isset( $_REQUEST['message'] ) && ( 'saved' === $_REQUEST['message'] ) ) { //phpcs:ignore
28
+ ?>
29
+ <div id="message" class="notice notice-success is-dismissive wcf-notice"><p> <?php esc_html_e( 'Settings saved successfully.', 'cartflows' ); ?> </p></div>
30
+ <?php
31
+ }
32
+ ?>
33
+ <?php do_action( 'cartflows_render_admin_content' ); ?>
34
+ </div>
35
+ </div>
includes/admin/cartflows-general.php CHANGED
@@ -1,370 +1,370 @@
1
- <?php
2
- /**
3
- * General settings
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- $settings = Cartflows_Helper::get_common_settings();
9
-
10
- $debug_data = Cartflows_Helper::get_debug_settings();
11
-
12
- $permalink_settings = Cartflows_Helper::get_permalink_settings();
13
-
14
- $facebook_settings = Cartflows_Helper::get_facebook_settings();
15
-
16
- $debug_on = ( isset( $_GET['debug'] ) ) ? sanitize_text_field( wp_unslash( $_GET['debug'] ) ) : 'false';
17
-
18
- $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOOLEAN );
19
- ?>
20
-
21
-
22
- <?php if ( $error_log ) : ?>
23
- <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
24
- <?php Cartflows_Logger::status_logs_file(); ?>
25
- </div>
26
- <?php else : ?>
27
- <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
28
- <input type="hidden" name="action" value="wcf_save_common_settings">
29
- <h1 class="screen-reader-text"><?php esc_html_e( 'General Settings', 'cartflows' ); ?></h1>
30
-
31
- <div id="poststuff">
32
- <div id="post-body" class="columns-2">
33
- <div id="post-body-content">
34
- <div class="postbox introduction">
35
- <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
36
- <span><?php esc_html_e( 'Getting Started', 'cartflows' ); ?></span>
37
- </h2>
38
- <div class="inside">
39
- <div class="iframe-wrap">
40
- <iframe width="560" height="315" src="https://www.youtube.com/embed/SlE0moPKjMY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
41
- </div>
42
- <p>
43
- <?php
44
- esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
45
- ?>
46
- </p>
47
- </div>
48
- </div>
49
-
50
- <div class="general-settings-form postbox">
51
- <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
52
- <span><?php esc_html_e( 'General Settings', 'cartflows' ); ?></span>
53
- </h2>
54
- <div class="inside">
55
- <form method="post" class="wrap wcf-clear" action="" >
56
- <div class="form-wrap">
57
- <?php
58
-
59
- do_action( 'cartflows_before_settings_fields', $settings );
60
-
61
- echo Cartflows_Admin_Fields::checkobox_field(
62
- array(
63
- 'id' => 'wcf_disallow_indexing',
64
- 'name' => '_cartflows_common[disallow_indexing]',
65
- 'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
66
- 'value' => $settings['disallow_indexing'],
67
- )
68
- );
69
-
70
- if ( wcf()->is_woo_active ) {
71
- echo Cartflows_Admin_Fields::flow_checkout_selection_field(
72
- array(
73
- 'id' => 'wcf_global_checkout',
74
- 'name' => '_cartflows_common[global_checkout]',
75
- 'title' => __( 'Global Checkout', 'cartflows' ),
76
- 'value' => $settings['global_checkout'],
77
- )
78
- );
79
- }
80
- echo Cartflows_Admin_Fields::select_field(
81
- array(
82
- 'id' => 'wcf_default_page_builder',
83
- 'name' => '_cartflows_common[default_page_builder]',
84
- 'title' => __( 'Show Templates designed with', 'cartflows' ),
85
- 'description' => __( 'CartFlows offers flow templates that can be imported in one click. These templates are available in few different page builders. Please choose your preferred page builder from the list so you will only see templates that are made using that page builder..', 'cartflows' ),
86
- 'value' => $settings['default_page_builder'],
87
- 'options' => array(
88
- 'elementor' => __( 'Elementor', 'cartflows' ),
89
- 'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
90
- 'divi' => __( 'Divi', 'cartflows' ),
91
- 'other' => __( 'Other', 'cartflows' ),
92
- ),
93
- )
94
- );
95
-
96
- do_action( 'cartflows_after_settings_fields', $settings );
97
-
98
- ?>
99
- </div>
100
- <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
101
- <?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
102
- </form>
103
- </div>
104
- </div>
105
-
106
- <div class="general-settingss-form postbox">
107
- <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
108
- <span><?php esc_html_e( 'Permalink Settings', 'cartflows' ); ?></span>
109
- </h2>
110
- <div class="inside">
111
- <form method="post" class="wrap wcf-clear" action="" >
112
- <div class="form-wrap wcf_permalink_settings">
113
- <?php
114
-
115
- echo Cartflows_Admin_Fields::radio_field(
116
- array(
117
- 'id' => 'permalink_structure',
118
- 'name' => '_cartflows_permalink[permalink_structure]',
119
- 'value' => $permalink_settings['permalink_structure'],
120
- 'options' => array(
121
- '' =>
122
- array(
123
- 'label' => __( 'Default', 'cartflows' ),
124
- 'description' => 'Default WordPress Permalink',
125
- ),
126
-
127
- '/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
128
- array(
129
- 'label' => __( 'Flow and Step Slug', 'cartflows' ),
130
- 'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
131
- ),
132
-
133
- '/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%' =>
134
- array(
135
- 'label' => __( 'Flow Slug', 'cartflows' ),
136
- 'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/%stepname%/',
137
- ),
138
-
139
- '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
140
- array(
141
- 'label' => __( 'Step Slug', 'cartflows' ),
142
- 'description' => '/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
143
- ),
144
- ),
145
- )
146
- );
147
- ?>
148
- <hr/>
149
- <?php
150
-
151
- echo Cartflows_Admin_Fields::title_field(
152
- array(
153
- 'title' => __( 'Post Type Permalink Base', 'cartflows' ),
154
- )
155
- );
156
-
157
- echo Cartflows_Admin_Fields::text_field(
158
- array(
159
- 'id' => 'wcf_permalink_step_base',
160
- 'name' => '_cartflows_permalink[permalink]',
161
- 'title' => __( 'Step Base', 'cartflows' ),
162
- 'value' => $permalink_settings['permalink'],
163
- 'placeholder' => CARTFLOWS_STEP_POST_TYPE,
164
- )
165
- );
166
-
167
- echo Cartflows_Admin_Fields::text_field(
168
- array(
169
- 'id' => 'wcf_permalink_flow_base',
170
- 'name' => '_cartflows_permalink[permalink_flow_base]',
171
- 'title' => __( 'Flow Base', 'cartflows' ),
172
- 'value' => $permalink_settings['permalink_flow_base'],
173
- 'placeholder' => CARTFLOWS_FLOW_POST_TYPE,
174
- )
175
- );
176
-
177
- ?>
178
-
179
-
180
- </div>
181
- <p>
182
- <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
183
- <?php submit_button( __( 'Set Default', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'reset', false ); ?>
184
- <?php wp_nonce_field( 'cartflows-permalink-settings', 'cartflows-permalink-settings-nonce' ); ?>
185
- </p>
186
-
187
-
188
- </form>
189
- </div>
190
- </div>
191
-
192
-
193
- <div class="general-settingss-form postbox">
194
- <h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
195
-
196
- <span><?php esc_html_e( 'Facebook Pixel Settings', 'cartflows' ); ?></span>
197
- </h2>
198
-
199
- <form method="post" class="wrap wcf-clear" action="">
200
- <div class="form-wrap">
201
- <input type="hidden" name="action" value="wcf_save_facebook_pixel_settings">
202
- <div id="post-body">
203
-
204
- <div class="inside">
205
- <div class="form-wrap">
206
- <?php
207
- echo Cartflows_Admin_Fields::checkobox_field(
208
- array(
209
- 'id' => 'wcf_facebook_pixel_tracking',
210
- 'name' => '_cartflows_facebook[facebook_pixel_tracking]',
211
- 'title' => __( 'Enable Facebook Pixel Tracking', 'cartflows' ),
212
- 'value' => $facebook_settings['facebook_pixel_tracking'],
213
- )
214
- );
215
-
216
- echo "<div class='wcf-fb-pixel-wrapper'>";
217
-
218
- echo Cartflows_Admin_Fields::text_field(
219
- array(
220
- 'id' => 'wcf_facebook_pixel_id',
221
- 'name' => '_cartflows_facebook[facebook_pixel_id]',
222
- 'title' => __( 'Enter Facebook pixel ID', 'cartflows' ),
223
- 'value' => $facebook_settings['facebook_pixel_id'],
224
- )
225
- );
226
-
227
-
228
- echo Cartflows_Admin_Fields::title_field(
229
- array(
230
- 'title' => __( 'Enable Events:', 'cartflows' ),
231
- )
232
- );
233
-
234
-
235
- echo Cartflows_Admin_Fields::checkobox_field(
236
- array(
237
- 'id' => 'wcf_facebook_pixel_initiate_checkout',
238
- 'name' => '_cartflows_facebook[facebook_pixel_initiate_checkout]',
239
- 'title' => __( 'Initiate Checkout', 'cartflows' ),
240
- 'value' => $facebook_settings['facebook_pixel_initiate_checkout'],
241
- )
242
- );
243
-
244
- echo Cartflows_Admin_Fields::checkobox_field(
245
- array(
246
- 'id' => 'wcf_facebook_pixel_add_payment_info',
247
- 'name' => '_cartflows_facebook[facebook_pixel_add_payment_info]',
248
- 'title' => __( 'Add Payment Info', 'cartflows' ),
249
- 'value' => $facebook_settings['facebook_pixel_add_payment_info'],
250
- )
251
- );
252
-
253
- echo Cartflows_Admin_Fields::checkobox_field(
254
- array(
255
- 'id' => 'wcf_facebook_pixel_purchase_complete',
256
- 'name' => '_cartflows_facebook[facebook_pixel_purchase_complete]',
257
- 'title' => __( 'Purchase Complete', 'cartflows' ),
258
- 'value' => $facebook_settings['facebook_pixel_purchase_complete'],
259
- )
260
- );
261
-
262
- echo '</div>';
263
-
264
- ?>
265
- </div>
266
-
267
- <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-facebook-setting-save-btn button-primary button', 'submit', false ); ?>
268
- <?php wp_nonce_field( 'cartflows-facebook-settings', 'cartflows-facebook-settings-nonce' ); ?>
269
- </div>
270
-
271
- </div>
272
- </div>
273
- </form>
274
-
275
-
276
- </div>
277
- </div>
278
- <div class="postbox-container" id="postbox-container-1">
279
- <div id="side-sortables">
280
-
281
- <div class="postbox">
282
- <h2 class="hndle">
283
- <span class="dashicons dashicons-book"></span>
284
- <span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
285
- </h2>
286
- <div class="inside">
287
- <p>
288
- <?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
289
- </p>
290
- <p>
291
- <a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
292
- </p>
293
- </div>
294
- </div>
295
-
296
- <div class="postbox">
297
- <h2 class="hndle">
298
- <span class="dashicons dashicons-groups"></span>
299
- <span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
300
- </h2>
301
- <div class="inside">
302
- <p>
303
- <?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
304
- </p>
305
- <p>
306
- <a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
307
- </p>
308
- </div>
309
- </div>
310
-
311
- <div class="postbox">
312
- <h2 class="hndle">
313
- <span class="dashicons dashicons-sos"></span>
314
- <span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
315
- </h2>
316
- <div class="inside">
317
- <p>
318
- <?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
319
- </p>
320
- <p>
321
- <a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a Ticket »', 'cartflows' ); ?></a>
322
- </p>
323
- </div>
324
- </div>
325
- <?php
326
- if ( 'true' == $debug_on ) {
327
- ?>
328
- <div class="postbox">
329
- <h2 class="hndle">
330
- <span class="dashicons dashicons-editor-code"></span>
331
- <span><?php esc_html_e( 'Load Minified CSS', 'cartflows' ); ?></span>
332
- </h2>
333
- <div class="inside">
334
- <form method="post" class="wrap wcf-clear" action="">
335
- <p>
336
- <?php esc_html_e( 'Load the Minified CSS from here. Just Enable it by checking the below given checkbox.', 'cartflows' ); ?>
337
- </p>
338
- <?php
339
- echo Cartflows_Admin_Fields::checkobox_field(
340
- array(
341
- 'id' => 'allow_minified_files',
342
- 'name' => '_cartflows_debug_data[allow_minified_files]',
343
- 'title' => __( 'Load minified CSS & JS Files', 'cartflows' ),
344
- 'value' => $debug_data['allow_minified_files'],
345
- )
346
- );
347
- ?>
348
- <?php submit_button( __( 'Save', 'cartflows' ), 'button-primary button', 'submit', false ); ?>
349
- <?php wp_nonce_field( 'cartflows-debug-settings', 'cartflows-debug-settings-nonce' ); ?>
350
- </form>
351
- </div>
352
- </div>
353
- <?php
354
- }
355
- ?>
356
- </div>
357
- </div>
358
- </div>
359
- <!-- /post-body -->
360
- <br class="clear">
361
- </div>
362
- </div>
363
- <?php endif; ?>
364
-
365
- <?php
366
- /**
367
- * Loads Zapier settings admin view.
368
- */
369
- do_action( 'cartflows_after_general_settings' );
370
- ?>
1
+ <?php
2
+ /**
3
+ * General settings
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ $settings = Cartflows_Helper::get_common_settings();
9
+
10
+ $debug_data = Cartflows_Helper::get_debug_settings();
11
+
12
+ $permalink_settings = Cartflows_Helper::get_permalink_settings();
13
+
14
+ $facebook_settings = Cartflows_Helper::get_facebook_settings();
15
+
16
+ $debug_on = ( isset( $_GET['debug'] ) ) ? sanitize_text_field( wp_unslash( $_GET['debug'] ) ) : 'false'; //phpcs:ignore
17
+
18
+ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOOLEAN );
19
+ ?>
20
+
21
+
22
+ <?php if ( $error_log ) : ?>
23
+ <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
24
+ <?php Cartflows_Logger::status_logs_file(); ?>
25
+ </div>
26
+ <?php else : ?>
27
+ <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
28
+ <input type="hidden" name="action" value="wcf_save_common_settings">
29
+ <h1 class="screen-reader-text"><?php esc_html_e( 'General Settings', 'cartflows' ); ?></h1>
30
+
31
+ <div id="poststuff">
32
+ <div id="post-body" class="columns-2">
33
+ <div id="post-body-content">
34
+ <div class="postbox introduction">
35
+ <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
36
+ <span><?php esc_html_e( 'Getting Started', 'cartflows' ); ?></span>
37
+ </h2>
38
+ <div class="inside">
39
+ <div class="iframe-wrap">
40
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/SlE0moPKjMY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
41
+ </div>
42
+ <p>
43
+ <?php
44
+ esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
45
+ ?>
46
+ </p>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="general-settings-form postbox">
51
+ <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
52
+ <span><?php esc_html_e( 'General Settings', 'cartflows' ); ?></span>
53
+ </h2>
54
+ <div class="inside">
55
+ <form method="post" class="wrap wcf-clear" action="" >
56
+ <div class="form-wrap">
57
+ <?php
58
+
59
+ do_action( 'cartflows_before_settings_fields', $settings );
60
+
61
+ echo Cartflows_Admin_Fields::checkobox_field(
62
+ array(
63
+ 'id' => 'wcf_disallow_indexing',
64
+ 'name' => '_cartflows_common[disallow_indexing]',
65
+ 'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
66
+ 'value' => $settings['disallow_indexing'],
67
+ )
68
+ );
69
+
70
+ if ( wcf()->is_woo_active ) {
71
+ echo Cartflows_Admin_Fields::flow_checkout_selection_field(
72
+ array(
73
+ 'id' => 'wcf_global_checkout',
74
+ 'name' => '_cartflows_common[global_checkout]',
75
+ 'title' => __( 'Global Checkout', 'cartflows' ),
76
+ 'value' => $settings['global_checkout'],
77
+ )
78
+ );
79
+ }
80
+ echo Cartflows_Admin_Fields::select_field(
81
+ array(
82
+ 'id' => 'wcf_default_page_builder',
83
+ 'name' => '_cartflows_common[default_page_builder]',
84
+ 'title' => __( 'Show Templates designed with', 'cartflows' ),
85
+ 'description' => __( 'CartFlows offers flow templates that can be imported in one click. These templates are available in few different page builders. Please choose your preferred page builder from the list so you will only see templates that are made using that page builder..', 'cartflows' ),
86
+ 'value' => $settings['default_page_builder'],
87
+ 'options' => array(
88
+ 'elementor' => __( 'Elementor', 'cartflows' ),
89
+ 'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
90
+ 'divi' => __( 'Divi', 'cartflows' ),
91
+ 'other' => __( 'Other', 'cartflows' ),
92
+ ),
93
+ )
94
+ );
95
+
96
+ do_action( 'cartflows_after_settings_fields', $settings );
97
+
98
+ ?>
99
+ </div>
100
+ <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
101
+ <?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
102
+ </form>
103
+ </div>
104
+ </div>
105
+
106
+ <div class="general-settingss-form postbox">
107
+ <h2 class="hndle wcf-normal-cusror ui-sortable-handle">
108
+ <span><?php esc_html_e( 'Permalink Settings', 'cartflows' ); ?></span>
109
+ </h2>
110
+ <div class="inside">
111
+ <form method="post" class="wrap wcf-clear" action="" >
112
+ <div class="form-wrap wcf_permalink_settings">
113
+ <?php
114
+
115
+ echo Cartflows_Admin_Fields::radio_field(
116
+ array(
117
+ 'id' => 'permalink_structure',
118
+ 'name' => '_cartflows_permalink[permalink_structure]',
119
+ 'value' => $permalink_settings['permalink_structure'],
120
+ 'options' => array(
121
+ '' =>
122
+ array(
123
+ 'label' => __( 'Default', 'cartflows' ),
124
+ 'description' => 'Default WordPress Permalink',
125
+ ),
126
+
127
+ '/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
128
+ array(
129
+ 'label' => __( 'Flow and Step Slug', 'cartflows' ),
130
+ 'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
131
+ ),
132
+
133
+ '/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%' =>
134
+ array(
135
+ 'label' => __( 'Flow Slug', 'cartflows' ),
136
+ 'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/%stepname%/',
137
+ ),
138
+
139
+ '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
140
+ array(
141
+ 'label' => __( 'Step Slug', 'cartflows' ),
142
+ 'description' => '/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
143
+ ),
144
+ ),
145
+ )
146
+ );
147
+ ?>
148
+ <hr/>
149
+ <?php
150
+
151
+ echo Cartflows_Admin_Fields::title_field(
152
+ array(
153
+ 'title' => __( 'Post Type Permalink Base', 'cartflows' ),
154
+ )
155
+ );
156
+
157
+ echo Cartflows_Admin_Fields::text_field(
158
+ array(
159
+ 'id' => 'wcf_permalink_step_base',
160
+ 'name' => '_cartflows_permalink[permalink]',
161
+ 'title' => __( 'Step Base', 'cartflows' ),
162
+ 'value' => $permalink_settings['permalink'],
163
+ 'placeholder' => CARTFLOWS_STEP_POST_TYPE,
164
+ )
165
+ );
166
+
167
+ echo Cartflows_Admin_Fields::text_field(
168
+ array(
169
+ 'id' => 'wcf_permalink_flow_base',
170
+ 'name' => '_cartflows_permalink[permalink_flow_base]',
171
+ 'title' => __( 'Flow Base', 'cartflows' ),
172
+ 'value' => $permalink_settings['permalink_flow_base'],
173
+ 'placeholder' => CARTFLOWS_FLOW_POST_TYPE,
174
+ )
175
+ );
176
+
177
+ ?>
178
+
179
+
180
+ </div>
181
+ <p>
182
+ <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
183
+ <?php submit_button( __( 'Set Default', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'reset', false ); ?>
184
+ <?php wp_nonce_field( 'cartflows-permalink-settings', 'cartflows-permalink-settings-nonce' ); ?>
185
+ </p>
186
+
187
+
188
+ </form>
189
+ </div>
190
+ </div>
191
+
192
+
193
+ <div class="general-settingss-form postbox">
194
+ <h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
195
+
196
+ <span><?php esc_html_e( 'Facebook Pixel Settings', 'cartflows' ); ?></span>
197
+ </h2>
198
+
199
+ <form method="post" class="wrap wcf-clear" action="">
200
+ <div class="form-wrap">
201
+ <input type="hidden" name="action" value="wcf_save_facebook_pixel_settings">
202
+ <div id="post-body">
203
+
204
+ <div class="inside">
205
+ <div class="form-wrap">
206
+ <?php
207
+ echo Cartflows_Admin_Fields::checkobox_field(
208
+ array(
209
+ 'id' => 'wcf_facebook_pixel_tracking',
210
+ 'name' => '_cartflows_facebook[facebook_pixel_tracking]',
211
+ 'title' => __( 'Enable Facebook Pixel Tracking', 'cartflows' ),
212
+ 'value' => $facebook_settings['facebook_pixel_tracking'],
213
+ )
214
+ );
215
+
216
+ echo "<div class='wcf-fb-pixel-wrapper'>";
217
+
218
+ echo Cartflows_Admin_Fields::text_field(
219
+ array(
220
+ 'id' => 'wcf_facebook_pixel_id',
221
+ 'name' => '_cartflows_facebook[facebook_pixel_id]',
222
+ 'title' => __( 'Enter Facebook pixel ID', 'cartflows' ),
223
+ 'value' => $facebook_settings['facebook_pixel_id'],
224
+ )
225
+ );
226
+
227
+
228
+ echo Cartflows_Admin_Fields::title_field(
229
+ array(
230
+ 'title' => __( 'Enable Events:', 'cartflows' ),
231
+ )
232
+ );
233
+
234
+
235
+ echo Cartflows_Admin_Fields::checkobox_field(
236
+ array(
237
+ 'id' => 'wcf_facebook_pixel_initiate_checkout',
238
+ 'name' => '_cartflows_facebook[facebook_pixel_initiate_checkout]',
239
+ 'title' => __( 'Initiate Checkout', 'cartflows' ),
240
+ 'value' => $facebook_settings['facebook_pixel_initiate_checkout'],
241
+ )
242
+ );
243
+
244
+ echo Cartflows_Admin_Fields::checkobox_field(
245
+ array(
246
+ 'id' => 'wcf_facebook_pixel_add_payment_info',
247
+ 'name' => '_cartflows_facebook[facebook_pixel_add_payment_info]',
248
+ 'title' => __( 'Add Payment Info', 'cartflows' ),
249
+ 'value' => $facebook_settings['facebook_pixel_add_payment_info'],
250
+ )
251
+ );
252
+
253
+ echo Cartflows_Admin_Fields::checkobox_field(
254
+ array(
255
+ 'id' => 'wcf_facebook_pixel_purchase_complete',
256
+ 'name' => '_cartflows_facebook[facebook_pixel_purchase_complete]',
257
+ 'title' => __( 'Purchase Complete', 'cartflows' ),
258
+ 'value' => $facebook_settings['facebook_pixel_purchase_complete'],
259
+ )
260
+ );
261
+
262
+ echo '</div>';
263
+
264
+ ?>
265
+ </div>
266
+
267
+ <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-facebook-setting-save-btn button-primary button', 'submit', false ); ?>
268
+ <?php wp_nonce_field( 'cartflows-facebook-settings', 'cartflows-facebook-settings-nonce' ); ?>
269
+ </div>
270
+
271
+ </div>
272
+ </div>
273
+ </form>
274
+
275
+
276
+ </div>
277
+ </div>
278
+ <div class="postbox-container" id="postbox-container-1">
279
+ <div id="side-sortables">
280
+
281
+ <div class="postbox">
282
+ <h2 class="hndle">
283
+ <span class="dashicons dashicons-book"></span>
284
+ <span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
285
+ </h2>
286
+ <div class="inside">
287
+ <p>
288
+ <?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
289
+ </p>
290
+ <p>
291
+ <a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
292
+ </p>
293
+ </div>
294
+ </div>
295
+
296
+ <div class="postbox">
297
+ <h2 class="hndle">
298
+ <span class="dashicons dashicons-groups"></span>
299
+ <span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
300
+ </h2>
301
+ <div class="inside">
302
+ <p>
303
+ <?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
304
+ </p>
305
+ <p>
306
+ <a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
307
+ </p>
308
+ </div>
309
+ </div>
310
+
311
+ <div class="postbox">
312
+ <h2 class="hndle">
313
+ <span class="dashicons dashicons-sos"></span>
314
+ <span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
315
+ </h2>
316
+ <div class="inside">
317
+ <p>
318
+ <?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
319
+ </p>
320
+ <p>
321
+ <a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a Ticket »', 'cartflows' ); ?></a>
322
+ </p>
323
+ </div>
324
+ </div>
325
+ <?php
326
+ if ( 'true' == $debug_on ) {
327
+ ?>
328
+ <div class="postbox">
329
+ <h2 class="hndle">
330
+ <span class="dashicons dashicons-editor-code"></span>
331
+ <span><?php esc_html_e( 'Load Minified CSS', 'cartflows' ); ?></span>
332
+ </h2>
333
+ <div class="inside">
334
+ <form method="post" class="wrap wcf-clear" action="">
335
+ <p>
336
+ <?php esc_html_e( 'Load the Minified CSS from here. Just Enable it by checking the below given checkbox.', 'cartflows' ); ?>
337
+ </p>
338
+ <?php
339
+ echo Cartflows_Admin_Fields::checkobox_field(
340
+ array(
341
+ 'id' => 'allow_minified_files',
342
+ 'name' => '_cartflows_debug_data[allow_minified_files]',
343
+ 'title' => __( 'Load minified CSS & JS Files', 'cartflows' ),
344
+ 'value' => $debug_data['allow_minified_files'],
345
+ )
346
+ );
347
+ ?>
348
+ <?php submit_button( __( 'Save', 'cartflows' ), 'button-primary button', 'submit', false ); ?>
349
+ <?php wp_nonce_field( 'cartflows-debug-settings', 'cartflows-debug-settings-nonce' ); ?>
350
+ </form>
351
+ </div>
352
+ </div>
353
+ <?php
354
+ }
355
+ ?>
356
+ </div>
357
+ </div>
358
+ </div>
359
+ <!-- /post-body -->
360
+ <br class="clear">
361
+ </div>
362
+ </div>
363
+ <?php endif; ?>
364
+
365
+ <?php
366
+ /**
367
+ * Loads Zapier settings admin view.
368
+ */
369
+ do_action( 'cartflows_after_general_settings' );
370
+ ?>
languages/cartflows.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: CartFlows 1.3.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
- "POT-Creation-Date: 2020-01-14 07:19:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -53,6 +53,7 @@ msgstr ""
53
 
54
  #: classes/class-cartflows-admin.php:153 classes/class-cartflows-admin.php:154
55
  #: includes/admin/cartflows-general-bck.php:34
 
56
  msgid "Settings"
57
  msgstr ""
58
 
@@ -69,22 +70,22 @@ msgid "Flows Library"
69
  msgstr ""
70
 
71
  #: classes/class-cartflows-admin.php:467
72
- #: modules/flow/view/meta-flow-steps.php:149
73
  msgid "Ready Templates"
74
  msgstr ""
75
 
76
  #: classes/class-cartflows-admin.php:470
77
- #: modules/flow/view/meta-flow-steps.php:152
78
  msgid "Create Your Own"
79
  msgstr ""
80
 
81
  #: classes/class-cartflows-admin.php:481
82
- #: modules/flow/view/meta-flow-steps.php:164
83
  msgid "Search Sites"
84
  msgstr ""
85
 
86
  #: classes/class-cartflows-admin.php:482
87
- #: modules/flow/view/meta-flow-steps.php:165
88
  msgid "Search Flow..."
89
  msgstr ""
90
 
@@ -95,7 +96,7 @@ msgstr ""
95
  #: classes/class-cartflows-admin.php:500
96
  #: classes/class-cartflows-importer.php:636
97
  #: classes/class-cartflows-importer.php:735
98
- #: modules/flow/view/meta-flow-steps.php:195
99
  msgid "Learn How"
100
  msgstr ""
101
 
@@ -108,7 +109,7 @@ msgid "Clone this flow"
108
  msgstr ""
109
 
110
  #: classes/class-cartflows-cloning.php:423
111
- #: modules/flow/view/meta-flow-steps.php:108
112
  msgid "Clone"
113
  msgstr ""
114
 
@@ -245,61 +246,61 @@ msgstr ""
245
  msgid "Select Step Type"
246
  msgstr ""
247
 
248
- #: classes/class-cartflows-importer.php:922
249
  msgid "Import from Cloud"
250
  msgstr ""
251
 
252
- #: classes/class-cartflows-importer.php:1236
253
  msgid "Sales Landing"
254
  msgstr ""
255
 
256
- #: classes/class-cartflows-importer.php:1240
257
  #: modules/flow/classes/class-cartflows-step-post-type.php:244
258
  #: modules/flow/view/meta-flow-steps.php:12
259
  msgid "Checkout (Woo)"
260
  msgstr ""
261
 
262
- #: classes/class-cartflows-importer.php:1244
263
  #: modules/flow/classes/class-cartflows-step-post-type.php:251
264
  #: modules/flow/view/meta-flow-steps.php:13
265
  msgid "Thank You (Woo)"
266
  msgstr ""
267
 
268
- #: classes/class-cartflows-importer.php:1252
269
  #: modules/flow/classes/class-cartflows-step-post-type.php:237
270
  #: modules/flow/view/meta-flow-steps.php:11
271
  msgid "Landing"
272
  msgstr ""
273
 
274
- #: classes/class-cartflows-importer.php:1256
275
  msgid "Thank You"
276
  msgstr ""
277
 
278
- #: classes/class-cartflows-importer.php:1358
279
  #. translators: %s: template ID
280
  msgid "Invalid template id %1$s or post id %2$s."
281
  msgstr ""
282
 
283
- #: classes/class-cartflows-importer.php:1416
284
  #. translators: %s: flow ID
285
  msgid "Invalid flow id %1$s OR step type %2$s."
286
  msgstr ""
287
 
288
- #: classes/class-cartflows-importer.php:1541
289
  msgid ""
290
  "Elementor is not activated. Please activate plugin Elementor Page Builder "
291
  "to import the step."
292
  msgstr ""
293
 
294
- #: classes/class-cartflows-importer.php:1644
295
  msgid "Action failed. Invalid Security Nonce."
296
  msgstr ""
297
 
298
- #: classes/class-cartflows-importer.php:1651
299
  msgid "User have not plugin install permissions."
300
  msgstr ""
301
 
302
- #: classes/class-cartflows-importer.php:1673
303
  msgid "Plugin Successfully Activated"
304
  msgstr ""
305
 
@@ -318,25 +319,25 @@ msgstr ""
318
  msgid "Select CartFlows Template for this Course"
319
  msgstr ""
320
 
321
- #: classes/class-cartflows-loader.php:225
322
  #. translators: %s: html tags
323
  msgid ""
324
  "You are using an older version of %1$sCartFlows Pro%2$s. Please update "
325
  "%1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher."
326
  msgstr ""
327
 
328
- #: classes/class-cartflows-loader.php:482
329
  #. translators: %s: html tags
330
  msgid ""
331
  "This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & "
332
  "activated."
333
  msgstr ""
334
 
335
- #: classes/class-cartflows-loader.php:492
336
  msgid "Activate WooCommerce"
337
  msgstr ""
338
 
339
- #: classes/class-cartflows-loader.php:500
340
  msgid "Install WooCommerce"
341
  msgstr ""
342
 
@@ -462,7 +463,7 @@ msgstr ""
462
  #: classes/class-cartflows-meta.php:63
463
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:192
464
  #: modules/landing/classes/class-cartflows-landing-meta.php:136
465
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:148
466
  msgid "Custom Script"
467
  msgstr ""
468
 
@@ -693,7 +694,7 @@ msgstr ""
693
 
694
  #: includes/admin/cartflows-error-log.php:41
695
  #: modules/flow/classes/class-cartflows-flow-post-type.php:225
696
- #: modules/flow/view/meta-flow-steps.php:97
697
  msgid "View"
698
  msgstr ""
699
 
@@ -727,7 +728,7 @@ msgid "Disallow search engines from indexing flows"
727
  msgstr ""
728
 
729
  #: includes/admin/cartflows-general.php:75
730
- #: modules/flow/view/meta-flow-steps.php:86
731
  msgid "Global Checkout"
732
  msgstr ""
733
 
@@ -892,14 +893,14 @@ msgid "Import"
892
  msgstr ""
893
 
894
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:254
895
- #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:65
896
  msgid ""
897
  "WooCommerce functions do not exist. If you are in an IFrame, please reload "
898
  "it."
899
  msgstr ""
900
 
901
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:255
902
- #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:66
903
  msgid "Click Here to Reload"
904
  msgstr ""
905
 
@@ -927,29 +928,29 @@ msgstr ""
927
  msgid "This product can't be purchased"
928
  msgstr ""
929
 
930
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1075
931
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1118
932
  msgid "Coupon Code"
933
  msgstr ""
934
 
935
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1076
936
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1127
937
  msgid "Apply"
938
  msgstr ""
939
 
940
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1283
941
  msgid "Sorry there was a problem removing this coupon."
942
  msgstr ""
943
 
944
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1286
945
  msgid "Coupon has been removed."
946
  msgstr ""
947
 
948
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1305
949
  msgid "Sorry there was a problem removing "
950
  msgstr ""
951
 
952
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:1308
953
  msgid " has been removed."
954
  msgstr ""
955
 
@@ -1075,8 +1076,8 @@ msgstr ""
1075
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:534
1076
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:580
1077
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:672
1078
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:203
1079
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:226
1080
  msgid "Font Family"
1081
  msgstr ""
1082
 
@@ -1085,7 +1086,7 @@ msgid "Advance Options"
1085
  msgstr ""
1086
 
1087
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:519
1088
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:211
1089
  msgid "Heading"
1090
  msgstr ""
1091
 
@@ -1096,7 +1097,7 @@ msgstr ""
1096
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:543
1097
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:589
1098
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:681
1099
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:235
1100
  msgid "Font Weight"
1101
  msgstr ""
1102
 
@@ -1294,7 +1295,7 @@ msgid ""
1294
  msgstr ""
1295
 
1296
  #: modules/flow/classes/class-cartflows-flow-meta.php:769
1297
- #: modules/flow/view/meta-flow-steps.php:126
1298
  msgid "Add New Step"
1299
  msgstr ""
1300
 
@@ -1420,12 +1421,12 @@ msgid "All Steps"
1420
  msgstr ""
1421
 
1422
  #: modules/flow/classes/class-cartflows-step-post-type.php:164
1423
- #: modules/flow/view/meta-flow-steps.php:99
1424
  msgid "Edit Step"
1425
  msgstr ""
1426
 
1427
  #: modules/flow/classes/class-cartflows-step-post-type.php:165
1428
- #: modules/flow/view/meta-flow-steps.php:95
1429
  msgid "View Step"
1430
  msgstr ""
1431
 
@@ -1455,39 +1456,39 @@ msgstr ""
1455
  msgid "Downsell (Woo)"
1456
  msgstr ""
1457
 
1458
- #: modules/flow/view/meta-flow-steps.php:78
1459
  msgid "No Product Assigned"
1460
  msgstr ""
1461
 
1462
- #: modules/flow/view/meta-flow-steps.php:82
1463
  msgid "Global Checkout - Remove selected checkout product"
1464
  msgstr ""
1465
 
1466
- #: modules/flow/view/meta-flow-steps.php:101
1467
  msgid "Edit"
1468
  msgstr ""
1469
 
1470
- #: modules/flow/view/meta-flow-steps.php:106
1471
  msgid "Clone Step"
1472
  msgstr ""
1473
 
1474
- #: modules/flow/view/meta-flow-steps.php:111
1475
  msgid "Delete Step"
1476
  msgstr ""
1477
 
1478
- #: modules/flow/view/meta-flow-steps.php:113
1479
  msgid "Delete"
1480
  msgstr ""
1481
 
1482
- #: modules/flow/view/meta-flow-steps.php:142
1483
  msgid "Steps Library"
1484
  msgstr ""
1485
 
1486
- #: modules/flow/view/meta-flow-steps.php:191
1487
  msgid "Create Step"
1488
  msgstr ""
1489
 
1490
- #: modules/flow/view/meta-flow-steps.php:193
1491
  msgid "You need a Cartflows Pro version to import Upsell / Downsell"
1492
  msgstr ""
1493
 
@@ -1504,54 +1505,66 @@ msgid "Thank You Page Settings"
1504
  msgstr ""
1505
 
1506
  #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:136
1507
- msgid "Thank You Design"
1508
  msgstr ""
1509
 
1510
  #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:142
1511
- msgid "Thank You Fields"
1512
  msgstr ""
1513
 
1514
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:176
1515
  msgid "Order Details"
1516
  msgstr ""
1517
 
1518
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:188
1519
  msgid "Text"
1520
  msgstr ""
1521
 
1522
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:194
1523
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:217
1524
  msgid "Color"
1525
  msgstr ""
1526
 
1527
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:243
1528
  msgid "Advanced Options"
1529
  msgstr ""
1530
 
1531
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:253
1532
  msgid "Container Width (In px)"
1533
  msgstr ""
1534
 
1535
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:261
1536
  msgid "Section Background Color"
1537
  msgstr ""
1538
 
1539
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:275
1540
  msgid "Enable Order Overview "
1541
  msgstr ""
1542
 
1543
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:283
1544
  msgid "Enable Order Details "
1545
  msgstr ""
1546
 
1547
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:291
1548
  msgid "Enable Billing Details "
1549
  msgstr ""
1550
 
1551
- #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:299
1552
  msgid "Enable Shipping Details "
1553
  msgstr ""
1554
 
 
 
 
 
 
 
 
 
 
 
 
 
1555
  #: modules/widgets/class-cartflows-next-step.php:24
1556
  msgid "CartFlows Next Step"
1557
  msgstr ""
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: CartFlows 1.3.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
+ "POT-Creation-Date: 2020-01-28 07:43:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
53
 
54
  #: classes/class-cartflows-admin.php:153 classes/class-cartflows-admin.php:154
55
  #: includes/admin/cartflows-general-bck.php:34
56
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:148
57
  msgid "Settings"
58
  msgstr ""
59
 
70
  msgstr ""
71
 
72
  #: classes/class-cartflows-admin.php:467
73
+ #: modules/flow/view/meta-flow-steps.php:155
74
  msgid "Ready Templates"
75
  msgstr ""
76
 
77
  #: classes/class-cartflows-admin.php:470
78
+ #: modules/flow/view/meta-flow-steps.php:158
79
  msgid "Create Your Own"
80
  msgstr ""
81
 
82
  #: classes/class-cartflows-admin.php:481
83
+ #: modules/flow/view/meta-flow-steps.php:170
84
  msgid "Search Sites"
85
  msgstr ""
86
 
87
  #: classes/class-cartflows-admin.php:482
88
+ #: modules/flow/view/meta-flow-steps.php:171
89
  msgid "Search Flow..."
90
  msgstr ""
91
 
96
  #: classes/class-cartflows-admin.php:500
97
  #: classes/class-cartflows-importer.php:636
98
  #: classes/class-cartflows-importer.php:735
99
+ #: modules/flow/view/meta-flow-steps.php:201
100
  msgid "Learn How"
101
  msgstr ""
102
 
109
  msgstr ""
110
 
111
  #: classes/class-cartflows-cloning.php:423
112
+ #: modules/flow/view/meta-flow-steps.php:114
113
  msgid "Clone"
114
  msgstr ""
115
 
246
  msgid "Select Step Type"
247
  msgstr ""
248
 
249
+ #: classes/class-cartflows-importer.php:923
250
  msgid "Import from Cloud"
251
  msgstr ""
252
 
253
+ #: classes/class-cartflows-importer.php:1237
254
  msgid "Sales Landing"
255
  msgstr ""
256
 
257
+ #: classes/class-cartflows-importer.php:1241
258
  #: modules/flow/classes/class-cartflows-step-post-type.php:244
259
  #: modules/flow/view/meta-flow-steps.php:12
260
  msgid "Checkout (Woo)"
261
  msgstr ""
262
 
263
+ #: classes/class-cartflows-importer.php:1245
264
  #: modules/flow/classes/class-cartflows-step-post-type.php:251
265
  #: modules/flow/view/meta-flow-steps.php:13
266
  msgid "Thank You (Woo)"
267
  msgstr ""
268
 
269
+ #: classes/class-cartflows-importer.php:1253
270
  #: modules/flow/classes/class-cartflows-step-post-type.php:237
271
  #: modules/flow/view/meta-flow-steps.php:11
272
  msgid "Landing"
273
  msgstr ""
274
 
275
+ #: classes/class-cartflows-importer.php:1257
276
  msgid "Thank You"
277
  msgstr ""
278
 
279
+ #: classes/class-cartflows-importer.php:1359
280
  #. translators: %s: template ID
281
  msgid "Invalid template id %1$s or post id %2$s."
282
  msgstr ""
283
 
284
+ #: classes/class-cartflows-importer.php:1417
285
  #. translators: %s: flow ID
286
  msgid "Invalid flow id %1$s OR step type %2$s."
287
  msgstr ""
288
 
289
+ #: classes/class-cartflows-importer.php:1542
290
  msgid ""
291
  "Elementor is not activated. Please activate plugin Elementor Page Builder "
292
  "to import the step."
293
  msgstr ""
294
 
295
+ #: classes/class-cartflows-importer.php:1645
296
  msgid "Action failed. Invalid Security Nonce."
297
  msgstr ""
298
 
299
+ #: classes/class-cartflows-importer.php:1652
300
  msgid "User have not plugin install permissions."
301
  msgstr ""
302
 
303
+ #: classes/class-cartflows-importer.php:1674
304
  msgid "Plugin Successfully Activated"
305
  msgstr ""
306
 
319
  msgid "Select CartFlows Template for this Course"
320
  msgstr ""
321
 
322
+ #: classes/class-cartflows-loader.php:217
323
  #. translators: %s: html tags
324
  msgid ""
325
  "You are using an older version of %1$sCartFlows Pro%2$s. Please update "
326
  "%1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher."
327
  msgstr ""
328
 
329
+ #: classes/class-cartflows-loader.php:470
330
  #. translators: %s: html tags
331
  msgid ""
332
  "This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & "
333
  "activated."
334
  msgstr ""
335
 
336
+ #: classes/class-cartflows-loader.php:480
337
  msgid "Activate WooCommerce"
338
  msgstr ""
339
 
340
+ #: classes/class-cartflows-loader.php:488
341
  msgid "Install WooCommerce"
342
  msgstr ""
343
 
463
  #: classes/class-cartflows-meta.php:63
464
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:192
465
  #: modules/landing/classes/class-cartflows-landing-meta.php:136
466
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:154
467
  msgid "Custom Script"
468
  msgstr ""
469
 
694
 
695
  #: includes/admin/cartflows-error-log.php:41
696
  #: modules/flow/classes/class-cartflows-flow-post-type.php:225
697
+ #: modules/flow/view/meta-flow-steps.php:103
698
  msgid "View"
699
  msgstr ""
700
 
728
  msgstr ""
729
 
730
  #: includes/admin/cartflows-general.php:75
731
+ #: modules/flow/view/meta-flow-steps.php:92
732
  msgid "Global Checkout"
733
  msgstr ""
734
 
893
  msgstr ""
894
 
895
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:254
896
+ #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:88
897
  msgid ""
898
  "WooCommerce functions do not exist. If you are in an IFrame, please reload "
899
  "it."
900
  msgstr ""
901
 
902
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:255
903
+ #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:89
904
  msgid "Click Here to Reload"
905
  msgstr ""
906
 
928
  msgid "This product can't be purchased"
929
  msgstr ""
930
 
931
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1043
932
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1086
933
  msgid "Coupon Code"
934
  msgstr ""
935
 
936
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1044
937
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1095
938
  msgid "Apply"
939
  msgstr ""
940
 
941
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1251
942
  msgid "Sorry there was a problem removing this coupon."
943
  msgstr ""
944
 
945
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1254
946
  msgid "Coupon has been removed."
947
  msgstr ""
948
 
949
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1273
950
  msgid "Sorry there was a problem removing "
951
  msgstr ""
952
 
953
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:1276
954
  msgid " has been removed."
955
  msgstr ""
956
 
1076
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:534
1077
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:580
1078
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:672
1079
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:209
1080
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:232
1081
  msgid "Font Family"
1082
  msgstr ""
1083
 
1086
  msgstr ""
1087
 
1088
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:519
1089
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:217
1090
  msgid "Heading"
1091
  msgstr ""
1092
 
1097
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:543
1098
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:589
1099
  #: modules/checkout/classes/class-cartflows-checkout-meta.php:681
1100
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:241
1101
  msgid "Font Weight"
1102
  msgstr ""
1103
 
1295
  msgstr ""
1296
 
1297
  #: modules/flow/classes/class-cartflows-flow-meta.php:769
1298
+ #: modules/flow/view/meta-flow-steps.php:132
1299
  msgid "Add New Step"
1300
  msgstr ""
1301
 
1421
  msgstr ""
1422
 
1423
  #: modules/flow/classes/class-cartflows-step-post-type.php:164
1424
+ #: modules/flow/view/meta-flow-steps.php:105
1425
  msgid "Edit Step"
1426
  msgstr ""
1427
 
1428
  #: modules/flow/classes/class-cartflows-step-post-type.php:165
1429
+ #: modules/flow/view/meta-flow-steps.php:101
1430
  msgid "View Step"
1431
  msgstr ""
1432
 
1456
  msgid "Downsell (Woo)"
1457
  msgstr ""
1458
 
1459
+ #: modules/flow/view/meta-flow-steps.php:84
1460
  msgid "No Product Assigned"
1461
  msgstr ""
1462
 
1463
+ #: modules/flow/view/meta-flow-steps.php:88
1464
  msgid "Global Checkout - Remove selected checkout product"
1465
  msgstr ""
1466
 
1467
+ #: modules/flow/view/meta-flow-steps.php:107
1468
  msgid "Edit"
1469
  msgstr ""
1470
 
1471
+ #: modules/flow/view/meta-flow-steps.php:112
1472
  msgid "Clone Step"
1473
  msgstr ""
1474
 
1475
+ #: modules/flow/view/meta-flow-steps.php:117
1476
  msgid "Delete Step"
1477
  msgstr ""
1478
 
1479
+ #: modules/flow/view/meta-flow-steps.php:119
1480
  msgid "Delete"
1481
  msgstr ""
1482
 
1483
+ #: modules/flow/view/meta-flow-steps.php:148
1484
  msgid "Steps Library"
1485
  msgstr ""
1486
 
1487
+ #: modules/flow/view/meta-flow-steps.php:197
1488
  msgid "Create Step"
1489
  msgstr ""
1490
 
1491
+ #: modules/flow/view/meta-flow-steps.php:199
1492
  msgid "You need a Cartflows Pro version to import Upsell / Downsell"
1493
  msgstr ""
1494
 
1505
  msgstr ""
1506
 
1507
  #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:136
1508
+ msgid "Design"
1509
  msgstr ""
1510
 
1511
  #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:142
1512
+ msgid "Edit Fields"
1513
  msgstr ""
1514
 
1515
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:182
1516
  msgid "Order Details"
1517
  msgstr ""
1518
 
1519
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:194
1520
  msgid "Text"
1521
  msgstr ""
1522
 
1523
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:200
1524
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:223
1525
  msgid "Color"
1526
  msgstr ""
1527
 
1528
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:249
1529
  msgid "Advanced Options"
1530
  msgstr ""
1531
 
1532
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:259
1533
  msgid "Container Width (In px)"
1534
  msgstr ""
1535
 
1536
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:267
1537
  msgid "Section Background Color"
1538
  msgstr ""
1539
 
1540
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:281
1541
  msgid "Enable Order Overview "
1542
  msgstr ""
1543
 
1544
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:289
1545
  msgid "Enable Order Details "
1546
  msgstr ""
1547
 
1548
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:297
1549
  msgid "Enable Billing Details "
1550
  msgstr ""
1551
 
1552
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:305
1553
  msgid "Enable Shipping Details "
1554
  msgstr ""
1555
 
1556
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:321
1557
+ msgid "Redirect After Purchase"
1558
+ msgstr ""
1559
+
1560
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:330
1561
+ msgid "Redirect Link"
1562
+ msgstr ""
1563
+
1564
+ #: modules/thankyou/classes/class-cartflows-thankyou-meta.php:334
1565
+ msgid "https://"
1566
+ msgstr ""
1567
+
1568
  #: modules/widgets/class-cartflows-next-step.php:24
1569
  msgid "CartFlows Next Step"
1570
  msgstr ""
modules/checkout/classes/class-cartflows-checkout-markup.php CHANGED
@@ -146,7 +146,7 @@ class Cartflows_Checkout_Markup {
146
 
147
  $checkout_id = get_the_ID();
148
  if ( ! $checkout_id ) {
149
- $checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? intval( $_POST['option']['checkout_id'] ) : 0;
150
  }
151
 
152
  $wcf_order_button_text = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-place-order-button-text' );
@@ -187,7 +187,7 @@ class Cartflows_Checkout_Markup {
187
  }
188
 
189
  // Return if the key OR Order paramater is found in the URL for certain Payment gateways.
190
- if ( isset( $_GET['key'] ) || isset( $_GET['order'] ) ) {
191
  return;
192
  }
193
 
@@ -946,49 +946,17 @@ class Cartflows_Checkout_Markup {
946
  */
947
  public function save_checkout_fields( $order_id, $posted ) {
948
 
949
- if ( isset( $_POST['_wcf_checkout_id'] ) ) {
950
 
951
- $checkout_id = wc_clean( wp_unslash( $_POST['_wcf_checkout_id'] ) ); //phpcs:ignore
952
 
953
  update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
954
 
955
- /**
956
- Custom Field To Do
957
- $custom_fields = get_post_meta( $checkout_id, 'wcf-custom-checkout-fields', true );
958
-
959
- //If condition
960
- if ( 'yes' === $custom_fields ) {
961
-
962
- $billing_fields = get_post_meta( $checkout_id, 'wcf_fields_billing', true );
963
-
964
- foreach ( $billing_fields as $field => $data ) {
965
-
966
- if ( isset( $data['custom'] ) && $data['custom'] ) {
967
-
968
- if ( isset( $_POST[ $field ] ) ) {
969
- update_post_meta( $order_id, $field, wc_clean( $_POST[ $field ] ) );
970
- }
971
- }
972
- }
973
-
974
- $shipping_fields = get_post_meta( $checkout_id, 'wcf_fields_shipping', true );
975
-
976
- foreach ( $shipping_fields as $field => $data ) {
977
-
978
- if ( isset( $data['custom'] ) && $data['custom'] ) {
979
-
980
- if ( isset( $_POST[ $field ] ) ) {
981
- update_post_meta( $order_id, $field, wc_clean( $_POST[ $field ] ) );
982
- }
983
- }
984
- }
985
- }
986
- */
987
- if ( isset( $_POST['_wcf_flow_id'] ) ) {
988
 
989
- $checkout_id = wc_clean( wp_unslash( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
990
 
991
- update_post_meta( $order_id, '_wcf_flow_id', $checkout_id );
992
  }
993
  }
994
 
@@ -1048,9 +1016,9 @@ class Cartflows_Checkout_Markup {
1048
  */
1049
  public function after_login_redirect( $redirect, $user ) {
1050
 
1051
- if ( isset( $_POST['_wcf_checkout_id'] ) ) {
1052
 
1053
- $checkout_id = intval( $_POST['_wcf_checkout_id'] );
1054
 
1055
  $redirect = get_permalink( $checkout_id );
1056
  }
146
 
147
  $checkout_id = get_the_ID();
148
  if ( ! $checkout_id ) {
149
+ $checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? intval( $_POST['option']['checkout_id'] ) : 0; //phpcs:ignore
150
  }
151
 
152
  $wcf_order_button_text = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-place-order-button-text' );
187
  }
188
 
189
  // Return if the key OR Order paramater is found in the URL for certain Payment gateways.
190
+ if ( isset( $_GET['key'] ) || isset( $_GET['order'] ) ) { //phpcs:ignore
191
  return;
192
  }
193
 
946
  */
947
  public function save_checkout_fields( $order_id, $posted ) {
948
 
949
+ if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
950
 
951
+ $checkout_id = wc_clean( intval( $_POST['_wcf_checkout_id'] ) ); //phpcs:ignore
952
 
953
  update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
954
 
955
+ if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
 
957
+ $flow_id = wc_clean( intval( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
958
 
959
+ update_post_meta( $order_id, '_wcf_flow_id', $flow_id );
960
  }
961
  }
962
 
1016
  */
1017
  public function after_login_redirect( $redirect, $user ) {
1018
 
1019
+ if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
1020
 
1021
+ $checkout_id = intval( $_POST['_wcf_checkout_id'] ); //phpcs:ignore
1022
 
1023
  $redirect = get_permalink( $checkout_id );
1024
  }
modules/checkout/classes/class-cartflows-checkout-meta.php CHANGED
@@ -1,881 +1,881 @@
1
- <?php
2
- /**
3
- * Checkout post meta
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Meta Boxes setup
10
- */
11
- class Cartflows_Checkout_Meta extends Cartflows_Meta {
12
-
13
-
14
- /**
15
- * Instance
16
- *
17
- * @var $instance
18
- */
19
- private static $instance;
20
-
21
- /**
22
- * Meta Option
23
- *
24
- * @var $meta_option
25
- */
26
- private static $meta_option = null;
27
-
28
- /**
29
- * Initiator
30
- */
31
- public static function get_instance() {
32
- if ( ! isset( self::$instance ) ) {
33
- self::$instance = new self();
34
- }
35
-
36
- return self::$instance;
37
- }
38
-
39
- /**
40
- * Constructor
41
- */
42
- public function __construct() {
43
-
44
- /* Init Metabox */
45
- add_action( 'load-post.php', array( $this, 'init_metabox' ) );
46
- add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
47
- }
48
- /**
49
- * Init Metabox
50
- */
51
- public function init_metabox() {
52
-
53
- add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54
- add_action( 'save_post', array( $this, 'save_meta_box' ) );
55
- }
56
-
57
- /**
58
- * Setup Metabox
59
- */
60
- public function setup_meta_box() {
61
-
62
- if ( _is_wcf_checkout_type() ) {
63
- add_meta_box(
64
- 'wcf-checkout-settings', // Id.
65
- __( 'Checkout Layout', 'cartflows' ), // Title.
66
- array( $this, 'markup_meta_box' ), // Callback.
67
- wcf()->utils->get_step_post_type(), // Post_type.
68
- 'normal', // Context.
69
- 'high' // Priority.
70
- );
71
- }
72
- }
73
-
74
- /**
75
- * Metabox Markup
76
- *
77
- * @param object $post Post object.
78
- * @return void
79
- */
80
- public function markup_meta_box( $post ) {
81
-
82
- wp_nonce_field( 'save-nonce-checkout-step-meta', 'nonce-checkout-step-meta' );
83
-
84
- $stored = get_post_meta( $post->ID );
85
-
86
- $checkout_meta = self::get_meta_option( $post->ID );
87
-
88
- // Set stored and override defaults.
89
- foreach ( $stored as $key => $value ) {
90
- if ( array_key_exists( $key, $checkout_meta ) ) {
91
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
92
- } else {
93
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
94
- }
95
- }
96
-
97
- // Get defaults.
98
- $meta = self::get_meta_option( $post->ID );
99
- $checkout_data = array();
100
-
101
- foreach ( $meta as $key => $value ) {
102
- $checkout_data[ $key ] = $meta[ $key ]['default'];
103
- }
104
-
105
- /**
106
- $billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post->ID );
107
-
108
- // For loop
109
- foreach ( $billing_fields as $key => $value ) {
110
-
111
- $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
112
- }
113
-
114
- $shipping_fields = Cartflows_Helper::get_checkout_fields( 'shipping', $post->ID );
115
-
116
- foreach ( $shipping_fields as $key => $value ) {
117
-
118
- $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
119
- }
120
-
121
- $additional_fields = Cartflows_Helper::get_checkout_fields( 'additional', $post->ID );
122
-
123
- foreach ( $additional_fields as $key => $value ) {
124
-
125
- $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
126
- }
127
- */
128
-
129
- do_action( 'wcf_checkout_settings_markup_before' );
130
- $this->tabs_markup( $checkout_data, $post->ID );
131
- do_action( 'wcf_checkout_settings_markup_after' );
132
- }
133
-
134
- /**
135
- * Page Header Tabs
136
- *
137
- * @param array $options options.
138
- * @param int $post_id post ID.
139
- */
140
- public function tabs_markup( $options, $post_id ) {
141
-
142
- $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
143
-
144
- if ( empty( $active_tab ) ) {
145
- $active_tab = 'wcf-checkout-shortcodes';
146
- }
147
-
148
- $tab_array = array(
149
- array(
150
- 'title' => __( 'Shortcodes', 'cartflows' ),
151
- 'id' => 'wcf-checkout-shortcodes',
152
- 'class' => 'wcf-checkout-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
153
- 'icon' => 'dashicons-editor-code',
154
- ),
155
- array(
156
- 'title' => __( 'Select Product', 'cartflows' ),
157
- 'id' => 'wcf-checkout-general',
158
- 'class' => 'wcf-checkout-general' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
159
- 'icon' => 'dashicons-info',
160
- ),
161
- array(
162
- 'title' => __( 'Order Bump', 'cartflows' ),
163
- 'id' => 'wcf-product-order-bump',
164
- 'class' => 'wcf-product-order-bump' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
165
- 'icon' => 'dashicons-cart',
166
- ),
167
- array(
168
- 'title' => __( 'Checkout Offer', 'cartflows' ),
169
- 'id' => 'wcf-pre-checkout-offer',
170
- 'class' => 'wcf-pre-checkout-offer' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
171
- 'icon' => 'dashicons-arrow-up-alt',
172
- ),
173
- array(
174
- 'title' => __( 'Checkout Design', 'cartflows' ),
175
- 'id' => 'wcf-checkout-style',
176
- 'class' => 'wcf-checkout-style' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
177
- 'icon' => 'dashicons-admin-customizer',
178
- ),
179
- array(
180
- 'title' => __( 'Checkout Fields', 'cartflows' ),
181
- 'id' => 'wcf-checkout-custom-fields',
182
- 'class' => 'wcf-checkout-custom-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
183
- 'icon' => 'dashicons-welcome-widgets-menus',
184
- ),
185
- array(
186
- 'title' => __( 'Checkout Settings', 'cartflows' ),
187
- 'id' => 'wcf-checkout-custom-settings',
188
- 'class' => 'wcf-checkout-custom-settings' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
189
- 'icon' => 'dashicons-admin-generic',
190
- ),
191
- array(
192
- 'title' => __( 'Custom Script', 'cartflows' ),
193
- 'id' => 'wcf-checkout-custom-script-header',
194
- 'class' => 'wcf-checkout-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
195
- 'icon' => 'dashicons-format-aside',
196
- ),
197
- );
198
-
199
- $show_logo = filter_input( INPUT_GET, 'logo-tab', FILTER_VALIDATE_BOOLEAN );
200
-
201
- if ( $show_logo ) {
202
- $logo_tab = array(
203
- 'title' => __( 'Logo (Optional)', 'cartflows' ),
204
- 'id' => 'wcf-checkout-header',
205
- 'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
206
- 'icon' => 'dashicons-format-image',
207
- );
208
- array_push( $tab_array, $logo_tab );
209
- }
210
-
211
- $tabs = apply_filters( 'cartflows_checkout_tabs', $tab_array, $active_tab );
212
-
213
- ?>
214
- <div class="wcf-checkout-table wcf-metabox-wrap widefat">
215
- <div class="wcf-table-container">
216
- <div class="wcf-column-left">
217
- <div class="wcf-tab-wrapper">
218
-
219
- <?php foreach ( $tabs as $key => $tab ) { ?>
220
- <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
221
- <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
222
- <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
223
- </div>
224
- <?php } ?>
225
-
226
- <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
227
- </div>
228
- </div>
229
- <div class="wcf-column-right">
230
- <?php $this->tab_shortcodes( $options, $post_id ); ?>
231
- <?php $this->tab_general( $options, $post_id ); ?>
232
- <?php $this->tab_style( $options, $post_id ); ?>
233
- <?php $this->tab_pre_checkout_offer( $options, $post_id ); ?>
234
- <?php $this->tab_product_bump( $options, $post_id ); ?>
235
- <?php $this->tab_custom_fields( $options, $post_id ); ?>
236
- <?php $this->tab_custom_settings( $options, $post_id ); ?>
237
- <?php $this->tab_header_content( $options, $post_id ); ?>
238
- <?php $this->tab_custom_script( $options, $post_id ); ?>
239
- <?php do_action( 'cartflows_checkout_tabs_content', $options, $post_id ); ?>
240
- <?php $this->right_column_footer( $options, $post_id ); ?>
241
- </div>
242
- </div>
243
- </div>
244
-
245
- <?php
246
- }
247
-
248
- /**
249
- * Shortcodes tab
250
- *
251
- * @param array $options options.
252
- * @param int $post_id post ID.
253
- */
254
- public function tab_shortcodes( $options, $post_id ) {
255
- ?>
256
- <div class="wcf-checkout-shortcodes wcf-tab-content widefat">
257
-
258
- <?php
259
-
260
- echo wcf()->meta->get_shortcode_field(
261
- array(
262
- 'label' => 'Checkout Page',
263
- 'name' => 'wcf-checkout-shortcode',
264
- 'content' => '[cartflows_checkout]',
265
- 'help' => esc_html__( 'Add this shortcode to your checkout page', 'cartflows' ),
266
- )
267
- );
268
- ?>
269
- </div>
270
- <?php
271
- }
272
-
273
-
274
- /**
275
- * General tab
276
- *
277
- * @param array $options options.
278
- * @param int $post_id post ID.
279
- */
280
- public function tab_general( $options, $post_id ) {
281
- ?>
282
- <div class="wcf-checkout-general wcf-tab-content widefat">
283
-
284
- <?php
285
-
286
- echo wcf()->meta->get_product_selection_repeater(
287
- array(
288
- 'name' => 'wcf-checkout-products',
289
- 'value' => $options['wcf-checkout-products'],
290
- 'allow_clear' => true,
291
- )
292
- );
293
-
294
- if ( ! _is_cartflows_pro() ) {
295
-
296
- echo wcf()->meta->get_hr_line_field( array() );
297
- echo wcf()->meta->get_description_field(
298
- array(
299
- 'name' => 'wcf-upgrade-to-pro',
300
- /* translators: %s: link */
301
- 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Pre-applied Coupon, Product Variations & Quantity Options.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
302
- )
303
- );
304
- }
305
-
306
- do_action( 'cartflows_checkout_general_tab_content', $options, $post_id );
307
-
308
- ?>
309
- </div>
310
- <?php
311
- }
312
-
313
- /**
314
- * Pre Checkout tab
315
- *
316
- * @param array $options options.
317
- * @param int $post_id post ID.
318
- */
319
- public function tab_pre_checkout_offer( $options, $post_id ) {
320
- ?>
321
- <div class="wcf-pre-checkout-offer wcf-tab-content widefat">
322
- <?php
323
- if ( ! _is_cartflows_pro() ) {
324
- echo wcf()->meta->get_description_field(
325
- array(
326
- 'name' => 'wcf-upgrade-to-pro',
327
- /* translators: %s: link */
328
- 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
329
- )
330
- );
331
- } elseif ( _is_cartflows_pro_ver_less_than( '1.2.0' ) ) {
332
-
333
- $version = '1.2.0';
334
- echo wcf()->meta->get_description_field(
335
- array(
336
- 'name' => 'wcf-upgrade-to-pro',
337
- /* translators: %s: link */
338
- 'content' => '<i>' . sprintf( esc_html__( 'Update to %1$sCartFlows Pro%2$s to %3$s or above for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>', $version ) . '</i>',
339
- )
340
- );
341
- }
342
- ?>
343
-
344
- <?php do_action( 'cartflows_pre_checkout_offer_tab_content', $options, $post_id ); ?>
345
- </div>
346
- <?php
347
- }
348
-
349
-
350
-
351
- /**
352
- * Product bump tab
353
- *
354
- * @param array $options options.
355
- * @param int $post_id post ID.
356
- */
357
- public function tab_product_bump( $options, $post_id ) {
358
- ?>
359
- <div class="wcf-product-order-bump wcf-tab-content widefat">
360
- <?php
361
- if ( ! _is_cartflows_pro() ) {
362
- echo wcf()->meta->get_description_field(
363
- array(
364
- 'name' => 'wcf-upgrade-to-pro',
365
- /* translators: %s: link */
366
- 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
367
- )
368
- );
369
- }
370
- ?>
371
-
372
- <?php do_action( 'cartflows_order_bump_tab_content', $options, $post_id ); ?>
373
- </div>
374
- <?php
375
- }
376
- /**
377
- * Tab custom fields
378
- *
379
- * @param array $options options.
380
- * @param int $post_id post ID.
381
- */
382
- public function tab_custom_fields( $options, $post_id ) {
383
- ?>
384
- <div class="wcf-checkout-custom-fields wcf-tab-content widefat">
385
- <?php
386
- /* Custom Checkout Fields Section */
387
-
388
- if ( ! _is_cartflows_pro() ) {
389
- echo wcf()->meta->get_description_field(
390
- array(
391
- 'name' => 'wcf-upgrade-to-pro',
392
- /* translators: %s: link */
393
- 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
394
- )
395
- );
396
- }
397
- ?>
398
- <?php do_action( 'cartflows_custom_fields_tab_content', $options, $post_id ); ?>
399
- </div>
400
- <?php
401
- }
402
- /**
403
- * Tab custom settings
404
- *
405
- * @param array $options options.
406
- * @param int $post_id post ID.
407
- */
408
- public function tab_custom_settings( $options, $post_id ) {
409
- ?>
410
- <div class="wcf-checkout-custom-settings wcf-tab-content widefat">
411
- <div class="wcf-custom-settings-fields">
412
- <?php
413
-
414
- echo wcf()->meta->get_text_field(
415
- array(
416
- 'label' => __( 'Place Order Button Text', 'cartflows' ),
417
- 'name' => 'wcf-checkout-place-order-button-text',
418
- 'value' => $options['wcf-checkout-place-order-button-text'],
419
- 'attr' => array(
420
- 'placeholder' => __( 'Place order', 'cartflows' ),
421
- ),
422
- 'help' => __( 'It will change the Place Order Button text on checkout page.', 'cartflows' ),
423
- )
424
- );
425
-
426
- echo wcf()->meta->get_hr_line_field( array() );
427
-
428
- echo wcf()->meta->get_checkbox_field(
429
- array(
430
- 'name' => 'wcf-remove-product-field',
431
- 'value' => $options['wcf-remove-product-field'],
432
- 'after' => esc_html__( 'Enable cart editing on checkout', 'cartflows' ),
433
- )
434
- );
435
-
436
- echo wcf()->meta->get_description_field(
437
- array(
438
- 'name' => '',
439
- /* translators: %s: link */
440
- 'content' => '<i>' . sprintf( esc_html__( 'Users will able to remove products from the checkout page.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
441
- )
442
- );
443
- ?>
444
- </div>
445
- <?php do_action( 'cartflows_custom_settings_tab_content', $options, $post_id ); ?>
446
- </div>
447
- <?php
448
- }
449
-
450
- /**
451
- * Tab style
452
- *
453
- * @param array $options options.
454
- * @param int $post_id post ID.
455
- */
456
- public function tab_style( $options, $post_id ) {
457
- ?>
458
-
459
- <div class="wcf-checkout-style wcf-tab-content widefat">
460
- <div class="wcf-cs-fields">
461
- <div class="wcf-cs-checkbox-field">
462
- <?php
463
-
464
- $layout_pro_option = array();
465
-
466
- if ( ! _is_cartflows_pro() ) {
467
- $layout_pro_option = array(
468
- 'one-column' => __( 'One Column (Available in CartFlows Pro) ', 'cartflows' ),
469
- 'two-step' => __( 'Two Step (Available in CartFlows Pro) ', 'cartflows' ),
470
- );
471
- }
472
-
473
- echo wcf()->meta->get_select_field(
474
- array(
475
- 'label' => __( 'Checkout Skin', 'cartflows' ),
476
- 'name' => 'wcf-checkout-layout',
477
- 'value' => $options['wcf-checkout-layout'],
478
- 'options' => array(
479
- 'one-column' => esc_html__( 'One Column', 'cartflows' ),
480
- 'two-column' => esc_html__( 'Two Column', 'cartflows' ),
481
- 'two-step' => esc_html__( 'Two Step', 'cartflows' ),
482
- ),
483
- 'pro-options' => $layout_pro_option,
484
-
485
- )
486
- );
487
-
488
- echo wcf()->meta->get_color_picker_field(
489
- array(
490
- 'label' => __( 'Primary Color', 'cartflows' ),
491
- 'name' => 'wcf-primary-color',
492
- 'value' => $options['wcf-primary-color'],
493
- )
494
- );
495
-
496
- echo wcf()->meta->get_font_family_field(
497
- array(
498
- 'for' => 'wcf-base',
499
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
500
- 'name' => 'wcf-base-font-family',
501
- 'value' => $options['wcf-base-font-family'],
502
- )
503
- );
504
-
505
- echo wcf()->meta->get_checkbox_field(
506
- array(
507
- 'label' => __( 'Advance Options', 'cartflows' ),
508
- 'name' => 'wcf-advance-options-fields',
509
- 'value' => $options['wcf-advance-options-fields'],
510
- 'after' => 'Enable',
511
- )
512
- );
513
- ?>
514
- </div>
515
- <div class="wcf-cs-fields-options">
516
- <?php
517
- echo wcf()->meta->get_section(
518
- array(
519
- 'label' => __( 'Heading', 'cartflows' ),
520
- )
521
- );
522
-
523
- echo wcf()->meta->get_color_picker_field(
524
- array(
525
- 'label' => __( 'Heading Color', 'cartflows' ),
526
- 'name' => 'wcf-heading-color',
527
- 'value' => $options['wcf-heading-color'],
528
- )
529
- );
530
-
531
- echo wcf()->meta->get_font_family_field(
532
- array(
533
- 'for' => 'wcf-heading',
534
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
535
- 'name' => 'wcf-heading-font-family',
536
- 'value' => $options['wcf-heading-font-family'],
537
- )
538
- );
539
-
540
- echo wcf()->meta->get_font_weight_field(
541
- array(
542
- 'for' => 'wcf-heading',
543
- 'label' => esc_html__( 'Font Weight', 'cartflows' ),
544
- 'name' => 'wcf-heading-font-weight',
545
- 'value' => $options['wcf-heading-font-weight'],
546
- )
547
- );
548
-
549
- echo wcf()->meta->get_section(
550
- array(
551
- 'label' => __( 'Input Fields', 'cartflows' ),
552
- )
553
- );
554
-
555
- $fields_skin_pro_option = array();
556
-
557
- if ( ! _is_cartflows_pro() ) {
558
- $fields_skin_pro_option = array(
559
- 'style-one' => __( 'Floating Labels (Available in CartFlows Pro)', 'cartflows' ),
560
- );
561
- }
562
-
563
- echo wcf()->meta->get_select_field(
564
- array(
565
- 'label' => __( 'Style', 'cartflows' ),
566
- 'name' => 'wcf-fields-skins',
567
- 'value' => $options['wcf-fields-skins'],
568
- 'options' => array(
569
- 'default' => esc_html__( 'Default', 'cartflows' ),
570
- 'style-one' => esc_html__( 'Floating Labels', 'cartflows' ),
571
- ),
572
- 'pro-options' => $fields_skin_pro_option,
573
-
574
- )
575
- );
576
-
577
- echo wcf()->meta->get_font_family_field(
578
- array(
579
- 'for' => 'wcf-input',
580
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
581
- 'name' => 'wcf-input-font-family',
582
- 'value' => $options['wcf-input-font-family'],
583
- )
584
- );
585
-
586
- echo wcf()->meta->get_font_weight_field(
587
- array(
588
- 'for' => 'wcf-input',
589
- 'label' => esc_html__( 'Font Weight', 'cartflows' ),
590
- 'name' => 'wcf-input-font-weight',
591
- 'value' => $options['wcf-input-font-weight'],
592
- )
593
- );
594
-
595
- echo wcf()->meta->get_select_field(
596
- array(
597
- 'label' => __( 'Size', 'cartflows' ),
598
- 'name' => 'wcf-input-field-size',
599
- 'value' => $options['wcf-input-field-size'],
600
- 'options' => array(
601
- '33px' => esc_html__( 'Extra Small', 'cartflows' ),
602
- '38px' => esc_html__( 'Small', 'cartflows' ),
603
- '44px' => esc_html__( 'Medium', 'cartflows' ),
604
- '58px' => esc_html__( 'Large', 'cartflows' ),
605
- '68px' => esc_html__( 'Extra Large', 'cartflows' ),
606
- 'custom' => esc_html__( 'Custom', 'cartflows' ),
607
- ),
608
- )
609
- );
610
-
611
- echo wcf()->meta->get_number_field(
612
- array(
613
- 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
614
- 'name' => 'wcf-field-tb-padding',
615
- 'value' => $options['wcf-field-tb-padding'],
616
- )
617
- );
618
-
619
- echo wcf()->meta->get_number_field(
620
- array(
621
- 'label' => __( 'Left Right Spacing', 'cartflows' ),
622
- 'name' => 'wcf-field-lr-padding',
623
- 'value' => $options['wcf-field-lr-padding'],
624
- )
625
- );
626
-
627
- echo wcf()->meta->get_color_picker_field(
628
- array(
629
- 'label' => __( 'Text / Placeholder Color', 'cartflows' ),
630
- 'name' => 'wcf-field-color',
631
- 'value' => $options['wcf-field-color'],
632
- )
633
- );
634
-
635
- echo wcf()->meta->get_color_picker_field(
636
- array(
637
- 'label' => __( 'Background Color', 'cartflows' ),
638
- 'name' => 'wcf-field-bg-color',
639
- 'value' => $options['wcf-field-bg-color'],
640
- )
641
- );
642
-
643
- echo wcf()->meta->get_color_picker_field(
644
- array(
645
- 'label' => __( 'Border Color', 'cartflows' ),
646
- 'name' => 'wcf-field-border-color',
647
- 'value' => $options['wcf-field-border-color'],
648
- )
649
- );
650
- echo wcf()->meta->get_color_picker_field(
651
- array(
652
- 'label' => __( 'Label Color', 'cartflows' ),
653
- 'name' => 'wcf-field-label-color',
654
- 'value' => $options['wcf-field-label-color'],
655
- )
656
- );
657
-
658
- ?>
659
- </div>
660
- <div class="wcf-cs-button-options">
661
- <?php
662
-
663
- echo wcf()->meta->get_section(
664
- array(
665
- 'label' => __( 'Buttons', 'cartflows' ),
666
- )
667
- );
668
-
669
- echo wcf()->meta->get_font_family_field(
670
- array(
671
- 'for' => 'wcf-button',
672
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
673
- 'name' => 'wcf-button-font-family',
674
- 'value' => $options['wcf-button-font-family'],
675
- )
676
- );
677
-
678
- echo wcf()->meta->get_font_weight_field(
679
- array(
680
- 'for' => 'wcf-button',
681
- 'label' => esc_html__( 'Font Weight', 'cartflows' ),
682
- 'name' => 'wcf-button-font-weight',
683
- 'value' => $options['wcf-button-font-weight'],
684
- )
685
- );
686
-
687
- echo wcf()->meta->get_select_field(
688
- array(
689
- 'label' => __( 'Size', 'cartflows' ),
690
- 'name' => 'wcf-input-button-size',
691
- 'value' => $options['wcf-input-button-size'],
692
- 'options' => array(
693
- '33px' => esc_html__( 'Extra Small', 'cartflows' ),
694
- '38px' => esc_html__( 'Small', 'cartflows' ),
695
- '44px' => esc_html__( 'Medium', 'cartflows' ),
696
- '58px' => esc_html__( 'Large', 'cartflows' ),
697
- '68px' => esc_html__( 'Extra Large', 'cartflows' ),
698
- 'custom' => esc_html__( 'Custom', 'cartflows' ),
699
- ),
700
- )
701
- );
702
-
703
- echo wcf()->meta->get_number_field(
704
- array(
705
- 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
706
- 'name' => 'wcf-submit-tb-padding',
707
- 'value' => $options['wcf-submit-tb-padding'],
708
- )
709
- );
710
-
711
- echo wcf()->meta->get_number_field(
712
- array(
713
- 'label' => __( 'Left Right Spacing', 'cartflows' ),
714
- 'name' => 'wcf-submit-lr-padding',
715
- 'value' => $options['wcf-submit-lr-padding'],
716
- )
717
- );
718
-
719
- echo wcf()->meta->get_color_picker_field(
720
- array(
721
- 'label' => __( 'Text Color', 'cartflows' ),
722
- 'name' => 'wcf-submit-color',
723
- 'value' => $options['wcf-submit-color'],
724
- )
725
- );
726
-
727
- echo wcf()->meta->get_color_picker_field(
728
- array(
729
- 'label' => __( 'Text Hover Color', 'cartflows' ),
730
- 'name' => 'wcf-submit-hover-color',
731
- 'value' => $options['wcf-submit-hover-color'],
732
- )
733
- );
734
-
735
- echo wcf()->meta->get_color_picker_field(
736
- array(
737
- 'label' => __( 'Background Color', 'cartflows' ),
738
- 'name' => 'wcf-submit-bg-color',
739
- 'value' => $options['wcf-submit-bg-color'],
740
- )
741
- );
742
-
743
- echo wcf()->meta->get_color_picker_field(
744
- array(
745
- 'label' => __( 'Background Hover Color', 'cartflows' ),
746
- 'name' => 'wcf-submit-bg-hover-color',
747
- 'value' => $options['wcf-submit-bg-hover-color'],
748
- )
749
- );
750
-
751
- echo wcf()->meta->get_color_picker_field(
752
- array(
753
- 'label' => __( 'Border Color', 'cartflows' ),
754
- 'name' => 'wcf-submit-border-color',
755
- 'value' => $options['wcf-submit-border-color'],
756
- )
757
- );
758
-
759
- echo wcf()->meta->get_color_picker_field(
760
- array(
761
- 'label' => __( 'Border Hover Color', 'cartflows' ),
762
- 'name' => 'wcf-submit-border-hover-color',
763
- 'value' => $options['wcf-submit-border-hover-color'],
764
- )
765
- );
766
-
767
- ?>
768
- </div>
769
- <div class="wcf-cs-section-options">
770
- <?php
771
-
772
- echo wcf()->meta->get_section(
773
- array(
774
- 'label' => __( 'Sections', 'cartflows' ),
775
- )
776
- );
777
-
778
- echo wcf()->meta->get_color_picker_field(
779
- array(
780
- 'label' => __( 'Highlight Area Background Color', 'cartflows' ),
781
- 'name' => 'wcf-hl-bg-color',
782
- 'value' => $options['wcf-hl-bg-color'],
783
- )
784
- );
785
-
786
- echo wcf()->meta->get_hidden_field(
787
- array(
788
- 'name' => 'wcf-field-google-font-url',
789
- 'value' => $options['wcf-field-google-font-url'],
790
- )
791
- );
792
- ?>
793
- </div>
794
- <?php do_action( 'cartflows_checkout_style_tab_content', $options, $post_id ); ?>
795
- </div>
796
- </div>
797
- <?php
798
- }
799
-
800
-
801
- /**
802
- * Tab Header (Used for add logo into header)
803
- *
804
- * @param array $options options.
805
- * @param int $post_id post ID.
806
- */
807
- public function tab_header_content( $options, $post_id ) {
808
- ?>
809
-
810
- <div class="wcf-checkout-header wcf-tab-content widefat">
811
- <?php
812
-
813
- $layout_pro_option = array();
814
-
815
- echo wcf()->meta->get_image_field(
816
- array(
817
- 'name' => 'wcf-header-logo-image',
818
- 'value' => $options['wcf-header-logo-image'],
819
- 'label' => esc_html__( 'Header Logo', 'cartflows' ),
820
- )
821
- );
822
-
823
- echo wcf()->meta->get_number_field(
824
- array(
825
- 'name' => 'wcf-header-logo-width',
826
- 'value' => $options['wcf-header-logo-width'],
827
- 'label' => esc_html__( 'Logo Width (In px)', 'cartflows' ),
828
- )
829
- );
830
- ?>
831
- <?php do_action( 'cartflows_checkout_header_tab_content', $options, $post_id ); ?>
832
- </div>
833
- <?php
834
- }
835
- /**
836
- * Get metabox options
837
- *
838
- * @param int $post_id post ID.
839
- */
840
- public static function get_meta_option( $post_id ) {
841
-
842
- if ( null === self::$meta_option ) {
843
-
844
- /**
845
- * Set metabox options
846
- *
847
- * @see http://php.net/manual/en/filter.filters.sanitize.php
848
- */
849
- self::$meta_option = wcf()->options->get_checkout_fields( $post_id );
850
- }
851
-
852
- return self::$meta_option;
853
- }
854
-
855
- /**
856
- * Metabox Save
857
- *
858
- * @param number $post_id Post ID.
859
- * @return void
860
- */
861
- public function save_meta_box( $post_id ) {
862
-
863
- // Checks save status.
864
- $is_autosave = wp_is_post_autosave( $post_id );
865
- $is_revision = wp_is_post_revision( $post_id );
866
-
867
- $is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-checkout-step-meta'] ) ), 'save-nonce-checkout-step-meta' ) ) ? true : false;
868
-
869
- // Exits script depending on save status.
870
- if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
871
- return;
872
- }
873
-
874
- wcf()->options->save_checkout_fields( $post_id );
875
- }
876
- }
877
-
878
- /**
879
- * Kicking this off by calling 'get_instance()' method
880
- */
881
- Cartflows_Checkout_Meta::get_instance();
1
+ <?php
2
+ /**
3
+ * Checkout post meta
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Meta Boxes setup
10
+ */
11
+ class Cartflows_Checkout_Meta extends Cartflows_Meta {
12
+
13
+
14
+ /**
15
+ * Instance
16
+ *
17
+ * @var $instance
18
+ */
19
+ private static $instance;
20
+
21
+ /**
22
+ * Meta Option
23
+ *
24
+ * @var $meta_option
25
+ */
26
+ private static $meta_option = null;
27
+
28
+ /**
29
+ * Initiator
30
+ */
31
+ public static function get_instance() {
32
+ if ( ! isset( self::$instance ) ) {
33
+ self::$instance = new self();
34
+ }
35
+
36
+ return self::$instance;
37
+ }
38
+
39
+ /**
40
+ * Constructor
41
+ */
42
+ public function __construct() {
43
+
44
+ /* Init Metabox */
45
+ add_action( 'load-post.php', array( $this, 'init_metabox' ) );
46
+ add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
47
+ }
48
+ /**
49
+ * Init Metabox
50
+ */
51
+ public function init_metabox() {
52
+
53
+ add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54
+ add_action( 'save_post', array( $this, 'save_meta_box' ) );
55
+ }
56
+
57
+ /**
58
+ * Setup Metabox
59
+ */
60
+ public function setup_meta_box() {
61
+
62
+ if ( _is_wcf_checkout_type() ) {
63
+ add_meta_box(
64
+ 'wcf-checkout-settings', // Id.
65
+ __( 'Checkout Layout', 'cartflows' ), // Title.
66
+ array( $this, 'markup_meta_box' ), // Callback.
67
+ wcf()->utils->get_step_post_type(), // Post_type.
68
+ 'normal', // Context.
69
+ 'high' // Priority.
70
+ );
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Metabox Markup
76
+ *
77
+ * @param object $post Post object.
78
+ * @return void
79
+ */
80
+ public function markup_meta_box( $post ) {
81
+
82
+ wp_nonce_field( 'save-nonce-checkout-step-meta', 'nonce-checkout-step-meta' );
83
+
84
+ $stored = get_post_meta( $post->ID );
85
+
86
+ $checkout_meta = self::get_meta_option( $post->ID );
87
+
88
+ // Set stored and override defaults.
89
+ foreach ( $stored as $key => $value ) {
90
+ if ( array_key_exists( $key, $checkout_meta ) ) {
91
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
92
+ } else {
93
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
94
+ }
95
+ }
96
+
97
+ // Get defaults.
98
+ $meta = self::get_meta_option( $post->ID );
99
+ $checkout_data = array();
100
+
101
+ foreach ( $meta as $key => $value ) {
102
+ $checkout_data[ $key ] = $meta[ $key ]['default'];
103
+ }
104
+
105
+ /**
106
+ $billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post->ID );
107
+
108
+ // For loop
109
+ foreach ( $billing_fields as $key => $value ) {
110
+
111
+ $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
112
+ }
113
+
114
+ $shipping_fields = Cartflows_Helper::get_checkout_fields( 'shipping', $post->ID );
115
+
116
+ foreach ( $shipping_fields as $key => $value ) {
117
+
118
+ $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
119
+ }
120
+
121
+ $additional_fields = Cartflows_Helper::get_checkout_fields( 'additional', $post->ID );
122
+
123
+ foreach ( $additional_fields as $key => $value ) {
124
+
125
+ $checkout_data[ 'wcf-' . $key ] = $meta[ 'wcf-' . $key ]['default'];
126
+ }
127
+ */
128
+
129
+ do_action( 'wcf_checkout_settings_markup_before' );
130
+ $this->tabs_markup( $checkout_data, $post->ID );
131
+ do_action( 'wcf_checkout_settings_markup_after' );
132
+ }
133
+
134
+ /**
135
+ * Page Header Tabs
136
+ *
137
+ * @param array $options options.
138
+ * @param int $post_id post ID.
139
+ */
140
+ public function tabs_markup( $options, $post_id ) {
141
+
142
+ $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
143
+
144
+ if ( empty( $active_tab ) ) {
145
+ $active_tab = 'wcf-checkout-shortcodes';
146
+ }
147
+
148
+ $tab_array = array(
149
+ array(
150
+ 'title' => __( 'Shortcodes', 'cartflows' ),
151
+ 'id' => 'wcf-checkout-shortcodes',
152
+ 'class' => 'wcf-checkout-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
153
+ 'icon' => 'dashicons-editor-code',
154
+ ),
155
+ array(
156
+ 'title' => __( 'Select Product', 'cartflows' ),
157
+ 'id' => 'wcf-checkout-general',
158
+ 'class' => 'wcf-checkout-general' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
159
+ 'icon' => 'dashicons-info',
160
+ ),
161
+ array(
162
+ 'title' => __( 'Order Bump', 'cartflows' ),
163
+ 'id' => 'wcf-product-order-bump',
164
+ 'class' => 'wcf-product-order-bump' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
165
+ 'icon' => 'dashicons-cart',
166
+ ),
167
+ array(
168
+ 'title' => __( 'Checkout Offer', 'cartflows' ),
169
+ 'id' => 'wcf-pre-checkout-offer',
170
+ 'class' => 'wcf-pre-checkout-offer' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
171
+ 'icon' => 'dashicons-arrow-up-alt',
172
+ ),
173
+ array(
174
+ 'title' => __( 'Checkout Design', 'cartflows' ),
175
+ 'id' => 'wcf-checkout-style',
176
+ 'class' => 'wcf-checkout-style' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
177
+ 'icon' => 'dashicons-admin-customizer',
178
+ ),
179
+ array(
180
+ 'title' => __( 'Checkout Fields', 'cartflows' ),
181
+ 'id' => 'wcf-checkout-custom-fields',
182
+ 'class' => 'wcf-checkout-custom-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
183
+ 'icon' => 'dashicons-welcome-widgets-menus',
184
+ ),
185
+ array(
186
+ 'title' => __( 'Checkout Settings', 'cartflows' ),
187
+ 'id' => 'wcf-checkout-custom-settings',
188
+ 'class' => 'wcf-checkout-custom-settings' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
189
+ 'icon' => 'dashicons-admin-generic',
190
+ ),
191
+ array(
192
+ 'title' => __( 'Custom Script', 'cartflows' ),
193
+ 'id' => 'wcf-checkout-custom-script-header',
194
+ 'class' => 'wcf-checkout-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
195
+ 'icon' => 'dashicons-format-aside',
196
+ ),
197
+ );
198
+
199
+ $show_logo = filter_input( INPUT_GET, 'logo-tab', FILTER_VALIDATE_BOOLEAN );
200
+
201
+ if ( $show_logo ) {
202
+ $logo_tab = array(
203
+ 'title' => __( 'Logo (Optional)', 'cartflows' ),
204
+ 'id' => 'wcf-checkout-header',
205
+ 'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
206
+ 'icon' => 'dashicons-format-image',
207
+ );
208
+ array_push( $tab_array, $logo_tab );
209
+ }
210
+
211
+ $tabs = apply_filters( 'cartflows_checkout_tabs', $tab_array, $active_tab );
212
+
213
+ ?>
214
+ <div class="wcf-checkout-table wcf-metabox-wrap widefat">
215
+ <div class="wcf-table-container">
216
+ <div class="wcf-column-left">
217
+ <div class="wcf-tab-wrapper">
218
+
219
+ <?php foreach ( $tabs as $key => $tab ) { ?>
220
+ <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
221
+ <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
222
+ <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
223
+ </div>
224
+ <?php } ?>
225
+
226
+ <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
227
+ </div>
228
+ </div>
229
+ <div class="wcf-column-right">
230
+ <?php $this->tab_shortcodes( $options, $post_id ); ?>
231
+ <?php $this->tab_general( $options, $post_id ); ?>
232
+ <?php $this->tab_style( $options, $post_id ); ?>
233
+ <?php $this->tab_pre_checkout_offer( $options, $post_id ); ?>
234
+ <?php $this->tab_product_bump( $options, $post_id ); ?>
235
+ <?php $this->tab_custom_fields( $options, $post_id ); ?>
236
+ <?php $this->tab_custom_settings( $options, $post_id ); ?>
237
+ <?php $this->tab_header_content( $options, $post_id ); ?>
238
+ <?php $this->tab_custom_script( $options, $post_id ); ?>
239
+ <?php do_action( 'cartflows_checkout_tabs_content', $options, $post_id ); ?>
240
+ <?php $this->right_column_footer( $options, $post_id ); ?>
241
+ </div>
242
+ </div>
243
+ </div>
244
+
245
+ <?php
246
+ }
247
+
248
+ /**
249
+ * Shortcodes tab
250
+ *
251
+ * @param array $options options.
252
+ * @param int $post_id post ID.
253
+ */
254
+ public function tab_shortcodes( $options, $post_id ) {
255
+ ?>
256
+ <div class="wcf-checkout-shortcodes wcf-tab-content widefat">
257
+
258
+ <?php
259
+
260
+ echo wcf()->meta->get_shortcode_field(
261
+ array(
262
+ 'label' => 'Checkout Page',
263
+ 'name' => 'wcf-checkout-shortcode',
264
+ 'content' => '[cartflows_checkout]',
265
+ 'help' => esc_html__( 'Add this shortcode to your checkout page', 'cartflows' ),
266
+ )
267
+ );
268
+ ?>
269
+ </div>
270
+ <?php
271
+ }
272
+
273
+
274
+ /**
275
+ * General tab
276
+ *
277
+ * @param array $options options.
278
+ * @param int $post_id post ID.
279
+ */
280
+ public function tab_general( $options, $post_id ) {
281
+ ?>
282
+ <div class="wcf-checkout-general wcf-tab-content widefat">
283
+
284
+ <?php
285
+
286
+ echo wcf()->meta->get_product_selection_repeater(
287
+ array(
288
+ 'name' => 'wcf-checkout-products',
289
+ 'value' => $options['wcf-checkout-products'],
290
+ 'allow_clear' => true,
291
+ )
292
+ );
293
+
294
+ if ( ! _is_cartflows_pro() ) {
295
+
296
+ echo wcf()->meta->get_hr_line_field( array() );
297
+ echo wcf()->meta->get_description_field(
298
+ array(
299
+ 'name' => 'wcf-upgrade-to-pro',
300
+ /* translators: %s: link */
301
+ 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Pre-applied Coupon, Product Variations & Quantity Options.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
302
+ )
303
+ );
304
+ }
305
+
306
+ do_action( 'cartflows_checkout_general_tab_content', $options, $post_id );
307
+
308
+ ?>
309
+ </div>
310
+ <?php
311
+ }
312
+
313
+ /**
314
+ * Pre Checkout tab
315
+ *
316
+ * @param array $options options.
317
+ * @param int $post_id post ID.
318
+ */
319
+ public function tab_pre_checkout_offer( $options, $post_id ) {
320
+ ?>
321
+ <div class="wcf-pre-checkout-offer wcf-tab-content widefat">
322
+ <?php
323
+ if ( ! _is_cartflows_pro() ) {
324
+ echo wcf()->meta->get_description_field(
325
+ array(
326
+ 'name' => 'wcf-upgrade-to-pro',
327
+ /* translators: %s: link */
328
+ 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
329
+ )
330
+ );
331
+ } elseif ( _is_cartflows_pro_ver_less_than( '1.2.0' ) ) {
332
+
333
+ $version = '1.2.0';
334
+ echo wcf()->meta->get_description_field(
335
+ array(
336
+ 'name' => 'wcf-upgrade-to-pro',
337
+ /* translators: %s: link */
338
+ 'content' => '<i>' . sprintf( esc_html__( 'Update to %1$sCartFlows Pro%2$s to %3$s or above for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>', $version ) . '</i>',
339
+ )
340
+ );
341
+ }
342
+ ?>
343
+
344
+ <?php do_action( 'cartflows_pre_checkout_offer_tab_content', $options, $post_id ); ?>
345
+ </div>
346
+ <?php
347
+ }
348
+
349
+
350
+
351
+ /**
352
+ * Product bump tab
353
+ *
354
+ * @param array $options options.
355
+ * @param int $post_id post ID.
356
+ */
357
+ public function tab_product_bump( $options, $post_id ) {
358
+ ?>
359
+ <div class="wcf-product-order-bump wcf-tab-content widefat">
360
+ <?php
361
+ if ( ! _is_cartflows_pro() ) {
362
+ echo wcf()->meta->get_description_field(
363
+ array(
364
+ 'name' => 'wcf-upgrade-to-pro',
365
+ /* translators: %s: link */
366
+ 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
367
+ )
368
+ );
369
+ }
370
+ ?>
371
+
372
+ <?php do_action( 'cartflows_order_bump_tab_content', $options, $post_id ); ?>
373
+ </div>
374
+ <?php
375
+ }
376
+ /**
377
+ * Tab custom fields
378
+ *
379
+ * @param array $options options.
380
+ * @param int $post_id post ID.
381
+ */
382
+ public function tab_custom_fields( $options, $post_id ) {
383
+ ?>
384
+ <div class="wcf-checkout-custom-fields wcf-tab-content widefat">
385
+ <?php
386
+ /* Custom Checkout Fields Section */
387
+
388
+ if ( ! _is_cartflows_pro() ) {
389
+ echo wcf()->meta->get_description_field(
390
+ array(
391
+ 'name' => 'wcf-upgrade-to-pro',
392
+ /* translators: %s: link */
393
+ 'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
394
+ )
395
+ );
396
+ }
397
+ ?>
398
+ <?php do_action( 'cartflows_custom_fields_tab_content', $options, $post_id ); ?>
399
+ </div>
400
+ <?php
401
+ }
402
+ /**
403
+ * Tab custom settings
404
+ *
405
+ * @param array $options options.
406
+ * @param int $post_id post ID.
407
+ */
408
+ public function tab_custom_settings( $options, $post_id ) {
409
+ ?>
410
+ <div class="wcf-checkout-custom-settings wcf-tab-content widefat">
411
+ <div class="wcf-custom-settings-fields">
412
+ <?php
413
+
414
+ echo wcf()->meta->get_text_field(
415
+ array(
416
+ 'label' => __( 'Place Order Button Text', 'cartflows' ),
417
+ 'name' => 'wcf-checkout-place-order-button-text',
418
+ 'value' => $options['wcf-checkout-place-order-button-text'],
419
+ 'attr' => array(
420
+ 'placeholder' => __( 'Place order', 'cartflows' ),
421
+ ),
422
+ 'help' => __( 'It will change the Place Order Button text on checkout page.', 'cartflows' ),
423
+ )
424
+ );
425
+
426
+ echo wcf()->meta->get_hr_line_field( array() );
427
+
428
+ echo wcf()->meta->get_checkbox_field(
429
+ array(
430
+ 'name' => 'wcf-remove-product-field',
431
+ 'value' => $options['wcf-remove-product-field'],
432
+ 'after' => esc_html__( 'Enable cart editing on checkout', 'cartflows' ),
433
+ )
434
+ );
435
+
436
+ echo wcf()->meta->get_description_field(
437
+ array(
438
+ 'name' => '',
439
+ /* translators: %s: link */
440
+ 'content' => '<i>' . sprintf( esc_html__( 'Users will able to remove products from the checkout page.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
441
+ )
442
+ );
443
+ ?>
444
+ </div>
445
+ <?php do_action( 'cartflows_custom_settings_tab_content', $options, $post_id ); ?>
446
+ </div>
447
+ <?php
448
+ }
449
+
450
+ /**
451
+ * Tab style
452
+ *
453
+ * @param array $options options.
454
+ * @param int $post_id post ID.
455
+ */
456
+ public function tab_style( $options, $post_id ) {
457
+ ?>
458
+
459
+ <div class="wcf-checkout-style wcf-tab-content widefat">
460
+ <div class="wcf-cs-fields">
461
+ <div class="wcf-cs-checkbox-field">
462
+ <?php
463
+
464
+ $layout_pro_option = array();
465
+
466
+ if ( ! _is_cartflows_pro() ) {
467
+ $layout_pro_option = array(
468
+ 'one-column' => __( 'One Column (Available in CartFlows Pro) ', 'cartflows' ),
469
+ 'two-step' => __( 'Two Step (Available in CartFlows Pro) ', 'cartflows' ),
470
+ );
471
+ }
472
+
473
+ echo wcf()->meta->get_select_field(
474
+ array(
475
+ 'label' => __( 'Checkout Skin', 'cartflows' ),
476
+ 'name' => 'wcf-checkout-layout',
477
+ 'value' => $options['wcf-checkout-layout'],
478
+ 'options' => array(
479
+ 'one-column' => esc_html__( 'One Column', 'cartflows' ),
480
+ 'two-column' => esc_html__( 'Two Column', 'cartflows' ),
481
+ 'two-step' => esc_html__( 'Two Step', 'cartflows' ),
482
+ ),
483
+ 'pro-options' => $layout_pro_option,
484
+
485
+ )
486
+ );
487
+
488
+ echo wcf()->meta->get_color_picker_field(
489
+ array(
490
+ 'label' => __( 'Primary Color', 'cartflows' ),
491
+ 'name' => 'wcf-primary-color',
492
+ 'value' => $options['wcf-primary-color'],
493
+ )
494
+ );
495
+
496
+ echo wcf()->meta->get_font_family_field(
497
+ array(
498
+ 'for' => 'wcf-base',
499
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
500
+ 'name' => 'wcf-base-font-family',
501
+ 'value' => $options['wcf-base-font-family'],
502
+ )
503
+ );
504
+
505
+ echo wcf()->meta->get_checkbox_field(
506
+ array(
507
+ 'label' => __( 'Advance Options', 'cartflows' ),
508
+ 'name' => 'wcf-advance-options-fields',
509
+ 'value' => $options['wcf-advance-options-fields'],
510
+ 'after' => 'Enable',
511
+ )
512
+ );
513
+ ?>
514
+ </div>
515
+ <div class="wcf-cs-fields-options">
516
+ <?php
517
+ echo wcf()->meta->get_section(
518
+ array(
519
+ 'label' => __( 'Heading', 'cartflows' ),
520
+ )
521
+ );
522
+
523
+ echo wcf()->meta->get_color_picker_field(
524
+ array(
525
+ 'label' => __( 'Heading Color', 'cartflows' ),
526
+ 'name' => 'wcf-heading-color',
527
+ 'value' => $options['wcf-heading-color'],
528
+ )
529
+ );
530
+
531
+ echo wcf()->meta->get_font_family_field(
532
+ array(
533
+ 'for' => 'wcf-heading',
534
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
535
+ 'name' => 'wcf-heading-font-family',
536
+ 'value' => $options['wcf-heading-font-family'],
537
+ )
538
+ );
539
+
540
+ echo wcf()->meta->get_font_weight_field(
541
+ array(
542
+ 'for' => 'wcf-heading',
543
+ 'label' => esc_html__( 'Font Weight', 'cartflows' ),
544
+ 'name' => 'wcf-heading-font-weight',
545
+ 'value' => $options['wcf-heading-font-weight'],
546
+ )
547
+ );
548
+
549
+ echo wcf()->meta->get_section(
550
+ array(
551
+ 'label' => __( 'Input Fields', 'cartflows' ),
552
+ )
553
+ );
554
+
555
+ $fields_skin_pro_option = array();
556
+
557
+ if ( ! _is_cartflows_pro() ) {
558
+ $fields_skin_pro_option = array(
559
+ 'style-one' => __( 'Floating Labels (Available in CartFlows Pro)', 'cartflows' ),
560
+ );
561
+ }
562
+
563
+ echo wcf()->meta->get_select_field(
564
+ array(
565
+ 'label' => __( 'Style', 'cartflows' ),
566
+ 'name' => 'wcf-fields-skins',
567
+ 'value' => $options['wcf-fields-skins'],
568
+ 'options' => array(
569
+ 'default' => esc_html__( 'Default', 'cartflows' ),
570
+ 'style-one' => esc_html__( 'Floating Labels', 'cartflows' ),
571
+ ),
572
+ 'pro-options' => $fields_skin_pro_option,
573
+
574
+ )
575
+ );
576
+
577
+ echo wcf()->meta->get_font_family_field(
578
+ array(
579
+ 'for' => 'wcf-input',
580
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
581
+ 'name' => 'wcf-input-font-family',
582
+ 'value' => $options['wcf-input-font-family'],
583
+ )
584
+ );
585
+
586
+ echo wcf()->meta->get_font_weight_field(
587
+ array(
588
+ 'for' => 'wcf-input',
589
+ 'label' => esc_html__( 'Font Weight', 'cartflows' ),
590
+ 'name' => 'wcf-input-font-weight',
591
+ 'value' => $options['wcf-input-font-weight'],
592
+ )
593
+ );
594
+
595
+ echo wcf()->meta->get_select_field(
596
+ array(
597
+ 'label' => __( 'Size', 'cartflows' ),
598
+ 'name' => 'wcf-input-field-size',
599
+ 'value' => $options['wcf-input-field-size'],
600
+ 'options' => array(
601
+ '33px' => esc_html__( 'Extra Small', 'cartflows' ),
602
+ '38px' => esc_html__( 'Small', 'cartflows' ),
603
+ '44px' => esc_html__( 'Medium', 'cartflows' ),
604
+ '58px' => esc_html__( 'Large', 'cartflows' ),
605
+ '68px' => esc_html__( 'Extra Large', 'cartflows' ),
606
+ 'custom' => esc_html__( 'Custom', 'cartflows' ),
607
+ ),
608
+ )
609
+ );
610
+
611
+ echo wcf()->meta->get_number_field(
612
+ array(
613
+ 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
614
+ 'name' => 'wcf-field-tb-padding',
615
+ 'value' => $options['wcf-field-tb-padding'],
616
+ )
617
+ );
618
+
619
+ echo wcf()->meta->get_number_field(
620
+ array(
621
+ 'label' => __( 'Left Right Spacing', 'cartflows' ),
622
+ 'name' => 'wcf-field-lr-padding',
623
+ 'value' => $options['wcf-field-lr-padding'],
624
+ )
625
+ );
626
+
627
+ echo wcf()->meta->get_color_picker_field(
628
+ array(
629
+ 'label' => __( 'Text / Placeholder Color', 'cartflows' ),
630
+ 'name' => 'wcf-field-color',
631
+ 'value' => $options['wcf-field-color'],
632
+ )
633
+ );
634
+
635
+ echo wcf()->meta->get_color_picker_field(
636
+ array(
637
+ 'label' => __( 'Background Color', 'cartflows' ),
638
+ 'name' => 'wcf-field-bg-color',
639
+ 'value' => $options['wcf-field-bg-color'],
640
+ )
641
+ );
642
+
643
+ echo wcf()->meta->get_color_picker_field(
644
+ array(
645
+ 'label' => __( 'Border Color', 'cartflows' ),
646
+ 'name' => 'wcf-field-border-color',
647
+ 'value' => $options['wcf-field-border-color'],
648
+ )
649
+ );
650
+ echo wcf()->meta->get_color_picker_field(
651
+ array(
652
+ 'label' => __( 'Label Color', 'cartflows' ),
653
+ 'name' => 'wcf-field-label-color',
654
+ 'value' => $options['wcf-field-label-color'],
655
+ )
656
+ );
657
+
658
+ ?>
659
+ </div>
660
+ <div class="wcf-cs-button-options">
661
+ <?php
662
+
663
+ echo wcf()->meta->get_section(
664
+ array(
665
+ 'label' => __( 'Buttons', 'cartflows' ),
666
+ )
667
+ );
668
+
669
+ echo wcf()->meta->get_font_family_field(
670
+ array(
671
+ 'for' => 'wcf-button',
672
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
673
+ 'name' => 'wcf-button-font-family',
674
+ 'value' => $options['wcf-button-font-family'],
675
+ )
676
+ );
677
+
678
+ echo wcf()->meta->get_font_weight_field(
679
+ array(
680
+ 'for' => 'wcf-button',
681
+ 'label' => esc_html__( 'Font Weight', 'cartflows' ),
682
+ 'name' => 'wcf-button-font-weight',
683
+ 'value' => $options['wcf-button-font-weight'],
684
+ )
685
+ );
686
+
687
+ echo wcf()->meta->get_select_field(
688
+ array(
689
+ 'label' => __( 'Size', 'cartflows' ),
690
+ 'name' => 'wcf-input-button-size',
691
+ 'value' => $options['wcf-input-button-size'],
692
+ 'options' => array(
693
+ '33px' => esc_html__( 'Extra Small', 'cartflows' ),
694
+ '38px' => esc_html__( 'Small', 'cartflows' ),
695
+ '44px' => esc_html__( 'Medium', 'cartflows' ),
696
+ '58px' => esc_html__( 'Large', 'cartflows' ),
697
+ '68px' => esc_html__( 'Extra Large', 'cartflows' ),
698
+ 'custom' => esc_html__( 'Custom', 'cartflows' ),
699
+ ),
700
+ )
701
+ );
702
+
703
+ echo wcf()->meta->get_number_field(
704
+ array(
705
+ 'label' => __( 'Top Bottom Spacing', 'cartflows' ),
706
+ 'name' => 'wcf-submit-tb-padding',
707
+ 'value' => $options['wcf-submit-tb-padding'],
708
+ )
709
+ );
710
+
711
+ echo wcf()->meta->get_number_field(
712
+ array(
713
+ 'label' => __( 'Left Right Spacing', 'cartflows' ),
714
+ 'name' => 'wcf-submit-lr-padding',
715
+ 'value' => $options['wcf-submit-lr-padding'],
716
+ )
717
+ );
718
+
719
+ echo wcf()->meta->get_color_picker_field(
720
+ array(
721
+ 'label' => __( 'Text Color', 'cartflows' ),
722
+ 'name' => 'wcf-submit-color',
723
+ 'value' => $options['wcf-submit-color'],
724
+ )
725
+ );
726
+
727
+ echo wcf()->meta->get_color_picker_field(
728
+ array(
729
+ 'label' => __( 'Text Hover Color', 'cartflows' ),
730
+ 'name' => 'wcf-submit-hover-color',
731
+ 'value' => $options['wcf-submit-hover-color'],
732
+ )
733
+ );
734
+
735
+ echo wcf()->meta->get_color_picker_field(
736
+ array(
737
+ 'label' => __( 'Background Color', 'cartflows' ),
738
+ 'name' => 'wcf-submit-bg-color',
739
+ 'value' => $options['wcf-submit-bg-color'],
740
+ )
741
+ );
742
+
743
+ echo wcf()->meta->get_color_picker_field(
744
+ array(
745
+ 'label' => __( 'Background Hover Color', 'cartflows' ),
746
+ 'name' => 'wcf-submit-bg-hover-color',
747
+ 'value' => $options['wcf-submit-bg-hover-color'],
748
+ )
749
+ );
750
+
751
+ echo wcf()->meta->get_color_picker_field(
752
+ array(
753
+ 'label' => __( 'Border Color', 'cartflows' ),
754
+ 'name' => 'wcf-submit-border-color',
755
+ 'value' => $options['wcf-submit-border-color'],
756
+ )
757
+ );
758
+
759
+ echo wcf()->meta->get_color_picker_field(
760
+ array(
761
+ 'label' => __( 'Border Hover Color', 'cartflows' ),
762
+ 'name' => 'wcf-submit-border-hover-color',
763
+ 'value' => $options['wcf-submit-border-hover-color'],
764
+ )
765
+ );
766
+
767
+ ?>
768
+ </div>
769
+ <div class="wcf-cs-section-options">
770
+ <?php
771
+
772
+ echo wcf()->meta->get_section(
773
+ array(
774
+ 'label' => __( 'Sections', 'cartflows' ),
775
+ )
776
+ );
777
+
778
+ echo wcf()->meta->get_color_picker_field(
779
+ array(
780
+ 'label' => __( 'Highlight Area Background Color', 'cartflows' ),
781
+ 'name' => 'wcf-hl-bg-color',
782
+ 'value' => $options['wcf-hl-bg-color'],
783
+ )
784
+ );
785
+
786
+ echo wcf()->meta->get_hidden_field(
787
+ array(
788
+ 'name' => 'wcf-field-google-font-url',
789
+ 'value' => $options['wcf-field-google-font-url'],
790
+ )
791
+ );
792
+ ?>
793
+ </div>
794
+ <?php do_action( 'cartflows_checkout_style_tab_content', $options, $post_id ); ?>
795
+ </div>
796
+ </div>
797
+ <?php
798
+ }
799
+
800
+
801
+ /**
802
+ * Tab Header (Used for add logo into header)
803
+ *
804
+ * @param array $options options.
805
+ * @param int $post_id post ID.
806
+ */
807
+ public function tab_header_content( $options, $post_id ) {
808
+ ?>
809
+
810
+ <div class="wcf-checkout-header wcf-tab-content widefat">
811
+ <?php
812
+
813
+ $layout_pro_option = array();
814
+
815
+ echo wcf()->meta->get_image_field(
816
+ array(
817
+ 'name' => 'wcf-header-logo-image',
818
+ 'value' => $options['wcf-header-logo-image'],
819
+ 'label' => esc_html__( 'Header Logo', 'cartflows' ),
820
+ )
821
+ );
822
+
823
+ echo wcf()->meta->get_number_field(
824
+ array(
825
+ 'name' => 'wcf-header-logo-width',
826
+ 'value' => $options['wcf-header-logo-width'],
827
+ 'label' => esc_html__( 'Logo Width (In px)', 'cartflows' ),
828
+ )
829
+ );
830
+ ?>
831
+ <?php do_action( 'cartflows_checkout_header_tab_content', $options, $post_id ); ?>
832
+ </div>
833
+ <?php
834
+ }
835
+ /**
836
+ * Get metabox options
837
+ *
838
+ * @param int $post_id post ID.
839
+ */
840
+ public static function get_meta_option( $post_id ) {
841
+
842
+ if ( null === self::$meta_option ) {
843
+
844
+ /**
845
+ * Set metabox options
846
+ *
847
+ * @see http://php.net/manual/en/filter.filters.sanitize.php
848
+ */
849
+ self::$meta_option = wcf()->options->get_checkout_fields( $post_id );
850
+ }
851
+
852
+ return self::$meta_option;
853
+ }
854
+
855
+ /**
856
+ * Metabox Save
857
+ *
858
+ * @param number $post_id Post ID.
859
+ * @return void
860
+ */
861
+ public function save_meta_box( $post_id ) {
862
+
863
+ // Checks save status.
864
+ $is_autosave = wp_is_post_autosave( $post_id );
865
+ $is_revision = wp_is_post_revision( $post_id );
866
+
867
+ $is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-checkout-step-meta'] ) ), 'save-nonce-checkout-step-meta' ) ) ? true : false;
868
+
869
+ // Exits script depending on save status.
870
+ if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
871
+ return;
872
+ }
873
+
874
+ wcf()->options->save_checkout_fields( $post_id );
875
+ }
876
+ }
877
+
878
+ /**
879
+ * Kicking this off by calling 'get_instance()' method
880
+ */
881
+ Cartflows_Checkout_Meta::get_instance();
modules/flow/classes/class-cartflows-flow-post-type.php CHANGED
@@ -59,9 +59,9 @@ class Cartflows_Flow_Post_Type {
59
  */
60
  public function add_cartflows_post_state( $post_states ) {
61
 
62
- if ( isset( $_GET['post_type'] ) && CARTFLOWS_STEP_POST_TYPE == $_GET['post_type'] ) {
63
 
64
- global $post;
65
 
66
  $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
67
  $flow_title = get_the_title( $flow_id );
@@ -359,7 +359,7 @@ class Cartflows_Flow_Post_Type {
359
  /* translators: %s: singular custom post type name */
360
  4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
361
  /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
362
- 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
363
  /* translators: %s: singular custom post type name */
364
  6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
365
  /* translators: %s: singular custom post type name */
59
  */
60
  public function add_cartflows_post_state( $post_states ) {
61
 
62
+ global $post;
63
 
64
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
65
 
66
  $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
67
  $flow_title = get_the_title( $flow_id );
359
  /* translators: %s: singular custom post type name */
360
  4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
361
  /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
362
+ 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, //phpcs:ignore
363
  /* translators: %s: singular custom post type name */
364
  6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
365
  /* translators: %s: singular custom post type name */
modules/flow/classes/class-cartflows-permalink.php CHANGED
@@ -1,159 +1,159 @@
1
- <?php
2
- /**
3
- * Step post type.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Permalink {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Initiator
25
- */
26
- public static function get_instance() {
27
- if ( ! isset( self::$instance ) ) {
28
- self::$instance = new self();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- /**
34
- * Constructor
35
- */
36
- public function __construct() {
37
-
38
- add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
39
- add_action( 'init', array( $this, 'rewrite_step_rule' ) );
40
-
41
- add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
42
-
43
- }
44
-
45
- /**
46
- * Modify permalink
47
- *
48
- * @param string $post_link post link.
49
- * @param array $post post data.
50
- * @param string $leavename leave name.
51
- * @return string
52
- */
53
- public function post_type_permalinks( $post_link, $post, $leavename ) {
54
-
55
- if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
56
-
57
- $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
58
- $flow_name = get_post_field( 'post_name', $flow_id );
59
- $cf_permalink = Cartflows_Helper::get_permalink_settings();
60
-
61
- if ( isset( $cf_permalink['permalink_structure'] ) && ! empty( $cf_permalink['permalink_structure'] ) ) {
62
-
63
- $search = array( 'cartflows_flow', '%flowname%', 'cartflows_step' );
64
- $replace = array( $cf_permalink['permalink_flow_base'], $flow_name, $cf_permalink['permalink'] );
65
- $post_link = str_replace( $search, $replace, $post_link );
66
- } else {
67
-
68
- // If elementor page preview, return post link as it is.
69
- if ( isset( $_REQUEST['elementor-preview'] ) ) {
70
- return $post_link;
71
- }
72
-
73
- $structure = get_option( 'permalink_structure' );
74
-
75
- if ( '/%postname%/' === $structure ) {
76
-
77
- $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
78
-
79
- }
80
- }
81
- }
82
-
83
- return $post_link;
84
- }
85
-
86
- /**
87
- * Reqrite rules for acrtflows step.
88
- */
89
- public function rewrite_step_rule() {
90
-
91
- $cf_permalink = Cartflows_Helper::get_permalink_settings();
92
-
93
- if ( isset( $cf_permalink['permalink_structure'] ) ) {
94
- switch ( $cf_permalink['permalink_structure'] ) {
95
- case '/cartflows_flow/%flowname%/cartflows_step':
96
- add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
97
- break;
98
-
99
- case '/cartflows_flow/%flowname%':
100
- add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/([^/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
101
- break;
102
-
103
- case '/%flowname%/cartflows_step':
104
- add_rewrite_rule( '([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
105
-
106
- break;
107
-
108
- default:
109
- break;
110
- }
111
- }
112
-
113
- }
114
-
115
- /**
116
- * Have WordPress match postname to any of our public post types.
117
- * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
118
- * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
119
- *
120
- * @param string $query query statement.
121
- */
122
- public function add_cpt_post_names_to_main_query( $query ) {
123
-
124
- // Bail if this is not the main query.
125
- if ( ! $query->is_main_query() ) {
126
- return;
127
- }
128
-
129
- // Bail if this query doesn't match our very specific rewrite rule.
130
- if ( ! isset( $query->query['thrive-variations'] ) && ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
131
- return;
132
- }
133
-
134
- // Bail if we're not querying based on the post name.
135
- if ( empty( $query->query['name'] ) ) {
136
- return;
137
- }
138
-
139
- // Add cartflows step post type to existing post type array.
140
- if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
141
-
142
- $post_types = $query->query_vars['post_type'];
143
-
144
- $post_types[] = CARTFLOWS_STEP_POST_TYPE;
145
-
146
- $query->set( 'post_type', $post_types );
147
-
148
- } else {
149
-
150
- // Add CPT to the list of post types WP will include when it queries based on the post name.
151
- $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
152
- }
153
- }
154
- }
155
-
156
- /**
157
- * Kicking this off by calling 'get_instance()' method
158
- */
159
- Cartflows_Permalink::get_instance();
1
+ <?php
2
+ /**
3
+ * Step post type.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Permalink {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Initiator
25
+ */
26
+ public static function get_instance() {
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new self();
29
+ }
30
+ return self::$instance;
31
+ }
32
+
33
+ /**
34
+ * Constructor
35
+ */
36
+ public function __construct() {
37
+
38
+ add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
39
+ add_action( 'init', array( $this, 'rewrite_step_rule' ) );
40
+
41
+ add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
42
+
43
+ }
44
+
45
+ /**
46
+ * Modify permalink
47
+ *
48
+ * @param string $post_link post link.
49
+ * @param array $post post data.
50
+ * @param string $leavename leave name.
51
+ * @return string
52
+ */
53
+ public function post_type_permalinks( $post_link, $post, $leavename ) {
54
+
55
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
56
+
57
+ $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
58
+ $flow_name = get_post_field( 'post_name', $flow_id );
59
+ $cf_permalink = Cartflows_Helper::get_permalink_settings();
60
+
61
+ if ( isset( $cf_permalink['permalink_structure'] ) && ! empty( $cf_permalink['permalink_structure'] ) ) {
62
+
63
+ $search = array( 'cartflows_flow', '%flowname%', 'cartflows_step' );
64
+ $replace = array( $cf_permalink['permalink_flow_base'], $flow_name, $cf_permalink['permalink'] );
65
+ $post_link = str_replace( $search, $replace, $post_link );
66
+ } else {
67
+
68
+ // If elementor page preview, return post link as it is.
69
+ if ( isset( $_REQUEST['elementor-preview'] ) ) { //phpcs:ignore
70
+ return $post_link;
71
+ }
72
+
73
+ $structure = get_option( 'permalink_structure' );
74
+
75
+ if ( '/%postname%/' === $structure ) {
76
+
77
+ $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
78
+
79
+ }
80
+ }
81
+ }
82
+
83
+ return $post_link;
84
+ }
85
+
86
+ /**
87
+ * Reqrite rules for acrtflows step.
88
+ */
89
+ public function rewrite_step_rule() {
90
+
91
+ $cf_permalink = Cartflows_Helper::get_permalink_settings();
92
+
93
+ if ( isset( $cf_permalink['permalink_structure'] ) ) {
94
+ switch ( $cf_permalink['permalink_structure'] ) {
95
+ case '/cartflows_flow/%flowname%/cartflows_step':
96
+ add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
97
+ break;
98
+
99
+ case '/cartflows_flow/%flowname%':
100
+ add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/([^/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
101
+ break;
102
+
103
+ case '/%flowname%/cartflows_step':
104
+ add_rewrite_rule( '([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
105
+
106
+ break;
107
+
108
+ default:
109
+ break;
110
+ }
111
+ }
112
+
113
+ }
114
+
115
+ /**
116
+ * Have WordPress match postname to any of our public post types.
117
+ * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
118
+ * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
119
+ *
120
+ * @param string $query query statement.
121
+ */
122
+ public function add_cpt_post_names_to_main_query( $query ) {
123
+
124
+ // Bail if this is not the main query.
125
+ if ( ! $query->is_main_query() ) {
126
+ return;
127
+ }
128
+
129
+ // Bail if this query doesn't match our very specific rewrite rule.
130
+ if ( ! isset( $query->query['thrive-variations'] ) && ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
131
+ return;
132
+ }
133
+
134
+ // Bail if we're not querying based on the post name.
135
+ if ( empty( $query->query['name'] ) ) {
136
+ return;
137
+ }
138
+
139
+ // Add cartflows step post type to existing post type array.
140
+ if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
141
+
142
+ $post_types = $query->query_vars['post_type'];
143
+
144
+ $post_types[] = CARTFLOWS_STEP_POST_TYPE;
145
+
146
+ $query->set( 'post_type', $post_types );
147
+
148
+ } else {
149
+
150
+ // Add CPT to the list of post types WP will include when it queries based on the post name.
151
+ $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
152
+ }
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Kicking this off by calling 'get_instance()' method
158
+ */
159
+ Cartflows_Permalink::get_instance();
modules/flow/classes/class-cartflows-step-post-type.php CHANGED
@@ -395,7 +395,7 @@ class Cartflows_Step_Post_Type {
395
  /* translators: %s: singular custom post type name */
396
  4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
397
  /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
398
- 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
399
  /* translators: %s: singular custom post type name */
400
  6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
401
  /* translators: %s: singular custom post type name */
395
  /* translators: %s: singular custom post type name */
396
  4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
397
  /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
398
+ 5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, //phpcs:ignore
399
  /* translators: %s: singular custom post type name */
400
  6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
401
  /* translators: %s: singular custom post type name */
modules/flow/view/meta-flow-steps.php CHANGED
@@ -30,6 +30,7 @@ $steps = array(
30
  $has_product_assigned = true;
31
  $is_global_checkout = '';
32
  $common = '';
 
33
 
34
  if ( isset( $data['type'] ) ) {
35
  $term_slug = $data['type'];
@@ -40,8 +41,13 @@ $steps = array(
40
  $step_wrap_class .= ' invalid-step';
41
  }
42
 
43
- if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
44
- $step_wrap_class .= ' wcf-new-step-highlight';
 
 
 
 
 
45
  }
46
 
47
  if ( 'checkout' === $term_slug ) {
30
  $has_product_assigned = true;
31
  $is_global_checkout = '';
32
  $common = '';
33
+ $data_step_id = intval( $data['id'] );
34
 
35
  if ( isset( $data['type'] ) ) {
36
  $term_slug = $data['type'];
41
  $step_wrap_class .= ' invalid-step';
42
  }
43
 
44
+ if ( isset( $_GET['highlight-step-id'] ) ) { //phpcs:ignore
45
+
46
+ $highlight_step_id = intval( $_GET['highlight-step-id'] ); //phpcs:ignore
47
+
48
+ if ( $highlight_step_id === $data_step_id ) {
49
+ $step_wrap_class .= ' wcf-new-step-highlight';
50
+ }
51
  }
52
 
53
  if ( 'checkout' === $term_slug ) {
modules/thankyou/classes/class-cartflows-thankyou-markup.php CHANGED
@@ -1,296 +1,338 @@
1
- <?php
2
- /**
3
- * Front end and markup
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Checkout Markup
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Thankyou_Markup {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var object instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Initiator
25
- */
26
- public static function get_instance() {
27
- if ( ! isset( self::$instance ) ) {
28
- self::$instance = new self();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- /**
34
- * Constructor
35
- */
36
- public function __construct() {
37
-
38
- /* Downsell Shortcode */
39
- add_shortcode( 'cartflows_order_details', array( $this, 'cartflows_order_details_shortcode_markup' ) );
40
-
41
- add_action( 'wp_enqueue_scripts', array( $this, 'thank_you_scripts' ), 21 );
42
-
43
- add_action( 'woocommerce_is_order_received_page', array( $this, 'set_order_received_page' ) );
44
-
45
- /* Set is checkout flag */
46
- add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
47
- }
48
-
49
- /**
50
- * Order shortcode markup
51
- *
52
- * @param array $atts attributes.
53
- * @since 1.0.0
54
- */
55
- public function cartflows_order_details_shortcode_markup( $atts ) {
56
-
57
- $output = '';
58
-
59
- if ( _is_wcf_thankyou_type() ) {
60
- /* Remove order item link */
61
- add_filter( 'woocommerce_order_item_permalink', '__return_false' );
62
-
63
- if ( ! function_exists( 'wc_print_notices' ) ) {
64
-
65
- $notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
66
- $notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
67
-
68
- return $notice_out;
69
- }
70
-
71
- $order = false;
72
-
73
- if ( ! isset( $_GET['wcf-order'] ) && wcf()->flow->is_flow_testmode() ) {
74
- $args = array(
75
- 'limit' => 1,
76
- 'order' => 'DESC',
77
- 'post_type' => 'shop_order',
78
- 'status' => array( 'completed', 'processing' ),
79
- );
80
-
81
- $latest_order = wc_get_orders( $args );
82
-
83
- $order_id = ( ! empty( $latest_order ) ) ? current( $latest_order )->get_id() : 0;
84
-
85
- if ( $order_id > 0 ) {
86
- $order = wc_get_order( $order_id );
87
-
88
- if ( ! $order ) {
89
- $order = false;
90
- }
91
- }
92
- } else {
93
- if ( ! isset( $_GET['wcf-order'] ) ) {
94
- return '<p class="woocommerce-notice">Order not found. You cannot access this page directly.</p>';
95
- }
96
-
97
- // Get the order.
98
- $order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) );
99
- $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) ); //phpcs:ignore
100
-
101
- if ( $order_id > 0 ) {
102
- $order = wc_get_order( $order_id );
103
-
104
- if ( ! $order || $order->get_order_key() !== $order_key ) {
105
- $order = false;
106
- }
107
- }
108
- }
109
-
110
- // Empty awaiting payment session.
111
- unset( WC()->session->order_awaiting_payment );
112
-
113
- if ( null !== WC()->session ) {
114
- if ( ! isset( WC()->cart ) || '' === WC()->cart ) {
115
- WC()->cart = new WC_Cart();
116
- }
117
-
118
- if ( ! WC()->cart->is_empty() ) {
119
- // wc_empty_cart();
120
- // Empty current cart.
121
- WC()->cart->empty_cart( true );
122
-
123
- wc_clear_notices();
124
- }
125
-
126
- wc_print_notices();
127
- }
128
-
129
- ob_start();
130
- echo "<div class='wcf-thankyou-wrap'>";
131
- wc_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
132
- echo '</div>';
133
- $output = ob_get_clean();
134
- }
135
-
136
- return $output;
137
- }
138
-
139
- /**
140
- * Load Thank You scripts.
141
- *
142
- * @return void
143
- */
144
- public function thank_you_scripts() {
145
-
146
- if ( _is_wcf_thankyou_type() ) {
147
- do_action( 'cartflows_thank_you_scripts' );
148
-
149
- $style = $this->generate_thank_you_style();
150
-
151
- wp_add_inline_style( 'wcf-frontend-global', $style );
152
- }
153
- }
154
-
155
- /**
156
- * Set thank you as a order received page.
157
- *
158
- * @param boolean $is_order_page order page.
159
- * @return boolean
160
- */
161
- public function set_order_received_page( $is_order_page ) {
162
-
163
- if ( _is_wcf_thankyou_type() ) {
164
- $is_order_page = true;
165
- }
166
-
167
- return $is_order_page;
168
- }
169
-
170
- /**
171
- * Generate Thank You Styles.
172
- *
173
- * @return string
174
- */
175
- public function generate_thank_you_style() {
176
-
177
- global $post;
178
-
179
- if ( _is_wcf_thankyou_type() ) {
180
- $thank_you_id = $post->ID;
181
- } else {
182
- $thank_you_id = _get_wcf_thankyou_id( $post->post_content );
183
- }
184
-
185
- CartFlows_Font_Families::render_fonts( $thank_you_id );
186
-
187
- $text_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-text-color' );
188
- $text_font_family = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-font-family' );
189
- $heading_text_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-color' );
190
- $heading_font_family = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-font-family' );
191
- $heading_font_weight = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-font-wt' );
192
- $container_width = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-container-width' );
193
- $section_bg_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-section-bg-color' );
194
-
195
- $show_order_review = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-overview-section' );
196
-
197
- $show_order_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-details-section' );
198
-
199
- $show_billing_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-billing-section' );
200
-
201
- $show_shipping_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-shipping-section' );
202
-
203
- $output = "
204
- .wcf-thankyou-wrap{
205
- color: {$text_color};
206
- font-family: {$text_font_family};
207
- max-width:{$container_width}px;
208
- }
209
-
210
- .woocommerce-order h2.woocommerce-column__title,
211
- .woocommerce-order h2.woocommerce-order-details__title,
212
- .woocommerce-order .woocommerce-thankyou-order-received,
213
- .woocommerce-order-details h2,
214
- .woocommerce-order h2.wc-bacs-bank-details-heading {
215
- color: {$heading_text_color};
216
- font-family: {$heading_font_family};
217
- font-weight: {$heading_font_weight};
218
- }
219
-
220
- .woocommerce-order ul.order_details,
221
- .woocommerce-order .woocommerce-order-details,
222
- .woocommerce-order .woocommerce-customer-details,
223
- .woocommerce-order .woocommerce-bacs-bank-details{
224
- background-color: {$section_bg_color}
225
- }
226
- img.emoji, img.wp-smiley {}
227
- ";
228
-
229
- if ( 'no' == $show_order_review ) {
230
- $output .= '
231
- .woocommerce-order ul.order_details{
232
- display: none;
233
- }
234
- ';
235
- }
236
-
237
- if ( 'no' == $show_order_details ) {
238
- $output .= '
239
- .woocommerce-order .woocommerce-order-details{
240
- display: none;
241
- }
242
- ';
243
- }
244
-
245
- if ( 'no' == $show_billing_details ) {
246
- $output .= '
247
- .woocommerce-order .woocommerce-customer-details .woocommerce-column--billing-address{
248
- display: none;
249
- }
250
- ';
251
- }
252
-
253
- if ( 'no' == $show_shipping_details ) {
254
- $output .= '
255
- .woocommerce-order .woocommerce-customer-details .woocommerce-column--shipping-address{
256
- display: none;
257
- }
258
- ';
259
- }
260
-
261
- if ( 'no' == $show_billing_details && 'no' == $show_shipping_details ) {
262
- $output .= '
263
- .woocommerce-order .woocommerce-customer-details{
264
- display: none;
265
- }
266
- ';
267
- }
268
-
269
- return $output;
270
- }
271
-
272
- /**
273
- * Set as a checkout page if it is thank you page.
274
- * Thank you page need to be set as a checkout page.
275
- * Becauye ayment gateways will not load if it is not checkout.
276
- *
277
- * @param bool $is_checkout is checkout.
278
- *
279
- * @return bool
280
- */
281
- public function woo_checkout_flag( $is_checkout ) {
282
-
283
- if ( ! is_admin() ) {
284
- if ( _is_wcf_thankyou_type() ) {
285
- $is_checkout = true;
286
- }
287
- }
288
-
289
- return $is_checkout;
290
- }
291
- }
292
-
293
- /**
294
- * Kicking this off by calling 'get_instance()' method
295
- */
296
- Cartflows_Thankyou_Markup::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Front end and markup
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Checkout Markup
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Thankyou_Markup {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var object instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Initiator
25
+ */
26
+ public static function get_instance() {
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new self();
29
+ }
30
+ return self::$instance;
31
+ }
32
+
33
+ /**
34
+ * Constructor
35
+ */
36
+ public function __construct() {
37
+
38
+ /* Downsell Shortcode */
39
+ add_shortcode( 'cartflows_order_details', array( $this, 'cartflows_order_details_shortcode_markup' ) );
40
+
41
+ add_action( 'wp_enqueue_scripts', array( $this, 'thank_you_scripts' ), 21 );
42
+
43
+ add_action( 'woocommerce_is_order_received_page', array( $this, 'set_order_received_page' ) );
44
+
45
+ /* Set is checkout flag */
46
+ add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
47
+
48
+ /* Custom redirection of thank you page */
49
+ add_action( 'template_redirect', array( $this, 'redirect_tq_page_to_custom_url' ) );
50
+
51
+ add_action( 'cartflows_thank_you_scripts', array( $this, 'add_divi_compatibility_css' ) );
52
+ }
53
+
54
+
55
+ /**
56
+ * Redirect to custom url instead of thank you page.
57
+ */
58
+ public function redirect_tq_page_to_custom_url() {
59
+ global $post;
60
+
61
+ if ( _is_wcf_thankyou_type() ) {
62
+
63
+ $thank_you_id = $post->ID;
64
+ $enable_redirection = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-tq-redirect-section' );
65
+ $redirect_link = wp_http_validate_url( wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-redirect-link' ) );
66
+
67
+ if ( 'yes' === $enable_redirection && ! empty( $redirect_link ) ) {
68
+ exit( wp_redirect( $redirect_link ) ); //phpcs:ignore
69
+ }
70
+ }
71
+ }
72
+ /**
73
+ * Order shortcode markup
74
+ *
75
+ * @param array $atts attributes.
76
+ * @since 1.0.0
77
+ */
78
+ public function cartflows_order_details_shortcode_markup( $atts ) {
79
+
80
+ $output = '';
81
+
82
+ if ( _is_wcf_thankyou_type() ) {
83
+ /* Remove order item link */
84
+ add_filter( 'woocommerce_order_item_permalink', '__return_false' );
85
+
86
+ if ( ! function_exists( 'wc_print_notices' ) ) {
87
+
88
+ $notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
89
+ $notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
90
+
91
+ return $notice_out;
92
+ }
93
+
94
+ $order = false;
95
+
96
+ if ( ! isset( $_GET['wcf-order'] ) && wcf()->flow->is_flow_testmode() ) { //phpcs:ignore
97
+ $args = array(
98
+ 'limit' => 1,
99
+ 'order' => 'DESC',
100
+ 'post_type' => 'shop_order',
101
+ 'status' => array( 'completed', 'processing' ),
102
+ );
103
+
104
+ $latest_order = wc_get_orders( $args );
105
+
106
+ $order_id = ( ! empty( $latest_order ) ) ? current( $latest_order )->get_id() : 0;
107
+
108
+ if ( $order_id > 0 ) {
109
+ $order = wc_get_order( $order_id );
110
+
111
+ if ( ! $order ) {
112
+ $order = false;
113
+ }
114
+ }
115
+ } else {
116
+ if ( ! isset( $_GET['wcf-order'] ) ) { //phpcs:ignore
117
+ return '<p class="woocommerce-notice">Order not found. You cannot access this page directly.</p>';
118
+ }
119
+
120
+ // Get the order.
121
+ $order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) ); //phpcs:ignore
122
+ $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) ); //phpcs:ignore
123
+
124
+ if ( $order_id > 0 ) {
125
+ $order = wc_get_order( $order_id );
126
+
127
+ if ( ! $order || $order->get_order_key() !== $order_key ) {
128
+ $order = false;
129
+ }
130
+ }
131
+ }
132
+
133
+ // Empty awaiting payment session.
134
+ unset( WC()->session->order_awaiting_payment );
135
+
136
+ if ( null !== WC()->session ) {
137
+ if ( ! isset( WC()->cart ) || '' === WC()->cart ) {
138
+ WC()->cart = new WC_Cart();
139
+ }
140
+
141
+ if ( ! WC()->cart->is_empty() ) {
142
+ // wc_empty_cart();
143
+ // Empty current cart.
144
+ WC()->cart->empty_cart( true );
145
+
146
+ wc_clear_notices();
147
+ }
148
+
149
+ wc_print_notices();
150
+ }
151
+
152
+ ob_start();
153
+ echo "<div class='wcf-thankyou-wrap' id='wcf-thankyou-wrap'>";
154
+ wc_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
155
+ echo '</div>';
156
+ $output = ob_get_clean();
157
+ }
158
+
159
+ return $output;
160
+ }
161
+
162
+ /**
163
+ * Load Thank You scripts.
164
+ *
165
+ * @return void
166
+ */
167
+ public function thank_you_scripts() {
168
+
169
+ if ( _is_wcf_thankyou_type() ) {
170
+
171
+ do_action( 'cartflows_thank_you_scripts' );
172
+
173
+ $style = $this->generate_thank_you_style();
174
+
175
+ wp_add_inline_style( 'wcf-frontend-global', $style );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Load DIVI compatibility Thank You style.
181
+ *
182
+ * @return void
183
+ */
184
+ public function add_divi_compatibility_css() {
185
+
186
+ global $post;
187
+
188
+ $thank_you_id = $post->ID;
189
+
190
+ if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
191
+ Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $thank_you_id )
192
+ ) {
193
+ wp_enqueue_style( 'wcf-frontend-global-divi', wcf()->utils->get_css_url( 'frontend-divi' ), array(), CARTFLOWS_VER );
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Set thank you as a order received page.
199
+ *
200
+ * @param boolean $is_order_page order page.
201
+ * @return boolean
202
+ */
203
+ public function set_order_received_page( $is_order_page ) {
204
+
205
+ if ( _is_wcf_thankyou_type() ) {
206
+ $is_order_page = true;
207
+ }
208
+
209
+ return $is_order_page;
210
+ }
211
+
212
+ /**
213
+ * Generate Thank You Styles.
214
+ *
215
+ * @return string
216
+ */
217
+ public function generate_thank_you_style() {
218
+
219
+ global $post;
220
+
221
+ if ( _is_wcf_thankyou_type() ) {
222
+ $thank_you_id = $post->ID;
223
+ } else {
224
+ $thank_you_id = _get_wcf_thankyou_id( $post->post_content );
225
+ }
226
+
227
+ CartFlows_Font_Families::render_fonts( $thank_you_id );
228
+
229
+ $text_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-text-color' );
230
+ $text_font_family = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-font-family' );
231
+ $heading_text_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-color' );
232
+ $heading_font_family = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-font-family' );
233
+ $heading_font_weight = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-heading-font-wt' );
234
+ $container_width = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-container-width' );
235
+ $section_bg_color = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-tq-section-bg-color' );
236
+
237
+ $show_order_review = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-overview-section' );
238
+
239
+ $show_order_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-details-section' );
240
+
241
+ $show_billing_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-billing-section' );
242
+
243
+ $show_shipping_details = wcf()->options->get_thankyou_meta_value( $thank_you_id, 'wcf-show-shipping-section' );
244
+
245
+ $output = "
246
+ .wcf-thankyou-wrap{
247
+ color: {$text_color};
248
+ font-family: {$text_font_family};
249
+ max-width:{$container_width}px;
250
+ }
251
+
252
+ .woocommerce-order h2.woocommerce-column__title,
253
+ .woocommerce-order h2.woocommerce-order-details__title,
254
+ .woocommerce-order .woocommerce-thankyou-order-received,
255
+ .woocommerce-order-details h2,
256
+ .woocommerce-order h2.wc-bacs-bank-details-heading {
257
+ color: {$heading_text_color};
258
+ font-family: {$heading_font_family};
259
+ font-weight: {$heading_font_weight};
260
+ }
261
+
262
+ .woocommerce-order ul.order_details,
263
+ .woocommerce-order .woocommerce-order-details,
264
+ .woocommerce-order .woocommerce-customer-details,
265
+ .woocommerce-order .woocommerce-bacs-bank-details{
266
+ background-color: {$section_bg_color}
267
+ }
268
+ img.emoji, img.wp-smiley {}
269
+ ";
270
+
271
+ if ( 'no' == $show_order_review ) {
272
+ $output .= '
273
+ .woocommerce-order ul.order_details{
274
+ display: none;
275
+ }
276
+ ';
277
+ }
278
+
279
+ if ( 'no' == $show_order_details ) {
280
+ $output .= '
281
+ .woocommerce-order .woocommerce-order-details{
282
+ display: none;
283
+ }
284
+ ';
285
+ }
286
+
287
+ if ( 'no' == $show_billing_details ) {
288
+ $output .= '
289
+ .woocommerce-order .woocommerce-customer-details .woocommerce-column--billing-address{
290
+ display: none;
291
+ }
292
+ ';
293
+ }
294
+
295
+ if ( 'no' == $show_shipping_details ) {
296
+ $output .= '
297
+ .woocommerce-order .woocommerce-customer-details .woocommerce-column--shipping-address{
298
+ display: none;
299
+ }
300
+ ';
301
+ }
302
+
303
+ if ( 'no' == $show_billing_details && 'no' == $show_shipping_details ) {
304
+ $output .= '
305
+ .woocommerce-order .woocommerce-customer-details{
306
+ display: none;
307
+ }
308
+ ';
309
+ }
310
+
311
+ return $output;
312
+ }
313
+
314
+ /**
315
+ * Set as a checkout page if it is thank you page.
316
+ * Thank you page need to be set as a checkout page.
317
+ * Becauye ayment gateways will not load if it is not checkout.
318
+ *
319
+ * @param bool $is_checkout is checkout.
320
+ *
321
+ * @return bool
322
+ */
323
+ public function woo_checkout_flag( $is_checkout ) {
324
+
325
+ if ( ! is_admin() ) {
326
+ if ( _is_wcf_thankyou_type() ) {
327
+ $is_checkout = true;
328
+ }
329
+ }
330
+
331
+ return $is_checkout;
332
+ }
333
+ }
334
+
335
+ /**
336
+ * Kicking this off by calling 'get_instance()' method
337
+ */
338
+ Cartflows_Thankyou_Markup::get_instance();
modules/thankyou/classes/class-cartflows-thankyou-meta.php CHANGED
@@ -1,371 +1,400 @@
1
- <?php
2
- /**
3
- * Checkout post meta box
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Meta Boxes setup
10
- */
11
- class Cartflows_Thankyou_Meta extends Cartflows_Meta {
12
-
13
- /**
14
- * Instance
15
- *
16
- * @var $instance
17
- */
18
- private static $instance;
19
-
20
- /**
21
- * Meta Option
22
- *
23
- * @var $meta_option
24
- */
25
- private static $meta_option = null;
26
-
27
- /**
28
- * Initiator
29
- */
30
- public static function get_instance() {
31
- if ( ! isset( self::$instance ) ) {
32
- self::$instance = new self();
33
- }
34
-
35
- return self::$instance;
36
- }
37
-
38
- /**
39
- * Constructor
40
- */
41
- public function __construct() {
42
-
43
- /* Init Metabox */
44
- add_action( 'load-post.php', array( $this, 'init_metabox' ) );
45
- add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
46
- }
47
-
48
- /**
49
- * Init Metabox
50
- */
51
- public function init_metabox() {
52
-
53
- add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54
- add_action( 'save_post', array( $this, 'save_meta_box' ) );
55
- }
56
-
57
- /**
58
- * Setup Metabox
59
- */
60
- public function setup_meta_box() {
61
-
62
- if ( _is_wcf_thankyou_type() ) {
63
- add_meta_box(
64
- 'wcf-thankyou-settings', // Id.
65
- __( 'Thank You Page Settings', 'cartflows' ), // Title.
66
- array( $this, 'markup_meta_box' ), // Callback.
67
- wcf()->utils->get_step_post_type(), // Post_type.
68
- 'normal', // Context.
69
- 'high' // Priority.
70
- );
71
- }
72
- }
73
-
74
- /**
75
- * Metabox Markup
76
- *
77
- * @param object $post Post object.
78
- * @return void
79
- */
80
- public function markup_meta_box( $post ) {
81
-
82
- wp_nonce_field( 'save-nonce-thankyou-step-meta', 'nonce-thankyou-step-meta' );
83
- $stored = get_post_meta( $post->ID );
84
-
85
- $checkout_meta = self::get_meta_option( $post->ID );
86
-
87
- // Set stored and override defaults.
88
- foreach ( $stored as $key => $value ) {
89
- if ( array_key_exists( $key, $checkout_meta ) ) {
90
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
91
- } else {
92
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
93
- }
94
- }
95
-
96
- // Get defaults.
97
- $meta = self::get_meta_option( $post->ID );
98
-
99
- /**
100
- * Get options
101
- */
102
- $thankyou_data = array();
103
-
104
- foreach ( $meta as $key => $value ) {
105
-
106
- $thankyou_data[ $key ] = $meta[ $key ]['default'];
107
- }
108
-
109
- do_action( 'wcf_thankyou_settings_markup_before', $meta );
110
- $this->page_header_tab( $thankyou_data, $post->ID );
111
- do_action( 'wcf_thankyou_settings_markup_after', $meta );
112
- }
113
-
114
- /**
115
- * Page Header Tabs
116
- *
117
- * @param array $options Post meta.
118
- * @param int $post_id Post ID.
119
- */
120
- public function page_header_tab( $options, $post_id ) {
121
-
122
- $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
123
-
124
- if ( empty( $active_tab ) ) {
125
- $active_tab = 'wcf-thankyou-shortcodes';
126
- }
127
-
128
- $tabs = array(
129
- array(
130
- 'title' => __( 'Shortcodes', 'cartflows' ),
131
- 'id' => 'wcf-thankyou-shortcodes',
132
- 'class' => 'wcf-thankyou-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
133
- 'icon' => 'dashicons-editor-code',
134
- ),
135
- array(
136
- 'title' => __( 'Thank You Design', 'cartflows' ),
137
- 'id' => 'wcf-thankyou-design',
138
- 'class' => 'wcf-thankyou-design' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
139
- 'icon' => 'dashicons-admin-customizer',
140
- ),
141
- array(
142
- 'title' => __( 'Thank You Fields', 'cartflows' ),
143
- 'id' => 'wcf-thankyou-fields',
144
- 'class' => 'wcf-thankyou-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
145
- 'icon' => 'dashicons-welcome-widgets-menus',
146
- ),
147
- array(
148
- 'title' => __( 'Custom Script', 'cartflows' ),
149
- 'id' => 'wcf-thankyou-custom-script-header',
150
- 'class' => 'wcf-thankyou-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
151
- 'icon' => 'dashicons-format-aside',
152
- ),
153
- );
154
-
155
- ?>
156
- <div class="wcf-thankyou-table wcf-metabox-wrap widefat">
157
- <div class="wcf-table-container">
158
- <div class="wcf-column-left">
159
- <div class="wcf-tab-wrapper">
160
-
161
- <?php foreach ( $tabs as $key => $tab ) { ?>
162
- <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
163
- <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
164
- <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
165
- </div>
166
- <?php } ?>
167
- <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
168
-
169
- </div>
170
- </div>
171
- <div class="wcf-column-right">
172
- <div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
173
- <?php
174
- echo wcf()->meta->get_shortcode_field(
175
- array(
176
- 'label' => __( 'Order Details', 'cartflows' ),
177
- 'name' => 'wcf-order-details',
178
- 'content' => esc_html( '[cartflows_order_details]' ),
179
- )
180
- );
181
- ?>
182
- </div>
183
- <div class="wcf-thankyou-design wcf-tab-content widefat">
184
- <?php
185
-
186
- echo wcf()->meta->get_section(
187
- array(
188
- 'label' => __( 'Text', 'cartflows' ),
189
- )
190
- );
191
-
192
- echo wcf()->meta->get_color_picker_field(
193
- array(
194
- 'label' => __( 'Color', 'cartflows' ),
195
- 'name' => 'wcf-tq-text-color',
196
- 'value' => $options['wcf-tq-text-color'],
197
- )
198
- );
199
-
200
- echo wcf()->meta->get_font_family_field(
201
- array(
202
- 'for' => 'wcf-tq-font-family',
203
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
204
- 'name' => 'wcf-tq-font-family',
205
- 'value' => $options['wcf-tq-font-family'],
206
- )
207
- );
208
-
209
- echo wcf()->meta->get_section(
210
- array(
211
- 'label' => __( 'Heading', 'cartflows' ),
212
- )
213
- );
214
-
215
- echo wcf()->meta->get_color_picker_field(
216
- array(
217
- 'label' => __( 'Color', 'cartflows' ),
218
- 'name' => 'wcf-tq-heading-color',
219
- 'value' => $options['wcf-tq-heading-color'],
220
- )
221
- );
222
-
223
- echo wcf()->meta->get_font_family_field(
224
- array(
225
- 'for' => 'wcf-tq-heading-font-family',
226
- 'label' => esc_html__( 'Font Family', 'cartflows' ),
227
- 'name' => 'wcf-tq-heading-font-family',
228
- 'value' => $options['wcf-tq-heading-font-family'],
229
- )
230
- );
231
-
232
- echo wcf()->meta->get_font_weight_field(
233
- array(
234
- 'for' => 'wcf-tq-heading-font-family',
235
- 'label' => esc_html__( 'Font Weight', 'cartflows' ),
236
- 'name' => 'wcf-tq-heading-font-wt',
237
- 'value' => $options['wcf-tq-heading-font-wt'],
238
- )
239
- );
240
-
241
- echo wcf()->meta->get_checkbox_field(
242
- array(
243
- 'label' => __( 'Advanced Options', 'cartflows' ),
244
- 'name' => 'wcf-tq-advance-options-fields',
245
- 'value' => $options['wcf-tq-advance-options-fields'],
246
- 'after' => 'Enable',
247
- )
248
- );
249
-
250
- echo wcf()->meta->get_number_field(
251
- array(
252
- 'for' => 'wcf-heading',
253
- 'label' => esc_html__( 'Container Width (In px)', 'cartflows' ),
254
- 'name' => 'wcf-tq-container-width',
255
- 'value' => $options['wcf-tq-container-width'],
256
- )
257
- );
258
-
259
- echo wcf()->meta->get_color_picker_field(
260
- array(
261
- 'label' => __( 'Section Background Color', 'cartflows' ),
262
- 'name' => 'wcf-tq-section-bg-color',
263
- 'value' => $options['wcf-tq-section-bg-color'],
264
- )
265
- );
266
-
267
- ?>
268
- </div>
269
- <div class="wcf-thankyou-fields wcf-tab-content widefat">
270
- <?php
271
- echo wcf()->meta->get_checkbox_field(
272
- array(
273
- 'name' => 'wcf-show-overview-section',
274
- 'value' => $options['wcf-show-overview-section'],
275
- 'after' => esc_html__( 'Enable Order Overview ', 'cartflows' ),
276
- )
277
- );
278
-
279
- echo wcf()->meta->get_checkbox_field(
280
- array(
281
- 'name' => 'wcf-show-details-section',
282
- 'value' => $options['wcf-show-details-section'],
283
- 'after' => esc_html__( 'Enable Order Details ', 'cartflows' ),
284
- )
285
- );
286
-
287
- echo wcf()->meta->get_checkbox_field(
288
- array(
289
- 'name' => 'wcf-show-billing-section',
290
- 'value' => $options['wcf-show-billing-section'],
291
- 'after' => esc_html__( 'Enable Billing Details ', 'cartflows' ),
292
- )
293
- );
294
-
295
- echo wcf()->meta->get_checkbox_field(
296
- array(
297
- 'name' => 'wcf-show-shipping-section',
298
- 'value' => $options['wcf-show-shipping-section'],
299
- 'after' => esc_html__( 'Enable Shipping Details ', 'cartflows' ),
300
- )
301
- );
302
-
303
- echo wcf()->meta->get_hidden_field(
304
- array(
305
- 'name' => 'wcf-field-google-font-url',
306
- 'value' => $options['wcf-field-google-font-url'],
307
- )
308
- );
309
- ?>
310
- </div>
311
-
312
- <?php $this->tab_custom_script( $options, $post_id ); ?>
313
-
314
- <?php $this->right_column_footer( $options, $post_id ); ?>
315
- </div>
316
- </div>
317
- </div>
318
-
319
- <?php
320
-
321
- }
322
-
323
- /**
324
- * Get metabox options
325
- *
326
- * @param int $post_id post ID.
327
- * @return array
328
- */
329
- public static function get_meta_option( $post_id ) {
330
-
331
- if ( null === self::$meta_option ) {
332
-
333
- /**
334
- * Set metabox options
335
- *
336
- * @see http://php.net/manual/en/filter.filters.sanitize.php
337
- */
338
- self::$meta_option = wcf()->options->get_thankyou_fields( $post_id );
339
- }
340
-
341
- return self::$meta_option;
342
-
343
- }
344
-
345
- /**
346
- * Metabox Save
347
- *
348
- * @param number $post_id Post ID.
349
- * @return void
350
- */
351
- public function save_meta_box( $post_id ) {
352
-
353
- // Checks save status.
354
- $is_autosave = wp_is_post_autosave( $post_id );
355
- $is_revision = wp_is_post_revision( $post_id );
356
-
357
- $is_valid_nonce = ( isset( $_POST['nonce-thankyou-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-thankyou-step-meta'] ) ), 'save-nonce-thankyou-step-meta' ) ) ? true : false;
358
-
359
- // Exits script depending on save status.
360
- if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
361
- return;
362
- }
363
-
364
- wcf()->options->save_thankyou_fields( $post_id );
365
- }
366
- }
367
-
368
- /**
369
- * Kicking this off by calling 'get_instance()' method
370
- */
371
- Cartflows_Thankyou_Meta::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Checkout post meta box
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Meta Boxes setup
10
+ */
11
+ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
12
+
13
+ /**
14
+ * Instance
15
+ *
16
+ * @var $instance
17
+ */
18
+ private static $instance;
19
+
20
+ /**
21
+ * Meta Option
22
+ *
23
+ * @var $meta_option
24
+ */
25
+ private static $meta_option = null;
26
+
27
+ /**
28
+ * Initiator
29
+ */
30
+ public static function get_instance() {
31
+ if ( ! isset( self::$instance ) ) {
32
+ self::$instance = new self();
33
+ }
34
+
35
+ return self::$instance;
36
+ }
37
+
38
+ /**
39
+ * Constructor
40
+ */
41
+ public function __construct() {
42
+
43
+ /* Init Metabox */
44
+ add_action( 'load-post.php', array( $this, 'init_metabox' ) );
45
+ add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
46
+ }
47
+
48
+ /**
49
+ * Init Metabox
50
+ */
51
+ public function init_metabox() {
52
+
53
+ add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
54
+ add_action( 'save_post', array( $this, 'save_meta_box' ) );
55
+ }
56
+
57
+ /**
58
+ * Setup Metabox
59
+ */
60
+ public function setup_meta_box() {
61
+
62
+ if ( _is_wcf_thankyou_type() ) {
63
+ add_meta_box(
64
+ 'wcf-thankyou-settings', // Id.
65
+ __( 'Thank You Page Settings', 'cartflows' ), // Title.
66
+ array( $this, 'markup_meta_box' ), // Callback.
67
+ wcf()->utils->get_step_post_type(), // Post_type.
68
+ 'normal', // Context.
69
+ 'high' // Priority.
70
+ );
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Metabox Markup
76
+ *
77
+ * @param object $post Post object.
78
+ * @return void
79
+ */
80
+ public function markup_meta_box( $post ) {
81
+
82
+ wp_nonce_field( 'save-nonce-thankyou-step-meta', 'nonce-thankyou-step-meta' );
83
+ $stored = get_post_meta( $post->ID );
84
+
85
+ $checkout_meta = self::get_meta_option( $post->ID );
86
+
87
+ // Set stored and override defaults.
88
+ foreach ( $stored as $key => $value ) {
89
+ if ( array_key_exists( $key, $checkout_meta ) ) {
90
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
91
+ } else {
92
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
93
+ }
94
+ }
95
+
96
+ // Get defaults.
97
+ $meta = self::get_meta_option( $post->ID );
98
+
99
+ /**
100
+ * Get options
101
+ */
102
+ $thankyou_data = array();
103
+
104
+ foreach ( $meta as $key => $value ) {
105
+
106
+ $thankyou_data[ $key ] = $meta[ $key ]['default'];
107
+ }
108
+
109
+ do_action( 'wcf_thankyou_settings_markup_before', $meta );
110
+ $this->page_header_tab( $thankyou_data, $post->ID );
111
+ do_action( 'wcf_thankyou_settings_markup_after', $meta );
112
+ }
113
+
114
+ /**
115
+ * Page Header Tabs
116
+ *
117
+ * @param array $options Post meta.
118
+ * @param int $post_id Post ID.
119
+ */
120
+ public function page_header_tab( $options, $post_id ) {
121
+
122
+ $active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
123
+
124
+ if ( empty( $active_tab ) ) {
125
+ $active_tab = 'wcf-thankyou-shortcodes';
126
+ }
127
+
128
+ $tabs = array(
129
+ array(
130
+ 'title' => __( 'Shortcodes', 'cartflows' ),
131
+ 'id' => 'wcf-thankyou-shortcodes',
132
+ 'class' => 'wcf-thankyou-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
133
+ 'icon' => 'dashicons-editor-code',
134
+ ),
135
+ array(
136
+ 'title' => __( 'Design', 'cartflows' ),
137
+ 'id' => 'wcf-thankyou-design',
138
+ 'class' => 'wcf-thankyou-design' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
139
+ 'icon' => 'dashicons-admin-customizer',
140
+ ),
141
+ array(
142
+ 'title' => __( 'Edit Fields', 'cartflows' ),
143
+ 'id' => 'wcf-thankyou-fields',
144
+ 'class' => 'wcf-thankyou-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
145
+ 'icon' => 'dashicons-welcome-widgets-menus',
146
+ ),
147
+ array(
148
+ 'title' => __( 'Settings', 'cartflows' ),
149
+ 'id' => 'wcf-thankyou-redirect',
150
+ 'class' => 'wcf-thankyou-redirect' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
151
+ 'icon' => 'dashicons-randomize',
152
+ ),
153
+ array(
154
+ 'title' => __( 'Custom Script', 'cartflows' ),
155
+ 'id' => 'wcf-thankyou-custom-script-header',
156
+ 'class' => 'wcf-thankyou-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
157
+ 'icon' => 'dashicons-format-aside',
158
+ ),
159
+ );
160
+
161
+ ?>
162
+ <div class="wcf-thankyou-table wcf-metabox-wrap widefat">
163
+ <div class="wcf-table-container">
164
+ <div class="wcf-column-left">
165
+ <div class="wcf-tab-wrapper">
166
+
167
+ <?php foreach ( $tabs as $key => $tab ) { ?>
168
+ <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
169
+ <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
170
+ <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
171
+ </div>
172
+ <?php } ?>
173
+ <input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
174
+
175
+ </div>
176
+ </div>
177
+ <div class="wcf-column-right">
178
+ <div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
179
+ <?php
180
+ echo wcf()->meta->get_shortcode_field(
181
+ array(
182
+ 'label' => __( 'Order Details', 'cartflows' ),
183
+ 'name' => 'wcf-order-details',
184
+ 'content' => esc_html( '[cartflows_order_details]' ),
185
+ )
186
+ );
187
+ ?>
188
+ </div>
189
+ <div class="wcf-thankyou-design wcf-tab-content widefat">
190
+ <?php
191
+
192
+ echo wcf()->meta->get_section(
193
+ array(
194
+ 'label' => __( 'Text', 'cartflows' ),
195
+ )
196
+ );
197
+
198
+ echo wcf()->meta->get_color_picker_field(
199
+ array(
200
+ 'label' => __( 'Color', 'cartflows' ),
201
+ 'name' => 'wcf-tq-text-color',
202
+ 'value' => $options['wcf-tq-text-color'],
203
+ )
204
+ );
205
+
206
+ echo wcf()->meta->get_font_family_field(
207
+ array(
208
+ 'for' => 'wcf-tq-font-family',
209
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
210
+ 'name' => 'wcf-tq-font-family',
211
+ 'value' => $options['wcf-tq-font-family'],
212
+ )
213
+ );
214
+
215
+ echo wcf()->meta->get_section(
216
+ array(
217
+ 'label' => __( 'Heading', 'cartflows' ),
218
+ )
219
+ );
220
+
221
+ echo wcf()->meta->get_color_picker_field(
222
+ array(
223
+ 'label' => __( 'Color', 'cartflows' ),
224
+ 'name' => 'wcf-tq-heading-color',
225
+ 'value' => $options['wcf-tq-heading-color'],
226
+ )
227
+ );
228
+
229
+ echo wcf()->meta->get_font_family_field(
230
+ array(
231
+ 'for' => 'wcf-tq-heading-font-family',
232
+ 'label' => esc_html__( 'Font Family', 'cartflows' ),
233
+ 'name' => 'wcf-tq-heading-font-family',
234
+ 'value' => $options['wcf-tq-heading-font-family'],
235
+ )
236
+ );
237
+
238
+ echo wcf()->meta->get_font_weight_field(
239
+ array(
240
+ 'for' => 'wcf-tq-heading-font-family',
241
+ 'label' => esc_html__( 'Font Weight', 'cartflows' ),
242
+ 'name' => 'wcf-tq-heading-font-wt',
243
+ 'value' => $options['wcf-tq-heading-font-wt'],
244
+ )
245
+ );
246
+
247
+ echo wcf()->meta->get_checkbox_field(
248
+ array(
249
+ 'label' => __( 'Advanced Options', 'cartflows' ),
250
+ 'name' => 'wcf-tq-advance-options-fields',
251
+ 'value' => $options['wcf-tq-advance-options-fields'],
252
+ 'after' => 'Enable',
253
+ )
254
+ );
255
+
256
+ echo wcf()->meta->get_number_field(
257
+ array(
258
+ 'for' => 'wcf-heading',
259
+ 'label' => esc_html__( 'Container Width (In px)', 'cartflows' ),
260
+ 'name' => 'wcf-tq-container-width',
261
+ 'value' => $options['wcf-tq-container-width'],
262
+ )
263
+ );
264
+
265
+ echo wcf()->meta->get_color_picker_field(
266
+ array(
267
+ 'label' => __( 'Section Background Color', 'cartflows' ),
268
+ 'name' => 'wcf-tq-section-bg-color',
269
+ 'value' => $options['wcf-tq-section-bg-color'],
270
+ )
271
+ );
272
+
273
+ ?>
274
+ </div>
275
+ <div class="wcf-thankyou-fields wcf-tab-content widefat">
276
+ <?php
277
+ echo wcf()->meta->get_checkbox_field(
278
+ array(
279
+ 'name' => 'wcf-show-overview-section',
280
+ 'value' => $options['wcf-show-overview-section'],
281
+ 'after' => esc_html__( 'Enable Order Overview ', 'cartflows' ),
282
+ )
283
+ );
284
+
285
+ echo wcf()->meta->get_checkbox_field(
286
+ array(
287
+ 'name' => 'wcf-show-details-section',
288
+ 'value' => $options['wcf-show-details-section'],
289
+ 'after' => esc_html__( 'Enable Order Details ', 'cartflows' ),
290
+ )
291
+ );
292
+
293
+ echo wcf()->meta->get_checkbox_field(
294
+ array(
295
+ 'name' => 'wcf-show-billing-section',
296
+ 'value' => $options['wcf-show-billing-section'],
297
+ 'after' => esc_html__( 'Enable Billing Details ', 'cartflows' ),
298
+ )
299
+ );
300
+
301
+ echo wcf()->meta->get_checkbox_field(
302
+ array(
303
+ 'name' => 'wcf-show-shipping-section',
304
+ 'value' => $options['wcf-show-shipping-section'],
305
+ 'after' => esc_html__( 'Enable Shipping Details ', 'cartflows' ),
306
+ )
307
+ );
308
+
309
+ echo wcf()->meta->get_hidden_field(
310
+ array(
311
+ 'name' => 'wcf-field-google-font-url',
312
+ 'value' => $options['wcf-field-google-font-url'],
313
+ )
314
+ );
315
+ ?>
316
+ </div>
317
+ <div class="wcf-thankyou-redirect wcf-tab-content widefat" >
318
+ <?php
319
+ echo wcf()->meta->get_checkbox_field(
320
+ array(
321
+ 'label' => __( 'Redirect After Purchase', 'cartflows' ),
322
+ 'name' => 'wcf-show-tq-redirect-section',
323
+ 'value' => $options['wcf-show-tq-redirect-section'],
324
+ 'after' => 'Enable',
325
+ )
326
+ );
327
+
328
+ echo wcf()->meta->get_text_field(
329
+ array(
330
+ 'label' => __( 'Redirect Link', 'cartflows' ),
331
+ 'name' => 'wcf-tq-redirect-link',
332
+ 'value' => $options['wcf-tq-redirect-link'],
333
+ 'attr' => array(
334
+ 'placeholder' => __( 'https://', 'cartflows' ),
335
+ ),
336
+ )
337
+ );
338
+ ?>
339
+ </div>
340
+
341
+ <?php $this->tab_custom_script( $options, $post_id ); ?>
342
+
343
+ <?php $this->right_column_footer( $options, $post_id ); ?>
344
+ </div>
345
+ </div>
346
+ </div>
347
+
348
+ <?php
349
+
350
+ }
351
+
352
+ /**
353
+ * Get metabox options
354
+ *
355
+ * @param int $post_id post ID.
356
+ * @return array
357
+ */
358
+ public static function get_meta_option( $post_id ) {
359
+
360
+ if ( null === self::$meta_option ) {
361
+
362
+ /**
363
+ * Set metabox options
364
+ *
365
+ * @see http://php.net/manual/en/filter.filters.sanitize.php
366
+ */
367
+ self::$meta_option = wcf()->options->get_thankyou_fields( $post_id );
368
+ }
369
+
370
+ return self::$meta_option;
371
+
372
+ }
373
+
374
+ /**
375
+ * Metabox Save
376
+ *
377
+ * @param number $post_id Post ID.
378
+ * @return void
379
+ */
380
+ public function save_meta_box( $post_id ) {
381
+
382
+ // Checks save status.
383
+ $is_autosave = wp_is_post_autosave( $post_id );
384
+ $is_revision = wp_is_post_revision( $post_id );
385
+
386
+ $is_valid_nonce = ( isset( $_POST['nonce-thankyou-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-thankyou-step-meta'] ) ), 'save-nonce-thankyou-step-meta' ) ) ? true : false;
387
+
388
+ // Exits script depending on save status.
389
+ if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
390
+ return;
391
+ }
392
+
393
+ wcf()->options->save_thankyou_fields( $post_id );
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Kicking this off by calling 'get_instance()' method
399
+ */
400
+ Cartflows_Thankyou_Meta::get_instance();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
4
  Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
5
  Requires at least: 4.4
6
  Tested up to: 5.3.2
7
- Stable tag: 1.3.4
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -125,6 +125,11 @@ Glad you asked! CartFlows Pro is an optional add-on to CartFlows that adds addit
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
128
  = Version 1.3.4 - Tuesday, 14th January 2020 =
129
  * New: Option added to change order button text for each flow.
130
  * Improvement: WooCommerce Google Analytics Integration plugin's compatibility added.
4
  Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
5
  Requires at least: 4.4
6
  Tested up to: 5.3.2
7
+ Stable tag: 1.3.5
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
125
 
126
  == Changelog ==
127
 
128
+ = Version 1.3.5 - Tuesday, 28th January 2020 =
129
+ * New: Option added for thank you page redirection.
130
+ * Fix: Pro version's two-step CSS conflict with the DIVI, the second tab was not displaying.
131
+ * Fix: Checkbox icon for terms & conditions was not displaying for DIVI Builder & Theme.
132
+
133
  = Version 1.3.4 - Tuesday, 14th January 2020 =
134
  * New: Option added to change order button text for each flow.
135
  * Improvement: WooCommerce Google Analytics Integration plugin's compatibility added.