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

Version Description

Download this release

Release Info

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

Code changes from version 1.1.13 to 1.1.14

Files changed (84) hide show
  1. admin/assets/css/admin-menu-settings-rtl.css +6 -1
  2. admin/assets/css/admin-menu-settings.css +6 -1
  3. assets/css/checkout-template-divi-rtl.css +26 -0
  4. assets/css/checkout-template-divi.css +26 -0
  5. assets/css/checkout-template-rtl.css +78 -20
  6. assets/css/checkout-template.css +78 -20
  7. assets/js/checkout-template.js +107 -35
  8. assets/js/import.js +3 -3
  9. assets/min-css/checkout-template-divi-rtl.min.css +1 -0
  10. assets/min-css/checkout-template-divi.min.css +1 -0
  11. assets/min-css/checkout-template-flatsome-rtl.min.css +1 -0
  12. assets/min-css/checkout-template-flatsome.min.css +1 -0
  13. assets/min-css/checkout-template-rtl.min.css +1 -0
  14. assets/min-css/checkout-template-the-seven-rtl.min.css +1 -0
  15. assets/min-css/checkout-template-the-seven.min.css +1 -0
  16. assets/min-css/checkout-template.min.css +1 -0
  17. assets/min-css/frontend-rtl.min.css +1 -0
  18. assets/min-css/frontend.min.css +1 -0
  19. assets/min-css/import-rtl.min.css +1 -0
  20. assets/min-css/import.min.css +1 -0
  21. assets/min-js/checkout-template.min.js +1 -0
  22. assets/min-js/frontend.min.js +1 -0
  23. assets/min-js/import.min.js +1 -0
  24. assets/min-js/rest-api.min.js +1 -0
  25. cartflows.php +1 -1
  26. changelog.txt +6 -0
  27. classes/batch-process/class-cartflows-batch-process.php +270 -270
  28. classes/batch-process/class-cartflows-importer-beaver-builder-batch.php +63 -63
  29. classes/batch-process/class-cartflows-importer-beaver-builder.php +229 -229
  30. classes/batch-process/class-cartflows-importer-divi-batch.php +63 -63
  31. classes/batch-process/class-cartflows-importer-divi.php +27 -128
  32. classes/batch-process/class-cartflows-importer-elementor-batch.php +66 -66
  33. classes/batch-process/class-cartflows-importer-elementor.php +69 -69
  34. classes/class-cartflows-admin-fields.php +198 -198
  35. classes/class-cartflows-admin.php +45 -0
  36. classes/class-cartflows-api.php +381 -381
  37. classes/class-cartflows-bb-compatibility.php +76 -76
  38. classes/class-cartflows-cloning.php +436 -436
  39. classes/class-cartflows-compatibility.php +400 -400
  40. classes/class-cartflows-divi-compatibility.php +55 -55
  41. classes/class-cartflows-flow-frontend.php +199 -199
  42. classes/class-cartflows-frontend.php +30 -3
  43. classes/class-cartflows-functions.php +388 -388
  44. classes/class-cartflows-helper.php +56 -0
  45. classes/class-cartflows-importer-core.php +272 -272
  46. classes/class-cartflows-importer.php +1569 -1569
  47. classes/class-cartflows-loader.php +19 -2
  48. classes/class-cartflows-logger.php +101 -101
  49. classes/class-cartflows-meta-fields.php +1482 -1482
  50. classes/class-cartflows-meta.php +75 -75
  51. classes/class-cartflows-thrive-compatibility.php +77 -77
  52. classes/class-cartflows-update.php +77 -77
  53. classes/class-cartflows-utils.php +67 -0
  54. classes/class-cartflows-wizard.php +447 -447
  55. includes/admin/cartflows-general.php +82 -48
  56. includes/exporter.php +23 -23
  57. includes/importer.php +26 -26
  58. languages/cartflows.pot +79 -41
  59. modules/checkout/classes/class-cartflows-checkout-markup.php +64 -19
  60. modules/checkout/templates/embed/checkout-template-simple.php +33 -33
  61. modules/flow/class-cartflows-flow.php +48 -48
  62. modules/flow/classes/class-cartflows-flow-meta.php +743 -743
  63. modules/flow/classes/class-cartflows-flow-post-type.php +281 -281
  64. modules/flow/classes/class-cartflows-step-post-type.php +486 -486
  65. modules/flow/templates/template-canvas.php +49 -49
  66. modules/flow/templates/template-default.php +54 -54
  67. modules/flow/view/meta-flow-steps.php +200 -200
  68. modules/landing/classes/class-cartflows-landing-markup.php +139 -139
  69. modules/landing/classes/class-cartflows-landing-meta.php +236 -236
  70. modules/thankyou/classes/class-cartflows-thankyou-markup.php +274 -274
  71. modules/thankyou/classes/class-cartflows-thankyou-meta.php +371 -371
  72. readme.txt +7 -1
  73. woocommerce/template/cart/cart-shipping.php +79 -79
  74. woocommerce/template/checkout/form-billing.php +80 -80
  75. woocommerce/template/checkout/form-checkout.php +64 -64
  76. woocommerce/template/checkout/form-coupon.php +42 -42
  77. woocommerce/template/checkout/form-login.php +36 -36
  78. woocommerce/template/checkout/payment.php +61 -61
  79. woocommerce/template/checkout/review-order.php +113 -113
  80. woocommerce/template/checkout/thankyou.php +87 -87
  81. woocommerce/template/global/form-login.php +67 -0
  82. woocommerce/template/notices/error.php +35 -35
  83. woocommerce/template/notices/notice.php +34 -34
  84. woocommerce/template/notices/success.php +34 -34
admin/assets/css/admin-menu-settings-rtl.css CHANGED
@@ -277,7 +277,8 @@
277
  #poststuff .general-settings-form .inside {
278
  margin: 2em 0 0;
279
  }
280
- .general-settings-form .form-field {
 
281
  border-bottom: 1px solid #e6e6e6;
282
  display: block;
283
  width: 100%;
@@ -289,4 +290,8 @@
289
  }
290
  .general-settings-form .form-field:last-child {
291
  border: none;
 
 
 
 
292
  }
277
  #poststuff .general-settings-form .inside {
278
  margin: 2em 0 0;
279
  }
280
+ .general-settings-form .form-field,
281
+ .postbox-container .form-field {
282
  border-bottom: 1px solid #e6e6e6;
283
  display: block;
284
  width: 100%;
290
  }
291
  .general-settings-form .form-field:last-child {
292
  border: none;
293
+ }
294
+
295
+ .postbox-container .form-field{
296
+ border: none;
297
  }
admin/assets/css/admin-menu-settings.css CHANGED
@@ -277,7 +277,8 @@
277
  #poststuff .general-settings-form .inside {
278
  margin: 2em 0 0;
279
  }
280
- .general-settings-form .form-field {
 
281
  border-bottom: 1px solid #e6e6e6;
282
  display: block;
283
  width: 100%;
@@ -289,4 +290,8 @@
289
  }
290
  .general-settings-form .form-field:last-child {
291
  border: none;
 
 
 
 
292
  }
277
  #poststuff .general-settings-form .inside {
278
  margin: 2em 0 0;
279
  }
280
+ .general-settings-form .form-field,
281
+ .postbox-container .form-field {
282
  border-bottom: 1px solid #e6e6e6;
283
  display: block;
284
  width: 100%;
290
  }
291
  .general-settings-form .form-field:last-child {
292
  border: none;
293
+ }
294
+
295
+ .postbox-container .form-field{
296
+ border: none;
297
  }
assets/css/checkout-template-divi-rtl.css CHANGED
@@ -220,6 +220,21 @@
220
  padding-top: 25px;
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  /*
224
  One Column
225
  */
@@ -252,6 +267,7 @@
252
  padding: 0px;
253
  -webkit-border-radius: 0px;
254
  border-radius: 0px;
 
255
  margin-bottom: 20px;
256
  }
257
 
@@ -268,6 +284,16 @@
268
  display: none !important;
269
  }
270
 
 
 
 
 
 
 
 
 
 
 
271
  /**
272
  * *************************************
273
  * Two Step Divi Compatibility css End
220
  padding-top: 25px;
221
  }
222
 
223
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message,
224
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error{
225
+ color: inherit !important;
226
+ border: none !important;
227
+ background-color: transparent !important;
228
+ padding: 0em 2em 1.2em 2em !important;
229
+ font-size: 14px !important;
230
+ margin: 0px !important;
231
+ }
232
+
233
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before,
234
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
235
+ display: block !important;
236
+ }
237
+
238
  /*
239
  One Column
240
  */
267
  padding: 0px;
268
  -webkit-border-radius: 0px;
269
  border-radius: 0px;
270
+ margin-top:10px;
271
  margin-bottom: 20px;
272
  }
273
 
284
  display: none !important;
285
  }
286
 
287
+ .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
288
+ display: none;
289
+ float: none;
290
+ width: 100%;
291
+ }
292
+
293
+ .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{
294
+ color: #fff;
295
+ }
296
+
297
  /**
298
  * *************************************
299
  * Two Step Divi Compatibility css End
assets/css/checkout-template-divi.css CHANGED
@@ -220,6 +220,21 @@
220
  padding-top: 25px;
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  /*
224
  One Column
225
  */
@@ -252,6 +267,7 @@
252
  padding: 0px;
253
  -webkit-border-radius: 0px;
254
  border-radius: 0px;
 
255
  margin-bottom: 20px;
256
  }
257
 
@@ -268,6 +284,16 @@
268
  display: none !important;
269
  }
270
 
 
 
 
 
 
 
 
 
 
 
271
  /**
272
  * *************************************
273
  * Two Step Divi Compatibility css End
220
  padding-top: 25px;
221
  }
222
 
223
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message,
224
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error{
225
+ color: inherit !important;
226
+ border: none !important;
227
+ background-color: transparent !important;
228
+ padding: 0em 2em 1.2em 2em !important;
229
+ font-size: 14px !important;
230
+ margin: 0px !important;
231
+ }
232
+
233
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before,
234
+ .et_pb_module #wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
235
+ display: block !important;
236
+ }
237
+
238
  /*
239
  One Column
240
  */
267
  padding: 0px;
268
  -webkit-border-radius: 0px;
269
  border-radius: 0px;
270
+ margin-top:10px;
271
  margin-bottom: 20px;
272
  }
273
 
284
  display: none !important;
285
  }
286
 
287
+ .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce-checkout #order_review{
288
+ display: none;
289
+ float: none;
290
+ width: 100%;
291
+ }
292
+
293
+ .et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{
294
+ color: #fff;
295
+ }
296
+
297
  /**
298
  * *************************************
299
  * Two Step Divi Compatibility css End
assets/css/checkout-template-rtl.css CHANGED
@@ -61,12 +61,6 @@
61
  clear: both;
62
  }
63
 
64
- .wcf-embed-checkout-form form .wcf-form-col-3{
65
- width: 32%;
66
- float: right;
67
- clear: unset;
68
- }
69
-
70
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{
71
  display: none;
72
  }
@@ -87,12 +81,41 @@
87
  top: 0;
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
90
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
 
 
 
 
 
91
  font-family: inherit;
92
- font-weight: 400;
93
  font-size: 13px;
94
- float: left;
95
- margin-top: -39px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
  /**
@@ -120,11 +143,13 @@
120
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,
121
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{
122
  border-width: 1px;
123
- border-color: #69bf29;
124
  }
125
 
126
  .wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,
127
- .wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required{
 
 
128
  border-color: #e2401c;
129
  }
130
 
@@ -365,7 +390,8 @@
365
  color: #555;
366
  background-color: #fff;
367
  background-image: none;
368
- border: 1px solid #d4d4d4;
 
369
  -webkit-border-radius: 3px;
370
  border-radius: 3px;
371
  -webkit-box-shadow: none;
@@ -378,7 +404,35 @@
378
  width: 100%;
379
  }
380
 
381
- .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  font-weight: normal;
383
  }
384
 
@@ -395,6 +449,9 @@
395
  border-bottom: 1px solid #dcdcdc;
396
  padding-top: 25px;
397
  padding-bottom: 25px;
 
 
 
398
  }
399
 
400
  .wcf-embed-checkout-form #order_review .wcf-coupon-col-1 {
@@ -719,9 +776,14 @@
719
  color: #a00;
720
  margin: 1rem 0 1rem;
721
  font-size: 14px;
 
 
 
 
 
 
722
  }
723
 
724
-
725
  .wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{
726
  display: inline;
727
  }
@@ -730,10 +792,6 @@
730
  margin:1em 0 1em;
731
  }
732
 
733
- .wcf-embed-checkout-form .woocommerce .woocommerce-error::before{
734
- content: '';
735
- }
736
-
737
  .wcf-embed-checkout-form .woocommerce .woocommerce-error li{
738
  list-style: disc inside !important;
739
  margin: 0 0 8px;
@@ -764,7 +822,7 @@
764
  }
765
 
766
  @media only screen and (max-width: 768px) {
767
- .wcf-embed-checkout-form form .wcf-form-col-3{
768
  width: 100%;
769
  }
770
  .wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
@@ -923,4 +981,4 @@ a.et_pb_more_button:after{
923
  -webkit-box-sizing: border-box;
924
  -moz-box-sizing: border-box;
925
  box-sizing: border-box;
926
- }
61
  clear: both;
62
  }
63
 
 
 
 
 
 
 
64
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{
65
  display: none;
66
  }
81
  top: 0;
82
  }
83
 
84
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .login-form-actions{
85
+ -js-display: flex;
86
+ display: -webkit-box;
87
+ display: -webkit-flex;
88
+ display: -moz-box;
89
+ display: -ms-flexbox;
90
+ display: flex;
91
+ margin-bottom: 0px;
92
+ }
93
+
94
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .remember_me,
95
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
96
+ -webkit-box-flex: 1;
97
+ -webkit-flex: 1;
98
+ -moz-box-flex: 1;
99
+ -ms-flex: 1;
100
+ flex: 1;
101
  font-family: inherit;
 
102
  font-size: 13px;
103
+ }
104
+
105
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me label{
106
+ margin-bottom: 0px;
107
+ vertical-align: text-top;
108
+ }
109
+
110
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me input,
111
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me span{
112
+ vertical-align: middle;
113
+ }
114
+
115
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
116
+ text-align: left;
117
+ margin-top: 0px;
118
+ margin-bottom: 0px;
119
  }
120
 
121
  /**
143
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,
144
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{
145
  border-width: 1px;
146
+ /*border-color: #69bf29;*/
147
  }
148
 
149
  .wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,
150
+ .wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,
151
+ .wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required,
152
+ .wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required{
153
  border-color: #e2401c;
154
  }
155
 
390
  color: #555;
391
  background-color: #fff;
392
  background-image: none;
393
+ border: 1px solid;
394
+ border-color: #d4d4d4;
395
  -webkit-border-radius: 3px;
396
  border-radius: 3px;
397
  -webkit-box-shadow: none;
404
  width: 100%;
405
  }
406
 
407
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message,
408
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error{
409
+ padding: 0em 2em 1.2em 2em;
410
+ background-color: transparent;
411
+ border: none;
412
+ margin: 0px;
413
+ width: 100%;
414
+ }
415
+
416
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{
417
+ list-style:none !important;
418
+ margin: 0px;
419
+ }
420
+
421
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before,
422
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
423
+ top: 0px;
424
+ right: 0px;
425
+ }
426
+
427
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
428
+ content: '\e016';
429
+ }
430
+
431
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{
432
+ margin: 0px 8px 0 0px;
433
+ }
434
+
435
+ .wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input[type="text"]{
436
  font-weight: normal;
437
  }
438
 
449
  border-bottom: 1px solid #dcdcdc;
450
  padding-top: 25px;
451
  padding-bottom: 25px;
452
+ -webkit-flex-wrap: wrap;
453
+ -ms-flex-wrap: wrap;
454
+ flex-wrap: wrap;
455
  }
456
 
457
  .wcf-embed-checkout-form #order_review .wcf-coupon-col-1 {
776
  color: #a00;
777
  margin: 1rem 0 1rem;
778
  font-size: 14px;
779
+ width: 100%;
780
+
781
+ }
782
+
783
+ .wcf-embed-checkout-form .woocommerce .woocommerce-error::before {
784
+ content: '';
785
  }
786
 
 
787
  .wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{
788
  display: inline;
789
  }
792
  margin:1em 0 1em;
793
  }
794
 
 
 
 
 
795
  .wcf-embed-checkout-form .woocommerce .woocommerce-error li{
796
  list-style: disc inside !important;
797
  margin: 0 0 8px;
822
  }
823
 
824
  @media only screen and (max-width: 768px) {
825
+ .wcf-embed-checkout-form form .wcf-column-33{
826
  width: 100%;
827
  }
828
  .wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
981
  -webkit-box-sizing: border-box;
982
  -moz-box-sizing: border-box;
983
  box-sizing: border-box;
984
+ }
assets/css/checkout-template.css CHANGED
@@ -61,12 +61,6 @@
61
  clear: both;
62
  }
63
 
64
- .wcf-embed-checkout-form form .wcf-form-col-3{
65
- width: 32%;
66
- float: left;
67
- clear: unset;
68
- }
69
-
70
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{
71
  display: none;
72
  }
@@ -87,12 +81,41 @@
87
  top: 0;
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
90
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
 
 
 
 
 
91
  font-family: inherit;
92
- font-weight: 400;
93
  font-size: 13px;
94
- float: right;
95
- margin-top: -39px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
  /**
@@ -120,11 +143,13 @@
120
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,
121
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{
122
  border-width: 1px;
123
- border-color: #69bf29;
124
  }
125
 
126
  .wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,
127
- .wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required{
 
 
128
  border-color: #e2401c;
129
  }
130
 
@@ -365,7 +390,8 @@
365
  color: #555;
366
  background-color: #fff;
367
  background-image: none;
368
- border: 1px solid #d4d4d4;
 
369
  -webkit-border-radius: 3px;
370
  border-radius: 3px;
371
  -webkit-box-shadow: none;
@@ -378,7 +404,35 @@
378
  width: 100%;
379
  }
380
 
381
- .wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type="text"]{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  font-weight: normal;
383
  }
384
 
@@ -395,6 +449,9 @@
395
  border-bottom: 1px solid #dcdcdc;
396
  padding-top: 25px;
397
  padding-bottom: 25px;
 
 
 
398
  }
399
 
400
  .wcf-embed-checkout-form #order_review .wcf-coupon-col-1 {
@@ -719,9 +776,14 @@
719
  color: #a00;
720
  margin: 1rem 0 1rem;
721
  font-size: 14px;
 
 
 
 
 
 
722
  }
723
 
724
-
725
  .wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{
726
  display: inline;
727
  }
@@ -730,10 +792,6 @@
730
  margin:1em 0 1em;
731
  }
732
 
733
- .wcf-embed-checkout-form .woocommerce .woocommerce-error::before{
734
- content: '';
735
- }
736
-
737
  .wcf-embed-checkout-form .woocommerce .woocommerce-error li{
738
  list-style: disc inside !important;
739
  margin: 0 0 8px;
@@ -764,7 +822,7 @@
764
  }
765
 
766
  @media only screen and (max-width: 768px) {
767
- .wcf-embed-checkout-form form .wcf-form-col-3{
768
  width: 100%;
769
  }
770
  .wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
@@ -923,4 +981,4 @@ a.et_pb_more_button:after{
923
  -webkit-box-sizing: border-box;
924
  -moz-box-sizing: border-box;
925
  box-sizing: border-box;
926
- }
61
  clear: both;
62
  }
63
 
 
 
 
 
 
 
64
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{
65
  display: none;
66
  }
81
  top: 0;
82
  }
83
 
84
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .login-form-actions{
85
+ -js-display: flex;
86
+ display: -webkit-box;
87
+ display: -webkit-flex;
88
+ display: -moz-box;
89
+ display: -ms-flexbox;
90
+ display: flex;
91
+ margin-bottom: 0px;
92
+ }
93
+
94
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .remember_me,
95
  .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
96
+ -webkit-box-flex: 1;
97
+ -webkit-flex: 1;
98
+ -moz-box-flex: 1;
99
+ -ms-flex: 1;
100
+ flex: 1;
101
  font-family: inherit;
 
102
  font-size: 13px;
103
+ }
104
+
105
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me label{
106
+ margin-bottom: 0px;
107
+ vertical-align: text-top;
108
+ }
109
+
110
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me input,
111
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me span{
112
+ vertical-align: middle;
113
+ }
114
+
115
+ .wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{
116
+ text-align: right;
117
+ margin-top: 0px;
118
+ margin-bottom: 0px;
119
  }
120
 
121
  /**
143
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,
144
  .wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{
145
  border-width: 1px;
146
+ /*border-color: #69bf29;*/
147
  }
148
 
149
  .wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,
150
+ .wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,
151
+ .wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required,
152
+ .wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required{
153
  border-color: #e2401c;
154
  }
155
 
390
  color: #555;
391
  background-color: #fff;
392
  background-image: none;
393
+ border: 1px solid;
394
+ border-color: #d4d4d4;
395
  -webkit-border-radius: 3px;
396
  border-radius: 3px;
397
  -webkit-box-shadow: none;
404
  width: 100%;
405
  }
406
 
407
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message,
408
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error{
409
+ padding: 0em 2em 1.2em 2em;
410
+ background-color: transparent;
411
+ border: none;
412
+ margin: 0px;
413
+ width: 100%;
414
+ }
415
+
416
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{
417
+ list-style:none !important;
418
+ margin: 0px;
419
+ }
420
+
421
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before,
422
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
423
+ top: 0px;
424
+ left: 0px;
425
+ }
426
+
427
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{
428
+ content: '\e016';
429
+ }
430
+
431
+ .wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{
432
+ margin: 0px 0px 0 8px;
433
+ }
434
+
435
+ .wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input[type="text"]{
436
  font-weight: normal;
437
  }
438
 
449
  border-bottom: 1px solid #dcdcdc;
450
  padding-top: 25px;
451
  padding-bottom: 25px;
452
+ -webkit-flex-wrap: wrap;
453
+ -ms-flex-wrap: wrap;
454
+ flex-wrap: wrap;
455
  }
456
 
457
  .wcf-embed-checkout-form #order_review .wcf-coupon-col-1 {
776
  color: #a00;
777
  margin: 1rem 0 1rem;
778
  font-size: 14px;
779
+ width: 100%;
780
+
781
+ }
782
+
783
+ .wcf-embed-checkout-form .woocommerce .woocommerce-error::before {
784
+ content: '';
785
  }
786
 
 
787
  .wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{
788
  display: inline;
789
  }
792
  margin:1em 0 1em;
793
  }
794
 
 
 
 
 
795
  .wcf-embed-checkout-form .woocommerce .woocommerce-error li{
796
  list-style: disc inside !important;
797
  margin: 0 0 8px;
822
  }
823
 
824
  @media only screen and (max-width: 768px) {
825
+ .wcf-embed-checkout-form form .wcf-column-33{
826
  width: 100%;
827
  }
828
  .wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
981
  -webkit-box-sizing: border-box;
982
  -moz-box-sizing: border-box;
983
  box-sizing: border-box;
984
+ }
assets/js/checkout-template.js CHANGED
@@ -49,22 +49,43 @@
49
  */
50
  var wcf_custom_field_validation = function(){
51
 
52
- var $inputs = $('form.woocommerce-checkout').find('input');
53
 
54
- $inputs.blur(function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  var $this = $(this),
56
- field_id = $this.attr('id'),
57
  field_value = $this.val();
58
-
59
- if ( field_value == '')
60
- {
61
- if( field_id != 'billing_company' && field_id != 'billing_address_2' && field_id != 'shipping_company' && field_id != 'shipping_address_2'){
62
- $this.addClass('field-required');
63
- }
64
- }else{
65
- $this.removeClass('field-required');
66
- }
67
  });
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
  /**
@@ -183,7 +204,7 @@
183
 
184
  localStorage.removeItem('cartflows_checkout_form');
185
 
186
- checkout_form.find('input[type=text], select').each(function(){
187
  checkout_data.push({ name: this.name, value: this.value});
188
  });
189
 
@@ -212,53 +233,104 @@
212
  }
213
 
214
 
215
- $(document).ready(function($) {
216
-
217
- wcf_persistent_data();
218
-
219
- //wcf_reload_checkout_on_return();
220
-
221
- wcf_custom_field_validation();
222
-
223
- add_custom_class_address_field();
224
-
225
- });
226
-
227
  $(window).load(function(){
228
  $( 'body' ).trigger( 'update_checkout' );
229
  });
230
 
231
-
232
- var cf_checkout_coupons = {
233
 
234
  init: function() {
235
- $( document.body ).on( 'click', '.cf-submit-coupon', this.submit_coupon );
 
 
 
236
  },
237
 
238
  submit_coupon: function( e ) {
239
 
240
  e.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
 
 
242
  var data = {
243
- coupon_code: $(this).closest('.wcf-custom-coupon-field').find('.cf-coupon-code-input').val(),
244
- action: 'cf_woo_apply_coupon',
245
- security: cartflows.cf_validate_coupon_nonce
246
  };
247
 
248
  $.ajax({
249
  type: 'POST',
250
  url: cartflows.ajax_url,
251
  data: data,
 
252
  success: function( code ) {
253
 
 
 
 
254
  if( code ) {
255
- $( document.body ).trigger( 'update_checkout', { update_shipping_method: false } );
 
 
256
  }
257
  }
258
  });
259
- }
260
  }
261
 
262
- cf_checkout_coupons.init();
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
- })(jQuery);
49
  */
50
  var wcf_custom_field_validation = function(){
51
 
52
+ var custom_field_add_class = function (field_value, field_row, field_wrap){
53
 
54
+ if ( field_value == '') {
55
+ if( field_row.hasClass('validate-required') ){
56
+
57
+ field_wrap.addClass('field-required');
58
+ }
59
+ } else {
60
+ field_wrap.removeClass('field-required');
61
+ }
62
+
63
+ }
64
+
65
+ var fields_wrapper = $('form.woocommerce-checkout #customer_details'),
66
+ $all_fields = fields_wrapper.find('input, textarea'),
67
+ $selects = fields_wrapper.find('.select2-selection');
68
+
69
+ $all_fields.blur(function(){
70
  var $this = $(this),
71
+ field_row = $this.closest('p.form-row'),
72
  field_value = $this.val();
73
+
74
+ custom_field_add_class(field_value, field_row, $this);
75
+
 
 
 
 
 
 
76
  });
77
+
78
+
79
+ $selects.blur(function(){
80
+ var $this = $(this),
81
+ field_row = $this.closest('p.form-row'),
82
+ field_wrap = field_row.find('.select2-container--default'),
83
+ field_value = field_row.find('select').val();
84
+
85
+ custom_field_add_class(field_value, field_row, field_wrap);
86
+
87
+ });
88
+
89
  }
90
 
91
  /**
204
 
205
  localStorage.removeItem('cartflows_checkout_form');
206
 
207
+ checkout_form.find('input[type=text], select, input[type=email], input[type=tel]').each(function(){
208
  checkout_data.push({ name: this.name, value: this.value});
209
  });
210
 
233
  }
234
 
235
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  $(window).load(function(){
237
  $( 'body' ).trigger( 'update_checkout' );
238
  });
239
 
240
+ var wcf_checkout_coupons = {
 
241
 
242
  init: function() {
243
+
244
+ $( document.body ).on( 'click', '.wcf-submit-coupon', this.submit_coupon );
245
+ $( document.body ).on( 'click', '.wcf-remove-coupon', this.remove_coupon );
246
+
247
  },
248
 
249
  submit_coupon: function( e ) {
250
 
251
  e.preventDefault();
252
+ var coupon_wrapper = $('.wcf-custom-coupon-field'),
253
+ coupon_field = coupon_wrapper.find('.wcf-coupon-code-input'),
254
+ coupon_value = coupon_field.val();
255
+
256
+ if( '' == coupon_value){
257
+ coupon_field.addClass('field-required');
258
+ return false;
259
+ }else{
260
+ coupon_field.removeClass('field-required');
261
+ }
262
+
263
+ var data = {
264
+ coupon_code : coupon_value,
265
+ action : 'wcf_woo_apply_coupon',
266
+ security : cartflows.wcf_validate_coupon_nonce
267
+ };
268
+
269
+ $.ajax({
270
+ type: 'POST',
271
+ url: cartflows.ajax_url,
272
+ data: data,
273
+
274
+ success: function( code ) {
275
+
276
+ var coupon_message = $(".wcf-custom-coupon-field");
277
+ coupon_message.find( '.woocommerce-error, .woocommerce-message' ).remove();
278
+
279
+ var data = JSON.parse(code);
280
+
281
+ if( data.status == true ) {
282
+
283
+ $( document.body ).trigger( 'update_checkout', { update_shipping_method: false } );
284
+ coupon_message.prepend(data.msg);
285
+ }else{
286
+ coupon_message.prepend(data.msg);
287
+ }
288
+ },
289
+
290
+ });
291
+ },
292
+
293
+ remove_coupon: function( e ) {
294
 
295
+ e.preventDefault();
296
  var data = {
297
+ coupon_code : $(this).attr("data-coupon"),
298
+ action : 'wcf_woo_remove_coupon',
299
+ security : cartflows.wcf_validate_remove_coupon_nonce
300
  };
301
 
302
  $.ajax({
303
  type: 'POST',
304
  url: cartflows.ajax_url,
305
  data: data,
306
+
307
  success: function( code ) {
308
 
309
+ var coupon_message = $(".wcf-custom-coupon-field");
310
+ coupon_message.find( '.woocommerce-error, .woocommerce-message' ).hide();
311
+
312
  if( code ) {
313
+ $( document.body ).trigger( 'update_checkout', { update_shipping_method: false } );
314
+ coupon_message.prepend(code);
315
+
316
  }
317
  }
318
  });
319
+ },
320
  }
321
 
322
+ $(document).ready(function($) {
323
+
324
+ wcf_persistent_data();
325
+
326
+ //wcf_reload_checkout_on_return();
327
+
328
+ wcf_custom_field_validation();
329
+
330
+ add_custom_class_address_field();
331
+
332
+ wcf_checkout_coupons.init();
333
+
334
+ });
335
 
336
+ })(jQuery);
assets/js/import.js CHANGED
@@ -1249,8 +1249,8 @@ var CartFlowsAjaxQueue = (function() {
1249
  step_slug = $('#wcf-scratch-steps-categories .step-type-filter-links .current').data('slug') || '',
1250
  step_title = $('#wcf-scratch-steps-categories .step-type-filter-links .current').data('title') || '',
1251
  step_type = step_slug,
1252
- step_count = $('.wcf-step-wrap[data-term-slug="'+step_slug+'"]').length || 1;
1253
- step_custom_title = `${step_title} ${step_count+1}`;
1254
 
1255
  $('#wcf-start-from-scratch .wcf-notice-wrap').remove();
1256
 
@@ -1337,7 +1337,7 @@ var CartFlowsAjaxQueue = (function() {
1337
  step_slug = btn.data('slug') || '',
1338
  step_count = $('.wcf-step-wrap[data-term-slug="'+step_slug+'"]').length || 1;
1339
  step_title = btn.data('title') || '',
1340
- step_custom_title = `${step_title} ${step_count+1}`,
1341
  self = CartFlowsImport;
1342
 
1343
  if ( ! CartFlowsImportVars._is_pro_active ) {
1249
  step_slug = $('#wcf-scratch-steps-categories .step-type-filter-links .current').data('slug') || '',
1250
  step_title = $('#wcf-scratch-steps-categories .step-type-filter-links .current').data('title') || '',
1251
  step_type = step_slug,
1252
+ step_count = $('.wcf-step-wrap[data-term-slug="'+step_slug+'"]').length || 1,
1253
+ step_custom_title = step_title + ' ' + ( parseInt( step_count ) + 1 );
1254
 
1255
  $('#wcf-start-from-scratch .wcf-notice-wrap').remove();
1256
 
1337
  step_slug = btn.data('slug') || '',
1338
  step_count = $('.wcf-step-wrap[data-term-slug="'+step_slug+'"]').length || 1;
1339
  step_title = btn.data('title') || '',
1340
+ step_custom_title = step_title + ' ' + ( parseInt( step_count ) + 1 ),
1341
  self = CartFlowsImport;
1342
 
1343
  if ( ! CartFlowsImportVars._is_pro_active ) {
assets/min-css/checkout-template-divi-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .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{display:block;margin-top:10px;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-order-wrap,.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{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{display:none;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .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 ADDED
@@ -0,0 +1 @@
 
1
+ .et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .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{display:block;margin-top:10px;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-order-wrap,.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{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{display:none;float:none;width:100%}.et_pb_module #wcf-embed-checkout-form.wcf-embed-checkout-form-two-step .woocommerce a{color:#fff}@media only screen and (max-width:768px){.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .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/checkout-template-flatsome-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .absolute-footer,html{background-color:unset;font-family:inherit}body{color:#404040;font-family:inherit;line-height:1.5}b,strong{font-weight:700}.woocommerce-billing-fields{padding-top:0;border-top:unset}.button,button,fieldset,input,select,textarea{margin-bottom:inherit}.wcf-embed-checkout-form .woocommerce #order_review .input-text,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row select,.wcf-embed-checkout-form .woocommerce form .form-row textarea{height:auto}#ship-to-different-address label{font-weight:inherit}.shop_table tfoot th,td,th{color:inherit;font-size:inherit;letter-spacing:inherit;text-transform:inherit;text-align:inherit}span.amount{white-space:inherit;color:inherit;font-weight:inherit}.cart_totals tbody tr td,.shop_table tfoot tr td,.shop_table thead tr th:last-of-type,.shop_table tr td:last-of-type,td.product-total{text-align:inherit}.shipping__table--multiple td,.shipping__table--multiple th{display:table-cell;width:50%}.shipping__table--multiple{display:block;text-align:inherit}tr.shipping input:checked+label{font-weight:400}.widget_shopping_cart_content .blockUI.blockOverlay::before,.woocommerce-checkout-review-order .blockUI.blockOverlay::before{border-top:inherit!important;border-left:inherit!important;border-bottom:inherit!important;border-right:inherit!important}label,legend{color:inherit;font-weight:inherit;font-size:inherit}.payment_methods p{font-size:inherit}.payment_methods li+li{padding-top:0;border-top:unset}.wcf-embed-checkout-form .woocommerce-privacy-policy-text{font-size:inherit}.wcf-embed-checkout-form .woocommerce-privacy-policy-text p{color:#444;font-family:inherit;font-weight:inherit;margin-top:1rem}.form-row .select2-container{margin-bottom:inherit}@media only screen and (max-width:768px){#billing_address_2_field>label{opacity:1;overflow:visible}}
assets/min-css/checkout-template-flatsome.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .absolute-footer,html{background-color:unset;font-family:inherit}body{color:#404040;font-family:inherit;line-height:1.5}b,strong{font-weight:700}.woocommerce-billing-fields{padding-top:0;border-top:unset}.button,button,fieldset,input,select,textarea{margin-bottom:inherit}.wcf-embed-checkout-form .woocommerce #order_review .input-text,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row select,.wcf-embed-checkout-form .woocommerce form .form-row textarea{height:auto}#ship-to-different-address label{font-weight:inherit}.shop_table tfoot th,td,th{color:inherit;font-size:inherit;letter-spacing:inherit;text-transform:inherit;text-align:inherit}span.amount{white-space:inherit;color:inherit;font-weight:inherit}.cart_totals tbody tr td,.shop_table tfoot tr td,.shop_table thead tr th:last-of-type,.shop_table tr td:last-of-type,td.product-total{text-align:inherit}.shipping__table--multiple td,.shipping__table--multiple th{display:table-cell;width:50%}.shipping__table--multiple{display:block;text-align:inherit}tr.shipping input:checked+label{font-weight:400}.widget_shopping_cart_content .blockUI.blockOverlay::before,.woocommerce-checkout-review-order .blockUI.blockOverlay::before{border-top:inherit!important;border-right:inherit!important;border-bottom:inherit!important;border-left:inherit!important}label,legend{color:inherit;font-weight:inherit;font-size:inherit}.payment_methods p{font-size:inherit}.payment_methods li+li{padding-top:0;border-top:unset}.wcf-embed-checkout-form .woocommerce-privacy-policy-text{font-size:inherit}.wcf-embed-checkout-form .woocommerce-privacy-policy-text p{color:#444;font-family:inherit;font-weight:inherit;margin-top:1rem}.form-row .select2-container{margin-bottom:inherit}@media only screen and (max-width:768px){#billing_address_2_field>label{opacity:1;overflow:visible}}
assets/min-css/checkout-template-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .cartflows-container .wcf-embed-checkout-form,.cartflows-container .wcf-embed-checkout-form *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wcf-embed-checkout-form .wc-backward{display:none!important}.wcf-embed-checkout-form .woocommerce form .form-row-first,.wcf-embed-checkout-form .woocommerce form .form-row-last,.wcf-embed-checkout-form .woocommerce-page form .form-row-first,.wcf-embed-checkout-form .woocommerce-page form .form-row-last{width:50%;display:block}.wcf-embed-checkout-form .woocommerce form .form-row-full,.wcf-embed-checkout-form .woocommerce-page form .form-row-full{width:100%;clear:both}.wcf-embed-checkout-form form .form-row-wide{width:100%}.wcf-embed-checkout-form form .wcf-column-33{width:33.33%}.wcf-embed-checkout-form .woocommerce form .form-row-first,.woocommerce-page form .form-row-first{float:right;clear:right}.wcf-embed-checkout-form .woocommerce form .form-row-last,.woocommerce-page form .form-row-last{float:left;clear:left}.wcf-embed-checkout-form .woocommerce form .form-row .required{color:red;font-weight:700;border:0!important;text-decoration:none}.wcf-embed-checkout-form form .form-row-first.form-row-one{clear:both}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{display:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row{margin-bottom:15px}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .clear{clear:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label{margin:0;line-height:1em;padding-top:0;position:relative;top:0}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .login-form-actions{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:0}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password,.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .remember_me{-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;font-family:inherit;font-size:13px}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me label{margin-bottom:0;vertical-align:text-top}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me input,.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me span{vertical-align:middle}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{text-align:left;margin-top:0;margin-bottom:0}.wcf-embed-checkout-form .woocommerce .blockUI.blockOverlay{font-size:15px}.mt20{margin-top:20px!important}.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid .select2-container,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid select{border-width:1px;border-color:#e2401c}.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated .select2-container,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{border-width:1px}.wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}.wcf-embed-checkout-form .woocommerce form .form-row input.field-validated{border-right-width:2px;border-right-color:#69bf29}.wcf-embed-checkout-form .wcf-checkout-header-image{text-align:center}.wcf-embed-checkout-form .woocommerce #payment input[type=radio]{-webkit-border-radius:50%;border-radius:50%;margin-left:4px;line-height:10px}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\e600";margin:0;color:#f16334}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.wcf-embed-checkout-form .woocommerce #payment input[type=radio],.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox],.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}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:focus,.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)}.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}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:checked:before,.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}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li input[type=checkbox]{min-width:16px}.wcf-embed-checkout-form .woocommerce .col2-set .col-1,.wcf-embed-checkout-form .woocommerce .col2-set .col-2,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-1,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2{float:none;width:100%;max-width:100%;padding:0;-webkit-border-radius:0;border-radius:0;border:none;border-color:none;margin-bottom:0}.wcf-embed-checkout-form #order_review_heading,.wcf-embed-checkout-form .woocommerce #ship-to-different-address,.wcf-embed-checkout-form .woocommerce-additional-fields>h3,.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;padding:3px}.wcf-embed-checkout-form .woocommerce-checkout #payment{background:unset;-webkit-border-radius:0;border-radius:0}.wcf-embed-checkout-form .woocommerce-checkout #payment .form-row{margin:0;padding:0}.wcf-embed-checkout-form .woocommerce-checkout #payment .form-row label.checkbox{display:block;margin-bottom:1.1em}.wcf-embed-checkout-form .woocommerce-checkout #payment .payment_method_paypal .about_paypal{float:none;margin-right:10px}.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box .form-row{margin:0 0 .5em}.wcf-embed-checkout-form .woocommerce-checkout #payment fieldset .form-row .wcf-embed-checkout-form .woocommerce-checkout #payment fieldset p{margin-bottom:10px}.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{background-color:#eaeaea;font-family:inherit;font-weight:inherit;margin-bottom:.5em}.wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,.wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before{content:'';display:block;border:1em solid;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;border-bottom-color:#eaeaea;position:absolute;top:-.75em;right:0;margin:-1em 2em 0 0}.wcf-embed-checkout-form .select2-container--default .select2-selection--single{display:block;width:100%;min-height:34px;height:auto;padding:11px 12px;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid;border-color:#d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;outline:0}.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered{color:#666;line-height:19px;min-height:19px;overflow:visible;padding-right:0}.select2-results__option[data-selected],.wcf-embed-checkout-form .select2-results__option[aria-selected]{font-size:14px}.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__arrow{height:100%}.select2-dropdown{border:1px solid #d4d4d4}.wcf-embed-checkout-form .woocommerce #order_review .input-text,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row select,.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;border-color:#d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;height:auto}.wcf-embed-checkout-form #order_review{padding:3px;width:100%}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{padding:0 2em 1.2em 2em;background-color:transparent;border:none;margin:0;width:100%}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{list-style:none!important;margin:0}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{top:0;right:0}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{content:'\e016'}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{margin:0 8px 0 0}.wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input[type=text]{font-weight:400}.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:15px;margin-top:25px;border-top:1px solid #dcdcdc;border-bottom:1px solid #dcdcdc;padding-top:25px;padding-bottom:25px;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.wcf-embed-checkout-form #order_review .wcf-coupon-col-1{width:70%;display:inline-block;padding-left:20px}.wcf-embed-checkout-form #order_review .wcf-coupon-col-2{width:30%}.wcf-embed-checkout-form .select2-container--open,.wcf-embed-checkout-form input[type=email]:focus,.wcf-embed-checkout-form input[type=password]:focus,.wcf-embed-checkout-form input[type=tel]:focus,.wcf-embed-checkout-form input[type=text]:focus,.wcf-embed-checkout-form textarea:focus{border-color:#b3b3b3;-webkit-box-shadow:none;box-shadow:none;outline:0}.wcf-embed-checkout-form button:focus{outline:0;outline-color:none;outline-style:none;outline-width:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,.wcf-embed-checkout-form form.checkout_coupon .button{display:block;clear:both;border:none;font-size:15px;font-family:inherit;font-weight:inherit;background-color:#f16334;line-height:9px;padding:18px;margin-bottom:10px;width:100%;text-transform:uppercase}.wcf-embed-checkout-form .woocommerce #order_review button{border:1px solid;border-color:#f16334;background-color:#f16334;font-family:inherit;font-weight:inherit;font-size:18px;letter-spacing:.5px;width:100%;padding:16px 24px;font-size:16px;line-height:1.5;-webkit-border-radius:3px;border-radius:3px;color:#fff;text-transform:uppercase}.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small{padding:8px 6px;background-color:#c8c8c8;border:1px #c8c8c8 solid}.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{border-color:#f16334;background-color:#f16334}.wcf-embed-checkout-form .woocommerce #payment #place_order:hover{background-color:#f16334;border-color:#f16334;color:#fff}.wcf-embed-checkout-form .woocommerce-checkout{display:inline-block;width:100%}.wcf-embed-checkout-form .woocommerce-checkout .col2-set{display:inline-block;width:55%;float:right;padding-left:40px;margin:20px 0 0}.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0 -7px;-ms-flex-wrap:wrap;flex-wrap:wrap;-js-display:flex;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex;display:-webkit-flex;flex-wrap:wrap;-webkit-flex-wrap:wrap}.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper{margin:0 -7px}.wcf-embed-checkout-form-two-column .woocommerce-checkout .wcf-order-wrap{display:inline-block;float:none;width:45%;border:none;background-color:inherit;padding:0 10px;-webkit-border-radius:3px;border-radius:3px}.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block;font-family:inherit;font-weight:600;width:100%;margin:20px 0 0;padding:3px 3px 20px;border:none;border-bottom:none}.wcf-embed-checkout-form .woocommerce-checkout #payment{background-color:inherit;border:none;-webkit-border-radius:0;border-radius:0}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0}.wcf-embed-checkout-form #add_payment_method #payment ul.payment_methods,.wcf-embed-checkout-form .woocommerce-cart #payment ul.payment_methods,.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{border:none}.wcf-embed-checkout-form .woocommerce form .form-row{display:block;margin-bottom:1.1em;padding:3px 7px;position:relative}.wcf-embed-checkout-form 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}.wcf-embed-checkout-form table.shop_table td strong.product-quantity{font-weight:400}.wcf-embed-checkout-form table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.wcf-embed-checkout-form table.shop_table #shipping_method .amount{font-weight:400}.wcf-embed-checkout-form table.shop_table th{border:none;font-weight:400;padding:9px 0;line-height:1.2em}.wcf-embed-checkout-form table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.wcf-embed-checkout-form table.shop_table td,.wcf-embed-checkout-form table.shop_table td dl dd,.wcf-embed-checkout-form table.shop_table td dl dt,.wcf-embed-checkout-form table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.wcf-embed-checkout-form table.shop_table td dl dd p{margin-top:0}.wcf-embed-checkout-form table.shop_table tbody th,.wcf-embed-checkout-form table.shop_table tfoot td,.wcf-embed-checkout-form table.shop_table tfoot th{border:none;font-weight:400;width:50%}.wcf-embed-checkout-form table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.wcf-embed-checkout-form table.shop_table th.product-name,.wcf-embed-checkout-form table.shop_table th.product-total{font-weight:600}.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not(.recurring-total) td,.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-total td,.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-total th,.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.wcf-embed-checkout-form table.shop_table tbody tr td:nth-child(1),.wcf-embed-checkout-form table.shop_table tfoot tr td:nth-child(1),.wcf-embed-checkout-form table.shop_table thead tr th:nth-child(1){width:70%}.wcf-embed-checkout-form table.shop_table tbody tr td:nth-child(2),.wcf-embed-checkout-form table.shop_table tfoot tr td:nth-child(2),.wcf-embed-checkout-form table.shop_table thead tr th:nth-child(2){width:30%}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.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}.wcf-embed-checkout-form .woocommerce .woocommerce-terms-and-conditions-wrapper .woocommerce-terms-and-conditions-checkbox-text{line-height:20px;text-transform:initial}.wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;font-size:11px;color:#777;margin-top:0;text-align:justify}.wcf-embed-checkout-form #payment .wc_payment_methods .payment_box p{margin:0}.wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.wcf-embed-checkout-form .woocommerce .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-info,.wcf-embed-checkout-form .woocommerce .woocommerce-message,.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{padding:1em 2em .4em 2em;border-top:none;background-color:inherit;font-size:14px;font-weight:500;margin:0}.wcf-embed-checkout-form .woocommerce-info::before,.wcf-embed-checkout-form .woocommerce-message::before{right:.1em;color:#f16334}.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6;border:dashed 1px #a00;padding:25px 25px 20px;color:#a00;margin:1rem 0 1rem;font-size:14px;width:100%}.wcf-embed-checkout-form .woocommerce .woocommerce-error::before{content:''}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{display:inline}.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{margin:1em 0 1em}.wcf-embed-checkout-form .woocommerce .woocommerce-error li{list-style:disc inside!important;margin:0 0 8px}.wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.wcf-embed-checkout-form .woocommerce form.checkout_coupon{border:1px solid #d3ced2;padding:30px 20px 20px;margin:2em 0;text-align:right;-webkit-border-radius:5px;border-radius:5px}.wcf-embed-checkout-form .woocommerce .checkout_coupon p{font-size:14px}.wcf-embed-checkout-form .woocommerce .checkout_coupon p{font-family:inherit;font-weight:500;margin-top:0;margin-bottom:10px}@media only screen and (max-width:768px){.wcf-embed-checkout-form form .wcf-column-33{width:100%}.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{width:100%}.wcf-embed-checkout-form .woocommerce-checkout #order_review{width:100%}.wcf-embed-checkout-form .woocommerce-checkout .wcf-order-wrap{width:100%}.wcf-embed-checkout-form .woocommerce-checkout{display:block}.wcf-embed-checkout-form .woocommerce-checkout .col2-set{display:block;width:100%;padding-left:0;margin:20px 0 0}.wcf-embed-checkout-form form.checkout_coupon .button{font-size:12px}.wcf-bump-order-field-wrap .wcf-bump-order-label{font-size:16px;text-transform:capitalize}.wcf-embed-checkout-form .woocommerce .col2-set .col-1,.wcf-embed-checkout-form .woocommerce .col2-set .col-2,.wcf-embed-checkout-form .woocommerce .wcf-order-wrap,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-1,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2,.wcf-embed-checkout-form .woocommerce-page .wcf-order-wrap{padding:15px 18px}.wcf-embed-checkout-form .woocommerce form .form-row-first,.wcf-embed-checkout-form .woocommerce form .form-row-last,.wcf-embed-checkout-form .woocommerce-page form .form-row-first,.wcf-embed-checkout-form .woocommerce-page form .form-row-last{width:100%}.wcf-embed-checkout-form #order_review_heading,.wcf-embed-checkout-form .woocommerce #ship-to-different-address,.wcf-embed-checkout-form .woocommerce-additional-fields>h3,.wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-size:1em}}#et-info-email:before,#et-info-phone:before,#et_search_icon:before,.comment-reply-link:after,.et-cart-info span:before,.et-pb-arrow-next:before,.et-pb-arrow-prev:before,.et-social-icon a:before,.et_audio_container .mejs-playpause-button button:before,.et_audio_container .mejs-volume-button button:before,.et_overlay:before,.et_password_protected_form .et_submit_button:after,.et_pb_button:after,.et_pb_contact_reset:after,.et_pb_contact_submit:after,.et_pb_font_icon:before,.et_pb_newsletter_button:after,.et_pb_pricing_table_button:after,.et_pb_promo_button:after,.et_pb_social_icon a.icon:before,.et_pb_testimonial:before,.et_pb_toggle_title:before,.form-submit .et_pb_button:after,.mobile_menu_bar:before,.woocommerce #content input.button.alt:after,.woocommerce #content input.button:after,.woocommerce #respond input#submit.alt:after,.woocommerce #respond input#submit:after,.woocommerce a.button.alt:after,.woocommerce button.button.alt:after,.woocommerce button.button:after,.woocommerce button.single_add_to_cart_button.button:after,.woocommerce input.button.alt:after,.woocommerce input.button:after,.woocommerce-page #content input.button.alt:after,.woocommerce-page #content input.button:after,.woocommerce-page #respond input#submit.alt:after,.woocommerce-page #respond input#submit:after,.woocommerce-page a.button.alt:after,.woocommerce-page a.button:after,.woocommerce-page button.button.alt:after,.woocommerce-page button.button:after,.woocommerce-page input.button.alt:after,.woocommerce-page input.button:after,a.et_pb_more_button:after{text-shadow:0 0;font-family:none;font-weight:400;font-style:normal;font-variant:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1;text-transform:none;speak:none}.comment-reply-link:hover:after,.woocommerce #content input.button.alt:hover:after,.woocommerce #content input.button:hover:after,.woocommerce #respond input#submit.alt:hover:after,.woocommerce #respond input#submit:hover:after,.woocommerce a.button.alt:hover:after,.woocommerce a.button:hover:after,.woocommerce button.button.alt:hover:after,.woocommerce button.button:hover:after,.woocommerce input.button.alt:hover:after,.woocommerce input.button:hover:after,.woocommerce-page #content input.button.alt:hover:after,.woocommerce-page #content input.button:hover:after,.woocommerce-page #respond input#submit.alt:hover:after,.woocommerce-page #respond input#submit:hover:after,.woocommerce-page a.button.alt:hover:after,.woocommerce-page a.button:hover:after,.woocommerce-page button.button.alt:hover:after,.woocommerce-page button.button:hover:after,.woocommerce-page input.button.alt:hover:after,.woocommerce-page input.button:hover:after{opacity:0}.thrv_wrapper .wcf-embed-checkout-form div{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
assets/min-css/checkout-template-the-seven-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .wf-container>*,body,body.page,button,input,optgroup,select,textarea{font-family:normal 1rem/2 sans-serif,Helvetica,Arial,Verdana,sans-serif;font-size:inherit}.wcf-embed-checkout-form-one-column #customer_details{width:100%}.wcf-embed-checkout-form-two-column #customer_details{width:55%}.wpcf7-number,input[type=date],input[type=email],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=url],select{height:auto}#ship-to-different-address{font:inherit}#ship-to-different-address label,.create-account label.checkbox span{font-size:inherit;line-height:inherit}.order_details .product-name,.order_details .product-name a,.woocommerce-checkout-review-order .product-name,.woocommerce-checkout-review-order .product-name a{font:inherit;font-size:inherit;color:inherit}.order_details .about_paypal,.order_details .cart-subtotal th,.order_details .order-total th,.order_details .product-quantity,.order_details .product-total,.order_details .product-total .woocommerce-Price-amount,.order_details .shipping th,.order_details tfoot th,.woocommerce-checkout-review-order .about_paypal,.woocommerce-checkout-review-order .cart-subtotal th,.woocommerce-checkout-review-order .order-total th,.woocommerce-checkout-review-order .product-quantity,.woocommerce-checkout-review-order .product-total,.woocommerce-checkout-review-order .product-total .woocommerce-Price-amount,.woocommerce-checkout-review-order .shipping th,.woocommerce-checkout-review-order tfoot th{color:inherit}#shipping_method label,.payment_methods label{color:inherit;font-size:inherit;line-height:inherit}.woocommerce-privacy-policy-text,.woocommerce-terms-and-conditions-checkbox-text,.woocommerce-terms-and-conditions-text{font-size:inherit;line-height:inherit}.woocommerce-error .woocommerce-error-text,.woocommerce-error .woocommerce-info-text,.woocommerce-error .woocommerce-message-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-error-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-info-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-message-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-error-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-info-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-message-text{font:inherit}.checkout .woocommerce-NoticeGroup .woocommerce-error .woocommerce-error-text{margin:0;padding-right:0}table.shop_table tbody tr td,table.shop_table tbody tr th,table.shop_table thead tr td,table.shop_table thead tr th{border:none;font-weight:400;width:50%}@media screen and (max-width:990px){#customer_details{width:100%}.mt20{margin-top:10px!important}}@media only screen and (max-width:768px){#customer_details{width:100%}.mt20{margin-top:10px!important}}@media screen and (max-width:600px){#customer_details{width:100%}table.shop_table tbody tr{padding:0}.shop_table tr{border-top:inherit;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-flow:inherit;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-flow:inherit;flex-flow:inherit}.shop_table tr.cart_item td.product-name{-webkit-box-align:baseline;-webkit-align-items:baseline;-moz-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-flow:inherit;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-flow:inherit;flex-flow:inherit;text-align:right}.shop_table thead{display:block}}
assets/min-css/checkout-template-the-seven.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .wf-container>*,body,body.page,button,input,optgroup,select,textarea{font-family:normal 1rem/2 sans-serif,Helvetica,Arial,Verdana,sans-serif;font-size:inherit}.wcf-embed-checkout-form-one-column #customer_details{width:100%}.wcf-embed-checkout-form-two-column #customer_details{width:55%}.wpcf7-number,input[type=date],input[type=email],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=url],select{height:auto}#ship-to-different-address{font:inherit}#ship-to-different-address label,.create-account label.checkbox span{font-size:inherit;line-height:inherit}.order_details .product-name,.order_details .product-name a,.woocommerce-checkout-review-order .product-name,.woocommerce-checkout-review-order .product-name a{font:inherit;font-size:inherit;color:inherit}.order_details .about_paypal,.order_details .cart-subtotal th,.order_details .order-total th,.order_details .product-quantity,.order_details .product-total,.order_details .product-total .woocommerce-Price-amount,.order_details .shipping th,.order_details tfoot th,.woocommerce-checkout-review-order .about_paypal,.woocommerce-checkout-review-order .cart-subtotal th,.woocommerce-checkout-review-order .order-total th,.woocommerce-checkout-review-order .product-quantity,.woocommerce-checkout-review-order .product-total,.woocommerce-checkout-review-order .product-total .woocommerce-Price-amount,.woocommerce-checkout-review-order .shipping th,.woocommerce-checkout-review-order tfoot th{color:inherit}#shipping_method label,.payment_methods label{color:inherit;font-size:inherit;line-height:inherit}.woocommerce-privacy-policy-text,.woocommerce-terms-and-conditions-checkbox-text,.woocommerce-terms-and-conditions-text{font-size:inherit;line-height:inherit}.woocommerce-error .woocommerce-error-text,.woocommerce-error .woocommerce-info-text,.woocommerce-error .woocommerce-message-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-error-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-info-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-info .woocommerce-message-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-error-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-info-text,div:not(.wc-coupon-wrap):not(.wc-login-wrap):not(.woocommerce-MyAccount-content)>.woocommerce-message .woocommerce-message-text{font:inherit}.checkout .woocommerce-NoticeGroup .woocommerce-error .woocommerce-error-text{margin:0;padding-left:0}table.shop_table tbody tr td,table.shop_table tbody tr th,table.shop_table thead tr td,table.shop_table thead tr th{border:none;font-weight:400;width:50%}@media screen and (max-width:990px){#customer_details{width:100%}.mt20{margin-top:10px!important}}@media only screen and (max-width:768px){#customer_details{width:100%}.mt20{margin-top:10px!important}}@media screen and (max-width:600px){#customer_details{width:100%}table.shop_table tbody tr{padding:0}.shop_table tr{border-top:inherit;-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-flow:inherit;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-flow:inherit;flex-flow:inherit}.shop_table tr.cart_item td.product-name{-webkit-box-align:baseline;-webkit-align-items:baseline;-moz-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-flow:inherit;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-flow:inherit;flex-flow:inherit;text-align:left}.shop_table thead{display:block}}
assets/min-css/checkout-template.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .cartflows-container .wcf-embed-checkout-form,.cartflows-container .wcf-embed-checkout-form *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wcf-embed-checkout-form .wc-backward{display:none!important}.wcf-embed-checkout-form .woocommerce form .form-row-first,.wcf-embed-checkout-form .woocommerce form .form-row-last,.wcf-embed-checkout-form .woocommerce-page form .form-row-first,.wcf-embed-checkout-form .woocommerce-page form .form-row-last{width:50%;display:block}.wcf-embed-checkout-form .woocommerce form .form-row-full,.wcf-embed-checkout-form .woocommerce-page form .form-row-full{width:100%;clear:both}.wcf-embed-checkout-form form .form-row-wide{width:100%}.wcf-embed-checkout-form form .wcf-column-33{width:33.33%}.wcf-embed-checkout-form .woocommerce form .form-row-first,.woocommerce-page form .form-row-first{float:left;clear:left}.wcf-embed-checkout-form .woocommerce form .form-row-last,.woocommerce-page form .form-row-last{float:right;clear:right}.wcf-embed-checkout-form .woocommerce form .form-row .required{color:red;font-weight:700;border:0!important;text-decoration:none}.wcf-embed-checkout-form form .form-row-first.form-row-one{clear:both}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login{display:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row{margin-bottom:15px}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .clear{clear:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label{margin:0;line-height:1em;padding-top:0;position:relative;top:0}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .login-form-actions{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;margin-bottom:0}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password,.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .remember_me{-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;font-family:inherit;font-size:13px}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me label{margin-bottom:0;vertical-align:text-top}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me input,.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row .remember_me span{vertical-align:middle}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .lost_password{text-align:right;margin-top:0;margin-bottom:0}.wcf-embed-checkout-form .woocommerce .blockUI.blockOverlay{font-size:15px}.mt20{margin-top:20px!important}.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid .select2-container,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-invalid select{border-width:1px;border-color:#e2401c}.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated .select2-container,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row.woocommerce-validated select{border-width:1px}.wcf-embed-checkout-form .select2-container--default.field-required .select2-selection--single,.wcf-embed-checkout-form .woocommerce #order_review .input-text.field-required,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text.field-required,.wcf-embed-checkout-form .woocommerce form .form-row textarea.input-text.field-required{border-color:#e2401c}.wcf-embed-checkout-form .woocommerce form .form-row input.field-validated{border-left-width:2px;border-left-color:#69bf29}.wcf-embed-checkout-form .wcf-checkout-header-image{text-align:center}.wcf-embed-checkout-form .woocommerce #payment input[type=radio]{-webkit-border-radius:50%;border-radius:50%;margin-right:4px;line-height:10px}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type=checkbox]:checked:before{content:"\e600";margin:0;color:#f16334}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox],.wcf-embed-checkout-form .woocommerce #payment input[type=radio],.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox],.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}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:focus,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:focus,.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)}.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}.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before,.wcf-embed-checkout-form .woocommerce .woocommerce-billing-fields [type=checkbox]:checked:before,.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}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li input[type=checkbox]{min-width:16px}.wcf-embed-checkout-form .woocommerce .col2-set .col-1,.wcf-embed-checkout-form .woocommerce .col2-set .col-2,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-1,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2{float:none;width:100%;max-width:100%;padding:0;-webkit-border-radius:0;border-radius:0;border:none;border-color:none;margin-bottom:0}.wcf-embed-checkout-form #order_review_heading,.wcf-embed-checkout-form .woocommerce #ship-to-different-address,.wcf-embed-checkout-form .woocommerce-additional-fields>h3,.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;padding:3px}.wcf-embed-checkout-form .woocommerce-checkout #payment{background:unset;-webkit-border-radius:0;border-radius:0}.wcf-embed-checkout-form .woocommerce-checkout #payment .form-row{margin:0;padding:0}.wcf-embed-checkout-form .woocommerce-checkout #payment .form-row label.checkbox{display:block;margin-bottom:1.1em}.wcf-embed-checkout-form .woocommerce-checkout #payment .payment_method_paypal .about_paypal{float:none;margin-left:10px}.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box .form-row{margin:0 0 .5em}.wcf-embed-checkout-form .woocommerce-checkout #payment fieldset .form-row .wcf-embed-checkout-form .woocommerce-checkout #payment fieldset p{margin-bottom:10px}.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{background-color:#eaeaea;font-family:inherit;font-weight:inherit;margin-bottom:.5em}.wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,.wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before{content:'';display:block;border:1em solid;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent;border-bottom-color:#eaeaea;position:absolute;top:-.75em;left:0;margin:-1em 0 0 2em}.wcf-embed-checkout-form .select2-container--default .select2-selection--single{display:block;width:100%;min-height:34px;height:auto;padding:11px 12px;font-size:14px;line-height:1.42857143!important;color:#555;background-color:#fff;background-image:none;border:1px solid;border-color:#d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;outline:0}.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered{color:#666;line-height:19px;min-height:19px;overflow:visible;padding-left:0}.select2-results__option[data-selected],.wcf-embed-checkout-form .select2-results__option[aria-selected]{font-size:14px}.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__arrow{height:100%}.select2-dropdown{border:1px solid #d4d4d4}.wcf-embed-checkout-form .woocommerce #order_review .input-text,.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,.wcf-embed-checkout-form .woocommerce form .form-row select,.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;border-color:#d4d4d4;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:none;box-shadow:none;height:auto}.wcf-embed-checkout-form #order_review{padding:3px;width:100%}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error,.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message{padding:0 2em 1.2em 2em;background-color:transparent;border:none;margin:0;width:100%}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{list-style:none!important;margin:0}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before,.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-message::before{top:0;left:0}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error::before{content:'\e016'}.wcf-embed-checkout-form .woocommerce .wcf-custom-coupon-field .woocommerce-error li{margin:0 0 0 8px}.wcf-embed-checkout-form .woocommerce #order_review .wcf-custom-coupon-field input[type=text]{font-weight:400}.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:15px;margin-top:25px;border-top:1px solid #dcdcdc;border-bottom:1px solid #dcdcdc;padding-top:25px;padding-bottom:25px;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.wcf-embed-checkout-form #order_review .wcf-coupon-col-1{width:70%;display:inline-block;padding-right:20px}.wcf-embed-checkout-form #order_review .wcf-coupon-col-2{width:30%}.wcf-embed-checkout-form .select2-container--open,.wcf-embed-checkout-form input[type=email]:focus,.wcf-embed-checkout-form input[type=password]:focus,.wcf-embed-checkout-form input[type=tel]:focus,.wcf-embed-checkout-form input[type=text]:focus,.wcf-embed-checkout-form textarea:focus{border-color:#b3b3b3;-webkit-box-shadow:none;box-shadow:none;outline:0}.wcf-embed-checkout-form button:focus{outline:0;outline-color:none;outline-style:none;outline-width:none}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,.wcf-embed-checkout-form form.checkout_coupon .button{display:block;clear:both;border:none;font-size:15px;font-family:inherit;font-weight:inherit;background-color:#f16334;line-height:9px;padding:18px;margin-bottom:10px;width:100%;text-transform:uppercase}.wcf-embed-checkout-form .woocommerce #order_review button{border:1px solid;border-color:#f16334;background-color:#f16334;font-family:inherit;font-weight:inherit;font-size:18px;letter-spacing:.5px;width:100%;padding:16px 24px;font-size:16px;line-height:1.5;-webkit-border-radius:3px;border-radius:3px;color:#fff;text-transform:uppercase}.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small{padding:8px 6px;background-color:#c8c8c8;border:1px #c8c8c8 solid}.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{border-color:#f16334;background-color:#f16334}.wcf-embed-checkout-form .woocommerce #payment #place_order:hover{background-color:#f16334;border-color:#f16334;color:#fff}.wcf-embed-checkout-form .woocommerce-checkout{display:inline-block;width:100%}.wcf-embed-checkout-form .woocommerce-checkout .col2-set{display:inline-block;width:55%;float:left;padding-right:40px;margin:20px 0 0}.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-billing-fields .woocommerce-billing-fields__field-wrapper,.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper{margin:0 -7px;-ms-flex-wrap:wrap;flex-wrap:wrap;-js-display:flex;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:flex;display:-webkit-flex;flex-wrap:wrap;-webkit-flex-wrap:wrap}.wcf-embed-checkout-form .woocommerce-checkout .col2-set .woocommerce-additional-fields .woocommerce-additional-fields__field-wrapper{margin:0 -7px}.wcf-embed-checkout-form-two-column .woocommerce-checkout .wcf-order-wrap{display:inline-block;float:none;width:45%;border:none;background-color:inherit;padding:0 10px;-webkit-border-radius:3px;border-radius:3px}.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{display:inline-block;font-family:inherit;font-weight:600;width:100%;margin:20px 0 0;padding:3px 3px 20px;border:none;border-bottom:none}.wcf-embed-checkout-form .woocommerce-checkout #payment{background-color:inherit;border:none;-webkit-border-radius:0;border-radius:0}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{padding:1em 0}.wcf-embed-checkout-form #add_payment_method #payment ul.payment_methods,.wcf-embed-checkout-form .woocommerce-cart #payment ul.payment_methods,.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods{border:none}.wcf-embed-checkout-form .woocommerce form .form-row{display:block;margin-bottom:1.1em;padding:3px 7px;position:relative}.wcf-embed-checkout-form 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}.wcf-embed-checkout-form table.shop_table td strong.product-quantity{font-weight:400}.wcf-embed-checkout-form table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.wcf-embed-checkout-form table.shop_table #shipping_method .amount{font-weight:400}.wcf-embed-checkout-form table.shop_table th{border:none;font-weight:400;padding:9px 0;line-height:1.2em}.wcf-embed-checkout-form table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.wcf-embed-checkout-form table.shop_table td,.wcf-embed-checkout-form table.shop_table td dl dd,.wcf-embed-checkout-form table.shop_table td dl dt,.wcf-embed-checkout-form table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.wcf-embed-checkout-form table.shop_table td dl dd p{margin-top:0}.wcf-embed-checkout-form table.shop_table tbody th,.wcf-embed-checkout-form table.shop_table tfoot td,.wcf-embed-checkout-form table.shop_table tfoot th{border:none;font-weight:400;width:50%}.wcf-embed-checkout-form table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.wcf-embed-checkout-form table.shop_table th.product-name,.wcf-embed-checkout-form table.shop_table th.product-total{font-weight:600}.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not(.recurring-total) td,.wcf-embed-checkout-form table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-total td,.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-total th,.wcf-embed-checkout-form table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.wcf-embed-checkout-form table.shop_table tbody tr td:nth-child(1),.wcf-embed-checkout-form table.shop_table tfoot tr td:nth-child(1),.wcf-embed-checkout-form table.shop_table thead tr th:nth-child(1){width:70%}.wcf-embed-checkout-form table.shop_table tbody tr td:nth-child(2),.wcf-embed-checkout-form table.shop_table tfoot tr td:nth-child(2),.wcf-embed-checkout-form table.shop_table thead tr th:nth-child(2){width:30%}.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row label,.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}.wcf-embed-checkout-form .woocommerce .woocommerce-terms-and-conditions-wrapper .woocommerce-terms-and-conditions-checkbox-text{line-height:20px;text-transform:initial}.wcf-embed-checkout-form #payment .woocommerce-privacy-policy-text p{font-family:inherit;font-weight:inherit;font-size:11px;color:#777;margin-top:0;text-align:justify}.wcf-embed-checkout-form #payment .wc_payment_methods .payment_box p{margin:0}.wcf-embed-checkout-form .woocommerce a{color:#f16334;text-decoration:none}.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-message,.wcf-embed-checkout-form .woocommerce .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-info,.wcf-embed-checkout-form .woocommerce .woocommerce-message,.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{padding:1em 2em .4em 2em;border-top:none;background-color:inherit;font-size:14px;font-weight:500;margin:0}.wcf-embed-checkout-form .woocommerce-info::before,.wcf-embed-checkout-form .woocommerce-message::before{left:.1em;color:#f16334}.wcf-embed-checkout-form .woocommerce .woocommerce-NoticeGroup .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-error,.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-error{background-color:#fff6f6;border:dashed 1px #a00;padding:25px 25px 20px;color:#a00;margin:1rem 0 1rem;font-size:14px;width:100%}.wcf-embed-checkout-form .woocommerce .woocommerce-error::before{content:''}.wcf-embed-checkout-form .woocommerce-checkout #payment ul.payment_methods li:not(.woocommerce-notice)::before{display:inline}.wcf-embed-checkout-form .woocommerce .woocommerce-notices-wrapper .woocommerce-message{margin:1em 0 1em}.wcf-embed-checkout-form .woocommerce .woocommerce-error li{list-style:disc inside!important;margin:0 0 8px}.wcf-embed-checkout-form .woocommerce .woocommerce-error li strong{font-weight:400}.wcf-embed-checkout-form .woocommerce form.checkout_coupon{border:1px solid #d3ced2;padding:30px 20px 20px;margin:2em 0;text-align:left;-webkit-border-radius:5px;border-radius:5px}.wcf-embed-checkout-form .woocommerce .checkout_coupon p{font-size:14px}.wcf-embed-checkout-form .woocommerce .checkout_coupon p{font-family:inherit;font-weight:500;margin-top:0;margin-bottom:10px}@media only screen and (max-width:768px){.wcf-embed-checkout-form form .wcf-column-33{width:100%}.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{width:100%}.wcf-embed-checkout-form .woocommerce-checkout #order_review{width:100%}.wcf-embed-checkout-form .woocommerce-checkout .wcf-order-wrap{width:100%}.wcf-embed-checkout-form .woocommerce-checkout{display:block}.wcf-embed-checkout-form .woocommerce-checkout .col2-set{display:block;width:100%;padding-right:0;margin:20px 0 0}.wcf-embed-checkout-form form.checkout_coupon .button{font-size:12px}.wcf-bump-order-field-wrap .wcf-bump-order-label{font-size:16px;text-transform:capitalize}.wcf-embed-checkout-form .woocommerce .col2-set .col-1,.wcf-embed-checkout-form .woocommerce .col2-set .col-2,.wcf-embed-checkout-form .woocommerce .wcf-order-wrap,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-1,.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2,.wcf-embed-checkout-form .woocommerce-page .wcf-order-wrap{padding:15px 18px}.wcf-embed-checkout-form .woocommerce form .form-row-first,.wcf-embed-checkout-form .woocommerce form .form-row-last,.wcf-embed-checkout-form .woocommerce-page form .form-row-first,.wcf-embed-checkout-form .woocommerce-page form .form-row-last{width:100%}.wcf-embed-checkout-form #order_review_heading,.wcf-embed-checkout-form .woocommerce #ship-to-different-address,.wcf-embed-checkout-form .woocommerce-additional-fields>h3,.wcf-embed-checkout-form .woocommerce-billing-fields>h3{font-size:1em}}#et-info-email:before,#et-info-phone:before,#et_search_icon:before,.comment-reply-link:after,.et-cart-info span:before,.et-pb-arrow-next:before,.et-pb-arrow-prev:before,.et-social-icon a:before,.et_audio_container .mejs-playpause-button button:before,.et_audio_container .mejs-volume-button button:before,.et_overlay:before,.et_password_protected_form .et_submit_button:after,.et_pb_button:after,.et_pb_contact_reset:after,.et_pb_contact_submit:after,.et_pb_font_icon:before,.et_pb_newsletter_button:after,.et_pb_pricing_table_button:after,.et_pb_promo_button:after,.et_pb_social_icon a.icon:before,.et_pb_testimonial:before,.et_pb_toggle_title:before,.form-submit .et_pb_button:after,.mobile_menu_bar:before,.woocommerce #content input.button.alt:after,.woocommerce #content input.button:after,.woocommerce #respond input#submit.alt:after,.woocommerce #respond input#submit:after,.woocommerce a.button.alt:after,.woocommerce button.button.alt:after,.woocommerce button.button:after,.woocommerce button.single_add_to_cart_button.button:after,.woocommerce input.button.alt:after,.woocommerce input.button:after,.woocommerce-page #content input.button.alt:after,.woocommerce-page #content input.button:after,.woocommerce-page #respond input#submit.alt:after,.woocommerce-page #respond input#submit:after,.woocommerce-page a.button.alt:after,.woocommerce-page a.button:after,.woocommerce-page button.button.alt:after,.woocommerce-page button.button:after,.woocommerce-page input.button.alt:after,.woocommerce-page input.button:after,a.et_pb_more_button:after{text-shadow:0 0;font-family:none;font-weight:400;font-style:normal;font-variant:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1;text-transform:none;speak:none}.comment-reply-link:hover:after,.woocommerce #content input.button.alt:hover:after,.woocommerce #content input.button:hover:after,.woocommerce #respond input#submit.alt:hover:after,.woocommerce #respond input#submit:hover:after,.woocommerce a.button.alt:hover:after,.woocommerce a.button:hover:after,.woocommerce button.button.alt:hover:after,.woocommerce button.button:hover:after,.woocommerce input.button.alt:hover:after,.woocommerce input.button:hover:after,.woocommerce-page #content input.button.alt:hover:after,.woocommerce-page #content input.button:hover:after,.woocommerce-page #respond input#submit.alt:hover:after,.woocommerce-page #respond input#submit:hover:after,.woocommerce-page a.button.alt:hover:after,.woocommerce-page a.button:hover:after,.woocommerce-page button.button.alt:hover:after,.woocommerce-page button.button:hover:after,.woocommerce-page input.button.alt:hover:after,.woocommerce-page input.button:hover:after{opacity:0}.thrv_wrapper .wcf-embed-checkout-form div{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
assets/min-css/frontend-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ html{line-height:1.15;-webkit-text-size-adjust:100%}@font-face{font-family:cartflows-icon;src:url(../fonts/cartflows-icon.eot?81m15v);src:url(../fonts/cartflows-icon.eot?81m15v#iefix) format('embedded-opentype'),url(../fonts/cartflows-icon.ttf?81m15v) format('truetype'),url(../fonts/cartflows-icon.woff?81m15v) format('woff'),url(../fonts/cartflows-icon.svg?81m15v#cartflows-icon) format('svg');font-weight:400;font-style:normal}.cartflows-icon{font-family:cartflows-icon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cartflows-icon-close:before{content:"\e602";font-family:cartflows-icon}.cartflows-icon-cross:before{content:"\e601"}.cartflows-icon-check:before{content:"\e600"}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;-moz-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:700}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}body,button,input,optgroup,select,textarea{color:#404040;font-family:sans-serif;font-size:16px;font-size:1rem;line-height:1.5}h1,h2,h3,h4,h5,h6{clear:both}p{margin-bottom:1.5em}cite,dfn,em,i{font-style:italic}blockquote{margin:0 1.5em}address{margin:0 0 1.5em}pre{background:#eee;font-family:"Courier 10 Pitch",Courier,monospace;font-size:15px;font-size:.9375rem;line-height:1.6;margin-bottom:1.6em;max-width:100%;overflow:auto;padding:1.6em}code,kbd,tt,var{font-family:Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;font-size:15px;font-size:.9375rem}abbr,acronym{border-bottom:1px dotted #666;cursor:help}ins,mark{background:#fff9c0;text-decoration:none}big{font-size:125%}html{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*,:after,:before{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}body{background:#fff}hr{background-color:#ccc;border:0;height:1px;margin-bottom:1.5em}ol,ul{margin:0 3em 1.5em 0}ul{list-style:disc}ol{list-style:decimal}li>ol,li>ul{margin-bottom:0;margin-right:1.5em}dt{font-weight:700}dd{margin:0 1.5em 1.5em}img{height:auto;max-width:100%}figure{margin:1em 0}table{margin:0 0 1.5em;width:100%}button,input[type=button],input[type=reset],input[type=submit]{border:1px solid;border-color:#ccc #ccc #bbb;-webkit-border-radius:3px;border-radius:3px;background:#e6e6e6;color:rgba(0,0,0,.8);font-size:12px;font-size:.75rem;line-height:1;padding:.6em 1em .4em}button:hover,input[type=button]:hover,input[type=reset]:hover,input[type=submit]:hover{border-color:#ccc #bbb #aaa}button:active,button:focus,input[type=button]:active,input[type=button]:focus,input[type=reset]:active,input[type=reset]:focus,input[type=submit]:active,input[type=submit]:focus{border-color:#aaa #bbb #bbb}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea{color:#666;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;padding:3px}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=range]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,textarea:focus{color:#111}select{border:1px solid #ccc}textarea{width:100%}a{color:#4169e1}a:active,a:hover{outline:0}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#f1f1f1;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 0 2px 2px rgba(0,0,0,.6);box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#content[tabindex="-1"]:focus{outline:0}.alignleft{display:inline;float:right;margin-left:1.5em}.alignright{display:inline;float:left;margin-right:1.5em}.aligncenter{clear:both;display:block;margin-right:auto;margin-left:auto}.clear:after,.clear:before{content:"";display:table;table-layout:fixed}.clear:after{clear:both}.widget{margin:0 0 1.5em}.widget select{max-width:100%}embed,iframe,object{max-width:100%}.wcf-button{display:inline-block;padding:12px 24px;background:#ccc;text-decoration:none;margin:5px}body.cartflows-default{background-color:#f5f5f5}.cartflows-default .cartflows-container{max-width:1200px;width:100%;padding:0 20px;margin:60px auto}.cartflows-default .cartflows-primary{background-color:#fff;padding:70px;overflow:hidden;max-width:100%}@media (max-width:768px){.cartflows-default .cartflows-container{padding:0;margin:0}.cartflows-default .cartflows-primary{padding:20px 30px}}@media (max-width:544px){.cartflows-default .cartflows-primary{padding:20px 15px}}.wcf-preview-mode{background:#f16334;position:fixed;bottom:0;right:0;width:100%;height:2.6em;color:#fff;text-align:center;font-size:14px;line-height:2.6em;pointer-events:none;z-index:9999999}@media only screen and (max-width:768px){.wcf-preview-mode{font-size:13px;line-height:18px;padding:4px 10px;height:auto}}.wcf-footer-primary .wcf-footer-content p{margin:1.5em 0;text-align:center}.wcf-thankyou-wrap{padding:0;margin:0 auto;width:100%;max-width:55em;font-size:13px}.wcf-thankyou-wrap a{color:#404040}.woocommerce-order ul.order_details::after,.woocommerce-order ul.order_details::before{content:' ';display:table}.woocommerce-order ul.order_details::after{clear:both}.woocommerce-order ul.order_details,.woocommerce-order ul.order_details li{list-style:none;line-height:1}.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}.woocommerce-order ul.order_details li:first-child{padding-right:0}.woocommerce-order ul.order_details li:last-child{border-left:0;padding-left:0}.woocommerce-order ul.order_details li strong{display:block;margin-top:.7em}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{background:#f1f1f1;padding:1.5em 2.5em}.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.woocommerce-column__title,.woocommerce-order h2.woocommerce-order-details__title{padding:.8em 0;margin:0 0 .5em;font-size:1.5em;font-weight:600;color:#404040}.woocommerce-order .woocommerce-thankyou-order-received{margin:0 0 1.5em;padding:0 .5em;text-align:center}.woocommerce-order-details 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{border:none;font-weight:400;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}.woocommerce-order .col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.woocommerce-order .col2-set .col-1{margin-left:2%}.woocommerce-order .col2-set .col-1,.woocommerce-order .col2-set .col-2{width:49%;display:inline-block}.woocommerce-order .woocommerce-customer-details address{border-left-width:1px;border-bottom-width:1px;-webkit-border-radius:0;border-radius:0;font-style:normal}.woocommerce-order .woocommerce-customer-details address p{margin:0}@media only screen and (max-width:768px){.woocommerce-order .woocommerce-thankyou-order-received{margin:0 0 1em}.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.woocommerce-column__title,.woocommerce-order h2.woocommerce-order-details__title{padding:.5em 0;font-size:1.5em}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{padding:1.5em 2em}.woocommerce-order ul.order_details li{display:block;width:100%;border-left:none;padding:.5em 0 1em 1em;border-bottom:1px dashed #ccc}.woocommerce-order ul.order_details li:last-child{border:none}.woocommerce-order .col2-set{display:block}.woocommerce-order .col2-set .col-1,.woocommerce-order .col2-set .col-2{width:100%;display:block}}
assets/min-css/frontend.min.css ADDED
@@ -0,0 +1 @@
 
1
+ html{line-height:1.15;-webkit-text-size-adjust:100%}@font-face{font-family:cartflows-icon;src:url(../fonts/cartflows-icon.eot?81m15v);src:url(../fonts/cartflows-icon.eot?81m15v#iefix) format('embedded-opentype'),url(../fonts/cartflows-icon.ttf?81m15v) format('truetype'),url(../fonts/cartflows-icon.woff?81m15v) format('woff'),url(../fonts/cartflows-icon.svg?81m15v#cartflows-icon) format('svg');font-weight:400;font-style:normal}.cartflows-icon{font-family:cartflows-icon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.cartflows-icon-close:before{content:"\e602";font-family:cartflows-icon}.cartflows-icon-cross:before{content:"\e601"}.cartflows-icon-check:before{content:"\e600"}body{margin:0}h1{font-size:2em;margin:.67em 0}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;-moz-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:700}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}body,button,input,optgroup,select,textarea{color:#404040;font-family:sans-serif;font-size:16px;font-size:1rem;line-height:1.5}h1,h2,h3,h4,h5,h6{clear:both}p{margin-bottom:1.5em}cite,dfn,em,i{font-style:italic}blockquote{margin:0 1.5em}address{margin:0 0 1.5em}pre{background:#eee;font-family:"Courier 10 Pitch",Courier,monospace;font-size:15px;font-size:.9375rem;line-height:1.6;margin-bottom:1.6em;max-width:100%;overflow:auto;padding:1.6em}code,kbd,tt,var{font-family:Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace;font-size:15px;font-size:.9375rem}abbr,acronym{border-bottom:1px dotted #666;cursor:help}ins,mark{background:#fff9c0;text-decoration:none}big{font-size:125%}html{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*,:after,:before{-webkit-box-sizing:inherit;-moz-box-sizing:inherit;box-sizing:inherit}body{background:#fff}hr{background-color:#ccc;border:0;height:1px;margin-bottom:1.5em}ol,ul{margin:0 0 1.5em 3em}ul{list-style:disc}ol{list-style:decimal}li>ol,li>ul{margin-bottom:0;margin-left:1.5em}dt{font-weight:700}dd{margin:0 1.5em 1.5em}img{height:auto;max-width:100%}figure{margin:1em 0}table{margin:0 0 1.5em;width:100%}button,input[type=button],input[type=reset],input[type=submit]{border:1px solid;border-color:#ccc #ccc #bbb;-webkit-border-radius:3px;border-radius:3px;background:#e6e6e6;color:rgba(0,0,0,.8);font-size:12px;font-size:.75rem;line-height:1;padding:.6em 1em .4em}button:hover,input[type=button]:hover,input[type=reset]:hover,input[type=submit]:hover{border-color:#ccc #bbb #aaa}button:active,button:focus,input[type=button]:active,input[type=button]:focus,input[type=reset]:active,input[type=reset]:focus,input[type=submit]:active,input[type=submit]:focus{border-color:#aaa #bbb #bbb}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],textarea{color:#666;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;padding:3px}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=range]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus,textarea:focus{color:#111}select{border:1px solid #ccc}textarea{width:100%}a{color:#4169e1}a:active,a:hover{outline:0}.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#f1f1f1;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 0 2px 2px rgba(0,0,0,.6);box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}#content[tabindex="-1"]:focus{outline:0}.alignleft{display:inline;float:left;margin-right:1.5em}.alignright{display:inline;float:right;margin-left:1.5em}.aligncenter{clear:both;display:block;margin-left:auto;margin-right:auto}.clear:after,.clear:before{content:"";display:table;table-layout:fixed}.clear:after{clear:both}.widget{margin:0 0 1.5em}.widget select{max-width:100%}embed,iframe,object{max-width:100%}.wcf-button{display:inline-block;padding:12px 24px;background:#ccc;text-decoration:none;margin:5px}body.cartflows-default{background-color:#f5f5f5}.cartflows-default .cartflows-container{max-width:1200px;width:100%;padding:0 20px;margin:60px auto}.cartflows-default .cartflows-primary{background-color:#fff;padding:70px;overflow:hidden;max-width:100%}@media (max-width:768px){.cartflows-default .cartflows-container{padding:0;margin:0}.cartflows-default .cartflows-primary{padding:20px 30px}}@media (max-width:544px){.cartflows-default .cartflows-primary{padding:20px 15px}}.wcf-preview-mode{background:#f16334;position:fixed;bottom:0;left:0;width:100%;height:2.6em;color:#fff;text-align:center;font-size:14px;line-height:2.6em;pointer-events:none;z-index:9999999}@media only screen and (max-width:768px){.wcf-preview-mode{font-size:13px;line-height:18px;padding:4px 10px;height:auto}}.wcf-footer-primary .wcf-footer-content p{margin:1.5em 0;text-align:center}.wcf-thankyou-wrap{padding:0;margin:0 auto;width:100%;max-width:55em;font-size:13px}.wcf-thankyou-wrap a{color:#404040}.woocommerce-order ul.order_details::after,.woocommerce-order ul.order_details::before{content:' ';display:table}.woocommerce-order ul.order_details::after{clear:both}.woocommerce-order ul.order_details,.woocommerce-order ul.order_details li{list-style:none;line-height:1}.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}.woocommerce-order ul.order_details li:first-child{padding-left:0}.woocommerce-order ul.order_details li:last-child{border-right:0;padding-right:0}.woocommerce-order ul.order_details li strong{display:block;margin-top:.7em}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{background:#f1f1f1;padding:1.5em 2.5em}.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.woocommerce-column__title,.woocommerce-order h2.woocommerce-order-details__title{padding:.8em 0;margin:0 0 .5em;font-size:1.5em;font-weight:600;color:#404040}.woocommerce-order .woocommerce-thankyou-order-received{margin:0 0 1.5em;padding:0 .5em;text-align:center}.woocommerce-order-details 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{border:none;font-weight:400;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}.woocommerce-order .col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.woocommerce-order .col2-set .col-1{margin-right:2%}.woocommerce-order .col2-set .col-1,.woocommerce-order .col2-set .col-2{width:49%;display:inline-block}.woocommerce-order .woocommerce-customer-details address{border-right-width:1px;border-bottom-width:1px;-webkit-border-radius:0;border-radius:0;font-style:normal}.woocommerce-order .woocommerce-customer-details address p{margin:0}@media only screen and (max-width:768px){.woocommerce-order .woocommerce-thankyou-order-received{margin:0 0 1em}.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.woocommerce-column__title,.woocommerce-order h2.woocommerce-order-details__title{padding:.5em 0;font-size:1.5em}.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order ul.order_details{padding:1.5em 2em}.woocommerce-order ul.order_details li{display:block;width:100%;border-right:none;padding:.5em 1em 1em 0;border-bottom:1px dashed #ccc}.woocommerce-order ul.order_details li:last-child{border:none}.woocommerce-order .col2-set{display:block}.woocommerce-order .col2-set .col-1,.woocommerce-order .col2-set .col-2{width:100%;display:block}}
assets/min-css/import-rtl.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .no-elementor-notice{border-right:none;background:0 0;border:none;-webkit-box-shadow:none;box-shadow:none;padding-right:0}.no-elementor-notice span{color:#f16334;font-size:18px;vertical-align:middle}.site-preview{background:#c5c5c5;display:block;overflow:hidden;position:relative;-webkit-backface-visibility:hidden}.template.importing .site-preview:after,.template:hover .site-preview:after{opacity:.3}.template.importing .site-preview,.template:hover .site-preview{background:#fff;cursor:pointer}.template .site-preview:after{content:"";background:#fff;opacity:0;top:0;content:"";display:block;top:0;position:absolute;padding-top:66.66666%;-webkit-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out;right:0;left:0;bottom:0}.template .notice{padding:.5em;background:rgba(0,0,0,.7);color:#fff;font-weight:400;border:#ffdead;font-size:11px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;top:50%;-webkit-transform:translateY(-60%);-ms-transform:translateY(-60%);transform:translateY(-60%);left:0;right:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out}#wcf_create_notice{display:none}.preview:focus,.preview:hover{color:#fff;-webkit-box-shadow:none;box-shadow:none}.preview{text-decoration:none;opacity:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);left:22%;right:22%;z-index:4;background:#23282d;background:rgba(0,0,0,.7);color:#fff;font-size:13px;text-shadow:0 1px 0 rgba(0,0,0,.6);-webkit-font-smoothing:antialiased;font-weight:600;padding:10px 12px;text-align:center;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out}.template-id-container{font-size:15px;font-weight:600;margin:0;padding:10px;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,.1);box-shadow:inset 0 1px 0 rgba(0,0,0,.1);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;background:#fff;background:rgba(255,255,255,.65);position:relative}.template-actions{opacity:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;position:absolute;bottom:0;left:0;top:0;padding:5px 5px 0 5px;background:rgba(244,244,244,.7);border-right:1px solid rgba(0,0,0,.05)}.template.importing .preview,.template.importing .template-actions,.template:hover .preview,.template:hover .template-actions,.wcf-step-content .template-actions{opacity:1}.wcf-remote-list .template{position:relative;overflow:hidden}.wcf-remote-list h3{margin-bottom:1em;margin-top:0;font-size:15px;font-weight:600;margin:0;padding:0;text-align:right}.wcf-remote-list img{max-width:100%;vertical-align:middle}.wcf-remote-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#cartflows-steps-list img{width:100%}#cartflows-steps-list .title{font-weight:700;color:#474747;line-height:2;background:#f7f7f7;padding:.5em 1em}#cartflows-steps-list .image-wrap{-webkit-background-size:cover;background-size:cover;overflow:hidden}#cartflows-steps .close{display:inline-block;padding:2em;cursor:pointer}.template-message-block{text-align:center;margin:0 auto;padding:4em 0}.templator #TB_ajaxContent{width:100%!important}.template-message-block .description{font-style:normal}.template-message-block .spinner{float:none;margin:0}.cartflows-steps-popup{position:fixed;right:0;left:0;top:0;bottom:0;z-index:99999;background:#fff;overflow-y:scroll}.cartflows-steps-popup .notice{max-width:700px;margin:0 auto}.cartflows-load-steps-library .dashicons{height:auto;width:auto;line-height:normal;margin:0 0 0 5px;vertical-align:initial;font-size:100%}.cartflows-load-steps .dashicons{vertical-align:text-bottom}#TB_window{width:100%!important;margin:0 auto!important;text-align:center!important;position:fixed!important;top:0!important;right:0!important;left:0!important;bottom:0!important}#TB_iframeContent{width:100%!important;height:100%!important}@media only screen and (min-device-width :320px) and (max-device-width :1024px){#TB_iframeContent-wrapper{position:fixed;left:0;bottom:50px;right:0;top:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}}#TB_window #TB_ajaxWindowTitle{font-size:1.2rem;display:inline-block;width:auto;padding:0}#TB_window #TB_closeWindowButton{position:relative}.tb-close-icon:before{vertical-align:middle}#TB_window{text-align:center}#TB_iframeContent.tablet{width:768px!important;height:1024px!important;background:#111;padding:40px 10px 70px;-webkit-border-radius:30px;border-radius:30px}#TB_iframeContent.tablet.landscape{width:1024px!important}#TB_iframeContent.mobile{width:360px!important;height:640px!important;background:#111;padding:40px 10px 70px;-webkit-border-radius:30px;border-radius:30px}#TB_iframeContent.mobile.landscape{width:360px!important}#TB_closeAjaxWindow{float:left}#TB_window.thickbox-loading{margin:0!important}div#TB_window{background-color:#fff}#TB_window #TB_title{color:#0a0c0d;text-align:right;bottom:0;-webkit-box-shadow:none;box-shadow:none;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;padding:1em 1.5em 1em 1em}@media all and (min-width:769px){#TB_window #TB_title{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}}#TB_window.mobile,#TB_window.tablet{overflow-y:scroll}.top #TB_iframeContent-wrapper{bottom:0;top:80px}#TB_window.top #TB_title{top:0}#TB_window #TB_closeWindowButton:focus .tb-close-icon{-webkit-box-shadow:none;box-shadow:none;color:#666}@media all and (max-width:768px){#TB_closeAjaxWindow{padding-left:0}#TB_window #TB_closeWindowButton,#TB_window .tb-close-icon{width:80px}}.responsive-view .dashicons{color:#ddd}.responsive-view .active{color:#111}.responsive-view a:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}#TB_window.mobile #TB_iframeContent,#TB_window.tablet #TB_iframeContent{margin-bottom:50px;margin-top:50px}.responsive-view a{color:#666;cursor:pointer;display:inline-block;padding:1em;vertical-align:middle;text-decoration:none}#TB_closeAjaxWindow .tb-close-icon{position:relative}.site-loading{display:none;position:absolute;right:50%;top:50%;text-align:center;color:#555;-webkit-transform:translate(50%,-40%);-ms-transform:translate(50%,-40%);transform:translate(50%,-40%)}.top .site-loading{top:50%;-webkit-transform:translate(50%,-50%);-ms-transform:translate(50%,-50%);transform:translate(50%,-50%)}.site-loading h3{font-size:33px;font-weight:600;margin:0 0 .8em 0}.site-loading p{margin:0}.cartflows-thickbox-loading .site-loading{display:block}.cartflows-thickbox-loading #TB_iframeContent,.cartflows-thickbox-loading #TB_iframeContent-wrapper{display:none}.wcf-remote-list:after,.wcf-remote-list:before{content:"";display:table}.wcf-remote-list::after{content:"";display:table;clear:both}.wcf-template-header .filter-count{line-height:normal}#wcf-page-builders{display:none}#wcf-remote-flow-filters>div,#wcf-remote-step-filters>div{display:inline-block}.wcf-template-header .filter-links{margin:0;padding:0}.wcf-template-header li:focus{outline:0}.wcf-template-header .filter-links li{margin:0;display:inline-block}.wcf-template-header .filter-links li a:focus,.wcf-template-header .filter-links li a:hove{outline:0;-webkit-box-shadow:none;box-shadow:none}.wcf-template-header .filter-links li .current{color:#000;border-bottom:2px solid #f16334;font-weight:600}.wcf-flow-search-input{border:none;-webkit-box-shadow:none;box-shadow:none;border-bottom:1px solid #eee;line-height:1.8}.wcf-search-form{margin-left:2em;padding-left:0;text-align:left;margin-top:1em;margin-bottom:1em;position:relative}.wcf-template-notice{display:none}#wcf-start-from-scratch{text-align:center}#wcf-start-from-scratch .inner{background:0 0;-webkit-box-shadow:none;box-shadow:none;width:94%;margin:0 auto;float:none;position:absolute;top:40%}#wcf-scratch-steps-categories{display:inline-block}#wcf-scratch-steps-categories select{-webkit-border-radius:0;border-radius:0;height:29px;border:1px solid;border-color:#9e9e9e;border-width:1px;-webkit-box-shadow:none;box-shadow:none;padding:2px;line-height:29px}#wcf-start-from-scratch .description{margin-bottom:2em}#wcf-remote-step-importer .wcf-search-form{display:none}.wcf-search-form .wcf-flow-search-input{border:none;-webkit-box-shadow:none;box-shadow:none;border-bottom:1px solid #eee;line-height:1.8;background:0 0;border-bottom:1px solid #ccc;font-size:1em}.wcf-search-form .wcf-flow-search-input:focus{-webkit-box-shadow:none;box-shadow:none;border-color:#ccc}.cartflows-preview-flow-steps li{display:inline-block;margin:0 1em;position:relative}.cartflows-flow-import-blank.updating-message:before{vertical-align:text-bottom}#wpwrap .cartflows-step-loading h2,#wpwrap .template-message-block h2{font-size:1.5em;margin:0 0 .5em 0;padding:8px 12px;line-height:1.4}#wpwrap .cartflows-step-loading p,#wpwrap .template-message-block p{font-size:1.2em}#wpwrap .cartflows-step-loading .spinner{vertical-align:initial}.wcf-flow-type{position:absolute;left:0;top:0;padding:3px 10px;color:#fff}.wcf-flow-type.pro{background:#f06262}.wcf-templates-popup-overlay{position:fixed;height:100%;width:100%;top:0;right:0;background:rgba(0,0,0,.7);-webkit-transition:opacity .5s;transition:opacity .5s;visibility:hidden;opacity:0;z-index:9999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:none;transition:none}.wcf-templates-popup-overlay.open{visibility:visible;opacity:1;z-index:9999}.wcf-templates-popup-content{max-width:1200px;background-color:#fff;position:absolute;-webkit-border-radius:3px;border-radius:3px;top:40%;right:50%;-webkit-transform:translate(50%,-35%);-ms-transform:translate(50%,-35%);transform:translate(50%,-35%);width:70%;min-height:450px;overflow:hidden}.wcf-templates-popup-content .inner{background:#fff;position:relative;padding:8px 8px 0 8px;display:block;float:right;margin:15px;text-align:center;-webkit-box-shadow:0 0 5px 1px rgba(204,204,204,.3);box-shadow:0 0 5px 1px rgba(204,204,204,.3)}@media only screen and (max-width:480px){.wcf-templates-popup-content{width:90%}.wcf-template-header{display:block!important;padding:15px 15px 0 15px!important}.wcf-popup-close-wrap{position:absolute;top:10px;left:5px}}@media only screen and (min-width:768px){.wcf-templates-popup-content .inner{width:-webkit-calc(25% - 30px);width:calc(25% - 30px)}}html.wcf-popup-open{overflow:hidden}.wcf-button-wrap{margin-top:0;position:absolute;top:10px;right:110px}.wcf-steps-loading #wcf-remote-step-list{display:none!important}#wcf-remote-content{background-color:#f5f5f5;overflow-y:auto;min-height:450px;max-height:450px;padding:20px 20px 20px 20px;clear:both}#wcf-remote-content #wcf-start-from-scratch h1{font-size:23px;font-weight:400;margin:0 0 1em 0;padding:9px 0 4px;line-height:29px}.wcf-template-list-wrap .template-name{margin:0;text-align:right;font-size:13px}.wcf-template-list-wrap img{width:100%;vertical-align:middle}.wcf-templates-popup-content .template{margin:0;position:relative;overflow:hidden}.wcf-tab.nav-tabs{overflow:hidden;margin:0}.wcf-template-header{-moz-box-align:center;align-items:center;background:#fff;-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);box-shadow:0 0 8px rgba(0,0,0,.2);-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;-moz-box-pack:justify;justify-content:space-between;padding:0 15px;min-height:50px}.wcf-search-form:after{content:"\f179";display:inline-block;font-family:dashicons;text-decoration:inherit;font-weight:400;font-style:normal;text-align:center;-webkit-transition:color .1s ease-in 0;transition:color .1s ease-in 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;left:.5em;top:.5em;color:#81868a}.wcf-template-logo-wrap{font-size:16px;font-weight:600;text-align:center}.wcf-template-logo-wrap .wcf-cartflows-logo-img{vertical-align:middle}.wcf-tab.nav-tabs:before{display:table;content:""}.wcf-tab.nav-tabs:after{clear:both}.wcf-tab.nav-tabs>li{display:inline-block;padding:15px 0;margin:0;font-weight:400}.wcf-tab.nav-tabs>li.active{border-bottom:3px solid #f16334;font-weight:600}.wcf-template-header .filter-links li>a{border-color:transparent;margin:0}.wcf-tab.nav-tabs>li:active,.wcf-tab.nav-tabs>li:focus,.wcf-tab.nav-tabs>li>a:focus,.wcf-template-header .filter-links>li:active,.wcf-template-header .filter-links>li:focus .wcf-template-header .filter-links>li:active,.wcf-template-header .filter-links>li>a:focus,.wcf-template-header .filter-links>li>a:hover{outline:0;-webkit-box-shadow:none;box-shadow:none}.wcf-tab.nav-tabs>li>a,.wcf-template-header .filter-links>li>a,.wcf-template-header .filter-links>li>a:focus,.wcf-template-header .filter-links>li>a:hover{padding:15px;color:#555;text-decoration:none}.wcf-nav-section-content{display:none}.wcf-nav-section-content.active{display:block;overflow:hidden}.wcf-popup-close-wrap{width:35px;text-align:center;border-right:1px #eee solid}.wcf-popup-close-wrap .close-icon{cursor:pointer}.wcf-popup-close-wrap .wcf-cartflow-icons{pointer-events:none;font-size:20px;height:20px;width:20px;line-height:20px;opacity:.7}.wcf-popup-close-wrap .close-icon:hover .wcf-cartflow-icons{opacity:1}.wcf-templates-popup-content .spinner{position:absolute;top:50%;right:50%;bottom:0;left:0;max-width:100%;max-height:100%;-webkit-transform:translate(50%,-50%);-ms-transform:translate(50%,-50%);transform:translate(50%,-50%);z-index:99999}.wcf-templates-popup-content .wcf-template-header .wcf-tab-wrapper{margin:0 auto}#wcf-upcoming-page-builders .description{font-size:1rem;margin:4em 0 0 0;text-align:center}.flow-type-filter-links{display:none}#wcf-remote-filters{padding:0 15px}#wcf-remote-filters a{text-decoration:none}#wcf-remote-filters .filter-links li:focus,#wcf-remote-filters a:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}#wcf-remote-filters .filter-links li a{border-bottom:none}#wcf-remote-filters .filter-links li:first-child a{margin-right:0}#wcf-remote-filters .filter-links li:last-child a{margin-left:0}#wcf-remote-filters .filter-links li .current,#wcf-remote-filters .filter-links li a:focus,#wcf-remote-filters .filter-links li a:hover{color:#f16334}.wrap .wcf-page-builder-notice .notice{margin:5px 15px}#wcf-api-notice-block{text-align:center;margin-top:5em}.wcf-templates-popup-overlay a{-webkit-transition:none;transition:none}.wcf-notice-wrap .notice{display:inline-block}.wcf-learn-how i{font-size:1rem;vertical-align:middle}.wcf-learn-how a{text-decoration:none}#wcf-remote-content .wcf-install-plugin::focus{border-color:none;-webkit-box-shadow:none;box-shadow:none}#wcf-remote-content .wcf-install-plugin.updating-message{background:0 0;padding:0;font-size:1rem;-webkit-box-shadow:none;box-shadow:none;border:none;margin:0 3px 0 0}.wcf-page-builder-message{margin:5em auto 0 auto;width:700px}.wcf-page-builder-message p{font-size:1rem}.wcf-page-builder-message i{font-size:1rem;vertical-align:middle}.wcf-page-builder-message a{text-decoration:none;margin:1.5em 0 0 0}.cartflows-ie .postbox{padding:1em}.cartflows-ie{padding-top:2em;padding-left:2em}.admin_page_flow_exporter .notice,.admin_page_flow_importer .notice{margin:1em 0 0 0}.cartflows-website-unreachable{padding:1em 2em}
assets/min-css/import.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .no-elementor-notice{border-left:none;background:0 0;border:none;-webkit-box-shadow:none;box-shadow:none;padding-left:0}.no-elementor-notice span{color:#f16334;font-size:18px;vertical-align:middle}.site-preview{background:#c5c5c5;display:block;overflow:hidden;position:relative;-webkit-backface-visibility:hidden}.template.importing .site-preview:after,.template:hover .site-preview:after{opacity:.3}.template.importing .site-preview,.template:hover .site-preview{background:#fff;cursor:pointer}.template .site-preview:after{content:"";background:#fff;opacity:0;top:0;content:"";display:block;top:0;position:absolute;padding-top:66.66666%;-webkit-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out;left:0;right:0;bottom:0}.template .notice{padding:.5em;background:rgba(0,0,0,.7);color:#fff;font-weight:400;border:#ffdead;font-size:11px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;top:50%;-webkit-transform:translateY(-60%);-ms-transform:translateY(-60%);transform:translateY(-60%);right:0;left:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out}#wcf_create_notice{display:none}.preview:focus,.preview:hover{color:#fff;-webkit-box-shadow:none;box-shadow:none}.preview{text-decoration:none;opacity:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);right:22%;left:22%;z-index:4;background:#23282d;background:rgba(0,0,0,.7);color:#fff;font-size:13px;text-shadow:0 1px 0 rgba(0,0,0,.6);-webkit-font-smoothing:antialiased;font-weight:600;padding:10px 12px;text-align:center;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out}.template-id-container{font-size:15px;font-weight:600;margin:0;padding:10px;-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,.1);box-shadow:inset 0 1px 0 rgba(0,0,0,.1);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;background:#fff;background:rgba(255,255,255,.65);position:relative}.template-actions{opacity:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;position:absolute;bottom:0;right:0;top:0;padding:5px 5px 0 5px;background:rgba(244,244,244,.7);border-left:1px solid rgba(0,0,0,.05)}.template.importing .preview,.template.importing .template-actions,.template:hover .preview,.template:hover .template-actions,.wcf-step-content .template-actions{opacity:1}.wcf-remote-list .template{position:relative;overflow:hidden}.wcf-remote-list h3{margin-bottom:1em;margin-top:0;font-size:15px;font-weight:600;margin:0;padding:0;text-align:left}.wcf-remote-list img{max-width:100%;vertical-align:middle}.wcf-remote-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#cartflows-steps-list img{width:100%}#cartflows-steps-list .title{font-weight:700;color:#474747;line-height:2;background:#f7f7f7;padding:.5em 1em}#cartflows-steps-list .image-wrap{-webkit-background-size:cover;background-size:cover;overflow:hidden}#cartflows-steps .close{display:inline-block;padding:2em;cursor:pointer}.template-message-block{text-align:center;margin:0 auto;padding:4em 0}.templator #TB_ajaxContent{width:100%!important}.template-message-block .description{font-style:normal}.template-message-block .spinner{float:none;margin:0}.cartflows-steps-popup{position:fixed;left:0;right:0;top:0;bottom:0;z-index:99999;background:#fff;overflow-y:scroll}.cartflows-steps-popup .notice{max-width:700px;margin:0 auto}.cartflows-load-steps-library .dashicons{height:auto;width:auto;line-height:normal;margin:0 5px 0 0;vertical-align:initial;font-size:100%}.cartflows-load-steps .dashicons{vertical-align:text-bottom}#TB_window{width:100%!important;margin:0 auto!important;text-align:center!important;position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important}#TB_iframeContent{width:100%!important;height:100%!important}@media only screen and (min-device-width :320px) and (max-device-width :1024px){#TB_iframeContent-wrapper{position:fixed;right:0;bottom:50px;left:0;top:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}}#TB_window #TB_ajaxWindowTitle{font-size:1.2rem;display:inline-block;width:auto;padding:0}#TB_window #TB_closeWindowButton{position:relative}.tb-close-icon:before{vertical-align:middle}#TB_window{text-align:center}#TB_iframeContent.tablet{width:768px!important;height:1024px!important;background:#111;padding:40px 10px 70px;-webkit-border-radius:30px;border-radius:30px}#TB_iframeContent.tablet.landscape{width:1024px!important}#TB_iframeContent.mobile{width:360px!important;height:640px!important;background:#111;padding:40px 10px 70px;-webkit-border-radius:30px;border-radius:30px}#TB_iframeContent.mobile.landscape{width:360px!important}#TB_closeAjaxWindow{float:right}#TB_window.thickbox-loading{margin:0!important}div#TB_window{background-color:#fff}#TB_window #TB_title{color:#0a0c0d;text-align:left;bottom:0;-webkit-box-shadow:none;box-shadow:none;-webkit-box-pack:justify;-webkit-justify-content:space-between;-moz-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;padding:1em 1em 1em 1.5em}@media all and (min-width:769px){#TB_window #TB_title{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}}#TB_window.mobile,#TB_window.tablet{overflow-y:scroll}.top #TB_iframeContent-wrapper{bottom:0;top:80px}#TB_window.top #TB_title{top:0}#TB_window #TB_closeWindowButton:focus .tb-close-icon{-webkit-box-shadow:none;box-shadow:none;color:#666}@media all and (max-width:768px){#TB_closeAjaxWindow{padding-right:0}#TB_window #TB_closeWindowButton,#TB_window .tb-close-icon{width:80px}}.responsive-view .dashicons{color:#ddd}.responsive-view .active{color:#111}.responsive-view a:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}#TB_window.mobile #TB_iframeContent,#TB_window.tablet #TB_iframeContent{margin-bottom:50px;margin-top:50px}.responsive-view a{color:#666;cursor:pointer;display:inline-block;padding:1em;vertical-align:middle;text-decoration:none}#TB_closeAjaxWindow .tb-close-icon{position:relative}.site-loading{display:none;position:absolute;left:50%;top:50%;text-align:center;color:#555;-webkit-transform:translate(-50%,-40%);-ms-transform:translate(-50%,-40%);transform:translate(-50%,-40%)}.top .site-loading{top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.site-loading h3{font-size:33px;font-weight:600;margin:0 0 .8em 0}.site-loading p{margin:0}.cartflows-thickbox-loading .site-loading{display:block}.cartflows-thickbox-loading #TB_iframeContent,.cartflows-thickbox-loading #TB_iframeContent-wrapper{display:none}.wcf-remote-list:after,.wcf-remote-list:before{content:"";display:table}.wcf-remote-list::after{content:"";display:table;clear:both}.wcf-template-header .filter-count{line-height:normal}#wcf-page-builders{display:none}#wcf-remote-flow-filters>div,#wcf-remote-step-filters>div{display:inline-block}.wcf-template-header .filter-links{margin:0;padding:0}.wcf-template-header li:focus{outline:0}.wcf-template-header .filter-links li{margin:0;display:inline-block}.wcf-template-header .filter-links li a:focus,.wcf-template-header .filter-links li a:hove{outline:0;-webkit-box-shadow:none;box-shadow:none}.wcf-template-header .filter-links li .current{color:#000;border-bottom:2px solid #f16334;font-weight:600}.wcf-flow-search-input{border:none;-webkit-box-shadow:none;box-shadow:none;border-bottom:1px solid #eee;line-height:1.8}.wcf-search-form{margin-right:2em;padding-right:0;text-align:right;margin-top:1em;margin-bottom:1em;position:relative}.wcf-template-notice{display:none}#wcf-start-from-scratch{text-align:center}#wcf-start-from-scratch .inner{background:0 0;-webkit-box-shadow:none;box-shadow:none;width:94%;margin:0 auto;float:none;position:absolute;top:40%}#wcf-scratch-steps-categories{display:inline-block}#wcf-scratch-steps-categories select{-webkit-border-radius:0;border-radius:0;height:29px;border:1px solid;border-color:#9e9e9e;border-width:1px;-webkit-box-shadow:none;box-shadow:none;padding:2px;line-height:29px}#wcf-start-from-scratch .description{margin-bottom:2em}#wcf-remote-step-importer .wcf-search-form{display:none}.wcf-search-form .wcf-flow-search-input{border:none;-webkit-box-shadow:none;box-shadow:none;border-bottom:1px solid #eee;line-height:1.8;background:0 0;border-bottom:1px solid #ccc;font-size:1em}.wcf-search-form .wcf-flow-search-input:focus{-webkit-box-shadow:none;box-shadow:none;border-color:#ccc}.cartflows-preview-flow-steps li{display:inline-block;margin:0 1em;position:relative}.cartflows-flow-import-blank.updating-message:before{vertical-align:text-bottom}#wpwrap .cartflows-step-loading h2,#wpwrap .template-message-block h2{font-size:1.5em;margin:0 0 .5em 0;padding:8px 12px;line-height:1.4}#wpwrap .cartflows-step-loading p,#wpwrap .template-message-block p{font-size:1.2em}#wpwrap .cartflows-step-loading .spinner{vertical-align:initial}.wcf-flow-type{position:absolute;right:0;top:0;padding:3px 10px;color:#fff}.wcf-flow-type.pro{background:#f06262}.wcf-templates-popup-overlay{position:fixed;height:100%;width:100%;top:0;left:0;background:rgba(0,0,0,.7);-webkit-transition:opacity .5s;transition:opacity .5s;visibility:hidden;opacity:0;z-index:9999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:none;transition:none}.wcf-templates-popup-overlay.open{visibility:visible;opacity:1;z-index:9999}.wcf-templates-popup-content{max-width:1200px;background-color:#fff;position:absolute;-webkit-border-radius:3px;border-radius:3px;top:40%;left:50%;-webkit-transform:translate(-50%,-35%);-ms-transform:translate(-50%,-35%);transform:translate(-50%,-35%);width:70%;min-height:450px;overflow:hidden}.wcf-templates-popup-content .inner{background:#fff;position:relative;padding:8px 8px 0 8px;display:block;float:left;margin:15px;text-align:center;-webkit-box-shadow:0 0 5px 1px rgba(204,204,204,.3);box-shadow:0 0 5px 1px rgba(204,204,204,.3)}@media only screen and (max-width:480px){.wcf-templates-popup-content{width:90%}.wcf-template-header{display:block!important;padding:15px 15px 0 15px!important}.wcf-popup-close-wrap{position:absolute;top:10px;right:5px}}@media only screen and (min-width:768px){.wcf-templates-popup-content .inner{width:-webkit-calc(25% - 30px);width:calc(25% - 30px)}}html.wcf-popup-open{overflow:hidden}.wcf-button-wrap{margin-top:0;position:absolute;top:10px;left:110px}.wcf-steps-loading #wcf-remote-step-list{display:none!important}#wcf-remote-content{background-color:#f5f5f5;overflow-y:auto;min-height:450px;max-height:450px;padding:20px 20px 20px 20px;clear:both}#wcf-remote-content #wcf-start-from-scratch h1{font-size:23px;font-weight:400;margin:0 0 1em 0;padding:9px 0 4px;line-height:29px}.wcf-template-list-wrap .template-name{margin:0;text-align:left;font-size:13px}.wcf-template-list-wrap img{width:100%;vertical-align:middle}.wcf-templates-popup-content .template{margin:0;position:relative;overflow:hidden}.wcf-tab.nav-tabs{overflow:hidden;margin:0}.wcf-template-header{-moz-box-align:center;align-items:center;background:#fff;-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);box-shadow:0 0 8px rgba(0,0,0,.2);-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;-moz-box-pack:justify;justify-content:space-between;padding:0 15px;min-height:50px}.wcf-search-form:after{content:"\f179";display:inline-block;font-family:dashicons;text-decoration:inherit;font-weight:400;font-style:normal;text-align:center;-webkit-transition:color .1s ease-in 0;transition:color .1s ease-in 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;right:.5em;top:.5em;color:#81868a}.wcf-template-logo-wrap{font-size:16px;font-weight:600;text-align:center}.wcf-template-logo-wrap .wcf-cartflows-logo-img{vertical-align:middle}.wcf-tab.nav-tabs:before{display:table;content:""}.wcf-tab.nav-tabs:after{clear:both}.wcf-tab.nav-tabs>li{display:inline-block;padding:15px 0;margin:0;font-weight:400}.wcf-tab.nav-tabs>li.active{border-bottom:3px solid #f16334;font-weight:600}.wcf-template-header .filter-links li>a{border-color:transparent;margin:0}.wcf-tab.nav-tabs>li:active,.wcf-tab.nav-tabs>li:focus,.wcf-tab.nav-tabs>li>a:focus,.wcf-template-header .filter-links>li:active,.wcf-template-header .filter-links>li:focus .wcf-template-header .filter-links>li:active,.wcf-template-header .filter-links>li>a:focus,.wcf-template-header .filter-links>li>a:hover{outline:0;-webkit-box-shadow:none;box-shadow:none}.wcf-tab.nav-tabs>li>a,.wcf-template-header .filter-links>li>a,.wcf-template-header .filter-links>li>a:focus,.wcf-template-header .filter-links>li>a:hover{padding:15px;color:#555;text-decoration:none}.wcf-nav-section-content{display:none}.wcf-nav-section-content.active{display:block;overflow:hidden}.wcf-popup-close-wrap{width:35px;text-align:center;border-left:1px #eee solid}.wcf-popup-close-wrap .close-icon{cursor:pointer}.wcf-popup-close-wrap .wcf-cartflow-icons{pointer-events:none;font-size:20px;height:20px;width:20px;line-height:20px;opacity:.7}.wcf-popup-close-wrap .close-icon:hover .wcf-cartflow-icons{opacity:1}.wcf-templates-popup-content .spinner{position:absolute;top:50%;left:50%;bottom:0;right:0;max-width:100%;max-height:100%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%);z-index:99999}.wcf-templates-popup-content .wcf-template-header .wcf-tab-wrapper{margin:0 auto}#wcf-upcoming-page-builders .description{font-size:1rem;margin:4em 0 0 0;text-align:center}.flow-type-filter-links{display:none}#wcf-remote-filters{padding:0 15px}#wcf-remote-filters a{text-decoration:none}#wcf-remote-filters .filter-links li:focus,#wcf-remote-filters a:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}#wcf-remote-filters .filter-links li a{border-bottom:none}#wcf-remote-filters .filter-links li:first-child a{margin-left:0}#wcf-remote-filters .filter-links li:last-child a{margin-right:0}#wcf-remote-filters .filter-links li .current,#wcf-remote-filters .filter-links li a:focus,#wcf-remote-filters .filter-links li a:hover{color:#f16334}.wrap .wcf-page-builder-notice .notice{margin:5px 15px}#wcf-api-notice-block{text-align:center;margin-top:5em}.wcf-templates-popup-overlay a{-webkit-transition:none;transition:none}.wcf-notice-wrap .notice{display:inline-block}.wcf-learn-how i{font-size:1rem;vertical-align:middle}.wcf-learn-how a{text-decoration:none}#wcf-remote-content .wcf-install-plugin::focus{border-color:none;-webkit-box-shadow:none;box-shadow:none}#wcf-remote-content .wcf-install-plugin.updating-message{background:0 0;padding:0;font-size:1rem;-webkit-box-shadow:none;box-shadow:none;border:none;margin:0 0 0 3px}.wcf-page-builder-message{margin:5em auto 0 auto;width:700px}.wcf-page-builder-message p{font-size:1rem}.wcf-page-builder-message i{font-size:1rem;vertical-align:middle}.wcf-page-builder-message a{text-decoration:none;margin:1.5em 0 0 0}.cartflows-ie .postbox{padding:1em}.cartflows-ie{padding-top:2em;padding-right:2em}.admin_page_flow_exporter .notice,.admin_page_flow_importer .notice{margin:1em 0 0 0}.cartflows-website-unreachable{padding:1em 2em}
assets/min-js/checkout-template.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(r){function o(){if("yes"==cartflows.allow_persistance&&!1!==function(){var e="test";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}()){var e="form.woocommerce-checkout #customer_details",o=function(){var e=[],o=r("form.woocommerce-checkout #customer_details");localStorage.removeItem("cartflows_checkout_form"),o.find("input[type=text], select, input[type=email], input[type=tel]").each(function(){e.push({name:this.name,value:this.value})}),cartflows_checkout_form=JSON.stringify(e),localStorage.setItem("cartflows_checkout_form",cartflows_checkout_form)};(function(){if(null!=localStorage.getItem("cartflows_checkout_form")){checkout_data=JSON.parse(localStorage.getItem("cartflows_checkout_form"));for(var e=0;e<checkout_data.length;e++)r("form.woocommerce-checkout [name="+checkout_data[e].name+"]").val(checkout_data[e].value)}})(),r(e+" input, "+e+" select").change(function(){o()})}}r(window).load(function(){r("body").trigger("update_checkout")});var c={init:function(){r(document.body).on("click",".wcf-submit-coupon",this.submit_coupon),r(document.body).on("click",".wcf-remove-coupon",this.remove_coupon)},submit_coupon:function(e){e.preventDefault();var o=r(".wcf-custom-coupon-field").find(".wcf-coupon-code-input"),c=o.val();if(""==c)return o.addClass("field-required"),!1;o.removeClass("field-required");var t={coupon_code:c,action:"wcf_woo_apply_coupon",security:cartflows.wcf_validate_coupon_nonce};r.ajax({type:"POST",url:cartflows.ajax_url,data:t,success:function(e){var o=r(".wcf-custom-coupon-field");o.find(".woocommerce-error, .woocommerce-message").remove();var c=JSON.parse(e);1==c.status&&r(document.body).trigger("update_checkout",{update_shipping_method:!1}),o.prepend(c.msg)}})},remove_coupon:function(e){e.preventDefault();var o={coupon_code:r(this).attr("data-coupon"),action:"wcf_woo_remove_coupon",security:cartflows.wcf_validate_remove_coupon_nonce};r.ajax({type:"POST",url:cartflows.ajax_url,data:o,success:function(e){var o=r(".wcf-custom-coupon-field");o.find(".woocommerce-error, .woocommerce-message").hide(),e&&(r(document.body).trigger("update_checkout",{update_shipping_method:!1}),o.prepend(e))}})}};r(document).ready(function(e){o(),function(){function t(e,o,c){""==e?o.hasClass("validate-required")&&c.addClass("field-required"):c.removeClass("field-required")}var e=r("form.woocommerce-checkout #customer_details"),o=e.find("input, textarea"),c=e.find(".select2-selection");o.blur(function(){var e=r(this),o=e.closest("p.form-row"),c=e.val();t(c,o,e)}),c.blur(function(){var e=r(this).closest("p.form-row"),o=e.find(".select2-container--default"),c=e.find("select").val();t(c,e,o)})}(),function(){r(".cartflows-container").find(".wcf-embed-checkout-form-two-column");var e=r(".wcf-embed-checkout-form .woocommerce-checkout").find("#billing_address_1_field"),o=r(".wcf-embed-checkout-form .woocommerce-checkout").find("#billing_address_2_field");e.hasClass("form-row-wide")&&(e.removeClass("form-row-wide"),e.addClass("form-row-first")),o.hasClass("form-row-wide")&&(o.removeClass("form-row-wide"),o.addClass("form-row-last"),o.find("label").hasClass("screen-reader-text")?o.addClass("mt20"):o.removeClass("mt20"));var c=r(".wcf-embed-checkout-form .woocommerce-checkout").find("#shipping_address_1_field"),t=r(".wcf-embed-checkout-form .woocommerce-checkout").find("#shipping_address_2_field");c.hasClass("form-row-wide")&&(c.removeClass("form-row-wide"),c.addClass("form-row-first")),t.hasClass("form-row-wide")&&(t.removeClass("form-row-wide"),t.addClass("form-row-last"),t.find("label").hasClass("screen-reader-text")?t.addClass("mt20"):t.removeClass("mt20")),r(".wcf-embed-checkout-form .woocommerce-checkout").find("#billing_country").on("change",function(e){}),r(".wcf-embed-checkout-form .woocommerce-checkout").find("#shipping_country").on("change",function(e){})}(),c.init()})}(jQuery);
assets/min-js/frontend.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){e(document).ready(function(e){!function(){if("OceanWP"==cartflows.current_theme){var e=document.getElementById("oceanwp-style-css");null!=e&&e.remove()}}(),e(document).on("click",'a[href*="wcf-next-step"]',function(e){if(e.preventDefault(),void 0===cartflows.is_pb_preview||"1"!=cartflows.is_pb_preview)return window.location.href=cartflows.next_step,!1;e.stopPropagation()})})}(jQuery);
assets/min-js/import.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var CartFlowsAjaxQueue=function(){var s=[];return{add:function(t){s.push(t)},remove:function(t){-1<jQuery.inArray(t,s)&&s.splice($.inArray(t,s),1)},run:function(){var t,e=this;s.length?(t=s[0].complete,s[0].complete=function(){"function"==typeof t&&t(),s.shift(),e.run.apply(e,[])},jQuery.ajax(s[0])):e.tid=setTimeout(function(){e.run.apply(e,[])},1e3)},stop:function(){s=[],clearTimeout(this.tid)}}}();!function(c){CartFlowsImport={doc:c(document),wrap:c(".wcf-flow-steps-data-wrap"),inner:c(".wcf-flow-steps-data-wrap-importer"),post_id:c("#post_ID").val(),_ref:null,_api_step_type:{},_api_params:{},all_steps:0,remaining_steps:0,remaining_install_plugins:0,remaining_active_plugins:0,init:function(){if(this._bind(),"other"!==CartFlowsImportVars.default_page_builder&&(c(".post-type-cartflows_flow").hasClass("edit-php")&&this._process_cache_remote_flows(),c(".post-type-cartflows_flow").hasClass("post-php")&&this._process_cache_remote_steps()),c(".post-type-cartflows_flow").hasClass("edit-php")&&null!==this._getParamFromURL("add-new-flow")&&this._render_remote_flows(),c(".post-type-cartflows_flow").hasClass("post-php")&&null!==this._getParamFromURL("add-new-step")&&this._render_remote_steps(),this._getParamFromURL("highlight-step-id")){var t=c('.wcf-step-wrap[data-id="'+this._getParamFromURL("highlight-step-id")+'"]');t.length&&c("html, body").animate({scrollTop:t.offset().top},1500)}if(c(".post-type-cartflows_flow").hasClass("edit-php")){var e=c(".edit-php.post-type-cartflows_flow").find(".page-title-action:first");e.after('<a href="'+CartFlowsImportVars.export_url+'" class="page-title-action">Export</a>'),e.after('<a href="'+CartFlowsImportVars.import_url+'" class="page-title-action">Import</a>')}},_getParamFromURL:function(t,e){e||(e=window.location.href),t=t.replace(/[\[\]]/g,"\\$&");var s=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return s?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null},_bind:function(){var t=CartFlowsImport;t.doc.on("click",".wcf-install-plugin",t._install_plugin),t.doc.on("cartflows-api-request-fail",t._api_request_failed),t.doc.on("click","#wcf-get-started-steps a, .wcf-create-from-scratch-link",t._toggle_ready_templates),t.doc.on("click",".cartflows-flow-import-blank",t._create_default_flow),t.doc.on("click","#wcf-remote-flow-importer .wcf-page-builder-links a",t._filterFlowPageBuilderClick),t.doc.on("click","#wcf-remote-step-importer #wcf-categories .step-type-filter-links a",t._filterBlankStepCategoryClick),t.doc.on("change","#wcf-remote-step-importer #wcf-scratch-steps-categories .step-type-filter-links",t._filterBlankStepCategoryChange),t.doc.on("click","#wcf-remote-step-importer .wcf-page-builder-links a",t._filterStepPageBuilderClick),t.doc.on("click",".cartflows-step-import-blank:not(.get-pro)",t._create_blank_step),t.doc.on("click","#wcf-remote-step-importer .cartflows-step-import",t._process_import_step),t.doc.on("click","#wcf-remote-flow-importer .cartflows-step-import",t._process_import_flow),t.doc.on("click",".cartflows-preview-flow-step",t._preview_individual),t.doc.on("add_template_to_page-fail",t._add_template_to_page_fail),c("body").on("thickbox:iframe:loaded",t._previewLoaded),c(document).on("keyup input","#wcf-remote-step-importer .wcf-flow-search-input",t._remote_step_search),c(document).on("click",".actions a",t._previewResponsive),c(document).on("click",".page-title-action:first",t._render_remote_flows),c(document).on("click",".wcf-trigger-popup",t._render_remote_steps),c(document).on("click",".wcf-templates-popup-overlay",t._close_template_popup),c(document).on("click",".wcf-popup-close-wrap .close-icon",t._close_template_popup),c(document).on("wp-plugin-install-success",t._installSuccess)},_install_plugin:function(t){t.preventDefault();var e=c(this);if(!e.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process"),c("#wcf-remote-step-importer").addClass("request-process"),e.addClass("updating-message button");var s=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(s,function(t,e){"install"===e.status&&CartFlowsImport.remaining_install_plugins++,"activate"===e.status&&CartFlowsImport.remaining_active_plugins++}),CartFlowsImport.remaining_install_plugins?CartFlowsImport._install_all_plugins():CartFlowsImport.remaining_active_plugins?CartFlowsImport._activate_all_plugins():c("#wcf-remote-flow-importer").length?CartFlowsImport._cache_remote_flows():c("#wcf-remote-step-importer").length&&CartFlowsImport._cache_remote_steps()}},_install_all_plugins:function(){var t=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(t,function(t,e){"install"===e.status&&wp.updates.queue.push({action:"install-plugin",data:{slug:e.slug}})}),wp.updates.queueChecker()},_activate_all_plugins:function(){if(CartFlowsImport.remaining_active_plugins||CartFlowsImport.remaining_install_plugins){var t=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;CartFlowsAjaxQueue.stop(),CartFlowsAjaxQueue.run(),c.each(t,function(t,e){"activate"===e.status&&CartFlowsAjaxQueue.add({url:CartFlowsImportVars.ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:e.init},success:function(t){CartFlowsImport.remaining_active_plugins--,CartFlowsImport.remaining_active_plugins||CartFlowsImport.remaining_install_plugins||(c("#wcf-remote-flow-importer").length?CartFlowsImport._cache_remote_flows():c("#wcf-remote-step-importer").length&&CartFlowsImport._cache_remote_steps())}})})}else c("#wcf-remote-flow-importer").length?CartFlowsImport._cache_remote_flows():c("#wcf-remote-step-importer").length&&CartFlowsImport._cache_remote_steps()},_installSuccess:function(t,s){t.preventDefault();var e=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(e,function(t,e){"install"===e.status&&s.slug===e.slug&&c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:e.init}}).done(function(t,e,s){CartFlowsImport.remaining_install_plugins--,CartFlowsImport.remaining_install_plugins||CartFlowsImport._activate_all_plugins()})})},_api_request_failed:function(t,e,s,a){"error"==a&&(c("#wcf-remote-content-failed").length||c("#wcf-ready-templates").html(wp.template("cartflows-website-unreachable")))},_toggle_ready_templates:function(t){t.preventDefault();var e=c(this).data("slug")||"";c("#wcf-get-started-steps").find("a").removeClass("current"),c("#wcf-get-started-steps").find('a[data-slug="'+e+'"]').addClass("current"),"canvas"==e?(c("#wcf-ready-templates").hide(),c("#wcf-start-from-scratch").show()):(c("#wcf-ready-templates").show(),c("#wcf-start-from-scratch").hide()),!c(".wcf-page-builder-notice").length&&c("#wcf-remote-step-importer").length&&CartFlowsImport._showSteps()},_switch_step_tab:function(t){t.preventDefault();var e=c(".wcf-tab > li.active > a").attr("href");c(".wcf-tab > li.active").removeClass("active"),c(this).parents("li").addClass("active"),c(e).removeClass("active"),c(e).addClass("hide");var s=c(this).attr("href");c(s).removeClass("hide"),c(s).addClass("active")},_remote_step_search:function(t){t.preventDefault(),c(".step-type-filter-links").find("option").removeClass("current"),c(".step-type-filter-links").find("option:first-child").addClass("current"),window.clearTimeout(CartFlowsImport._ref),CartFlowsImport._ref=window.setTimeout(function(){CartFlowsImport._ref=null,CartFlowsImport._showSteps()},500)},_previewResponsive:function(t){t.preventDefault();var e=c(this).find(".dashicons"),s=e.attr("data-view")||"";c("#TB_window").removeClass("desktop tablet mobile"),c("#TB_window").addClass(s),c(".actions .dashicons").removeClass("active"),e.addClass("active"),c("#TB_iframeContent").removeClass(),c("#TB_iframeContent").addClass(s)},_filterStepPageBuilderClick:function(t){t.preventDefault(),c(this).parents("ul").find("a").removeClass("current"),c(this).addClass("current");var e=c(".step-type-filter-links .current").data("slug")||"";"upsell"===e||"downsell"===e?c(".wcf-template-notice").show():c(".wcf-template-notice").hide(),c(".wcf-page-builder-notice").html(""),c("#wcf-remote-step-list").html('<span class="spinner is-active"></span>'),CartFlowsImport._showSteps()},_filterBlankStepCategoryClick:function(t){t.preventDefault(),c(".wcf-page-builder-notice").html("");var e=c(this).data("group")||"";e&&(c("#wcf-scratch-steps-categories .step-type-filter-links").val(e),c("#wcf-scratch-steps-categories .step-type-filter-links option").removeClass("current"),c('#wcf-scratch-steps-categories .step-type-filter-links option[data-group="'+e+'"]').addClass("current")),c(".step-type-filter-links").find("a").removeClass("current"),c(this).addClass("current"),$step_type=c(this).data("slug"),"upsell"===$step_type||"downsell"===$step_type?c(".wcf-template-notice").show():c(".wcf-template-notice").hide(),""!=CartFlowsImportVars._is_pro_active||"upsell"!=$step_type&&"downsell"!=$step_type?(c(".cartflows-step-import-blank").text("Create Step"),c(".cartflows-step-import-blank").removeClass("get-pro"),c(".cartflows-step-import-blank").removeAttr("target")):(c(".cartflows-step-import-blank").text("Get Pro"),c(".cartflows-step-import-blank").attr("href",CartFlowsImportVars.domain_url),c(".cartflows-step-import-blank").attr("target","_blank"),c(".cartflows-step-import-blank").addClass("get-pro")),c("#wcf-remote-step-list").html('<span class="spinner is-active"></span>'),CartFlowsImport._showSteps()},_filterBlankStepCategoryChange:function(t){t.preventDefault();var e=c(this).find("option:selected").val()||"";e&&(c(".step-type-filter-links").val(e),c(".step-type-filter-links").find("a").removeClass("current"),c(".step-type-filter-links").find('a[data-group="'+e+'"]').addClass("current")),c(".step-type-filter-links").find("option").removeClass("current"),c(".step-type-filter-links").find("option:selected").addClass("current"),$step_type=c(this).find("option:selected").data("slug"),"upsell"===$step_type||"downsell"===$step_type?c(".wcf-template-notice").show():c(".wcf-template-notice").hide(),""!=CartFlowsImportVars._is_pro_active||"upsell"!=$step_type&&"downsell"!=$step_type?(c(".cartflows-step-import-blank").text("Create Step"),c(".cartflows-step-import-blank").removeClass("get-pro"),c(".cartflows-step-import-blank").removeAttr("target")):(c(".cartflows-step-import-blank").text("Get Pro"),c(".cartflows-step-import-blank").attr("href",CartFlowsImportVars.domain_url),c(".cartflows-step-import-blank").attr("target","_blank"),c(".cartflows-step-import-blank").addClass("get-pro")),!c(".wcf-page-builder-notice").length&&c("#wcf-remote-step-importer").length&&(c("#wcf-remote-step-list").html('<span class="spinner is-active"></span>'),CartFlowsImport._showSteps())},_showSteps:function(){var t={licence_args:CartFlowsImportVars.licence_args,per_page:15,_fields:CartFlowsImportVars.step_fields.toString()},e=c("#wcf-categories .step-type-filter-links").find(".current").data("group")||"",s=c("#wcf-categories .step-type-filter-links").find(".current").data("slug");""!==e&&"all"!==e&&(t[CartFlowsImportVars.step_type]=e);e=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("group")||"",s=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("slug")||"";var a=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("title")||"Page Builder";""!==e&&"all"!==e&&(t[CartFlowsImportVars.step_page_builder]=e);var r={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(r,function(t){t.current_step_type=s;var e=wp.template("cartflows-steps-list");parseInt(t.items_count)?c("#wcf-remote-step-list").html(e(t)):(c("#wcf-remote-step-list").html(wp.template("cartflows-no-steps")),c(".cartflows-no-steps").find(".description").html("We are working on ready templates designed with "+a+'.<br/>Meanwhile you can <a href="#" data-slug="canvas" class="wcf-create-from-scratch-link">create your own designs</a> easily.')),c(".wcf-page-builder-notice").remove(),c("#wcf-remote-step-importer").removeClass("request-process")})},_apiAddParam_per_page:function(){CartFlowsImport._api_params.per_page=15},_apiAddParam_licence_args:function(){CartFlowsImport._api_params.licence_args=CartFlowsImportVars.licence_args},_apiAddParam_search:function(){var t=c(".wcf-flow-search-input").val()||"";""!==t&&(CartFlowsImport._api_params.search=t)},_close_popup:function(){c("#cartflows-steps").fadeOut(),c("body").removeClass("cartflows-popup-is-open")},_post_auto_save:function(){var t=c("#title"),e=c("#title-prompt-text"),s=CartFlowsImport;t.val()||(t.val("CartFlows #"+s.post_id),e.length&&e.remove()),wp.autosave&&wp.autosave.server.triggerSave()},_process_cache_remote_flows:function(){if("gutenberg"==CartFlowsImportVars.default_page_builder)CartFlowsImport._cache_remote_flows();else{var t=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins,s=!0;c.each(t,function(t,e){s&&("install"!==e.status&&"activate"!==e.status||(s=!1))}),!1===s?(c(".wcf-page-builder-notice").html(wp.template("cartflows-page-builder-notice")),c("#wcf-remote-flow-list").find(".spinner").remove()):CartFlowsImport._cache_remote_flows()}},_cache_remote_flows:function(){CartFlowsImport;var t={search:CartFlowsImportVars.default_page_builder,licence_args:CartFlowsImportVars.licence_args,hide_empty:!1,_fields:CartFlowsImportVars.flow_page_builder_fields.toString()},e={remote_slug:CartFlowsImportVars.flow_page_builder,slug:CartFlowsImportVars.flow_page_builder+"?"+decodeURIComponent(c.param(t)),wrapper_class:"wcf-page-builder-links filter-links",show_all:!1};CartFlowsAPI._api_request(e,function(t){var e=wp.template("cartflows-term-filters");c("#wcf-page-builders").html(e(t)),c("#wcf-page-builders").find("li:first a").addClass("current");var s={licence_args:CartFlowsImportVars.licence_args,hide_empty:!0,_fields:CartFlowsImportVars.flow_type_fields.toString()},a={remote_slug:CartFlowsImportVars.flow_type,slug:CartFlowsImportVars.flow_type+"?"+decodeURIComponent(c.param(s)),wrapper_class:"flow-type-filter-links filter-links",show_all:!1};CartFlowsAPI._api_request(a,function(t){var e=wp.template("cartflows-term-filters");c("#wcf-categories").html(e(t)),c("#wcf-categories").find("li:first a").addClass("current"),CartFlowsImport._showFlows()})})},_render_remote_flows:function(t){t&&t.preventDefault(),c("#wcf-remote-flow-importer").addClass("open"),c("html").addClass("wcf-popup-open")},_process_cache_remote_steps:function(){if("gutenberg"==CartFlowsImportVars.default_page_builder)CartFlowsImport._cache_remote_steps();else{var t=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins,s=!0;c.each(t,function(t,e){s&&("install"!==e.status&&"activate"!==e.status||(s=!1))}),!1===s?(c(".wcf-page-builder-notice").html(wp.template("cartflows-page-builder-notice")),c("#wcf-remote-step-list").find(".spinner").remove()):CartFlowsImport._cache_remote_steps()}},_cache_remote_steps:function(){CartFlowsImport;c("html").addClass("wcf-steps-loading");var t={search:CartFlowsImportVars.default_page_builder,licence_args:CartFlowsImportVars.licence_args,hide_empty:!1,_fields:CartFlowsImportVars.step_page_builder_fields.toString()},e={remote_slug:CartFlowsImportVars.step_page_builder,slug:CartFlowsImportVars.step_page_builder+"?"+decodeURIComponent(c.param(t)),wrapper_class:"wcf-page-builder-links filter-links",show_all:!1};CartFlowsAPI._api_request(e,function(t){var e=wp.template("cartflows-term-filters");c("#wcf-page-builders").html(e(t)),c("#wcf-page-builders").find("li:first a").addClass("current")});t={licence_args:CartFlowsImportVars.licence_args,_fields:CartFlowsImportVars.step_type_fields.toString()},e={remote_slug:CartFlowsImportVars.step_type,slug:CartFlowsImportVars.step_type+"?"+decodeURIComponent(c.param(t)),wrapper_class:"step-type-filter-links filter-links",show_all:!1};CartFlowsAPI._api_request(e,function(t){var a=t,r=t.items_count;if(t.items)for(key in t.items){var e={licence_args:CartFlowsImportVars.licence_args,per_page:15,_fields:CartFlowsImportVars.step_fields.toString()};e[CartFlowsImportVars.step_type]=t.items[key].id;var s={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(e))};CartFlowsAPI._api_request(s,function(t){var e=wp.template("cartflows-steps-list");if(parseInt(t.items_count)?c("#wcf-remote-step-list").html(e(t)):c("#wcf-remote-step-list").html(wp.template("cartflows-no-steps")),0==--r){var s=wp.template("cartflows-term-filters-dropdown");e=wp.template("cartflows-term-filters");c("#wcf-categories").html(e(a)),c("#wcf-scratch-steps-categories").html(s(a)),c("#wcf-categories, #wcf-scratch-steps-categories").find("option:first").addClass("current"),c("#wcf-categories").find("li:first a").addClass("current"),c(".wcf-page-builder-notice").remove(),c("#wcf-remote-content").find(".spinner").remove(),CartFlowsImport._showSteps(),c("html").removeClass("wcf-steps-loading")}})}})},_render_remote_steps:function(t){t&&t.preventDefault(),c("#wcf-remote-step-importer").addClass("open"),c("html").addClass("wcf-popup-open")},_categorize_data:function(t){var a=[];return c.each(t,function(t,e){var s=e.step_type.slug;void 0===a[s]&&(a[s]=[]),a[s].push(e)}),a},_close_template_popup:function(t){(c(t.target).hasClass("wcf-templates-popup-overlay")||c(t.target).hasClass("close-icon"))&&(c(".wcf-templates-popup-overlay").hasClass("request-process")||(c("html").removeClass("wcf-popup-open"),c(".wcf-templates-popup-overlay").removeClass("open")))},_ajax:function(t,a,r){var o=CartFlowsImport;c.ajax({url:ajaxurl,type:"POST",data:t}).done(function(t,e,s){a&&"function"==typeof a&&a({request:t,status:e,XHR:s}),o.doc.trigger(r+"-done",[t,e,s])}).fail(function(t,e){o.doc.trigger(r+"-fail",[t,e])}).always(function(){o.doc.trigger(r+"-always")})},_load_templates:function(t,a){var r=CartFlowsImport;c("body").hasClass("processing")||(c("body").addClass("processing"),c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_load_steps",security:cartflows_admin.cf_load_steps_nonce,args:t}}).done(function(t,e,s){r.doc.trigger(a,[t]),c("body").removeClass("processing")}).fail(function(t,e){}).always(function(){}))},_empty:function(t){if("number"==typeof t||"boolean"==typeof t)return!1;if(null==t)return!0;if(void 0!==t.length)return 0==t.length;var e=0;for(var s in t)t.hasOwnProperty(s)&&e++;return 0==e},_preview_individual:function(){var t=c(this).data("id")||"",e=c(this).data("href")||"";c(".cartflows-preview-flow-step").removeClass("active"),c('.cartflows-preview-flow-step[data-id="'+t+'"]').addClass("active"),c("#TB_window").addClass("cartflows-thickbox-loading"),c("#TB_iframeContent").removeAttr("onload"),c("#TB_iframeContent").removeAttr("src"),c("#TB_iframeContent").attr("src",e),c("#TB_iframeContent").attr("onload","CartFlowsImport.showIframe()")},showIframe:function(){c("#TB_load").remove(),c("#TB_window").css({visibility:"visible"}),c("#TB_window").removeClass("cartflows-thickbox-loading")},_previewLoaded:function(t){t.preventDefault(),c("#TB_window").removeClass("cartflows-thickbox-loading")},_filterFlowPageBuilderClick:function(t){t.preventDefault(),c(this).parents("ul").find("a").removeClass("current"),c(this).addClass("current"),c(".wcf-page-builder-notice").html(""),c("#wcf-remote-flow-list").html('<span class="spinner is-active"></span>'),CartFlowsImport._showFlows()},_showFlows:function(){var t={licence_args:CartFlowsImportVars.licence_args,_fields:CartFlowsImportVars.flow_fields.toString()},e=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("group")||"";c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("slug"),c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("title");""!==e&&"all"!==e&&(t[CartFlowsImportVars.flow_page_builder]=e);var s={remote_slug:CartFlowsImportVars.flow,slug:CartFlowsImportVars.flow+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(s,function(t){var e=wp.template("cartflows-flows-list");parseInt(t.items_count)?c("#wcf-remote-flow-list").html(e(t)):c("#wcf-remote-flow-list").html(wp.template("cartflows-no-flows")),c(".wcf-page-builder-notice").remove(),c("#wcf-remote-flow-importer").removeClass("request-process")})},_create_default_flow:function(t){t.preventDefault();var e=CartFlowsImport,s=c(this);if(!s.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process"),s.addClass("updating-message").text("Creating Flow.."),s.parents(".template").addClass("importing");var a={action:"cartflows_default_flow",security:cartflows_admin.cf_default_flow_nonce};e._ajax(a,function(t){if(t.request.success){var e=t.request.data;setTimeout(function(){s.removeClass("updating-message").text("Flow Created! Redirecting.."),window.location=CartFlowsImportVars.admin_url+"post.php?post="+e+"&action=edit"},3e3)}})}},_activate_plugin:function(t){var e={action:"cartflows_activate_plugin",plugin_init:t};CartFlowsImport._ajax(e,function(t){})},_process_import_flow:function(t){t.preventDefault();var a=c(this);if(!a.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process");var e=CartFlowsImport;a.text("Creating Flow.."),a.addClass("updating-message"),a.parents(".template").addClass("importing");var s=a.data("flow-steps")||"",r=""!==s?JSON.parse("["+s+"]"):[],o={action:"cartflows_create_flow",security:cartflows_admin.cf_create_flow_nonce};e._ajax(o,function(t){if(t.request.success){var s=t.request.data;r&&(CartFlowsAjaxQueue.stop(),CartFlowsAjaxQueue.run(),CartFlowsImport.all_steps=r.length,a.addClass("updating-message").text("Importing Step 1 of "+CartFlowsImport.all_steps),c.each(r,function(t,e){CartFlowsAjaxQueue.add({url:CartFlowsImportVars.ajaxurl,type:"POST",data:{action:"cartflows_import_flow_step",flow_id:s,template_id:e,security:cartflows_admin.cf_import_flow_step_nonce},success:function(t){CartFlowsImport.remaining_steps=CartFlowsImport.remaining_steps+1,CartFlowsImport.remaining_steps===CartFlowsImport.all_steps?(a.addClass("updating-message").text("Imported Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){a.removeClass("updating-message").text("All Imported! Redirecting.."),window.location=CartFlowsImportVars.admin_url+"post.php?post="+s+"&action=edit"},3e3)):a.addClass("updating-message").text("Importing Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps)},error:function(t){CartFlowsImport.remaining_steps=CartFlowsImport.remaining_steps+1,template=a.parents(".template.importing"),template.find(".preview").addClass("notice notice-warning").removeClass("preview").text(t.statusText),CartFlowsImport.remaining_steps===CartFlowsImport.all_steps?(a.addClass("updating-message").text("Failed "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){a.removeClass("updating-message button-primary").addClass("disabled")},3e3)):a.addClass("updating-message").text("Failed "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps)},fail:function(t){CartFlowsImport.remaining_steps=CartFlowsImport.remaining_steps+1,CartFlowsImport.remaining_steps===CartFlowsImport.all_steps?(a.addClass("updating-message").text("Imported "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){a.removeClass("updating-message").text("All Step Imported! Reloading.."),location.reload()},3e3)):a.addClass("updating-message").text("Importing "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps)}})}))}})}},_handle_error:function(t){c(".cartflows-step-import.updating-message").addClass("updating-message").text(t.errorMessage)},_create_blank_step:function(t){t.preventDefault();var s=c(this),e=CartFlowsImport,a=c("#post_ID").val(),r=c("#wcf-scratch-steps-categories .step-type-filter-links .current").data("slug")||"",o=c("#wcf-scratch-steps-categories .step-type-filter-links .current").data("title")||"",l=r,i=c('.wcf-step-wrap[data-term-slug="'+r+'"]').length||1,p=o+" "+(parseInt(i)+1);if(c("#wcf-start-from-scratch .wcf-notice-wrap").remove(),""!==l){if(CartFlowsImportVars._is_pro_active||"upsell"!==l&&"downsell"!==l){if(s.parents(".template").addClass("importing"),!CartFlowsImportVars._is_pro_active)if("checkout"===l)if(0<c('.wcf-step-wrap[data-term-slug="checkout"]').length){s.parents(".template.importing");return s.removeClass("importing updating-message").text("Import Failed!"),void c("#wcf-start-from-scratch .inner").append('<div class="wcf-notice-wrap"><div class="notice notice-warning"><p>Upgrade to Pro for adding more than one Checkout step.</p></div></div>')}if(c("#wcf-remote-step-importer").addClass("request-process"),c(".cartflows-step-import").addClass("disabled"),s.addClass("importing updating-message").text("Creating.."),c("body").hasClass("post-type-cartflows_flow")){var n={action:"cartflows_step_create_blank",flow_id:a,step_type:l,step_title:p,security:cartflows_admin.cf_step_create_blank_nonce};e._ajax(n,function(t){CartFlowsImport;var e=s.parents(".template.importing");t.request.success?(s.text("Created. Reloading.."),setTimeout(function(){window.location.href=window.location.href+"&highlight-step-id="+t.request.data},3e3)):(s.removeClass("importing updating-message").text("Creating Failed!"),c("#wcf-remote-step-importer").removeClass("request-process"),e.find(".cartflows-step-preview").append("<div class='preview'></div>"),e.find(".preview").addClass("notice notice-warning").removeClass("preview").text(t.request.data))})}}}else c("#wcf-start-from-scratch .inner").append('<div class="wcf-notice-wrap"><div class="notice notice-info"><p>Please select the step type.</p></div></div>')},_process_import_step:function(t){t.preventDefault();var s=c(this),e=s.data("slug")||"",a=c('.wcf-step-wrap[data-term-slug="'+e+'"]').length||1;if((step_title=s.data("title")||"",step_custom_title=step_title+" "+(parseInt(a)+1),o=CartFlowsImport,!CartFlowsImportVars._is_pro_active)&&("checkout"===e&&0<c('.wcf-step-wrap[data-term-slug="checkout"]').length)){var r=s.parents(".template");return s.removeClass("importing updating-message").text("Import Failed!"),r.find(".preview").hide(),r.find("#wcf_create_notice").show().find("a").addClass("notice notice-warning ").text("Upgrade to Pro for adding more than one Checkout step"),void c("#wcf-remote-step-importer").removeClass("request-process")}if(!s.hasClass("updating-message")){c("#wcf-remote-step-importer").addClass("request-process");var o=CartFlowsImport;s.addClass("updating-message"),s.parents(".template").addClass("importing");var l=s.data("template-id")||"",i=c("#post_ID").val(),p=e;o=CartFlowsImport;if(c(".cartflows-step-import-blank").addClass("disabled"),c(".cartflows-step-import").addClass("disabled"),s.addClass("importing updating-message").text("Importing.."),c("body").hasClass("post-type-cartflows_flow")){var n={action:"cartflows_step_import",flow_id:i,template_id:l,step_title:step_custom_title,step_type:p,security:cartflows_admin.cf_step_import_nonce};o._ajax(n,function(t){CartFlowsImport;var e=s.parents(".template.importing");t.request.success?(s.text("Imported. Reloading.."),setTimeout(function(){window.location.href=window.location.href+"&highlight-step-id="+t.request.data},3e3)):(c(".wcf-templates-popup-overlay").removeClass("request-process"),s.removeClass("importing updating-message").text("Import Failed!"),e.find(".preview").addClass("notice notice-warning").removeClass("preview").text(t.request.data))},"add_template_to_page")}}},_add_template_to_page_fail:function(t,e,s){t.preventDefault();CartFlowsImport;var a=c(".wcf-flow-steps-data-wrap-importer .template.importing");a.find(".cartflows-step-import").removeClass("importing updating-message").text("Import Failed!"),a.find(".preview").addClass("notice notice-warning").removeClass("preview").text(e.responseText)}},c(function(){CartFlowsImport.init()})}(jQuery);
assets/min-js/rest-api.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(i){var n={timeout:3e5,data:{},remove:function(e){delete n.data[e]},exist:function(e){return!!n.data[e]&&(new Date).getTime()-n.data[e]._<n.timeout},get:function(e){return n.data[e].data},set:function(e,t,r){n.remove(e),n.data[e]={_:(new Date).getTime(),data:t},r&&"function"==typeof r&&r(t)}};i.ajaxPrefilter(function(a,e,t){if("brainstormforce"===a.author){var o=e.complete||i.noop,s=e.url;a.beforeSend=function(){if(n.exist(s)){var e=n.get(s);return CartFlowsAPI._api_cached_request(e),!1}return!0},a.complete=function(e,t){var r={args:a.args,items:e.responseText?JSON.parse(e.responseText):"",items_count:e.getResponseHeader("x-wp-total")||0,callback:a.callback,status:t,XHR:e};n.set(s,r,o)}}}),CartFlowsAPI={_log:function(e,t){if(CartFlowsImportVars.debug)if("table"===t);else(new Date).toLocaleTimeString()},_api_url:CartFlowsImportVars.server_rest_url,_api_cached_request:function(e){CartFlowsAPI._log(n.data,"table"),CartFlowsAPI._log("Current time "+(new Date).getTime()),CartFlowsAPI._log("Cache expired in "+parseInt(n.timeout)/1e3+" seconds."),void 0!==e.args.trigger&&""!==e.args.trigger&&i(document).trigger(e.args.trigger,[e]),e.callback&&"function"==typeof e.callback&&e.callback(e)},_api_request:function(o,s){var r={url:CartFlowsAPI._api_url+o.slug,args:o,callback:s,author:"brainstormforce"};r.headers=CartFlowsImportVars.headers,i.ajax(r).done(function(e,t,r){if("success"===t&&r.getResponseHeader("x-wp-total")){var a={args:o,items:e,items_count:r.getResponseHeader("x-wp-total")||0,callback:s,status:t,XHR:r};void 0!==o.trigger&&""!==o.trigger&&i(document).trigger(o.trigger,[a])}else i(document).trigger("cartflows-api-request-error");s&&"function"==typeof s&&s(a)}).fail(function(e,t){i(document).trigger("cartflows-api-request-fail",[r,e,t])}).always(function(){i(document).trigger("cartflows-api-request-always")})}}}(jQuery);
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.1.13
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.1.14
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  Version 1.1.13 - Tuesday, 9th April 2019
2
  - Improvement: Added compatibility for a Two-Step checkout style of CartFlows Pro.
3
  - Fix: CSS conflict with the Divi theme.
1
+ Version 1.1.14 - Wednesday, 24th April 2019
2
+ - Improvement: Minify CSS and Js files filter added.
3
+ - Improvement: Inline coupon message. Now coupon message will show above coupon field.
4
+ - Fix: Divi compatibility CSS updated.
5
+ - Fix: Lost your password link was unable to click on the checkout page.
6
+
7
  Version 1.1.13 - Tuesday, 9th April 2019
8
  - Improvement: Added compatibility for a Two-Step checkout style of CartFlows Pro.
9
  - Fix: CSS conflict with the Divi theme.
classes/batch-process/class-cartflows-batch-process.php CHANGED
@@ -1,270 +1,270 @@
1
- <?php
2
- /**
3
- * Batch Processing
4
- *
5
- * @package CartFlows
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
10
-
11
- /**
12
- * CartFlows_Batch_Process
13
- *
14
- * @since 1.0.0
15
- */
16
- class CartFlows_Batch_Process {
17
-
18
- /**
19
- * Instance
20
- *
21
- * @since 1.0.0
22
- * @var object Class object.
23
- * @access private
24
- */
25
- private static $instance;
26
-
27
- /**
28
- * Elementor Batch Instance
29
- *
30
- * @since 1.1.1 Updated instance name with elementor specific.
31
- *
32
- * @since 1.0.0
33
- * @var object Class object.
34
- * @access public
35
- */
36
- public static $batch_instance_elementor;
37
-
38
- /**
39
- * Beaver Builder Batch Instance
40
- *
41
- * @since 1.1.1
42
- * @var object Class object.
43
- * @access public
44
- */
45
- public static $batch_instance_bb;
46
-
47
- /**
48
- * Divi Batch Instance
49
- *
50
- * @since 1.1.1
51
- * @var object Class object.
52
- * @access public
53
- */
54
- public static $batch_instance_divi;
55
-
56
- /**
57
- * Initiator
58
- *
59
- * @since 1.0.0
60
- * @return object initialized object of class.
61
- */
62
- public static function get_instance() {
63
- if ( ! isset( self::$instance ) ) {
64
- self::$instance = new self;
65
- }
66
- return self::$instance;
67
- }
68
-
69
- /**
70
- * Constructor
71
- *
72
- * @since 1.0.0
73
- */
74
- public function __construct() {
75
-
76
- // Not BB or Elementor then avoid importer.
77
- // if ( ! class_exists( '\Elementor\Plugin' ) && ! class_exists( 'FLBuilder' ) ) {
78
- // return;
79
- // }
80
- // Core Helpers - Image.
81
- require_once ABSPATH . 'wp-admin/includes/image.php';
82
-
83
- // Core Helpers - Batch Processing.
84
- require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-cartflows-importer-image.php';
85
- require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
86
- require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
87
-
88
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
89
-
90
- // Elementor.
91
- if ( ( 'elementor' === $default_page_builder ) && class_exists( '\Elementor\Plugin' ) ) {
92
- // Add "elementor" in import [queue].
93
- // @todo Remove required `allow_url_fopen` support.
94
- if ( ini_get( 'allow_url_fopen' ) ) {
95
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
96
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor-batch.php';
97
- self::$batch_instance_elementor = new Cartflows_Importer_Elementor_Batch();
98
- }
99
- }
100
-
101
- // Beaver Builder.
102
- if ( ( 'beaver-builder' === $default_page_builder ) && class_exists( 'FLBuilder' ) ) {
103
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
104
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
105
- self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
106
- }
107
-
108
- // Divi.
109
- if ( ( 'divi' === $default_page_builder ) && ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) ) {
110
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
111
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
112
- self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
113
- }
114
-
115
- // Start image importing after site import complete.
116
- add_action( 'cartflows_after_template_import', array( $this, 'start_batch_process' ) );
117
- add_action( 'cartflows_import_complete', array( $this, 'complete_batch_import' ) );
118
- add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
119
- add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
120
- }
121
-
122
- /**
123
- * Added .svg files as supported format in the uploader.
124
- *
125
- * @since 1.1.4
126
- *
127
- * @param array $mimes Already supported mime types.
128
- */
129
- public function custom_upload_mimes( $mimes ) {
130
-
131
- // Allow SVG files.
132
- $mimes['svg'] = 'image/svg+xml';
133
- $mimes['svgz'] = 'image/svg+xml';
134
-
135
- // Allow XML files.
136
- $mimes['xml'] = 'text/xml';
137
-
138
- return $mimes;
139
- }
140
-
141
- /**
142
- * Add SVG image support
143
- *
144
- * @since 1.1.4
145
- *
146
- * @param array $response Attachment response.
147
- * @param object $attachment Attachment object.
148
- * @param array $meta Attachment meta data.
149
- */
150
- function add_svg_image_support( $response, $attachment, $meta ) {
151
- if ( ! function_exists( 'simplexml_load_file' ) ) {
152
- return $response;
153
- }
154
-
155
- if ( ! empty( $response['sizes'] ) ) {
156
- return $response;
157
- }
158
-
159
- if ( 'image/svg+xml' !== $response['mime'] ) {
160
- return $response;
161
- }
162
-
163
- $svg_path = get_attached_file( $attachment->ID );
164
-
165
- $dimensions = self::get_svg_dimensions( $svg_path );
166
-
167
- $response['sizes'] = array(
168
- 'full' => array(
169
- 'url' => $response['url'],
170
- 'width' => $dimensions->width,
171
- 'height' => $dimensions->height,
172
- 'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
173
- ),
174
- );
175
-
176
- return $response;
177
- }
178
-
179
- /**
180
- * Get SVG Dimensions
181
- *
182
- * @since 1.1.4.
183
- *
184
- * @param string $svg SVG file path.
185
- * @return array Return SVG file height & width for valid SVG file.
186
- */
187
- public static function get_svg_dimensions( $svg ) {
188
-
189
- $svg = simplexml_load_file( $svg );
190
-
191
- if ( false === $svg ) {
192
- $width = '0';
193
- $height = '0';
194
- } else {
195
- $attributes = $svg->attributes();
196
- $width = (string) $attributes->width;
197
- $height = (string) $attributes->height;
198
- }
199
-
200
- return (object) array(
201
- 'width' => $width,
202
- 'height' => $height,
203
- );
204
- }
205
-
206
- /**
207
- * Batch Process Complete.
208
- *
209
- * @return void
210
- */
211
- public function complete_batch_import() {
212
- wcf()->logger->import_log( '(✓) BATCH Process Complete!' );
213
- }
214
-
215
- /**
216
- * Start Image Import
217
- *
218
- * @param integer $post_id Post Id.
219
- *
220
- * @return void
221
- */
222
- public function start_batch_process( $post_id = '' ) {
223
-
224
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
225
-
226
- wcf()->logger->import_log( '(✓) BATCH Started!' );
227
- wcf()->logger->import_log( '(✓) Step ID ' . $post_id );
228
-
229
- // Add "elementor" in import [queue].
230
- if ( 'beaver-builder' === $default_page_builder && self::$batch_instance_bb ) {
231
-
232
- // Add to queue.
233
- self::$batch_instance_bb->push_to_queue( $post_id );
234
-
235
- // Dispatch Queue.
236
- self::$batch_instance_bb->save()->dispatch();
237
-
238
- wcf()->logger->import_log( '(✓) Dispatch "Beaver Builder" Request..' );
239
-
240
- } elseif ( 'elementor' === $default_page_builder && self::$batch_instance_elementor ) {
241
-
242
- // Add to queue.
243
- self::$batch_instance_elementor->push_to_queue( $post_id );
244
-
245
- // Dispatch Queue.
246
- self::$batch_instance_elementor->save()->dispatch();
247
-
248
- wcf()->logger->import_log( '(✓) Dispatch "Elementor" Request..' );
249
- } elseif ( 'divi' === $default_page_builder && self::$batch_instance_divi ) {
250
-
251
- // Add to queue.
252
- self::$batch_instance_divi->push_to_queue( $post_id );
253
-
254
- // Dispatch Queue.
255
- self::$batch_instance_divi->save()->dispatch();
256
-
257
- wcf()->logger->import_log( '(✓) Dispatch "Divi" Request..' );
258
- } else {
259
- wcf()->logger->import_log( '(✕) Could not import image due to allow_url_fopen() is disabled!' );
260
- }
261
- }
262
-
263
- }
264
-
265
- /**
266
- * Kicking this off by calling 'get_instance()' method
267
- */
268
- CartFlows_Batch_Process::get_instance();
269
-
270
- endif;
1
+ <?php
2
+ /**
3
+ * Batch Processing
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
10
+
11
+ /**
12
+ * CartFlows_Batch_Process
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class CartFlows_Batch_Process {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.0
22
+ * @var object Class object.
23
+ * @access private
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Elementor Batch Instance
29
+ *
30
+ * @since 1.1.1 Updated instance name with elementor specific.
31
+ *
32
+ * @since 1.0.0
33
+ * @var object Class object.
34
+ * @access public
35
+ */
36
+ public static $batch_instance_elementor;
37
+
38
+ /**
39
+ * Beaver Builder Batch Instance
40
+ *
41
+ * @since 1.1.1
42
+ * @var object Class object.
43
+ * @access public
44
+ */
45
+ public static $batch_instance_bb;
46
+
47
+ /**
48
+ * Divi Batch Instance
49
+ *
50
+ * @since 1.1.1
51
+ * @var object Class object.
52
+ * @access public
53
+ */
54
+ public static $batch_instance_divi;
55
+
56
+ /**
57
+ * Initiator
58
+ *
59
+ * @since 1.0.0
60
+ * @return object initialized object of class.
61
+ */
62
+ public static function get_instance() {
63
+ if ( ! isset( self::$instance ) ) {
64
+ self::$instance = new self;
65
+ }
66
+ return self::$instance;
67
+ }
68
+
69
+ /**
70
+ * Constructor
71
+ *
72
+ * @since 1.0.0
73
+ */
74
+ public function __construct() {
75
+
76
+ // Not BB or Elementor then avoid importer.
77
+ // if ( ! class_exists( '\Elementor\Plugin' ) && ! class_exists( 'FLBuilder' ) ) {
78
+ // return;
79
+ // }
80
+ // Core Helpers - Image.
81
+ require_once ABSPATH . 'wp-admin/includes/image.php';
82
+
83
+ // Core Helpers - Batch Processing.
84
+ require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-cartflows-importer-image.php';
85
+ require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
86
+ require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
87
+
88
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
89
+
90
+ // Elementor.
91
+ if ( ( 'elementor' === $default_page_builder ) && class_exists( '\Elementor\Plugin' ) ) {
92
+ // Add "elementor" in import [queue].
93
+ // @todo Remove required `allow_url_fopen` support.
94
+ if ( ini_get( 'allow_url_fopen' ) ) {
95
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
96
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor-batch.php';
97
+ self::$batch_instance_elementor = new Cartflows_Importer_Elementor_Batch();
98
+ }
99
+ }
100
+
101
+ // Beaver Builder.
102
+ if ( ( 'beaver-builder' === $default_page_builder ) && class_exists( 'FLBuilder' ) ) {
103
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
104
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
105
+ self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
106
+ }
107
+
108
+ // Divi.
109
+ if ( ( 'divi' === $default_page_builder ) && ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) ) {
110
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
111
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
112
+ self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
113
+ }
114
+
115
+ // Start image importing after site import complete.
116
+ add_action( 'cartflows_after_template_import', array( $this, 'start_batch_process' ) );
117
+ add_action( 'cartflows_import_complete', array( $this, 'complete_batch_import' ) );
118
+ add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
119
+ add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
120
+ }
121
+
122
+ /**
123
+ * Added .svg files as supported format in the uploader.
124
+ *
125
+ * @since 1.1.4
126
+ *
127
+ * @param array $mimes Already supported mime types.
128
+ */
129
+ public function custom_upload_mimes( $mimes ) {
130
+
131
+ // Allow SVG files.
132
+ $mimes['svg'] = 'image/svg+xml';
133
+ $mimes['svgz'] = 'image/svg+xml';
134
+
135
+ // Allow XML files.
136
+ $mimes['xml'] = 'text/xml';
137
+
138
+ return $mimes;
139
+ }
140
+
141
+ /**
142
+ * Add SVG image support
143
+ *
144
+ * @since 1.1.4
145
+ *
146
+ * @param array $response Attachment response.
147
+ * @param object $attachment Attachment object.
148
+ * @param array $meta Attachment meta data.
149
+ */
150
+ function add_svg_image_support( $response, $attachment, $meta ) {
151
+ if ( ! function_exists( 'simplexml_load_file' ) ) {
152
+ return $response;
153
+ }
154
+
155
+ if ( ! empty( $response['sizes'] ) ) {
156
+ return $response;
157
+ }
158
+
159
+ if ( 'image/svg+xml' !== $response['mime'] ) {
160
+ return $response;
161
+ }
162
+
163
+ $svg_path = get_attached_file( $attachment->ID );
164
+
165
+ $dimensions = self::get_svg_dimensions( $svg_path );
166
+
167
+ $response['sizes'] = array(
168
+ 'full' => array(
169
+ 'url' => $response['url'],
170
+ 'width' => $dimensions->width,
171
+ 'height' => $dimensions->height,
172
+ 'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
173
+ ),
174
+ );
175
+
176
+ return $response;
177
+ }
178
+
179
+ /**
180
+ * Get SVG Dimensions
181
+ *
182
+ * @since 1.1.4.
183
+ *
184
+ * @param string $svg SVG file path.
185
+ * @return array Return SVG file height & width for valid SVG file.
186
+ */
187
+ public static function get_svg_dimensions( $svg ) {
188
+
189
+ $svg = simplexml_load_file( $svg );
190
+
191
+ if ( false === $svg ) {
192
+ $width = '0';
193
+ $height = '0';
194
+ } else {
195
+ $attributes = $svg->attributes();
196
+ $width = (string) $attributes->width;
197
+ $height = (string) $attributes->height;
198
+ }
199
+
200
+ return (object) array(
201
+ 'width' => $width,
202
+ 'height' => $height,
203
+ );
204
+ }
205
+
206
+ /**
207
+ * Batch Process Complete.
208
+ *
209
+ * @return void
210
+ */
211
+ public function complete_batch_import() {
212
+ wcf()->logger->import_log( '(✓) BATCH Process Complete!' );
213
+ }
214
+
215
+ /**
216
+ * Start Image Import
217
+ *
218
+ * @param integer $post_id Post Id.
219
+ *
220
+ * @return void
221
+ */
222
+ public function start_batch_process( $post_id = '' ) {
223
+
224
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
225
+
226
+ wcf()->logger->import_log( '(✓) BATCH Started!' );
227
+ wcf()->logger->import_log( '(✓) Step ID ' . $post_id );
228
+
229
+ // Add "elementor" in import [queue].
230
+ if ( 'beaver-builder' === $default_page_builder && self::$batch_instance_bb ) {
231
+
232
+ // Add to queue.
233
+ self::$batch_instance_bb->push_to_queue( $post_id );
234
+
235
+ // Dispatch Queue.
236
+ self::$batch_instance_bb->save()->dispatch();
237
+
238
+ wcf()->logger->import_log( '(✓) Dispatch "Beaver Builder" Request..' );
239
+
240
+ } elseif ( 'elementor' === $default_page_builder && self::$batch_instance_elementor ) {
241
+
242
+ // Add to queue.
243
+ self::$batch_instance_elementor->push_to_queue( $post_id );
244
+
245
+ // Dispatch Queue.
246
+ self::$batch_instance_elementor->save()->dispatch();
247
+
248
+ wcf()->logger->import_log( '(✓) Dispatch "Elementor" Request..' );
249
+ } elseif ( 'divi' === $default_page_builder && self::$batch_instance_divi ) {
250
+
251
+ // Add to queue.
252
+ self::$batch_instance_divi->push_to_queue( $post_id );
253
+
254
+ // Dispatch Queue.
255
+ self::$batch_instance_divi->save()->dispatch();
256
+
257
+ wcf()->logger->import_log( '(✓) Dispatch "Divi" Request..' );
258
+ } else {
259
+ wcf()->logger->import_log( '(✕) Could not import image due to allow_url_fopen() is disabled!' );
260
+ }
261
+ }
262
+
263
+ }
264
+
265
+ /**
266
+ * Kicking this off by calling 'get_instance()' method
267
+ */
268
+ CartFlows_Batch_Process::get_instance();
269
+
270
+ endif;
classes/batch-process/class-cartflows-importer-beaver-builder-batch.php CHANGED
@@ -1,63 +1,63 @@
1
- <?php
2
- /**
3
- * Beaver Builder Batch Process
4
- *
5
- * @package CartFlows
6
- * @since 1.1.1
7
- */
8
-
9
- if ( ! class_exists( 'Cartflows_Importer_Beaver_Builder_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
-
11
- /**
12
- * Image Background Process
13
- *
14
- * @since 1.1.1
15
- */
16
- class Cartflows_Importer_Beaver_Builder_Batch extends WP_Background_Process {
17
-
18
- /**
19
- * Image Process
20
- *
21
- * @var string
22
- */
23
- protected $action = 'cartflows_beaver_builder_image_process';
24
-
25
- /**
26
- * Task
27
- *
28
- * Override this method to perform any actions required on each
29
- * queue item. Return the modified item for further processing
30
- * in the next pass through. Or, return false to remove the
31
- * item from the queue.
32
- *
33
- * @since 1.1.1
34
- *
35
- * @param integer $post_id Post Id.
36
- * @return mixed
37
- */
38
- protected function task( $post_id ) {
39
-
40
- CartFlows_Importer_Beaver_Builder::get_instance()->import_single_post( $post_id );
41
-
42
- return false;
43
- }
44
-
45
- /**
46
- * Complete
47
- *
48
- * Override if applicable, but ensure that the below actions are
49
- * performed, or, call parent::complete().
50
- *
51
- * @since 1.1.1
52
- */
53
- protected function complete() {
54
-
55
- parent::complete();
56
-
57
- do_action( 'cartflows_import_complete' );
58
-
59
- }
60
-
61
- }
62
-
63
- endif;
1
+ <?php
2
+ /**
3
+ * Beaver Builder Batch Process
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.1.1
7
+ */
8
+
9
+ if ( ! class_exists( 'Cartflows_Importer_Beaver_Builder_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 1.1.1
15
+ */
16
+ class Cartflows_Importer_Beaver_Builder_Batch extends WP_Background_Process {
17
+
18
+ /**
19
+ * Image Process
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'cartflows_beaver_builder_image_process';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 1.1.1
34
+ *
35
+ * @param integer $post_id Post Id.
36
+ * @return mixed
37
+ */
38
+ protected function task( $post_id ) {
39
+
40
+ CartFlows_Importer_Beaver_Builder::get_instance()->import_single_post( $post_id );
41
+
42
+ return false;
43
+ }
44
+
45
+ /**
46
+ * Complete
47
+ *
48
+ * Override if applicable, but ensure that the below actions are
49
+ * performed, or, call parent::complete().
50
+ *
51
+ * @since 1.1.1
52
+ */
53
+ protected function complete() {
54
+
55
+ parent::complete();
56
+
57
+ do_action( 'cartflows_import_complete' );
58
+
59
+ }
60
+
61
+ }
62
+
63
+ endif;
classes/batch-process/class-cartflows-importer-beaver-builder.php CHANGED
@@ -1,229 +1,229 @@
1
- <?php
2
- /**
3
- * Beaver Builder Importer
4
- *
5
- * @package CartFlows
6
- * @since 1.1.1
7
- */
8
-
9
- if ( ! class_exists( 'CartFlows_Importer_Beaver_Builder' ) ) :
10
-
11
- /**
12
- * CartFlows Import Beaver Builder
13
- *
14
- * @since 1.1.1
15
- */
16
- class CartFlows_Importer_Beaver_Builder {
17
-
18
- /**
19
- * Instance
20
- *
21
- * @since 1.1.1
22
- * @access private
23
- * @var object Class object.
24
- */
25
- private static $instance;
26
-
27
- /**
28
- * Initiator
29
- *
30
- * @since 1.1.1
31
- * @return object initialized object of class.
32
- */
33
- public static function get_instance() {
34
-
35
- if ( ! isset( self::$instance ) ) {
36
- self::$instance = new self;
37
- }
38
- return self::$instance;
39
- }
40
-
41
- /**
42
- * Constructor
43
- *
44
- * @since 1.1.1
45
- */
46
- public function __construct() {
47
- }
48
-
49
- /**
50
- * Update post meta.
51
- *
52
- * @param integer $post_id Post ID.
53
- * @return void
54
- */
55
- public function import_single_post( $post_id = 0 ) {
56
-
57
- $data = get_post_meta( $post_id, '_fl_builder_data', true );
58
- if ( ! empty( $data ) ) {
59
-
60
- $data = $this->get_import_data( $data );
61
-
62
- // Update page builder data.
63
- update_post_meta( $post_id, '_fl_builder_data', $data );
64
- update_post_meta( $post_id, '_fl_builder_draft', $data );
65
-
66
- // Clear all cache.
67
- FLBuilderModel::delete_asset_cache_for_all_posts();
68
- } else {
69
- wcf()->logger->import_log( '(✕) Not have "Beaver Builder" Data. Post meta _fl_builder_data is empty!' );
70
- }
71
- }
72
-
73
- /**
74
- * Update post meta.
75
- *
76
- * @param array $data Page builder data.
77
- * @return mixed
78
- */
79
- public function get_import_data( $data ) {
80
-
81
- if ( empty( $data ) ) {
82
- return array();
83
- }
84
-
85
- foreach ( $data as $key => $el ) {
86
-
87
- // Import 'row' images.
88
- if ( 'row' === $el->type ) {
89
- $data[ $key ]->settings = self::import_row_images( $el->settings );
90
- }
91
-
92
- // Import 'module' images.
93
- if ( 'module' === $el->type ) {
94
- $data[ $key ]->settings = self::import_module_images( $el->settings );
95
- }
96
-
97
- // Import 'column' images.
98
- if ( 'column' === $el->type ) {
99
- $data[ $key ]->settings = self::import_column_images( $el->settings );
100
- }
101
- }
102
-
103
- return $data;
104
- }
105
-
106
- /**
107
- * Import Module Images.
108
- *
109
- * @param object $settings Module settings object.
110
- * @return object
111
- */
112
- public static function import_module_images( $settings ) {
113
-
114
- /**
115
- * 1) Set photos.
116
- */
117
- $settings = self::import_photo( $settings );
118
-
119
- /**
120
- * 2) Set `$settings->data` for Only type 'image-icon'
121
- *
122
- * @todo Remove the condition `'image-icon' === $settings->type` if `$settings->data` is used only for the Image Icon.
123
- */
124
- if (
125
- isset( $settings->data ) &&
126
- isset( $settings->photo ) && ! empty( $settings->photo ) &&
127
- 'image-icon' === $settings->type
128
- ) {
129
- $settings->data = FLBuilderPhoto::get_attachment_data( $settings->photo );
130
- }
131
-
132
- /**
133
- * 3) Set `list item` module images
134
- */
135
- if ( isset( $settings->add_list_item ) ) {
136
- foreach ( $settings->add_list_item as $key => $value ) {
137
- $settings->add_list_item[ $key ] = self::import_photo( $value );
138
- }
139
- }
140
-
141
- return $settings;
142
- }
143
-
144
- /**
145
- * Import Column Images.
146
- *
147
- * @param object $settings Column settings object.
148
- * @return object
149
- */
150
- public static function import_column_images( $settings ) {
151
-
152
- // 1) Set BG Images.
153
- $settings = self::import_bg_image( $settings );
154
-
155
- return $settings;
156
- }
157
-
158
- /**
159
- * Import Row Images.
160
- *
161
- * @param object $settings Row settings object.
162
- * @return object
163
- */
164
- public static function import_row_images( $settings ) {
165
-
166
- // 1) Set BG Images.
167
- $settings = self::import_bg_image( $settings );
168
-
169
- return $settings;
170
- }
171
-
172
- /**
173
- * Helper: Import BG Images.
174
- *
175
- * @param object $settings Row settings object.
176
- * @return object
177
- */
178
- public static function import_bg_image( $settings ) {
179
-
180
- if (
181
- ( ! empty( $settings->bg_image ) && ! empty( $settings->bg_image_src ) )
182
- ) {
183
- $image = array(
184
- 'url' => $settings->bg_image_src,
185
- 'id' => $settings->bg_image,
186
- );
187
-
188
- $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
189
-
190
- $settings->bg_image_src = $downloaded_image['url'];
191
- $settings->bg_image = $downloaded_image['id'];
192
- }
193
-
194
- return $settings;
195
- }
196
-
197
- /**
198
- * Helper: Import Photo.
199
- *
200
- * @param object $settings Row settings object.
201
- * @return object
202
- */
203
- public static function import_photo( $settings ) {
204
-
205
- if ( ! empty( $settings->photo ) && ! empty( $settings->photo_src ) ) {
206
-
207
- $image = array(
208
- 'url' => $settings->photo_src,
209
- 'id' => $settings->photo,
210
- );
211
-
212
- $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
213
-
214
- $settings->photo_src = $downloaded_image['url'];
215
- $settings->photo = $downloaded_image['id'];
216
- }
217
-
218
- return $settings;
219
- }
220
-
221
-
222
- }
223
-
224
- /**
225
- * Initialize class object with 'get_instance()' method
226
- */
227
- CartFlows_Importer_Beaver_Builder::get_instance();
228
-
229
- endif;
1
+ <?php
2
+ /**
3
+ * Beaver Builder Importer
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.1.1
7
+ */
8
+
9
+ if ( ! class_exists( 'CartFlows_Importer_Beaver_Builder' ) ) :
10
+
11
+ /**
12
+ * CartFlows Import Beaver Builder
13
+ *
14
+ * @since 1.1.1
15
+ */
16
+ class CartFlows_Importer_Beaver_Builder {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.1.1
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.1.1
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+
35
+ if ( ! isset( self::$instance ) ) {
36
+ self::$instance = new self;
37
+ }
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.1.1
45
+ */
46
+ public function __construct() {
47
+ }
48
+
49
+ /**
50
+ * Update post meta.
51
+ *
52
+ * @param integer $post_id Post ID.
53
+ * @return void
54
+ */
55
+ public function import_single_post( $post_id = 0 ) {
56
+
57
+ $data = get_post_meta( $post_id, '_fl_builder_data', true );
58
+ if ( ! empty( $data ) ) {
59
+
60
+ $data = $this->get_import_data( $data );
61
+
62
+ // Update page builder data.
63
+ update_post_meta( $post_id, '_fl_builder_data', $data );
64
+ update_post_meta( $post_id, '_fl_builder_draft', $data );
65
+
66
+ // Clear all cache.
67
+ FLBuilderModel::delete_asset_cache_for_all_posts();
68
+ } else {
69
+ wcf()->logger->import_log( '(✕) Not have "Beaver Builder" Data. Post meta _fl_builder_data is empty!' );
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Update post meta.
75
+ *
76
+ * @param array $data Page builder data.
77
+ * @return mixed
78
+ */
79
+ public function get_import_data( $data ) {
80
+
81
+ if ( empty( $data ) ) {
82
+ return array();
83
+ }
84
+
85
+ foreach ( $data as $key => $el ) {
86
+
87
+ // Import 'row' images.
88
+ if ( 'row' === $el->type ) {
89
+ $data[ $key ]->settings = self::import_row_images( $el->settings );
90
+ }
91
+
92
+ // Import 'module' images.
93
+ if ( 'module' === $el->type ) {
94
+ $data[ $key ]->settings = self::import_module_images( $el->settings );
95
+ }
96
+
97
+ // Import 'column' images.
98
+ if ( 'column' === $el->type ) {
99
+ $data[ $key ]->settings = self::import_column_images( $el->settings );
100
+ }
101
+ }
102
+
103
+ return $data;
104
+ }
105
+
106
+ /**
107
+ * Import Module Images.
108
+ *
109
+ * @param object $settings Module settings object.
110
+ * @return object
111
+ */
112
+ public static function import_module_images( $settings ) {
113
+
114
+ /**
115
+ * 1) Set photos.
116
+ */
117
+ $settings = self::import_photo( $settings );
118
+
119
+ /**
120
+ * 2) Set `$settings->data` for Only type 'image-icon'
121
+ *
122
+ * @todo Remove the condition `'image-icon' === $settings->type` if `$settings->data` is used only for the Image Icon.
123
+ */
124
+ if (
125
+ isset( $settings->data ) &&
126
+ isset( $settings->photo ) && ! empty( $settings->photo ) &&
127
+ 'image-icon' === $settings->type
128
+ ) {
129
+ $settings->data = FLBuilderPhoto::get_attachment_data( $settings->photo );
130
+ }
131
+
132
+ /**
133
+ * 3) Set `list item` module images
134
+ */
135
+ if ( isset( $settings->add_list_item ) ) {
136
+ foreach ( $settings->add_list_item as $key => $value ) {
137
+ $settings->add_list_item[ $key ] = self::import_photo( $value );
138
+ }
139
+ }
140
+
141
+ return $settings;
142
+ }
143
+
144
+ /**
145
+ * Import Column Images.
146
+ *
147
+ * @param object $settings Column settings object.
148
+ * @return object
149
+ */
150
+ public static function import_column_images( $settings ) {
151
+
152
+ // 1) Set BG Images.
153
+ $settings = self::import_bg_image( $settings );
154
+
155
+ return $settings;
156
+ }
157
+
158
+ /**
159
+ * Import Row Images.
160
+ *
161
+ * @param object $settings Row settings object.
162
+ * @return object
163
+ */
164
+ public static function import_row_images( $settings ) {
165
+
166
+ // 1) Set BG Images.
167
+ $settings = self::import_bg_image( $settings );
168
+
169
+ return $settings;
170
+ }
171
+
172
+ /**
173
+ * Helper: Import BG Images.
174
+ *
175
+ * @param object $settings Row settings object.
176
+ * @return object
177
+ */
178
+ public static function import_bg_image( $settings ) {
179
+
180
+ if (
181
+ ( ! empty( $settings->bg_image ) && ! empty( $settings->bg_image_src ) )
182
+ ) {
183
+ $image = array(
184
+ 'url' => $settings->bg_image_src,
185
+ 'id' => $settings->bg_image,
186
+ );
187
+
188
+ $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
189
+
190
+ $settings->bg_image_src = $downloaded_image['url'];
191
+ $settings->bg_image = $downloaded_image['id'];
192
+ }
193
+
194
+ return $settings;
195
+ }
196
+
197
+ /**
198
+ * Helper: Import Photo.
199
+ *
200
+ * @param object $settings Row settings object.
201
+ * @return object
202
+ */
203
+ public static function import_photo( $settings ) {
204
+
205
+ if ( ! empty( $settings->photo ) && ! empty( $settings->photo_src ) ) {
206
+
207
+ $image = array(
208
+ 'url' => $settings->photo_src,
209
+ 'id' => $settings->photo,
210
+ );
211
+
212
+ $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
213
+
214
+ $settings->photo_src = $downloaded_image['url'];
215
+ $settings->photo = $downloaded_image['id'];
216
+ }
217
+
218
+ return $settings;
219
+ }
220
+
221
+
222
+ }
223
+
224
+ /**
225
+ * Initialize class object with 'get_instance()' method
226
+ */
227
+ CartFlows_Importer_Beaver_Builder::get_instance();
228
+
229
+ endif;
classes/batch-process/class-cartflows-importer-divi-batch.php CHANGED
@@ -1,63 +1,63 @@
1
- <?php
2
- /**
3
- * Divi Batch Process
4
- *
5
- * @package CartFlows
6
- * @since 1.1.1
7
- */
8
-
9
- if ( ! class_exists( 'Cartflows_Importer_Divi_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
-
11
- /**
12
- * Image Background Process
13
- *
14
- * @since 1.1.1
15
- */
16
- class Cartflows_Importer_Divi_Batch extends WP_Background_Process {
17
-
18
- /**
19
- * Image Process
20
- *
21
- * @var string
22
- */
23
- protected $action = 'cartflows_divi_image_process';
24
-
25
- /**
26
- * Task
27
- *
28
- * Override this method to perform any actions required on each
29
- * queue item. Return the modified item for further processing
30
- * in the next pass through. Or, return false to remove the
31
- * item from the queue.
32
- *
33
- * @since 1.1.1
34
- *
35
- * @param integer $post_id Post Id.
36
- * @return mixed
37
- */
38
- protected function task( $post_id ) {
39
-
40
- CartFlows_Importer_Divi::get_instance()->import_single_post( $post_id );
41
-
42
- return false;
43
- }
44
-
45
- /**
46
- * Complete
47
- *
48
- * Override if applicable, but ensure that the below actions are
49
- * performed, or, call parent::complete().
50
- *
51
- * @since 1.1.1
52
- */
53
- protected function complete() {
54
-
55
- parent::complete();
56
-
57
- do_action( 'cartflows_import_complete' );
58
-
59
- }
60
-
61
- }
62
-
63
- endif;
1
+ <?php
2
+ /**
3
+ * Divi Batch Process
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.1.1
7
+ */
8
+
9
+ if ( ! class_exists( 'Cartflows_Importer_Divi_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 1.1.1
15
+ */
16
+ class Cartflows_Importer_Divi_Batch extends WP_Background_Process {
17
+
18
+ /**
19
+ * Image Process
20
+ *
21
+ * @var string
22
+ */
23
+ protected $action = 'cartflows_divi_image_process';
24
+
25
+ /**
26
+ * Task
27
+ *
28
+ * Override this method to perform any actions required on each
29
+ * queue item. Return the modified item for further processing
30
+ * in the next pass through. Or, return false to remove the
31
+ * item from the queue.
32
+ *
33
+ * @since 1.1.1
34
+ *
35
+ * @param integer $post_id Post Id.
36
+ * @return mixed
37
+ */
38
+ protected function task( $post_id ) {
39
+
40
+ CartFlows_Importer_Divi::get_instance()->import_single_post( $post_id );
41
+
42
+ return false;
43
+ }
44
+
45
+ /**
46
+ * Complete
47
+ *
48
+ * Override if applicable, but ensure that the below actions are
49
+ * performed, or, call parent::complete().
50
+ *
51
+ * @since 1.1.1
52
+ */
53
+ protected function complete() {
54
+
55
+ parent::complete();
56
+
57
+ do_action( 'cartflows_import_complete' );
58
+
59
+ }
60
+
61
+ }
62
+
63
+ endif;
classes/batch-process/class-cartflows-importer-divi.php CHANGED
@@ -43,140 +43,29 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
43
  *
44
  * @since 1.1.1
45
  */
46
- public function __construct() {
47
- add_action( 'admin_head', array( $this, 're_process_data_flow' ) );
48
- add_action( 'admin_head', array( $this, 're_process_data_step' ) );
49
- }
50
 
51
  /**
52
- * Rest Data.
53
  *
54
- * @param integer $post_id Post ID.
55
- * @return void
56
- */
57
- function reset_data( $post_id ) {
58
-
59
- $content = get_post_meta( $post_id, 'divi_content_processed', true );
60
-
61
- if ( ! empty( $content ) ) {
62
-
63
- $content = CartFlows_Importer::get_instance()->get_content( $content );
64
-
65
- // Update post content.
66
- wp_update_post(
67
- array(
68
- 'ID' => $post_id,
69
- 'post_content' => $content,
70
- )
71
- );
72
- }
73
- }
74
-
75
- /**
76
- * Re process data.
77
- */
78
- function re_process_data_flow() {
79
- wcf()->logger->import_log( ' Without batch started.. ' );
80
-
81
- if ( CARTFLOWS_FLOW_POST_TYPE !== get_post_type() ) {
82
- return;
83
- }
84
-
85
- global $pagenow;
86
-
87
- if ( 'post.php' !== $pagenow ) {
88
- return;
89
- }
90
-
91
- // Is Highlight step then return!
92
- // Because, It process only for the first flow import.
93
- if ( isset( $_GET['highlight-step-id'] ) ) {
94
- return;
95
- }
96
-
97
- $post_id = get_the_ID();
98
-
99
- /* If Imported Flow */
100
- if ( 'yes' !== get_post_meta( $post_id, 'cartflows_imported_flow', true ) ) {
101
- return;
102
- }
103
-
104
- // wcf()->logger->import_log( ' Reprocessing Divi Data.. ' . $post_id );.
105
- $flow_processed = get_post_meta( $post_id, 'wcf_divi_flow_data_processed', true );
106
-
107
- if ( ! $flow_processed ) {
108
-
109
- $steps = get_post_meta( $post_id, 'wcf-steps', true );
110
- $steps_count = count( $steps );
111
- $steps_remaing = $steps_count;
112
-
113
- foreach ( $steps as $key => $step ) {
114
-
115
- $step_processed = get_post_meta( $step['id'], 'wcf_divi_step_data_processed', true );
116
-
117
- if ( ! $step_processed ) {
118
-
119
- $content = get_post_meta( $step['id'], 'divi_content_processed', true );
120
- // It means that batch is not complete yet.
121
- if ( ! empty( $content ) ) {
122
- $this->reset_data( $step['id'] );
123
-
124
- wcf()->logger->import_log( ' Processing without batch.. ' . $step['id'] );
125
-
126
- // Step processed!
127
- update_post_meta( $step['id'], 'wcf_divi_step_data_processed', true );
128
-
129
- $steps_remaing--;
130
- }
131
- }
132
- }
133
-
134
- // All step data processed.
135
- if ( 0 === $steps_remaing ) {
136
- wcf()->logger->import_log( ' ----------- FLOW COMPLETE ----------------- ' . $post_id );
137
- update_post_meta( $post_id, 'wcf_divi_flow_data_processed', true );
138
- }
139
- } else {
140
- wcf()->logger->import_log( ' Already processed.. ' );
141
- }
142
-
143
- wcf()->logger->import_log( ' Without batch end.. ' );
144
-
145
- }
146
-
147
- /**
148
- * Re process data for step.
149
  */
150
- function re_process_data_step() {
151
 
152
- wcf()->logger->import_log( ' Without batch started.. ' );
 
153
 
154
- if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type() ) {
155
- return;
156
  }
157
 
158
- $post_id = get_the_ID();
159
-
160
- /* If Imported Step */
161
- if ( 'yes' !== get_post_meta( $post_id, 'cartflows_imported_step', true ) ) {
162
- return;
163
- }
164
-
165
- $step_processed = get_post_meta( $post_id, 'wcf_divi_step_data_processed', true );
166
-
167
- if ( ! $step_processed ) {
168
-
169
- $content = get_post_meta( $post_id, 'divi_content_processed', true );
170
- // It means that batch is not complete yet.
171
- if ( ! empty( $content ) ) {
172
- $this->reset_data( $post_id );
173
-
174
- wcf()->logger->import_log( ' Processing without batch.. ' . $post_id );
175
-
176
- // Step processed!
177
- update_post_meta( $post_id, 'wcf_divi_step_data_processed', true );
178
- }
179
- }
180
  }
181
 
182
  /**
@@ -187,6 +76,9 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
187
  */
188
  public function import_single_post( $post_id = 0 ) {
189
 
 
 
 
190
  // Download and replace images.
191
  $content = get_post_meta( $post_id, 'divi_content', true );
192
 
@@ -199,10 +91,17 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
199
  // Update hotlink images.
200
  $content = CartFlows_Importer::get_instance()->get_content( $content );
201
 
202
- // Save processed data.
203
- update_post_meta( $post_id, 'divi_content_processed', $content );
 
 
 
 
 
204
 
205
  // Delete temporary meta key.
 
 
206
  wcf()->logger->import_log( '(✓) Process Complete' );
207
  }
208
  }
43
  *
44
  * @since 1.1.1
45
  */
46
+ public function __construct() {}
 
 
 
47
 
48
  /**
49
+ * Allowed tags for the batch update process
50
  *
51
+ * @since x.x.x
52
+ *
53
+ * @param array $allowedposttags Array of default allowable HTML tags.
54
+ * @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
55
+ * 'strip', 'data', 'entities', or the name of a field filter such as
56
+ * 'pre_user_description'.
57
+ * @return array Array of allowed HTML tags and their allowed attributes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  */
59
+ function allowed_tags_and_attributes( $allowedposttags, $context ) {
60
 
61
+ // Keep only for 'post' contenxt.
62
+ if ( 'post' === $context ) {
63
 
64
+ // <style> tag and attributes.
65
+ $allowedposttags['style'] = array();
66
  }
67
 
68
+ return $allowedposttags;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
 
71
  /**
76
  */
77
  public function import_single_post( $post_id = 0 ) {
78
 
79
+ // Allow the SVG tags in batch update process.
80
+ add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_tags_and_attributes' ), 10, 2 );
81
+
82
  // Download and replace images.
83
  $content = get_post_meta( $post_id, 'divi_content', true );
84
 
91
  // Update hotlink images.
92
  $content = CartFlows_Importer::get_instance()->get_content( $content );
93
 
94
+ // Update post content.
95
+ wp_update_post(
96
+ array(
97
+ 'ID' => $post_id,
98
+ 'post_content' => $content,
99
+ )
100
+ );
101
 
102
  // Delete temporary meta key.
103
+ delete_post_meta( $post_id, 'divi_content' );
104
+
105
  wcf()->logger->import_log( '(✓) Process Complete' );
106
  }
107
  }
classes/batch-process/class-cartflows-importer-elementor-batch.php CHANGED
@@ -1,66 +1,66 @@
1
- <?php
2
- /**
3
- * Elementor Batch Process
4
- *
5
- * @package CartFlows
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! class_exists( 'Cartflows_Importer_Elementor_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
-
11
- /**
12
- * Image Background Process
13
- *
14
- * @since 1.1.1 Updated class name with Elementor specific.
15
- *
16
- * @since 1.0.0
17
- */
18
- class Cartflows_Importer_Elementor_Batch extends WP_Background_Process {
19
-
20
- /**
21
- * Image Process
22
- *
23
- * @var string
24
- */
25
- protected $action = 'cartflows_elementor_image_process';
26
-
27
- /**
28
- * Task
29
- *
30
- * Override this method to perform any actions required on each
31
- * queue item. Return the modified item for further processing
32
- * in the next pass through. Or, return false to remove the
33
- * item from the queue.
34
- *
35
- * @since 1.0.0
36
- *
37
- * @param integer $post_id Post Id.
38
- * @return mixed
39
- */
40
- protected function task( $post_id ) {
41
-
42
- $obj = new \Elementor\TemplateLibrary\CartFlows_Importer_Elementor();
43
- $obj->import_single_template( $post_id );
44
-
45
- return false;
46
- }
47
-
48
- /**
49
- * Complete
50
- *
51
- * Override if applicable, but ensure that the below actions are
52
- * performed, or, call parent::complete().
53
- *
54
- * @since 1.0.0
55
- */
56
- protected function complete() {
57
-
58
- parent::complete();
59
-
60
- do_action( 'cartflows_import_complete' );
61
-
62
- }
63
-
64
- }
65
-
66
- endif;
1
+ <?php
2
+ /**
3
+ * Elementor Batch Process
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Cartflows_Importer_Elementor_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
10
+
11
+ /**
12
+ * Image Background Process
13
+ *
14
+ * @since 1.1.1 Updated class name with Elementor specific.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ class Cartflows_Importer_Elementor_Batch extends WP_Background_Process {
19
+
20
+ /**
21
+ * Image Process
22
+ *
23
+ * @var string
24
+ */
25
+ protected $action = 'cartflows_elementor_image_process';
26
+
27
+ /**
28
+ * Task
29
+ *
30
+ * Override this method to perform any actions required on each
31
+ * queue item. Return the modified item for further processing
32
+ * in the next pass through. Or, return false to remove the
33
+ * item from the queue.
34
+ *
35
+ * @since 1.0.0
36
+ *
37
+ * @param integer $post_id Post Id.
38
+ * @return mixed
39
+ */
40
+ protected function task( $post_id ) {
41
+
42
+ $obj = new \Elementor\TemplateLibrary\CartFlows_Importer_Elementor();
43
+ $obj->import_single_template( $post_id );
44
+
45
+ return false;
46
+ }
47
+
48
+ /**
49
+ * Complete
50
+ *
51
+ * Override if applicable, but ensure that the below actions are
52
+ * performed, or, call parent::complete().
53
+ *
54
+ * @since 1.0.0
55
+ */
56
+ protected function complete() {
57
+
58
+ parent::complete();
59
+
60
+ do_action( 'cartflows_import_complete' );
61
+
62
+ }
63
+
64
+ }
65
+
66
+ endif;
classes/batch-process/class-cartflows-importer-elementor.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
- /**
3
- * Elementor Importer
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- namespace Elementor\TemplateLibrary;
9
-
10
- use Elementor\Core\Base\Document;
11
- use Elementor\DB;
12
- use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
13
- use Elementor\Core\Settings\Manager as SettingsManager;
14
- use Elementor\Core\Settings\Page\Model;
15
- use Elementor\Editor;
16
- use Elementor\Plugin;
17
- use Elementor\Settings;
18
- use Elementor\Utils;
19
-
20
- if ( ! defined( 'ABSPATH' ) ) {
21
- exit; // Exit if accessed directly.
22
- }
23
-
24
- /**
25
- * Elementor template library local source.
26
- *
27
- * Elementor template library local source handler class is responsible for
28
- * handling local Elementor templates saved by the user locally on his site.
29
- *
30
- * @since 1.0.0
31
- */
32
- class CartFlows_Importer_Elementor extends Source_Local {
33
-
34
- /**
35
- * Import single template
36
- *
37
- * @param int $post_id post ID.
38
- */
39
- public function import_single_template( $post_id ) {
40
-
41
- $rest_content = get_post_meta( $post_id, '_elementor_data', true );
42
-
43
- if ( empty( $rest_content ) ) {
44
- $data = __( 'Invalid content.', 'cartflows' );
45
- wcf()->logger->import_log( '(✕) ' . $data );
46
- }
47
-
48
- $rest_content = add_magic_quotes( $rest_content );
49
- $content = json_decode( $rest_content, true );
50
-
51
- if ( ! is_array( $content ) ) {
52
- $data = __( 'Invalid content. Expected an array.', 'cartflows' );
53
- wcf()->logger->import_log( '(✕) ' . $data );
54
- wcf()->logger->import_log( $content );
55
- } else {
56
-
57
- wcf()->logger->import_log( '(✓) Processing Request..' );
58
-
59
- // Import the data.
60
- $content = $this->process_export_import_content( $content, 'on_import' );
61
-
62
- // Update content.
63
- update_metadata( 'post', $post_id, '_elementor_data', $content );
64
-
65
- wcf()->logger->import_log( '(✓) Process Complete' );
66
- }
67
-
68
- }
69
- }
1
+ <?php
2
+ /**
3
+ * Elementor Importer
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ namespace Elementor\TemplateLibrary;
9
+
10
+ use Elementor\Core\Base\Document;
11
+ use Elementor\DB;
12
+ use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
13
+ use Elementor\Core\Settings\Manager as SettingsManager;
14
+ use Elementor\Core\Settings\Page\Model;
15
+ use Elementor\Editor;
16
+ use Elementor\Plugin;
17
+ use Elementor\Settings;
18
+ use Elementor\Utils;
19
+
20
+ if ( ! defined( 'ABSPATH' ) ) {
21
+ exit; // Exit if accessed directly.
22
+ }
23
+
24
+ /**
25
+ * Elementor template library local source.
26
+ *
27
+ * Elementor template library local source handler class is responsible for
28
+ * handling local Elementor templates saved by the user locally on his site.
29
+ *
30
+ * @since 1.0.0
31
+ */
32
+ class CartFlows_Importer_Elementor extends Source_Local {
33
+
34
+ /**
35
+ * Import single template
36
+ *
37
+ * @param int $post_id post ID.
38
+ */
39
+ public function import_single_template( $post_id ) {
40
+
41
+ $rest_content = get_post_meta( $post_id, '_elementor_data', true );
42
+
43
+ if ( empty( $rest_content ) ) {
44
+ $data = __( 'Invalid content.', 'cartflows' );
45
+ wcf()->logger->import_log( '(✕) ' . $data );
46
+ }
47
+
48
+ $rest_content = add_magic_quotes( $rest_content );
49
+ $content = json_decode( $rest_content, true );
50
+
51
+ if ( ! is_array( $content ) ) {
52
+ $data = __( 'Invalid content. Expected an array.', 'cartflows' );
53
+ wcf()->logger->import_log( '(✕) ' . $data );
54
+ wcf()->logger->import_log( $content );
55
+ } else {
56
+
57
+ wcf()->logger->import_log( '(✓) Processing Request..' );
58
+
59
+ // Import the data.
60
+ $content = $this->process_export_import_content( $content, 'on_import' );
61
+
62
+ // Update content.
63
+ update_metadata( 'post', $post_id, '_elementor_data', $content );
64
+
65
+ wcf()->logger->import_log( '(✓) Process Complete' );
66
+ }
67
+
68
+ }
69
+ }
classes/class-cartflows-admin-fields.php CHANGED
@@ -1,198 +1,198 @@
1
- <?php
2
- /**
3
- * CARTFLOWS Admin Fields.
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- /**
9
- * Class Cartflows_Admin_Fields.
10
- */
11
- class Cartflows_Admin_Fields {
12
-
13
- /**
14
- * Text Field
15
- *
16
- * @param array $args Args.
17
- * @return string
18
- */
19
- static public function text_field( $args ) {
20
-
21
- $id = $args['id'];
22
- $name = $args['name'];
23
- $title = $args['title'];
24
- $value = $args['value'];
25
-
26
- $output = '<div class="form-field" id="form-field-' . $id . '">';
27
- $output .= '<label for="' . $id . '">' . $title . '</label>';
28
- $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_attr( $value ) . '">';
29
- $output .= '</div>';
30
-
31
- return $output;
32
- }
33
-
34
- /**
35
- * URL Field
36
- *
37
- * @param array $args Args.
38
- * @return string
39
- */
40
- static public function url_field( $args ) {
41
-
42
- $id = $args['id'];
43
- $name = $args['name'];
44
- $title = $args['title'];
45
- $value = $args['value'];
46
-
47
- $output = '<div class="form-field">';
48
- $output .= '<label for="' . $id . '">' . $title . '</label>';
49
- $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_url( $value ) . '">';
50
- $output .= '</div>';
51
-
52
- return $output;
53
- }
54
-
55
- /**
56
- * Checkbox Field
57
- *
58
- * @param array $args Args.
59
- * @return string
60
- */
61
- static public function checkobox_field( $args ) {
62
-
63
- $id = $args['id'];
64
- $name = $args['name'];
65
- $title = $args['title'];
66
- $value = $args['value'];
67
-
68
- $output = '<div class="form-field" id="form-field-' . $id . '">';
69
- $output .= '<label for="' . $id . '">';
70
- $output .= '<input type="hidden" id="wcf_hid_' . $id . '" name="' . $name . '" value="disable">';
71
- $output .= '<input type="checkbox" id="wcf_' . $id . '" name="' . $name . '" value="enable" ' . checked( $value, 'enable', false ) . '>';
72
- $output .= $title;
73
- $output .= '</label>';
74
- $output .= '</div>';
75
-
76
- return $output;
77
- }
78
-
79
- /**
80
- * Select Field
81
- *
82
- * @since 1.1.4
83
- *
84
- * @param array $args Args.
85
- * @return string
86
- */
87
- static public function select_field( $args ) {
88
-
89
- $id = $args['id'];
90
- $name = $args['name'];
91
- $title = $args['title'];
92
- $description = $args['description'];
93
- $value = $args['value'];
94
- $options = $args['options'];
95
-
96
- $output = '<div class="form-field" id="form-field-' . $id . '">';
97
-
98
- $output .= '<div class="form-field-label">';
99
- $output .= $title;
100
- $output .= '</div>';
101
-
102
- $output .= '<div class="form-field-data">';
103
- $output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
104
- foreach ( $options as $option_value => $option_title ) {
105
- $output .= '<option value="' . $option_value . '" ' . selected( $value, $option_value, false ) . '>' . $option_title . '</option>';
106
- }
107
- $output .= '</select>';
108
- $output .= '</div>';
109
-
110
- $output .= '<div class="form-field-desc">';
111
- $output .= '<p>';
112
- $output .= $description;
113
- $output .= '</p>';
114
- $output .= '</div>';
115
- $output .= '</div>';
116
-
117
- return $output;
118
- }
119
-
120
- /**
121
- * Checkout Selection Field
122
- *
123
- * @param array $args Args.
124
- * @return string
125
- */
126
- static public function flow_checkout_selection_field( $args ) {
127
-
128
- $id = $args['id'];
129
- $name = $args['name'];
130
- $title = $args['title'];
131
- $value = $args['value'];
132
-
133
- $checkout_steps = get_posts(
134
- array(
135
- 'posts_per_page' => -1,
136
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
137
- 'post_status' => 'publish',
138
- 'orderby' => 'ID',
139
- 'order' => 'ASC',
140
- 'tax_query' => array(
141
- array(
142
- 'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
143
- 'field' => 'slug',
144
- 'terms' => 'checkout',
145
- ),
146
- ),
147
- )
148
- );
149
-
150
- $output = '<div class="form-field" id="form-field-' . $id . '">';
151
-
152
- $output .= '<div class="form-field-label">';
153
- $output .= '<label for="' . $id . '">';
154
- $output .= $title;
155
- $output .= '</label>';
156
- $output .= '</div>';
157
-
158
- $output .= '<div class="form-field-data">';
159
- $output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
160
-
161
- if ( ! empty( $checkout_steps ) ) {
162
- $output .= '<option value="">' . __( 'Select', 'cartflows' ) . '</option>';
163
- } else {
164
-
165
- $output .= '<option value="">' . __( 'No Checkout Steps', 'cartflows' ) . '</option>';
166
- }
167
-
168
- foreach ( $checkout_steps as $index => $step_data ) {
169
-
170
- $output .= '<option value="' . $step_data->ID . '" ' . selected( $value, $step_data->ID, false ) . '>' . $step_data->post_title . ' (#' . $step_data->ID . ') </option>';
171
- }
172
-
173
- $output .= '</select>';
174
- $output .= '</div>';
175
-
176
- if ( '' !== $value ) {
177
- $output .= '<div class="form-field-actions">';
178
- $output .= '<a href="' . get_edit_post_link( $value ) . '" target="_blank" class="" title="Edit">';
179
- $output .= '<span class="dashicons dashicons-edit"></span>';
180
- $output .= '<span class="">Edit</span>';
181
- $output .= '</a>';
182
- $output .= '<a href="' . get_permalink( $value ) . '" target="_blank" class="" title="View">';
183
- $output .= '<span class="dashicons dashicons-visibility"></span>';
184
- $output .= '<span class="">View</span>';
185
- $output .= '</a>';
186
- $output .= '</div>';
187
- }
188
-
189
- $output .= '<div class="form-field-desc">';
190
- /* translators: %s: link */
191
- $output .= '<p>' . sprintf( __( 'Be sure not to add any product in above selected Global Checkout step. Please read information about how to set up Global Checkout %1$shere%2$s.', 'cartflows' ), '<a href="https://cartflows.com/docs/global-checkout/" target="_blank">', '</a>' ) . '</p>';
192
- $output .= '</div>';
193
-
194
- $output .= '</div>';
195
-
196
- return $output;
197
- }
198
- }
1
+ <?php
2
+ /**
3
+ * CARTFLOWS Admin Fields.
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ /**
9
+ * Class Cartflows_Admin_Fields.
10
+ */
11
+ class Cartflows_Admin_Fields {
12
+
13
+ /**
14
+ * Text Field
15
+ *
16
+ * @param array $args Args.
17
+ * @return string
18
+ */
19
+ static public function text_field( $args ) {
20
+
21
+ $id = $args['id'];
22
+ $name = $args['name'];
23
+ $title = $args['title'];
24
+ $value = $args['value'];
25
+
26
+ $output = '<div class="form-field" id="form-field-' . $id . '">';
27
+ $output .= '<label for="' . $id . '">' . $title . '</label>';
28
+ $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_attr( $value ) . '">';
29
+ $output .= '</div>';
30
+
31
+ return $output;
32
+ }
33
+
34
+ /**
35
+ * URL Field
36
+ *
37
+ * @param array $args Args.
38
+ * @return string
39
+ */
40
+ static public function url_field( $args ) {
41
+
42
+ $id = $args['id'];
43
+ $name = $args['name'];
44
+ $title = $args['title'];
45
+ $value = $args['value'];
46
+
47
+ $output = '<div class="form-field">';
48
+ $output .= '<label for="' . $id . '">' . $title . '</label>';
49
+ $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_url( $value ) . '">';
50
+ $output .= '</div>';
51
+
52
+ return $output;
53
+ }
54
+
55
+ /**
56
+ * Checkbox Field
57
+ *
58
+ * @param array $args Args.
59
+ * @return string
60
+ */
61
+ static public function checkobox_field( $args ) {
62
+
63
+ $id = $args['id'];
64
+ $name = $args['name'];
65
+ $title = $args['title'];
66
+ $value = $args['value'];
67
+
68
+ $output = '<div class="form-field" id="form-field-' . $id . '">';
69
+ $output .= '<label for="' . $id . '">';
70
+ $output .= '<input type="hidden" id="wcf_hid_' . $id . '" name="' . $name . '" value="disable">';
71
+ $output .= '<input type="checkbox" id="wcf_' . $id . '" name="' . $name . '" value="enable" ' . checked( $value, 'enable', false ) . '>';
72
+ $output .= $title;
73
+ $output .= '</label>';
74
+ $output .= '</div>';
75
+
76
+ return $output;
77
+ }
78
+
79
+ /**
80
+ * Select Field
81
+ *
82
+ * @since 1.1.4
83
+ *
84
+ * @param array $args Args.
85
+ * @return string
86
+ */
87
+ static public function select_field( $args ) {
88
+
89
+ $id = $args['id'];
90
+ $name = $args['name'];
91
+ $title = $args['title'];
92
+ $description = $args['description'];
93
+ $value = $args['value'];
94
+ $options = $args['options'];
95
+
96
+ $output = '<div class="form-field" id="form-field-' . $id . '">';
97
+
98
+ $output .= '<div class="form-field-label">';
99
+ $output .= $title;
100
+ $output .= '</div>';
101
+
102
+ $output .= '<div class="form-field-data">';
103
+ $output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
104
+ foreach ( $options as $option_value => $option_title ) {
105
+ $output .= '<option value="' . $option_value . '" ' . selected( $value, $option_value, false ) . '>' . $option_title . '</option>';
106
+ }
107
+ $output .= '</select>';
108
+ $output .= '</div>';
109
+
110
+ $output .= '<div class="form-field-desc">';
111
+ $output .= '<p>';
112
+ $output .= $description;
113
+ $output .= '</p>';
114
+ $output .= '</div>';
115
+ $output .= '</div>';
116
+
117
+ return $output;
118
+ }
119
+
120
+ /**
121
+ * Checkout Selection Field
122
+ *
123
+ * @param array $args Args.
124
+ * @return string
125
+ */
126
+ static public function flow_checkout_selection_field( $args ) {
127
+
128
+ $id = $args['id'];
129
+ $name = $args['name'];
130
+ $title = $args['title'];
131
+ $value = $args['value'];
132
+
133
+ $checkout_steps = get_posts(
134
+ array(
135
+ 'posts_per_page' => -1,
136
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
137
+ 'post_status' => 'publish',
138
+ 'orderby' => 'ID',
139
+ 'order' => 'ASC',
140
+ 'tax_query' => array(
141
+ array(
142
+ 'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
143
+ 'field' => 'slug',
144
+ 'terms' => 'checkout',
145
+ ),
146
+ ),
147
+ )
148
+ );
149
+
150
+ $output = '<div class="form-field" id="form-field-' . $id . '">';
151
+
152
+ $output .= '<div class="form-field-label">';
153
+ $output .= '<label for="' . $id . '">';
154
+ $output .= $title;
155
+ $output .= '</label>';
156
+ $output .= '</div>';
157
+
158
+ $output .= '<div class="form-field-data">';
159
+ $output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
160
+
161
+ if ( ! empty( $checkout_steps ) ) {
162
+ $output .= '<option value="">' . __( 'Select', 'cartflows' ) . '</option>';
163
+ } else {
164
+
165
+ $output .= '<option value="">' . __( 'No Checkout Steps', 'cartflows' ) . '</option>';
166
+ }
167
+
168
+ foreach ( $checkout_steps as $index => $step_data ) {
169
+
170
+ $output .= '<option value="' . $step_data->ID . '" ' . selected( $value, $step_data->ID, false ) . '>' . $step_data->post_title . ' (#' . $step_data->ID . ') </option>';
171
+ }
172
+
173
+ $output .= '</select>';
174
+ $output .= '</div>';
175
+
176
+ if ( '' !== $value ) {
177
+ $output .= '<div class="form-field-actions">';
178
+ $output .= '<a href="' . get_edit_post_link( $value ) . '" target="_blank" class="" title="Edit">';
179
+ $output .= '<span class="dashicons dashicons-edit"></span>';
180
+ $output .= '<span class="">Edit</span>';
181
+ $output .= '</a>';
182
+ $output .= '<a href="' . get_permalink( $value ) . '" target="_blank" class="" title="View">';
183
+ $output .= '<span class="dashicons dashicons-visibility"></span>';
184
+ $output .= '<span class="">View</span>';
185
+ $output .= '</a>';
186
+ $output .= '</div>';
187
+ }
188
+
189
+ $output .= '<div class="form-field-desc">';
190
+ /* translators: %s: link */
191
+ $output .= '<p>' . sprintf( __( 'Be sure not to add any product in above selected Global Checkout step. Please read information about how to set up Global Checkout %1$shere%2$s.', 'cartflows' ), '<a href="https://cartflows.com/docs/global-checkout/" target="_blank">', '</a>' ) . '</p>';
192
+ $output .= '</div>';
193
+
194
+ $output .= '</div>';
195
+
196
+ return $output;
197
+ }
198
+ }
classes/class-cartflows-admin.php CHANGED
@@ -206,6 +206,50 @@ class Cartflows_Admin {
206
  } // End if statement.
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  /**
210
  * Check is cartflows admin.
211
  *
@@ -397,6 +441,7 @@ class Cartflows_Admin {
397
  }
398
 
399
  self::save_common_settings();
 
400
 
401
  // Let extensions hook into saving.
402
  do_action( 'cartflows_admin_settings_save' );
206
  } // End if statement.
207
  }
208
 
209
+ /**
210
+ * Save Debug Setting options.
211
+ *
212
+ * @since 1.1.14
213
+ */
214
+ static public function save_debug_settings() {
215
+
216
+ if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( $_POST['cartflows-debug-settings-nonce'], 'cartflows-debug-settings' ) ) {
217
+
218
+ $url = $_SERVER['REQUEST_URI'];
219
+ $input_settings = array();
220
+ $new_settings = array();
221
+
222
+ if ( isset( $_POST['_cartflows_debug_data'] ) ) {
223
+
224
+ $input_settings = $_POST['_cartflows_debug_data'];
225
+
226
+ // Loop through the input and sanitize each of the values.
227
+ foreach ( $input_settings as $key => $val ) {
228
+
229
+ if ( is_array( $val ) ) {
230
+ foreach ( $val as $k => $v ) {
231
+ $new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
232
+ }
233
+ } else {
234
+ $new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
235
+ }
236
+ }
237
+ }
238
+
239
+ Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, true );
240
+
241
+ $query = array(
242
+ 'message' => 'saved',
243
+ );
244
+
245
+ $redirect_to = add_query_arg( $query, $url );
246
+
247
+ wp_redirect( $redirect_to );
248
+ exit;
249
+
250
+ }
251
+ }
252
+
253
  /**
254
  * Check is cartflows admin.
255
  *
441
  }
442
 
443
  self::save_common_settings();
444
+ self::save_debug_settings();
445
 
446
  // Let extensions hook into saving.
447
  do_action( 'cartflows_admin_settings_save' );
classes/class-cartflows-api.php CHANGED
@@ -1,381 +1,381 @@
1
- <?php
2
- /**
3
- * CartFlows API
4
- *
5
- * @package CartFlows
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! class_exists( 'CartFlows_API' ) ) :
10
-
11
- /**
12
- * CartFlows API
13
- *
14
- * @since 1.0.0
15
- */
16
- class CartFlows_API {
17
-
18
- /**
19
- * Instance
20
- *
21
- * @access private
22
- * @var object Class object.
23
- * @since 1.0.0
24
- */
25
- private static $instance;
26
-
27
- /**
28
- * Initiator
29
- *
30
- * @since 1.0.0
31
- * @return object initialized object of class.
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- *
43
- * @since 1.0.0
44
- */
45
- public function __construct() {
46
- }
47
-
48
- /**
49
- * Get site URL.
50
- *
51
- * @since 1.0.0
52
- *
53
- * @return string Site URL.
54
- */
55
- public static function get_site_url() {
56
- return apply_filters( 'cartflows_templates_url', CARTFLOWS_TEMPLATES_URL );
57
- }
58
-
59
- /**
60
- * Get Client Site Templates Rest API URL.
61
- *
62
- * @since 1.0.0
63
- *
64
- * @return string API site URL.
65
- */
66
- public static function get_step_endpoint_url() {
67
- return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_STEP_POST_TYPE . '/';
68
- }
69
-
70
- /**
71
- * Get Client Site Category Rest API URL.
72
- *
73
- * @since 1.0.0
74
- *
75
- * @return string API site URL.
76
- */
77
- public static function get_category_endpoint_url() {
78
- return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER . '/';
79
- }
80
-
81
- /**
82
- * Get API request URL.
83
- *
84
- * @since 1.0.0
85
- *
86
- * @param string $api_base base of api request.
87
- * @return string API site URL.
88
- */
89
- public static function get_request_api_url( $api_base = '' ) {
90
- return self::get_site_url() . 'wp-json/' . CARTFLOWS_STEP_POST_TYPE . '/v1/' . $api_base;
91
- }
92
-
93
- /**
94
- * License Args.
95
- *
96
- * @return array License arguments.
97
- */
98
- public static function get_licence_args() {
99
- return apply_filters( 'cartflows_licence_args', array() );
100
- }
101
-
102
- /**
103
- * Get single demo.
104
- *
105
- * @since 1.0.0
106
- *
107
- * @param string $site_id Template ID of the site.
108
- * @return array Template data.
109
- */
110
- public static function get_template( $site_id ) {
111
- // @codingStandardsIgnoreStart
112
- $request_params = array(
113
- 'licence_args' => self::get_licence_args(),
114
- '_fields' => 'id,slug,status,type,link,title,featured_media,template,cartflows_step_page_builder,cartflows_step_type,cartflows_step_flow,featured_image_url,licence_status,flow_type,step_type,page_builder,divi_content,post_meta',
115
- );
116
- // @codingStandardsIgnoreEnd
117
-
118
- $url = add_query_arg( $request_params, self::get_step_endpoint_url() . $site_id );
119
-
120
- $api_args = array(
121
- 'timeout' => 15,
122
- );
123
-
124
- $response = self::remote_get( $url, $api_args );
125
-
126
- if ( $response['success'] ) {
127
- $template = $response['data'];
128
- return array(
129
- 'title' => ( isset( $template['title']->rendered ) ) ? $template['title']->rendered : '',
130
- 'post_meta' => ( isset( $template['post_meta'] ) ) ? $template['post_meta'] : '',
131
- 'data' => $template,
132
- 'divi_content' => isset( $response['data']['divi_content'] ) ? $response['data']['divi_content'] : '',
133
- 'message' => $response['message'], // __( 'Your API Key is not valid. Please add valid API Key.', 'cartflows' ),
134
- 'success' => $response['success'],
135
- );
136
- }
137
-
138
- return array(
139
- 'title' => '',
140
- 'post_meta' => array(),
141
- 'message' => $response['message'],
142
- 'data' => $response['data'],
143
- 'divi_content' => '',
144
- 'success' => $response['success'],
145
- );
146
- }
147
-
148
- /**
149
- * Get Cloud Templates
150
- *
151
- * @since 1.0.0
152
- *
153
- * @param array $args For selecting the demos (Search terms, pagination etc).
154
- * @return array CartFlows list.
155
- */
156
- public static function get_templates( $args = array() ) {
157
-
158
- $request_params = wp_parse_args(
159
- $args,
160
- array(
161
- 'page' => '1',
162
- 'per_page' => '15',
163
- )
164
- );
165
-
166
- $url = add_query_arg( $request_params, self::get_step_endpoint_url() );
167
-
168
- $api_args = array(
169
- 'timeout' => 15,
170
- );
171
-
172
- $response = self::remote_get( $url, $api_args );
173
-
174
- if ( $response['success'] ) {
175
- $templates_data = $response['data'];
176
- $templates = array();
177
- foreach ( $templates_data as $key => $template ) {
178
-
179
- if ( ! isset( $template->id ) ) {
180
- continue;
181
- }
182
-
183
- $templates[ $key ]['id'] = isset( $template->id ) ? esc_attr( $template->id ) : '';
184
- $templates[ $key ]['slug'] = isset( $template->slug ) ? esc_attr( $template->slug ) : '';
185
- $templates[ $key ]['link'] = isset( $template->link ) ? esc_url( $template->link ) : '';
186
- $templates[ $key ]['date'] = isset( $template->date ) ? esc_attr( $template->date ) : '';
187
- $templates[ $key ]['title'] = isset( $template->title->rendered ) ? esc_attr( $template->title->rendered ) : '';
188
- $templates[ $key ]['featured_image_url'] = isset( $template->featured_image_url ) ? esc_url( $template->featured_image_url ) : '';
189
- $templates[ $key ]['content'] = isset( $template->content->rendered ) ? $template->content->rendered : '';
190
- $templates[ $key ]['divi_content'] = isset( $template->divi_content ) ? $template->divi_content : '';
191
- $templates[ $key ]['post_meta'] = isset( $template->post_meta ) ? $template->post_meta : '';
192
- }
193
-
194
- return array(
195
- 'templates' => $templates,
196
- 'templates_count' => $response['count'],
197
- 'data' => $response,
198
- );
199
- }
200
-
201
- return array(
202
- 'templates' => array(),
203
- 'templates_count' => 0,
204
- 'data' => $response,
205
- );
206
-
207
- }
208
-
209
- /**
210
- * Get categories.
211
- *
212
- * @since 1.0.0
213
- * @param array $args Arguments.
214
- * @return array Category data.
215
- */
216
- public static function get_categories( $args = array() ) {
217
-
218
- $request_params = apply_filters(
219
- 'cartflows_categories_api_params',
220
- wp_parse_args(
221
- $args,
222
- array(
223
- 'page' => '1',
224
- 'per_page' => '15',
225
- )
226
- )
227
- );
228
-
229
- $url = add_query_arg( $request_params, self::get_category_endpoint_url() );
230
-
231
- $api_args = apply_filters(
232
- 'cartflows_api_args',
233
- array(
234
- 'timeout' => 15,
235
- )
236
- );
237
-
238
- $response = self::remote_get( $url, $api_args );
239
-
240
- if ( $response['success'] ) {
241
- $categories_data = $response['data'];
242
- $categories = array();
243
-
244
- foreach ( $categories_data as $key => $category ) {
245
- if ( isset( $category->count ) && ! empty( $category->count ) ) {
246
- $categories[] = array(
247
- 'id' => isset( $category->id ) ? absint( $category->id ) : 0,
248
- 'count' => isset( $category->count ) ? absint( $category->count ) : 0,
249
- 'description' => isset( $category->description ) ? $category->description : '',
250
- 'link' => isset( $category->link ) ? esc_url( $category->link ) : '',
251
- 'name' => isset( $category->name ) ? $category->name : '',
252
- 'slug' => isset( $category->slug ) ? sanitize_text_field( $category->slug ) : '',
253
- 'taxonomy' => isset( $category->taxonomy ) ? $category->taxonomy : '',
254
- 'parent' => isset( $category->parent ) ? $category->parent : '',
255
- );
256
- }
257
- }
258
-
259
- return array(
260
- 'categories' => $categories,
261
- 'categories_count' => $response['count'],
262
- 'data' => $response,
263
- );
264
- }
265
-
266
- return array(
267
- 'categories' => array(),
268
- 'categories_count' => 0,
269
- 'data' => $response,
270
- );
271
- }
272
-
273
- /**
274
- * Remote GET API Request
275
- *
276
- * @since 1.0.0
277
- *
278
- * @param string $url Target server API URL.
279
- * @param array $args Array of arguments for the API request.
280
- * @return mixed Return the API request result.
281
- */
282
- public static function remote_get( $url = '', $args = array() ) {
283
- $request = wp_remote_get( $url, $args );
284
- return self::request( $request );
285
- }
286
-
287
- /**
288
- * Remote POST API Request
289
- *
290
- * @since 1.0.0
291
- *
292
- * @param string $url Target server API URL.
293
- * @param array $args Array of arguments for the API request.
294
- * @return mixed Return the API request result.
295
- */
296
- public static function remote_post( $url = '', $args = array() ) {
297
- $request = wp_remote_post( $url, $args );
298
-
299
- return self::request( $request );
300
- }
301
-
302
- /**
303
- * Site API Request
304
- *
305
- * @since 1.0.0
306
- *
307
- * @param boolean $api_base Target server API URL.
308
- * @param array $args Array of arguments for the API request.
309
- * @return mixed Return the API request result.
310
- */
311
- public static function site_request( $api_base = '', $args = array() ) {
312
-
313
- $api_url = self::get_request_api_url( $api_base );
314
-
315
- return self::remote_post( $api_url, $args );
316
- }
317
-
318
- /**
319
- * API Request
320
- *
321
- * Handle the API request and return the result.
322
- *
323
- * @since 1.0.0
324
- *
325
- * @param array $request Array of arguments for the API request.
326
- * @return mixed Return the API request result.
327
- */
328
- public static function request( $request ) {
329
-
330
- // Is WP Error?
331
- if ( is_wp_error( $request ) ) {
332
- return array(
333
- 'success' => false,
334
- 'message' => $request->get_error_message(),
335
- 'data' => $request,
336
- 'count' => 0,
337
- );
338
- }
339
-
340
- // Invalid response code.
341
- if ( wp_remote_retrieve_response_code( $request ) != 200 ) {
342
- return array(
343
- 'success' => false,
344
- 'message' => $request['response'],
345
- 'data' => $request,
346
- 'count' => 0,
347
- );
348
- }
349
-
350
- // Get body data.
351
- $body = wp_remote_retrieve_body( $request );
352
-
353
- // Is WP Error?
354
- if ( is_wp_error( $body ) ) {
355
- return array(
356
- 'success' => false,
357
- 'message' => $body->get_error_message(),
358
- 'data' => $request,
359
- 'count' => 0,
360
- );
361
- }
362
-
363
- // Decode body content.
364
- $body_decoded = json_decode( $body );
365
-
366
- return array(
367
- 'success' => true,
368
- 'message' => __( 'Request successfully processed!', 'cartflows' ),
369
- 'data' => (array) $body_decoded,
370
- 'count' => wp_remote_retrieve_header( $request, 'x-wp-total' ),
371
- );
372
- }
373
-
374
- }
375
-
376
- /**
377
- * Initialize class object with 'get_instance()' method
378
- */
379
- CartFlows_API::get_instance();
380
-
381
- endif;
1
+ <?php
2
+ /**
3
+ * CartFlows API
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'CartFlows_API' ) ) :
10
+
11
+ /**
12
+ * CartFlows API
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class CartFlows_API {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @access private
22
+ * @var object Class object.
23
+ * @since 1.0.0
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.0
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0.0
44
+ */
45
+ public function __construct() {
46
+ }
47
+
48
+ /**
49
+ * Get site URL.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @return string Site URL.
54
+ */
55
+ public static function get_site_url() {
56
+ return apply_filters( 'cartflows_templates_url', CARTFLOWS_TEMPLATES_URL );
57
+ }
58
+
59
+ /**
60
+ * Get Client Site Templates Rest API URL.
61
+ *
62
+ * @since 1.0.0
63
+ *
64
+ * @return string API site URL.
65
+ */
66
+ public static function get_step_endpoint_url() {
67
+ return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_STEP_POST_TYPE . '/';
68
+ }
69
+
70
+ /**
71
+ * Get Client Site Category Rest API URL.
72
+ *
73
+ * @since 1.0.0
74
+ *
75
+ * @return string API site URL.
76
+ */
77
+ public static function get_category_endpoint_url() {
78
+ return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER . '/';
79
+ }
80
+
81
+ /**
82
+ * Get API request URL.
83
+ *
84
+ * @since 1.0.0
85
+ *
86
+ * @param string $api_base base of api request.
87
+ * @return string API site URL.
88
+ */
89
+ public static function get_request_api_url( $api_base = '' ) {
90
+ return self::get_site_url() . 'wp-json/' . CARTFLOWS_STEP_POST_TYPE . '/v1/' . $api_base;
91
+ }
92
+
93
+ /**
94
+ * License Args.
95
+ *
96
+ * @return array License arguments.
97
+ */
98
+ public static function get_licence_args() {
99
+ return apply_filters( 'cartflows_licence_args', array() );
100
+ }
101
+
102
+ /**
103
+ * Get single demo.
104
+ *
105
+ * @since 1.0.0
106
+ *
107
+ * @param string $site_id Template ID of the site.
108
+ * @return array Template data.
109
+ */
110
+ public static function get_template( $site_id ) {
111
+ // @codingStandardsIgnoreStart
112
+ $request_params = array(
113
+ 'licence_args' => self::get_licence_args(),
114
+ '_fields' => 'id,slug,status,type,link,title,featured_media,template,cartflows_step_page_builder,cartflows_step_type,cartflows_step_flow,featured_image_url,licence_status,flow_type,step_type,page_builder,divi_content,post_meta',
115
+ );
116
+ // @codingStandardsIgnoreEnd
117
+
118
+ $url = add_query_arg( $request_params, self::get_step_endpoint_url() . $site_id );
119
+
120
+ $api_args = array(
121
+ 'timeout' => 15,
122
+ );
123
+
124
+ $response = self::remote_get( $url, $api_args );
125
+
126
+ if ( $response['success'] ) {
127
+ $template = $response['data'];
128
+ return array(
129
+ 'title' => ( isset( $template['title']->rendered ) ) ? $template['title']->rendered : '',
130
+ 'post_meta' => ( isset( $template['post_meta'] ) ) ? $template['post_meta'] : '',
131
+ 'data' => $template,
132
+ 'divi_content' => isset( $response['data']['divi_content'] ) ? $response['data']['divi_content'] : '',
133
+ 'message' => $response['message'], // __( 'Your API Key is not valid. Please add valid API Key.', 'cartflows' ),
134
+ 'success' => $response['success'],
135
+ );
136
+ }
137
+
138
+ return array(
139
+ 'title' => '',
140
+ 'post_meta' => array(),
141
+ 'message' => $response['message'],
142
+ 'data' => $response['data'],
143
+ 'divi_content' => '',
144
+ 'success' => $response['success'],
145
+ );
146
+ }
147
+
148
+ /**
149
+ * Get Cloud Templates
150
+ *
151
+ * @since 1.0.0
152
+ *
153
+ * @param array $args For selecting the demos (Search terms, pagination etc).
154
+ * @return array CartFlows list.
155
+ */
156
+ public static function get_templates( $args = array() ) {
157
+
158
+ $request_params = wp_parse_args(
159
+ $args,
160
+ array(
161
+ 'page' => '1',
162
+ 'per_page' => '15',
163
+ )
164
+ );
165
+
166
+ $url = add_query_arg( $request_params, self::get_step_endpoint_url() );
167
+
168
+ $api_args = array(
169
+ 'timeout' => 15,
170
+ );
171
+
172
+ $response = self::remote_get( $url, $api_args );
173
+
174
+ if ( $response['success'] ) {
175
+ $templates_data = $response['data'];
176
+ $templates = array();
177
+ foreach ( $templates_data as $key => $template ) {
178
+
179
+ if ( ! isset( $template->id ) ) {
180
+ continue;
181
+ }
182
+
183
+ $templates[ $key ]['id'] = isset( $template->id ) ? esc_attr( $template->id ) : '';
184
+ $templates[ $key ]['slug'] = isset( $template->slug ) ? esc_attr( $template->slug ) : '';
185
+ $templates[ $key ]['link'] = isset( $template->link ) ? esc_url( $template->link ) : '';
186
+ $templates[ $key ]['date'] = isset( $template->date ) ? esc_attr( $template->date ) : '';
187
+ $templates[ $key ]['title'] = isset( $template->title->rendered ) ? esc_attr( $template->title->rendered ) : '';
188
+ $templates[ $key ]['featured_image_url'] = isset( $template->featured_image_url ) ? esc_url( $template->featured_image_url ) : '';
189
+ $templates[ $key ]['content'] = isset( $template->content->rendered ) ? $template->content->rendered : '';
190
+ $templates[ $key ]['divi_content'] = isset( $template->divi_content ) ? $template->divi_content : '';
191
+ $templates[ $key ]['post_meta'] = isset( $template->post_meta ) ? $template->post_meta : '';
192
+ }
193
+
194
+ return array(
195
+ 'templates' => $templates,
196
+ 'templates_count' => $response['count'],
197
+ 'data' => $response,
198
+ );
199
+ }
200
+
201
+ return array(
202
+ 'templates' => array(),
203
+ 'templates_count' => 0,
204
+ 'data' => $response,
205
+ );
206
+
207
+ }
208
+
209
+ /**
210
+ * Get categories.
211
+ *
212
+ * @since 1.0.0
213
+ * @param array $args Arguments.
214
+ * @return array Category data.
215
+ */
216
+ public static function get_categories( $args = array() ) {
217
+
218
+ $request_params = apply_filters(
219
+ 'cartflows_categories_api_params',
220
+ wp_parse_args(
221
+ $args,
222
+ array(
223
+ 'page' => '1',
224
+ 'per_page' => '15',
225
+ )
226
+ )
227
+ );
228
+
229
+ $url = add_query_arg( $request_params, self::get_category_endpoint_url() );
230
+
231
+ $api_args = apply_filters(
232
+ 'cartflows_api_args',
233
+ array(
234
+ 'timeout' => 15,
235
+ )
236
+ );
237
+
238
+ $response = self::remote_get( $url, $api_args );
239
+
240
+ if ( $response['success'] ) {
241
+ $categories_data = $response['data'];
242
+ $categories = array();
243
+
244
+ foreach ( $categories_data as $key => $category ) {
245
+ if ( isset( $category->count ) && ! empty( $category->count ) ) {
246
+ $categories[] = array(
247
+ 'id' => isset( $category->id ) ? absint( $category->id ) : 0,
248
+ 'count' => isset( $category->count ) ? absint( $category->count ) : 0,
249
+ 'description' => isset( $category->description ) ? $category->description : '',
250
+ 'link' => isset( $category->link ) ? esc_url( $category->link ) : '',
251
+ 'name' => isset( $category->name ) ? $category->name : '',
252
+ 'slug' => isset( $category->slug ) ? sanitize_text_field( $category->slug ) : '',
253
+ 'taxonomy' => isset( $category->taxonomy ) ? $category->taxonomy : '',
254
+ 'parent' => isset( $category->parent ) ? $category->parent : '',
255
+ );
256
+ }
257
+ }
258
+
259
+ return array(
260
+ 'categories' => $categories,
261
+ 'categories_count' => $response['count'],
262
+ 'data' => $response,
263
+ );
264
+ }
265
+
266
+ return array(
267
+ 'categories' => array(),
268
+ 'categories_count' => 0,
269
+ 'data' => $response,
270
+ );
271
+ }
272
+
273
+ /**
274
+ * Remote GET API Request
275
+ *
276
+ * @since 1.0.0
277
+ *
278
+ * @param string $url Target server API URL.
279
+ * @param array $args Array of arguments for the API request.
280
+ * @return mixed Return the API request result.
281
+ */
282
+ public static function remote_get( $url = '', $args = array() ) {
283
+ $request = wp_remote_get( $url, $args );
284
+ return self::request( $request );
285
+ }
286
+
287
+ /**
288
+ * Remote POST API Request
289
+ *
290
+ * @since 1.0.0
291
+ *
292
+ * @param string $url Target server API URL.
293
+ * @param array $args Array of arguments for the API request.
294
+ * @return mixed Return the API request result.
295
+ */
296
+ public static function remote_post( $url = '', $args = array() ) {
297
+ $request = wp_remote_post( $url, $args );
298
+
299
+ return self::request( $request );
300
+ }
301
+
302
+ /**
303
+ * Site API Request
304
+ *
305
+ * @since 1.0.0
306
+ *
307
+ * @param boolean $api_base Target server API URL.
308
+ * @param array $args Array of arguments for the API request.
309
+ * @return mixed Return the API request result.
310
+ */
311
+ public static function site_request( $api_base = '', $args = array() ) {
312
+
313
+ $api_url = self::get_request_api_url( $api_base );
314
+
315
+ return self::remote_post( $api_url, $args );
316
+ }
317
+
318
+ /**
319
+ * API Request
320
+ *
321
+ * Handle the API request and return the result.
322
+ *
323
+ * @since 1.0.0
324
+ *
325
+ * @param array $request Array of arguments for the API request.
326
+ * @return mixed Return the API request result.
327
+ */
328
+ public static function request( $request ) {
329
+
330
+ // Is WP Error?
331
+ if ( is_wp_error( $request ) ) {
332
+ return array(
333
+ 'success' => false,
334
+ 'message' => $request->get_error_message(),
335
+ 'data' => $request,
336
+ 'count' => 0,
337
+ );
338
+ }
339
+
340
+ // Invalid response code.
341
+ if ( wp_remote_retrieve_response_code( $request ) != 200 ) {
342
+ return array(
343
+ 'success' => false,
344
+ 'message' => $request['response'],
345
+ 'data' => $request,
346
+ 'count' => 0,
347
+ );
348
+ }
349
+
350
+ // Get body data.
351
+ $body = wp_remote_retrieve_body( $request );
352
+
353
+ // Is WP Error?
354
+ if ( is_wp_error( $body ) ) {
355
+ return array(
356
+ 'success' => false,
357
+ 'message' => $body->get_error_message(),
358
+ 'data' => $request,
359
+ 'count' => 0,
360
+ );
361
+ }
362
+
363
+ // Decode body content.
364
+ $body_decoded = json_decode( $body );
365
+
366
+ return array(
367
+ 'success' => true,
368
+ 'message' => __( 'Request successfully processed!', 'cartflows' ),
369
+ 'data' => (array) $body_decoded,
370
+ 'count' => wp_remote_retrieve_header( $request, 'x-wp-total' ),
371
+ );
372
+ }
373
+
374
+ }
375
+
376
+ /**
377
+ * Initialize class object with 'get_instance()' method
378
+ */
379
+ CartFlows_API::get_instance();
380
+
381
+ endif;
classes/class-cartflows-bb-compatibility.php CHANGED
@@ -1,76 +1,76 @@
1
- <?php
2
- /**
3
- * Beaver Builder page builder compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_BB_Compatibility' ) ) :
9
-
10
- /**
11
- * Class for Beaver Builder page builder compatibility
12
- */
13
- class Cartflows_BB_Compatibility {
14
-
15
- /**
16
- * Member Variable
17
- *
18
- * @var instance
19
- */
20
- private static $instance;
21
-
22
- /**
23
- * Initiator
24
- *
25
- * @since 1.1.4
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
- * @since 1.1.4
38
- */
39
- public function __construct() {
40
- add_filter( 'fl_builder_post_types', array( $this, 'post_types' ) );
41
- add_action( 'admin_init', array( $this, 'disable_rediraction' ), 99 );
42
- }
43
-
44
- /**
45
- * Disable Beaver Builder Redirection after plugin install.
46
- *
47
- * @since 1.1.4
48
- *
49
- * @return void
50
- */
51
- function disable_rediraction() {
52
- delete_transient( '_fl_builder_activation_admin_notice' );
53
- }
54
-
55
- /**
56
- * Add beaver builder support for step post type.
57
- *
58
- * @since 1.1.4
59
- *
60
- * @param array $post_types container Post types.
61
- * @return array
62
- */
63
- public function post_types( $post_types ) {
64
-
65
- $post_types[] = 'cartflows_step';
66
-
67
- return $post_types;
68
- }
69
- }
70
-
71
- /**
72
- * Kicking this off by calling 'get_instance()' method
73
- */
74
- Cartflows_BB_Compatibility::get_instance();
75
-
76
- endif;
1
+ <?php
2
+ /**
3
+ * Beaver Builder page builder compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_BB_Compatibility' ) ) :
9
+
10
+ /**
11
+ * Class for Beaver Builder page builder compatibility
12
+ */
13
+ class Cartflows_BB_Compatibility {
14
+
15
+ /**
16
+ * Member Variable
17
+ *
18
+ * @var instance
19
+ */
20
+ private static $instance;
21
+
22
+ /**
23
+ * Initiator
24
+ *
25
+ * @since 1.1.4
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
+ * @since 1.1.4
38
+ */
39
+ public function __construct() {
40
+ add_filter( 'fl_builder_post_types', array( $this, 'post_types' ) );
41
+ add_action( 'admin_init', array( $this, 'disable_rediraction' ), 99 );
42
+ }
43
+
44
+ /**
45
+ * Disable Beaver Builder Redirection after plugin install.
46
+ *
47
+ * @since 1.1.4
48
+ *
49
+ * @return void
50
+ */
51
+ function disable_rediraction() {
52
+ delete_transient( '_fl_builder_activation_admin_notice' );
53
+ }
54
+
55
+ /**
56
+ * Add beaver builder support for step post type.
57
+ *
58
+ * @since 1.1.4
59
+ *
60
+ * @param array $post_types container Post types.
61
+ * @return array
62
+ */
63
+ public function post_types( $post_types ) {
64
+
65
+ $post_types[] = 'cartflows_step';
66
+
67
+ return $post_types;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Kicking this off by calling 'get_instance()' method
73
+ */
74
+ Cartflows_BB_Compatibility::get_instance();
75
+
76
+ endif;
classes/class-cartflows-cloning.php CHANGED
@@ -1,436 +1,436 @@
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
- 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( $_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) ";
132
-
133
- foreach ( $post_meta_infos as $meta_info ) {
134
-
135
- $meta_key = $meta_info->meta_key;
136
-
137
- if ( '_wp_old_slug' === $meta_key ) {
138
- continue;
139
- }
140
-
141
- $meta_value = addslashes( $meta_info->meta_value );
142
-
143
- $sql_query_sel[] = "SELECT $new_flow_id, '$meta_key', '$meta_value'";
144
- }
145
-
146
- $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
147
-
148
- // @codingStandardsIgnoreStart
149
- $wpdb->query( $sql_query );
150
- // @codingStandardsIgnoreEnd
151
- }
152
-
153
- /* Steps Cloning */
154
- $flow_steps = get_post_meta( $post_id, 'wcf-steps', true );
155
- $new_flow_steps = array();
156
-
157
- if ( is_array( $flow_steps ) && ! empty( $flow_steps ) ) {
158
-
159
- foreach ( $flow_steps as $index => $step_data ) {
160
-
161
- $step_id = $step_data['id'];
162
- $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
163
-
164
- $step_object = get_post( $step_id );
165
-
166
- /**
167
- * New step post data array
168
- */
169
- $step_args = array(
170
- 'comment_status' => $step_object->comment_status,
171
- 'ping_status' => $step_object->ping_status,
172
- 'post_author' => $new_post_author,
173
- 'post_content' => $step_object->post_content,
174
- 'post_excerpt' => $step_object->post_excerpt,
175
- 'post_name' => $step_object->post_name,
176
- 'post_parent' => $step_object->post_parent,
177
- 'post_password' => $step_object->post_password,
178
- 'post_status' => $step_object->post_status,
179
- 'post_title' => $step_object->post_title,
180
- 'post_type' => $step_object->post_type,
181
- 'to_ping' => $step_object->to_ping,
182
- 'menu_order' => $step_object->menu_order,
183
- );
184
-
185
- /**
186
- * Insert the post
187
- */
188
- $new_step_id = wp_insert_post( $step_args );
189
-
190
- /**
191
- * Duplicate all step meta
192
- */
193
- // @codingStandardsIgnoreStart
194
- $post_meta_infos = $wpdb->get_results(
195
- "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$step_id"
196
- );
197
- // @codingStandardsIgnoreEnd
198
-
199
- if ( ! empty( $post_meta_infos ) ) {
200
-
201
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
202
-
203
- foreach ( $post_meta_infos as $meta_info ) {
204
-
205
- $meta_key = $meta_info->meta_key;
206
-
207
- if ( '_wp_old_slug' === $meta_key ) {
208
- continue;
209
- }
210
-
211
- $meta_value = addslashes( $meta_info->meta_value );
212
-
213
- $sql_query_sel[] = "SELECT $new_step_id, '$meta_key', '$meta_value'";
214
- }
215
-
216
- $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
217
-
218
- // @codingStandardsIgnoreStart
219
- $wpdb->query( $sql_query );
220
- // @codingStandardsIgnoreEnd
221
- }
222
-
223
- // insert post meta.
224
- update_post_meta( $new_step_id, 'wcf-flow-id', $new_flow_id );
225
- update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
226
-
227
- wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
228
- wp_set_object_terms( $new_step_id, 'flow-' . $new_flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
229
-
230
- /* Add New Flow Steps */
231
- $new_flow_steps[] = array(
232
- 'id' => $new_step_id,
233
- 'title' => $step_object->post_title,
234
- 'type' => $step_type,
235
- );
236
- }
237
- }
238
-
239
- /* Update New Flow Step Post Meta */
240
- update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
241
-
242
- /* Clear Page Builder Cache */
243
- $this->clear_cache();
244
-
245
- /**
246
- * Redirect to the new flow edit screen
247
- */
248
- wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_flow_id ) );
249
- exit;
250
- } else {
251
- wp_die( 'Post creation failed, could not find original post: ' . $post_id );
252
- }
253
- }
254
-
255
- /**
256
- * Clone step with its meta.
257
- */
258
- function clone_step() {
259
-
260
- global $wpdb;
261
-
262
- if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_step' === $_REQUEST['action'] ) ) ) {
263
- wp_die( 'No post to duplicate has been supplied!' );
264
- }
265
-
266
- /*
267
- * Nonce verification
268
- */
269
- if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( $_GET['step_clone_nonce'], 'step_clone' ) ) {
270
- return;
271
- }
272
-
273
- /**
274
- * Get the original post id
275
- */
276
- $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
277
-
278
- /**
279
- * And all the original post data then
280
- */
281
- $post = get_post( $post_id );
282
-
283
- /**
284
- * Assign current user to be the new post author
285
- */
286
- $current_user = wp_get_current_user();
287
- $new_post_author = $current_user->ID;
288
-
289
- /**
290
- * If post data exists, create the post duplicate
291
- */
292
- if ( isset( $post ) && null !== $post ) {
293
-
294
- /**
295
- * New post data array
296
- */
297
- $args = array(
298
- 'comment_status' => $post->comment_status,
299
- 'ping_status' => $post->ping_status,
300
- 'post_author' => $new_post_author,
301
- 'post_content' => $post->post_content,
302
- 'post_excerpt' => $post->post_excerpt,
303
- 'post_name' => $post->post_name,
304
- 'post_parent' => $post->post_parent,
305
- 'post_password' => $post->post_password,
306
- 'post_status' => $post->post_status,
307
- 'post_title' => $post->post_title . ' Clone',
308
- 'post_type' => $post->post_type,
309
- 'to_ping' => $post->to_ping,
310
- 'menu_order' => $post->menu_order,
311
- );
312
-
313
- /**
314
- * Insert the post
315
- */
316
- $new_step_id = wp_insert_post( $args );
317
-
318
- /**
319
- * Get all current post terms ad set them to the new post
320
- */
321
- // returns array of taxonomy names for post type, ex array("category", "post_tag");.
322
- $taxonomies = get_object_taxonomies( $post->post_type );
323
-
324
- foreach ( $taxonomies as $taxonomy ) {
325
-
326
- $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
327
-
328
- wp_set_object_terms( $new_step_id, $post_terms, $taxonomy, false );
329
- }
330
-
331
- /**
332
- * Duplicate all post meta just in two SQL queries
333
- */
334
- // @codingStandardsIgnoreStart
335
- $post_meta_infos = $wpdb->get_results(
336
- "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
337
- );
338
- // @codingStandardsIgnoreEnd
339
-
340
- if ( ! empty( $post_meta_infos ) ) {
341
-
342
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
343
-
344
- foreach ( $post_meta_infos as $meta_info ) {
345
-
346
- $meta_key = $meta_info->meta_key;
347
-
348
- if ( '_wp_old_slug' === $meta_key ) {
349
- continue;
350
- }
351
-
352
- $meta_value = addslashes( $meta_info->meta_value );
353
-
354
- $sql_query_sel[] = "SELECT $new_step_id, '$meta_key', '$meta_value'";
355
- }
356
-
357
- $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
358
-
359
- // @codingStandardsIgnoreStart
360
- $wpdb->query( $sql_query );
361
- // @codingStandardsIgnoreEnd
362
- }
363
-
364
- $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
365
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
366
- $step_type = get_post_meta( $post_id, 'wcf-step-type', true );
367
-
368
- if ( ! is_array( $flow_steps ) ) {
369
- $flow_steps = array();
370
- }
371
-
372
- $flow_steps[] = array(
373
- 'id' => $new_step_id,
374
- 'title' => $post->post_title,
375
- 'type' => $step_type,
376
- );
377
-
378
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
379
-
380
- /* Clear Page Builder Cache */
381
- $this->clear_cache();
382
-
383
- /**
384
- * Redirect to the new flow edit screen
385
- */
386
- $redirect_url = add_query_arg( 'highlight-step-id', $new_step_id, get_edit_post_link( $flow_id, 'default' ) );
387
-
388
- wp_redirect( $redirect_url );
389
- exit;
390
- } else {
391
- wp_die( 'Post creation failed, could not find original post: ' . $post_id );
392
- }
393
- }
394
-
395
- /**
396
- * Add the clone link to action list for flows row actions
397
- *
398
- * @param array $actions Actions array.
399
- * @param object $post Post object.
400
- *
401
- * @return array
402
- */
403
- function clone_link( $actions, $post ) {
404
-
405
- if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
406
-
407
- if ( isset( $actions['duplicate'] ) ) { // Duplicate page plugin remove.
408
- unset( $actions['duplicate'] );
409
- }
410
- if ( isset( $actions['edit_as_new_draft'] ) ) { // Duplicate post plugin remove.
411
- unset( $actions['edit_as_new_draft'] );
412
- }
413
-
414
- $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>';
415
- }
416
-
417
- return $actions;
418
- }
419
-
420
- /**
421
- * Clear Page Builder Cache
422
- */
423
- function clear_cache() {
424
-
425
- // Clear 'Elementor' file cache.
426
- if ( class_exists( '\Elementor\Plugin' ) ) {
427
- Elementor\Plugin::$instance->files_manager->clear_cache();
428
- }
429
- }
430
-
431
- }
432
-
433
- /**
434
- * Kicking this off by calling 'get_instance()' method
435
- */
436
- 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
+ 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( $_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) ";
132
+
133
+ foreach ( $post_meta_infos as $meta_info ) {
134
+
135
+ $meta_key = $meta_info->meta_key;
136
+
137
+ if ( '_wp_old_slug' === $meta_key ) {
138
+ continue;
139
+ }
140
+
141
+ $meta_value = addslashes( $meta_info->meta_value );
142
+
143
+ $sql_query_sel[] = "SELECT $new_flow_id, '$meta_key', '$meta_value'";
144
+ }
145
+
146
+ $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
147
+
148
+ // @codingStandardsIgnoreStart
149
+ $wpdb->query( $sql_query );
150
+ // @codingStandardsIgnoreEnd
151
+ }
152
+
153
+ /* Steps Cloning */
154
+ $flow_steps = get_post_meta( $post_id, 'wcf-steps', true );
155
+ $new_flow_steps = array();
156
+
157
+ if ( is_array( $flow_steps ) && ! empty( $flow_steps ) ) {
158
+
159
+ foreach ( $flow_steps as $index => $step_data ) {
160
+
161
+ $step_id = $step_data['id'];
162
+ $step_type = get_post_meta( $step_id, 'wcf-step-type', true );
163
+
164
+ $step_object = get_post( $step_id );
165
+
166
+ /**
167
+ * New step post data array
168
+ */
169
+ $step_args = array(
170
+ 'comment_status' => $step_object->comment_status,
171
+ 'ping_status' => $step_object->ping_status,
172
+ 'post_author' => $new_post_author,
173
+ 'post_content' => $step_object->post_content,
174
+ 'post_excerpt' => $step_object->post_excerpt,
175
+ 'post_name' => $step_object->post_name,
176
+ 'post_parent' => $step_object->post_parent,
177
+ 'post_password' => $step_object->post_password,
178
+ 'post_status' => $step_object->post_status,
179
+ 'post_title' => $step_object->post_title,
180
+ 'post_type' => $step_object->post_type,
181
+ 'to_ping' => $step_object->to_ping,
182
+ 'menu_order' => $step_object->menu_order,
183
+ );
184
+
185
+ /**
186
+ * Insert the post
187
+ */
188
+ $new_step_id = wp_insert_post( $step_args );
189
+
190
+ /**
191
+ * Duplicate all step meta
192
+ */
193
+ // @codingStandardsIgnoreStart
194
+ $post_meta_infos = $wpdb->get_results(
195
+ "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$step_id"
196
+ );
197
+ // @codingStandardsIgnoreEnd
198
+
199
+ if ( ! empty( $post_meta_infos ) ) {
200
+
201
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
202
+
203
+ foreach ( $post_meta_infos as $meta_info ) {
204
+
205
+ $meta_key = $meta_info->meta_key;
206
+
207
+ if ( '_wp_old_slug' === $meta_key ) {
208
+ continue;
209
+ }
210
+
211
+ $meta_value = addslashes( $meta_info->meta_value );
212
+
213
+ $sql_query_sel[] = "SELECT $new_step_id, '$meta_key', '$meta_value'";
214
+ }
215
+
216
+ $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
217
+
218
+ // @codingStandardsIgnoreStart
219
+ $wpdb->query( $sql_query );
220
+ // @codingStandardsIgnoreEnd
221
+ }
222
+
223
+ // insert post meta.
224
+ update_post_meta( $new_step_id, 'wcf-flow-id', $new_flow_id );
225
+ update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
226
+
227
+ wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
228
+ wp_set_object_terms( $new_step_id, 'flow-' . $new_flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
229
+
230
+ /* Add New Flow Steps */
231
+ $new_flow_steps[] = array(
232
+ 'id' => $new_step_id,
233
+ 'title' => $step_object->post_title,
234
+ 'type' => $step_type,
235
+ );
236
+ }
237
+ }
238
+
239
+ /* Update New Flow Step Post Meta */
240
+ update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
241
+
242
+ /* Clear Page Builder Cache */
243
+ $this->clear_cache();
244
+
245
+ /**
246
+ * Redirect to the new flow edit screen
247
+ */
248
+ wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_flow_id ) );
249
+ exit;
250
+ } else {
251
+ wp_die( 'Post creation failed, could not find original post: ' . $post_id );
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Clone step with its meta.
257
+ */
258
+ function clone_step() {
259
+
260
+ global $wpdb;
261
+
262
+ if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_step' === $_REQUEST['action'] ) ) ) {
263
+ wp_die( 'No post to duplicate has been supplied!' );
264
+ }
265
+
266
+ /*
267
+ * Nonce verification
268
+ */
269
+ if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( $_GET['step_clone_nonce'], 'step_clone' ) ) {
270
+ return;
271
+ }
272
+
273
+ /**
274
+ * Get the original post id
275
+ */
276
+ $post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
277
+
278
+ /**
279
+ * And all the original post data then
280
+ */
281
+ $post = get_post( $post_id );
282
+
283
+ /**
284
+ * Assign current user to be the new post author
285
+ */
286
+ $current_user = wp_get_current_user();
287
+ $new_post_author = $current_user->ID;
288
+
289
+ /**
290
+ * If post data exists, create the post duplicate
291
+ */
292
+ if ( isset( $post ) && null !== $post ) {
293
+
294
+ /**
295
+ * New post data array
296
+ */
297
+ $args = array(
298
+ 'comment_status' => $post->comment_status,
299
+ 'ping_status' => $post->ping_status,
300
+ 'post_author' => $new_post_author,
301
+ 'post_content' => $post->post_content,
302
+ 'post_excerpt' => $post->post_excerpt,
303
+ 'post_name' => $post->post_name,
304
+ 'post_parent' => $post->post_parent,
305
+ 'post_password' => $post->post_password,
306
+ 'post_status' => $post->post_status,
307
+ 'post_title' => $post->post_title . ' Clone',
308
+ 'post_type' => $post->post_type,
309
+ 'to_ping' => $post->to_ping,
310
+ 'menu_order' => $post->menu_order,
311
+ );
312
+
313
+ /**
314
+ * Insert the post
315
+ */
316
+ $new_step_id = wp_insert_post( $args );
317
+
318
+ /**
319
+ * Get all current post terms ad set them to the new post
320
+ */
321
+ // returns array of taxonomy names for post type, ex array("category", "post_tag");.
322
+ $taxonomies = get_object_taxonomies( $post->post_type );
323
+
324
+ foreach ( $taxonomies as $taxonomy ) {
325
+
326
+ $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
327
+
328
+ wp_set_object_terms( $new_step_id, $post_terms, $taxonomy, false );
329
+ }
330
+
331
+ /**
332
+ * Duplicate all post meta just in two SQL queries
333
+ */
334
+ // @codingStandardsIgnoreStart
335
+ $post_meta_infos = $wpdb->get_results(
336
+ "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
337
+ );
338
+ // @codingStandardsIgnoreEnd
339
+
340
+ if ( ! empty( $post_meta_infos ) ) {
341
+
342
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
343
+
344
+ foreach ( $post_meta_infos as $meta_info ) {
345
+
346
+ $meta_key = $meta_info->meta_key;
347
+
348
+ if ( '_wp_old_slug' === $meta_key ) {
349
+ continue;
350
+ }
351
+
352
+ $meta_value = addslashes( $meta_info->meta_value );
353
+
354
+ $sql_query_sel[] = "SELECT $new_step_id, '$meta_key', '$meta_value'";
355
+ }
356
+
357
+ $sql_query .= implode( ' UNION ALL ', $sql_query_sel );
358
+
359
+ // @codingStandardsIgnoreStart
360
+ $wpdb->query( $sql_query );
361
+ // @codingStandardsIgnoreEnd
362
+ }
363
+
364
+ $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
365
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
366
+ $step_type = get_post_meta( $post_id, 'wcf-step-type', true );
367
+
368
+ if ( ! is_array( $flow_steps ) ) {
369
+ $flow_steps = array();
370
+ }
371
+
372
+ $flow_steps[] = array(
373
+ 'id' => $new_step_id,
374
+ 'title' => $post->post_title,
375
+ 'type' => $step_type,
376
+ );
377
+
378
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
379
+
380
+ /* Clear Page Builder Cache */
381
+ $this->clear_cache();
382
+
383
+ /**
384
+ * Redirect to the new flow edit screen
385
+ */
386
+ $redirect_url = add_query_arg( 'highlight-step-id', $new_step_id, get_edit_post_link( $flow_id, 'default' ) );
387
+
388
+ wp_redirect( $redirect_url );
389
+ exit;
390
+ } else {
391
+ wp_die( 'Post creation failed, could not find original post: ' . $post_id );
392
+ }
393
+ }
394
+
395
+ /**
396
+ * Add the clone link to action list for flows row actions
397
+ *
398
+ * @param array $actions Actions array.
399
+ * @param object $post Post object.
400
+ *
401
+ * @return array
402
+ */
403
+ function clone_link( $actions, $post ) {
404
+
405
+ if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
406
+
407
+ if ( isset( $actions['duplicate'] ) ) { // Duplicate page plugin remove.
408
+ unset( $actions['duplicate'] );
409
+ }
410
+ if ( isset( $actions['edit_as_new_draft'] ) ) { // Duplicate post plugin remove.
411
+ unset( $actions['edit_as_new_draft'] );
412
+ }
413
+
414
+ $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>';
415
+ }
416
+
417
+ return $actions;
418
+ }
419
+
420
+ /**
421
+ * Clear Page Builder Cache
422
+ */
423
+ function clear_cache() {
424
+
425
+ // Clear 'Elementor' file cache.
426
+ if ( class_exists( '\Elementor\Plugin' ) ) {
427
+ Elementor\Plugin::$instance->files_manager->clear_cache();
428
+ }
429
+ }
430
+
431
+ }
432
+
433
+ /**
434
+ * Kicking this off by calling 'get_instance()' method
435
+ */
436
+ Cartflows_Cloning::get_instance();
classes/class-cartflows-compatibility.php CHANGED
@@ -1,400 +1,400 @@
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
-
66
- /**
67
- * Check if it is beaver builder enabled.
68
- *
69
- * @since 1.1.4
70
- */
71
- public function is_bb_enabled() {
72
-
73
- if ( class_exists( 'FLBuilderModel' ) ) {
74
- return true;
75
- }
76
-
77
- return false;
78
- }
79
-
80
- /**
81
- * Check if elementor preview mode is on.
82
- */
83
- public function is_elementor_preview_mode() {
84
-
85
- if ( class_exists( '\Elementor\Plugin' ) ) {
86
-
87
- if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
88
- return true;
89
- }
90
- }
91
-
92
- return false;
93
- }
94
-
95
- /**
96
- * Get Current Theme.
97
- */
98
- public function get_current_theme() {
99
-
100
- $theme_name = '';
101
- $theme = wp_get_theme();
102
-
103
- if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
104
- $theme_name = $theme->parent_theme;
105
- } else {
106
- $theme_name = $theme->name;
107
- }
108
-
109
- return $theme_name;
110
- }
111
-
112
- /**
113
- * Check if it is beaver builder preview mode
114
- */
115
- public function is_bb_preview_mode() {
116
-
117
- if ( class_exists( 'FLBuilderModel' ) ) {
118
- if ( FLBuilderModel::is_builder_active() ) {
119
- return true;
120
- } else {
121
- return false;
122
- }
123
- }
124
-
125
- return false;
126
- }
127
-
128
- /**
129
- * Check for page builder preview mode.
130
- */
131
- public function is_page_builder_preview() {
132
-
133
- if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
134
- return true;
135
- }
136
-
137
- return false;
138
- }
139
-
140
- /**
141
- * Check if divi builder enabled for post id.
142
- */
143
- public function is_divi_builder_preview() {
144
-
145
- if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
146
- return true;
147
- }
148
-
149
- return false;
150
- }
151
-
152
- /**
153
- * Check if divi builder enabled for post id.
154
- *
155
- * @param int $post_id post id.
156
- */
157
- public function is_divi_builder_enabled( $post_id ) {
158
-
159
- if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
160
- return true;
161
- }
162
-
163
- return false;
164
- }
165
-
166
- /**
167
- * Check if compatibility theme enabled.
168
- */
169
- function is_compatibility_theme_enabled() {
170
-
171
- $theme = wp_get_theme();
172
-
173
- $is_compatibility = false;
174
-
175
- if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
176
-
177
- $is_compatibility = true;
178
- }
179
-
180
- return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
181
- }
182
-
183
- /**
184
- * Check if divi builder enabled for post id.
185
- *
186
- * @param object $theme theme data.
187
- * @return boolean
188
- */
189
- function is_divi_enabled( $theme = false ) {
190
-
191
- if ( ! $theme ) {
192
- $theme = wp_get_theme();
193
- }
194
-
195
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
196
- return true;
197
- }
198
-
199
- return false;
200
- }
201
-
202
- /**
203
- * Check if Divi theme is install status.
204
- *
205
- * @return boolean
206
- */
207
- function is_divi_theme_installed() {
208
- foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
209
- if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
210
- return true;
211
- }
212
- }
213
- return false;
214
- }
215
-
216
- /**
217
- * Check if Flatsome enabled for post id.
218
- *
219
- * @param object $theme theme data.
220
- * @return boolean
221
- */
222
- function is_flatsome_enabled( $theme = false ) {
223
-
224
- if ( ! $theme ) {
225
- $theme = wp_get_theme();
226
- }
227
-
228
- if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
229
- return true;
230
- }
231
-
232
- return false;
233
- }
234
-
235
- /**
236
- * Check if The7 enabled for post id.
237
- *
238
- * @param object $theme theme data.
239
- * @return boolean
240
- */
241
- function is_the_seven_enabled( $theme = false ) {
242
-
243
- if ( ! $theme ) {
244
- $theme = wp_get_theme();
245
- }
246
-
247
- if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
248
- return true;
249
- }
250
-
251
- return false;
252
- }
253
-
254
- /**
255
- * Check if OceanWp enabled for post id.
256
- *
257
- * @param object $theme theme data.
258
- * @return boolean
259
- */
260
- function is_oceanwp_enabled( $theme = false ) {
261
-
262
- if ( ! $theme ) {
263
- $theme = wp_get_theme();
264
- }
265
-
266
- if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
267
- return true;
268
- }
269
-
270
- return false;
271
- }
272
-
273
- /**
274
- * Check for thrive architect edit page.
275
- *
276
- * @param int $post_id post id.
277
- */
278
- public function is_thrive_edit_page( $post_id ) {
279
-
280
- if ( true === $this->is_thrive_builder_page( $post_id ) ) {
281
- return true;
282
- } else {
283
- return false;
284
- }
285
- }
286
-
287
- /**
288
- * Check if the page being rendered is the main ID on the editor page.
289
- *
290
- * @since 1.0.0
291
- * @param String $post_id Post ID which is to be rendered.
292
- * @return boolean True if current if is being rendered is not being edited.
293
- */
294
- private function is_thrive_builder_page( $post_id ) {
295
- $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
296
- $post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
297
-
298
- return ( true == $tve && $post_id !== $post );
299
- }
300
-
301
- /**
302
- * Overwrite meta for page
303
- */
304
- public function override_meta() {
305
-
306
- // don't override meta for `elementor_library` post type.
307
- if ( 'elementor_library' == get_post_type() ) {
308
- return;
309
- }
310
-
311
- if ( ! is_singular() ) {
312
- return;
313
- }
314
-
315
- global $post;
316
- $post_id = $post->ID;
317
- $post_type = get_post_type();
318
-
319
- if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
320
- || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
321
- || $this->is_divi_builder_enabled( $post_id ) ) ) {
322
-
323
- if ( '' == $post->post_content ) {
324
-
325
- $this->overwrite_template( $post_id );
326
- }
327
- }
328
- }
329
-
330
- /**
331
- * Assign cartflow canvas template to page.
332
- *
333
- * @param int $post_id post ID.
334
- */
335
- public function overwrite_template( $post_id ) {
336
-
337
- $template = 'cartflows-canvas';
338
- $key = '_wp_page_template';
339
-
340
- $record_exists = get_post_meta( $post_id, $key, true );
341
-
342
- if ( 'cartflows-canvas' == $record_exists ) {
343
- return;
344
- }
345
-
346
- // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
347
- if ( class_exists( '\Elementor\Plugin' ) ) {
348
-
349
- global $wpdb;
350
-
351
- if ( '' == $record_exists || ! $record_exists ) {
352
-
353
- $wpdb->insert(
354
- $wpdb->prefix . 'postmeta',
355
- array(
356
- 'post_id' => $post_id,
357
- 'meta_key' => $key,
358
- 'meta_value' => $template, // ... and so on
359
- )
360
- );
361
- } else {
362
-
363
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
364
- }
365
- } else {
366
-
367
- update_post_meta( $post_id, $key, $template );
368
- }
369
- }
370
-
371
- /**
372
- * Load font awesome style from oceanwp on checkout page.
373
- */
374
- public function load_fontawesome() {
375
-
376
- $theme = get_template();
377
-
378
- if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
379
-
380
- $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
381
-
382
- if ( $load_fa ) {
383
-
384
- wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
385
- }
386
-
387
- $custom_css = '
388
- #oceanwp-cart-sidebar-wrap,
389
- #owp-qv-wrap{
390
- display: none;
391
- }';
392
-
393
- wp_add_inline_style( 'wcf-frontend-global', $custom_css );
394
- }
395
- }
396
- }
397
- }
398
-
399
- Cartflows_Compatibility::get_instance();
400
-
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
+
66
+ /**
67
+ * Check if it is beaver builder enabled.
68
+ *
69
+ * @since 1.1.4
70
+ */
71
+ public function is_bb_enabled() {
72
+
73
+ if ( class_exists( 'FLBuilderModel' ) ) {
74
+ return true;
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Check if elementor preview mode is on.
82
+ */
83
+ public function is_elementor_preview_mode() {
84
+
85
+ if ( class_exists( '\Elementor\Plugin' ) ) {
86
+
87
+ if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
88
+ return true;
89
+ }
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * Get Current Theme.
97
+ */
98
+ public function get_current_theme() {
99
+
100
+ $theme_name = '';
101
+ $theme = wp_get_theme();
102
+
103
+ if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
104
+ $theme_name = $theme->parent_theme;
105
+ } else {
106
+ $theme_name = $theme->name;
107
+ }
108
+
109
+ return $theme_name;
110
+ }
111
+
112
+ /**
113
+ * Check if it is beaver builder preview mode
114
+ */
115
+ public function is_bb_preview_mode() {
116
+
117
+ if ( class_exists( 'FLBuilderModel' ) ) {
118
+ if ( FLBuilderModel::is_builder_active() ) {
119
+ return true;
120
+ } else {
121
+ return false;
122
+ }
123
+ }
124
+
125
+ return false;
126
+ }
127
+
128
+ /**
129
+ * Check for page builder preview mode.
130
+ */
131
+ public function is_page_builder_preview() {
132
+
133
+ if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
134
+ return true;
135
+ }
136
+
137
+ return false;
138
+ }
139
+
140
+ /**
141
+ * Check if divi builder enabled for post id.
142
+ */
143
+ public function is_divi_builder_preview() {
144
+
145
+ if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
146
+ return true;
147
+ }
148
+
149
+ return false;
150
+ }
151
+
152
+ /**
153
+ * Check if divi builder enabled for post id.
154
+ *
155
+ * @param int $post_id post id.
156
+ */
157
+ public function is_divi_builder_enabled( $post_id ) {
158
+
159
+ if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
160
+ return true;
161
+ }
162
+
163
+ return false;
164
+ }
165
+
166
+ /**
167
+ * Check if compatibility theme enabled.
168
+ */
169
+ function is_compatibility_theme_enabled() {
170
+
171
+ $theme = wp_get_theme();
172
+
173
+ $is_compatibility = false;
174
+
175
+ if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
176
+
177
+ $is_compatibility = true;
178
+ }
179
+
180
+ return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
181
+ }
182
+
183
+ /**
184
+ * Check if divi builder enabled for post id.
185
+ *
186
+ * @param object $theme theme data.
187
+ * @return boolean
188
+ */
189
+ function is_divi_enabled( $theme = false ) {
190
+
191
+ if ( ! $theme ) {
192
+ $theme = wp_get_theme();
193
+ }
194
+
195
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
196
+ return true;
197
+ }
198
+
199
+ return false;
200
+ }
201
+
202
+ /**
203
+ * Check if Divi theme is install status.
204
+ *
205
+ * @return boolean
206
+ */
207
+ function is_divi_theme_installed() {
208
+ foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
209
+ if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
210
+ return true;
211
+ }
212
+ }
213
+ return false;
214
+ }
215
+
216
+ /**
217
+ * Check if Flatsome enabled for post id.
218
+ *
219
+ * @param object $theme theme data.
220
+ * @return boolean
221
+ */
222
+ function is_flatsome_enabled( $theme = false ) {
223
+
224
+ if ( ! $theme ) {
225
+ $theme = wp_get_theme();
226
+ }
227
+
228
+ if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
229
+ return true;
230
+ }
231
+
232
+ return false;
233
+ }
234
+
235
+ /**
236
+ * Check if The7 enabled for post id.
237
+ *
238
+ * @param object $theme theme data.
239
+ * @return boolean
240
+ */
241
+ function is_the_seven_enabled( $theme = false ) {
242
+
243
+ if ( ! $theme ) {
244
+ $theme = wp_get_theme();
245
+ }
246
+
247
+ if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
248
+ return true;
249
+ }
250
+
251
+ return false;
252
+ }
253
+
254
+ /**
255
+ * Check if OceanWp enabled for post id.
256
+ *
257
+ * @param object $theme theme data.
258
+ * @return boolean
259
+ */
260
+ function is_oceanwp_enabled( $theme = false ) {
261
+
262
+ if ( ! $theme ) {
263
+ $theme = wp_get_theme();
264
+ }
265
+
266
+ if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
267
+ return true;
268
+ }
269
+
270
+ return false;
271
+ }
272
+
273
+ /**
274
+ * Check for thrive architect edit page.
275
+ *
276
+ * @param int $post_id post id.
277
+ */
278
+ public function is_thrive_edit_page( $post_id ) {
279
+
280
+ if ( true === $this->is_thrive_builder_page( $post_id ) ) {
281
+ return true;
282
+ } else {
283
+ return false;
284
+ }
285
+ }
286
+
287
+ /**
288
+ * Check if the page being rendered is the main ID on the editor page.
289
+ *
290
+ * @since 1.0.0
291
+ * @param String $post_id Post ID which is to be rendered.
292
+ * @return boolean True if current if is being rendered is not being edited.
293
+ */
294
+ private function is_thrive_builder_page( $post_id ) {
295
+ $tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
296
+ $post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
297
+
298
+ return ( true == $tve && $post_id !== $post );
299
+ }
300
+
301
+ /**
302
+ * Overwrite meta for page
303
+ */
304
+ public function override_meta() {
305
+
306
+ // don't override meta for `elementor_library` post type.
307
+ if ( 'elementor_library' == get_post_type() ) {
308
+ return;
309
+ }
310
+
311
+ if ( ! is_singular() ) {
312
+ return;
313
+ }
314
+
315
+ global $post;
316
+ $post_id = $post->ID;
317
+ $post_type = get_post_type();
318
+
319
+ if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
320
+ || $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
321
+ || $this->is_divi_builder_enabled( $post_id ) ) ) {
322
+
323
+ if ( '' == $post->post_content ) {
324
+
325
+ $this->overwrite_template( $post_id );
326
+ }
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Assign cartflow canvas template to page.
332
+ *
333
+ * @param int $post_id post ID.
334
+ */
335
+ public function overwrite_template( $post_id ) {
336
+
337
+ $template = 'cartflows-canvas';
338
+ $key = '_wp_page_template';
339
+
340
+ $record_exists = get_post_meta( $post_id, $key, true );
341
+
342
+ if ( 'cartflows-canvas' == $record_exists ) {
343
+ return;
344
+ }
345
+
346
+ // As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
347
+ if ( class_exists( '\Elementor\Plugin' ) ) {
348
+
349
+ global $wpdb;
350
+
351
+ if ( '' == $record_exists || ! $record_exists ) {
352
+
353
+ $wpdb->insert(
354
+ $wpdb->prefix . 'postmeta',
355
+ array(
356
+ 'post_id' => $post_id,
357
+ 'meta_key' => $key,
358
+ 'meta_value' => $template, // ... and so on
359
+ )
360
+ );
361
+ } else {
362
+
363
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
364
+ }
365
+ } else {
366
+
367
+ update_post_meta( $post_id, $key, $template );
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Load font awesome style from oceanwp on checkout page.
373
+ */
374
+ public function load_fontawesome() {
375
+
376
+ $theme = get_template();
377
+
378
+ if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
379
+
380
+ $load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
381
+
382
+ if ( $load_fa ) {
383
+
384
+ wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
385
+ }
386
+
387
+ $custom_css = '
388
+ #oceanwp-cart-sidebar-wrap,
389
+ #owp-qv-wrap{
390
+ display: none;
391
+ }';
392
+
393
+ wp_add_inline_style( 'wcf-frontend-global', $custom_css );
394
+ }
395
+ }
396
+ }
397
+ }
398
+
399
+ Cartflows_Compatibility::get_instance();
400
+
classes/class-cartflows-divi-compatibility.php CHANGED
@@ -1,55 +1,55 @@
1
- <?php
2
- /**
3
- * Divi page builder compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Class for divi page builder compatibility
10
- */
11
- class Cartflows_Divi_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
-
35
- add_filter( 'cartflows_container_atts', array( $this, 'add_id_for_cartflows_container' ) );
36
- }
37
-
38
- /**
39
- * Add id attribute to cartflows container which is needed to apply style to divi elements.
40
- *
41
- * @param array $atts container HTML attributes.
42
- * @return array
43
- */
44
- public function add_id_for_cartflows_container( $atts ) {
45
-
46
- $atts['id'] = 'page-container';
47
-
48
- return $atts;
49
- }
50
- }
51
-
52
- /**
53
- * Kicking this off by calling 'get_instance()' method
54
- */
55
- Cartflows_Divi_Compatibility::get_instance();
1
+ <?php
2
+ /**
3
+ * Divi page builder compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class for divi page builder compatibility
10
+ */
11
+ class Cartflows_Divi_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
+
35
+ add_filter( 'cartflows_container_atts', array( $this, 'add_id_for_cartflows_container' ) );
36
+ }
37
+
38
+ /**
39
+ * Add id attribute to cartflows container which is needed to apply style to divi elements.
40
+ *
41
+ * @param array $atts container HTML attributes.
42
+ * @return array
43
+ */
44
+ public function add_id_for_cartflows_container( $atts ) {
45
+
46
+ $atts['id'] = 'page-container';
47
+
48
+ return $atts;
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Kicking this off by calling 'get_instance()' method
54
+ */
55
+ Cartflows_Divi_Compatibility::get_instance();
classes/class-cartflows-flow-frontend.php CHANGED
@@ -1,199 +1,199 @@
1
- <?php
2
- /**
3
- * Frontend & Markup
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Flow Markup
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Flow_Frontend {
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
- /* Analytics */
39
- add_action( 'cartflows_wp_footer', array( $this, 'footer_markup' ) );
40
- }
41
-
42
- /**
43
- * Footer markup
44
- */
45
- function footer_markup() {
46
-
47
- if ( wcf()->utils->is_step_post_type() ) {
48
- // @codingStandardsIgnoreStart
49
- ?>
50
- <?php if( $this->is_flow_testmode() ) { ?>
51
- <div class="wcf-preview-mode">
52
- <span><?php _e( 'Test mode is active — which displays random products for previewing. It can be deactivated from the flow settings in the admin dashboard.', 'cartflows' ); ?></span>
53
- </div>
54
- <?php } ?>
55
- <?php
56
- // @codingStandardsIgnoreEnd
57
- }
58
- }
59
-
60
- /**
61
- * Check if flow test mode is enable.
62
- *
63
- * @since 1.0.0
64
- * @param int $flow_id flow ID.
65
- *
66
- * @return boolean
67
- */
68
- function is_flow_testmode( $flow_id = '' ) {
69
-
70
- if ( ! $flow_id ) {
71
- $flow_id = wcf()->utils->get_flow_id();
72
- }
73
-
74
- $test_mode = wcf()->options->get_flow_meta_value( $flow_id, 'wcf-testing' );
75
-
76
- if ( 'no' === $test_mode ) {
77
- return false;
78
- }
79
-
80
- return true;
81
- }
82
-
83
- /**
84
- * Get steps data.
85
- *
86
- * @since 1.0.0
87
- * @param int $flow_id flow ID.
88
- *
89
- * @return array
90
- */
91
- function get_steps( $flow_id ) {
92
-
93
- $steps = get_post_meta( $flow_id, 'wcf-steps', true );
94
-
95
- if ( ! is_array( $steps ) ) {
96
-
97
- $steps = array();
98
- }
99
-
100
- return $steps;
101
- }
102
-
103
- /**
104
- * Check thank you page exists.
105
- *
106
- * @since 1.0.0
107
- * @param array $order order data.
108
- *
109
- * @return bool
110
- */
111
- function is_thankyou_page_exists( $order ) {
112
-
113
- $thankyou_step_exist = false;
114
-
115
- $flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
116
-
117
- if ( $flow_id ) {
118
-
119
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
120
- $step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
121
-
122
- if ( is_array( $flow_steps ) ) {
123
-
124
- $current_step_found = false;
125
-
126
- foreach ( $flow_steps as $index => $data ) {
127
-
128
- if ( $current_step_found ) {
129
-
130
- if ( 'thankyou' === $data['type'] ) {
131
-
132
- $thankyou_step_exist = true;
133
- break;
134
- }
135
- } else {
136
-
137
- if ( intval( $data['id'] ) === $step_id ) {
138
-
139
- $current_step_found = true;
140
- }
141
- }
142
- }
143
- }
144
- }
145
-
146
- return $thankyou_step_exist;
147
- }
148
-
149
- /**
150
- * Check thank you page exists.
151
- *
152
- * @since 1.0.0
153
- * @param array $order order data.
154
- *
155
- * @return bool
156
- */
157
- function get_thankyou_page_id( $order ) {
158
-
159
- $thankyou_step_id = false;
160
-
161
- $flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
162
-
163
- if ( $flow_id ) {
164
-
165
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
166
- $step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
167
-
168
- if ( is_array( $flow_steps ) ) {
169
-
170
- $current_step_found = false;
171
-
172
- foreach ( $flow_steps as $index => $data ) {
173
-
174
- if ( $current_step_found ) {
175
-
176
- if ( 'thankyou' === $data['type'] ) {
177
-
178
- $thankyou_step_id = intval( $data['id'] );
179
- break;
180
- }
181
- } else {
182
-
183
- if ( intval( $data['id'] ) === $step_id ) {
184
-
185
- $current_step_found = true;
186
- }
187
- }
188
- }
189
- }
190
- }
191
-
192
- return $thankyou_step_id;
193
- }
194
- }
195
-
196
- /**
197
- * Kicking this off by calling 'get_instance()' method
198
- */
199
- Cartflows_Flow_Frontend::get_instance();
1
+ <?php
2
+ /**
3
+ * Frontend & Markup
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Flow Markup
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Flow_Frontend {
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
+ /* Analytics */
39
+ add_action( 'cartflows_wp_footer', array( $this, 'footer_markup' ) );
40
+ }
41
+
42
+ /**
43
+ * Footer markup
44
+ */
45
+ function footer_markup() {
46
+
47
+ if ( wcf()->utils->is_step_post_type() ) {
48
+ // @codingStandardsIgnoreStart
49
+ ?>
50
+ <?php if( $this->is_flow_testmode() ) { ?>
51
+ <div class="wcf-preview-mode">
52
+ <span><?php _e( 'Test mode is active — which displays random products for previewing. It can be deactivated from the flow settings in the admin dashboard.', 'cartflows' ); ?></span>
53
+ </div>
54
+ <?php } ?>
55
+ <?php
56
+ // @codingStandardsIgnoreEnd
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Check if flow test mode is enable.
62
+ *
63
+ * @since 1.0.0
64
+ * @param int $flow_id flow ID.
65
+ *
66
+ * @return boolean
67
+ */
68
+ function is_flow_testmode( $flow_id = '' ) {
69
+
70
+ if ( ! $flow_id ) {
71
+ $flow_id = wcf()->utils->get_flow_id();
72
+ }
73
+
74
+ $test_mode = wcf()->options->get_flow_meta_value( $flow_id, 'wcf-testing' );
75
+
76
+ if ( 'no' === $test_mode ) {
77
+ return false;
78
+ }
79
+
80
+ return true;
81
+ }
82
+
83
+ /**
84
+ * Get steps data.
85
+ *
86
+ * @since 1.0.0
87
+ * @param int $flow_id flow ID.
88
+ *
89
+ * @return array
90
+ */
91
+ function get_steps( $flow_id ) {
92
+
93
+ $steps = get_post_meta( $flow_id, 'wcf-steps', true );
94
+
95
+ if ( ! is_array( $steps ) ) {
96
+
97
+ $steps = array();
98
+ }
99
+
100
+ return $steps;
101
+ }
102
+
103
+ /**
104
+ * Check thank you page exists.
105
+ *
106
+ * @since 1.0.0
107
+ * @param array $order order data.
108
+ *
109
+ * @return bool
110
+ */
111
+ function is_thankyou_page_exists( $order ) {
112
+
113
+ $thankyou_step_exist = false;
114
+
115
+ $flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
116
+
117
+ if ( $flow_id ) {
118
+
119
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
120
+ $step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
121
+
122
+ if ( is_array( $flow_steps ) ) {
123
+
124
+ $current_step_found = false;
125
+
126
+ foreach ( $flow_steps as $index => $data ) {
127
+
128
+ if ( $current_step_found ) {
129
+
130
+ if ( 'thankyou' === $data['type'] ) {
131
+
132
+ $thankyou_step_exist = true;
133
+ break;
134
+ }
135
+ } else {
136
+
137
+ if ( intval( $data['id'] ) === $step_id ) {
138
+
139
+ $current_step_found = true;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ return $thankyou_step_exist;
147
+ }
148
+
149
+ /**
150
+ * Check thank you page exists.
151
+ *
152
+ * @since 1.0.0
153
+ * @param array $order order data.
154
+ *
155
+ * @return bool
156
+ */
157
+ function get_thankyou_page_id( $order ) {
158
+
159
+ $thankyou_step_id = false;
160
+
161
+ $flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
162
+
163
+ if ( $flow_id ) {
164
+
165
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
166
+ $step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
167
+
168
+ if ( is_array( $flow_steps ) ) {
169
+
170
+ $current_step_found = false;
171
+
172
+ foreach ( $flow_steps as $index => $data ) {
173
+
174
+ if ( $current_step_found ) {
175
+
176
+ if ( 'thankyou' === $data['type'] ) {
177
+
178
+ $thankyou_step_id = intval( $data['id'] );
179
+ break;
180
+ }
181
+ } else {
182
+
183
+ if ( intval( $data['id'] ) === $step_id ) {
184
+
185
+ $current_step_found = true;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ return $thankyou_step_id;
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Kicking this off by calling 'get_instance()' method
198
+ */
199
+ Cartflows_Flow_Frontend::get_instance();
classes/class-cartflows-frontend.php CHANGED
@@ -35,6 +35,7 @@ class Cartflows_Frontend {
35
  /* Set / Destroy Flow Sessions. Set data */
36
  add_action( 'wp', array( $this, 'init_actions' ), 1 );
37
 
 
38
  /* Enqueue global required scripts */
39
  add_action( 'wp', array( $this, 'wp_actions' ), 55 );
40
 
@@ -300,6 +301,33 @@ class Cartflows_Frontend {
300
  }
301
  }
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  /**
304
  * Global flow scripts.
305
  *
@@ -331,12 +359,11 @@ class Cartflows_Frontend {
331
 
332
  wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
333
 
334
- wp_enqueue_style( 'wcf-frontend-global', CARTFLOWS_URL . 'assets/css/frontend.css', array(), CARTFLOWS_VER );
335
- wp_style_add_data( 'wcf-frontend-global', 'rtl', 'replace' );
336
 
337
  wp_enqueue_script(
338
  'wcf-frontend-global',
339
- CARTFLOWS_URL . 'assets/js/frontend.js',
340
  array( 'jquery' ),
341
  CARTFLOWS_VER,
342
  true
35
  /* Set / Destroy Flow Sessions. Set data */
36
  add_action( 'wp', array( $this, 'init_actions' ), 1 );
37
 
38
+ add_action( 'init', array( $this, 'debug_data_setting_actions' ) );
39
  /* Enqueue global required scripts */
40
  add_action( 'wp', array( $this, 'wp_actions' ), 55 );
41
 
301
  }
302
  }
303
 
304
+ /**
305
+ * Debug Data Setting Actions.
306
+ *
307
+ * @since 1.1.14
308
+ */
309
+ function debug_data_setting_actions() {
310
+
311
+ add_filter( 'cartflows_load_min_assets', array( $this, 'allow_load_minify' ) );
312
+ }
313
+
314
+ /**
315
+ * Get/Set the allow minify option.
316
+ *
317
+ * @since 1.1.14
318
+ */
319
+ function allow_load_minify() {
320
+ $debug_data = Cartflows_Helper::get_debug_settings();
321
+ $allow_minified = $debug_data['allow_minified_files'];
322
+ $allow_minify = false;
323
+
324
+ if ( 'enable' === $allow_minified ) {
325
+ $allow_minify = true;
326
+ }
327
+
328
+ return $allow_minify;
329
+ }
330
+
331
  /**
332
  * Global flow scripts.
333
  *
359
 
360
  wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
361
 
362
+ wp_enqueue_style( 'wcf-frontend-global', wcf()->utils->get_css_url( 'frontend' ), array(), CARTFLOWS_VER );
 
363
 
364
  wp_enqueue_script(
365
  'wcf-frontend-global',
366
+ wcf()->utils->get_js_url( 'frontend' ),
367
  array( 'jquery' ),
368
  CARTFLOWS_VER,
369
  true
classes/class-cartflows-functions.php CHANGED
@@ -1,388 +1,388 @@
1
- <?php
2
- /**
3
- * CartFlows Functions.
4
- *
5
- * @package CARTFLOWS
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit; // Exit if accessed directly.
10
- }
11
-
12
- /**
13
- * Check if cartflows pro activated.
14
- *
15
- * @since 1.0.0
16
- */
17
- function _is_cartflows_pro() {
18
-
19
- if ( defined( 'CARTFLOWS_PRO_FILE' ) ) {
20
- return true;
21
- }
22
-
23
- return false;
24
-
25
- }
26
-
27
- /**
28
- * Returns step id.
29
- *
30
- * @since 1.0.0
31
- */
32
- function _get_wcf_post_id() {
33
-
34
- global $post;
35
-
36
- if ( isset( $post->ID ) ) {
37
- return $post->ID;
38
- }
39
-
40
- return 0;
41
- }
42
-
43
- /**
44
- * Returns step id.
45
- *
46
- * @since 1.0.0
47
- */
48
- function _get_wcf_step_id() {
49
-
50
- if ( wcf()->utils->is_step_post_type() ) {
51
-
52
- global $post;
53
-
54
- return $post->ID;
55
- }
56
-
57
- return false;
58
- }
59
-
60
- /**
61
- * Check if it is a landing page?
62
- *
63
- * @since 1.0.0
64
- */
65
- function _is_wcf_landing_type() {
66
-
67
- if ( wcf()->utils->is_step_post_type() ) {
68
-
69
- global $post;
70
-
71
- if ( 'landing' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
72
-
73
- return true;
74
- }
75
- }
76
-
77
- return false;
78
- }
79
-
80
- /**
81
- * Returns landing id.
82
- *
83
- * @since 1.0.0
84
- */
85
- function _get_wcf_landing_id() {
86
-
87
- if ( _is_wcf_landing_type() ) {
88
-
89
- global $post;
90
-
91
- return $post->ID;
92
- }
93
-
94
- return false;
95
- }
96
-
97
- /**
98
- * Is custom checkout?
99
- *
100
- * @param int $checkout_id checkout ID.
101
- * @since 1.0.0
102
- */
103
- function _is_wcf_meta_custom_checkout( $checkout_id ) {
104
-
105
- $is_custom = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-custom-checkout-fields' );
106
-
107
- if ( 'yes' === $is_custom ) {
108
-
109
- return true;
110
- }
111
-
112
- return false;
113
- }
114
-
115
- /**
116
- * Check if page is cartflow checkout.
117
- *
118
- * @since 1.0.0
119
- * @return bool
120
- */
121
- function _is_wcf_checkout_type() {
122
-
123
- if ( wcf()->utils->is_step_post_type() ) {
124
-
125
- global $post;
126
-
127
- if ( 'checkout' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
128
-
129
- return true;
130
- }
131
- }
132
-
133
- return false;
134
- }
135
-
136
- /**
137
- * Check if AJAX call is in progress.
138
- *
139
- * @since 1.0.0
140
- * @return bool
141
- */
142
- function _is_wcf_doing_checkout_ajax() {
143
-
144
- if ( wp_doing_ajax() ) {
145
-
146
- if ( isset( $_GET['wc-ajax'] ) &&
147
- 'checkout' === $_GET['wc-ajax'] &&
148
- isset( $_POST['_wcf_checkout_id'] )
149
- ) {
150
- return true;
151
- }
152
- }
153
-
154
- return false;
155
- }
156
-
157
-
158
- /**
159
- * Returns checkout ID.
160
- *
161
- * @since 1.0.0
162
- * @return int/bool
163
- */
164
- function _get_wcf_checkout_id() {
165
-
166
- if ( _is_wcf_checkout_type() ) {
167
-
168
- global $post;
169
-
170
- return $post->ID;
171
- }
172
-
173
- return false;
174
- }
175
-
176
- /**
177
- * Check if it is checkout shortcode.
178
- *
179
- * @since 1.0.0
180
- * @return bool
181
- */
182
- function _is_wcf_checkout_shortcode() {
183
-
184
- global $post;
185
-
186
- if ( ! empty( $post ) && has_shortcode( $post->post_content, 'cartflows_checkout' ) ) {
187
-
188
- return true;
189
- }
190
-
191
- return false;
192
- }
193
-
194
- /**
195
- * Check if it is checkout shortcode.
196
- *
197
- * @since 1.0.0
198
- * @param string $content shortcode content.
199
- * @return bool
200
- */
201
- function _get_wcf_checkout_id_from_shortcode( $content = '' ) {
202
-
203
- $checkout_id = 0;
204
-
205
- if ( ! empty( $content ) ) {
206
-
207
- $regex_pattern = get_shortcode_regex( array( 'cartflows_checkout' ) );
208
-
209
- preg_match( '/' . $regex_pattern . '/s', $content, $regex_matches );
210
-
211
- if ( ! empty( $regex_matches ) ) {
212
-
213
- if ( 'cartflows_checkout' == $regex_matches[2] ) {
214
-
215
- $attribure_str = str_replace( ' ', '&', trim( $regex_matches[3] ) );
216
- $attribure_str = str_replace( '"', '', $attribure_str );
217
-
218
- $attributes = wp_parse_args( $attribure_str );
219
-
220
- if ( isset( $attributes['id'] ) ) {
221
- $checkout_id = $attributes['id'];
222
- }
223
- }
224
- }
225
- }
226
-
227
- return $checkout_id;
228
- }
229
-
230
- /**
231
- * Check if post type is upsell.
232
- *
233
- * @since 1.0.0
234
- * @return bool
235
- */
236
- function _is_wcf_upsell_type() {
237
-
238
- if ( wcf()->utils->is_step_post_type() ) {
239
-
240
- global $post;
241
-
242
- if ( 'upsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
243
-
244
- return true;
245
- }
246
- }
247
-
248
- return false;
249
- }
250
-
251
- /**
252
- * Returns upsell ID.
253
- *
254
- * @since 1.0.0
255
- * @return int/bool
256
- */
257
- function _get_wcf_upsell_id() {
258
-
259
- if ( _is_wcf_upsell_type() ) {
260
-
261
- global $post;
262
-
263
- return $post->ID;
264
- }
265
-
266
- return false;
267
- }
268
-
269
- /**
270
- * Check if post is of type downsell.
271
- *
272
- * @since 1.0.0
273
- * @return int/bool
274
- */
275
- function _is_wcf_downsell_type() {
276
-
277
- if ( wcf()->utils->is_step_post_type() ) {
278
-
279
- global $post;
280
-
281
- if ( 'downsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
282
-
283
- return true;
284
- }
285
- }
286
-
287
- return false;
288
- }
289
-
290
- /**
291
- * Get downsell page ID.
292
- *
293
- * @since 1.0.0
294
- * @return int/bool
295
- */
296
- function _get_wcf_downsell_id() {
297
-
298
- if ( _is_wcf_downsell_type() ) {
299
-
300
- global $post;
301
-
302
- return $post->ID;
303
- }
304
-
305
- return false;
306
- }
307
-
308
- /**
309
- * Check if page is of thank you type.
310
- *
311
- * @since 1.0.0
312
- * @return int/bool
313
- */
314
- function _is_wcf_thankyou_type() {
315
-
316
- if ( wcf()->utils->is_step_post_type() ) {
317
-
318
- global $post;
319
-
320
- if ( 'thankyou' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
321
-
322
- return true;
323
- }
324
- }
325
-
326
- return false;
327
- }
328
-
329
- /**
330
- * Get thank you page ID.
331
- *
332
- * @since 1.0.0
333
- * @return int/bool
334
- */
335
- function _get_wcf_thankyou_id() {
336
-
337
- if ( _is_wcf_thankyou_type() ) {
338
-
339
- global $post;
340
-
341
- return $post->ID;
342
- }
343
-
344
- return false;
345
- }
346
-
347
-
348
- /**
349
- * Check if post type is upsell.
350
- *
351
- * @since 1.0.0
352
- * @return bool
353
- */
354
- function _is_wcf_base_offer_type() {
355
-
356
- if ( wcf()->utils->is_step_post_type() ) {
357
-
358
- global $post;
359
-
360
- $step_type = get_post_meta( $post->ID, 'wcf-step-type', true );
361
-
362
- if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
363
-
364
- return true;
365
- }
366
- }
367
-
368
- return false;
369
- }
370
-
371
- /**
372
- * Returns upsell ID.
373
- *
374
- * @since 1.0.0
375
- * @return int/bool
376
- */
377
- function _get_wcf_base_offer_id() {
378
-
379
- if ( _is_wcf_base_offer_type() ) {
380
-
381
- global $post;
382
-
383
- return $post->ID;
384
- }
385
-
386
- return false;
387
- }
388
-
1
+ <?php
2
+ /**
3
+ * CartFlows Functions.
4
+ *
5
+ * @package CARTFLOWS
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit; // Exit if accessed directly.
10
+ }
11
+
12
+ /**
13
+ * Check if cartflows pro activated.
14
+ *
15
+ * @since 1.0.0
16
+ */
17
+ function _is_cartflows_pro() {
18
+
19
+ if ( defined( 'CARTFLOWS_PRO_FILE' ) ) {
20
+ return true;
21
+ }
22
+
23
+ return false;
24
+
25
+ }
26
+
27
+ /**
28
+ * Returns step id.
29
+ *
30
+ * @since 1.0.0
31
+ */
32
+ function _get_wcf_post_id() {
33
+
34
+ global $post;
35
+
36
+ if ( isset( $post->ID ) ) {
37
+ return $post->ID;
38
+ }
39
+
40
+ return 0;
41
+ }
42
+
43
+ /**
44
+ * Returns step id.
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ function _get_wcf_step_id() {
49
+
50
+ if ( wcf()->utils->is_step_post_type() ) {
51
+
52
+ global $post;
53
+
54
+ return $post->ID;
55
+ }
56
+
57
+ return false;
58
+ }
59
+
60
+ /**
61
+ * Check if it is a landing page?
62
+ *
63
+ * @since 1.0.0
64
+ */
65
+ function _is_wcf_landing_type() {
66
+
67
+ if ( wcf()->utils->is_step_post_type() ) {
68
+
69
+ global $post;
70
+
71
+ if ( 'landing' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
72
+
73
+ return true;
74
+ }
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Returns landing id.
82
+ *
83
+ * @since 1.0.0
84
+ */
85
+ function _get_wcf_landing_id() {
86
+
87
+ if ( _is_wcf_landing_type() ) {
88
+
89
+ global $post;
90
+
91
+ return $post->ID;
92
+ }
93
+
94
+ return false;
95
+ }
96
+
97
+ /**
98
+ * Is custom checkout?
99
+ *
100
+ * @param int $checkout_id checkout ID.
101
+ * @since 1.0.0
102
+ */
103
+ function _is_wcf_meta_custom_checkout( $checkout_id ) {
104
+
105
+ $is_custom = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-custom-checkout-fields' );
106
+
107
+ if ( 'yes' === $is_custom ) {
108
+
109
+ return true;
110
+ }
111
+
112
+ return false;
113
+ }
114
+
115
+ /**
116
+ * Check if page is cartflow checkout.
117
+ *
118
+ * @since 1.0.0
119
+ * @return bool
120
+ */
121
+ function _is_wcf_checkout_type() {
122
+
123
+ if ( wcf()->utils->is_step_post_type() ) {
124
+
125
+ global $post;
126
+
127
+ if ( 'checkout' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
128
+
129
+ return true;
130
+ }
131
+ }
132
+
133
+ return false;
134
+ }
135
+
136
+ /**
137
+ * Check if AJAX call is in progress.
138
+ *
139
+ * @since 1.0.0
140
+ * @return bool
141
+ */
142
+ function _is_wcf_doing_checkout_ajax() {
143
+
144
+ if ( wp_doing_ajax() ) {
145
+
146
+ if ( isset( $_GET['wc-ajax'] ) &&
147
+ 'checkout' === $_GET['wc-ajax'] &&
148
+ isset( $_POST['_wcf_checkout_id'] )
149
+ ) {
150
+ return true;
151
+ }
152
+ }
153
+
154
+ return false;
155
+ }
156
+
157
+
158
+ /**
159
+ * Returns checkout ID.
160
+ *
161
+ * @since 1.0.0
162
+ * @return int/bool
163
+ */
164
+ function _get_wcf_checkout_id() {
165
+
166
+ if ( _is_wcf_checkout_type() ) {
167
+
168
+ global $post;
169
+
170
+ return $post->ID;
171
+ }
172
+
173
+ return false;
174
+ }
175
+
176
+ /**
177
+ * Check if it is checkout shortcode.
178
+ *
179
+ * @since 1.0.0
180
+ * @return bool
181
+ */
182
+ function _is_wcf_checkout_shortcode() {
183
+
184
+ global $post;
185
+
186
+ if ( ! empty( $post ) && has_shortcode( $post->post_content, 'cartflows_checkout' ) ) {
187
+
188
+ return true;
189
+ }
190
+
191
+ return false;
192
+ }
193
+
194
+ /**
195
+ * Check if it is checkout shortcode.
196
+ *
197
+ * @since 1.0.0
198
+ * @param string $content shortcode content.
199
+ * @return bool
200
+ */
201
+ function _get_wcf_checkout_id_from_shortcode( $content = '' ) {
202
+
203
+ $checkout_id = 0;
204
+
205
+ if ( ! empty( $content ) ) {
206
+
207
+ $regex_pattern = get_shortcode_regex( array( 'cartflows_checkout' ) );
208
+
209
+ preg_match( '/' . $regex_pattern . '/s', $content, $regex_matches );
210
+
211
+ if ( ! empty( $regex_matches ) ) {
212
+
213
+ if ( 'cartflows_checkout' == $regex_matches[2] ) {
214
+
215
+ $attribure_str = str_replace( ' ', '&', trim( $regex_matches[3] ) );
216
+ $attribure_str = str_replace( '"', '', $attribure_str );
217
+
218
+ $attributes = wp_parse_args( $attribure_str );
219
+
220
+ if ( isset( $attributes['id'] ) ) {
221
+ $checkout_id = $attributes['id'];
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ return $checkout_id;
228
+ }
229
+
230
+ /**
231
+ * Check if post type is upsell.
232
+ *
233
+ * @since 1.0.0
234
+ * @return bool
235
+ */
236
+ function _is_wcf_upsell_type() {
237
+
238
+ if ( wcf()->utils->is_step_post_type() ) {
239
+
240
+ global $post;
241
+
242
+ if ( 'upsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
243
+
244
+ return true;
245
+ }
246
+ }
247
+
248
+ return false;
249
+ }
250
+
251
+ /**
252
+ * Returns upsell ID.
253
+ *
254
+ * @since 1.0.0
255
+ * @return int/bool
256
+ */
257
+ function _get_wcf_upsell_id() {
258
+
259
+ if ( _is_wcf_upsell_type() ) {
260
+
261
+ global $post;
262
+
263
+ return $post->ID;
264
+ }
265
+
266
+ return false;
267
+ }
268
+
269
+ /**
270
+ * Check if post is of type downsell.
271
+ *
272
+ * @since 1.0.0
273
+ * @return int/bool
274
+ */
275
+ function _is_wcf_downsell_type() {
276
+
277
+ if ( wcf()->utils->is_step_post_type() ) {
278
+
279
+ global $post;
280
+
281
+ if ( 'downsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
282
+
283
+ return true;
284
+ }
285
+ }
286
+
287
+ return false;
288
+ }
289
+
290
+ /**
291
+ * Get downsell page ID.
292
+ *
293
+ * @since 1.0.0
294
+ * @return int/bool
295
+ */
296
+ function _get_wcf_downsell_id() {
297
+
298
+ if ( _is_wcf_downsell_type() ) {
299
+
300
+ global $post;
301
+
302
+ return $post->ID;
303
+ }
304
+
305
+ return false;
306
+ }
307
+
308
+ /**
309
+ * Check if page is of thank you type.
310
+ *
311
+ * @since 1.0.0
312
+ * @return int/bool
313
+ */
314
+ function _is_wcf_thankyou_type() {
315
+
316
+ if ( wcf()->utils->is_step_post_type() ) {
317
+
318
+ global $post;
319
+
320
+ if ( 'thankyou' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
321
+
322
+ return true;
323
+ }
324
+ }
325
+
326
+ return false;
327
+ }
328
+
329
+ /**
330
+ * Get thank you page ID.
331
+ *
332
+ * @since 1.0.0
333
+ * @return int/bool
334
+ */
335
+ function _get_wcf_thankyou_id() {
336
+
337
+ if ( _is_wcf_thankyou_type() ) {
338
+
339
+ global $post;
340
+
341
+ return $post->ID;
342
+ }
343
+
344
+ return false;
345
+ }
346
+
347
+
348
+ /**
349
+ * Check if post type is upsell.
350
+ *
351
+ * @since 1.0.0
352
+ * @return bool
353
+ */
354
+ function _is_wcf_base_offer_type() {
355
+
356
+ if ( wcf()->utils->is_step_post_type() ) {
357
+
358
+ global $post;
359
+
360
+ $step_type = get_post_meta( $post->ID, 'wcf-step-type', true );
361
+
362
+ if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
363
+
364
+ return true;
365
+ }
366
+ }
367
+
368
+ return false;
369
+ }
370
+
371
+ /**
372
+ * Returns upsell ID.
373
+ *
374
+ * @since 1.0.0
375
+ * @return int/bool
376
+ */
377
+ function _get_wcf_base_offer_id() {
378
+
379
+ if ( _is_wcf_base_offer_type() ) {
380
+
381
+ global $post;
382
+
383
+ return $post->ID;
384
+ }
385
+
386
+ return false;
387
+ }
388
+
classes/class-cartflows-helper.php CHANGED
@@ -21,6 +21,13 @@ class Cartflows_Helper {
21
  */
22
  private static $common = null;
23
 
 
 
 
 
 
 
 
24
  /**
25
  * Installed Plugins
26
  *
@@ -97,6 +104,25 @@ class Cartflows_Helper {
97
  return $default;
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /**
101
  * Get required plugins for page builder
102
  *
@@ -256,6 +282,36 @@ class Cartflows_Helper {
256
  return self::$common;
257
  }
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  /**
260
  * Get Checkout field.
261
  *
21
  */
22
  private static $common = null;
23
 
24
+ /**
25
+ * Common Debug data
26
+ *
27
+ * @var zapier
28
+ */
29
+ private static $debug_data = null;
30
+
31
  /**
32
  * Installed Plugins
33
  *
104
  return $default;
105
  }
106
 
107
+ /**
108
+ * Get single debug options
109
+ *
110
+ * @since 1.1.4
111
+ *
112
+ * @param string $key Option key.
113
+ * @param string $default Option default value if not exist.
114
+ * @return mixed
115
+ */
116
+ static public function get_debug_setting( $key = '', $default = '' ) {
117
+ $debug_data = self::get_debug_settings();
118
+
119
+ if ( $debug_data && array_key_exists( $key, $debug_data ) ) {
120
+ return $debug_data[ $key ];
121
+ }
122
+
123
+ return $default;
124
+ }
125
+
126
  /**
127
  * Get required plugins for page builder
128
  *
282
  return self::$common;
283
  }
284
 
285
+ /**
286
+ * Get debug settings data.
287
+ *
288
+ * @return array.
289
+ */
290
+ static public function get_debug_settings() {
291
+
292
+ if ( null === self::$debug_data ) {
293
+
294
+ $debug_data_default = apply_filters(
295
+ 'cartflows_debug_settings_default',
296
+ array(
297
+ 'allow_minified_files' => 'disable',
298
+ )
299
+ );
300
+
301
+ $debug_data = Cartflows_Helper::get_admin_settings_option( '_cartflows_debug_data', false, true );
302
+
303
+ $debug_data = wp_parse_args( $debug_data, $debug_data_default );
304
+
305
+ if ( ! did_action( 'wp' ) ) {
306
+ return $debug_data;
307
+ } else {
308
+ self::$debug_data = $debug_data;
309
+ }
310
+ }
311
+
312
+ return self::$debug_data;
313
+ }
314
+
315
  /**
316
  * Get Checkout field.
317
  *
classes/class-cartflows-importer-core.php CHANGED
@@ -1,272 +1,272 @@
1
- <?php
2
- /**
3
- * Image Importer
4
- *
5
- * => How to use?
6
- *
7
- * $image = array(
8
- * 'url' => '<image-url>',
9
- * 'id' => '<image-id>',
10
- * );
11
- *
12
- * $downloaded_image = CartFlows_Importer_Core::get_instance()->import( $image );
13
- *
14
- * @package CartFlows
15
- * @since 1.0.0
16
- */
17
-
18
- if ( ! class_exists( 'CartFlows_Importer_Core' ) ) :
19
-
20
- /**
21
- * CartFlows Importer
22
- *
23
- * @since 1.0.0
24
- */
25
- class CartFlows_Importer_Core {
26
-
27
- /**
28
- * Instance
29
- *
30
- * @since 1.0.0
31
- * @var object Class object.
32
- * @access private
33
- */
34
- private static $instance;
35
-
36
- /**
37
- * Images IDs
38
- *
39
- * @var array The Array of already image IDs.
40
- * @since 1.0.0
41
- */
42
- private $already_imported_ids = array();
43
-
44
- /**
45
- * Initiator
46
- *
47
- * @since 1.0.0
48
- * @return object initialized object of class.
49
- */
50
- public static function get_instance() {
51
- if ( ! isset( self::$instance ) ) {
52
- self::$instance = new self;
53
- }
54
- return self::$instance;
55
- }
56
-
57
- /**
58
- * Constructor
59
- *
60
- * @since 1.0.0
61
- */
62
- public function __construct() {
63
-
64
- if ( ! function_exists( 'WP_Filesystem' ) ) {
65
- require_once ABSPATH . 'wp-admin/includes/file.php';
66
- }
67
-
68
- WP_Filesystem();
69
- }
70
-
71
- /**
72
- * Process Image Download
73
- *
74
- * @since 1.0.0
75
- * @param array $attachments Attachment array.
76
- * @return array Attachment array.
77
- */
78
- public function process( $attachments ) {
79
-
80
- $downloaded_images = array();
81
-
82
- foreach ( $attachments as $key => $attachment ) {
83
- $downloaded_images[] = $this->import( $attachment );
84
- }
85
-
86
- return $downloaded_images;
87
- }
88
-
89
- /**
90
- * Get Hash Image.
91
- *
92
- * @since 1.0.0
93
- * @param string $attachment_url Attachment URL.
94
- * @return string Hash string.
95
- */
96
- private function get_hash_image( $attachment_url ) {
97
- return sha1( $attachment_url );
98
- }
99
-
100
- /**
101
- * Get Saved Image.
102
- *
103
- * @since 1.0.0
104
- * @param string $attachment Attachment Data.
105
- * @return string Hash string.
106
- */
107
- private function get_saved_image( $attachment ) {
108
-
109
- wcf()->logger->import_log( 'importer-core.php File' );
110
-
111
- if ( apply_filters( 'cartflows_image_importer_skip_image', false, $attachment ) ) {
112
-
113
- self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
114
-
115
- return $attachment;
116
- }
117
-
118
- global $wpdb;
119
-
120
- // Already imported? Then return!
121
- if ( isset( $this->already_imported_ids[ $attachment['id'] ] ) ) {
122
-
123
- self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
124
-
125
- return $this->already_imported_ids[ $attachment['id'] ];
126
- }
127
-
128
- // 1. Is already imported in Batch Import Process?
129
- $post_id = $wpdb->get_var(
130
- $wpdb->prepare(
131
- 'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
132
- WHERE `meta_key` = \'_cartflows_image_hash\'
133
- AND `meta_value` = %s
134
- ;',
135
- $this->get_hash_image( $attachment['url'] )
136
- )
137
- );
138
-
139
- // 2. Is image already imported though XML?
140
- if ( empty( $post_id ) ) {
141
-
142
- // Get file name without extension.
143
- // To check it exist in attachment.
144
- $filename = preg_replace( '/\\.[^.\\s]{3,4}$/', '', basename( $attachment['url'] ) );
145
-
146
- $post_id = $wpdb->get_var(
147
- $wpdb->prepare(
148
- 'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
149
- WHERE `meta_key` = \'_wp_attached_file\'
150
- AND `meta_value` LIKE %s
151
- ;',
152
- '%' . $filename . '%'
153
- )
154
- );
155
-
156
- self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
157
- }
158
-
159
- if ( $post_id ) {
160
-
161
- $new_imgage_url = wp_get_attachment_url( $post_id );
162
- $new_attachment = array(
163
- 'id' => $post_id,
164
- 'url' => $new_imgage_url,
165
- );
166
- $this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
167
-
168
- self::log( 'Download (✓) Replace (✓) - ' . $new_imgage_url );
169
- return $new_attachment;
170
- }
171
-
172
- return false;
173
- }
174
-
175
- /**
176
- * Import Image
177
- *
178
- * @since 1.0.0
179
- * @param array $attachment Attachment array.
180
- * @return array Attachment array.
181
- */
182
- public function import( $attachment ) {
183
-
184
- $saved_image = $this->get_saved_image( $attachment );
185
- if ( $saved_image ) {
186
- return $saved_image;
187
- }
188
-
189
- $args = array(
190
- 'timeout' => 300,
191
- );
192
-
193
- $file_content = wp_remote_retrieve_body( wp_safe_remote_get( $attachment['url'], $args ) );
194
-
195
- // Empty file content?
196
- if ( empty( $file_content ) ) {
197
-
198
- self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
199
- self::log( 'Error: Failed wp_remote_retrieve_body().' );
200
-
201
- return $attachment;
202
- }
203
-
204
- // Extract the file name and extension from the URL.
205
- $filename = basename( $attachment['url'] );
206
-
207
- $upload = wp_upload_bits(
208
- $filename,
209
- null,
210
- $file_content
211
- );
212
-
213
- $post = array(
214
- 'post_title' => $filename,
215
- 'guid' => $upload['url'],
216
- );
217
-
218
- $info = wp_check_filetype( $upload['file'] );
219
- if ( $info ) {
220
- $post['post_mime_type'] = $info['type'];
221
- } else {
222
- // For now just return the origin attachment.
223
- return $attachment;
224
- }
225
-
226
- $post_id = wp_insert_attachment( $post, $upload['file'] );
227
- wp_update_attachment_metadata(
228
- $post_id,
229
- wp_generate_attachment_metadata( $post_id, $upload['file'] )
230
- );
231
- update_post_meta( $post_id, '_cartflows_image_hash', $this->get_hash_image( $attachment['url'] ) );
232
-
233
- $new_attachment = array(
234
- 'id' => $post_id,
235
- 'url' => $upload['url'],
236
- );
237
-
238
- self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
239
-
240
- $this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
241
-
242
- return $new_attachment;
243
- }
244
-
245
- /**
246
- * Debugging Log.
247
- *
248
- * @since 1.0.0
249
- * @param mixed $log Log data.
250
- * @return void
251
- */
252
- public static function log( $log ) {
253
-
254
- if ( ! WP_DEBUG_LOG ) {
255
- return;
256
- }
257
-
258
- if ( is_array( $log ) || is_object( $log ) ) {
259
- wcf()->logger->import_log( print_r( $log, true ) );
260
- } else {
261
- wcf()->logger->import_log( $log );
262
- }
263
- }
264
-
265
- }
266
-
267
- /**
268
- * Initialize class object with 'get_instance()' method
269
- */
270
- CartFlows_Importer_Core::get_instance();
271
-
272
- endif;
1
+ <?php
2
+ /**
3
+ * Image Importer
4
+ *
5
+ * => How to use?
6
+ *
7
+ * $image = array(
8
+ * 'url' => '<image-url>',
9
+ * 'id' => '<image-id>',
10
+ * );
11
+ *
12
+ * $downloaded_image = CartFlows_Importer_Core::get_instance()->import( $image );
13
+ *
14
+ * @package CartFlows
15
+ * @since 1.0.0
16
+ */
17
+
18
+ if ( ! class_exists( 'CartFlows_Importer_Core' ) ) :
19
+
20
+ /**
21
+ * CartFlows Importer
22
+ *
23
+ * @since 1.0.0
24
+ */
25
+ class CartFlows_Importer_Core {
26
+
27
+ /**
28
+ * Instance
29
+ *
30
+ * @since 1.0.0
31
+ * @var object Class object.
32
+ * @access private
33
+ */
34
+ private static $instance;
35
+
36
+ /**
37
+ * Images IDs
38
+ *
39
+ * @var array The Array of already image IDs.
40
+ * @since 1.0.0
41
+ */
42
+ private $already_imported_ids = array();
43
+
44
+ /**
45
+ * Initiator
46
+ *
47
+ * @since 1.0.0
48
+ * @return object initialized object of class.
49
+ */
50
+ public static function get_instance() {
51
+ if ( ! isset( self::$instance ) ) {
52
+ self::$instance = new self;
53
+ }
54
+ return self::$instance;
55
+ }
56
+
57
+ /**
58
+ * Constructor
59
+ *
60
+ * @since 1.0.0
61
+ */
62
+ public function __construct() {
63
+
64
+ if ( ! function_exists( 'WP_Filesystem' ) ) {
65
+ require_once ABSPATH . 'wp-admin/includes/file.php';
66
+ }
67
+
68
+ WP_Filesystem();
69
+ }
70
+
71
+ /**
72
+ * Process Image Download
73
+ *
74
+ * @since 1.0.0
75
+ * @param array $attachments Attachment array.
76
+ * @return array Attachment array.
77
+ */
78
+ public function process( $attachments ) {
79
+
80
+ $downloaded_images = array();
81
+
82
+ foreach ( $attachments as $key => $attachment ) {
83
+ $downloaded_images[] = $this->import( $attachment );
84
+ }
85
+
86
+ return $downloaded_images;
87
+ }
88
+
89
+ /**
90
+ * Get Hash Image.
91
+ *
92
+ * @since 1.0.0
93
+ * @param string $attachment_url Attachment URL.
94
+ * @return string Hash string.
95
+ */
96
+ private function get_hash_image( $attachment_url ) {
97
+ return sha1( $attachment_url );
98
+ }
99
+
100
+ /**
101
+ * Get Saved Image.
102
+ *
103
+ * @since 1.0.0
104
+ * @param string $attachment Attachment Data.
105
+ * @return string Hash string.
106
+ */
107
+ private function get_saved_image( $attachment ) {
108
+
109
+ wcf()->logger->import_log( 'importer-core.php File' );
110
+
111
+ if ( apply_filters( 'cartflows_image_importer_skip_image', false, $attachment ) ) {
112
+
113
+ self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
114
+
115
+ return $attachment;
116
+ }
117
+
118
+ global $wpdb;
119
+
120
+ // Already imported? Then return!
121
+ if ( isset( $this->already_imported_ids[ $attachment['id'] ] ) ) {
122
+
123
+ self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
124
+
125
+ return $this->already_imported_ids[ $attachment['id'] ];
126
+ }
127
+
128
+ // 1. Is already imported in Batch Import Process?
129
+ $post_id = $wpdb->get_var(
130
+ $wpdb->prepare(
131
+ 'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
132
+ WHERE `meta_key` = \'_cartflows_image_hash\'
133
+ AND `meta_value` = %s
134
+ ;',
135
+ $this->get_hash_image( $attachment['url'] )
136
+ )
137
+ );
138
+
139
+ // 2. Is image already imported though XML?
140
+ if ( empty( $post_id ) ) {
141
+
142
+ // Get file name without extension.
143
+ // To check it exist in attachment.
144
+ $filename = preg_replace( '/\\.[^.\\s]{3,4}$/', '', basename( $attachment['url'] ) );
145
+
146
+ $post_id = $wpdb->get_var(
147
+ $wpdb->prepare(
148
+ 'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
149
+ WHERE `meta_key` = \'_wp_attached_file\'
150
+ AND `meta_value` LIKE %s
151
+ ;',
152
+ '%' . $filename . '%'
153
+ )
154
+ );
155
+
156
+ self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
157
+ }
158
+
159
+ if ( $post_id ) {
160
+
161
+ $new_imgage_url = wp_get_attachment_url( $post_id );
162
+ $new_attachment = array(
163
+ 'id' => $post_id,
164
+ 'url' => $new_imgage_url,
165
+ );
166
+ $this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
167
+
168
+ self::log( 'Download (✓) Replace (✓) - ' . $new_imgage_url );
169
+ return $new_attachment;
170
+ }
171
+
172
+ return false;
173
+ }
174
+
175
+ /**
176
+ * Import Image
177
+ *
178
+ * @since 1.0.0
179
+ * @param array $attachment Attachment array.
180
+ * @return array Attachment array.
181
+ */
182
+ public function import( $attachment ) {
183
+
184
+ $saved_image = $this->get_saved_image( $attachment );
185
+ if ( $saved_image ) {
186
+ return $saved_image;
187
+ }
188
+
189
+ $args = array(
190
+ 'timeout' => 300,
191
+ );
192
+
193
+ $file_content = wp_remote_retrieve_body( wp_safe_remote_get( $attachment['url'], $args ) );
194
+
195
+ // Empty file content?
196
+ if ( empty( $file_content ) ) {
197
+
198
+ self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
199
+ self::log( 'Error: Failed wp_remote_retrieve_body().' );
200
+
201
+ return $attachment;
202
+ }
203
+
204
+ // Extract the file name and extension from the URL.
205
+ $filename = basename( $attachment['url'] );
206
+
207
+ $upload = wp_upload_bits(
208
+ $filename,
209
+ null,
210
+ $file_content
211
+ );
212
+
213
+ $post = array(
214
+ 'post_title' => $filename,
215
+ 'guid' => $upload['url'],
216
+ );
217
+
218
+ $info = wp_check_filetype( $upload['file'] );
219
+ if ( $info ) {
220
+ $post['post_mime_type'] = $info['type'];
221
+ } else {
222
+ // For now just return the origin attachment.
223
+ return $attachment;
224
+ }
225
+
226
+ $post_id = wp_insert_attachment( $post, $upload['file'] );
227
+ wp_update_attachment_metadata(
228
+ $post_id,
229
+ wp_generate_attachment_metadata( $post_id, $upload['file'] )
230
+ );
231
+ update_post_meta( $post_id, '_cartflows_image_hash', $this->get_hash_image( $attachment['url'] ) );
232
+
233
+ $new_attachment = array(
234
+ 'id' => $post_id,
235
+ 'url' => $upload['url'],
236
+ );
237
+
238
+ self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
239
+
240
+ $this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
241
+
242
+ return $new_attachment;
243
+ }
244
+
245
+ /**
246
+ * Debugging Log.
247
+ *
248
+ * @since 1.0.0
249
+ * @param mixed $log Log data.
250
+ * @return void
251
+ */
252
+ public static function log( $log ) {
253
+
254
+ if ( ! WP_DEBUG_LOG ) {
255
+ return;
256
+ }
257
+
258
+ if ( is_array( $log ) || is_object( $log ) ) {
259
+ wcf()->logger->import_log( print_r( $log, true ) );
260
+ } else {
261
+ wcf()->logger->import_log( $log );
262
+ }
263
+ }
264
+
265
+ }
266
+
267
+ /**
268
+ * Initialize class object with 'get_instance()' method
269
+ */
270
+ CartFlows_Importer_Core::get_instance();
271
+
272
+ endif;
classes/class-cartflows-importer.php CHANGED
@@ -1,1569 +1,1569 @@
1
- <?php
2
- /**
3
- * CartFlows Admin
4
- *
5
- * @package CartFlows
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! class_exists( 'CartFlows_Importer' ) ) :
10
-
11
- /**
12
- * CartFlows Import
13
- *
14
- * @since 1.0.0
15
- */
16
- class CartFlows_Importer {
17
-
18
- /**
19
- * Instance
20
- *
21
- * @since 1.0.0
22
- * @access private
23
- * @var object Class object.
24
- */
25
- private static $instance;
26
-
27
- /**
28
- * Initiator
29
- *
30
- * @since 1.0.0
31
- * @return object initialized object of class.
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
-
38
- return self::$instance;
39
- }
40
-
41
- /**
42
- * Constructor
43
- *
44
- * @since 1.0.0
45
- */
46
- public function __construct() {
47
- add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
48
- add_action( 'wp_ajax_cartflows_load_steps', array( $this, 'load_templates' ) );
49
- add_action( 'wp_ajax_cartflows_step_import', array( $this, 'import_step' ) );
50
- add_action( 'wp_ajax_cartflows_create_flow', array( $this, 'create_flow' ) );
51
- add_action( 'wp_ajax_cartflows_default_flow', array( $this, 'create_default_flow' ) );
52
- add_action( 'wp_ajax_cartflows_step_create_blank', array( $this, 'step_create_blank' ) );
53
- add_action( 'wp_ajax_cartflows_import_flow_step', array( $this, 'import_flow' ) );
54
- add_action( 'admin_footer', array( $this, 'js_templates' ) );
55
- add_action( 'cartflows_import_complete', array( $this, 'clear_cache' ) );
56
-
57
- add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
58
-
59
- add_action( 'wp_ajax_cartflows_activate_plugin', array( $this, 'activate_plugin' ) );
60
-
61
- add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
62
- add_action( 'admin_init', array( $this, 'export_json' ) );
63
- add_action( 'admin_init', array( $this, 'import_json' ) );
64
- add_filter( 'post_row_actions', array( $this, 'export_link' ), 10, 2 );
65
- add_action( 'admin_action_cartflows_export_flow', array( $this, 'export_flow' ) );
66
- }
67
-
68
- /**
69
- * Add the export link to action list for flows row actions
70
- *
71
- * @since 1.1.4
72
- *
73
- * @param array $actions Actions array.
74
- * @param object $post Post object.
75
- *
76
- * @return array
77
- */
78
- function export_link( $actions, $post ) {
79
- if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
80
- $actions['export'] = '<a href="' . wp_nonce_url( 'admin.php?action=cartflows_export_flow&post=' . $post->ID, basename( __FILE__ ), 'flow_export_nonce' ) . '" title="' . __( 'Export this flow', 'cartflows' ) . '" rel="permalink">' . __( 'Export', 'cartflows' ) . '</a>';
81
- }
82
- return $actions;
83
- }
84
-
85
- /**
86
- * Add menus
87
- *
88
- * @since 1.1.4
89
- */
90
- function add_to_menus() {
91
- add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Export', 'cartflows' ), __( 'Flow Export', 'cartflows' ), 'export', 'flow_exporter', array( $this, 'exporter_markup' ) );
92
- add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Import', 'cartflows' ), __( 'Flow Import', 'cartflows' ), 'import', 'flow_importer', array( $this, 'importer_markup' ) );
93
- }
94
-
95
- /**
96
- * Export flow with steps and its meta
97
- *
98
- * @since 1.1.4
99
- */
100
- function export_flow() {
101
-
102
- if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_export_flow' == $_REQUEST['action'] ) ) ) {
103
- wp_die( __( 'No post to export has been supplied!', 'cartflows' ) );
104
- }
105
-
106
- if ( ! isset( $_GET['flow_export_nonce'] ) || ! wp_verify_nonce( $_GET['flow_export_nonce'], basename( __FILE__ ) ) ) {
107
- return;
108
- }
109
-
110
- // Get the original post id.
111
- $flow_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
112
-
113
- $flows = array();
114
- $flows[] = $this->get_flow_export_data( $flow_id );
115
- $flows = apply_filters( 'cartflows_export_data', $flows );
116
-
117
- nocache_headers();
118
- header( 'Content-Type: application/json; charset=utf-8' );
119
- header( 'Content-Disposition: attachment; filename=cartflows-flow-' . $flow_id . '-' . date( 'm-d-Y' ) . '.json' );
120
- header( 'Expires: 0' );
121
-
122
- echo json_encode( $flows );
123
- exit;
124
- }
125
-
126
- /**
127
- * Export flow markup
128
- *
129
- * @since 1.1.4
130
- */
131
- function exporter_markup() {
132
- include_once CARTFLOWS_DIR . 'includes/exporter.php';
133
- }
134
-
135
- /**
136
- * Import flow markup
137
- *
138
- * @since 1.1.4
139
- */
140
- function importer_markup() {
141
- include_once CARTFLOWS_DIR . 'includes/importer.php';
142
- }
143
-
144
- /**
145
- * Export flow
146
- *
147
- * @since 1.1.4
148
- */
149
- function export_json() {
150
- if ( empty( $_POST['cartflows-action'] ) || 'export' != $_POST['cartflows-action'] ) {
151
- return;
152
- }
153
-
154
- if ( ! wp_verify_nonce( $_POST['cartflows-action-nonce'], 'cartflows-action-nonce' ) ) {
155
- return;
156
- }
157
-
158
- if ( ! current_user_can( 'manage_options' ) ) {
159
- return;
160
- }
161
-
162
- $flows = $this->get_all_flow_export_data();
163
- $flows = apply_filters( 'cartflows_export_data', $flows );
164
-
165
- nocache_headers();
166
- header( 'Content-Type: application/json; charset=utf-8' );
167
- header( 'Content-Disposition: attachment; filename=cartflows-flow-export-' . date( 'm-d-Y' ) . '.json' );
168
- header( 'Expires: 0' );
169
-
170
- echo json_encode( $flows );
171
- exit;
172
- }
173
-
174
- /**
175
- * Get flow export data
176
- *
177
- * @since 1.1.4
178
- *
179
- * @param integer $flow_id Flow ID.
180
- * @return array
181
- */
182
- function get_flow_export_data( $flow_id ) {
183
-
184
- $export_all = apply_filters( 'cartflows_export_all', false );
185
-
186
- $valid_step_meta_keys = array(
187
- '_wp_page_template',
188
- '_thumbnail_id',
189
- 'classic-editor-remember',
190
- );
191
-
192
- $new_steps = array();
193
- $steps = get_post_meta( $flow_id, 'wcf-steps', true );
194
- if ( $steps ) {
195
- foreach ( $steps as $key => $step ) {
196
-
197
- // Add step post meta.
198
- $new_all_meta = array();
199
- $all_meta = get_post_meta( $step['id'] );
200
- if ( is_array( $all_meta ) ) {
201
-
202
- if ( $export_all ) {
203
- foreach ( $all_meta as $meta_key => $value ) {
204
- $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
205
- }
206
- } else {
207
-
208
- foreach ( $all_meta as $meta_key => $value ) {
209
- if ( substr( $meta_key, 0, strlen( 'wcf' ) ) === 'wcf' ) {
210
- $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
211
- } elseif ( in_array( $meta_key, $valid_step_meta_keys ) ) {
212
- $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
213
- }
214
- }
215
- }
216
- }
217
-
218
- // Add single step.
219
- $step_data_arr = array(
220
- 'title' => get_the_title( $step['id'] ),
221
- 'type' => $step['type'],
222
- 'meta' => $new_all_meta,
223
- 'post_content' => '',
224
- );
225
-
226
- if ( $export_all ) {
227
-
228
- $step_post_obj = get_post( $step['id'] );
229
-
230
- $step_data_arr['post_content'] = $step_post_obj->post_content;
231
- }
232
-
233
- $new_steps[] = $step_data_arr;
234
- }
235
- }
236
-
237
- // Add single flow.
238
- return array(
239
- 'title' => get_the_title( $flow_id ),
240
- 'steps' => $new_steps,
241
- );
242
- }
243
-
244
- /**
245
- * Get all flow export data
246
- *
247
- * @since 1.1.4
248
- */
249
- function get_all_flow_export_data() {
250
-
251
- $query_args = array(
252
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
253
-
254
- // Query performance optimization.
255
- 'fields' => 'ids',
256
- 'no_found_rows' => true,
257
- 'posts_per_page' => -1,
258
- );
259
-
260
- $query = new WP_Query( $query_args );
261
- $flows = array();
262
- if ( $query->posts ) {
263
- foreach ( $query->posts as $key => $post_id ) {
264
- $flows[] = $this->get_flow_export_data( $post_id );
265
- }
266
- }
267
-
268
- return $flows;
269
- }
270
-
271
- /**
272
- * Import our exported file
273
- *
274
- * @since 1.1.4
275
- */
276
- function import_json() {
277
- if ( empty( $_POST['cartflows-action'] ) || 'import' != $_POST['cartflows-action'] ) {
278
- return;
279
- }
280
-
281
- if ( ! wp_verify_nonce( $_POST['cartflows-action-nonce'], 'cartflows-action-nonce' ) ) {
282
- return;
283
- }
284
-
285
- if ( ! current_user_can( 'manage_options' ) ) {
286
- return;
287
- }
288
-
289
- $filename = $_FILES['file']['name'];
290
- $file_info = explode( '.', $filename );
291
- $extension = end( $file_info );
292
-
293
- if ( 'json' != $extension ) {
294
- wp_die( __( 'Please upload a valid .json file', 'cartflows' ) );
295
- }
296
-
297
- $file = $_FILES['file']['tmp_name'];
298
-
299
- if ( empty( $file ) ) {
300
- wp_die( __( 'Please upload a file to import', 'cartflows' ) );
301
- }
302
-
303
- // Retrieve the settings from the file and convert the JSON object to an array.
304
- $flows = json_decode( file_get_contents( $file ), true );
305
-
306
- if ( $flows ) {
307
-
308
- foreach ( $flows as $key => $flow ) {
309
-
310
- $flow_title = $flow['title'];
311
- if ( post_exists( $flow['title'] ) ) {
312
- $flow_title = $flow['title'] . ' Copy';
313
- }
314
-
315
- // Create post object.
316
- $new_flow_args = array(
317
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
318
- 'post_title' => $flow_title,
319
- 'post_status' => 'draft',
320
- );
321
-
322
- // Insert the post into the database.
323
- $flow_id = wp_insert_post( $new_flow_args );
324
-
325
- if ( $flow['steps'] ) {
326
- foreach ( $flow['steps'] as $key => $step ) {
327
-
328
- $new_step_id = wp_insert_post(
329
- array(
330
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
331
- 'post_title' => $step['title'],
332
- 'post_status' => 'publish',
333
- 'meta_input' => $step['meta'],
334
- 'post_content' => isset( $step['post_content'] ) ? $step['post_content'] : '',
335
- )
336
- );
337
-
338
- // Insert post meta.
339
- update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
340
-
341
- $step_taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
342
- $current_term = term_exists( $step['type'], $step_taxonomy );
343
-
344
- // // Set type object.
345
- $data = get_term( $current_term['term_id'], $step_taxonomy );
346
- $step_slug = $data->slug;
347
- wp_set_object_terms( $new_step_id, $data->slug, $step_taxonomy );
348
-
349
- // Set type.
350
- update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
351
-
352
- // Set flow.
353
- wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
354
-
355
- CartFlows_Importer::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step['title'], $step_slug );
356
-
357
- if ( isset( $step['post_content'] ) && ! empty( $step['post_content'] ) ) {
358
-
359
- // Download and replace images.
360
- $content = $this->get_content( $step['post_content'] );
361
-
362
- // Update post content.
363
- wp_update_post(
364
- array(
365
- 'ID' => $new_step_id,
366
- 'post_content' => $content,
367
- )
368
- );
369
- }
370
- }
371
- }
372
- }
373
- }
374
-
375
- add_action( 'admin_notices', array( $this, 'imported_successfully' ) );
376
- }
377
-
378
- /**
379
- * Download and Replace hotlink images
380
- *
381
- * @since x.x.x
382
- *
383
- * @param string $content Mixed post content.
384
- * @return array Hotlink image array.
385
- */
386
- function get_content( $content = '' ) {
387
-
388
- $all_links = wp_extract_urls( $content );
389
- $image_links = array();
390
- $image_map = array();
391
-
392
- // Not have any link.
393
- if ( empty( $all_links ) ) {
394
- return $content;
395
- }
396
-
397
- foreach ( $all_links as $key => $link ) {
398
- if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $link ) ) {
399
- $image_links[] = $link;
400
- }
401
- }
402
-
403
- // Not have any image link.
404
- if ( empty( $image_links ) ) {
405
- return $content;
406
- }
407
-
408
- foreach ( $image_links as $key => $image_url ) {
409
-
410
- // Download remote image.
411
- $image = array(
412
- 'url' => $image_url,
413
- 'id' => rand( 000, 999 ),
414
- );
415
- $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
416
-
417
- // Old and New image mapping links.
418
- $image_map[ $image_url ] = $downloaded_image['url'];
419
- }
420
-
421
- // Replace old image links with new image links.
422
- foreach ( $image_map as $old_url => $new_url ) {
423
- $content = str_replace( $old_url, $new_url, $content );
424
- }
425
-
426
- return $content;
427
-
428
- }
429
-
430
- /**
431
- * Imported notice
432
- *
433
- * @since 1.1.4
434
- */
435
- function imported_successfully() {
436
- ?>
437
- <div class="notice notice-success">
438
- <p><?php _e( 'Successfully imported flows.', 'cartflows' ); ?></p>
439
- </div>
440
- <?php
441
- }
442
-
443
- /**
444
- * Clear Cache.
445
- *
446
- * @since 1.0.0
447
- */
448
- public function clear_cache() {
449
- // Clear 'Elementor' file cache.
450
- if ( class_exists( '\Elementor\Plugin' ) ) {
451
- Elementor\Plugin::$instance->files_manager->clear_cache();
452
- }
453
- }
454
-
455
- /**
456
- * JS Templates
457
- *
458
- * @since 1.0.0
459
- *
460
- * @return void
461
- */
462
- function js_templates() {
463
-
464
- // Loading Templates.
465
- ?>
466
- <script type="text/template" id="tmpl-cartflows-step-loading">
467
- <div class="template-message-block cartflows-step-loading">
468
- <h2>
469
- <span class="spinner"></span>
470
- <?php _e( 'Loading Steps', 'cartflows' ); ?>
471
- </h2>
472
- <p class="description"><?php _e( 'Getting steps from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
473
- </div>
474
- </script>
475
-
476
- <?php
477
- // Search Templates.
478
- ?>
479
- <script type="text/template" id="tmpl-cartflows-searching-templates">
480
- <div class="template-message-block cartflows-searching-templates">
481
- <h2>
482
- <span class="spinner"></span>
483
- <?php _e( 'Searching Template..', 'cartflows' ); ?>
484
- </h2>
485
- <p class="description"><?php _e( 'Getting templates from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
486
- </div>
487
- </script>
488
-
489
- <?php
490
- // CartFlows Importing Template.
491
- ?>
492
- <script type="text/template" id="tmpl-cartflows-step-importing">
493
- <div class="template-message-block cartflows-step-importing">
494
- <h2><span class="spinner"></span> <?php _e( 'Importing..', 'cartflows' ); ?></h2>
495
- </div>
496
- </script>
497
-
498
- <?php
499
- // CartFlows Imported.
500
- ?>
501
- <script type="text/template" id="tmpl-cartflows-step-imported">
502
- <div class="template-message-block cartflows-step-imported">
503
- <h2><span class="dashicons dashicons-yes"></span> <?php _e( 'Imported', 'cartflows' ); ?></h2>
504
- <p class="description"><?php _e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span></p></div>
505
- </script>
506
-
507
- <?php
508
- // No templates.
509
- ?>
510
- <script type="text/template" id="tmpl-cartflows-no-steps">
511
- <div class="cartflows-no-steps">
512
- <div class="template-message-block">
513
- <h2><?php _e( 'Coming Soon!', 'cartflows' ); ?></h2>
514
- <p class="description"></p>
515
- </div>
516
- </div>
517
- </script>
518
-
519
- <?php
520
- // No templates.
521
- ?>
522
- <script type="text/template" id="tmpl-cartflows-no-flows">
523
- <div class="cartflows-no-flows">
524
- <div class="template-message-block">
525
- <h2><?php _e( 'Coming Soon!', 'cartflows' ); ?></h2>
526
- <p class="description"></p>
527
- </div>
528
- </div>
529
- </script>
530
-
531
- <?php
532
- // Error handling.
533
- ?>
534
- <script type="text/template" id="tmpl-templator-error">
535
- <div class="notice notice-error"><p>{{ data }}</p></div>
536
- </script>
537
-
538
- <?php
539
- // Redirect to Elementor.
540
- ?>
541
- <script type="text/template" id="tmpl-templator-redirect-to-elementor">
542
- <div class="template-message-block templator-redirect-to-elementor">
543
- <h2><span class="dashicons dashicons-yes"></span> <?php _e( 'Imported', 'cartflows' ); ?></h2>
544
- <p class="description"><?php _e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span><br/><br/><?php _e( 'Redirecting to the Elementor edit window.', 'cartflows' ); ?> </p></div>
545
- </script>
546
-
547
- <?php
548
- /**
549
- * Responsive Buttons
550
- */
551
- ?>
552
- <script type="text/template" id="tmpl-cartflows-responsive-view">
553
- <span class="responsive-view">
554
- <span class="actions">
555
- <a class="desktop" href="#"><span data-view="desktop " class="active dashicons dashicons-desktop"></span></a>
556
- <a class="tablet" href="#"><span data-view="tablet" class="dashicons dashicons-tablet"></span></a>
557
- <a class="mobile" href="#"><span data-view="mobile" class="dashicons dashicons-smartphone"></span></a>
558
- </span>
559
- </span>
560
- </script>
561
-
562
- <?php
563
- // Templates data.
564
- ?>
565
- <script type="text/template" id="tmpl-cartflows-flows-list">
566
-
567
- <# console.log( data.items.length ) #>
568
- <# console.log( data.items ) #>
569
- <# if ( data.items.length ) { #>
570
- <# for ( key in data.items ) { #>
571
- <#
572
- var flow_steps = [];
573
- if( data.items[ key ].flow_steps ) {
574
- flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
575
- return value['id'];
576
- });
577
- }
578
- #>
579
- <div class="inner">
580
- <div class="template">
581
- <span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
582
- <div class="template-screenshot">
583
- <# if( data.items[ key ].featured_image_url ) { #>
584
- <img src="{{ data.items[ key ].featured_image_url }}" />
585
- <# } else { #>
586
- <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
587
- <# } #>
588
- </div>
589
- <a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>flow={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
590
- <# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
591
- <span class="wcf-flow-type pro"><?php _e( 'Pro', 'cartflows' ); ?></span>
592
- <# } #>
593
- </span>
594
- <div class="template-id-container">
595
- <h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
596
- <div class="template-actions">
597
-
598
- <#
599
- if( data.items[ key ].page_builder.slug ) {
600
- required_plugin_group = data.items[ key ].page_builder.slug;
601
- } else {
602
- required_plugin_group = '';
603
- }
604
-
605
- if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
606
- import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
607
- } else {
608
- import_btn_title = 'Import';
609
- } #>
610
-
611
- <# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
612
- <a data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
613
- <# } else if( CartFlowsImportVars._is_pro_active ) { #>
614
- <a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php _e( 'Activate License', 'cartflows' ); ?></a>
615
- <# } else { #>
616
- <a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php _e( 'Get Pro', 'cartflows' ); ?></a>
617
- <# } #>
618
- </div>
619
- </div>
620
- </div>
621
- </div>
622
- <# } #>
623
- <# } #>
624
- </script>
625
-
626
- <?php
627
- // Empty Step.
628
- ?>
629
- <script type="text/template" id="tmpl-cartflows-create-blank-step">
630
- <div class="inner">
631
- <div class="template">
632
- <span class="thumbnail site-preview cartflows-flow-preview">
633
- <div class="template-screenshot">
634
- <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/start-scratch.jpg" />
635
- </div>
636
- <div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
637
- </span>
638
- <div class="template-id-container">
639
- <h3 class="template-name"> Blank </h3>
640
- <div class="template-actions">
641
- <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create', 'cartflows' ); ?></a>
642
- </div>
643
- </div>
644
- </div>
645
- </div>
646
- </script>
647
-
648
- <?php
649
- // Templates data.
650
- ?>
651
- <script type="text/template" id="tmpl-cartflows-steps-list">
652
- <# if ( data.items.length ) { #>
653
- <# for ( key in data.items ) { #>
654
- <#
655
- var flow_steps = [];
656
- if( data.items[ key ].flow_steps ) {
657
- flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
658
- return value['id'];
659
- });
660
- }
661
- #>
662
- <div class="inner">
663
- <div class="template">
664
- <span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
665
- <div class="template-screenshot">
666
- <# if( data.items[ key ].featured_image_url ) { #>
667
- <img src="{{ data.items[ key ].featured_image_url }}" />
668
- <# } else { #>
669
- <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
670
- <# } #>
671
- </div>
672
- <div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
673
- <a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>step={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
674
- <# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
675
- <span class="wcf-flow-type pro"><?php _e( 'Pro', 'cartflows' ); ?></span>
676
- <# } #>
677
- </span>
678
- <div class="template-id-container">
679
- <h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
680
- <div class="template-actions">
681
-
682
- <#
683
-
684
- var step_slug = data.items[ key ].step_type.slug || '';
685
- var step_title = data.items[ key ].step_type.name || '';
686
- var import_btn_title = 'Import';
687
-
688
- var required_plugin_group = '';
689
- if( data.items[ key ].page_builder ) {
690
- required_plugin_group = data.items[ key ].page_builder.slug;
691
-
692
- if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
693
- import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
694
- }
695
- }
696
- #>
697
-
698
- <# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
699
- <a data-slug="{{step_slug}}" data-title="{{step_title}}" data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
700
- <# } else if( CartFlowsImportVars._is_pro_active ) { #>
701
- <a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php _e( 'Activate License', 'cartflows' ); ?></a>
702
- <# } else { #>
703
- <a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php _e( 'Get Pro', 'cartflows' ); ?></a>
704
- <# } #>
705
- </div>
706
- </div>
707
- </div>
708
- </div>
709
- <# } #>
710
- <# } #>
711
- </script>
712
-
713
- <?php
714
- /**
715
- * TMPL - Website Unreachable
716
- */
717
- ?>
718
- <script type="text/template" id="tmpl-cartflows-website-unreachable">
719
- <div class="postbox cartflows-website-unreachable">
720
- <h2><?php _e( 'Under Maintenance..', 'cartflows' ); ?></h2>
721
- <p><?php _e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly.', 'cartflows' ); ?></p>
722
- <p><?php _e( 'In rare case, it is possible your website is having trouble connecting with ours. If you need help, please feel free to get in touch with us from our website..', 'cartflows' ); ?></p>
723
- </div>
724
- </script>
725
-
726
- <?php
727
- /**
728
- * TMPL - Filters
729
- */
730
- ?>
731
- <script type="text/template" id="tmpl-cartflows-page-builder-notice">
732
- <?php
733
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
734
- $page_builder = Cartflows_Helper::get_required_plugins_for_page_builder( Cartflows_Helper::get_common_setting( 'default_page_builder' ) );
735
- $title = $page_builder['title'];
736
-
737
- $plugin_string = '<a href="#" data-slug="' . esc_html( $default_page_builder ) . '" class="wcf-install-plugin">Please click here and activate ' . esc_html( $title ) . '</a>';
738
- $theme_status = '';
739
- if ( 'divi' === $default_page_builder ) {
740
-
741
- $theme_status = $page_builder['theme-status'];
742
- $plugin_status = $page_builder['plugin-status'];
743
-
744
- if ( 'deactivate' === $theme_status || 'install' === $plugin_status ) {
745
- $plugin_string = 'Please activate ' . esc_html( $title );
746
- } elseif ( ( 'deactivate' === $theme_status || 'not-installed' === $theme_status ) && 'install' === $plugin_status ) {
747
- $plugin_string = 'Please install and activate ' . esc_html( $title );
748
- }
749
- }
750
- ?>
751
- <div class="wcf-page-builder-message">
752
- <p><?php /* translators: %s: Plugin string */ printf( __( '%1$s to see CartFlows templates. If you prefer another page builder tool, you can <a href="%2$s" target="blank">select it here</a>.', 'cartflows' ), $plugin_string, admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS . '&action=common-settings#form-field-wcf_default_page_builder' ) ); ?></p>
753
- <p>If your preferred page builder is not available, feel free to <a href="#" data-slug="canvas" class="wcf-create-from-scratch-link">create your own</a> pages using page builder of your choice as CartFlows works with all major page builders.</p>
754
- <p>We plan to add design templates made with more page builder shortly!</p>
755
- </div>
756
- </script>
757
-
758
- <?php
759
- /**
760
- * TMPL - Filters
761
- */
762
- ?>
763
- <script type="text/template" id="tmpl-cartflows-term-filters-dropdown">
764
- <# if ( data ) { #>
765
- <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
766
- <# if ( data.args.show_all ) { #>
767
- <option value="all"> <?php _e( 'All', 'cartflows' ); ?> </option>
768
- <# } #>
769
- <# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
770
- <option value=""> <?php _e( 'Select Step Type', 'cartflows' ); ?> </option>
771
- <# } #>
772
- <# for ( key in data.items ) { #>
773
- <option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
774
- <# } #>
775
- </select>
776
- <# } #>
777
- </script>
778
-
779
- <script type="text/template" id="tmpl-cartflows-term-filters">
780
-
781
- <# if ( data ) { #>
782
-
783
- <?php /* <# if ( CartFlowsImportVars.flow_page_builder === data.args.remote_slug || CartFlowsImportVars.step_page_builder === data.args.remote_slug ) { #> */ ?>
784
- <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
785
-
786
- <# if ( data.args.show_all ) { #>
787
- <li>
788
- <a href="#" data-group="all"> All </a>
789
- </li>
790
- <# } #>
791
-
792
- <# for ( key in data.items ) { #>
793
- <li>
794
- <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</a>
795
- </li>
796
- <# } #>
797
-
798
- </ul>
799
-
800
- <?php
801
-
802
- /*
803
- <# } else { #>
804
- <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
805
-
806
- <# if ( data.args.show_all ) { #>
807
- <option value="all"> <?php _e( 'All', 'cartflows' ); ?> </option>
808
- <# } #>
809
-
810
- <# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
811
- <option value=""> <?php _e( 'Select Step Type', 'cartflows' ); ?> </option>
812
- <# } #>
813
-
814
- <# for ( key in data.items ) { #>
815
- <option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
816
- <# } #>
817
-
818
- </select>
819
- */
820
- ?>
821
-
822
- <?php /* <# } #> */ ?>
823
-
824
- <# } #>
825
- </script>
826
-
827
- <?php
828
- // Step Type.
829
- ?>
830
- <script type="text/template" id="tmpl-cartflows-step-types">
831
- <ul class="wcf-tab nav-tabs">
832
- <# if( data.items_count ) { #>
833
- <# for( key in data.items ) { #>
834
- <# console.log( data.items[ key ].id ) #>
835
- <li data-slug="{{data.items[ key ].slug}}" data-title="{{ data.items[ key ].name }}">
836
- <a href="#{{{ data.items[ key ].slug }}}">{{{ data.items[ key ].name }}}</a>
837
- </li>
838
- <# } #>
839
- <# } #>
840
- </ul>
841
- </script>
842
-
843
- <?php
844
- // Add to library button.
845
- ?>
846
- <script type="text/template" id="tmpl-templator-add-to-library">
847
- <a class="templator-add-to-library page-title-action cartflows-load-steps-library"><i class="dashicons dashicons-cloud"></i><?php esc_attr_e( 'Import from Cloud', 'cartflows' ); ?></a>
848
- </script>
849
- <?php
850
- }
851
-
852
- /**
853
- * Enqueue scripts
854
- *
855
- * @since 1.0.0
856
- *
857
- * @hook admin_enqueue_scripts
858
- * @param string $hook Current page hook.
859
- */
860
- function scripts( $hook = '' ) {
861
-
862
- if ( ! self::is_supported_post( get_current_screen()->post_type ) ) {
863
- return;
864
- }
865
-
866
- wp_enqueue_script( 'cartflows-rest-api', CARTFLOWS_URL . 'assets/js/rest-api.js', array( 'jquery' ), CARTFLOWS_VER, true );
867
- wp_enqueue_style( 'cartflows-import', CARTFLOWS_URL . 'assets/css/import.css', null, CARTFLOWS_VER, 'all' );
868
- wp_style_add_data( 'cartflows-import', 'rtl', 'replace' );
869
- wp_enqueue_script( 'cartflows-import', CARTFLOWS_URL . 'assets/js/import.js', array( 'jquery', 'wp-util', 'cartflows-rest-api', 'updates' ), CARTFLOWS_VER, true );
870
-
871
- $localize_vars = array(
872
- '_is_pro_active' => _is_cartflows_pro(),
873
-
874
- // Flow and its rest fields.
875
- 'flow' => CARTFLOWS_FLOW_POST_TYPE,
876
- 'flow_fields' => array(
877
- 'id',
878
- 'title',
879
- 'flow_type',
880
- 'page_builder',
881
- 'flow_steps',
882
- 'licence_status',
883
- 'featured_image_url',
884
- 'featured_media', // @required for field `featured_image_url`.
885
- ),
886
-
887
- // Flow type and rest fields.
888
- 'flow_type' => CARTFLOWS_TAXONOMY_FLOW_CATEGORY,
889
- 'flow_type_fields' => array(
890
- 'id',
891
- 'name',
892
- 'slug',
893
- ),
894
-
895
- // Flow page builder and rest fields.
896
- 'flow_page_builder' => CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER,
897
- 'flow_page_builder_fields' => array(
898
- 'id',
899
- 'name',
900
- 'slug',
901
- ),
902
-
903
- // Step page builder and rest fields.
904
- 'step_page_builder' => CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER,
905
- 'step_page_builder_fields' => array(
906
- 'id',
907
- 'name',
908
- 'slug',
909
- ),
910
-
911
- // Step and its rest fields.
912
- 'step' => CARTFLOWS_STEP_POST_TYPE,
913
- 'step_fields' => array(
914
- 'title',
915
- 'featured_image_url',
916
- 'featured_media', // @required for field `featured_image_url`.
917
- 'id',
918
- 'flow_type',
919
- 'step_type',
920
- 'page_builder',
921
- 'licence_status',
922
- ),
923
-
924
- // Step type and its rest fields.
925
- 'step_type' => CARTFLOWS_TAXONOMY_STEP_TYPE,
926
- 'step_type_fields' => array(
927
- 'id',
928
- 'name',
929
- 'slug',
930
- ),
931
-
932
- 'domain_url' => CARTFLOWS_DOMAIN_URL,
933
- 'server_url' => CARTFLOWS_TEMPLATES_URL,
934
- 'server_rest_url' => CARTFLOWS_TEMPLATES_URL . 'wp-json/wp/v2/',
935
- 'site_url' => site_url(),
936
- 'import_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_importer' ),
937
- 'export_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_exporter' ),
938
- 'admin_url' => admin_url(),
939
- 'licence_args' => CartFlows_API::get_instance()->get_licence_args(),
940
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
941
- 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
942
-
943
- 'required_plugins' => Cartflows_Helper::get_plugins_groupby_page_builders(),
944
-
945
- 'default_page_builder' => Cartflows_Helper::get_common_setting( 'default_page_builder' ),
946
- );
947
-
948
- // var_dump(Cartflows_Helper::get_common_setting( 'default_page_builder' ));
949
- // wp_die( );
950
- // Add thickbox.
951
- add_thickbox();
952
-
953
- wp_localize_script( 'cartflows-import', 'CartFlowsImportVars', $localize_vars );
954
- wp_localize_script( 'cartflows-rest-api', 'CartFlowsImportVars', $localize_vars );
955
- }
956
-
957
- /**
958
- * Load Template
959
- *
960
- * @since 1.0.0
961
- *
962
- * @hook cartflows_load_steps
963
- * @return void
964
- */
965
- function load_templates() {
966
-
967
- check_ajax_referer( 'cf-load-steps', 'security' );
968
-
969
- $args = ( isset( $_POST['args'] ) ) ? array_map( 'sanitize_text_field', $_POST['args'] ) : array();
970
- $templates = CartFlows_API::get_instance()->get_templates( $args );
971
-
972
- if ( $templates['templates_count'] ) {
973
- wp_send_json_success( $templates );
974
- } else {
975
- wp_send_json_error( $templates );
976
- }
977
- wp_die();
978
- }
979
-
980
- /**
981
- * Import.
982
- *
983
- * @since 1.0.0
984
- *
985
- * @hook wp_ajax_cartflows_import_flow_step
986
- * @return void
987
- */
988
- function import_flow() {
989
-
990
- check_ajax_referer( 'cf-import-flow-step', 'security' );
991
-
992
- $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
993
- $template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
994
-
995
- wcf()->logger->import_log( '------------------------------------' );
996
- wcf()->logger->import_log( 'STARTED! Importing FLOW' );
997
- wcf()->logger->import_log( '------------------------------------' );
998
- wcf()->logger->import_log( '(✓) Creating new step from remote step [' . $template_id . '] for FLOW ' . get_the_title( $flow_id ) . ' [' . $flow_id . ']' );
999
-
1000
- $response = CartFlows_API::get_instance()->get_template( $template_id );
1001
-
1002
- $post_content = isset( $response['data']['content']->rendered ) ? $response['data']['content']->rendered : '';
1003
- if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1004
- if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1005
- $post_content = $response['data']['divi_content'];
1006
- }
1007
- }
1008
-
1009
- if ( false === $response['success'] ) {
1010
- wcf()->logger->import_log( '(✕) Failed to fetch remote data.' );
1011
- wp_send_json_error( $response );
1012
- }
1013
-
1014
- wcf()->logger->import_log( '(✓) Successfully getting remote step response ' . json_encode( $response ) );
1015
-
1016
- $new_step_id = wp_insert_post(
1017
- array(
1018
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1019
- 'post_title' => $response['title'],
1020
- 'post_content' => $post_content,
1021
- 'post_status' => 'publish',
1022
- )
1023
- );
1024
-
1025
- if ( is_wp_error( $new_step_id ) ) {
1026
- wcf()->logger->import_log( '(✕) Failed to create new step for flow ' . $flow_id );
1027
- wp_send_json_error( $new_step_id );
1028
- }
1029
-
1030
- if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1031
- if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1032
- update_post_meta( $new_step_id, 'divi_content', $response['data']['divi_content'] );
1033
- }
1034
- }
1035
-
1036
- /* Imported Step */
1037
- update_post_meta( $new_step_id, 'cartflows_imported_step', 'yes' );
1038
-
1039
- wcf()->logger->import_log( '(✓) Created new step ' . '"' . $response['title'] . '" id ' . $new_step_id );
1040
- // insert post meta.
1041
- update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
1042
- wcf()->logger->import_log( '(✓) Added flow ID ' . $flow_id . ' in post meta key wcf-flow-id.' );
1043
-
1044
- /**
1045
- * Import & Set type.
1046
- */
1047
- $term = isset( $response['data']['step_type'] ) ? $response['data']['step_type'] : '';
1048
- $term_slug = '';
1049
- if ( $term ) {
1050
-
1051
- $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
1052
- $term_exist = term_exists( $term->name, $taxonomy );
1053
-
1054
- if ( empty( $term_exist ) ) {
1055
- $terms = array(
1056
- array(
1057
- 'name' => $term->name,
1058
- ),
1059
- );
1060
-
1061
- Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
1062
- wcf()->logger->import_log( '(✓) Created new term ' . $term->name );
1063
- }
1064
-
1065
- $current_term = term_exists( $term->name, $taxonomy );
1066
-
1067
- // Set type object.
1068
- $data = get_term( $current_term['term_id'], $taxonomy );
1069
- $term_slug = $data->slug;
1070
- $term_name = $data->name;
1071
- wp_set_object_terms( $new_step_id, $term_slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1072
- wcf()->logger->import_log( '(✓) Assigned existing term ' . $term_name . ' to the template ' . $new_step_id );
1073
-
1074
- // Set type.
1075
- update_post_meta( $new_step_id, 'wcf-step-type', $term_slug );
1076
- wcf()->logger->import_log( '(✓) Updated term ' . $term_name . ' to the post meta wcf-step-type.' );
1077
- }
1078
-
1079
- // Set flow.
1080
- wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1081
- wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
1082
-
1083
- /**
1084
- * Update steps for the current flow.
1085
- */
1086
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
1087
-
1088
- if ( ! is_array( $flow_steps ) ) {
1089
- $flow_steps = array();
1090
- }
1091
-
1092
- $flow_steps[] = array(
1093
- 'id' => $new_step_id,
1094
- 'title' => $response['title'],
1095
- 'type' => $term_slug,
1096
- );
1097
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1098
- wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . json_encode( $flow_steps ) );
1099
-
1100
- // Import Post Meta.
1101
- self::import_post_meta( $new_step_id, $response );
1102
-
1103
- wcf()->logger->import_log( '(✓) Importing step "' . get_the_title( $new_step_id ) . '" [' . $new_step_id . '] for FLOW "' . get_the_title( $flow_id ) . '" [' . $flow_id . ']' );
1104
- wcf()->logger->import_log( '------------------------------------' );
1105
- wcf()->logger->import_log( 'COMPLETE! Importing FLOW' );
1106
- wcf()->logger->import_log( '------------------------------------' );
1107
-
1108
- do_action( 'cartflows_import_complete' );
1109
- wcf()->logger->import_log( '(✓) BATCH STARTED for step ' . $new_step_id . ' for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
1110
-
1111
- // Batch Process.
1112
- do_action( 'cartflows_after_template_import', $new_step_id, $response );
1113
-
1114
- /**
1115
- * End
1116
- */
1117
- wp_send_json_success( $new_step_id );
1118
- }
1119
-
1120
- /**
1121
- * Import Step.
1122
- *
1123
- * @since 1.0.0
1124
- * @hook wp_ajax_cartflows_step_import
1125
- *
1126
- * @return void
1127
- */
1128
- function create_default_flow() {
1129
-
1130
- check_ajax_referer( 'cf-default-flow', 'security' );
1131
-
1132
- // Create post object.
1133
- $new_flow_post = array(
1134
- 'post_content' => '',
1135
- 'post_status' => 'publish',
1136
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
1137
- );
1138
-
1139
- // Insert the post into the database.
1140
- $flow_id = wp_insert_post( $new_flow_post );
1141
-
1142
- if ( is_wp_error( $flow_id ) ) {
1143
- wp_send_json_error( $flow_id->get_error_message() );
1144
- }
1145
-
1146
- $flow_steps = array();
1147
-
1148
- $steps_data = array(
1149
- 'landing' => __( 'Landing Page', 'cartflows' ),
1150
- 'checkout' => __( 'Checkout Page', 'cartflows' ),
1151
- 'thankyou' => __( 'Thank You Page', 'cartflows' ),
1152
- );
1153
-
1154
- foreach ( $steps_data as $slug => $title ) {
1155
-
1156
- $post_content = '';
1157
-
1158
- switch ( $slug ) {
1159
- case 'checkout':
1160
- $post_content = '';
1161
- break;
1162
- case 'thankyou':
1163
- $post_content = '';
1164
- break;
1165
- default:
1166
- $post_content = '';
1167
- break;
1168
- }
1169
-
1170
- $step_id = wp_insert_post(
1171
- array(
1172
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1173
- 'post_title' => $title,
1174
- 'post_content' => $post_content,
1175
- 'post_status' => 'publish',
1176
- )
1177
- );
1178
-
1179
- if ( is_wp_error( $step_id ) ) {
1180
- wp_send_json_error( $step_id->get_error_message() );
1181
- }
1182
-
1183
- if ( $step_id ) {
1184
-
1185
- $flow_steps[] = array(
1186
- 'id' => $step_id,
1187
- 'title' => $title,
1188
- 'type' => $slug,
1189
- );
1190
-
1191
- // insert post meta.
1192
- update_post_meta( $step_id, 'wcf-flow-id', $flow_id );
1193
- update_post_meta( $step_id, 'wcf-step-type', $slug );
1194
-
1195
- wp_set_object_terms( $step_id, $slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1196
- wp_set_object_terms( $step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1197
- }
1198
- }
1199
-
1200
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1201
-
1202
- wp_send_json_success( $flow_id );
1203
- }
1204
-
1205
- /**
1206
- * Create Flow
1207
- *
1208
- * @return void
1209
- */
1210
- function create_flow() {
1211
-
1212
- check_ajax_referer( 'cf-create-flow', 'security' );
1213
-
1214
- // Create post object.
1215
- $new_flow_post = array(
1216
- 'post_content' => '',
1217
- 'post_status' => 'publish',
1218
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
1219
- );
1220
-
1221
- // Insert the post into the database.
1222
- $flow_id = wp_insert_post( $new_flow_post );
1223
-
1224
- if ( is_wp_error( $flow_id ) ) {
1225
- wp_send_json_error( $flow_id->get_error_message() );
1226
- }
1227
-
1228
- /* Imported Flow */
1229
- update_post_meta( $flow_id, 'cartflows_imported_flow', 'yes' );
1230
-
1231
- wp_send_json_success( $flow_id );
1232
- }
1233
-
1234
- /**
1235
- * Create Step
1236
- *
1237
- * @return void
1238
- */
1239
- function import_step() {
1240
-
1241
- check_ajax_referer( 'cf-step-import', 'security' );
1242
-
1243
- $template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
1244
- $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
1245
- $step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( $_POST['step_title'] ) : '';
1246
- $step_type = isset( $_POST['step_type'] ) ? sanitize_title( $_POST['step_type'] ) : '';
1247
- $step_custom_title = isset( $_POST['step_custom_title'] ) ? sanitize_title( $_POST['step_custom_title'] ) : $step_title;
1248
-
1249
- $cartflow_meta = Cartflows_Flow_Meta::get_instance();
1250
-
1251
- $post_id = $cartflow_meta->create_step( $flow_id, $step_type, $step_custom_title );
1252
-
1253
- wcf()->logger->import_log( '------------------------------------' );
1254
- wcf()->logger->import_log( 'STARTED! Importing STEP' );
1255
- wcf()->logger->import_log( '------------------------------------' );
1256
-
1257
- if ( empty( $template_id ) || empty( $post_id ) ) {
1258
- /* translators: %s: template ID */
1259
- $data = sprintf( __( 'Invalid template id %1$s or post id %2$s.', 'cartflows' ), $template_id, $post_id );
1260
- wcf()->logger->import_log( $data );
1261
- wp_send_json_error( $data );
1262
- }
1263
-
1264
- wcf()->logger->import_log( 'Remote Step ' . $template_id . ' for local flow "' . get_the_title( $post_id ) . '" [' . $post_id . ']' );
1265
-
1266
- $response = CartFlows_API::get_instance()->get_template( $template_id );
1267
-
1268
- if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1269
- if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1270
- update_post_meta( $post_id, 'divi_content', $response['data']['divi_content'] );
1271
-
1272
- wp_update_post(
1273
- array(
1274
- 'ID' => $post_id,
1275
- 'post_content' => $response['data']['divi_content'],
1276
- )
1277
- );
1278
- }
1279
- }
1280
-
1281
- /* Imported Step */
1282
- update_post_meta( $post_id, 'cartflows_imported_step', 'yes' );
1283
-
1284
- // Import Post Meta.
1285
- self::import_post_meta( $post_id, $response );
1286
-
1287
- do_action( 'cartflows_import_complete' );
1288
-
1289
- // Batch Process.
1290
- do_action( 'cartflows_after_template_import', $post_id, $response );
1291
-
1292
- wcf()->logger->import_log( '------------------------------------' );
1293
- wcf()->logger->import_log( 'COMPLETE! Importing Step' );
1294
- wcf()->logger->import_log( '------------------------------------' );
1295
-
1296
- wp_send_json_success( $post_id );
1297
- }
1298
-
1299
- /**
1300
- * Import Step.
1301
- *
1302
- * @since 1.0.0
1303
- * @hook wp_ajax_cartflows_step_create_blank
1304
- *
1305
- * @return void
1306
- */
1307
- function step_create_blank() {
1308
-
1309
- check_ajax_referer( 'cf-step-create-blank', 'security' );
1310
-
1311
- $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
1312
- $step_type = isset( $_POST['step_type'] ) ? sanitize_text_field( $_POST['step_type'] ) : '';
1313
- $step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( $_POST['step_title'] ) : '';
1314
-
1315
- if ( empty( $flow_id ) || empty( $step_type ) ) {
1316
- /* translators: %s: flow ID */
1317
- $data = sprintf( __( 'Invalid flow id %1$s OR step type %2$s.', 'cartflows' ), $flow_id, $step_type );
1318
- wcf()->logger->import_log( $data );
1319
- wp_send_json_error( $data );
1320
- }
1321
-
1322
- wcf()->logger->import_log( '------------------------------------' );
1323
- wcf()->logger->import_log( 'STARTED! Creating Blank STEP for Flow ' . $flow_id );
1324
-
1325
- $step_type_title = str_replace( '-', ' ', $step_type );
1326
- $step_type_slug = strtolower( str_replace( '-', ' ', $step_type ) );
1327
-
1328
- $new_step_id = wp_insert_post(
1329
- array(
1330
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1331
- 'post_title' => $step_title,
1332
- 'post_content' => '',
1333
- 'post_status' => 'publish',
1334
- )
1335
- );
1336
-
1337
- // insert post meta.
1338
- update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
1339
-
1340
- $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
1341
- $term_exist = term_exists( $step_type_title, $taxonomy );
1342
-
1343
- if ( empty( $term_exist ) ) {
1344
- $terms = array(
1345
- array(
1346
- 'name' => $step_type_title,
1347
- ),
1348
- );
1349
-
1350
- Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
1351
- wcf()->logger->import_log( '(✓) Created new term ' . $step_type_title );
1352
- }
1353
-
1354
- $current_term = term_exists( $step_type_title, $taxonomy );
1355
-
1356
- // Set type object.
1357
- $data = get_term( $current_term['term_id'], $taxonomy );
1358
- $step_slug = $data->slug;
1359
- wp_set_object_terms( $new_step_id, $data->slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1360
- wcf()->logger->import_log( '(✓) Assigned existing term ' . $step_type_title . ' to the template ' . $new_step_id );
1361
-
1362
- // Set type.
1363
- update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
1364
- wcf()->logger->import_log( '(✓) Updated term ' . $data->name . ' to the post meta wcf-step-type.' );
1365
-
1366
- // Set flow.
1367
- wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1368
- wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
1369
-
1370
- CartFlows_Importer::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step_type_title, $step_slug );
1371
-
1372
- wcf()->logger->import_log( 'COMPLETE! Creating Blank STEP for Flow ' . $flow_id );
1373
- wcf()->logger->import_log( '------------------------------------' );
1374
-
1375
- wp_send_json_success( $new_step_id );
1376
- }
1377
-
1378
- /**
1379
- * Import Post Meta
1380
- *
1381
- * @since 1.0.0
1382
- *
1383
- * @param integer $post_id Post ID.
1384
- * @param array $response Post meta.
1385
- * @return void
1386
- */
1387
- public static function import_post_meta( $post_id, $response ) {
1388
-
1389
- $metadata = (array) $response['post_meta'];
1390
-
1391
- foreach ( $metadata as $meta_key => $meta_value ) {
1392
- $meta_value = isset( $meta_value[0] ) ? $meta_value[0] : '';
1393
-
1394
- if ( $meta_value ) {
1395
-
1396
- if ( is_serialized( $meta_value, true ) ) {
1397
- $raw_data = maybe_unserialize( stripslashes( $meta_value ) );
1398
- } elseif ( is_array( $meta_value ) ) {
1399
- $raw_data = json_decode( stripslashes( $meta_value ), true );
1400
- } else {
1401
- $raw_data = $meta_value;
1402
- }
1403
-
1404
- if ( '_elementor_data' === $meta_key ) {
1405
- if ( is_array( $raw_data ) ) {
1406
- $raw_data = wp_slash( json_encode( $raw_data ) );
1407
- } else {
1408
- $raw_data = wp_slash( $raw_data );
1409
- }
1410
- }
1411
- if ( '_elementor_data' !== $meta_key && '_elementor_draft' !== $meta_key && '_fl_builder_data' !== $meta_key && '_fl_builder_draft' !== $meta_key ) {
1412
- if ( is_array( $raw_data ) ) {
1413
- wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . json_encode( $raw_data ) );
1414
- } else {
1415
- if ( ! is_object( $raw_data ) ) {
1416
- wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . $raw_data );
1417
- }
1418
- }
1419
- }
1420
-
1421
- update_post_meta( $post_id, $meta_key, $raw_data );
1422
- }
1423
- }
1424
- }
1425
-
1426
- /**
1427
- * Import Template for Elementor
1428
- *
1429
- * @since 1.0.0
1430
- *
1431
- * @param integer $post_id Post ID.
1432
- * @param array $response Post meta.
1433
- * @param array $page_build_data Page build data.
1434
- * @return void
1435
- */
1436
- public static function import_template_elementor( $post_id, $response, $page_build_data ) {
1437
- if ( ! is_plugin_active( 'elementor/elementor.php' ) ) {
1438
- $data = __( 'Elementor is not activated. Please activate plugin Elementor Page Builder to import the step.', 'cartflows' );
1439
- wcf()->logger->import_log( $data );
1440
- wp_send_json_error( $data );
1441
- }
1442
-
1443
- require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
1444
-
1445
- wcf()->logger->import_log( '# Started "importing page builder data" for step ' . $post_id );
1446
-
1447
- $obj = new \Elementor\TemplateLibrary\CartFlows_Importer_Elementor();
1448
- $obj->import_single_template( $post_id );
1449
-
1450
- wcf()->logger->import_log( '# Complete "importing page builder data" for step ' . $post_id );
1451
- }
1452
-
1453
- /**
1454
- * Supported post types
1455
- *
1456
- * @since 1.0.0
1457
- *
1458
- * @return array Supported post types.
1459
- */
1460
- public static function supported_post_types() {
1461
- return apply_filters(
1462
- 'cartflows_supported_post_types',
1463
- array(
1464
- CARTFLOWS_FLOW_POST_TYPE,
1465
- )
1466
- );
1467
- }
1468
-
1469
- /**
1470
- * Check supported post type
1471
- *
1472
- * @since 1.0.0
1473
- *
1474
- * @param string $post_type Post type.
1475
- * @return boolean Supported post type status.
1476
- */
1477
- public static function is_supported_post( $post_type = '' ) {
1478
- if ( in_array( $post_type, self::supported_post_types() ) ) {
1479
- return true;
1480
- }
1481
-
1482
- return false;
1483
- }
1484
-
1485
- /**
1486
- * Set steps to the flow
1487
- *
1488
- * @param integer $flow_id Flow ID.
1489
- * @param integer $new_step_id New step ID.
1490
- * @param string $step_title Flow Type.
1491
- * @param string $step_slug Flow Type.
1492
- */
1493
- function set_step_to_flow( $flow_id, $new_step_id, $step_title, $step_slug ) {
1494
- // Update steps for the current flow.
1495
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
1496
-
1497
- if ( ! is_array( $flow_steps ) ) {
1498
- $flow_steps = array();
1499
- }
1500
-
1501
- $flow_steps[] = array(
1502
- 'id' => $new_step_id,
1503
- 'title' => $step_title,
1504
- 'type' => $step_slug,
1505
- );
1506
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1507
- wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . json_encode( $flow_steps ) );
1508
- }
1509
-
1510
- /**
1511
- * Localize variables in admin
1512
- *
1513
- * @param array $vars variables.
1514
- */
1515
- function localize_vars( $vars ) {
1516
-
1517
- $ajax_actions = array(
1518
- 'cf_step_import',
1519
- 'cf_load_steps',
1520
- 'cf_create_flow',
1521
- 'cf_default_flow',
1522
- 'cf_step_create_blank',
1523
- 'cf_import_flow_step',
1524
- );
1525
-
1526
- foreach ( $ajax_actions as $action ) {
1527
-
1528
- $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
1529
- }
1530
-
1531
- return $vars;
1532
- }
1533
-
1534
- /**
1535
- * Ajax action to activate plugin
1536
- */
1537
- public function activate_plugin() {
1538
-
1539
- $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( $_POST['plugin_init'] ) : '';
1540
-
1541
- $activate = activate_plugin( $plugin_init, '', false, true );
1542
-
1543
- if ( is_wp_error( $activate ) ) {
1544
- wp_send_json_error(
1545
- array(
1546
- 'success' => false,
1547
- 'message' => $activate->get_error_message(),
1548
- 'init' => $plugin_init,
1549
- )
1550
- );
1551
- }
1552
-
1553
- wp_send_json_success(
1554
- array(
1555
- 'success' => true,
1556
- 'message' => __( 'Plugin Successfully Activated', 'cartflows' ),
1557
- 'init' => $plugin_init,
1558
- )
1559
- );
1560
- }
1561
-
1562
- }
1563
-
1564
- /**
1565
- * Initialize class object with 'get_instance()' method
1566
- */
1567
- CartFlows_Importer::get_instance();
1568
-
1569
- endif;
1
+ <?php
2
+ /**
3
+ * CartFlows Admin
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'CartFlows_Importer' ) ) :
10
+
11
+ /**
12
+ * CartFlows Import
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class CartFlows_Importer {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.0
22
+ * @access private
23
+ * @var object Class object.
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Initiator
29
+ *
30
+ * @since 1.0.0
31
+ * @return object initialized object of class.
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+
38
+ return self::$instance;
39
+ }
40
+
41
+ /**
42
+ * Constructor
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public function __construct() {
47
+ add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
48
+ add_action( 'wp_ajax_cartflows_load_steps', array( $this, 'load_templates' ) );
49
+ add_action( 'wp_ajax_cartflows_step_import', array( $this, 'import_step' ) );
50
+ add_action( 'wp_ajax_cartflows_create_flow', array( $this, 'create_flow' ) );
51
+ add_action( 'wp_ajax_cartflows_default_flow', array( $this, 'create_default_flow' ) );
52
+ add_action( 'wp_ajax_cartflows_step_create_blank', array( $this, 'step_create_blank' ) );
53
+ add_action( 'wp_ajax_cartflows_import_flow_step', array( $this, 'import_flow' ) );
54
+ add_action( 'admin_footer', array( $this, 'js_templates' ) );
55
+ add_action( 'cartflows_import_complete', array( $this, 'clear_cache' ) );
56
+
57
+ add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
58
+
59
+ add_action( 'wp_ajax_cartflows_activate_plugin', array( $this, 'activate_plugin' ) );
60
+
61
+ add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
62
+ add_action( 'admin_init', array( $this, 'export_json' ) );
63
+ add_action( 'admin_init', array( $this, 'import_json' ) );
64
+ add_filter( 'post_row_actions', array( $this, 'export_link' ), 10, 2 );
65
+ add_action( 'admin_action_cartflows_export_flow', array( $this, 'export_flow' ) );
66
+ }
67
+
68
+ /**
69
+ * Add the export link to action list for flows row actions
70
+ *
71
+ * @since 1.1.4
72
+ *
73
+ * @param array $actions Actions array.
74
+ * @param object $post Post object.
75
+ *
76
+ * @return array
77
+ */
78
+ function export_link( $actions, $post ) {
79
+ if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
80
+ $actions['export'] = '<a href="' . wp_nonce_url( 'admin.php?action=cartflows_export_flow&post=' . $post->ID, basename( __FILE__ ), 'flow_export_nonce' ) . '" title="' . __( 'Export this flow', 'cartflows' ) . '" rel="permalink">' . __( 'Export', 'cartflows' ) . '</a>';
81
+ }
82
+ return $actions;
83
+ }
84
+
85
+ /**
86
+ * Add menus
87
+ *
88
+ * @since 1.1.4
89
+ */
90
+ function add_to_menus() {
91
+ add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Export', 'cartflows' ), __( 'Flow Export', 'cartflows' ), 'export', 'flow_exporter', array( $this, 'exporter_markup' ) );
92
+ add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Import', 'cartflows' ), __( 'Flow Import', 'cartflows' ), 'import', 'flow_importer', array( $this, 'importer_markup' ) );
93
+ }
94
+
95
+ /**
96
+ * Export flow with steps and its meta
97
+ *
98
+ * @since 1.1.4
99
+ */
100
+ function export_flow() {
101
+
102
+ if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_export_flow' == $_REQUEST['action'] ) ) ) {
103
+ wp_die( __( 'No post to export has been supplied!', 'cartflows' ) );
104
+ }
105
+
106
+ if ( ! isset( $_GET['flow_export_nonce'] ) || ! wp_verify_nonce( $_GET['flow_export_nonce'], basename( __FILE__ ) ) ) {
107
+ return;
108
+ }
109
+
110
+ // Get the original post id.
111
+ $flow_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
112
+
113
+ $flows = array();
114
+ $flows[] = $this->get_flow_export_data( $flow_id );
115
+ $flows = apply_filters( 'cartflows_export_data', $flows );
116
+
117
+ nocache_headers();
118
+ header( 'Content-Type: application/json; charset=utf-8' );
119
+ header( 'Content-Disposition: attachment; filename=cartflows-flow-' . $flow_id . '-' . date( 'm-d-Y' ) . '.json' );
120
+ header( 'Expires: 0' );
121
+
122
+ echo json_encode( $flows );
123
+ exit;
124
+ }
125
+
126
+ /**
127
+ * Export flow markup
128
+ *
129
+ * @since 1.1.4
130
+ */
131
+ function exporter_markup() {
132
+ include_once CARTFLOWS_DIR . 'includes/exporter.php';
133
+ }
134
+
135
+ /**
136
+ * Import flow markup
137
+ *
138
+ * @since 1.1.4
139
+ */
140
+ function importer_markup() {
141
+ include_once CARTFLOWS_DIR . 'includes/importer.php';
142
+ }
143
+
144
+ /**
145
+ * Export flow
146
+ *
147
+ * @since 1.1.4
148
+ */
149
+ function export_json() {
150
+ if ( empty( $_POST['cartflows-action'] ) || 'export' != $_POST['cartflows-action'] ) {
151
+ return;
152
+ }
153
+
154
+ if ( ! wp_verify_nonce( $_POST['cartflows-action-nonce'], 'cartflows-action-nonce' ) ) {
155
+ return;
156
+ }
157
+
158
+ if ( ! current_user_can( 'manage_options' ) ) {
159
+ return;
160
+ }
161
+
162
+ $flows = $this->get_all_flow_export_data();
163
+ $flows = apply_filters( 'cartflows_export_data', $flows );
164
+
165
+ nocache_headers();
166
+ header( 'Content-Type: application/json; charset=utf-8' );
167
+ header( 'Content-Disposition: attachment; filename=cartflows-flow-export-' . date( 'm-d-Y' ) . '.json' );
168
+ header( 'Expires: 0' );
169
+
170
+ echo json_encode( $flows );
171
+ exit;
172
+ }
173
+
174
+ /**
175
+ * Get flow export data
176
+ *
177
+ * @since 1.1.4
178
+ *
179
+ * @param integer $flow_id Flow ID.
180
+ * @return array
181
+ */
182
+ function get_flow_export_data( $flow_id ) {
183
+
184
+ $export_all = apply_filters( 'cartflows_export_all', false );
185
+
186
+ $valid_step_meta_keys = array(
187
+ '_wp_page_template',
188
+ '_thumbnail_id',
189
+ 'classic-editor-remember',
190
+ );
191
+
192
+ $new_steps = array();
193
+ $steps = get_post_meta( $flow_id, 'wcf-steps', true );
194
+ if ( $steps ) {
195
+ foreach ( $steps as $key => $step ) {
196
+
197
+ // Add step post meta.
198
+ $new_all_meta = array();
199
+ $all_meta = get_post_meta( $step['id'] );
200
+ if ( is_array( $all_meta ) ) {
201
+
202
+ if ( $export_all ) {
203
+ foreach ( $all_meta as $meta_key => $value ) {
204
+ $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
205
+ }
206
+ } else {
207
+
208
+ foreach ( $all_meta as $meta_key => $value ) {
209
+ if ( substr( $meta_key, 0, strlen( 'wcf' ) ) === 'wcf' ) {
210
+ $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
211
+ } elseif ( in_array( $meta_key, $valid_step_meta_keys ) ) {
212
+ $new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ // Add single step.
219
+ $step_data_arr = array(
220
+ 'title' => get_the_title( $step['id'] ),
221
+ 'type' => $step['type'],
222
+ 'meta' => $new_all_meta,
223
+ 'post_content' => '',
224
+ );
225
+
226
+ if ( $export_all ) {
227
+
228
+ $step_post_obj = get_post( $step['id'] );
229
+
230
+ $step_data_arr['post_content'] = $step_post_obj->post_content;
231
+ }
232
+
233
+ $new_steps[] = $step_data_arr;
234
+ }
235
+ }
236
+
237
+ // Add single flow.
238
+ return array(
239
+ 'title' => get_the_title( $flow_id ),
240
+ 'steps' => $new_steps,
241
+ );
242
+ }
243
+
244
+ /**
245
+ * Get all flow export data
246
+ *
247
+ * @since 1.1.4
248
+ */
249
+ function get_all_flow_export_data() {
250
+
251
+ $query_args = array(
252
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
253
+
254
+ // Query performance optimization.
255
+ 'fields' => 'ids',
256
+ 'no_found_rows' => true,
257
+ 'posts_per_page' => -1,
258
+ );
259
+
260
+ $query = new WP_Query( $query_args );
261
+ $flows = array();
262
+ if ( $query->posts ) {
263
+ foreach ( $query->posts as $key => $post_id ) {
264
+ $flows[] = $this->get_flow_export_data( $post_id );
265
+ }
266
+ }
267
+
268
+ return $flows;
269
+ }
270
+
271
+ /**
272
+ * Import our exported file
273
+ *
274
+ * @since 1.1.4
275
+ */
276
+ function import_json() {
277
+ if ( empty( $_POST['cartflows-action'] ) || 'import' != $_POST['cartflows-action'] ) {
278
+ return;
279
+ }
280
+
281
+ if ( ! wp_verify_nonce( $_POST['cartflows-action-nonce'], 'cartflows-action-nonce' ) ) {
282
+ return;
283
+ }
284
+
285
+ if ( ! current_user_can( 'manage_options' ) ) {
286
+ return;
287
+ }
288
+
289
+ $filename = $_FILES['file']['name'];
290
+ $file_info = explode( '.', $filename );
291
+ $extension = end( $file_info );
292
+
293
+ if ( 'json' != $extension ) {
294
+ wp_die( __( 'Please upload a valid .json file', 'cartflows' ) );
295
+ }
296
+
297
+ $file = $_FILES['file']['tmp_name'];
298
+
299
+ if ( empty( $file ) ) {
300
+ wp_die( __( 'Please upload a file to import', 'cartflows' ) );
301
+ }
302
+
303
+ // Retrieve the settings from the file and convert the JSON object to an array.
304
+ $flows = json_decode( file_get_contents( $file ), true );
305
+
306
+ if ( $flows ) {
307
+
308
+ foreach ( $flows as $key => $flow ) {
309
+
310
+ $flow_title = $flow['title'];
311
+ if ( post_exists( $flow['title'] ) ) {
312
+ $flow_title = $flow['title'] . ' Copy';
313
+ }
314
+
315
+ // Create post object.
316
+ $new_flow_args = array(
317
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
318
+ 'post_title' => $flow_title,
319
+ 'post_status' => 'draft',
320
+ );
321
+
322
+ // Insert the post into the database.
323
+ $flow_id = wp_insert_post( $new_flow_args );
324
+
325
+ if ( $flow['steps'] ) {
326
+ foreach ( $flow['steps'] as $key => $step ) {
327
+
328
+ $new_step_id = wp_insert_post(
329
+ array(
330
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
331
+ 'post_title' => $step['title'],
332
+ 'post_status' => 'publish',
333
+ 'meta_input' => $step['meta'],
334
+ 'post_content' => isset( $step['post_content'] ) ? $step['post_content'] : '',
335
+ )
336
+ );
337
+
338
+ // Insert post meta.
339
+ update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
340
+
341
+ $step_taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
342
+ $current_term = term_exists( $step['type'], $step_taxonomy );
343
+
344
+ // // Set type object.
345
+ $data = get_term( $current_term['term_id'], $step_taxonomy );
346
+ $step_slug = $data->slug;
347
+ wp_set_object_terms( $new_step_id, $data->slug, $step_taxonomy );
348
+
349
+ // Set type.
350
+ update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
351
+
352
+ // Set flow.
353
+ wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
354
+
355
+ CartFlows_Importer::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step['title'], $step_slug );
356
+
357
+ if ( isset( $step['post_content'] ) && ! empty( $step['post_content'] ) ) {
358
+
359
+ // Download and replace images.
360
+ $content = $this->get_content( $step['post_content'] );
361
+
362
+ // Update post content.
363
+ wp_update_post(
364
+ array(
365
+ 'ID' => $new_step_id,
366
+ 'post_content' => $content,
367
+ )
368
+ );
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+
375
+ add_action( 'admin_notices', array( $this, 'imported_successfully' ) );
376
+ }
377
+
378
+ /**
379
+ * Download and Replace hotlink images
380
+ *
381
+ * @since x.x.x
382
+ *
383
+ * @param string $content Mixed post content.
384
+ * @return array Hotlink image array.
385
+ */
386
+ function get_content( $content = '' ) {
387
+
388
+ $all_links = wp_extract_urls( $content );
389
+ $image_links = array();
390
+ $image_map = array();
391
+
392
+ // Not have any link.
393
+ if ( empty( $all_links ) ) {
394
+ return $content;
395
+ }
396
+
397
+ foreach ( $all_links as $key => $link ) {
398
+ if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $link ) ) {
399
+ $image_links[] = $link;
400
+ }
401
+ }
402
+
403
+ // Not have any image link.
404
+ if ( empty( $image_links ) ) {
405
+ return $content;
406
+ }
407
+
408
+ foreach ( $image_links as $key => $image_url ) {
409
+
410
+ // Download remote image.
411
+ $image = array(
412
+ 'url' => $image_url,
413
+ 'id' => rand( 000, 999 ),
414
+ );
415
+ $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
416
+
417
+ // Old and New image mapping links.
418
+ $image_map[ $image_url ] = $downloaded_image['url'];
419
+ }
420
+
421
+ // Replace old image links with new image links.
422
+ foreach ( $image_map as $old_url => $new_url ) {
423
+ $content = str_replace( $old_url, $new_url, $content );
424
+ }
425
+
426
+ return $content;
427
+
428
+ }
429
+
430
+ /**
431
+ * Imported notice
432
+ *
433
+ * @since 1.1.4
434
+ */
435
+ function imported_successfully() {
436
+ ?>
437
+ <div class="notice notice-success">
438
+ <p><?php _e( 'Successfully imported flows.', 'cartflows' ); ?></p>
439
+ </div>
440
+ <?php
441
+ }
442
+
443
+ /**
444
+ * Clear Cache.
445
+ *
446
+ * @since 1.0.0
447
+ */
448
+ public function clear_cache() {
449
+ // Clear 'Elementor' file cache.
450
+ if ( class_exists( '\Elementor\Plugin' ) ) {
451
+ Elementor\Plugin::$instance->files_manager->clear_cache();
452
+ }
453
+ }
454
+
455
+ /**
456
+ * JS Templates
457
+ *
458
+ * @since 1.0.0
459
+ *
460
+ * @return void
461
+ */
462
+ function js_templates() {
463
+
464
+ // Loading Templates.
465
+ ?>
466
+ <script type="text/template" id="tmpl-cartflows-step-loading">
467
+ <div class="template-message-block cartflows-step-loading">
468
+ <h2>
469
+ <span class="spinner"></span>
470
+ <?php _e( 'Loading Steps', 'cartflows' ); ?>
471
+ </h2>
472
+ <p class="description"><?php _e( 'Getting steps from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
473
+ </div>
474
+ </script>
475
+
476
+ <?php
477
+ // Search Templates.
478
+ ?>
479
+ <script type="text/template" id="tmpl-cartflows-searching-templates">
480
+ <div class="template-message-block cartflows-searching-templates">
481
+ <h2>
482
+ <span class="spinner"></span>
483
+ <?php _e( 'Searching Template..', 'cartflows' ); ?>
484
+ </h2>
485
+ <p class="description"><?php _e( 'Getting templates from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
486
+ </div>
487
+ </script>
488
+
489
+ <?php
490
+ // CartFlows Importing Template.
491
+ ?>
492
+ <script type="text/template" id="tmpl-cartflows-step-importing">
493
+ <div class="template-message-block cartflows-step-importing">
494
+ <h2><span class="spinner"></span> <?php _e( 'Importing..', 'cartflows' ); ?></h2>
495
+ </div>
496
+ </script>
497
+
498
+ <?php
499
+ // CartFlows Imported.
500
+ ?>
501
+ <script type="text/template" id="tmpl-cartflows-step-imported">
502
+ <div class="template-message-block cartflows-step-imported">
503
+ <h2><span class="dashicons dashicons-yes"></span> <?php _e( 'Imported', 'cartflows' ); ?></h2>
504
+ <p class="description"><?php _e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span></p></div>
505
+ </script>
506
+
507
+ <?php
508
+ // No templates.
509
+ ?>
510
+ <script type="text/template" id="tmpl-cartflows-no-steps">
511
+ <div class="cartflows-no-steps">
512
+ <div class="template-message-block">
513
+ <h2><?php _e( 'Coming Soon!', 'cartflows' ); ?></h2>
514
+ <p class="description"></p>
515
+ </div>
516
+ </div>
517
+ </script>
518
+
519
+ <?php
520
+ // No templates.
521
+ ?>
522
+ <script type="text/template" id="tmpl-cartflows-no-flows">
523
+ <div class="cartflows-no-flows">
524
+ <div class="template-message-block">
525
+ <h2><?php _e( 'Coming Soon!', 'cartflows' ); ?></h2>
526
+ <p class="description"></p>
527
+ </div>
528
+ </div>
529
+ </script>
530
+
531
+ <?php
532
+ // Error handling.
533
+ ?>
534
+ <script type="text/template" id="tmpl-templator-error">
535
+ <div class="notice notice-error"><p>{{ data }}</p></div>
536
+ </script>
537
+
538
+ <?php
539
+ // Redirect to Elementor.
540
+ ?>
541
+ <script type="text/template" id="tmpl-templator-redirect-to-elementor">
542
+ <div class="template-message-block templator-redirect-to-elementor">
543
+ <h2><span class="dashicons dashicons-yes"></span> <?php _e( 'Imported', 'cartflows' ); ?></h2>
544
+ <p class="description"><?php _e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span><br/><br/><?php _e( 'Redirecting to the Elementor edit window.', 'cartflows' ); ?> </p></div>
545
+ </script>
546
+
547
+ <?php
548
+ /**
549
+ * Responsive Buttons
550
+ */
551
+ ?>
552
+ <script type="text/template" id="tmpl-cartflows-responsive-view">
553
+ <span class="responsive-view">
554
+ <span class="actions">
555
+ <a class="desktop" href="#"><span data-view="desktop " class="active dashicons dashicons-desktop"></span></a>
556
+ <a class="tablet" href="#"><span data-view="tablet" class="dashicons dashicons-tablet"></span></a>
557
+ <a class="mobile" href="#"><span data-view="mobile" class="dashicons dashicons-smartphone"></span></a>
558
+ </span>
559
+ </span>
560
+ </script>
561
+
562
+ <?php
563
+ // Templates data.
564
+ ?>
565
+ <script type="text/template" id="tmpl-cartflows-flows-list">
566
+
567
+ <# console.log( data.items.length ) #>
568
+ <# console.log( data.items ) #>
569
+ <# if ( data.items.length ) { #>
570
+ <# for ( key in data.items ) { #>
571
+ <#
572
+ var flow_steps = [];
573
+ if( data.items[ key ].flow_steps ) {
574
+ flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
575
+ return value['id'];
576
+ });
577
+ }
578
+ #>
579
+ <div class="inner">
580
+ <div class="template">
581
+ <span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
582
+ <div class="template-screenshot">
583
+ <# if( data.items[ key ].featured_image_url ) { #>
584
+ <img src="{{ data.items[ key ].featured_image_url }}" />
585
+ <# } else { #>
586
+ <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
587
+ <# } #>
588
+ </div>
589
+ <a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>flow={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
590
+ <# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
591
+ <span class="wcf-flow-type pro"><?php _e( 'Pro', 'cartflows' ); ?></span>
592
+ <# } #>
593
+ </span>
594
+ <div class="template-id-container">
595
+ <h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
596
+ <div class="template-actions">
597
+
598
+ <#
599
+ if( data.items[ key ].page_builder.slug ) {
600
+ required_plugin_group = data.items[ key ].page_builder.slug;
601
+ } else {
602
+ required_plugin_group = '';
603
+ }
604
+
605
+ if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
606
+ import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
607
+ } else {
608
+ import_btn_title = 'Import';
609
+ } #>
610
+
611
+ <# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
612
+ <a data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
613
+ <# } else if( CartFlowsImportVars._is_pro_active ) { #>
614
+ <a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php _e( 'Activate License', 'cartflows' ); ?></a>
615
+ <# } else { #>
616
+ <a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php _e( 'Get Pro', 'cartflows' ); ?></a>
617
+ <# } #>
618
+ </div>
619
+ </div>
620
+ </div>
621
+ </div>
622
+ <# } #>
623
+ <# } #>
624
+ </script>
625
+
626
+ <?php
627
+ // Empty Step.
628
+ ?>
629
+ <script type="text/template" id="tmpl-cartflows-create-blank-step">
630
+ <div class="inner">
631
+ <div class="template">
632
+ <span class="thumbnail site-preview cartflows-flow-preview">
633
+ <div class="template-screenshot">
634
+ <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/start-scratch.jpg" />
635
+ </div>
636
+ <div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
637
+ </span>
638
+ <div class="template-id-container">
639
+ <h3 class="template-name"> Blank </h3>
640
+ <div class="template-actions">
641
+ <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create', 'cartflows' ); ?></a>
642
+ </div>
643
+ </div>
644
+ </div>
645
+ </div>
646
+ </script>
647
+
648
+ <?php
649
+ // Templates data.
650
+ ?>
651
+ <script type="text/template" id="tmpl-cartflows-steps-list">
652
+ <# if ( data.items.length ) { #>
653
+ <# for ( key in data.items ) { #>
654
+ <#
655
+ var flow_steps = [];
656
+ if( data.items[ key ].flow_steps ) {
657
+ flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
658
+ return value['id'];
659
+ });
660
+ }
661
+ #>
662
+ <div class="inner">
663
+ <div class="template">
664
+ <span class="thumbnail site-preview cartflows-preview-flow-steps" data-flow-steps="{{ JSON.stringify( data.items[ key ].flow_steps ) }}" data-title="{{ data.items[ key ].title.rendered }}">
665
+ <div class="template-screenshot">
666
+ <# if( data.items[ key ].featured_image_url ) { #>
667
+ <img src="{{ data.items[ key ].featured_image_url }}" />
668
+ <# } else { #>
669
+ <img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
670
+ <# } #>
671
+ </div>
672
+ <div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
673
+ <a href="<?php echo CARTFLOWS_TEMPLATES_URL . 'preview/?'; ?>step={{ data.items[ key ].id }}&title={{{ data.items[ key ].title.rendered }}}" class="preview" target="_blank">Preview <i class="dashicons dashicons-external"></i></a>
674
+ <# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
675
+ <span class="wcf-flow-type pro"><?php _e( 'Pro', 'cartflows' ); ?></span>
676
+ <# } #>
677
+ </span>
678
+ <div class="template-id-container">
679
+ <h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
680
+ <div class="template-actions">
681
+
682
+ <#
683
+
684
+ var step_slug = data.items[ key ].step_type.slug || '';
685
+ var step_title = data.items[ key ].step_type.name || '';
686
+ var import_btn_title = 'Import';
687
+
688
+ var required_plugin_group = '';
689
+ if( data.items[ key ].page_builder ) {
690
+ required_plugin_group = data.items[ key ].page_builder.slug;
691
+
692
+ if( data.items[ key ].page_builder.slug && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug] && CartFlowsImportVars.required_plugins[data.items[ key ].page_builder.slug].button_title ) {
693
+ import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
694
+ }
695
+ }
696
+ #>
697
+
698
+ <# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
699
+ <a data-slug="{{step_slug}}" data-title="{{step_title}}" data-flow-steps="{{ flow_steps }}" data-required-plugin-group="{{required_plugin_group}}" href="#" class="button button-primary cartflows-step-import" data-template-id="{{ data.items[ key ].id }}">{{ import_btn_title }}</a>
700
+ <# } else if( CartFlowsImportVars._is_pro_active ) { #>
701
+ <a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php _e( 'Activate License', 'cartflows' ); ?></a>
702
+ <# } else { #>
703
+ <a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php _e( 'Get Pro', 'cartflows' ); ?></a>
704
+ <# } #>
705
+ </div>
706
+ </div>
707
+ </div>
708
+ </div>
709
+ <# } #>
710
+ <# } #>
711
+ </script>
712
+
713
+ <?php
714
+ /**
715
+ * TMPL - Website Unreachable
716
+ */
717
+ ?>
718
+ <script type="text/template" id="tmpl-cartflows-website-unreachable">
719
+ <div class="postbox cartflows-website-unreachable">
720
+ <h2><?php _e( 'Under Maintenance..', 'cartflows' ); ?></h2>
721
+ <p><?php _e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly.', 'cartflows' ); ?></p>
722
+ <p><?php _e( 'In rare case, it is possible your website is having trouble connecting with ours. If you need help, please feel free to get in touch with us from our website..', 'cartflows' ); ?></p>
723
+ </div>
724
+ </script>
725
+
726
+ <?php
727
+ /**
728
+ * TMPL - Filters
729
+ */
730
+ ?>
731
+ <script type="text/template" id="tmpl-cartflows-page-builder-notice">
732
+ <?php
733
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
734
+ $page_builder = Cartflows_Helper::get_required_plugins_for_page_builder( Cartflows_Helper::get_common_setting( 'default_page_builder' ) );
735
+ $title = $page_builder['title'];
736
+
737
+ $plugin_string = '<a href="#" data-slug="' . esc_html( $default_page_builder ) . '" class="wcf-install-plugin">Please click here and activate ' . esc_html( $title ) . '</a>';
738
+ $theme_status = '';
739
+ if ( 'divi' === $default_page_builder ) {
740
+
741
+ $theme_status = $page_builder['theme-status'];
742
+ $plugin_status = $page_builder['plugin-status'];
743
+
744
+ if ( 'deactivate' === $theme_status || 'install' === $plugin_status ) {
745
+ $plugin_string = 'Please activate ' . esc_html( $title );
746
+ } elseif ( ( 'deactivate' === $theme_status || 'not-installed' === $theme_status ) && 'install' === $plugin_status ) {
747
+ $plugin_string = 'Please install and activate ' . esc_html( $title );
748
+ }
749
+ }
750
+ ?>
751
+ <div class="wcf-page-builder-message">
752
+ <p><?php /* translators: %s: Plugin string */ printf( __( '%1$s to see CartFlows templates. If you prefer another page builder tool, you can <a href="%2$s" target="blank">select it here</a>.', 'cartflows' ), $plugin_string, admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS . '&action=common-settings#form-field-wcf_default_page_builder' ) ); ?></p>
753
+ <p>If your preferred page builder is not available, feel free to <a href="#" data-slug="canvas" class="wcf-create-from-scratch-link">create your own</a> pages using page builder of your choice as CartFlows works with all major page builders.</p>
754
+ <p>We plan to add design templates made with more page builder shortly!</p>
755
+ </div>
756
+ </script>
757
+
758
+ <?php
759
+ /**
760
+ * TMPL - Filters
761
+ */
762
+ ?>
763
+ <script type="text/template" id="tmpl-cartflows-term-filters-dropdown">
764
+ <# if ( data ) { #>
765
+ <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
766
+ <# if ( data.args.show_all ) { #>
767
+ <option value="all"> <?php _e( 'All', 'cartflows' ); ?> </option>
768
+ <# } #>
769
+ <# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
770
+ <option value=""> <?php _e( 'Select Step Type', 'cartflows' ); ?> </option>
771
+ <# } #>
772
+ <# for ( key in data.items ) { #>
773
+ <option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
774
+ <# } #>
775
+ </select>
776
+ <# } #>
777
+ </script>
778
+
779
+ <script type="text/template" id="tmpl-cartflows-term-filters">
780
+
781
+ <# if ( data ) { #>
782
+
783
+ <?php /* <# if ( CartFlowsImportVars.flow_page_builder === data.args.remote_slug || CartFlowsImportVars.step_page_builder === data.args.remote_slug ) { #> */ ?>
784
+ <ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
785
+
786
+ <# if ( data.args.show_all ) { #>
787
+ <li>
788
+ <a href="#" data-group="all"> All </a>
789
+ </li>
790
+ <# } #>
791
+
792
+ <# for ( key in data.items ) { #>
793
+ <li>
794
+ <a href="#" data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</a>
795
+ </li>
796
+ <# } #>
797
+
798
+ </ul>
799
+
800
+ <?php
801
+
802
+ /*
803
+ <# } else { #>
804
+ <select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
805
+
806
+ <# if ( data.args.show_all ) { #>
807
+ <option value="all"> <?php _e( 'All', 'cartflows' ); ?> </option>
808
+ <# } #>
809
+
810
+ <# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
811
+ <option value=""> <?php _e( 'Select Step Type', 'cartflows' ); ?> </option>
812
+ <# } #>
813
+
814
+ <# for ( key in data.items ) { #>
815
+ <option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
816
+ <# } #>
817
+
818
+ </select>
819
+ */
820
+ ?>
821
+
822
+ <?php /* <# } #> */ ?>
823
+
824
+ <# } #>
825
+ </script>
826
+
827
+ <?php
828
+ // Step Type.
829
+ ?>
830
+ <script type="text/template" id="tmpl-cartflows-step-types">
831
+ <ul class="wcf-tab nav-tabs">
832
+ <# if( data.items_count ) { #>
833
+ <# for( key in data.items ) { #>
834
+ <# console.log( data.items[ key ].id ) #>
835
+ <li data-slug="{{data.items[ key ].slug}}" data-title="{{ data.items[ key ].name }}">
836
+ <a href="#{{{ data.items[ key ].slug }}}">{{{ data.items[ key ].name }}}</a>
837
+ </li>
838
+ <# } #>
839
+ <# } #>
840
+ </ul>
841
+ </script>
842
+
843
+ <?php
844
+ // Add to library button.
845
+ ?>
846
+ <script type="text/template" id="tmpl-templator-add-to-library">
847
+ <a class="templator-add-to-library page-title-action cartflows-load-steps-library"><i class="dashicons dashicons-cloud"></i><?php esc_attr_e( 'Import from Cloud', 'cartflows' ); ?></a>
848
+ </script>
849
+ <?php
850
+ }
851
+
852
+ /**
853
+ * Enqueue scripts
854
+ *
855
+ * @since 1.0.0
856
+ *
857
+ * @hook admin_enqueue_scripts
858
+ * @param string $hook Current page hook.
859
+ */
860
+ function scripts( $hook = '' ) {
861
+
862
+ if ( ! self::is_supported_post( get_current_screen()->post_type ) ) {
863
+ return;
864
+ }
865
+
866
+ wp_enqueue_script( 'cartflows-rest-api', CARTFLOWS_URL . 'assets/js/rest-api.js', array( 'jquery' ), CARTFLOWS_VER, true );
867
+ wp_enqueue_style( 'cartflows-import', CARTFLOWS_URL . 'assets/css/import.css', null, CARTFLOWS_VER, 'all' );
868
+ wp_style_add_data( 'cartflows-import', 'rtl', 'replace' );
869
+ wp_enqueue_script( 'cartflows-import', CARTFLOWS_URL . 'assets/js/import.js', array( 'jquery', 'wp-util', 'cartflows-rest-api', 'updates' ), CARTFLOWS_VER, true );
870
+
871
+ $localize_vars = array(
872
+ '_is_pro_active' => _is_cartflows_pro(),
873
+
874
+ // Flow and its rest fields.
875
+ 'flow' => CARTFLOWS_FLOW_POST_TYPE,
876
+ 'flow_fields' => array(
877
+ 'id',
878
+ 'title',
879
+ 'flow_type',
880
+ 'page_builder',
881
+ 'flow_steps',
882
+ 'licence_status',
883
+ 'featured_image_url',
884
+ 'featured_media', // @required for field `featured_image_url`.
885
+ ),
886
+
887
+ // Flow type and rest fields.
888
+ 'flow_type' => CARTFLOWS_TAXONOMY_FLOW_CATEGORY,
889
+ 'flow_type_fields' => array(
890
+ 'id',
891
+ 'name',
892
+ 'slug',
893
+ ),
894
+
895
+ // Flow page builder and rest fields.
896
+ 'flow_page_builder' => CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER,
897
+ 'flow_page_builder_fields' => array(
898
+ 'id',
899
+ 'name',
900
+ 'slug',
901
+ ),
902
+
903
+ // Step page builder and rest fields.
904
+ 'step_page_builder' => CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER,
905
+ 'step_page_builder_fields' => array(
906
+ 'id',
907
+ 'name',
908
+ 'slug',
909
+ ),
910
+
911
+ // Step and its rest fields.
912
+ 'step' => CARTFLOWS_STEP_POST_TYPE,
913
+ 'step_fields' => array(
914
+ 'title',
915
+ 'featured_image_url',
916
+ 'featured_media', // @required for field `featured_image_url`.
917
+ 'id',
918
+ 'flow_type',
919
+ 'step_type',
920
+ 'page_builder',
921
+ 'licence_status',
922
+ ),
923
+
924
+ // Step type and its rest fields.
925
+ 'step_type' => CARTFLOWS_TAXONOMY_STEP_TYPE,
926
+ 'step_type_fields' => array(
927
+ 'id',
928
+ 'name',
929
+ 'slug',
930
+ ),
931
+
932
+ 'domain_url' => CARTFLOWS_DOMAIN_URL,
933
+ 'server_url' => CARTFLOWS_TEMPLATES_URL,
934
+ 'server_rest_url' => CARTFLOWS_TEMPLATES_URL . 'wp-json/wp/v2/',
935
+ 'site_url' => site_url(),
936
+ 'import_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_importer' ),
937
+ 'export_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_exporter' ),
938
+ 'admin_url' => admin_url(),
939
+ 'licence_args' => CartFlows_API::get_instance()->get_licence_args(),
940
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
941
+ 'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false,
942
+
943
+ 'required_plugins' => Cartflows_Helper::get_plugins_groupby_page_builders(),
944
+
945
+ 'default_page_builder' => Cartflows_Helper::get_common_setting( 'default_page_builder' ),
946
+ );
947
+
948
+ // var_dump(Cartflows_Helper::get_common_setting( 'default_page_builder' ));
949
+ // wp_die( );
950
+ // Add thickbox.
951
+ add_thickbox();
952
+
953
+ wp_localize_script( 'cartflows-import', 'CartFlowsImportVars', $localize_vars );
954
+ wp_localize_script( 'cartflows-rest-api', 'CartFlowsImportVars', $localize_vars );
955
+ }
956
+
957
+ /**
958
+ * Load Template
959
+ *
960
+ * @since 1.0.0
961
+ *
962
+ * @hook cartflows_load_steps
963
+ * @return void
964
+ */
965
+ function load_templates() {
966
+
967
+ check_ajax_referer( 'cf-load-steps', 'security' );
968
+
969
+ $args = ( isset( $_POST['args'] ) ) ? array_map( 'sanitize_text_field', $_POST['args'] ) : array();
970
+ $templates = CartFlows_API::get_instance()->get_templates( $args );
971
+
972
+ if ( $templates['templates_count'] ) {
973
+ wp_send_json_success( $templates );
974
+ } else {
975
+ wp_send_json_error( $templates );
976
+ }
977
+ wp_die();
978
+ }
979
+
980
+ /**
981
+ * Import.
982
+ *
983
+ * @since 1.0.0
984
+ *
985
+ * @hook wp_ajax_cartflows_import_flow_step
986
+ * @return void
987
+ */
988
+ function import_flow() {
989
+
990
+ check_ajax_referer( 'cf-import-flow-step', 'security' );
991
+
992
+ $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
993
+ $template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
994
+
995
+ wcf()->logger->import_log( '------------------------------------' );
996
+ wcf()->logger->import_log( 'STARTED! Importing FLOW' );
997
+ wcf()->logger->import_log( '------------------------------------' );
998
+ wcf()->logger->import_log( '(✓) Creating new step from remote step [' . $template_id . '] for FLOW ' . get_the_title( $flow_id ) . ' [' . $flow_id . ']' );
999
+
1000
+ $response = CartFlows_API::get_instance()->get_template( $template_id );
1001
+
1002
+ $post_content = isset( $response['data']['content']->rendered ) ? $response['data']['content']->rendered : '';
1003
+ if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1004
+ if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1005
+ $post_content = $response['data']['divi_content'];
1006
+ }
1007
+ }
1008
+
1009
+ if ( false === $response['success'] ) {
1010
+ wcf()->logger->import_log( '(✕) Failed to fetch remote data.' );
1011
+ wp_send_json_error( $response );
1012
+ }
1013
+
1014
+ wcf()->logger->import_log( '(✓) Successfully getting remote step response ' . json_encode( $response ) );
1015
+
1016
+ $new_step_id = wp_insert_post(
1017
+ array(
1018
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1019
+ 'post_title' => $response['title'],
1020
+ 'post_content' => $post_content,
1021
+ 'post_status' => 'publish',
1022
+ )
1023
+ );
1024
+
1025
+ if ( is_wp_error( $new_step_id ) ) {
1026
+ wcf()->logger->import_log( '(✕) Failed to create new step for flow ' . $flow_id );
1027
+ wp_send_json_error( $new_step_id );
1028
+ }
1029
+
1030
+ if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1031
+ if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1032
+ update_post_meta( $new_step_id, 'divi_content', $response['data']['divi_content'] );
1033
+ }
1034
+ }
1035
+
1036
+ /* Imported Step */
1037
+ update_post_meta( $new_step_id, 'cartflows_imported_step', 'yes' );
1038
+
1039
+ wcf()->logger->import_log( '(✓) Created new step ' . '"' . $response['title'] . '" id ' . $new_step_id );
1040
+ // insert post meta.
1041
+ update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
1042
+ wcf()->logger->import_log( '(✓) Added flow ID ' . $flow_id . ' in post meta key wcf-flow-id.' );
1043
+
1044
+ /**
1045
+ * Import & Set type.
1046
+ */
1047
+ $term = isset( $response['data']['step_type'] ) ? $response['data']['step_type'] : '';
1048
+ $term_slug = '';
1049
+ if ( $term ) {
1050
+
1051
+ $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
1052
+ $term_exist = term_exists( $term->name, $taxonomy );
1053
+
1054
+ if ( empty( $term_exist ) ) {
1055
+ $terms = array(
1056
+ array(
1057
+ 'name' => $term->name,
1058
+ ),
1059
+ );
1060
+
1061
+ Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
1062
+ wcf()->logger->import_log( '(✓) Created new term ' . $term->name );
1063
+ }
1064
+
1065
+ $current_term = term_exists( $term->name, $taxonomy );
1066
+
1067
+ // Set type object.
1068
+ $data = get_term( $current_term['term_id'], $taxonomy );
1069
+ $term_slug = $data->slug;
1070
+ $term_name = $data->name;
1071
+ wp_set_object_terms( $new_step_id, $term_slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1072
+ wcf()->logger->import_log( '(✓) Assigned existing term ' . $term_name . ' to the template ' . $new_step_id );
1073
+
1074
+ // Set type.
1075
+ update_post_meta( $new_step_id, 'wcf-step-type', $term_slug );
1076
+ wcf()->logger->import_log( '(✓) Updated term ' . $term_name . ' to the post meta wcf-step-type.' );
1077
+ }
1078
+
1079
+ // Set flow.
1080
+ wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1081
+ wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
1082
+
1083
+ /**
1084
+ * Update steps for the current flow.
1085
+ */
1086
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
1087
+
1088
+ if ( ! is_array( $flow_steps ) ) {
1089
+ $flow_steps = array();
1090
+ }
1091
+
1092
+ $flow_steps[] = array(
1093
+ 'id' => $new_step_id,
1094
+ 'title' => $response['title'],
1095
+ 'type' => $term_slug,
1096
+ );
1097
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1098
+ wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . json_encode( $flow_steps ) );
1099
+
1100
+ // Import Post Meta.
1101
+ self::import_post_meta( $new_step_id, $response );
1102
+
1103
+ wcf()->logger->import_log( '(✓) Importing step "' . get_the_title( $new_step_id ) . '" [' . $new_step_id . '] for FLOW "' . get_the_title( $flow_id ) . '" [' . $flow_id . ']' );
1104
+ wcf()->logger->import_log( '------------------------------------' );
1105
+ wcf()->logger->import_log( 'COMPLETE! Importing FLOW' );
1106
+ wcf()->logger->import_log( '------------------------------------' );
1107
+
1108
+ do_action( 'cartflows_import_complete' );
1109
+ wcf()->logger->import_log( '(✓) BATCH STARTED for step ' . $new_step_id . ' for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
1110
+
1111
+ // Batch Process.
1112
+ do_action( 'cartflows_after_template_import', $new_step_id, $response );
1113
+
1114
+ /**
1115
+ * End
1116
+ */
1117
+ wp_send_json_success( $new_step_id );
1118
+ }
1119
+
1120
+ /**
1121
+ * Import Step.
1122
+ *
1123
+ * @since 1.0.0
1124
+ * @hook wp_ajax_cartflows_step_import
1125
+ *
1126
+ * @return void
1127
+ */
1128
+ function create_default_flow() {
1129
+
1130
+ check_ajax_referer( 'cf-default-flow', 'security' );
1131
+
1132
+ // Create post object.
1133
+ $new_flow_post = array(
1134
+ 'post_content' => '',
1135
+ 'post_status' => 'publish',
1136
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
1137
+ );
1138
+
1139
+ // Insert the post into the database.
1140
+ $flow_id = wp_insert_post( $new_flow_post );
1141
+
1142
+ if ( is_wp_error( $flow_id ) ) {
1143
+ wp_send_json_error( $flow_id->get_error_message() );
1144
+ }
1145
+
1146
+ $flow_steps = array();
1147
+
1148
+ $steps_data = array(
1149
+ 'landing' => __( 'Landing Page', 'cartflows' ),
1150
+ 'checkout' => __( 'Checkout Page', 'cartflows' ),
1151
+ 'thankyou' => __( 'Thank You Page', 'cartflows' ),
1152
+ );
1153
+
1154
+ foreach ( $steps_data as $slug => $title ) {
1155
+
1156
+ $post_content = '';
1157
+
1158
+ switch ( $slug ) {
1159
+ case 'checkout':
1160
+ $post_content = '';
1161
+ break;
1162
+ case 'thankyou':
1163
+ $post_content = '';
1164
+ break;
1165
+ default:
1166
+ $post_content = '';
1167
+ break;
1168
+ }
1169
+
1170
+ $step_id = wp_insert_post(
1171
+ array(
1172
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1173
+ 'post_title' => $title,
1174
+ 'post_content' => $post_content,
1175
+ 'post_status' => 'publish',
1176
+ )
1177
+ );
1178
+
1179
+ if ( is_wp_error( $step_id ) ) {
1180
+ wp_send_json_error( $step_id->get_error_message() );
1181
+ }
1182
+
1183
+ if ( $step_id ) {
1184
+
1185
+ $flow_steps[] = array(
1186
+ 'id' => $step_id,
1187
+ 'title' => $title,
1188
+ 'type' => $slug,
1189
+ );
1190
+
1191
+ // insert post meta.
1192
+ update_post_meta( $step_id, 'wcf-flow-id', $flow_id );
1193
+ update_post_meta( $step_id, 'wcf-step-type', $slug );
1194
+
1195
+ wp_set_object_terms( $step_id, $slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1196
+ wp_set_object_terms( $step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1197
+ }
1198
+ }
1199
+
1200
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1201
+
1202
+ wp_send_json_success( $flow_id );
1203
+ }
1204
+
1205
+ /**
1206
+ * Create Flow
1207
+ *
1208
+ * @return void
1209
+ */
1210
+ function create_flow() {
1211
+
1212
+ check_ajax_referer( 'cf-create-flow', 'security' );
1213
+
1214
+ // Create post object.
1215
+ $new_flow_post = array(
1216
+ 'post_content' => '',
1217
+ 'post_status' => 'publish',
1218
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
1219
+ );
1220
+
1221
+ // Insert the post into the database.
1222
+ $flow_id = wp_insert_post( $new_flow_post );
1223
+
1224
+ if ( is_wp_error( $flow_id ) ) {
1225
+ wp_send_json_error( $flow_id->get_error_message() );
1226
+ }
1227
+
1228
+ /* Imported Flow */
1229
+ update_post_meta( $flow_id, 'cartflows_imported_flow', 'yes' );
1230
+
1231
+ wp_send_json_success( $flow_id );
1232
+ }
1233
+
1234
+ /**
1235
+ * Create Step
1236
+ *
1237
+ * @return void
1238
+ */
1239
+ function import_step() {
1240
+
1241
+ check_ajax_referer( 'cf-step-import', 'security' );
1242
+
1243
+ $template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
1244
+ $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
1245
+ $step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( $_POST['step_title'] ) : '';
1246
+ $step_type = isset( $_POST['step_type'] ) ? sanitize_title( $_POST['step_type'] ) : '';
1247
+ $step_custom_title = isset( $_POST['step_custom_title'] ) ? sanitize_title( $_POST['step_custom_title'] ) : $step_title;
1248
+
1249
+ $cartflow_meta = Cartflows_Flow_Meta::get_instance();
1250
+
1251
+ $post_id = $cartflow_meta->create_step( $flow_id, $step_type, $step_custom_title );
1252
+
1253
+ wcf()->logger->import_log( '------------------------------------' );
1254
+ wcf()->logger->import_log( 'STARTED! Importing STEP' );
1255
+ wcf()->logger->import_log( '------------------------------------' );
1256
+
1257
+ if ( empty( $template_id ) || empty( $post_id ) ) {
1258
+ /* translators: %s: template ID */
1259
+ $data = sprintf( __( 'Invalid template id %1$s or post id %2$s.', 'cartflows' ), $template_id, $post_id );
1260
+ wcf()->logger->import_log( $data );
1261
+ wp_send_json_error( $data );
1262
+ }
1263
+
1264
+ wcf()->logger->import_log( 'Remote Step ' . $template_id . ' for local flow "' . get_the_title( $post_id ) . '" [' . $post_id . ']' );
1265
+
1266
+ $response = CartFlows_API::get_instance()->get_template( $template_id );
1267
+
1268
+ if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
1269
+ if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
1270
+ update_post_meta( $post_id, 'divi_content', $response['data']['divi_content'] );
1271
+
1272
+ wp_update_post(
1273
+ array(
1274
+ 'ID' => $post_id,
1275
+ 'post_content' => $response['data']['divi_content'],
1276
+ )
1277
+ );
1278
+ }
1279
+ }
1280
+
1281
+ /* Imported Step */
1282
+ update_post_meta( $post_id, 'cartflows_imported_step', 'yes' );
1283
+
1284
+ // Import Post Meta.
1285
+ self::import_post_meta( $post_id, $response );
1286
+
1287
+ do_action( 'cartflows_import_complete' );
1288
+
1289
+ // Batch Process.
1290
+ do_action( 'cartflows_after_template_import', $post_id, $response );
1291
+
1292
+ wcf()->logger->import_log( '------------------------------------' );
1293
+ wcf()->logger->import_log( 'COMPLETE! Importing Step' );
1294
+ wcf()->logger->import_log( '------------------------------------' );
1295
+
1296
+ wp_send_json_success( $post_id );
1297
+ }
1298
+
1299
+ /**
1300
+ * Import Step.
1301
+ *
1302
+ * @since 1.0.0
1303
+ * @hook wp_ajax_cartflows_step_create_blank
1304
+ *
1305
+ * @return void
1306
+ */
1307
+ function step_create_blank() {
1308
+
1309
+ check_ajax_referer( 'cf-step-create-blank', 'security' );
1310
+
1311
+ $flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
1312
+ $step_type = isset( $_POST['step_type'] ) ? sanitize_text_field( $_POST['step_type'] ) : '';
1313
+ $step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( $_POST['step_title'] ) : '';
1314
+
1315
+ if ( empty( $flow_id ) || empty( $step_type ) ) {
1316
+ /* translators: %s: flow ID */
1317
+ $data = sprintf( __( 'Invalid flow id %1$s OR step type %2$s.', 'cartflows' ), $flow_id, $step_type );
1318
+ wcf()->logger->import_log( $data );
1319
+ wp_send_json_error( $data );
1320
+ }
1321
+
1322
+ wcf()->logger->import_log( '------------------------------------' );
1323
+ wcf()->logger->import_log( 'STARTED! Creating Blank STEP for Flow ' . $flow_id );
1324
+
1325
+ $step_type_title = str_replace( '-', ' ', $step_type );
1326
+ $step_type_slug = strtolower( str_replace( '-', ' ', $step_type ) );
1327
+
1328
+ $new_step_id = wp_insert_post(
1329
+ array(
1330
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
1331
+ 'post_title' => $step_title,
1332
+ 'post_content' => '',
1333
+ 'post_status' => 'publish',
1334
+ )
1335
+ );
1336
+
1337
+ // insert post meta.
1338
+ update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
1339
+
1340
+ $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
1341
+ $term_exist = term_exists( $step_type_title, $taxonomy );
1342
+
1343
+ if ( empty( $term_exist ) ) {
1344
+ $terms = array(
1345
+ array(
1346
+ 'name' => $step_type_title,
1347
+ ),
1348
+ );
1349
+
1350
+ Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
1351
+ wcf()->logger->import_log( '(✓) Created new term ' . $step_type_title );
1352
+ }
1353
+
1354
+ $current_term = term_exists( $step_type_title, $taxonomy );
1355
+
1356
+ // Set type object.
1357
+ $data = get_term( $current_term['term_id'], $taxonomy );
1358
+ $step_slug = $data->slug;
1359
+ wp_set_object_terms( $new_step_id, $data->slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
1360
+ wcf()->logger->import_log( '(✓) Assigned existing term ' . $step_type_title . ' to the template ' . $new_step_id );
1361
+
1362
+ // Set type.
1363
+ update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
1364
+ wcf()->logger->import_log( '(✓) Updated term ' . $data->name . ' to the post meta wcf-step-type.' );
1365
+
1366
+ // Set flow.
1367
+ wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
1368
+ wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
1369
+
1370
+ CartFlows_Importer::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step_type_title, $step_slug );
1371
+
1372
+ wcf()->logger->import_log( 'COMPLETE! Creating Blank STEP for Flow ' . $flow_id );
1373
+ wcf()->logger->import_log( '------------------------------------' );
1374
+
1375
+ wp_send_json_success( $new_step_id );
1376
+ }
1377
+
1378
+ /**
1379
+ * Import Post Meta
1380
+ *
1381
+ * @since 1.0.0
1382
+ *
1383
+ * @param integer $post_id Post ID.
1384
+ * @param array $response Post meta.
1385
+ * @return void
1386
+ */
1387
+ public static function import_post_meta( $post_id, $response ) {
1388
+
1389
+ $metadata = (array) $response['post_meta'];
1390
+
1391
+ foreach ( $metadata as $meta_key => $meta_value ) {
1392
+ $meta_value = isset( $meta_value[0] ) ? $meta_value[0] : '';
1393
+
1394
+ if ( $meta_value ) {
1395
+
1396
+ if ( is_serialized( $meta_value, true ) ) {
1397
+ $raw_data = maybe_unserialize( stripslashes( $meta_value ) );
1398
+ } elseif ( is_array( $meta_value ) ) {
1399
+ $raw_data = json_decode( stripslashes( $meta_value ), true );
1400
+ } else {
1401
+ $raw_data = $meta_value;
1402
+ }
1403
+
1404
+ if ( '_elementor_data' === $meta_key ) {
1405
+ if ( is_array( $raw_data ) ) {
1406
+ $raw_data = wp_slash( json_encode( $raw_data ) );
1407
+ } else {
1408
+ $raw_data = wp_slash( $raw_data );
1409
+ }
1410
+ }
1411
+ if ( '_elementor_data' !== $meta_key && '_elementor_draft' !== $meta_key && '_fl_builder_data' !== $meta_key && '_fl_builder_draft' !== $meta_key ) {
1412
+ if ( is_array( $raw_data ) ) {
1413
+ wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . json_encode( $raw_data ) );
1414
+ } else {
1415
+ if ( ! is_object( $raw_data ) ) {
1416
+ wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . $raw_data );
1417
+ }
1418
+ }
1419
+ }
1420
+
1421
+ update_post_meta( $post_id, $meta_key, $raw_data );
1422
+ }
1423
+ }
1424
+ }
1425
+
1426
+ /**
1427
+ * Import Template for Elementor
1428
+ *
1429
+ * @since 1.0.0
1430
+ *
1431
+ * @param integer $post_id Post ID.
1432
+ * @param array $response Post meta.
1433
+ * @param array $page_build_data Page build data.
1434
+ * @return void
1435
+ */
1436
+ public static function import_template_elementor( $post_id, $response, $page_build_data ) {
1437
+ if ( ! is_plugin_active( 'elementor/elementor.php' ) ) {
1438
+ $data = __( 'Elementor is not activated. Please activate plugin Elementor Page Builder to import the step.', 'cartflows' );
1439
+ wcf()->logger->import_log( $data );
1440
+ wp_send_json_error( $data );
1441
+ }
1442
+
1443
+ require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
1444
+
1445
+ wcf()->logger->import_log( '# Started "importing page builder data" for step ' . $post_id );
1446
+
1447
+ $obj = new \Elementor\TemplateLibrary\CartFlows_Importer_Elementor();
1448
+ $obj->import_single_template( $post_id );
1449
+
1450
+ wcf()->logger->import_log( '# Complete "importing page builder data" for step ' . $post_id );
1451
+ }
1452
+
1453
+ /**
1454
+ * Supported post types
1455
+ *
1456
+ * @since 1.0.0
1457
+ *
1458
+ * @return array Supported post types.
1459
+ */
1460
+ public static function supported_post_types() {
1461
+ return apply_filters(
1462
+ 'cartflows_supported_post_types',
1463
+ array(
1464
+ CARTFLOWS_FLOW_POST_TYPE,
1465
+ )
1466
+ );
1467
+ }
1468
+
1469
+ /**
1470
+ * Check supported post type
1471
+ *
1472
+ * @since 1.0.0
1473
+ *
1474
+ * @param string $post_type Post type.
1475
+ * @return boolean Supported post type status.
1476
+ */
1477
+ public static function is_supported_post( $post_type = '' ) {
1478
+ if ( in_array( $post_type, self::supported_post_types() ) ) {
1479
+ return true;
1480
+ }
1481
+
1482
+ return false;
1483
+ }
1484
+
1485
+ /**
1486
+ * Set steps to the flow
1487
+ *
1488
+ * @param integer $flow_id Flow ID.
1489
+ * @param integer $new_step_id New step ID.
1490
+ * @param string $step_title Flow Type.
1491
+ * @param string $step_slug Flow Type.
1492
+ */
1493
+ function set_step_to_flow( $flow_id, $new_step_id, $step_title, $step_slug ) {
1494
+ // Update steps for the current flow.
1495
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
1496
+
1497
+ if ( ! is_array( $flow_steps ) ) {
1498
+ $flow_steps = array();
1499
+ }
1500
+
1501
+ $flow_steps[] = array(
1502
+ 'id' => $new_step_id,
1503
+ 'title' => $step_title,
1504
+ 'type' => $step_slug,
1505
+ );
1506
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
1507
+ wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . json_encode( $flow_steps ) );
1508
+ }
1509
+
1510
+ /**
1511
+ * Localize variables in admin
1512
+ *
1513
+ * @param array $vars variables.
1514
+ */
1515
+ function localize_vars( $vars ) {
1516
+
1517
+ $ajax_actions = array(
1518
+ 'cf_step_import',
1519
+ 'cf_load_steps',
1520
+ 'cf_create_flow',
1521
+ 'cf_default_flow',
1522
+ 'cf_step_create_blank',
1523
+ 'cf_import_flow_step',
1524
+ );
1525
+
1526
+ foreach ( $ajax_actions as $action ) {
1527
+
1528
+ $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
1529
+ }
1530
+
1531
+ return $vars;
1532
+ }
1533
+
1534
+ /**
1535
+ * Ajax action to activate plugin
1536
+ */
1537
+ public function activate_plugin() {
1538
+
1539
+ $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( $_POST['plugin_init'] ) : '';
1540
+
1541
+ $activate = activate_plugin( $plugin_init, '', false, true );
1542
+
1543
+ if ( is_wp_error( $activate ) ) {
1544
+ wp_send_json_error(
1545
+ array(
1546
+ 'success' => false,
1547
+ 'message' => $activate->get_error_message(),
1548
+ 'init' => $plugin_init,
1549
+ )
1550
+ );
1551
+ }
1552
+
1553
+ wp_send_json_success(
1554
+ array(
1555
+ 'success' => true,
1556
+ 'message' => __( 'Plugin Successfully Activated', 'cartflows' ),
1557
+ 'init' => $plugin_init,
1558
+ )
1559
+ );
1560
+ }
1561
+
1562
+ }
1563
+
1564
+ /**
1565
+ * Initialize class object with 'get_instance()' method
1566
+ */
1567
+ CartFlows_Importer::get_instance();
1568
+
1569
+ endif;
classes/class-cartflows-loader.php CHANGED
@@ -62,6 +62,13 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
62
  */
63
  public $flow = null;
64
 
 
 
 
 
 
 
 
65
  /**
66
  * Initiator
67
  */
@@ -98,8 +105,8 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
98
  register_deactivation_hook( CARTFLOWS_FILE, array( $this, 'deactivation_reset' ) );
99
 
100
  add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
101
-
102
  add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
 
103
 
104
  // Update compatibility.
105
  require_once CARTFLOWS_DIR . 'classes/class-cartflows-update.php';
@@ -115,7 +122,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
115
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
116
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
117
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
118
- define( 'CARTFLOWS_VER', '1.1.13' );
119
  define( 'CARTFLOWS_SLUG', 'cartflows' );
120
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
121
 
@@ -196,7 +203,17 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
196
  $this->utils = Cartflows_Utils::get_instance();
197
  $this->session = Cartflows_Session::get_instance();
198
  $this->options = Cartflows_Default_Meta::get_instance();
 
199
 
 
 
 
 
 
 
 
 
 
200
  }
201
 
202
  /**
62
  */
63
  public $flow = null;
64
 
65
+ /**
66
+ * Member Variable
67
+ *
68
+ * @var assets_vars
69
+ */
70
+ public $assets_vars = null;
71
+
72
  /**
73
  * Initiator
74
  */
105
  register_deactivation_hook( CARTFLOWS_FILE, array( $this, 'deactivation_reset' ) );
106
 
107
  add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
 
108
  add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
109
+ add_action( 'wp_loaded', array( $this, 'initialize' ) );
110
 
111
  // Update compatibility.
112
  require_once CARTFLOWS_DIR . 'classes/class-cartflows-update.php';
122
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
123
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
124
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
125
+ define( 'CARTFLOWS_VER', '1.1.14' );
126
  define( 'CARTFLOWS_SLUG', 'cartflows' );
127
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
128
 
203
  $this->utils = Cartflows_Utils::get_instance();
204
  $this->session = Cartflows_Session::get_instance();
205
  $this->options = Cartflows_Default_Meta::get_instance();
206
+ }
207
 
208
+ /**
209
+ * Init hooked function.
210
+ *
211
+ * @since 1.0.0
212
+ *
213
+ * @return void
214
+ */
215
+ function initialize() {
216
+ $this->assets_vars = $this->utils->get_assets_path();
217
  }
218
 
219
  /**
classes/class-cartflows-logger.php CHANGED
@@ -1,101 +1,101 @@
1
- <?php
2
- /**
3
- * Logger.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Logger {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Member Variable
25
- *
26
- * @var logger
27
- */
28
- public $logger;
29
-
30
- /**
31
- * Initiator
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- */
43
- public function __construct() {
44
-
45
- /* Load WC Logger */
46
- add_action( 'init', array( $this, 'init_wc_logger' ), 99 );
47
- }
48
-
49
- /**
50
- * Inint Logger.
51
- *
52
- * @since 1.0.0
53
- */
54
- function init_wc_logger() {
55
- $this->logger = new WC_Logger();
56
- }
57
-
58
- /**
59
- * Write log
60
- *
61
- * @param string $message log message.
62
- * @param string $level type of log.
63
- * @since 1.0.0
64
- */
65
- function log( $message, $level = 'info' ) {
66
-
67
- $enable_log = apply_filters( 'cartflows_enable_log', 'enable' );
68
-
69
- if ( 'enable' === $enable_log &&
70
- is_a( $this->logger, 'WC_Logger' ) &&
71
- did_action( 'plugins_loaded' )
72
- ) {
73
-
74
- $this->logger->log( $level, $message, array( 'source' => 'cartflows' ) );
75
- }
76
- }
77
-
78
- /**
79
- * Write log
80
- *
81
- * @param string $message log message.
82
- * @param string $level type of log.
83
- * @since 1.0.0
84
- */
85
- function import_log( $message, $level = 'info' ) {
86
-
87
- if ( defined( 'WP_DEBUG' ) &&
88
- WP_DEBUG &&
89
- is_a( $this->logger, 'WC_Logger' ) &&
90
- did_action( 'plugins_loaded' )
91
- ) {
92
-
93
- $this->logger->log( $level, $message, array( 'source' => 'cartflows-import' ) );
94
- }
95
- }
96
- }
97
-
98
- /**
99
- * Kicking this off by calling 'get_instance()' method
100
- */
101
- Cartflows_Logger::get_instance();
1
+ <?php
2
+ /**
3
+ * Logger.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Logger {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Member Variable
25
+ *
26
+ * @var logger
27
+ */
28
+ public $logger;
29
+
30
+ /**
31
+ * Initiator
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ */
43
+ public function __construct() {
44
+
45
+ /* Load WC Logger */
46
+ add_action( 'init', array( $this, 'init_wc_logger' ), 99 );
47
+ }
48
+
49
+ /**
50
+ * Inint Logger.
51
+ *
52
+ * @since 1.0.0
53
+ */
54
+ function init_wc_logger() {
55
+ $this->logger = new WC_Logger();
56
+ }
57
+
58
+ /**
59
+ * Write log
60
+ *
61
+ * @param string $message log message.
62
+ * @param string $level type of log.
63
+ * @since 1.0.0
64
+ */
65
+ function log( $message, $level = 'info' ) {
66
+
67
+ $enable_log = apply_filters( 'cartflows_enable_log', 'enable' );
68
+
69
+ if ( 'enable' === $enable_log &&
70
+ is_a( $this->logger, 'WC_Logger' ) &&
71
+ did_action( 'plugins_loaded' )
72
+ ) {
73
+
74
+ $this->logger->log( $level, $message, array( 'source' => 'cartflows' ) );
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Write log
80
+ *
81
+ * @param string $message log message.
82
+ * @param string $level type of log.
83
+ * @since 1.0.0
84
+ */
85
+ function import_log( $message, $level = 'info' ) {
86
+
87
+ if ( defined( 'WP_DEBUG' ) &&
88
+ WP_DEBUG &&
89
+ is_a( $this->logger, 'WC_Logger' ) &&
90
+ did_action( 'plugins_loaded' )
91
+ ) {
92
+
93
+ $this->logger->log( $level, $message, array( 'source' => 'cartflows-import' ) );
94
+ }
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Kicking this off by calling 'get_instance()' method
100
+ */
101
+ Cartflows_Logger::get_instance();
classes/class-cartflows-meta-fields.php CHANGED
@@ -1,1482 +1,1482 @@
1
- <?php
2
- // @codingStandardsIgnoreStart
3
- /**
4
- * Meta Fields.
5
- *
6
- * @package CartFlows
7
- */
8
-
9
- /**
10
- * Class Cartflows_Meta_Fields.
11
- */
12
- class Cartflows_Meta_Fields {
13
-
14
- /**
15
- * Instance
16
- *
17
- * @var $instance
18
- */
19
- private static $instance;
20
-
21
- /**
22
- * Initiator
23
- */
24
- public static function get_instance() {
25
- if ( ! isset( self::$instance ) ) {
26
- self::$instance = new self;
27
- }
28
-
29
- return self::$instance;
30
- }
31
-
32
- /**
33
- * Constructor
34
- */
35
- public function __construct() {
36
-
37
- /* Add Scripts */
38
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_meta_scripts' ), 20 );
39
-
40
- add_action( 'wp_ajax_wcf_json_search_coupons', array( $this, 'json_search_coupons' ) );
41
-
42
- add_action( 'wp_ajax_wcf_add_checkout_custom_field', array( $this, 'add_checkout_custom_field' ) );
43
-
44
- add_action( 'wp_ajax_wcf_pro_add_checkout_custom_field', array( $this, 'add_pro_checkout_custom_field' ) );
45
-
46
- add_action( 'wp_ajax_wcf_delete_checkout_custom_field', array( $this, 'delete_checkout_custom_field' ) );
47
-
48
- add_action( 'wp_ajax_wcf_json_search_pages', array( $this, 'json_search_pages' ) );
49
-
50
- add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
51
- }
52
-
53
- public function admin_meta_scripts() {
54
-
55
- global $pagenow;
56
- global $post;
57
-
58
- $screen = get_current_screen();
59
-
60
- if (
61
- ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) &&
62
- wcf()->utils->is_step_post_type( $screen->post_type )
63
- ) {
64
-
65
- wp_enqueue_style( 'woocommerce_admin_styles' );
66
-
67
- wp_enqueue_script( 'select2' );
68
- wp_enqueue_script( 'wc-enhanced-select' );
69
-
70
- wp_enqueue_script(
71
- 'wcf-admin-meta',
72
- CARTFLOWS_URL . 'admin/meta-assets/js/admin-edit.js',
73
- array( 'jquery', 'select2', 'wp-color-picker' ),
74
- CARTFLOWS_VER,
75
- true
76
- );
77
-
78
- wp_enqueue_style( 'wcf-admin-meta', CARTFLOWS_URL . 'admin/meta-assets/css/admin-edit.css', array( 'wp-color-picker' ), CARTFLOWS_VER );
79
- wp_style_add_data( 'wcf-admin-meta', 'rtl', 'replace' );
80
-
81
- $localize = array(
82
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
83
- 'google_fonts' => CartFlows_Font_Families::get_google_fonts(),
84
- 'system_fonts' => CartFlows_Font_Families::get_system_fonts(),
85
- 'font_weights' => array(
86
- '100' => __( 'Thin 100', 'cartflows' ),
87
- '200' => __( 'Extra-Light 200', 'cartflows' ),
88
- '300' => __( 'Light 300', 'cartflows' ),
89
- '400' => __( 'Normal 400', 'cartflows' ),
90
- '500' => __( 'Medium 500', 'cartflows' ),
91
- '600' => __( 'Semi-Bold 600', 'cartflows' ),
92
- '700' => __( 'Bold 700', 'cartflows' ),
93
- '800' => __( 'Extra-Bold 800', 'cartflows' ),
94
- '900' => __( 'Ultra-Bold 900', 'cartflows' ),
95
- )
96
- );
97
-
98
- wp_localize_script( 'jquery', 'wcf', apply_filters( 'wcf_js_localize', $localize ) );
99
-
100
- do_action( 'cartflows_admin_meta_scripts' );
101
- }
102
- }
103
-
104
- /**
105
- * Function to search coupons
106
- */
107
- public function json_search_coupons() {
108
-
109
- check_admin_referer( 'wcf-json-search-coupons', 'security' );
110
-
111
- global $wpdb;
112
-
113
- $term = (string) urldecode( sanitize_text_field( wp_unslash( $_GET['term'] ) ) ); // phpcs:ignore
114
-
115
- if ( empty( $term ) ) {
116
- die();
117
- }
118
-
119
- $posts = wp_cache_get( 'wcf_search_coupons', 'wcf_funnel_Cart' );
120
-
121
- if ( false === $posts ) {
122
- $posts = $wpdb->get_results( // phpcs:ignore
123
- $wpdb->prepare(
124
- "SELECT *
125
- FROM {$wpdb->prefix}posts
126
- WHERE post_type = %s
127
- AND post_title LIKE %s
128
- AND post_status = %s",
129
- 'shop_coupon',
130
- $wpdb->esc_like( $term ) . '%',
131
- 'publish'
132
- )
133
- );
134
- wp_cache_set( 'wcf_search_coupons', $posts, 'wcf_funnel_Cart' );
135
- }
136
-
137
- $coupons_found = array();
138
- $all_discount_types = wc_get_coupon_types();
139
-
140
- if ( $posts ) {
141
- foreach ( $posts as $post ) {
142
-
143
- $discount_type = get_post_meta( $post->ID, 'discount_type', true );
144
-
145
- if ( ! empty( $all_discount_types[ $discount_type ] ) ) {
146
- $coupons_found[ get_the_title( $post->ID ) ] = get_the_title( $post->ID ) . ' (Type: ' . $all_discount_types[ $discount_type ] . ')';
147
- }
148
- }
149
- }
150
-
151
- wp_send_json( $coupons_found );
152
- }
153
-
154
- /**
155
- * [add_checkout_custom_field description]
156
- *
157
- * @hook wcf_add_checkout_custom_field
158
- */
159
- public function add_checkout_custom_field() {
160
-
161
- check_ajax_referer( 'wcf-add-checkout-custom-field', 'security' );
162
-
163
- $post_id = intval( $_POST['post_id'] );
164
- $add_to = sanitize_text_field( wp_unslash( $_POST['add_to'] ) );
165
- $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
166
- $options = sanitize_text_field( wp_unslash( $_POST['options'] ) );
167
- $label = sanitize_text_field( wp_unslash( $_POST['label'] ) );
168
- $name = sanitize_text_field( wp_unslash( $_POST['name'] ) );
169
-
170
- if ( '' !== $name ) {
171
-
172
- $fields = Cartflows_Helper::get_checkout_fields( $add_to, $post_id );
173
- $field_keys = array_keys($fields);
174
-
175
- $name = $add_to . '_' . sanitize_key( $name );
176
- if( in_array($name, $field_keys) ) {
177
- $name = $name . '_' . rand( 0000, 9999 );
178
- }
179
-
180
- $field_data = array(
181
- 'type' => $type,
182
- 'label' => $label,
183
- 'placeholder' => '',
184
- 'class' => array( 'form-row-wide' ),
185
- 'label_class' => array(),
186
- 'required' => true,
187
- 'custom' => true,
188
- );
189
-
190
- if ( 'select' === $type ) {
191
-
192
- $options = explode( ',', $options );
193
- $field_data['options'] = array();
194
-
195
- if ( is_array( $options ) && ! empty( $options ) ) {
196
-
197
- foreach ( $options as $key => $value ) {
198
-
199
- $field_data['options'][ $value ] = $value;
200
- }
201
- }
202
- }
203
-
204
- Cartflows_Helper::add_checkout_field( $add_to, $name, $field_data, $post_id );
205
-
206
- $key = sanitize_key( $name );
207
- $name = 'wcf-' . $key;
208
-
209
- $field_args = array(
210
- 'label' => $label,
211
- 'name' => $name,
212
- 'value' => 'yes',
213
- 'after' => 'Enable',
214
- );
215
-
216
- $field_args['after_html'] = '<span class="wcf-cpf-actions" data-type="billing" data-key="' . $key . '"> | ';
217
- $field_args['after_html'] .= '<a class="wcf-cpf-action-remove">' . __( 'Remove', 'cartflows' ) . '</a>';
218
- $field_args['after_html'] .= '</span>';
219
-
220
- $field_markup = wcf()->meta->get_checkbox_field( $field_args );
221
-
222
- if( 'billing' === $add_to ) {
223
- $add_to_class = 'wcf-cb-fields';
224
- } else if( 'shipping' === $add_to ) {
225
- $add_to_class = 'wcf-sb-fields';
226
- }
227
-
228
- $data = array(
229
- 'field_data' => $field_data,
230
- 'field_args' => $field_args,
231
- 'add_to_class' => $add_to_class,
232
- 'markup' => $field_markup,
233
- );
234
-
235
- wp_send_json( $data );
236
- }
237
-
238
- wp_send_json( false );
239
-
240
- }
241
-
242
- /**
243
- * [add_checkout_custom_field description]
244
- *
245
- * @hook wcf_add_checkout_custom_field
246
- */
247
- public function add_pro_checkout_custom_field() {
248
-
249
- check_ajax_referer( 'wcf-pro-add-checkout-custom-field', 'security' );
250
-
251
- $post_id = intval( $_POST['post_id'] );
252
- $add_to = sanitize_text_field( wp_unslash( $_POST['add_to'] ) );
253
- $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
254
- $options = sanitize_text_field( wp_unslash( $_POST['options'] ) );
255
- $label = sanitize_text_field( wp_unslash( $_POST['label'] ) );
256
- $name = sanitize_text_field( wp_unslash( str_replace(' ', '_', $_POST['label'] ) ) );
257
- $placeholder = sanitize_text_field( wp_unslash( $_POST['placeholder'] ) );
258
- $width = sanitize_text_field( wp_unslash( $_POST['width'] ) );
259
- $default_value = sanitize_text_field( wp_unslash( $_POST['default'] ) );
260
- $is_required = sanitize_text_field( wp_unslash( $_POST['required'] ) );
261
-
262
- $field_markup = '';
263
-
264
- if ( '' !== $name ) {
265
-
266
- $fields = Cartflows_Helper::get_checkout_fields( $add_to, $post_id );
267
- $field_keys = array_keys($fields);
268
-
269
- $name = $add_to . '_' . sanitize_key( $name );
270
- if( in_array($name, $field_keys) ) {
271
- $name = $name . '_' . rand( 0000, 9999 );
272
- }
273
-
274
- $field_data = array(
275
- 'type' => $type,
276
- 'label' => $label,
277
- 'placeholder' => $placeholder,
278
- 'class' => array( 'form-row-wide' ),
279
- 'label_class' => array(),
280
- 'required' => $is_required,
281
- 'custom' => true,
282
- 'default' => $default_value,
283
- 'options' => $options,
284
- );
285
-
286
- if ( 'select' === $type ) {
287
-
288
- $options = explode( ',', $options );
289
- $field_data['options'] = array();
290
-
291
- if ( is_array( $options ) && ! empty( $options ) ) {
292
-
293
- foreach ( $options as $key => $value ) {
294
-
295
- $field_data['options'][ $value ] = $value;
296
- }
297
- }
298
- }
299
-
300
- $width_args = array(
301
- 'wcf-field-width_'.$name => $width,
302
- );
303
-
304
- Cartflows_Helper::add_checkout_field( $add_to, $name, $field_data, $post_id );
305
- Cartflows_Helper::save_meta_option( $post_id, $width_args );
306
-
307
- $key = sanitize_key( $name );
308
- $name = 'wcf-' . $key;
309
-
310
- $field_args = array(
311
- 'type' => $type,
312
- 'label' => $label,
313
- 'name' => $name,
314
- 'value' => 'yes',
315
- 'placeholder' => $placeholder,
316
- 'width' => $width,
317
- 'after' => 'Enable',
318
- 'section' => $add_to,
319
- 'default' => $default_value,
320
- 'required' => $is_required,
321
- 'options' => $options,
322
- );
323
-
324
- $field_args['after_html'] = '<span class="wcf-cpf-actions" data-type="billing" data-key="' . $key . '"> ';
325
- $field_args['after_html'] .= '<a class="wcf-cpf-action-remove wp-ui-text-notification">'. __( 'Remove', 'cartflows' ).'</a>';
326
- $field_args['after_html'] .= '</span>';
327
-
328
- // $field_markup = wcf()->meta->get_checkbox_field( $field_args );
329
-
330
- $field_markup .= "<li class='wcf-field-item-edit-inactive wcf-field-item ui-sortable-handle'>";
331
- $field_markup .= $this->get_field_html_via_ajax($field_args);
332
- $field_markup .= "</li>";
333
-
334
- if( 'billing' === $add_to ) {
335
- $add_to_class = 'billing-field-sortable';
336
- $section = 'billing';
337
- } else if( 'shipping' === $add_to ) {
338
- $add_to_class = 'shipping-field-sortable';
339
- $section = 'shipping';
340
- }
341
-
342
- $data = array(
343
- 'field_data' => $field_data,
344
- 'field_args' => $field_args,
345
- 'add_to_class' => $add_to_class,
346
- 'markup' => $field_markup,
347
- 'section' => $section,
348
- );
349
-
350
- wp_send_json( $data );
351
- }
352
-
353
- wp_send_json( false );
354
-
355
- }
356
-
357
- /**
358
- * Get field html.
359
- *
360
- * @param array $args field arguments.
361
- * @return string
362
- */
363
- function get_field_html_via_ajax( $field_args ) {
364
-
365
- $value = $field_args['value'];
366
-
367
- $is_checkbox = false;
368
- $is_require = false;
369
- $is_select = false;
370
-
371
- $display = 'none';
372
-
373
- $field_content = '';
374
-
375
- if ( isset( $field_args['before'] ) ) {
376
- $field_content .= '<span>' . $field_args['before'] . '</span>';
377
- }
378
- $field_content .= '<input type="hidden" name="' . $field_args['name'] . '" value="no">';
379
- $field_content .= '<input type="checkbox" name="' . $field_args['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
380
-
381
- if ( isset( $field_args['after'] ) ) {
382
- $field_content .= $field_args['after'];
383
- }
384
-
385
- $type = isset( $field_args['type'] ) ? $field_args['type'] : '';
386
- $label = isset( $field_args['label'] ) ? $field_args['label'] : '';
387
- $help = isset( $field_args['help'] ) ? $field_args['help'] : '';
388
- $after_html = isset( $field_args['after_html'] ) ? $field_args['after_html'] : '';
389
- $name = isset( $field_args['name'] ) ? $field_args['name'] : '';
390
- $default = isset( $field_args['default']) ? $field_args['default'] : '';
391
- $required = isset( $field_args['required']) ? $field_args['required'] : '';
392
- $options = isset( $field_args['options']) ? $field_args['options'] : '';
393
- $width = isset( $field_args['width']) ? $field_args['width'] : '';
394
- $name_class = 'field-' . $field_args['name'];
395
-
396
- if( isset( $options ) && !empty( $options ) ){
397
- $options = implode(', ', $options );
398
- }else{
399
- $options = '';
400
- }
401
-
402
- if( 'yes' == $required ){
403
- $is_require = true;
404
- }
405
-
406
- if( 'checkbox' == $type ){
407
- $is_checkbox = true;
408
- }
409
-
410
- if( 'select' == $type ){
411
- $is_select = true;
412
- $display = 'block';
413
- }
414
-
415
- // echo "<pre>";
416
- // var_dump($after_html);
417
- // echo "</pre>";
418
-
419
- // $field_markup = wcf()->meta->get_only_checkbox_field( $field_args );
420
- ob_start();
421
-
422
- ?>
423
- <div class="wcf-field-item-bar">
424
- <div class="wcf-field-item-handle ui-sortable-handle">
425
- <label class="dashicons <?php if( 'no' == $value ){ echo 'dashicons-hidden'; } else{ echo 'dashicons-visibility';} ?> " for="<?php echo $field_args['name']; ?>"></label>
426
- <span class="item-title">
427
- <span class="wcf-field-item-title"><?php echo $label; if( $is_require ) { ?> <i>*</i> <?php } ?></span>
428
- <span class="is-submenu" style="display: none;">sub item</span>
429
- </span>
430
- <span class="item-controls">
431
- <span class="dashicons dashicons-menu"></span>
432
- <span class="item-order hide-if-js">
433
- <a href="#" class="item-move-up" aria-label="Move up">↑</a>
434
- |
435
- <a href="#" class="item-move-down" aria-label="Move down">↓</a>
436
- </span>
437
- <a class="item-edit" id="edit-64" href="javascript:void(0);" aria-label="My account. Menu item 1 of 5."><span class="screen-reader-text">Edit</span></a>
438
- </span>
439
- </div>
440
- </div>
441
- <div class="wcf-field-item-settings">
442
- <div class="wcf-field-item-settings-row-width">
443
- <?php
444
- echo wcf()->meta->get_select_field(
445
- array(
446
- 'label' => __( 'Field Width', 'cartflows' ),
447
- 'name' => 'wcf-field-width_' . str_replace( 'wcf-', '', $field_args['name'] ),
448
- 'value' => $width,
449
- 'options' => array(
450
- '33' => __( '33%', 'cartflows' ),
451
- '50' => __( '50%', 'cartflows' ),
452
- '100' => __( '100%', 'cartflows' ),
453
- ),
454
- )
455
- );
456
- ?>
457
- </div>
458
-
459
- <div class="wcf-field-item-settings-label">
460
- <?php
461
- echo wcf()->meta->get_text_field(
462
- array(
463
- 'label' => __( 'Field Label', 'cartflows' ),
464
- 'name' => 'wcf_label_text_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
465
- 'value' => $label,
466
- )
467
- );
468
-
469
- ?>
470
- <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace( 'wcf-', '', $field_args['name'] ); ?>">
471
- </div>
472
-
473
- <div class="wcf-field-item-select-options" style="display:<?php if( isset( $display ) ){ print $display; } ?>;" >
474
- <?php
475
- echo wcf()->meta->get_text_field(
476
- array(
477
- 'label' => __( 'Options', 'cartflows' ),
478
- 'name' => 'wcf_select_option_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
479
- 'value' => $options,
480
- )
481
- );
482
-
483
- ?>
484
- <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace( 'wcf-', '', $field_args['name'] ); ?>">
485
- </div>
486
-
487
- <div class="wcf-field-item-settings-default">
488
- <?php
489
- if( true == $is_checkbox ){
490
- echo wcf()->meta->get_select_field(
491
- array(
492
- 'label' => __( 'Default', 'cartflows' ),
493
- 'name' => 'wcf_label_default_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
494
- 'value' => $value,
495
- 'options' => array(
496
- '1' => __( 'Checked', 'cartflows' ),
497
- '0' => __( 'Un-Checked', 'cartflows' ),
498
- ),
499
- )
500
- );
501
- }else{
502
-
503
- echo wcf()->meta->get_text_field(
504
- array(
505
- 'label' => __( 'Default', 'cartflows' ),
506
- 'name' => 'wcf_label_default_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
507
- 'value' => $default,
508
- )
509
- );
510
- }
511
- ?>
512
- </div>
513
-
514
- <div class="wcf-field-item-settings-placeholder" <?php if( true == $is_checkbox ) {?> style="display: none;" <?php } ?> >
515
- <?php
516
- echo wcf()->meta->get_text_field(
517
- array(
518
- 'label' => __( 'Placeholder', 'cartflows' ),
519
- 'name' => 'wcf_label_placeholder_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
520
- 'value' => $label,
521
- )
522
- );
523
- ?>
524
- </div>
525
-
526
- <div class="wcf-field-item-settings-required">
527
- <?php
528
- echo wcf()->meta->get_checkbox_field(
529
- array(
530
- 'label' => __( 'Required', 'cartflows' ),
531
- 'name' => 'wcf_is_required_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
532
- 'value' => $required,
533
- )
534
- );
535
- ?>
536
- </div>
537
-
538
- <div class="wcf-field-item-settings-checkbox">
539
- <?php
540
- echo wcf()->meta->get_checkbox_field(
541
- array(
542
- 'label' => __( 'Enable this field', 'cartflows' ),
543
- 'name' => $field_args['name'],
544
- 'value' => $value,
545
- )
546
- );
547
- ?>
548
- </div>
549
-
550
- <?php
551
- if(isset( $field_args['after_html']) )
552
- {
553
- ?>
554
- <div class="wcf-field-item-settings-row-delete-cf">
555
- <?php echo $field_args['after_html']; ?>
556
- </div>
557
- <?php
558
- }
559
- ?>
560
- <!--
561
- <label for="<?php echo $field_args['name']; ?>">
562
- <?php _e( 'Label', 'cartflows' ); ?><br>
563
- <input type="text" value="<?php echo $field_args['label']; ?>">
564
-
565
- <?php if( isset( $field_markup ) ) { echo $field_markup; }?>
566
-
567
- <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace('wcf-', '', $field_args['name'] ); ?>">
568
- </label> -->
569
- </div>
570
-
571
- <?php
572
-
573
- return ob_get_clean();
574
- }
575
-
576
- /**
577
- * [delete_checkout_custom_field description]
578
- *
579
- * @hook wcf_delete_checkout_custom_field
580
- * @return [type] [description]
581
- */
582
- public function delete_checkout_custom_field() {
583
-
584
- check_ajax_referer( 'wcf-delete-checkout-custom-field', 'security' );
585
-
586
- $post_id = intval( $_POST['post_id'] );
587
- $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
588
- $key = sanitize_text_field( wp_unslash( $_POST['key'] ) );
589
-
590
- if ( '' !== $key ) {
591
-
592
- Cartflows_Helper::delete_checkout_field( $type, $key, $post_id );
593
-
594
- wp_send_json( true );
595
-
596
- }
597
-
598
- wp_send_json( false );
599
-
600
- }
601
-
602
- /**
603
- * Function to search coupons
604
- */
605
- public function json_search_pages() {
606
-
607
- check_ajax_referer( 'wcf-json-search-pages', 'security' );
608
-
609
- $term = (string) urldecode( sanitize_text_field( wp_unslash( $_GET['term'] ) ) ); // phpcs:ignore
610
-
611
- if ( empty( $term ) ) {
612
- die( 'not found' );
613
- }
614
-
615
- $search_string = $term;
616
- $data = array();
617
- $result = array();
618
-
619
- add_filter( 'posts_search', array( $this, 'search_only_titles' ), 10, 2 );
620
-
621
- $query = new WP_Query(
622
- array(
623
- 's' => $search_string,
624
- 'post_type' => 'page',
625
- 'posts_per_page' => - 1,
626
- )
627
- );
628
-
629
- if ( $query->have_posts() ) {
630
- while ( $query->have_posts() ) {
631
- $query->the_post();
632
- $title = get_the_title();
633
- $title .= ( 0 != $query->post->post_parent ) ? ' (' . get_the_title( $query->post->post_parent ) . ')' : '';
634
- $id = get_the_id();
635
- $data[] = array(
636
- 'id' => $id,
637
- 'text' => $title,
638
- );
639
- }
640
- }
641
-
642
- if ( is_array( $data ) && ! empty( $data ) ) {
643
- $result[] = array(
644
- 'text' => '',
645
- 'children' => $data,
646
- );
647
- }
648
-
649
- wp_reset_postdata();
650
-
651
- // return the result in json.
652
- wp_send_json( $result );
653
- }
654
-
655
- public function search_only_titles( $search, $wp_query ) {
656
- if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) {
657
- global $wpdb;
658
-
659
- $q = $wp_query->query_vars;
660
- $n = ! empty( $q['exact'] ) ? '' : '%';
661
-
662
- $search = array();
663
-
664
- foreach ( (array) $q['search_terms'] as $term ) {
665
- $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $n . $wpdb->esc_like( $term ) . $n );
666
- }
667
-
668
- if ( ! is_user_logged_in() ) {
669
- $search[] = "$wpdb->posts.post_password = ''";
670
- }
671
-
672
- $search = ' AND ' . implode( ' AND ', $search );
673
- }
674
-
675
- return $search;
676
- }
677
-
678
- function get_field( $field_data, $field_content ) {
679
-
680
- $label = isset( $field_data['label'] ) ? $field_data['label'] : '';
681
- $help = isset( $field_data['help'] ) ? $field_data['help'] : '';
682
- $after_html = isset( $field_data['after_html'] ) ? $field_data['after_html'] : '';
683
-
684
- $name_class = 'field-' . $field_data['name'];
685
-
686
- $field_html = '<div class="wcf-field-row ' . $name_class . '">';
687
-
688
- if( ! empty( $label ) || ! empty( $help ) ) {
689
- $field_html .= '<div class="wcf-field-row-heading">';
690
- if( ! empty( $label ) ) {
691
- $field_html .= '<label>' . esc_html( $label ) . '</label>';
692
- }
693
- if ( ! empty( $help ) ) {
694
- $field_html .= '<i class="wcf-field-heading-help dashicons dashicons-editor-help">';
695
- // $field_html .= '<span class="wcf-tooltip" data-tooltip= "'. esc_attr( $help ) .'"></span>';
696
- $field_html .= '</i>';
697
- $field_html .= '<span class="wcf-tooltip-text">';
698
- $field_html .= $help;
699
- $field_html .= '</span>';
700
- }
701
- $field_html .= '</div>';
702
- }
703
-
704
- $field_html .= '<div class="wcf-field-row-content">';
705
- $field_html .= $field_content;
706
-
707
- if ( ! empty( $after_html ) ) {
708
- $field_html .= $after_html;
709
- }
710
-
711
- $field_html .= '</div>';
712
- $field_html .= '</div>';
713
-
714
- return $field_html;
715
- }
716
-
717
- function get_text_field( $field_data ) {
718
-
719
- $value = $field_data['value'];
720
-
721
- $attr = '';
722
-
723
- if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
724
-
725
- foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
726
- $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
727
- }
728
- }
729
-
730
- $field_content = '<input type="text" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
731
-
732
- return $this->get_field( $field_data, $field_content );
733
- }
734
-
735
- function get_shortcode_field( $field_data ) {
736
-
737
- $attr = '';
738
-
739
- $attr_fields = array(
740
- 'readonly' => 'readonly',
741
- 'onfocus' => 'this.select()',
742
- 'onmouseup' => 'return false',
743
- );
744
-
745
- if ( $attr_fields && is_array( $attr_fields ) ) {
746
-
747
- foreach ( $attr_fields as $attr_key => $attr_value ) {
748
- $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
749
- }
750
- }
751
-
752
- $field_content = '<input type="text" name="' . $field_data['name'] . '" value="' . $field_data['content'] . '" ' . $attr . '>';
753
-
754
- return $this->get_field( $field_data, $field_content );
755
- }
756
-
757
- function get_display_field( $field_data ) {
758
-
759
- $field_content = $field_data['content'];
760
-
761
- return $this->get_field( $field_data, $field_content );
762
- }
763
-
764
- function get_hr_line_field( $field_data ) {
765
-
766
- $field_data = array(
767
- 'name' => 'wcf-hr-line',
768
- 'content' => '<hr>'
769
- );
770
-
771
- $field_content = $field_data['content'];
772
-
773
- return $this->get_field( $field_data, $field_content );
774
- }
775
-
776
- function get_number_field( $field_data ) {
777
-
778
- $value = $field_data['value'];
779
-
780
- $attr = '';
781
-
782
- if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
783
-
784
- foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
785
- $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
786
- }
787
- }
788
-
789
- $field_content = '<input type="number" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
790
-
791
- return $this->get_field( $field_data, $field_content );
792
- }
793
-
794
- function get_hidden_field( $field_data ) {
795
-
796
- $value = $field_data['value'];
797
-
798
- $attr = '';
799
-
800
- if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
801
-
802
- foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
803
- $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
804
- }
805
- }
806
-
807
- $field_content = '<input type="hidden" id="' . $field_data['name'] . '" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
808
-
809
- return $this->get_field( $field_data, $field_content );
810
- }
811
-
812
- function get_area_field( $field_data ) {
813
-
814
- $value = $field_data['value'];
815
-
816
- $field_content = '<textarea name="' . $field_data['name'] . '" rows="10" cols="50">';
817
- $field_content .= $value;
818
- $field_content .= '</textarea>';
819
-
820
- return $this->get_field( $field_data, $field_content );
821
- }
822
-
823
- function get_only_checkbox_field( $field_data ) {
824
- // echo "<pre>";
825
- // var_dump($field_data);
826
- // echo "</pre>";
827
-
828
- $value = $field_data['value'];
829
-
830
-
831
- $field_content = '';
832
- if ( isset( $field_data['before'] ) ) {
833
- $field_content .= '<span>' . $field_data['before'] . '</span>';
834
- }
835
- $field_content .= '<input type="hidden" name="' . $field_data['name'] . '" value="no">';
836
- $field_content .= '<input type="checkbox" name="' . $field_data['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
837
-
838
- if ( isset( $field_data['after'] ) ) {
839
- $field_content .= '<span>' . $field_data['after'] . '</span>';
840
- }
841
-
842
- if ( isset( $field_data['after_html'] ) ) {
843
- $field_content .= '<span>' . $field_data['after_html'] . '</span>';
844
- }
845
-
846
- return $field_content;
847
- }
848
-
849
- function get_checkbox_field( $field_data ) {
850
-
851
- $value = $field_data['value'];
852
-
853
- $field_content = '';
854
- if ( isset( $field_data['before'] ) ) {
855
- $field_content .= '<span>' . $field_data['before'] . '</span>';
856
- }
857
- $field_content .= '<input type="hidden" name="' . $field_data['name'] . '" value="no">';
858
- $field_content .= '<input type="checkbox" id="'.$field_data['name'].'" name="' . $field_data['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
859
-
860
- if ( isset( $field_data['after'] ) ) {
861
- $field_content .= '<span>' . $field_data['after'] . '</span>';
862
- }
863
-
864
- return $this->get_field( $field_data, $field_content );
865
- }
866
-
867
- function get_radio_field( $field_data ) {
868
-
869
- $value = $field_data['value'];
870
- $field_content = '';
871
-
872
- if ( is_array( $field_data['options'] ) && ! empty( $field_data['options'] ) ) {
873
-
874
- foreach ( $field_data['options'] as $data_key => $data_value ) {
875
-
876
- $field_content .= '<div class="wcf-radio-option">';
877
- $field_content .= '<input type="radio" name="' . $field_data['name'] . '" value="' . $data_key . '" ' . checked( $data_key, $value, false ) . '>';
878
- $field_content .= $data_value;
879
- $field_content .= '</div>';
880
- }
881
- }
882
-
883
- return $this->get_field( $field_data, $field_content );
884
- }
885
-
886
- function get_font_family_field( $field_data ) {
887
-
888
- $value = $field_data['value'];
889
-
890
- $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
891
-
892
- $field_content = '<select class="wcf-field-font-family" data-for="' . $field_data['for'] . '" name="' . $field_data['name'] . '">';
893
-
894
- $field_content .= '<option value="" ' . selected( '', $value, false ) . '>Default</option>';
895
-
896
- $field_content .= '<optgroup label="Other System Fonts">';
897
- foreach ( CartFlows_Font_Families::get_system_fonts() as $name => $variants ) {
898
- $field_content .= '<option value="' . esc_attr( $name ) . '" ' . selected( $name, $value, false ) . '>' . esc_attr( $name ) . '</option>';
899
- }
900
- $field_content .= '</optgroup>';
901
- $field_content .= '<optgroup label="Google">';
902
- foreach ( CartFlows_Font_Families::get_google_fonts() as $name => $single_font ) {
903
- $variants = wcf_get_prop( $single_font, '0' );
904
- $category = wcf_get_prop( $single_font, '1' );
905
- $font_value = '\'' . esc_attr( $name ) . '\', ' . esc_attr( $category );
906
- $field_content .= '<option value="' . esc_attr( $font_value ) . '" ' . selected( $font_value, $value, false ) . '>' . esc_attr( $name ) . '</option>';
907
- }
908
- $field_content .= '</optgroup>';
909
-
910
- $field_content .= '</select>';
911
-
912
- return $this->get_field( $field_data, $field_content );
913
- }
914
-
915
- function get_font_weight_field( $field_data ) {
916
-
917
- $value = $field_data['value'];
918
-
919
- $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
920
-
921
- $field_content = '<select data-selected="'.esc_attr( $value ).'" class="wcf-field-font-weight" data-for="' . $field_data['for'] . '" name="' . $field_data['name'] . '">';
922
-
923
- $field_content .= '<option value="" ' . selected( '', $value, false ) . '>Default</option>';
924
-
925
- $field_content .= '</select>';
926
-
927
- return $this->get_field( $field_data, $field_content );
928
- }
929
-
930
- function get_select_field( $field_data ) {
931
-
932
- $value = $field_data['value'];
933
- $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
934
-
935
- $field_content = '<select name="' . $field_data['name'] . '">';
936
-
937
-
938
- if ( is_array( $field_data['options'] ) && ! empty( $field_data['options'] ) ) {
939
-
940
- foreach ( $field_data['options'] as $data_key => $data_value ) {
941
-
942
- $disabled = '';
943
-
944
- if ( array_key_exists( $data_key, $pro_options ) ) {
945
- $disabled = 'disabled ';
946
- $data_value = $pro_options[ $data_key ];
947
- }
948
-
949
- $field_content .= '<option value="' . $data_key . '" ' . selected( $value, $data_key, false ) . ' ' . $disabled .'>' . $data_value . '</option>';
950
- }
951
- }
952
-
953
- $field_content .= '</select>';
954
-
955
- if ( isset( $field_data['after'] ) ) {
956
- $field_content .= '<span>' . $field_data['after'] . '</span>';
957
- }
958
-
959
- return $this->get_field( $field_data, $field_content );
960
- }
961
-
962
- function get_color_picker_field( $field_data ) {
963
-
964
- $value = $field_data['value'];
965
-
966
- $field_content = '<input class="wcf-color-picker" type="text" name="' . $field_data['name'] . '" value="' . $value . '">';
967
-
968
- return $this->get_field( $field_data, $field_content );
969
- }
970
-
971
- function get_product_selection_field( $field_data ) {
972
-
973
- $value = $field_data['value'];
974
-
975
- $multiple = '';
976
-
977
- if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
978
- $multiple = ' multiple="multiple"';
979
- }
980
-
981
- $allow_clear = '';
982
-
983
- if ( isset( $field_data['allow_clear'] ) && $field_data['allow_clear'] ) {
984
- $allow_clear = ' data-allow_clear="allow_clear"';
985
- }
986
-
987
- $field_content = '<select
988
- name="' . $field_data['name'] . '[]"
989
- class="wcf-product-search" ' . $multiple . $allow_clear . '
990
- data-placeholder="' . __( 'Search for a product&hellip;', 'cartflows' ) . '"
991
- data-action="woocommerce_json_search_products_and_variations">';
992
-
993
- if ( is_array( $value ) && ! empty( $value ) ) {
994
-
995
- foreach ( $value as $data_key => $product_id ) {
996
-
997
- $product = wc_get_product( $product_id );
998
-
999
- // posts.
1000
- if ( ! empty( $product ) ) {
1001
- $post_title = $product->get_name() . ' (#' . $product_id . ')';
1002
-
1003
- $field_content .= '<option value="' . $product_id . '" selected="selected" >' . $post_title . '</option>';
1004
- }
1005
- }
1006
- }
1007
- $field_content .= '</select>';
1008
-
1009
- return $this->get_field( $field_data, $field_content );
1010
- }
1011
-
1012
- function get_coupon_selection_field( $field_data ) {
1013
-
1014
- $value = $field_data['value'];
1015
-
1016
- $multiple = '';
1017
-
1018
- if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
1019
- $multiple = ' multiple="multiple"';
1020
- }
1021
-
1022
- $allow_clear = '';
1023
-
1024
- if ( isset( $field_data['allow_clear'] ) && $field_data['allow_clear'] ) {
1025
- $allow_clear = ' data-allow_clear="allow_clear"';
1026
- }
1027
-
1028
- $field_content = '<select
1029
- name="' . $field_data['name'] . '[]"
1030
- class="wc-coupon-search wcf-coupon-search" ' . $multiple . $allow_clear . '
1031
- data-placeholder="' . __( 'Search for a coupon&hellip;', 'cartflows' ) . '"
1032
- data-action="wcf_json_search_coupons">';
1033
-
1034
- if ( is_array( $value ) && ! empty( $value ) ) {
1035
-
1036
- $all_discount_types = wc_get_coupon_types();
1037
-
1038
- foreach ( $value as $coupon_title ) {
1039
-
1040
- $coupon = new WC_Coupon( $coupon_title );
1041
-
1042
- $discount_type = $coupon->get_discount_type();
1043
-
1044
- if ( isset( $discount_type ) && $discount_type ) {
1045
- $discount_type = ' ( Type: ' . $all_discount_types[ $discount_type ] . ' )';
1046
- }
1047
-
1048
- $field_content .= '<option value="' . $coupon_title . '" selected="selected">' . $coupon_title . $discount_type . '</option>';
1049
- }
1050
- }
1051
-
1052
- $field_content .= '</select>';
1053
-
1054
- return $this->get_field( $field_data, $field_content );
1055
- }
1056
-
1057
- function get_page_selection_field( $field_data ) {
1058
-
1059
- $value = $field_data['value'];
1060
-
1061
- $multiple = '';
1062
-
1063
- if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
1064
- $multiple = 'multiple="multiple"';
1065
- }
1066
-
1067
- $field_content = '<select
1068
- name="' . $field_data['name'] . '[]"
1069
- class="wcf-search-pages" ' . $multiple . '"
1070
- data-action="wcf_json_search_pages">';
1071
-
1072
- if ( is_array( $value ) && ! empty( $value ) ) {
1073
-
1074
- foreach ( $value as $data_key => $data_value ) {
1075
-
1076
- $field_content .= '<option value="' . $data_value . '">' . get_the_title( $data_value ) . '</option>';
1077
- }
1078
- }
1079
-
1080
- $field_content .= '</select>';
1081
-
1082
- return $this->get_field( $field_data, $field_content );
1083
- }
1084
-
1085
- function get_section( $field_data ) {
1086
- $field_html = '<div class="wcf-field-row wcf-field-section">';
1087
- $field_html .= '<div class="wcf-field-section-heading" colspan="2">';
1088
- $field_html .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1089
-
1090
- if ( isset( $field_data['help'] ) ) {
1091
- $field_html .= '<i class="wcf-field-heading-help dashicons dashicons-editor-help" title="' . esc_attr( $field_data['help'] ) . '"></i>';
1092
- }
1093
- $field_html .= '</div>';
1094
- $field_html .= '</div>';
1095
- return $field_html;
1096
- }
1097
-
1098
- function get_description_field( $field_data ) {
1099
-
1100
- $field_html = '<div class="wcf-field-row wcf-field-desc ' . $field_data['name'] . '">';
1101
- $field_html .= '<div class="wcf-field-desc-content">';
1102
- $field_html .= $field_data['content'];
1103
- $field_html .= '</div>';
1104
- $field_html .= '</div>';
1105
-
1106
- return $field_html;
1107
- }
1108
-
1109
- function get_checkout_field_repeater( $field_data ) {
1110
-
1111
- $value = array();
1112
-
1113
- $value[0] = array(
1114
- 'add_to' => '',
1115
- 'type' => '',
1116
- 'label' => '',
1117
- 'name' => '',
1118
- );
1119
-
1120
- $field_content = '';
1121
-
1122
- $field_content .= '<div class="wcf-field-row">';
1123
- // $field_content .= '<div class="wcf-field-row-heading">';
1124
- // $field_content .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1125
- // $field_content .= '</div>';
1126
- $field_content .= '<div class="wcf-field-row-content">';
1127
- $field_content .= '<div class="wcf-cpf-wrap">';
1128
-
1129
- foreach ( $value as $p_key => $p_data ) {
1130
- $field_content .= '<div class="wcf-cpf-row" data-key="' . $p_key . '">';
1131
- $field_content .= '<div class="wcf-cpf-row-header">';
1132
- $field_content .= '<span class="wcf-cpf-row-title">Add New Custom Field</span>';
1133
- $field_content .= '</div>';
1134
-
1135
- $field_content .= '<div class="wcf-cpf-row-standard-fields">';
1136
-
1137
- /* Add To */
1138
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-add_to">';
1139
- $field_content .= '<span class="wcf-cpf-row-setting-label">Add to</span>';
1140
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1141
- $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][add_to]" class="wcf-cpf-add_to">';
1142
- $field_content .= '<option value="billing">Billing</option>';
1143
- $field_content .= '<option value="shipping">Shipping</option>';
1144
- $field_content .= '</select>';
1145
- $field_content .= '</span>';
1146
- $field_content .= '</div>';
1147
-
1148
- /* Type */
1149
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-type">';
1150
- $field_content .= '<span class="wcf-cpf-row-setting-label">Type</span>';
1151
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1152
- $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][type]" class="wcf-cpf-type">';
1153
- $field_content .= '<option value="text">Text</option>';
1154
- $field_content .= '<option value="textarea">Textarea</option>';
1155
- $field_content .= '<option value="select">Select</option>';
1156
- $field_content .= '<option value="checkbox">Checkbox</option>';
1157
- $field_content .= '</select>';
1158
- $field_content .= '</span>';
1159
- $field_content .= '</div>';
1160
-
1161
- /* Textarea */
1162
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-options">';
1163
- $field_content .= '<span class="wcf-cpf-row-setting-label">Options *</span>';
1164
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1165
- $field_content .= '<textarea value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-options" placeholder="Enter your options separated by comma."></textarea>';
1166
- $field_content .= '</span>';
1167
- $field_content .= '</div>';
1168
-
1169
- /* Label */
1170
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-label">';
1171
- $field_content .= '<span class="wcf-cpf-row-setting-label">Label *</span>';
1172
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1173
- $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-label">';
1174
- $field_content .= '</span>';
1175
- $field_content .= '</div>';
1176
-
1177
- /* Name */
1178
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-name">';
1179
- $field_content .= '<span class="wcf-cpf-row-setting-label">Name *</span>';
1180
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1181
- $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][name]" class="wcf-cpf-name">';
1182
- $field_content .= '</span>';
1183
- $field_content .= '</div>';
1184
-
1185
- $field_content .= '</div>';
1186
- $field_content .= '</div>';
1187
- }
1188
-
1189
- /* Add New Custom Field */
1190
- $field_content .= '<div class="wcf-cpf-add-row">';
1191
- $field_content .= '<div class="wcf-cpf-add-wrap">';
1192
- $field_content .= '<button class="button button-secondary wcf-cpf-add" data-name="wcf-checkout-custom-fields">Add New Field</button>';
1193
- $field_content .= '</div>';
1194
- $field_content .= '</div>';
1195
- /* End Add new custom field */
1196
-
1197
- $field_content .= '</div>';
1198
- $field_content .= '</div>';
1199
- $field_content .= '</div>';
1200
-
1201
- return $field_content;
1202
- }
1203
-
1204
- function get_pro_checkout_field_repeater( $field_data ) {
1205
-
1206
- $value = array();
1207
-
1208
- $value[0] = array(
1209
- 'add_to' => '',
1210
- 'type' => '',
1211
- 'label' => '',
1212
- 'name' => '',
1213
- );
1214
-
1215
- $field_content = '';
1216
-
1217
- $field_content .= '<div class="wcf-field-row">';
1218
- // $field_content .= '<div class="wcf-field-row-heading">';
1219
- // $field_content .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1220
- // $field_content .= '</div>';
1221
- $field_content .= '<div class="wcf-field-row-content">';
1222
- $field_content .= '<div class="wcf-cpf-wrap">';
1223
-
1224
- foreach ( $value as $p_key => $p_data ) {
1225
- $field_content .= '<div class="wcf-cpf-row" data-key="' . $p_key . '">';
1226
- $field_content .= '<div class="wcf-cpf-row-header">';
1227
- $field_content .= '<span class="wcf-cpf-row-title">Add New Custom Field</span>';
1228
- $field_content .= '</div>';
1229
-
1230
- $field_content .= '<div class="wcf-cpf-row-standard-fields">';
1231
-
1232
- /* Add To */
1233
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-add_to">';
1234
- $field_content .= '<span class="wcf-cpf-row-setting-label">Add to</span>';
1235
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1236
- $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][add_to]" class="wcf-cpf-add_to">';
1237
- $field_content .= '<option value="billing">Billing</option>';
1238
- $field_content .= '<option value="shipping">Shipping</option>';
1239
- $field_content .= '</select>';
1240
- $field_content .= '</span>';
1241
- $field_content .= '</div>';
1242
-
1243
- /* Type */
1244
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-type">';
1245
- $field_content .= '<span class="wcf-cpf-row-setting-label">Type</span>';
1246
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1247
- $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][type]" class="wcf-cpf-type">';
1248
- $field_content .= '<option value="text">Text</option>';
1249
- $field_content .= '<option value="textarea">Textarea</option>';
1250
- $field_content .= '<option value="select">Select</option>';
1251
- $field_content .= '<option value="checkbox">Checkbox</option>';
1252
- $field_content .= '<option value="hidden">Hidden</option>';
1253
- $field_content .= '</select>';
1254
- $field_content .= '</span>';
1255
- $field_content .= '</div>';
1256
-
1257
- /* Label */
1258
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-label">';
1259
- $field_content .= '<span class="wcf-cpf-row-setting-label">Label <i>*</i></span>';
1260
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1261
- $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-label">';
1262
- $field_content .= '<span id="wcf-cpf-label-error-msg"></span>';
1263
- $field_content .= '</span>';
1264
- $field_content .= '</div>';
1265
-
1266
- /* Default */
1267
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-default">';
1268
- $field_content .= '<span class="wcf-cpf-row-setting-label">Default</span>';
1269
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1270
- $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][default]" class="wcf-cpf-default">';
1271
- $field_content .= '<span id="wcf-cpf-default-error-msg"></span>';
1272
- $field_content .= '</span>';
1273
- $field_content .= '</div>';
1274
-
1275
- /* Placeholder */
1276
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-placeholder">';
1277
- $field_content .= '<span class="wcf-cpf-row-setting-label">Placeholder</span>';
1278
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1279
- $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][placeholder]" class="wcf-cpf-placeholder">';
1280
- $field_content .= '<span id="wcf-cpf-placeholder-error-msg"></span>';
1281
- $field_content .= '</span>';
1282
- $field_content .= '</div>';
1283
-
1284
- /* Options */
1285
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-options">';
1286
- $field_content .= '<span class="wcf-cpf-row-setting-label">Options <i>*</i></span>';
1287
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1288
- $field_content .= '<textarea value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-options" placeholder="Enter your options separated by comma."></textarea>';
1289
- $field_content .= '</span>';
1290
- $field_content .= '</div>';
1291
-
1292
- /* Width */
1293
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-width">';
1294
- $field_content .= '<span class="wcf-cpf-row-setting-label">Width</span>';
1295
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1296
- $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][width]" class="wcf-cpf-width">';
1297
- $field_content .= '<option value="33">33%</option>';
1298
- $field_content .= '<option value="50">50%</option>';
1299
- $field_content .= '<option value="100" selected>100%</option>';
1300
- $field_content .= '</select>';
1301
- $field_content .= '</span>';
1302
- $field_content .= '</div>';
1303
-
1304
- /* Required */
1305
- $field_content .= '<div class="wcf-cpf-fields wcf-cpf-required">';
1306
- $field_content .= '<span class="wcf-cpf-row-setting-label">Required</span>';
1307
- $field_content .= '<span class="wcf-cpf-row-setting-field">';
1308
- $field_content .= '<input type="hidden" value="no" name="wcf-checkout-custom-fields[' . $p_key . '][required]" class="wcf-cpf-required">';
1309
- $field_content .= '<input type="checkbox" value="yes" name="wcf-checkout-custom-fields[' . $p_key . '][required]" class="wcf-cpf-required">';
1310
- $field_content .= '<span id="wcf-cpf-required-error-msg"></span>';
1311
- $field_content .= '</span>';
1312
- $field_content .= '</div>';
1313
-
1314
- $field_content .= '</div>';
1315
- $field_content .= '</div>';
1316
- }
1317
-
1318
- /* Add New Custom Field */
1319
- $field_content .= '<div class="wcf-cpf-add-row">';
1320
- $field_content .= '<div class="wcf-cpf-add-wrap">';
1321
- $field_content .= '<button class="button button-secondary wcf-pro-cpf-add" data-name="wcf-checkout-custom-fields">Add New Field</button>';
1322
- $field_content .= '</div>';
1323
- $field_content .= '</div>';
1324
- /* End Add new custom field */
1325
-
1326
- $field_content .= '</div>';
1327
- $field_content .= '</div>';
1328
- $field_content .= '</div>';
1329
-
1330
- return $field_content;
1331
- }
1332
-
1333
- function get_product_selection_repeater( $field_data ) {
1334
-
1335
- $value = $field_data['value'];
1336
-
1337
- if ( ! is_array( $value ) ) {
1338
-
1339
- $value[0] = array(
1340
- 'product' => '',
1341
- );
1342
- } else {
1343
-
1344
- if ( ! isset( $value[0] ) ) {
1345
-
1346
- $value[0] = array(
1347
- 'product' => '',
1348
- );
1349
- }
1350
- }
1351
-
1352
- $field_html = '';
1353
-
1354
- $field_html .= '<script type="text/html" id="tmpl-wcf-product-repeater">';
1355
- $field_html .= $this->generate_product_repeater_html( '{{id}}' );
1356
- $field_html .= '</script>';
1357
-
1358
- $field_html .= '<div class="wcf-field-row">';
1359
- $field_html .= '<div class="wcf-field-row-content">';
1360
- $field_html .= '<div class="wcf-repeatables-wrap">';
1361
-
1362
- if ( is_array( $value ) ) {
1363
-
1364
- foreach ( $value as $p_key => $p_data ) {
1365
-
1366
- $selected_options = '';
1367
-
1368
- if ( isset( $p_data['product'] ) ) {
1369
-
1370
- $product = wc_get_product( $p_data['product'] );
1371
-
1372
- // posts.
1373
- if ( ! empty( $product ) ) {
1374
- $post_title = $product->get_name() . ' (#' . $p_data['product'] . ')';
1375
-
1376
- $selected_options = '<option value="' . $p_data['product'] . '" selected="selected" >' . $post_title . '</option>';
1377
- }
1378
- }
1379
-
1380
- $field_html .= $this->generate_product_repeater_html( $p_key, $selected_options );
1381
- }
1382
- }
1383
-
1384
- $field_html .= '<div class="wcf-add-repeatable-row">';
1385
- $field_html .= '<div class="submit wcf-add-repeatable-wrap">';
1386
- $field_html .= '<button class="button-primary wcf-add-repeatable" data-name="wcf-checkout-products">Add New Product</button>';
1387
- $field_html .= '</div>';
1388
- $field_html .= '</div>';
1389
- $field_html .= '</div>';
1390
- $field_html .= '</div>';
1391
- $field_html .= '</div>';
1392
-
1393
- return $field_html;
1394
- }
1395
-
1396
- function generate_product_repeater_html( $id, $options = '' ) {
1397
-
1398
- $field_html = '<div class="wcf-repeatable-row" data-key="' . $id . '">';
1399
-
1400
- $field_html .= '<div class="wcf-repeatable-row-standard-fields">';
1401
-
1402
- /* Product Name */
1403
- $field_html .= '<div class="wcf-repeatable-fields wcf-sel-product">';
1404
- $field_html .= '<span class="wcf-repeatable-row-setting-field">';
1405
- $field_html .= '<select
1406
- name="wcf-checkout-products[' . $id . '][product]"
1407
- class="wcf-product-search"
1408
- data-allow_clear="allow_clear"
1409
- data-placeholder="' . __( 'Search for a product&hellip;', 'cartflows' ) . '"
1410
- data-action="woocommerce_json_search_products_and_variations">';
1411
- $field_html .= $options;
1412
- $field_html .= '</select>';
1413
- $field_html .= '</span>';
1414
- $field_html .= '<span class="wcf-repeatable-row-actions">';
1415
- $field_html .= '<a class="wcf-remove-row wcf-repeatable-remove button" data-type="product">';
1416
- $field_html .= '<span class="dashicons dashicons-trash"></span>';
1417
- $field_html .= '<span class="wcf-repeatable-remove-button">'. __( 'Remove', 'cartflows' ).'</span>';
1418
- $field_html .= '</a>';
1419
- $field_html .= '</span>';
1420
- $field_html .= '</div>';
1421
- $field_html .= '</div>';
1422
- $field_html .= '</div>';
1423
-
1424
- return $field_html;
1425
- }
1426
-
1427
- function get_image_field( $field_data ) {
1428
-
1429
- $value = $field_data['value'];
1430
-
1431
- $attr = '';
1432
-
1433
- if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
1434
-
1435
- foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
1436
- $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
1437
- }
1438
- }
1439
-
1440
- $display_preview_box = ( isset( $value ) && '' != $value ) ? 'display:block;' : 'display:none';
1441
-
1442
- $field_content = '<div id="wcf-image-preview" style="'.$display_preview_box.'">';
1443
- if( isset( $value ) ){
1444
- $field_content .= '<img src="'. $value .'" class="saved-image" name="'. $field_data['name'] .'" width="150">';
1445
- }
1446
- $field_content .= '</div>';
1447
- // $field_content .= '<input type="hidden" id="wcf-image-id" class="wcf-image-id" name="wcf-image-id[image-id]" value="">';
1448
- $field_content .= '<input type="hidden" id="wcf-image-value" class="wcf-image" name="' . $field_data['name'] . '" value="'.$value.'">';
1449
-
1450
- $field_content .= '<button type="button" ' . $attr . ' class="wcf-select-image button-secondary">Select Image</button>';
1451
-
1452
- $display_remove_button = ( isset( $value ) && '' != $value ) ? 'display:inline-block; margin-left: 5px;' : 'display:none';
1453
-
1454
- $field_content .= '<button type="button" class="wcf-remove-image button-secondary" style="'.$display_remove_button.'">Remove Image</button>';
1455
-
1456
- return $this->get_field( $field_data, $field_content );
1457
- }
1458
-
1459
- /**
1460
- * Localize variables in admin
1461
- *
1462
- * @param array $vars variables.
1463
- */
1464
- function localize_vars( $vars ) {
1465
-
1466
- $ajax_actions = array(
1467
- 'wcf_add_checkout_custom_field',
1468
- 'wcf_pro_add_checkout_custom_field',
1469
- 'wcf_delete_checkout_custom_field',
1470
- 'wcf_json_search_pages',
1471
- 'wcf_json_search_coupons'
1472
- );
1473
-
1474
- foreach ( $ajax_actions as $action ) {
1475
-
1476
- $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
1477
- }
1478
-
1479
- return $vars;
1480
- }
1481
- }
1482
- // @codingStandardsIgnoreEnd
1
+ <?php
2
+ // @codingStandardsIgnoreStart
3
+ /**
4
+ * Meta Fields.
5
+ *
6
+ * @package CartFlows
7
+ */
8
+
9
+ /**
10
+ * Class Cartflows_Meta_Fields.
11
+ */
12
+ class Cartflows_Meta_Fields {
13
+
14
+ /**
15
+ * Instance
16
+ *
17
+ * @var $instance
18
+ */
19
+ private static $instance;
20
+
21
+ /**
22
+ * Initiator
23
+ */
24
+ public static function get_instance() {
25
+ if ( ! isset( self::$instance ) ) {
26
+ self::$instance = new self;
27
+ }
28
+
29
+ return self::$instance;
30
+ }
31
+
32
+ /**
33
+ * Constructor
34
+ */
35
+ public function __construct() {
36
+
37
+ /* Add Scripts */
38
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_meta_scripts' ), 20 );
39
+
40
+ add_action( 'wp_ajax_wcf_json_search_coupons', array( $this, 'json_search_coupons' ) );
41
+
42
+ add_action( 'wp_ajax_wcf_add_checkout_custom_field', array( $this, 'add_checkout_custom_field' ) );
43
+
44
+ add_action( 'wp_ajax_wcf_pro_add_checkout_custom_field', array( $this, 'add_pro_checkout_custom_field' ) );
45
+
46
+ add_action( 'wp_ajax_wcf_delete_checkout_custom_field', array( $this, 'delete_checkout_custom_field' ) );
47
+
48
+ add_action( 'wp_ajax_wcf_json_search_pages', array( $this, 'json_search_pages' ) );
49
+
50
+ add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
51
+ }
52
+
53
+ public function admin_meta_scripts() {
54
+
55
+ global $pagenow;
56
+ global $post;
57
+
58
+ $screen = get_current_screen();
59
+
60
+ if (
61
+ ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) &&
62
+ wcf()->utils->is_step_post_type( $screen->post_type )
63
+ ) {
64
+
65
+ wp_enqueue_style( 'woocommerce_admin_styles' );
66
+
67
+ wp_enqueue_script( 'select2' );
68
+ wp_enqueue_script( 'wc-enhanced-select' );
69
+
70
+ wp_enqueue_script(
71
+ 'wcf-admin-meta',
72
+ CARTFLOWS_URL . 'admin/meta-assets/js/admin-edit.js',
73
+ array( 'jquery', 'select2', 'wp-color-picker' ),
74
+ CARTFLOWS_VER,
75
+ true
76
+ );
77
+
78
+ wp_enqueue_style( 'wcf-admin-meta', CARTFLOWS_URL . 'admin/meta-assets/css/admin-edit.css', array( 'wp-color-picker' ), CARTFLOWS_VER );
79
+ wp_style_add_data( 'wcf-admin-meta', 'rtl', 'replace' );
80
+
81
+ $localize = array(
82
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
83
+ 'google_fonts' => CartFlows_Font_Families::get_google_fonts(),
84
+ 'system_fonts' => CartFlows_Font_Families::get_system_fonts(),
85
+ 'font_weights' => array(
86
+ '100' => __( 'Thin 100', 'cartflows' ),
87
+ '200' => __( 'Extra-Light 200', 'cartflows' ),
88
+ '300' => __( 'Light 300', 'cartflows' ),
89
+ '400' => __( 'Normal 400', 'cartflows' ),
90
+ '500' => __( 'Medium 500', 'cartflows' ),
91
+ '600' => __( 'Semi-Bold 600', 'cartflows' ),
92
+ '700' => __( 'Bold 700', 'cartflows' ),
93
+ '800' => __( 'Extra-Bold 800', 'cartflows' ),
94
+ '900' => __( 'Ultra-Bold 900', 'cartflows' ),
95
+ )
96
+ );
97
+
98
+ wp_localize_script( 'jquery', 'wcf', apply_filters( 'wcf_js_localize', $localize ) );
99
+
100
+ do_action( 'cartflows_admin_meta_scripts' );
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Function to search coupons
106
+ */
107
+ public function json_search_coupons() {
108
+
109
+ check_admin_referer( 'wcf-json-search-coupons', 'security' );
110
+
111
+ global $wpdb;
112
+
113
+ $term = (string) urldecode( sanitize_text_field( wp_unslash( $_GET['term'] ) ) ); // phpcs:ignore
114
+
115
+ if ( empty( $term ) ) {
116
+ die();
117
+ }
118
+
119
+ $posts = wp_cache_get( 'wcf_search_coupons', 'wcf_funnel_Cart' );
120
+
121
+ if ( false === $posts ) {
122
+ $posts = $wpdb->get_results( // phpcs:ignore
123
+ $wpdb->prepare(
124
+ "SELECT *
125
+ FROM {$wpdb->prefix}posts
126
+ WHERE post_type = %s
127
+ AND post_title LIKE %s
128
+ AND post_status = %s",
129
+ 'shop_coupon',
130
+ $wpdb->esc_like( $term ) . '%',
131
+ 'publish'
132
+ )
133
+ );
134
+ wp_cache_set( 'wcf_search_coupons', $posts, 'wcf_funnel_Cart' );
135
+ }
136
+
137
+ $coupons_found = array();
138
+ $all_discount_types = wc_get_coupon_types();
139
+
140
+ if ( $posts ) {
141
+ foreach ( $posts as $post ) {
142
+
143
+ $discount_type = get_post_meta( $post->ID, 'discount_type', true );
144
+
145
+ if ( ! empty( $all_discount_types[ $discount_type ] ) ) {
146
+ $coupons_found[ get_the_title( $post->ID ) ] = get_the_title( $post->ID ) . ' (Type: ' . $all_discount_types[ $discount_type ] . ')';
147
+ }
148
+ }
149
+ }
150
+
151
+ wp_send_json( $coupons_found );
152
+ }
153
+
154
+ /**
155
+ * [add_checkout_custom_field description]
156
+ *
157
+ * @hook wcf_add_checkout_custom_field
158
+ */
159
+ public function add_checkout_custom_field() {
160
+
161
+ check_ajax_referer( 'wcf-add-checkout-custom-field', 'security' );
162
+
163
+ $post_id = intval( $_POST['post_id'] );
164
+ $add_to = sanitize_text_field( wp_unslash( $_POST['add_to'] ) );
165
+ $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
166
+ $options = sanitize_text_field( wp_unslash( $_POST['options'] ) );
167
+ $label = sanitize_text_field( wp_unslash( $_POST['label'] ) );
168
+ $name = sanitize_text_field( wp_unslash( $_POST['name'] ) );
169
+
170
+ if ( '' !== $name ) {
171
+
172
+ $fields = Cartflows_Helper::get_checkout_fields( $add_to, $post_id );
173
+ $field_keys = array_keys($fields);
174
+
175
+ $name = $add_to . '_' . sanitize_key( $name );
176
+ if( in_array($name, $field_keys) ) {
177
+ $name = $name . '_' . rand( 0000, 9999 );
178
+ }
179
+
180
+ $field_data = array(
181
+ 'type' => $type,
182
+ 'label' => $label,
183
+ 'placeholder' => '',
184
+ 'class' => array( 'form-row-wide' ),
185
+ 'label_class' => array(),
186
+ 'required' => true,
187
+ 'custom' => true,
188
+ );
189
+
190
+ if ( 'select' === $type ) {
191
+
192
+ $options = explode( ',', $options );
193
+ $field_data['options'] = array();
194
+
195
+ if ( is_array( $options ) && ! empty( $options ) ) {
196
+
197
+ foreach ( $options as $key => $value ) {
198
+
199
+ $field_data['options'][ $value ] = $value;
200
+ }
201
+ }
202
+ }
203
+
204
+ Cartflows_Helper::add_checkout_field( $add_to, $name, $field_data, $post_id );
205
+
206
+ $key = sanitize_key( $name );
207
+ $name = 'wcf-' . $key;
208
+
209
+ $field_args = array(
210
+ 'label' => $label,
211
+ 'name' => $name,
212
+ 'value' => 'yes',
213
+ 'after' => 'Enable',
214
+ );
215
+
216
+ $field_args['after_html'] = '<span class="wcf-cpf-actions" data-type="billing" data-key="' . $key . '"> | ';
217
+ $field_args['after_html'] .= '<a class="wcf-cpf-action-remove">' . __( 'Remove', 'cartflows' ) . '</a>';
218
+ $field_args['after_html'] .= '</span>';
219
+
220
+ $field_markup = wcf()->meta->get_checkbox_field( $field_args );
221
+
222
+ if( 'billing' === $add_to ) {
223
+ $add_to_class = 'wcf-cb-fields';
224
+ } else if( 'shipping' === $add_to ) {
225
+ $add_to_class = 'wcf-sb-fields';
226
+ }
227
+
228
+ $data = array(
229
+ 'field_data' => $field_data,
230
+ 'field_args' => $field_args,
231
+ 'add_to_class' => $add_to_class,
232
+ 'markup' => $field_markup,
233
+ );
234
+
235
+ wp_send_json( $data );
236
+ }
237
+
238
+ wp_send_json( false );
239
+
240
+ }
241
+
242
+ /**
243
+ * [add_checkout_custom_field description]
244
+ *
245
+ * @hook wcf_add_checkout_custom_field
246
+ */
247
+ public function add_pro_checkout_custom_field() {
248
+
249
+ check_ajax_referer( 'wcf-pro-add-checkout-custom-field', 'security' );
250
+
251
+ $post_id = intval( $_POST['post_id'] );
252
+ $add_to = sanitize_text_field( wp_unslash( $_POST['add_to'] ) );
253
+ $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
254
+ $options = sanitize_text_field( wp_unslash( $_POST['options'] ) );
255
+ $label = sanitize_text_field( wp_unslash( $_POST['label'] ) );
256
+ $name = sanitize_text_field( wp_unslash( str_replace(' ', '_', $_POST['label'] ) ) );
257
+ $placeholder = sanitize_text_field( wp_unslash( $_POST['placeholder'] ) );
258
+ $width = sanitize_text_field( wp_unslash( $_POST['width'] ) );
259
+ $default_value = sanitize_text_field( wp_unslash( $_POST['default'] ) );
260
+ $is_required = sanitize_text_field( wp_unslash( $_POST['required'] ) );
261
+
262
+ $field_markup = '';
263
+
264
+ if ( '' !== $name ) {
265
+
266
+ $fields = Cartflows_Helper::get_checkout_fields( $add_to, $post_id );
267
+ $field_keys = array_keys($fields);
268
+
269
+ $name = $add_to . '_' . sanitize_key( $name );
270
+ if( in_array($name, $field_keys) ) {
271
+ $name = $name . '_' . rand( 0000, 9999 );
272
+ }
273
+
274
+ $field_data = array(
275
+ 'type' => $type,
276
+ 'label' => $label,
277
+ 'placeholder' => $placeholder,
278
+ 'class' => array( 'form-row-wide' ),
279
+ 'label_class' => array(),
280
+ 'required' => $is_required,
281
+ 'custom' => true,
282
+ 'default' => $default_value,
283
+ 'options' => $options,
284
+ );
285
+
286
+ if ( 'select' === $type ) {
287
+
288
+ $options = explode( ',', $options );
289
+ $field_data['options'] = array();
290
+
291
+ if ( is_array( $options ) && ! empty( $options ) ) {
292
+
293
+ foreach ( $options as $key => $value ) {
294
+
295
+ $field_data['options'][ $value ] = $value;
296
+ }
297
+ }
298
+ }
299
+
300
+ $width_args = array(
301
+ 'wcf-field-width_'.$name => $width,
302
+ );
303
+
304
+ Cartflows_Helper::add_checkout_field( $add_to, $name, $field_data, $post_id );
305
+ Cartflows_Helper::save_meta_option( $post_id, $width_args );
306
+
307
+ $key = sanitize_key( $name );
308
+ $name = 'wcf-' . $key;
309
+
310
+ $field_args = array(
311
+ 'type' => $type,
312
+ 'label' => $label,
313
+ 'name' => $name,
314
+ 'value' => 'yes',
315
+ 'placeholder' => $placeholder,
316
+ 'width' => $width,
317
+ 'after' => 'Enable',
318
+ 'section' => $add_to,
319
+ 'default' => $default_value,
320
+ 'required' => $is_required,
321
+ 'options' => $options,
322
+ );
323
+
324
+ $field_args['after_html'] = '<span class="wcf-cpf-actions" data-type="billing" data-key="' . $key . '"> ';
325
+ $field_args['after_html'] .= '<a class="wcf-cpf-action-remove wp-ui-text-notification">'. __( 'Remove', 'cartflows' ).'</a>';
326
+ $field_args['after_html'] .= '</span>';
327
+
328
+ // $field_markup = wcf()->meta->get_checkbox_field( $field_args );
329
+
330
+ $field_markup .= "<li class='wcf-field-item-edit-inactive wcf-field-item ui-sortable-handle'>";
331
+ $field_markup .= $this->get_field_html_via_ajax($field_args);
332
+ $field_markup .= "</li>";
333
+
334
+ if( 'billing' === $add_to ) {
335
+ $add_to_class = 'billing-field-sortable';
336
+ $section = 'billing';
337
+ } else if( 'shipping' === $add_to ) {
338
+ $add_to_class = 'shipping-field-sortable';
339
+ $section = 'shipping';
340
+ }
341
+
342
+ $data = array(
343
+ 'field_data' => $field_data,
344
+ 'field_args' => $field_args,
345
+ 'add_to_class' => $add_to_class,
346
+ 'markup' => $field_markup,
347
+ 'section' => $section,
348
+ );
349
+
350
+ wp_send_json( $data );
351
+ }
352
+
353
+ wp_send_json( false );
354
+
355
+ }
356
+
357
+ /**
358
+ * Get field html.
359
+ *
360
+ * @param array $args field arguments.
361
+ * @return string
362
+ */
363
+ function get_field_html_via_ajax( $field_args ) {
364
+
365
+ $value = $field_args['value'];
366
+
367
+ $is_checkbox = false;
368
+ $is_require = false;
369
+ $is_select = false;
370
+
371
+ $display = 'none';
372
+
373
+ $field_content = '';
374
+
375
+ if ( isset( $field_args['before'] ) ) {
376
+ $field_content .= '<span>' . $field_args['before'] . '</span>';
377
+ }
378
+ $field_content .= '<input type="hidden" name="' . $field_args['name'] . '" value="no">';
379
+ $field_content .= '<input type="checkbox" name="' . $field_args['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
380
+
381
+ if ( isset( $field_args['after'] ) ) {
382
+ $field_content .= $field_args['after'];
383
+ }
384
+
385
+ $type = isset( $field_args['type'] ) ? $field_args['type'] : '';
386
+ $label = isset( $field_args['label'] ) ? $field_args['label'] : '';
387
+ $help = isset( $field_args['help'] ) ? $field_args['help'] : '';
388
+ $after_html = isset( $field_args['after_html'] ) ? $field_args['after_html'] : '';
389
+ $name = isset( $field_args['name'] ) ? $field_args['name'] : '';
390
+ $default = isset( $field_args['default']) ? $field_args['default'] : '';
391
+ $required = isset( $field_args['required']) ? $field_args['required'] : '';
392
+ $options = isset( $field_args['options']) ? $field_args['options'] : '';
393
+ $width = isset( $field_args['width']) ? $field_args['width'] : '';
394
+ $name_class = 'field-' . $field_args['name'];
395
+
396
+ if( isset( $options ) && !empty( $options ) ){
397
+ $options = implode(', ', $options );
398
+ }else{
399
+ $options = '';
400
+ }
401
+
402
+ if( 'yes' == $required ){
403
+ $is_require = true;
404
+ }
405
+
406
+ if( 'checkbox' == $type ){
407
+ $is_checkbox = true;
408
+ }
409
+
410
+ if( 'select' == $type ){
411
+ $is_select = true;
412
+ $display = 'block';
413
+ }
414
+
415
+ // echo "<pre>";
416
+ // var_dump($after_html);
417
+ // echo "</pre>";
418
+
419
+ // $field_markup = wcf()->meta->get_only_checkbox_field( $field_args );
420
+ ob_start();
421
+
422
+ ?>
423
+ <div class="wcf-field-item-bar">
424
+ <div class="wcf-field-item-handle ui-sortable-handle">
425
+ <label class="dashicons <?php if( 'no' == $value ){ echo 'dashicons-hidden'; } else{ echo 'dashicons-visibility';} ?> " for="<?php echo $field_args['name']; ?>"></label>
426
+ <span class="item-title">
427
+ <span class="wcf-field-item-title"><?php echo $label; if( $is_require ) { ?> <i>*</i> <?php } ?></span>
428
+ <span class="is-submenu" style="display: none;">sub item</span>
429
+ </span>
430
+ <span class="item-controls">
431
+ <span class="dashicons dashicons-menu"></span>
432
+ <span class="item-order hide-if-js">
433
+ <a href="#" class="item-move-up" aria-label="Move up">↑</a>
434
+ |
435
+ <a href="#" class="item-move-down" aria-label="Move down">↓</a>
436
+ </span>
437
+ <a class="item-edit" id="edit-64" href="javascript:void(0);" aria-label="My account. Menu item 1 of 5."><span class="screen-reader-text">Edit</span></a>
438
+ </span>
439
+ </div>
440
+ </div>
441
+ <div class="wcf-field-item-settings">
442
+ <div class="wcf-field-item-settings-row-width">
443
+ <?php
444
+ echo wcf()->meta->get_select_field(
445
+ array(
446
+ 'label' => __( 'Field Width', 'cartflows' ),
447
+ 'name' => 'wcf-field-width_' . str_replace( 'wcf-', '', $field_args['name'] ),
448
+ 'value' => $width,
449
+ 'options' => array(
450
+ '33' => __( '33%', 'cartflows' ),
451
+ '50' => __( '50%', 'cartflows' ),
452
+ '100' => __( '100%', 'cartflows' ),
453
+ ),
454
+ )
455
+ );
456
+ ?>
457
+ </div>
458
+
459
+ <div class="wcf-field-item-settings-label">
460
+ <?php
461
+ echo wcf()->meta->get_text_field(
462
+ array(
463
+ 'label' => __( 'Field Label', 'cartflows' ),
464
+ 'name' => 'wcf_label_text_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
465
+ 'value' => $label,
466
+ )
467
+ );
468
+
469
+ ?>
470
+ <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace( 'wcf-', '', $field_args['name'] ); ?>">
471
+ </div>
472
+
473
+ <div class="wcf-field-item-select-options" style="display:<?php if( isset( $display ) ){ print $display; } ?>;" >
474
+ <?php
475
+ echo wcf()->meta->get_text_field(
476
+ array(
477
+ 'label' => __( 'Options', 'cartflows' ),
478
+ 'name' => 'wcf_select_option_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
479
+ 'value' => $options,
480
+ )
481
+ );
482
+
483
+ ?>
484
+ <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace( 'wcf-', '', $field_args['name'] ); ?>">
485
+ </div>
486
+
487
+ <div class="wcf-field-item-settings-default">
488
+ <?php
489
+ if( true == $is_checkbox ){
490
+ echo wcf()->meta->get_select_field(
491
+ array(
492
+ 'label' => __( 'Default', 'cartflows' ),
493
+ 'name' => 'wcf_label_default_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
494
+ 'value' => $value,
495
+ 'options' => array(
496
+ '1' => __( 'Checked', 'cartflows' ),
497
+ '0' => __( 'Un-Checked', 'cartflows' ),
498
+ ),
499
+ )
500
+ );
501
+ }else{
502
+
503
+ echo wcf()->meta->get_text_field(
504
+ array(
505
+ 'label' => __( 'Default', 'cartflows' ),
506
+ 'name' => 'wcf_label_default_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
507
+ 'value' => $default,
508
+ )
509
+ );
510
+ }
511
+ ?>
512
+ </div>
513
+
514
+ <div class="wcf-field-item-settings-placeholder" <?php if( true == $is_checkbox ) {?> style="display: none;" <?php } ?> >
515
+ <?php
516
+ echo wcf()->meta->get_text_field(
517
+ array(
518
+ 'label' => __( 'Placeholder', 'cartflows' ),
519
+ 'name' => 'wcf_label_placeholder_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
520
+ 'value' => $label,
521
+ )
522
+ );
523
+ ?>
524
+ </div>
525
+
526
+ <div class="wcf-field-item-settings-required">
527
+ <?php
528
+ echo wcf()->meta->get_checkbox_field(
529
+ array(
530
+ 'label' => __( 'Required', 'cartflows' ),
531
+ 'name' => 'wcf_is_required_field_' . $field_args['section'] . '[' . str_replace( 'wcf-', '', $field_args['name'] ) . ']',
532
+ 'value' => $required,
533
+ )
534
+ );
535
+ ?>
536
+ </div>
537
+
538
+ <div class="wcf-field-item-settings-checkbox">
539
+ <?php
540
+ echo wcf()->meta->get_checkbox_field(
541
+ array(
542
+ 'label' => __( 'Enable this field', 'cartflows' ),
543
+ 'name' => $field_args['name'],
544
+ 'value' => $value,
545
+ )
546
+ );
547
+ ?>
548
+ </div>
549
+
550
+ <?php
551
+ if(isset( $field_args['after_html']) )
552
+ {
553
+ ?>
554
+ <div class="wcf-field-item-settings-row-delete-cf">
555
+ <?php echo $field_args['after_html']; ?>
556
+ </div>
557
+ <?php
558
+ }
559
+ ?>
560
+ <!--
561
+ <label for="<?php echo $field_args['name']; ?>">
562
+ <?php _e( 'Label', 'cartflows' ); ?><br>
563
+ <input type="text" value="<?php echo $field_args['label']; ?>">
564
+
565
+ <?php if( isset( $field_markup ) ) { echo $field_markup; }?>
566
+
567
+ <input type="hidden" name="wcf_field_order_<?php echo $field_args['section']; ?>[]" value="<?php echo str_replace('wcf-', '', $field_args['name'] ); ?>">
568
+ </label> -->
569
+ </div>
570
+
571
+ <?php
572
+
573
+ return ob_get_clean();
574
+ }
575
+
576
+ /**
577
+ * [delete_checkout_custom_field description]
578
+ *
579
+ * @hook wcf_delete_checkout_custom_field
580
+ * @return [type] [description]
581
+ */
582
+ public function delete_checkout_custom_field() {
583
+
584
+ check_ajax_referer( 'wcf-delete-checkout-custom-field', 'security' );
585
+
586
+ $post_id = intval( $_POST['post_id'] );
587
+ $type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
588
+ $key = sanitize_text_field( wp_unslash( $_POST['key'] ) );
589
+
590
+ if ( '' !== $key ) {
591
+
592
+ Cartflows_Helper::delete_checkout_field( $type, $key, $post_id );
593
+
594
+ wp_send_json( true );
595
+
596
+ }
597
+
598
+ wp_send_json( false );
599
+
600
+ }
601
+
602
+ /**
603
+ * Function to search coupons
604
+ */
605
+ public function json_search_pages() {
606
+
607
+ check_ajax_referer( 'wcf-json-search-pages', 'security' );
608
+
609
+ $term = (string) urldecode( sanitize_text_field( wp_unslash( $_GET['term'] ) ) ); // phpcs:ignore
610
+
611
+ if ( empty( $term ) ) {
612
+ die( 'not found' );
613
+ }
614
+
615
+ $search_string = $term;
616
+ $data = array();
617
+ $result = array();
618
+
619
+ add_filter( 'posts_search', array( $this, 'search_only_titles' ), 10, 2 );
620
+
621
+ $query = new WP_Query(
622
+ array(
623
+ 's' => $search_string,
624
+ 'post_type' => 'page',
625
+ 'posts_per_page' => - 1,
626
+ )
627
+ );
628
+
629
+ if ( $query->have_posts() ) {
630
+ while ( $query->have_posts() ) {
631
+ $query->the_post();
632
+ $title = get_the_title();
633
+ $title .= ( 0 != $query->post->post_parent ) ? ' (' . get_the_title( $query->post->post_parent ) . ')' : '';
634
+ $id = get_the_id();
635
+ $data[] = array(
636
+ 'id' => $id,
637
+ 'text' => $title,
638
+ );
639
+ }
640
+ }
641
+
642
+ if ( is_array( $data ) && ! empty( $data ) ) {
643
+ $result[] = array(
644
+ 'text' => '',
645
+ 'children' => $data,
646
+ );
647
+ }
648
+
649
+ wp_reset_postdata();
650
+
651
+ // return the result in json.
652
+ wp_send_json( $result );
653
+ }
654
+
655
+ public function search_only_titles( $search, $wp_query ) {
656
+ if ( ! empty( $search ) && ! empty( $wp_query->query_vars['search_terms'] ) ) {
657
+ global $wpdb;
658
+
659
+ $q = $wp_query->query_vars;
660
+ $n = ! empty( $q['exact'] ) ? '' : '%';
661
+
662
+ $search = array();
663
+
664
+ foreach ( (array) $q['search_terms'] as $term ) {
665
+ $search[] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $n . $wpdb->esc_like( $term ) . $n );
666
+ }
667
+
668
+ if ( ! is_user_logged_in() ) {
669
+ $search[] = "$wpdb->posts.post_password = ''";
670
+ }
671
+
672
+ $search = ' AND ' . implode( ' AND ', $search );
673
+ }
674
+
675
+ return $search;
676
+ }
677
+
678
+ function get_field( $field_data, $field_content ) {
679
+
680
+ $label = isset( $field_data['label'] ) ? $field_data['label'] : '';
681
+ $help = isset( $field_data['help'] ) ? $field_data['help'] : '';
682
+ $after_html = isset( $field_data['after_html'] ) ? $field_data['after_html'] : '';
683
+
684
+ $name_class = 'field-' . $field_data['name'];
685
+
686
+ $field_html = '<div class="wcf-field-row ' . $name_class . '">';
687
+
688
+ if( ! empty( $label ) || ! empty( $help ) ) {
689
+ $field_html .= '<div class="wcf-field-row-heading">';
690
+ if( ! empty( $label ) ) {
691
+ $field_html .= '<label>' . esc_html( $label ) . '</label>';
692
+ }
693
+ if ( ! empty( $help ) ) {
694
+ $field_html .= '<i class="wcf-field-heading-help dashicons dashicons-editor-help">';
695
+ // $field_html .= '<span class="wcf-tooltip" data-tooltip= "'. esc_attr( $help ) .'"></span>';
696
+ $field_html .= '</i>';
697
+ $field_html .= '<span class="wcf-tooltip-text">';
698
+ $field_html .= $help;
699
+ $field_html .= '</span>';
700
+ }
701
+ $field_html .= '</div>';
702
+ }
703
+
704
+ $field_html .= '<div class="wcf-field-row-content">';
705
+ $field_html .= $field_content;
706
+
707
+ if ( ! empty( $after_html ) ) {
708
+ $field_html .= $after_html;
709
+ }
710
+
711
+ $field_html .= '</div>';
712
+ $field_html .= '</div>';
713
+
714
+ return $field_html;
715
+ }
716
+
717
+ function get_text_field( $field_data ) {
718
+
719
+ $value = $field_data['value'];
720
+
721
+ $attr = '';
722
+
723
+ if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
724
+
725
+ foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
726
+ $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
727
+ }
728
+ }
729
+
730
+ $field_content = '<input type="text" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
731
+
732
+ return $this->get_field( $field_data, $field_content );
733
+ }
734
+
735
+ function get_shortcode_field( $field_data ) {
736
+
737
+ $attr = '';
738
+
739
+ $attr_fields = array(
740
+ 'readonly' => 'readonly',
741
+ 'onfocus' => 'this.select()',
742
+ 'onmouseup' => 'return false',
743
+ );
744
+
745
+ if ( $attr_fields && is_array( $attr_fields ) ) {
746
+
747
+ foreach ( $attr_fields as $attr_key => $attr_value ) {
748
+ $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
749
+ }
750
+ }
751
+
752
+ $field_content = '<input type="text" name="' . $field_data['name'] . '" value="' . $field_data['content'] . '" ' . $attr . '>';
753
+
754
+ return $this->get_field( $field_data, $field_content );
755
+ }
756
+
757
+ function get_display_field( $field_data ) {
758
+
759
+ $field_content = $field_data['content'];
760
+
761
+ return $this->get_field( $field_data, $field_content );
762
+ }
763
+
764
+ function get_hr_line_field( $field_data ) {
765
+
766
+ $field_data = array(
767
+ 'name' => 'wcf-hr-line',
768
+ 'content' => '<hr>'
769
+ );
770
+
771
+ $field_content = $field_data['content'];
772
+
773
+ return $this->get_field( $field_data, $field_content );
774
+ }
775
+
776
+ function get_number_field( $field_data ) {
777
+
778
+ $value = $field_data['value'];
779
+
780
+ $attr = '';
781
+
782
+ if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
783
+
784
+ foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
785
+ $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
786
+ }
787
+ }
788
+
789
+ $field_content = '<input type="number" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
790
+
791
+ return $this->get_field( $field_data, $field_content );
792
+ }
793
+
794
+ function get_hidden_field( $field_data ) {
795
+
796
+ $value = $field_data['value'];
797
+
798
+ $attr = '';
799
+
800
+ if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
801
+
802
+ foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
803
+ $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
804
+ }
805
+ }
806
+
807
+ $field_content = '<input type="hidden" id="' . $field_data['name'] . '" name="' . $field_data['name'] . '" value="' . $value . '" ' . $attr . '>';
808
+
809
+ return $this->get_field( $field_data, $field_content );
810
+ }
811
+
812
+ function get_area_field( $field_data ) {
813
+
814
+ $value = $field_data['value'];
815
+
816
+ $field_content = '<textarea name="' . $field_data['name'] . '" rows="10" cols="50">';
817
+ $field_content .= $value;
818
+ $field_content .= '</textarea>';
819
+
820
+ return $this->get_field( $field_data, $field_content );
821
+ }
822
+
823
+ function get_only_checkbox_field( $field_data ) {
824
+ // echo "<pre>";
825
+ // var_dump($field_data);
826
+ // echo "</pre>";
827
+
828
+ $value = $field_data['value'];
829
+
830
+
831
+ $field_content = '';
832
+ if ( isset( $field_data['before'] ) ) {
833
+ $field_content .= '<span>' . $field_data['before'] . '</span>';
834
+ }
835
+ $field_content .= '<input type="hidden" name="' . $field_data['name'] . '" value="no">';
836
+ $field_content .= '<input type="checkbox" name="' . $field_data['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
837
+
838
+ if ( isset( $field_data['after'] ) ) {
839
+ $field_content .= '<span>' . $field_data['after'] . '</span>';
840
+ }
841
+
842
+ if ( isset( $field_data['after_html'] ) ) {
843
+ $field_content .= '<span>' . $field_data['after_html'] . '</span>';
844
+ }
845
+
846
+ return $field_content;
847
+ }
848
+
849
+ function get_checkbox_field( $field_data ) {
850
+
851
+ $value = $field_data['value'];
852
+
853
+ $field_content = '';
854
+ if ( isset( $field_data['before'] ) ) {
855
+ $field_content .= '<span>' . $field_data['before'] . '</span>';
856
+ }
857
+ $field_content .= '<input type="hidden" name="' . $field_data['name'] . '" value="no">';
858
+ $field_content .= '<input type="checkbox" id="'.$field_data['name'].'" name="' . $field_data['name'] . '" value="yes" ' . checked( 'yes', $value, false ) . '>';
859
+
860
+ if ( isset( $field_data['after'] ) ) {
861
+ $field_content .= '<span>' . $field_data['after'] . '</span>';
862
+ }
863
+
864
+ return $this->get_field( $field_data, $field_content );
865
+ }
866
+
867
+ function get_radio_field( $field_data ) {
868
+
869
+ $value = $field_data['value'];
870
+ $field_content = '';
871
+
872
+ if ( is_array( $field_data['options'] ) && ! empty( $field_data['options'] ) ) {
873
+
874
+ foreach ( $field_data['options'] as $data_key => $data_value ) {
875
+
876
+ $field_content .= '<div class="wcf-radio-option">';
877
+ $field_content .= '<input type="radio" name="' . $field_data['name'] . '" value="' . $data_key . '" ' . checked( $data_key, $value, false ) . '>';
878
+ $field_content .= $data_value;
879
+ $field_content .= '</div>';
880
+ }
881
+ }
882
+
883
+ return $this->get_field( $field_data, $field_content );
884
+ }
885
+
886
+ function get_font_family_field( $field_data ) {
887
+
888
+ $value = $field_data['value'];
889
+
890
+ $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
891
+
892
+ $field_content = '<select class="wcf-field-font-family" data-for="' . $field_data['for'] . '" name="' . $field_data['name'] . '">';
893
+
894
+ $field_content .= '<option value="" ' . selected( '', $value, false ) . '>Default</option>';
895
+
896
+ $field_content .= '<optgroup label="Other System Fonts">';
897
+ foreach ( CartFlows_Font_Families::get_system_fonts() as $name => $variants ) {
898
+ $field_content .= '<option value="' . esc_attr( $name ) . '" ' . selected( $name, $value, false ) . '>' . esc_attr( $name ) . '</option>';
899
+ }
900
+ $field_content .= '</optgroup>';
901
+ $field_content .= '<optgroup label="Google">';
902
+ foreach ( CartFlows_Font_Families::get_google_fonts() as $name => $single_font ) {
903
+ $variants = wcf_get_prop( $single_font, '0' );
904
+ $category = wcf_get_prop( $single_font, '1' );
905
+ $font_value = '\'' . esc_attr( $name ) . '\', ' . esc_attr( $category );
906
+ $field_content .= '<option value="' . esc_attr( $font_value ) . '" ' . selected( $font_value, $value, false ) . '>' . esc_attr( $name ) . '</option>';
907
+ }
908
+ $field_content .= '</optgroup>';
909
+
910
+ $field_content .= '</select>';
911
+
912
+ return $this->get_field( $field_data, $field_content );
913
+ }
914
+
915
+ function get_font_weight_field( $field_data ) {
916
+
917
+ $value = $field_data['value'];
918
+
919
+ $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
920
+
921
+ $field_content = '<select data-selected="'.esc_attr( $value ).'" class="wcf-field-font-weight" data-for="' . $field_data['for'] . '" name="' . $field_data['name'] . '">';
922
+
923
+ $field_content .= '<option value="" ' . selected( '', $value, false ) . '>Default</option>';
924
+
925
+ $field_content .= '</select>';
926
+
927
+ return $this->get_field( $field_data, $field_content );
928
+ }
929
+
930
+ function get_select_field( $field_data ) {
931
+
932
+ $value = $field_data['value'];
933
+ $pro_options = isset( $field_data['pro-options'] ) ? $field_data['pro-options'] : array();
934
+
935
+ $field_content = '<select name="' . $field_data['name'] . '">';
936
+
937
+
938
+ if ( is_array( $field_data['options'] ) && ! empty( $field_data['options'] ) ) {
939
+
940
+ foreach ( $field_data['options'] as $data_key => $data_value ) {
941
+
942
+ $disabled = '';
943
+
944
+ if ( array_key_exists( $data_key, $pro_options ) ) {
945
+ $disabled = 'disabled ';
946
+ $data_value = $pro_options[ $data_key ];
947
+ }
948
+
949
+ $field_content .= '<option value="' . $data_key . '" ' . selected( $value, $data_key, false ) . ' ' . $disabled .'>' . $data_value . '</option>';
950
+ }
951
+ }
952
+
953
+ $field_content .= '</select>';
954
+
955
+ if ( isset( $field_data['after'] ) ) {
956
+ $field_content .= '<span>' . $field_data['after'] . '</span>';
957
+ }
958
+
959
+ return $this->get_field( $field_data, $field_content );
960
+ }
961
+
962
+ function get_color_picker_field( $field_data ) {
963
+
964
+ $value = $field_data['value'];
965
+
966
+ $field_content = '<input class="wcf-color-picker" type="text" name="' . $field_data['name'] . '" value="' . $value . '">';
967
+
968
+ return $this->get_field( $field_data, $field_content );
969
+ }
970
+
971
+ function get_product_selection_field( $field_data ) {
972
+
973
+ $value = $field_data['value'];
974
+
975
+ $multiple = '';
976
+
977
+ if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
978
+ $multiple = ' multiple="multiple"';
979
+ }
980
+
981
+ $allow_clear = '';
982
+
983
+ if ( isset( $field_data['allow_clear'] ) && $field_data['allow_clear'] ) {
984
+ $allow_clear = ' data-allow_clear="allow_clear"';
985
+ }
986
+
987
+ $field_content = '<select
988
+ name="' . $field_data['name'] . '[]"
989
+ class="wcf-product-search" ' . $multiple . $allow_clear . '
990
+ data-placeholder="' . __( 'Search for a product&hellip;', 'cartflows' ) . '"
991
+ data-action="woocommerce_json_search_products_and_variations">';
992
+
993
+ if ( is_array( $value ) && ! empty( $value ) ) {
994
+
995
+ foreach ( $value as $data_key => $product_id ) {
996
+
997
+ $product = wc_get_product( $product_id );
998
+
999
+ // posts.
1000
+ if ( ! empty( $product ) ) {
1001
+ $post_title = $product->get_name() . ' (#' . $product_id . ')';
1002
+
1003
+ $field_content .= '<option value="' . $product_id . '" selected="selected" >' . $post_title . '</option>';
1004
+ }
1005
+ }
1006
+ }
1007
+ $field_content .= '</select>';
1008
+
1009
+ return $this->get_field( $field_data, $field_content );
1010
+ }
1011
+
1012
+ function get_coupon_selection_field( $field_data ) {
1013
+
1014
+ $value = $field_data['value'];
1015
+
1016
+ $multiple = '';
1017
+
1018
+ if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
1019
+ $multiple = ' multiple="multiple"';
1020
+ }
1021
+
1022
+ $allow_clear = '';
1023
+
1024
+ if ( isset( $field_data['allow_clear'] ) && $field_data['allow_clear'] ) {
1025
+ $allow_clear = ' data-allow_clear="allow_clear"';
1026
+ }
1027
+
1028
+ $field_content = '<select
1029
+ name="' . $field_data['name'] . '[]"
1030
+ class="wc-coupon-search wcf-coupon-search" ' . $multiple . $allow_clear . '
1031
+ data-placeholder="' . __( 'Search for a coupon&hellip;', 'cartflows' ) . '"
1032
+ data-action="wcf_json_search_coupons">';
1033
+
1034
+ if ( is_array( $value ) && ! empty( $value ) ) {
1035
+
1036
+ $all_discount_types = wc_get_coupon_types();
1037
+
1038
+ foreach ( $value as $coupon_title ) {
1039
+
1040
+ $coupon = new WC_Coupon( $coupon_title );
1041
+
1042
+ $discount_type = $coupon->get_discount_type();
1043
+
1044
+ if ( isset( $discount_type ) && $discount_type ) {
1045
+ $discount_type = ' ( Type: ' . $all_discount_types[ $discount_type ] . ' )';
1046
+ }
1047
+
1048
+ $field_content .= '<option value="' . $coupon_title . '" selected="selected">' . $coupon_title . $discount_type . '</option>';
1049
+ }
1050
+ }
1051
+
1052
+ $field_content .= '</select>';
1053
+
1054
+ return $this->get_field( $field_data, $field_content );
1055
+ }
1056
+
1057
+ function get_page_selection_field( $field_data ) {
1058
+
1059
+ $value = $field_data['value'];
1060
+
1061
+ $multiple = '';
1062
+
1063
+ if ( isset( $field_data['multiple'] ) && $field_data['multiple'] ) {
1064
+ $multiple = 'multiple="multiple"';
1065
+ }
1066
+
1067
+ $field_content = '<select
1068
+ name="' . $field_data['name'] . '[]"
1069
+ class="wcf-search-pages" ' . $multiple . '"
1070
+ data-action="wcf_json_search_pages">';
1071
+
1072
+ if ( is_array( $value ) && ! empty( $value ) ) {
1073
+
1074
+ foreach ( $value as $data_key => $data_value ) {
1075
+
1076
+ $field_content .= '<option value="' . $data_value . '">' . get_the_title( $data_value ) . '</option>';
1077
+ }
1078
+ }
1079
+
1080
+ $field_content .= '</select>';
1081
+
1082
+ return $this->get_field( $field_data, $field_content );
1083
+ }
1084
+
1085
+ function get_section( $field_data ) {
1086
+ $field_html = '<div class="wcf-field-row wcf-field-section">';
1087
+ $field_html .= '<div class="wcf-field-section-heading" colspan="2">';
1088
+ $field_html .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1089
+
1090
+ if ( isset( $field_data['help'] ) ) {
1091
+ $field_html .= '<i class="wcf-field-heading-help dashicons dashicons-editor-help" title="' . esc_attr( $field_data['help'] ) . '"></i>';
1092
+ }
1093
+ $field_html .= '</div>';
1094
+ $field_html .= '</div>';
1095
+ return $field_html;
1096
+ }
1097
+
1098
+ function get_description_field( $field_data ) {
1099
+
1100
+ $field_html = '<div class="wcf-field-row wcf-field-desc ' . $field_data['name'] . '">';
1101
+ $field_html .= '<div class="wcf-field-desc-content">';
1102
+ $field_html .= $field_data['content'];
1103
+ $field_html .= '</div>';
1104
+ $field_html .= '</div>';
1105
+
1106
+ return $field_html;
1107
+ }
1108
+
1109
+ function get_checkout_field_repeater( $field_data ) {
1110
+
1111
+ $value = array();
1112
+
1113
+ $value[0] = array(
1114
+ 'add_to' => '',
1115
+ 'type' => '',
1116
+ 'label' => '',
1117
+ 'name' => '',
1118
+ );
1119
+
1120
+ $field_content = '';
1121
+
1122
+ $field_content .= '<div class="wcf-field-row">';
1123
+ // $field_content .= '<div class="wcf-field-row-heading">';
1124
+ // $field_content .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1125
+ // $field_content .= '</div>';
1126
+ $field_content .= '<div class="wcf-field-row-content">';
1127
+ $field_content .= '<div class="wcf-cpf-wrap">';
1128
+
1129
+ foreach ( $value as $p_key => $p_data ) {
1130
+ $field_content .= '<div class="wcf-cpf-row" data-key="' . $p_key . '">';
1131
+ $field_content .= '<div class="wcf-cpf-row-header">';
1132
+ $field_content .= '<span class="wcf-cpf-row-title">Add New Custom Field</span>';
1133
+ $field_content .= '</div>';
1134
+
1135
+ $field_content .= '<div class="wcf-cpf-row-standard-fields">';
1136
+
1137
+ /* Add To */
1138
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-add_to">';
1139
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Add to</span>';
1140
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1141
+ $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][add_to]" class="wcf-cpf-add_to">';
1142
+ $field_content .= '<option value="billing">Billing</option>';
1143
+ $field_content .= '<option value="shipping">Shipping</option>';
1144
+ $field_content .= '</select>';
1145
+ $field_content .= '</span>';
1146
+ $field_content .= '</div>';
1147
+
1148
+ /* Type */
1149
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-type">';
1150
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Type</span>';
1151
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1152
+ $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][type]" class="wcf-cpf-type">';
1153
+ $field_content .= '<option value="text">Text</option>';
1154
+ $field_content .= '<option value="textarea">Textarea</option>';
1155
+ $field_content .= '<option value="select">Select</option>';
1156
+ $field_content .= '<option value="checkbox">Checkbox</option>';
1157
+ $field_content .= '</select>';
1158
+ $field_content .= '</span>';
1159
+ $field_content .= '</div>';
1160
+
1161
+ /* Textarea */
1162
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-options">';
1163
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Options *</span>';
1164
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1165
+ $field_content .= '<textarea value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-options" placeholder="Enter your options separated by comma."></textarea>';
1166
+ $field_content .= '</span>';
1167
+ $field_content .= '</div>';
1168
+
1169
+ /* Label */
1170
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-label">';
1171
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Label *</span>';
1172
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1173
+ $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-label">';
1174
+ $field_content .= '</span>';
1175
+ $field_content .= '</div>';
1176
+
1177
+ /* Name */
1178
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-name">';
1179
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Name *</span>';
1180
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1181
+ $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][name]" class="wcf-cpf-name">';
1182
+ $field_content .= '</span>';
1183
+ $field_content .= '</div>';
1184
+
1185
+ $field_content .= '</div>';
1186
+ $field_content .= '</div>';
1187
+ }
1188
+
1189
+ /* Add New Custom Field */
1190
+ $field_content .= '<div class="wcf-cpf-add-row">';
1191
+ $field_content .= '<div class="wcf-cpf-add-wrap">';
1192
+ $field_content .= '<button class="button button-secondary wcf-cpf-add" data-name="wcf-checkout-custom-fields">Add New Field</button>';
1193
+ $field_content .= '</div>';
1194
+ $field_content .= '</div>';
1195
+ /* End Add new custom field */
1196
+
1197
+ $field_content .= '</div>';
1198
+ $field_content .= '</div>';
1199
+ $field_content .= '</div>';
1200
+
1201
+ return $field_content;
1202
+ }
1203
+
1204
+ function get_pro_checkout_field_repeater( $field_data ) {
1205
+
1206
+ $value = array();
1207
+
1208
+ $value[0] = array(
1209
+ 'add_to' => '',
1210
+ 'type' => '',
1211
+ 'label' => '',
1212
+ 'name' => '',
1213
+ );
1214
+
1215
+ $field_content = '';
1216
+
1217
+ $field_content .= '<div class="wcf-field-row">';
1218
+ // $field_content .= '<div class="wcf-field-row-heading">';
1219
+ // $field_content .= '<label>' . esc_html( $field_data['label'] ) . '</label>';
1220
+ // $field_content .= '</div>';
1221
+ $field_content .= '<div class="wcf-field-row-content">';
1222
+ $field_content .= '<div class="wcf-cpf-wrap">';
1223
+
1224
+ foreach ( $value as $p_key => $p_data ) {
1225
+ $field_content .= '<div class="wcf-cpf-row" data-key="' . $p_key . '">';
1226
+ $field_content .= '<div class="wcf-cpf-row-header">';
1227
+ $field_content .= '<span class="wcf-cpf-row-title">Add New Custom Field</span>';
1228
+ $field_content .= '</div>';
1229
+
1230
+ $field_content .= '<div class="wcf-cpf-row-standard-fields">';
1231
+
1232
+ /* Add To */
1233
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-add_to">';
1234
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Add to</span>';
1235
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1236
+ $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][add_to]" class="wcf-cpf-add_to">';
1237
+ $field_content .= '<option value="billing">Billing</option>';
1238
+ $field_content .= '<option value="shipping">Shipping</option>';
1239
+ $field_content .= '</select>';
1240
+ $field_content .= '</span>';
1241
+ $field_content .= '</div>';
1242
+
1243
+ /* Type */
1244
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-type">';
1245
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Type</span>';
1246
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1247
+ $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][type]" class="wcf-cpf-type">';
1248
+ $field_content .= '<option value="text">Text</option>';
1249
+ $field_content .= '<option value="textarea">Textarea</option>';
1250
+ $field_content .= '<option value="select">Select</option>';
1251
+ $field_content .= '<option value="checkbox">Checkbox</option>';
1252
+ $field_content .= '<option value="hidden">Hidden</option>';
1253
+ $field_content .= '</select>';
1254
+ $field_content .= '</span>';
1255
+ $field_content .= '</div>';
1256
+
1257
+ /* Label */
1258
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-label">';
1259
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Label <i>*</i></span>';
1260
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1261
+ $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-label">';
1262
+ $field_content .= '<span id="wcf-cpf-label-error-msg"></span>';
1263
+ $field_content .= '</span>';
1264
+ $field_content .= '</div>';
1265
+
1266
+ /* Default */
1267
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-default">';
1268
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Default</span>';
1269
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1270
+ $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][default]" class="wcf-cpf-default">';
1271
+ $field_content .= '<span id="wcf-cpf-default-error-msg"></span>';
1272
+ $field_content .= '</span>';
1273
+ $field_content .= '</div>';
1274
+
1275
+ /* Placeholder */
1276
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-placeholder">';
1277
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Placeholder</span>';
1278
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1279
+ $field_content .= '<input type="text" value="" name="wcf-checkout-custom-fields[' . $p_key . '][placeholder]" class="wcf-cpf-placeholder">';
1280
+ $field_content .= '<span id="wcf-cpf-placeholder-error-msg"></span>';
1281
+ $field_content .= '</span>';
1282
+ $field_content .= '</div>';
1283
+
1284
+ /* Options */
1285
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-options">';
1286
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Options <i>*</i></span>';
1287
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1288
+ $field_content .= '<textarea value="" name="wcf-checkout-custom-fields[' . $p_key . '][label]" class="wcf-cpf-options" placeholder="Enter your options separated by comma."></textarea>';
1289
+ $field_content .= '</span>';
1290
+ $field_content .= '</div>';
1291
+
1292
+ /* Width */
1293
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-width">';
1294
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Width</span>';
1295
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1296
+ $field_content .= '<select name="wcf-checkout-custom-fields[' . $p_key . '][width]" class="wcf-cpf-width">';
1297
+ $field_content .= '<option value="33">33%</option>';
1298
+ $field_content .= '<option value="50">50%</option>';
1299
+ $field_content .= '<option value="100" selected>100%</option>';
1300
+ $field_content .= '</select>';
1301
+ $field_content .= '</span>';
1302
+ $field_content .= '</div>';
1303
+
1304
+ /* Required */
1305
+ $field_content .= '<div class="wcf-cpf-fields wcf-cpf-required">';
1306
+ $field_content .= '<span class="wcf-cpf-row-setting-label">Required</span>';
1307
+ $field_content .= '<span class="wcf-cpf-row-setting-field">';
1308
+ $field_content .= '<input type="hidden" value="no" name="wcf-checkout-custom-fields[' . $p_key . '][required]" class="wcf-cpf-required">';
1309
+ $field_content .= '<input type="checkbox" value="yes" name="wcf-checkout-custom-fields[' . $p_key . '][required]" class="wcf-cpf-required">';
1310
+ $field_content .= '<span id="wcf-cpf-required-error-msg"></span>';
1311
+ $field_content .= '</span>';
1312
+ $field_content .= '</div>';
1313
+
1314
+ $field_content .= '</div>';
1315
+ $field_content .= '</div>';
1316
+ }
1317
+
1318
+ /* Add New Custom Field */
1319
+ $field_content .= '<div class="wcf-cpf-add-row">';
1320
+ $field_content .= '<div class="wcf-cpf-add-wrap">';
1321
+ $field_content .= '<button class="button button-secondary wcf-pro-cpf-add" data-name="wcf-checkout-custom-fields">Add New Field</button>';
1322
+ $field_content .= '</div>';
1323
+ $field_content .= '</div>';
1324
+ /* End Add new custom field */
1325
+
1326
+ $field_content .= '</div>';
1327
+ $field_content .= '</div>';
1328
+ $field_content .= '</div>';
1329
+
1330
+ return $field_content;
1331
+ }
1332
+
1333
+ function get_product_selection_repeater( $field_data ) {
1334
+
1335
+ $value = $field_data['value'];
1336
+
1337
+ if ( ! is_array( $value ) ) {
1338
+
1339
+ $value[0] = array(
1340
+ 'product' => '',
1341
+ );
1342
+ } else {
1343
+
1344
+ if ( ! isset( $value[0] ) ) {
1345
+
1346
+ $value[0] = array(
1347
+ 'product' => '',
1348
+ );
1349
+ }
1350
+ }
1351
+
1352
+ $field_html = '';
1353
+
1354
+ $field_html .= '<script type="text/html" id="tmpl-wcf-product-repeater">';
1355
+ $field_html .= $this->generate_product_repeater_html( '{{id}}' );
1356
+ $field_html .= '</script>';
1357
+
1358
+ $field_html .= '<div class="wcf-field-row">';
1359
+ $field_html .= '<div class="wcf-field-row-content">';
1360
+ $field_html .= '<div class="wcf-repeatables-wrap">';
1361
+
1362
+ if ( is_array( $value ) ) {
1363
+
1364
+ foreach ( $value as $p_key => $p_data ) {
1365
+
1366
+ $selected_options = '';
1367
+
1368
+ if ( isset( $p_data['product'] ) ) {
1369
+
1370
+ $product = wc_get_product( $p_data['product'] );
1371
+
1372
+ // posts.
1373
+ if ( ! empty( $product ) ) {
1374
+ $post_title = $product->get_name() . ' (#' . $p_data['product'] . ')';
1375
+
1376
+ $selected_options = '<option value="' . $p_data['product'] . '" selected="selected" >' . $post_title . '</option>';
1377
+ }
1378
+ }
1379
+
1380
+ $field_html .= $this->generate_product_repeater_html( $p_key, $selected_options );
1381
+ }
1382
+ }
1383
+
1384
+ $field_html .= '<div class="wcf-add-repeatable-row">';
1385
+ $field_html .= '<div class="submit wcf-add-repeatable-wrap">';
1386
+ $field_html .= '<button class="button-primary wcf-add-repeatable" data-name="wcf-checkout-products">Add New Product</button>';
1387
+ $field_html .= '</div>';
1388
+ $field_html .= '</div>';
1389
+ $field_html .= '</div>';
1390
+ $field_html .= '</div>';
1391
+ $field_html .= '</div>';
1392
+
1393
+ return $field_html;
1394
+ }
1395
+
1396
+ function generate_product_repeater_html( $id, $options = '' ) {
1397
+
1398
+ $field_html = '<div class="wcf-repeatable-row" data-key="' . $id . '">';
1399
+
1400
+ $field_html .= '<div class="wcf-repeatable-row-standard-fields">';
1401
+
1402
+ /* Product Name */
1403
+ $field_html .= '<div class="wcf-repeatable-fields wcf-sel-product">';
1404
+ $field_html .= '<span class="wcf-repeatable-row-setting-field">';
1405
+ $field_html .= '<select
1406
+ name="wcf-checkout-products[' . $id . '][product]"
1407
+ class="wcf-product-search"
1408
+ data-allow_clear="allow_clear"
1409
+ data-placeholder="' . __( 'Search for a product&hellip;', 'cartflows' ) . '"
1410
+ data-action="woocommerce_json_search_products_and_variations">';
1411
+ $field_html .= $options;
1412
+ $field_html .= '</select>';
1413
+ $field_html .= '</span>';
1414
+ $field_html .= '<span class="wcf-repeatable-row-actions">';
1415
+ $field_html .= '<a class="wcf-remove-row wcf-repeatable-remove button" data-type="product">';
1416
+ $field_html .= '<span class="dashicons dashicons-trash"></span>';
1417
+ $field_html .= '<span class="wcf-repeatable-remove-button">'. __( 'Remove', 'cartflows' ).'</span>';
1418
+ $field_html .= '</a>';
1419
+ $field_html .= '</span>';
1420
+ $field_html .= '</div>';
1421
+ $field_html .= '</div>';
1422
+ $field_html .= '</div>';
1423
+
1424
+ return $field_html;
1425
+ }
1426
+
1427
+ function get_image_field( $field_data ) {
1428
+
1429
+ $value = $field_data['value'];
1430
+
1431
+ $attr = '';
1432
+
1433
+ if ( isset( $field_data['attr'] ) && is_array( $field_data['attr'] ) ) {
1434
+
1435
+ foreach ( $field_data['attr'] as $attr_key => $attr_value ) {
1436
+ $attr .= ' ' . $attr_key . '="' . $attr_value . '"';
1437
+ }
1438
+ }
1439
+
1440
+ $display_preview_box = ( isset( $value ) && '' != $value ) ? 'display:block;' : 'display:none';
1441
+
1442
+ $field_content = '<div id="wcf-image-preview" style="'.$display_preview_box.'">';
1443
+ if( isset( $value ) ){
1444
+ $field_content .= '<img src="'. $value .'" class="saved-image" name="'. $field_data['name'] .'" width="150">';
1445
+ }
1446
+ $field_content .= '</div>';
1447
+ // $field_content .= '<input type="hidden" id="wcf-image-id" class="wcf-image-id" name="wcf-image-id[image-id]" value="">';
1448
+ $field_content .= '<input type="hidden" id="wcf-image-value" class="wcf-image" name="' . $field_data['name'] . '" value="'.$value.'">';
1449
+
1450
+ $field_content .= '<button type="button" ' . $attr . ' class="wcf-select-image button-secondary">Select Image</button>';
1451
+
1452
+ $display_remove_button = ( isset( $value ) && '' != $value ) ? 'display:inline-block; margin-left: 5px;' : 'display:none';
1453
+
1454
+ $field_content .= '<button type="button" class="wcf-remove-image button-secondary" style="'.$display_remove_button.'">Remove Image</button>';
1455
+
1456
+ return $this->get_field( $field_data, $field_content );
1457
+ }
1458
+
1459
+ /**
1460
+ * Localize variables in admin
1461
+ *
1462
+ * @param array $vars variables.
1463
+ */
1464
+ function localize_vars( $vars ) {
1465
+
1466
+ $ajax_actions = array(
1467
+ 'wcf_add_checkout_custom_field',
1468
+ 'wcf_pro_add_checkout_custom_field',
1469
+ 'wcf_delete_checkout_custom_field',
1470
+ 'wcf_json_search_pages',
1471
+ 'wcf_json_search_coupons'
1472
+ );
1473
+
1474
+ foreach ( $ajax_actions as $action ) {
1475
+
1476
+ $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
1477
+ }
1478
+
1479
+ return $vars;
1480
+ }
1481
+ }
1482
+ // @codingStandardsIgnoreEnd
classes/class-cartflows-meta.php CHANGED
@@ -1,75 +1,75 @@
1
- <?php
2
- /**
3
- * CartFlows Meta
4
- *
5
- * @package CartFlows
6
- * @since 1.0.0
7
- */
8
-
9
- if ( ! class_exists( 'Cartflows_Meta' ) ) :
10
-
11
- /**
12
- * CartFlows_Meta
13
- *
14
- * @since 1.0.0
15
- */
16
- class Cartflows_Meta {
17
- /**
18
- * Constructor
19
- *
20
- * @since 1.0.0
21
- */
22
- public function __construct() {
23
- }
24
-
25
- /**
26
- * Flow & Step Actions
27
- *
28
- * @param array $options options.
29
- * @param int $post_id post ID.
30
- */
31
- function right_column_footer( $options, $post_id ) {
32
- ?>
33
- <div class="wcf-column-right-footer">
34
- <?php submit_button( __( 'Update', 'cartflows' ), 'primary', 'save', false ); ?>
35
-
36
- <?php
37
- $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
38
- if ( $flow_id ) {
39
- ?>
40
- <a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button pull-right wcf-back-to-flow-edit">
41
- <i class="dashicons dashicons-arrow-left-alt"></i>
42
- <?php _e( 'Back to edit Flow', 'cartflows' ); ?>
43
- </a>
44
- <?php } ?>
45
-
46
- </div>
47
- <?php
48
- }
49
-
50
- /**
51
- * Script Header (Used for add script into header)
52
- *
53
- * @param array $options options.
54
- * @param int $post_id post ID.
55
- */
56
- function tab_custom_script( $options, $post_id ) {
57
- ?>
58
- <div class="wcf-<?php echo wcf()->utils->get_step_type( $post_id ); ?>-custom-script-header wcf-tab-content widefat">
59
- <?php
60
- /* Script added onto the header */
61
- echo wcf()->meta->get_area_field(
62
- array(
63
- 'label' => __( 'Custom Script', 'cartflows' ),
64
- 'name' => 'wcf-custom-script',
65
- 'value' => htmlspecialchars( $options['wcf-custom-script'] ),
66
- 'help' => __( 'Custom script lets you add your own custom script on front end of this flow page.', 'cartflows' ),
67
- )
68
- );
69
- ?>
70
- </div>
71
- <?php
72
- }
73
- }
74
-
75
- endif;
1
+ <?php
2
+ /**
3
+ * CartFlows Meta
4
+ *
5
+ * @package CartFlows
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! class_exists( 'Cartflows_Meta' ) ) :
10
+
11
+ /**
12
+ * CartFlows_Meta
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Cartflows_Meta {
17
+ /**
18
+ * Constructor
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ public function __construct() {
23
+ }
24
+
25
+ /**
26
+ * Flow & Step Actions
27
+ *
28
+ * @param array $options options.
29
+ * @param int $post_id post ID.
30
+ */
31
+ function right_column_footer( $options, $post_id ) {
32
+ ?>
33
+ <div class="wcf-column-right-footer">
34
+ <?php submit_button( __( 'Update', 'cartflows' ), 'primary', 'save', false ); ?>
35
+
36
+ <?php
37
+ $flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
38
+ if ( $flow_id ) {
39
+ ?>
40
+ <a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button pull-right wcf-back-to-flow-edit">
41
+ <i class="dashicons dashicons-arrow-left-alt"></i>
42
+ <?php _e( 'Back to edit Flow', 'cartflows' ); ?>
43
+ </a>
44
+ <?php } ?>
45
+
46
+ </div>
47
+ <?php
48
+ }
49
+
50
+ /**
51
+ * Script Header (Used for add script into header)
52
+ *
53
+ * @param array $options options.
54
+ * @param int $post_id post ID.
55
+ */
56
+ function tab_custom_script( $options, $post_id ) {
57
+ ?>
58
+ <div class="wcf-<?php echo wcf()->utils->get_step_type( $post_id ); ?>-custom-script-header wcf-tab-content widefat">
59
+ <?php
60
+ /* Script added onto the header */
61
+ echo wcf()->meta->get_area_field(
62
+ array(
63
+ 'label' => __( 'Custom Script', 'cartflows' ),
64
+ 'name' => 'wcf-custom-script',
65
+ 'value' => htmlspecialchars( $options['wcf-custom-script'] ),
66
+ 'help' => __( 'Custom script lets you add your own custom script on front end of this flow page.', 'cartflows' ),
67
+ )
68
+ );
69
+ ?>
70
+ </div>
71
+ <?php
72
+ }
73
+ }
74
+
75
+ endif;
classes/class-cartflows-thrive-compatibility.php CHANGED
@@ -1,77 +1,77 @@
1
- <?php
2
- /**
3
- * Thrive Visual Editor Compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Class for Thrive Visual Editor Compatibility
10
- */
11
- class Cartflows_Thrive_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
-
35
- // Add CartFlows post type in the thrive page editor.
36
- add_filter( 'tve_post_type_can_use_landing_page', array( $this, 'send_post_type_to_thrive' ) );
37
-
38
- // add_filter( 'tve_landing_page_post_types', array( $this, 'send_post_type_to_thrive' ) );.
39
- add_filter( 'tcb_can_use_landing_pages', array( $this, 'display_change_template_option' ) );
40
-
41
- add_filter( 'tcb_has_templates_tab', array( $this, 'display_change_template_option' ) );
42
- }
43
-
44
- /**
45
- * Return step post type for Thrive Architect.
46
- *
47
- * @since 1.0.0
48
- * @param array $post_type_pt the current step post type.
49
- * @return array $post_type_pt current step post type.
50
- */
51
- function send_post_type_to_thrive( $post_type_pt ) {
52
-
53
- $post_type_pt[] = CARTFLOWS_STEP_POST_TYPE;
54
-
55
- return $post_type_pt;
56
- }
57
-
58
- /**
59
- * Return true/false to show change template option.
60
- *
61
- * @since 1.0.0
62
- * @param array $bool true/false.
63
- * @return array $bool true/false.
64
- */
65
- function display_change_template_option( $bool ) {
66
-
67
- if ( wcf()->utils->is_step_post_type() ) {
68
- $bool = true;
69
- }
70
- return $bool;
71
- }
72
- }
73
-
74
- /**
75
- * Kicking this off by calling 'get_instance()' method
76
- */
77
- Cartflows_Thrive_Compatibility::get_instance();
1
+ <?php
2
+ /**
3
+ * Thrive Visual Editor Compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class for Thrive Visual Editor Compatibility
10
+ */
11
+ class Cartflows_Thrive_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
+
35
+ // Add CartFlows post type in the thrive page editor.
36
+ add_filter( 'tve_post_type_can_use_landing_page', array( $this, 'send_post_type_to_thrive' ) );
37
+
38
+ // add_filter( 'tve_landing_page_post_types', array( $this, 'send_post_type_to_thrive' ) );.
39
+ add_filter( 'tcb_can_use_landing_pages', array( $this, 'display_change_template_option' ) );
40
+
41
+ add_filter( 'tcb_has_templates_tab', array( $this, 'display_change_template_option' ) );
42
+ }
43
+
44
+ /**
45
+ * Return step post type for Thrive Architect.
46
+ *
47
+ * @since 1.0.0
48
+ * @param array $post_type_pt the current step post type.
49
+ * @return array $post_type_pt current step post type.
50
+ */
51
+ function send_post_type_to_thrive( $post_type_pt ) {
52
+
53
+ $post_type_pt[] = CARTFLOWS_STEP_POST_TYPE;
54
+
55
+ return $post_type_pt;
56
+ }
57
+
58
+ /**
59
+ * Return true/false to show change template option.
60
+ *
61
+ * @since 1.0.0
62
+ * @param array $bool true/false.
63
+ * @return array $bool true/false.
64
+ */
65
+ function display_change_template_option( $bool ) {
66
+
67
+ if ( wcf()->utils->is_step_post_type() ) {
68
+ $bool = true;
69
+ }
70
+ return $bool;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Kicking this off by calling 'get_instance()' method
76
+ */
77
+ Cartflows_Thrive_Compatibility::get_instance();
classes/class-cartflows-update.php CHANGED
@@ -1,77 +1,77 @@
1
- <?php
2
- /**
3
- * Update Compatibility
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_Update' ) ) :
9
-
10
- /**
11
- * CartFlows Update initial setup
12
- *
13
- * @since 1.0.0
14
- */
15
- class Cartflows_Update {
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', __CLASS__ . '::init' );
40
- }
41
-
42
- /**
43
- * Init
44
- *
45
- * @since 1.0.0
46
- * @return void
47
- */
48
- static public function init() {
49
-
50
- do_action( 'cartflows_update_before' );
51
-
52
- // Get auto saved version number.
53
- $saved_version = get_option( 'cartflows-version', false );
54
-
55
- // Update auto saved version number.
56
- if ( ! $saved_version ) {
57
- update_option( 'cartflows-version', CARTFLOWS_VER );
58
- }
59
-
60
- // If equals then return.
61
- if ( version_compare( $saved_version, CARTFLOWS_VER, '=' ) ) {
62
- return;
63
- }
64
-
65
- // Update auto saved version number.
66
- update_option( 'cartflows-version', CARTFLOWS_VER );
67
-
68
- do_action( 'cartflows_update_after' );
69
- }
70
- }
71
-
72
- /**
73
- * Kicking this off by calling 'get_instance()' method
74
- */
75
- Cartflows_Update::get_instance();
76
-
77
- endif;
1
+ <?php
2
+ /**
3
+ * Update Compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_Update' ) ) :
9
+
10
+ /**
11
+ * CartFlows Update initial setup
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ class Cartflows_Update {
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', __CLASS__ . '::init' );
40
+ }
41
+
42
+ /**
43
+ * Init
44
+ *
45
+ * @since 1.0.0
46
+ * @return void
47
+ */
48
+ static public function init() {
49
+
50
+ do_action( 'cartflows_update_before' );
51
+
52
+ // Get auto saved version number.
53
+ $saved_version = get_option( 'cartflows-version', false );
54
+
55
+ // Update auto saved version number.
56
+ if ( ! $saved_version ) {
57
+ update_option( 'cartflows-version', CARTFLOWS_VER );
58
+ }
59
+
60
+ // If equals then return.
61
+ if ( version_compare( $saved_version, CARTFLOWS_VER, '=' ) ) {
62
+ return;
63
+ }
64
+
65
+ // Update auto saved version number.
66
+ update_option( 'cartflows-version', CARTFLOWS_VER );
67
+
68
+ do_action( 'cartflows_update_after' );
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Kicking this off by calling 'get_instance()' method
74
+ */
75
+ Cartflows_Update::get_instance();
76
+
77
+ endif;
classes/class-cartflows-utils.php CHANGED
@@ -315,6 +315,73 @@ class Cartflows_Utils {
315
 
316
  return $url;
317
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  }
319
 
320
  /**
315
 
316
  return $url;
317
  }
318
+
319
+ /**
320
+ * Get assets urls
321
+ *
322
+ * @return array
323
+ * @since 1.1.6
324
+ */
325
+ function get_assets_path() {
326
+
327
+ $rtl = '';
328
+
329
+ if ( is_rtl() ) {
330
+ $rtl = '-rtl';
331
+ }
332
+
333
+ $file_prefix = '';
334
+ $dir_name = '';
335
+
336
+ $is_min = apply_filters( 'cartflows_load_min_assets', false );
337
+
338
+ if ( $is_min ) {
339
+ $file_prefix = '.min';
340
+ $dir_name = 'min-';
341
+ }
342
+
343
+ $js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
344
+ $css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
345
+
346
+ return array(
347
+ 'css' => $css_gen_path,
348
+ 'js' => $js_gen_path,
349
+ 'file_prefix' => $file_prefix,
350
+ 'rtl' => $rtl,
351
+ );
352
+ }
353
+
354
+ /**
355
+ * Get assets css url
356
+ *
357
+ * @param string $file file name.
358
+ * @return string
359
+ * @since 1.1.6
360
+ */
361
+ function get_css_url( $file ) {
362
+
363
+ $assets_vars = wcf()->assets_vars;
364
+
365
+ $url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
366
+
367
+ return $url;
368
+ }
369
+
370
+ /**
371
+ * Get assets js url
372
+ *
373
+ * @param string $file file name.
374
+ * @return string
375
+ * @since 1.1.6
376
+ */
377
+ function get_js_url( $file ) {
378
+
379
+ $assets_vars = wcf()->assets_vars;
380
+
381
+ $url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
382
+
383
+ return $url;
384
+ }
385
  }
386
 
387
  /**
classes/class-cartflows-wizard.php CHANGED
@@ -1,447 +1,447 @@
1
- <?php
2
- /**
3
- * Schema Pro - Schema Wizard
4
- *
5
- * @package Schema Pro
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
- if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
24
- add_action( 'admin_menu', array( $this, 'admin_menus' ) );
25
- add_action( 'admin_init', array( $this, 'setup_wizard' ) );
26
- add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
27
- add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
28
-
29
- add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
30
- }
31
- }
32
-
33
- /**
34
- * Show action links on the plugin screen.
35
- *
36
- * @since 1.0.0
37
- * @return void
38
- */
39
- function show_setup_wizard() {
40
-
41
- $status = get_option( 'wcf_setup_complete', false );
42
-
43
- if ( false === $status ) { ?>
44
- <div class="notice notice-info">
45
- <p><b><?php _e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
46
- <p><?php _e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
47
- <p><a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary">Start Wizard!</a></p>
48
- </div>
49
- <?php
50
- }
51
- }
52
-
53
- /**
54
- * Add admin menus/screens.
55
- */
56
- public function admin_menus() {
57
- add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
58
- }
59
-
60
- /**
61
- * Show the setup wizard.
62
- */
63
- public function setup_wizard() {
64
-
65
- if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) {
66
- return;
67
- }
68
-
69
- $this->steps = array(
70
- 'basic-config' => array(
71
- 'name' => __( 'Welcome', 'cartflows' ),
72
- 'view' => array( $this, 'welcome_step' ),
73
- 'handler' => array( $this, 'welcome_step_save' ),
74
- ),
75
- 'page-builder' => array(
76
- 'name' => __( 'Page Builder', 'cartflows' ),
77
- 'view' => array( $this, 'page_builder_step' ),
78
- // 'handler' => array( $this, 'page_builder_step_save' ),
79
- ),
80
- 'setup-ready' => array(
81
- 'name' => __( 'Ready!', 'cartflows' ),
82
- 'view' => array( $this, 'ready_step' ),
83
- 'handler' => '',
84
- ),
85
- );
86
-
87
- $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
88
-
89
- wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
90
- wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
91
- wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER );
92
-
93
- wp_enqueue_media();
94
-
95
- if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
96
- call_user_func( $this->steps[ $this->step ]['handler'] );
97
- }
98
-
99
- ob_start();
100
- $this->setup_wizard_header();
101
- $this->setup_wizard_steps();
102
- $this->setup_wizard_content();
103
- $this->setup_wizard_footer();
104
- exit;
105
- }
106
-
107
- /**
108
- * Get current step slug
109
- */
110
- public function get_current_step_slug() {
111
- $keys = array_keys( $this->steps );
112
- return $keys[ array_search( $this->step, array_keys( $this->steps ) ) ];
113
- }
114
-
115
- /**
116
- * Get previous step link
117
- */
118
- public function get_prev_step_link() {
119
- $keys = array_keys( $this->steps );
120
- return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) - 1 ] );
121
- }
122
-
123
- /**
124
- * Get next step link
125
- */
126
- public function get_next_step_link() {
127
- $keys = array_keys( $this->steps );
128
- return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
129
- }
130
-
131
- /**
132
- * Get next step link
133
- */
134
- public function get_next_step_plain_link() {
135
- $keys = array_keys( $this->steps );
136
- $step = $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ];
137
- return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
138
- }
139
-
140
- /**
141
- * Setup Wizard Header.
142
- */
143
- public function setup_wizard_header() {
144
- ?>
145
- <!DOCTYPE html>
146
- <html>
147
- <head>
148
- <meta name="viewport" content="width=device-width" />
149
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
150
- <title><?php _e( 'CartFlows Setup', 'cartflows' ); ?></title>
151
-
152
- <script type="text/javascript">
153
- 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();}}};
154
- var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
155
- var pagenow = '';
156
- </script>
157
- <?php wp_print_scripts( array( 'cartflows-setup' ) ); ?>
158
- <?php do_action( 'admin_print_styles' ); ?>
159
- <?php do_action( 'admin_head' ); ?>
160
- </head>
161
- <body class="cartflows-setup wp-core-ui cartflows-step-<?php echo esc_attr( $this->get_current_step_slug() ); ?>">
162
- <div id="cartflows-logo">
163
- <h1>CartFlows</h1>
164
- </div>
165
- <?php
166
- }
167
-
168
- /**
169
- * Setup Wizard Footer.
170
- */
171
- public function setup_wizard_footer() {
172
-
173
- $admin_url = admin_url( 'admin.php?page=cartflows_settings' );
174
- ?>
175
- <div class="close-button-wrapper">
176
- <a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php _e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
177
- </div>
178
- </body>
179
- </html>
180
- <?php
181
- }
182
-
183
- /**
184
- * Output the steps.
185
- */
186
- public function setup_wizard_steps() {
187
-
188
- $ouput_steps = $this->steps;
189
- ?>
190
- <ol class="cartflows-setup-steps">
191
- <?php
192
- foreach ( $ouput_steps as $step_key => $step ) :
193
- $classes = '';
194
- $activated = false;
195
- if ( $step_key === $this->step ) {
196
- $classes = 'active';
197
- $activated = true;
198
- } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
199
- $classes = 'done';
200
- $activated = true;
201
- }
202
- ?>
203
- <li class="<?php echo esc_attr( $classes ); ?>">
204
- <span><?php echo esc_html( $step['name'] ); ?></span>
205
- </li>
206
- <?php endforeach; ?>
207
- </ol>
208
- <?php
209
- }
210
-
211
- /**
212
- * Output the content for the current step.
213
- */
214
- public function setup_wizard_content() {
215
- echo '<div class="cartflows-setup-content">';
216
- call_user_func( $this->steps[ $this->step ]['view'] );
217
- echo '</div>';
218
- }
219
-
220
- /**
221
- * Introduction step.
222
- */
223
- public function welcome_step() {
224
- ?>
225
- <h1><?php _e( 'Thank you for choosing CartFlows!', 'cartflows' ); ?></h1>
226
- <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
227
- <form method="post">
228
- <div class="cartflows-setup-actions step">
229
- <div class="button-prev-wrap">
230
- </div>
231
- <div class="button-next-wrap">
232
- <input type="submit" class="uct-activate button-primary button button-large button-next" value="<?php _e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
233
- </div>
234
- <?php wp_nonce_field( 'cartflow-setup' ); ?>
235
- </div>
236
- </form>
237
- <?php
238
- }
239
-
240
- /**
241
- * Save Locale Settings.
242
- */
243
- public function welcome_step_save() {
244
- check_admin_referer( 'cartflow-setup' );
245
-
246
- // Update site title & tagline.
247
- $redirect_url = $this->get_next_step_link();
248
-
249
- wp_redirect( esc_url_raw( $redirect_url ) );
250
- exit;
251
- }
252
-
253
- /**
254
- * Locale settings
255
- */
256
- public function page_builder_step() {
257
- ?>
258
-
259
- <h1><?php _e( 'Page Builder', 'cartflows' ); ?></h1>
260
- <p class="description"><?php _e( 'Select a page builder which you want to use for creating your new flows.', 'cartflows' ); ?></p>
261
- <form method="post">
262
- <table class="cartflows-table widefat">
263
- <tr class="cartflows-row">
264
- <td class="cartflows-row-heading">
265
- <label><?php esc_html_e( 'Select Page Builder', 'cartflows' ); ?></label>
266
- <i class="cartflows-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Add locations for where this Schema should appear.', 'cartflows' ); ?>"></i>
267
- </td>
268
- <td class="cartflows-row-content">
269
- <?php
270
- $installed_plugins = get_plugins();
271
- $plugins = array(
272
- array(
273
- 'title' => __( 'Elementor', 'cartflows' ),
274
- 'value' => 'elementor',
275
- 'data' => array(
276
- 'slug' => 'elementor',
277
- 'init' => 'elementor/elementor.php',
278
- 'active' => is_plugin_active( 'elementor/elementor.php' ) ? 'yes' : 'no',
279
- 'install' => isset( $installed_plugins['elementor/elementor.php'] ) ? 'yes' : 'no',
280
- ),
281
- ),
282
- );
283
- ?>
284
- <select name="page-builder" class="page-builder-list" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>">
285
- <?php
286
- foreach ( $plugins as $key => $plugin ) {
287
- 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>';
288
- }
289
- ?>
290
- </select>
291
- </td>
292
- </tr>
293
- </table>
294
- <p><?php _e( 'The above plugin will be installed and activated for you!', 'cartflows' ); ?></p>
295
- <div class="cartflows-setup-actions step">
296
- <div class="button-prev-wrap">
297
- <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php _e( '« Previous', 'cartflows' ); ?></a>
298
- </div>
299
- <div class="button-next-wrap">
300
- <a href="#" class="button button-primary wcf-install-plugins"><?php _e( 'Next »', 'cartflows' ); ?></a>
301
- <!-- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Next »', 'cartflows' ); ?>" name="save_step" /> -->
302
- </div>
303
- <?php wp_nonce_field( 'cartflow-setup' ); ?>
304
- </div>
305
- </form>
306
- <?php
307
- }
308
-
309
- /**
310
- * Save Locale Settings.
311
- */
312
- function page_builder_step_save() {
313
-
314
- check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
315
-
316
- $stored = get_option( 'wcf_setup', array() );
317
- $page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( $_POST['page_builder'] ) : '';
318
- $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( $_POST['plugin_init'] ) : '';
319
-
320
- if ( $page_builder ) {
321
- $stored['page-builder'] = $page_builder;
322
- }
323
-
324
- update_option( 'wcf_setup', $stored );
325
-
326
- $activate = activate_plugin( $plugin_init, '', false, true );
327
-
328
- if ( is_wp_error( $activate ) ) {
329
- wp_send_json_error(
330
- array(
331
- 'success' => false,
332
- 'message' => $activate->get_error_message(),
333
- )
334
- );
335
- }
336
-
337
- wp_send_json_success( $stored );
338
- }
339
-
340
- /**
341
- * Get Location rules of schema for Custom meta box.
342
- *
343
- * @param array $enabled_on Enabled on rules.
344
- * @param array $exclude_from Exlcude on rules.
345
- * @return array
346
- */
347
- public static function get_display_rules_for_meta_box( $enabled_on, $exclude_from ) {
348
- $locations = array();
349
- $enabled_location = array();
350
- $exclude_location = array();
351
-
352
- $args = array(
353
- 'public' => true,
354
- '_builtin' => true,
355
- );
356
- $post_types = get_post_types( $args );
357
- unset( $post_types['attachment'] );
358
-
359
- $args['_builtin'] = false;
360
- $custom_post_type = get_post_types( $args );
361
- $post_types = array_merge( $post_types, $custom_post_type );
362
-
363
- if ( ! empty( $enabled_on ) && isset( $enabled_on['rule'] ) ) {
364
- $enabled_location = $enabled_on['rule'];
365
- }
366
- if ( ! empty( $exclude_from ) && isset( $exclude_from['rule'] ) ) {
367
- $exclude_location = $exclude_from['rule'];
368
- }
369
-
370
- if ( in_array( 'specifics', $enabled_location ) || ( in_array( 'basic-singulars', $enabled_location ) && ! in_array( 'basic-singulars', $exclude_location ) ) ) {
371
- foreach ( $post_types as $post_type ) {
372
- $locations[ $post_type ] = 1;
373
- }
374
- } else {
375
- foreach ( $post_types as $post_type ) {
376
- $key = $post_type . '|all';
377
- if ( in_array( $key, $enabled_location ) && ! in_array( $key, $exclude_location ) ) {
378
- $locations[ $post_type ] = 1;
379
- }
380
- }
381
- }
382
- return $locations;
383
- }
384
-
385
- /**
386
- * Final step.
387
- */
388
- public function ready_step() {
389
-
390
- // Set setup wizard status to complete.
391
- update_option( 'wcf_setup_complete', true );
392
- ?>
393
- <h1><?php _e( 'Congratulations!', 'cartflows' ); ?></h1>
394
-
395
- <div class="cartflows-setup-next-steps">
396
- <div class="cartflows-setup-next-steps-last">
397
-
398
- <p class="success">
399
- <?php
400
- _e( 'You\'ve successfully completed the setup before you begin setting now you can use it.', 'cartflows' )
401
- ?>
402
- </p>
403
-
404
-
405
- <ul class="wcf-wizard-next-steps">
406
- <li class="wcf-wizard-next-step-item">
407
- <div class="wcf-wizard-next-step-description">
408
- <p class="next-step-heading">Next step</p>
409
- <h3 class="next-step-description">Create First Flow</h3>
410
- <p class="next-step-extra-info">You're ready to add flows to your website.</p>
411
- </div>
412
- <div class="wcf-wizard-next-step-action">
413
- <p class="wc-setup-actions step">
414
- <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 _e( 'Create a flow', 'cartflows' ); ?></a>
415
- </p>
416
- </div>
417
- </li>
418
- </ul>
419
-
420
- </div>
421
- </div>
422
- <?php
423
- }
424
-
425
- /**
426
- * Localize variables in admin
427
- *
428
- * @param array $vars variables.
429
- */
430
- function localize_vars( $vars ) {
431
-
432
- $ajax_actions = array(
433
- 'wcf_page_builder_step_save',
434
- );
435
-
436
- foreach ( $ajax_actions as $action ) {
437
-
438
- $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
439
- }
440
-
441
- return $vars;
442
- }
443
- }
444
-
445
- new CartFlows_Wizard();
446
-
447
- endif;
1
+ <?php
2
+ /**
3
+ * Schema Pro - Schema Wizard
4
+ *
5
+ * @package Schema Pro
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
+ if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
24
+ add_action( 'admin_menu', array( $this, 'admin_menus' ) );
25
+ add_action( 'admin_init', array( $this, 'setup_wizard' ) );
26
+ add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
27
+ add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
28
+
29
+ add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Show action links on the plugin screen.
35
+ *
36
+ * @since 1.0.0
37
+ * @return void
38
+ */
39
+ function show_setup_wizard() {
40
+
41
+ $status = get_option( 'wcf_setup_complete', false );
42
+
43
+ if ( false === $status ) { ?>
44
+ <div class="notice notice-info">
45
+ <p><b><?php _e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
46
+ <p><?php _e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
47
+ <p><a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary">Start Wizard!</a></p>
48
+ </div>
49
+ <?php
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Add admin menus/screens.
55
+ */
56
+ public function admin_menus() {
57
+ add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
58
+ }
59
+
60
+ /**
61
+ * Show the setup wizard.
62
+ */
63
+ public function setup_wizard() {
64
+
65
+ if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) {
66
+ return;
67
+ }
68
+
69
+ $this->steps = array(
70
+ 'basic-config' => array(
71
+ 'name' => __( 'Welcome', 'cartflows' ),
72
+ 'view' => array( $this, 'welcome_step' ),
73
+ 'handler' => array( $this, 'welcome_step_save' ),
74
+ ),
75
+ 'page-builder' => array(
76
+ 'name' => __( 'Page Builder', 'cartflows' ),
77
+ 'view' => array( $this, 'page_builder_step' ),
78
+ // 'handler' => array( $this, 'page_builder_step_save' ),
79
+ ),
80
+ 'setup-ready' => array(
81
+ 'name' => __( 'Ready!', 'cartflows' ),
82
+ 'view' => array( $this, 'ready_step' ),
83
+ 'handler' => '',
84
+ ),
85
+ );
86
+
87
+ $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
88
+
89
+ wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
90
+ wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
91
+ wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER );
92
+
93
+ wp_enqueue_media();
94
+
95
+ if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
96
+ call_user_func( $this->steps[ $this->step ]['handler'] );
97
+ }
98
+
99
+ ob_start();
100
+ $this->setup_wizard_header();
101
+ $this->setup_wizard_steps();
102
+ $this->setup_wizard_content();
103
+ $this->setup_wizard_footer();
104
+ exit;
105
+ }
106
+
107
+ /**
108
+ * Get current step slug
109
+ */
110
+ public function get_current_step_slug() {
111
+ $keys = array_keys( $this->steps );
112
+ return $keys[ array_search( $this->step, array_keys( $this->steps ) ) ];
113
+ }
114
+
115
+ /**
116
+ * Get previous step link
117
+ */
118
+ public function get_prev_step_link() {
119
+ $keys = array_keys( $this->steps );
120
+ return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) - 1 ] );
121
+ }
122
+
123
+ /**
124
+ * Get next step link
125
+ */
126
+ public function get_next_step_link() {
127
+ $keys = array_keys( $this->steps );
128
+ return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
129
+ }
130
+
131
+ /**
132
+ * Get next step link
133
+ */
134
+ public function get_next_step_plain_link() {
135
+ $keys = array_keys( $this->steps );
136
+ $step = $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ];
137
+ return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
138
+ }
139
+
140
+ /**
141
+ * Setup Wizard Header.
142
+ */
143
+ public function setup_wizard_header() {
144
+ ?>
145
+ <!DOCTYPE html>
146
+ <html>
147
+ <head>
148
+ <meta name="viewport" content="width=device-width" />
149
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
150
+ <title><?php _e( 'CartFlows Setup', 'cartflows' ); ?></title>
151
+
152
+ <script type="text/javascript">
153
+ 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();}}};
154
+ var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
155
+ var pagenow = '';
156
+ </script>
157
+ <?php wp_print_scripts( array( 'cartflows-setup' ) ); ?>
158
+ <?php do_action( 'admin_print_styles' ); ?>
159
+ <?php do_action( 'admin_head' ); ?>
160
+ </head>
161
+ <body class="cartflows-setup wp-core-ui cartflows-step-<?php echo esc_attr( $this->get_current_step_slug() ); ?>">
162
+ <div id="cartflows-logo">
163
+ <h1>CartFlows</h1>
164
+ </div>
165
+ <?php
166
+ }
167
+
168
+ /**
169
+ * Setup Wizard Footer.
170
+ */
171
+ public function setup_wizard_footer() {
172
+
173
+ $admin_url = admin_url( 'admin.php?page=cartflows_settings' );
174
+ ?>
175
+ <div class="close-button-wrapper">
176
+ <a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php _e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
177
+ </div>
178
+ </body>
179
+ </html>
180
+ <?php
181
+ }
182
+
183
+ /**
184
+ * Output the steps.
185
+ */
186
+ public function setup_wizard_steps() {
187
+
188
+ $ouput_steps = $this->steps;
189
+ ?>
190
+ <ol class="cartflows-setup-steps">
191
+ <?php
192
+ foreach ( $ouput_steps as $step_key => $step ) :
193
+ $classes = '';
194
+ $activated = false;
195
+ if ( $step_key === $this->step ) {
196
+ $classes = 'active';
197
+ $activated = true;
198
+ } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
199
+ $classes = 'done';
200
+ $activated = true;
201
+ }
202
+ ?>
203
+ <li class="<?php echo esc_attr( $classes ); ?>">
204
+ <span><?php echo esc_html( $step['name'] ); ?></span>
205
+ </li>
206
+ <?php endforeach; ?>
207
+ </ol>
208
+ <?php
209
+ }
210
+
211
+ /**
212
+ * Output the content for the current step.
213
+ */
214
+ public function setup_wizard_content() {
215
+ echo '<div class="cartflows-setup-content">';
216
+ call_user_func( $this->steps[ $this->step ]['view'] );
217
+ echo '</div>';
218
+ }
219
+
220
+ /**
221
+ * Introduction step.
222
+ */
223
+ public function welcome_step() {
224
+ ?>
225
+ <h1><?php _e( 'Thank you for choosing CartFlows!', 'cartflows' ); ?></h1>
226
+ <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
227
+ <form method="post">
228
+ <div class="cartflows-setup-actions step">
229
+ <div class="button-prev-wrap">
230
+ </div>
231
+ <div class="button-next-wrap">
232
+ <input type="submit" class="uct-activate button-primary button button-large button-next" value="<?php _e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
233
+ </div>
234
+ <?php wp_nonce_field( 'cartflow-setup' ); ?>
235
+ </div>
236
+ </form>
237
+ <?php
238
+ }
239
+
240
+ /**
241
+ * Save Locale Settings.
242
+ */
243
+ public function welcome_step_save() {
244
+ check_admin_referer( 'cartflow-setup' );
245
+
246
+ // Update site title & tagline.
247
+ $redirect_url = $this->get_next_step_link();
248
+
249
+ wp_redirect( esc_url_raw( $redirect_url ) );
250
+ exit;
251
+ }
252
+
253
+ /**
254
+ * Locale settings
255
+ */
256
+ public function page_builder_step() {
257
+ ?>
258
+
259
+ <h1><?php _e( 'Page Builder', 'cartflows' ); ?></h1>
260
+ <p class="description"><?php _e( 'Select a page builder which you want to use for creating your new flows.', 'cartflows' ); ?></p>
261
+ <form method="post">
262
+ <table class="cartflows-table widefat">
263
+ <tr class="cartflows-row">
264
+ <td class="cartflows-row-heading">
265
+ <label><?php esc_html_e( 'Select Page Builder', 'cartflows' ); ?></label>
266
+ <i class="cartflows-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Add locations for where this Schema should appear.', 'cartflows' ); ?>"></i>
267
+ </td>
268
+ <td class="cartflows-row-content">
269
+ <?php
270
+ $installed_plugins = get_plugins();
271
+ $plugins = array(
272
+ array(
273
+ 'title' => __( 'Elementor', 'cartflows' ),
274
+ 'value' => 'elementor',
275
+ 'data' => array(
276
+ 'slug' => 'elementor',
277
+ 'init' => 'elementor/elementor.php',
278
+ 'active' => is_plugin_active( 'elementor/elementor.php' ) ? 'yes' : 'no',
279
+ 'install' => isset( $installed_plugins['elementor/elementor.php'] ) ? 'yes' : 'no',
280
+ ),
281
+ ),
282
+ );
283
+ ?>
284
+ <select name="page-builder" class="page-builder-list" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>">
285
+ <?php
286
+ foreach ( $plugins as $key => $plugin ) {
287
+ 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>';
288
+ }
289
+ ?>
290
+ </select>
291
+ </td>
292
+ </tr>
293
+ </table>
294
+ <p><?php _e( 'The above plugin will be installed and activated for you!', 'cartflows' ); ?></p>
295
+ <div class="cartflows-setup-actions step">
296
+ <div class="button-prev-wrap">
297
+ <a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php _e( '« Previous', 'cartflows' ); ?></a>
298
+ </div>
299
+ <div class="button-next-wrap">
300
+ <a href="#" class="button button-primary wcf-install-plugins"><?php _e( 'Next »', 'cartflows' ); ?></a>
301
+ <!-- <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Next »', 'cartflows' ); ?>" name="save_step" /> -->
302
+ </div>
303
+ <?php wp_nonce_field( 'cartflow-setup' ); ?>
304
+ </div>
305
+ </form>
306
+ <?php
307
+ }
308
+
309
+ /**
310
+ * Save Locale Settings.
311
+ */
312
+ function page_builder_step_save() {
313
+
314
+ check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
315
+
316
+ $stored = get_option( 'wcf_setup', array() );
317
+ $page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( $_POST['page_builder'] ) : '';
318
+ $plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( $_POST['plugin_init'] ) : '';
319
+
320
+ if ( $page_builder ) {
321
+ $stored['page-builder'] = $page_builder;
322
+ }
323
+
324
+ update_option( 'wcf_setup', $stored );
325
+
326
+ $activate = activate_plugin( $plugin_init, '', false, true );
327
+
328
+ if ( is_wp_error( $activate ) ) {
329
+ wp_send_json_error(
330
+ array(
331
+ 'success' => false,
332
+ 'message' => $activate->get_error_message(),
333
+ )
334
+ );
335
+ }
336
+
337
+ wp_send_json_success( $stored );
338
+ }
339
+
340
+ /**
341
+ * Get Location rules of schema for Custom meta box.
342
+ *
343
+ * @param array $enabled_on Enabled on rules.
344
+ * @param array $exclude_from Exlcude on rules.
345
+ * @return array
346
+ */
347
+ public static function get_display_rules_for_meta_box( $enabled_on, $exclude_from ) {
348
+ $locations = array();
349
+ $enabled_location = array();
350
+ $exclude_location = array();
351
+
352
+ $args = array(
353
+ 'public' => true,
354
+ '_builtin' => true,
355
+ );
356
+ $post_types = get_post_types( $args );
357
+ unset( $post_types['attachment'] );
358
+
359
+ $args['_builtin'] = false;
360
+ $custom_post_type = get_post_types( $args );
361
+ $post_types = array_merge( $post_types, $custom_post_type );
362
+
363
+ if ( ! empty( $enabled_on ) && isset( $enabled_on['rule'] ) ) {
364
+ $enabled_location = $enabled_on['rule'];
365
+ }
366
+ if ( ! empty( $exclude_from ) && isset( $exclude_from['rule'] ) ) {
367
+ $exclude_location = $exclude_from['rule'];
368
+ }
369
+
370
+ if ( in_array( 'specifics', $enabled_location ) || ( in_array( 'basic-singulars', $enabled_location ) && ! in_array( 'basic-singulars', $exclude_location ) ) ) {
371
+ foreach ( $post_types as $post_type ) {
372
+ $locations[ $post_type ] = 1;
373
+ }
374
+ } else {
375
+ foreach ( $post_types as $post_type ) {
376
+ $key = $post_type . '|all';
377
+ if ( in_array( $key, $enabled_location ) && ! in_array( $key, $exclude_location ) ) {
378
+ $locations[ $post_type ] = 1;
379
+ }
380
+ }
381
+ }
382
+ return $locations;
383
+ }
384
+
385
+ /**
386
+ * Final step.
387
+ */
388
+ public function ready_step() {
389
+
390
+ // Set setup wizard status to complete.
391
+ update_option( 'wcf_setup_complete', true );
392
+ ?>
393
+ <h1><?php _e( 'Congratulations!', 'cartflows' ); ?></h1>
394
+
395
+ <div class="cartflows-setup-next-steps">
396
+ <div class="cartflows-setup-next-steps-last">
397
+
398
+ <p class="success">
399
+ <?php
400
+ _e( 'You\'ve successfully completed the setup before you begin setting now you can use it.', 'cartflows' )
401
+ ?>
402
+ </p>
403
+
404
+
405
+ <ul class="wcf-wizard-next-steps">
406
+ <li class="wcf-wizard-next-step-item">
407
+ <div class="wcf-wizard-next-step-description">
408
+ <p class="next-step-heading">Next step</p>
409
+ <h3 class="next-step-description">Create First Flow</h3>
410
+ <p class="next-step-extra-info">You're ready to add flows to your website.</p>
411
+ </div>
412
+ <div class="wcf-wizard-next-step-action">
413
+ <p class="wc-setup-actions step">
414
+ <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 _e( 'Create a flow', 'cartflows' ); ?></a>
415
+ </p>
416
+ </div>
417
+ </li>
418
+ </ul>
419
+
420
+ </div>
421
+ </div>
422
+ <?php
423
+ }
424
+
425
+ /**
426
+ * Localize variables in admin
427
+ *
428
+ * @param array $vars variables.
429
+ */
430
+ function localize_vars( $vars ) {
431
+
432
+ $ajax_actions = array(
433
+ 'wcf_page_builder_step_save',
434
+ );
435
+
436
+ foreach ( $ajax_actions as $action ) {
437
+
438
+ $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
439
+ }
440
+
441
+ return $vars;
442
+ }
443
+ }
444
+
445
+ new CartFlows_Wizard();
446
+
447
+ endif;
includes/admin/cartflows-general.php CHANGED
@@ -7,9 +7,12 @@
7
 
8
  $settings = Cartflows_Helper::get_common_settings();
9
 
 
 
 
10
  ?>
11
 
12
- <form method="post" class="wrap wcf-clear" action="" >
13
  <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
14
  <input type="hidden" name="action" value="wcf_save_common_settings">
15
  <h1 class="screen-reader-text"><?php _e( 'General Settings', 'cartflows' ); ?></h1>
@@ -38,50 +41,53 @@ $settings = Cartflows_Helper::get_common_settings();
38
  <span><?php _e( 'General Settings', 'cartflows' ); ?></span>
39
  </h2>
40
  <div class="inside">
41
- <div class="form-wrap">
42
- <?php
43
-
44
- do_action( 'cartflows_before_settings_fields', $settings );
45
-
46
- echo Cartflows_Admin_Fields::checkobox_field(
47
- array(
48
- 'id' => 'wcf_disallow_indexing',
49
- 'name' => '_cartflows_common[disallow_indexing]',
50
- 'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
51
- 'value' => $settings['disallow_indexing'],
52
- )
53
- );
54
- echo Cartflows_Admin_Fields::flow_checkout_selection_field(
55
- array(
56
- 'id' => 'wcf_global_checkout',
57
- 'name' => '_cartflows_common[global_checkout]',
58
- 'title' => __( 'Global Checkout', 'cartflows' ),
59
- 'value' => $settings['global_checkout'],
60
- )
61
- );
62
-
63
- echo Cartflows_Admin_Fields::select_field(
64
- array(
65
- 'id' => 'wcf_default_page_builder',
66
- 'name' => '_cartflows_common[default_page_builder]',
67
- 'title' => __( 'Show Templates designed with', 'cartflows' ),
68
- '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' ),
69
- 'value' => $settings['default_page_builder'],
70
- 'options' => array(
71
- 'elementor' => __( 'Elementor', 'cartflows' ),
72
- 'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
73
- 'divi' => __( 'Divi', 'cartflows' ),
74
- 'other' => __( 'Other', 'cartflows' ),
75
- ),
76
- )
77
- );
78
-
79
- do_action( 'cartflows_after_settings_fields', $settings );
80
-
81
- ?>
82
- </div>
83
- <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
84
- <?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
 
 
 
85
  </div>
86
  </div>
87
  </div>
@@ -132,7 +138,37 @@ $settings = Cartflows_Helper::get_common_settings();
132
  </p>
133
  </div>
134
  </div>
135
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  </div>
137
  </div>
138
  </div>
@@ -140,8 +176,6 @@ $settings = Cartflows_Helper::get_common_settings();
140
  <br class="clear">
141
  </div>
142
  </div>
143
- </form>
144
-
145
 
146
  <?php
147
  /**
7
 
8
  $settings = Cartflows_Helper::get_common_settings();
9
 
10
+ $debug_data = Cartflows_Helper::get_debug_settings();
11
+
12
+ $debug_on = ( isset( $_GET['debug'] ) ) ? sanitize_text_field( $_GET['debug'] ) : 'false';
13
  ?>
14
 
15
+
16
  <div class="wrap wcf-addon-wrap wcf-clear wcf-container">
17
  <input type="hidden" name="action" value="wcf_save_common_settings">
18
  <h1 class="screen-reader-text"><?php _e( 'General Settings', 'cartflows' ); ?></h1>
41
  <span><?php _e( 'General Settings', 'cartflows' ); ?></span>
42
  </h2>
43
  <div class="inside">
44
+ <form method="post" class="wrap wcf-clear" action="" >
45
+ <div class="form-wrap">
46
+ <?php
47
+
48
+ do_action( 'cartflows_before_settings_fields', $settings );
49
+
50
+ echo Cartflows_Admin_Fields::checkobox_field(
51
+ array(
52
+ 'id' => 'wcf_disallow_indexing',
53
+ 'name' => '_cartflows_common[disallow_indexing]',
54
+ 'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
55
+ 'value' => $settings['disallow_indexing'],
56
+ )
57
+ );
58
+
59
+ echo Cartflows_Admin_Fields::flow_checkout_selection_field(
60
+ array(
61
+ 'id' => 'wcf_global_checkout',
62
+ 'name' => '_cartflows_common[global_checkout]',
63
+ 'title' => __( 'Global Checkout', 'cartflows' ),
64
+ 'value' => $settings['global_checkout'],
65
+ )
66
+ );
67
+
68
+ echo Cartflows_Admin_Fields::select_field(
69
+ array(
70
+ 'id' => 'wcf_default_page_builder',
71
+ 'name' => '_cartflows_common[default_page_builder]',
72
+ 'title' => __( 'Show Templates designed with', 'cartflows' ),
73
+ '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' ),
74
+ 'value' => $settings['default_page_builder'],
75
+ 'options' => array(
76
+ 'elementor' => __( 'Elementor', 'cartflows' ),
77
+ 'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
78
+ 'divi' => __( 'Divi', 'cartflows' ),
79
+ 'other' => __( 'Other', 'cartflows' ),
80
+ ),
81
+ )
82
+ );
83
+
84
+ do_action( 'cartflows_after_settings_fields', $settings );
85
+
86
+ ?>
87
+ </div>
88
+ <?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
89
+ <?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
90
+ </form>
91
  </div>
92
  </div>
93
  </div>
138
  </p>
139
  </div>
140
  </div>
141
+ <?php
142
+ if ( 'true' == $debug_on ) {
143
+ ?>
144
+ <div class="postbox">
145
+ <h2 class="hndle">
146
+ <span class="dashicons dashicons-editor-code"></span>
147
+ <span><?php esc_html_e( 'Load Minified CSS', 'cartflows' ); ?></span>
148
+ </h2>
149
+ <div class="inside">
150
+ <form method="post" class="wrap wcf-clear" action="">
151
+ <p>
152
+ <?php esc_html_e( 'Load the Minified CSS from here. Just Enable it by checking the below given checkbox.', 'cartflows' ); ?>
153
+ </p>
154
+ <?php
155
+ echo Cartflows_Admin_Fields::checkobox_field(
156
+ array(
157
+ 'id' => 'allow_minified_files',
158
+ 'name' => '_cartflows_debug_data[allow_minified_files]',
159
+ 'title' => __( 'Load minified CSS & JS Files', 'cartflows' ),
160
+ 'value' => $debug_data['allow_minified_files'],
161
+ )
162
+ );
163
+ ?>
164
+ <?php submit_button( __( 'Save', 'cartflows' ), 'button-primary button', 'submit', false ); ?>
165
+ <?php wp_nonce_field( 'cartflows-debug-settings', 'cartflows-debug-settings-nonce' ); ?>
166
+ </form>
167
+ </div>
168
+ </div>
169
+ <?php
170
+ }
171
+ ?>
172
  </div>
173
  </div>
174
  </div>
176
  <br class="clear">
177
  </div>
178
  </div>
 
 
179
 
180
  <?php
181
  /**
includes/exporter.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- /**
3
- * Exporter
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
- <div class="cartflows-ie">
10
- <div class="postbox">
11
- <div class="inside">
12
- <h3><?php _e( 'Export Flows to a JSON file', 'cartflows' ); ?></h3>
13
- <p><?php _e( 'This tool allows you to generate and download a JSON file containing a list of all flows.', 'cartflows' ); ?></p>
14
- <form method="post">
15
- <p><input type="hidden" name="cartflows-action" value="export" /></p>
16
- <p style="margin-bottom:0">
17
- <?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
18
- <?php submit_button( __( 'Export', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
19
- </p>
20
- </form>
21
- </div>
22
- </div>
23
- </div>
1
+ <?php
2
+ /**
3
+ * Exporter
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+ <div class="cartflows-ie">
10
+ <div class="postbox">
11
+ <div class="inside">
12
+ <h3><?php _e( 'Export Flows to a JSON file', 'cartflows' ); ?></h3>
13
+ <p><?php _e( 'This tool allows you to generate and download a JSON file containing a list of all flows.', 'cartflows' ); ?></p>
14
+ <form method="post">
15
+ <p><input type="hidden" name="cartflows-action" value="export" /></p>
16
+ <p style="margin-bottom:0">
17
+ <?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
18
+ <?php submit_button( __( 'Export', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
19
+ </p>
20
+ </form>
21
+ </div>
22
+ </div>
23
+ </div>
includes/importer.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
- /**
3
- * Importer
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
- <div class="cartflows-ie">
10
- <div class="postbox">
11
- <div class="inside">
12
- <h3><?php _e( 'Import Flows to a JSON file', 'cartflows' ); ?></h3>
13
- <p><?php _e( 'This tool allows you to import the flows from the JSON file.', 'cartflows' ); ?></p>
14
- <form method="post" enctype="multipart/form-data">
15
- <p>
16
- <input type="file" name="file"/>
17
- <input type="hidden" name="cartflows-action" value="import" />
18
- </p>
19
- <p style="margin-bottom:0">
20
- <?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
21
- <?php submit_button( __( 'Import', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
22
- </p>
23
- </form>
24
- </div>
25
- </div>
26
- </div>
1
+ <?php
2
+ /**
3
+ * Importer
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+ <div class="cartflows-ie">
10
+ <div class="postbox">
11
+ <div class="inside">
12
+ <h3><?php _e( 'Import Flows to a JSON file', 'cartflows' ); ?></h3>
13
+ <p><?php _e( 'This tool allows you to import the flows from the JSON file.', 'cartflows' ); ?></p>
14
+ <form method="post" enctype="multipart/form-data">
15
+ <p>
16
+ <input type="file" name="file"/>
17
+ <input type="hidden" name="cartflows-action" value="import" />
18
+ </p>
19
+ <p style="margin-bottom:0">
20
+ <?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
21
+ <?php submit_button( __( 'Import', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
22
+ </p>
23
+ </form>
24
+ </div>
25
+ </div>
26
+ </div>
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.1.13\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
- "POT-Creation-Date: 2019-04-09 10:46:26+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -22,7 +22,7 @@ msgstr ""
22
  "X-Poedit-SearchPath-0: .\n"
23
  "X-Poedit-Bookmarks: \n"
24
  "X-Textdomain-Support: yes\n"
25
- "X-Generator: grunt-wp-i18n1.0.2\n"
26
 
27
  #: classes/batch-process/class-cartflows-importer-elementor.php:44
28
  msgid "Invalid content."
@@ -56,35 +56,35 @@ msgstr ""
56
  msgid "Settings"
57
  msgstr ""
58
 
59
- #: classes/class-cartflows-admin.php:315
60
  msgid "Flows Library"
61
  msgstr ""
62
 
63
- #: classes/class-cartflows-admin.php:322
64
  #: modules/flow/view/meta-flow-steps.php:145
65
  msgid "Ready Templates"
66
  msgstr ""
67
 
68
- #: classes/class-cartflows-admin.php:325
69
  #: modules/flow/view/meta-flow-steps.php:148
70
  msgid "Create Your Own"
71
  msgstr ""
72
 
73
- #: classes/class-cartflows-admin.php:336
74
  #: modules/flow/view/meta-flow-steps.php:160
75
  msgid "Search Sites"
76
  msgstr ""
77
 
78
- #: classes/class-cartflows-admin.php:337
79
  #: modules/flow/view/meta-flow-steps.php:161
80
  msgid "Search Flow..."
81
  msgstr ""
82
 
83
- #: classes/class-cartflows-admin.php:354
84
  msgid "Design Your Flow"
85
  msgstr ""
86
 
87
- #: classes/class-cartflows-admin.php:355
88
  #: modules/flow/view/meta-flow-steps.php:192
89
  msgid "Learn How"
90
  msgstr ""
@@ -268,18 +268,18 @@ msgstr ""
268
  msgid "Plugin Successfully Activated"
269
  msgstr ""
270
 
271
- #: classes/class-cartflows-loader.php:332
272
  #. translators: %s: html tags
273
  msgid ""
274
  "The %1$sCartFlows%2$s plugin requires %1$sWooCommerce%2$s plugin installed "
275
  "& activated."
276
  msgstr ""
277
 
278
- #: classes/class-cartflows-loader.php:342
279
  msgid "Activate WooCommerce"
280
  msgstr ""
281
 
282
- #: classes/class-cartflows-loader.php:350
283
  msgid "Install WooCommerce"
284
  msgstr ""
285
 
@@ -462,7 +462,7 @@ msgid "Add locations for where this Schema should appear."
462
  msgstr ""
463
 
464
  #: classes/class-cartflows-wizard.php:273
465
- #: includes/admin/cartflows-general.php:71
466
  msgid "Elementor"
467
  msgstr ""
468
 
@@ -494,7 +494,7 @@ msgid "Create a flow"
494
  msgstr ""
495
 
496
  #: includes/admin/cartflows-admin.php:19
497
- #: includes/admin/cartflows-general.php:30
498
  msgid "Modernizing WordPress eCommerce!"
499
  msgstr ""
500
 
@@ -510,29 +510,29 @@ msgstr ""
510
  msgid "General"
511
  msgstr ""
512
 
513
- #: includes/admin/cartflows-general.php:15
514
- #: includes/admin/cartflows-general.php:38
515
  msgid "General Settings"
516
  msgstr ""
517
 
518
- #: includes/admin/cartflows-general.php:22
519
  msgid "Getting Started"
520
  msgstr ""
521
 
522
- #: includes/admin/cartflows-general.php:50
523
  msgid "Disallow search engines from indexing flows"
524
  msgstr ""
525
 
526
- #: includes/admin/cartflows-general.php:58
527
  #: modules/flow/view/meta-flow-steps.php:87
528
  msgid "Global Checkout"
529
  msgstr ""
530
 
531
- #: includes/admin/cartflows-general.php:67
532
  msgid "Show Templates designed with"
533
  msgstr ""
534
 
535
- #: includes/admin/cartflows-general.php:68
536
  msgid ""
537
  "CartFlows offers flow templates that can be imported in one click. These "
538
  "templates are available in few different page builders. Please choose your "
@@ -540,60 +540,78 @@ msgid ""
540
  "are made using that page builder.."
541
  msgstr ""
542
 
543
- #: includes/admin/cartflows-general.php:72
544
  msgid "Beaver Builder"
545
  msgstr ""
546
 
547
- #: includes/admin/cartflows-general.php:73
548
  msgid "Divi"
549
  msgstr ""
550
 
551
- #: includes/admin/cartflows-general.php:74
552
  msgid "Other"
553
  msgstr ""
554
 
555
- #: includes/admin/cartflows-general.php:83
556
  msgid "Save Changes"
557
  msgstr ""
558
 
559
- #: includes/admin/cartflows-general.php:94
560
  msgid "Knowledge Base"
561
  msgstr ""
562
 
563
- #: includes/admin/cartflows-general.php:98
564
  msgid "Not sure how something works? Take a peek at the knowledge base and learn."
565
  msgstr ""
566
 
567
- #: includes/admin/cartflows-general.php:101
568
  msgid "Visit Knowledge Base »"
569
  msgstr ""
570
 
571
- #: includes/admin/cartflows-general.php:109
572
  msgid "Community"
573
  msgstr ""
574
 
575
- #: includes/admin/cartflows-general.php:113
576
  msgid ""
577
  "Join the community of super helpful CartFlows users. Say hello, ask "
578
  "questions, give feedback and help each other!"
579
  msgstr ""
580
 
581
- #: includes/admin/cartflows-general.php:116
582
  msgid "Join Our Facebook Group »"
583
  msgstr ""
584
 
585
- #: includes/admin/cartflows-general.php:124
586
  msgid "Five Star Support"
587
  msgstr ""
588
 
589
- #: includes/admin/cartflows-general.php:128
590
  msgid "Got a question? Get in touch with CartFlows developers. We're happy to help!"
591
  msgstr ""
592
 
593
- #: includes/admin/cartflows-general.php:131
594
  msgid "Submit a Ticket »"
595
  msgstr ""
596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  #: includes/exporter.php:12
598
  msgid "Export Flows to a JSON file"
599
  msgstr ""
@@ -616,32 +634,32 @@ msgstr ""
616
  msgid "Import"
617
  msgstr ""
618
 
619
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:158
620
  #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:62
621
  msgid ""
622
  "WooCommerce functions not exists. If you are in iframe, please reload the "
623
  "iframe"
624
  msgstr ""
625
 
626
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:174
627
  msgid "Checkout ID not found"
628
  msgstr ""
629
 
630
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:340
631
  msgid "Variations Not set"
632
  msgstr ""
633
 
634
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:349
635
  msgid "This product can't be purcahsed"
636
  msgstr ""
637
 
638
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:948
639
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:967
640
  msgid "Coupon Code"
641
  msgstr ""
642
 
643
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:953
644
- #: modules/checkout/classes/class-cartflows-checkout-markup.php:976
645
  msgid "Apply"
646
  msgstr ""
647
 
@@ -1363,6 +1381,26 @@ msgstr ""
1363
  msgid "Payment method:"
1364
  msgstr ""
1365
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1366
  #. Plugin Name of the plugin/theme
1367
  msgid "CartFlows"
1368
  msgstr ""
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: CartFlows 1.1.14\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
+ "POT-Creation-Date: 2019-04-24 05:42:01+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
  "X-Poedit-Bookmarks: \n"
24
  "X-Textdomain-Support: yes\n"
25
+ "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
  #: classes/batch-process/class-cartflows-importer-elementor.php:44
28
  msgid "Invalid content."
56
  msgid "Settings"
57
  msgstr ""
58
 
59
+ #: classes/class-cartflows-admin.php:359
60
  msgid "Flows Library"
61
  msgstr ""
62
 
63
+ #: classes/class-cartflows-admin.php:366
64
  #: modules/flow/view/meta-flow-steps.php:145
65
  msgid "Ready Templates"
66
  msgstr ""
67
 
68
+ #: classes/class-cartflows-admin.php:369
69
  #: modules/flow/view/meta-flow-steps.php:148
70
  msgid "Create Your Own"
71
  msgstr ""
72
 
73
+ #: classes/class-cartflows-admin.php:380
74
  #: modules/flow/view/meta-flow-steps.php:160
75
  msgid "Search Sites"
76
  msgstr ""
77
 
78
+ #: classes/class-cartflows-admin.php:381
79
  #: modules/flow/view/meta-flow-steps.php:161
80
  msgid "Search Flow..."
81
  msgstr ""
82
 
83
+ #: classes/class-cartflows-admin.php:398
84
  msgid "Design Your Flow"
85
  msgstr ""
86
 
87
+ #: classes/class-cartflows-admin.php:399
88
  #: modules/flow/view/meta-flow-steps.php:192
89
  msgid "Learn How"
90
  msgstr ""
268
  msgid "Plugin Successfully Activated"
269
  msgstr ""
270
 
271
+ #: classes/class-cartflows-loader.php:349
272
  #. translators: %s: html tags
273
  msgid ""
274
  "The %1$sCartFlows%2$s plugin requires %1$sWooCommerce%2$s plugin installed "
275
  "& activated."
276
  msgstr ""
277
 
278
+ #: classes/class-cartflows-loader.php:359
279
  msgid "Activate WooCommerce"
280
  msgstr ""
281
 
282
+ #: classes/class-cartflows-loader.php:367
283
  msgid "Install WooCommerce"
284
  msgstr ""
285
 
462
  msgstr ""
463
 
464
  #: classes/class-cartflows-wizard.php:273
465
+ #: includes/admin/cartflows-general.php:76
466
  msgid "Elementor"
467
  msgstr ""
468
 
494
  msgstr ""
495
 
496
  #: includes/admin/cartflows-admin.php:19
497
+ #: includes/admin/cartflows-general.php:33
498
  msgid "Modernizing WordPress eCommerce!"
499
  msgstr ""
500
 
510
  msgid "General"
511
  msgstr ""
512
 
513
+ #: includes/admin/cartflows-general.php:18
514
+ #: includes/admin/cartflows-general.php:41
515
  msgid "General Settings"
516
  msgstr ""
517
 
518
+ #: includes/admin/cartflows-general.php:25
519
  msgid "Getting Started"
520
  msgstr ""
521
 
522
+ #: includes/admin/cartflows-general.php:54
523
  msgid "Disallow search engines from indexing flows"
524
  msgstr ""
525
 
526
+ #: includes/admin/cartflows-general.php:63
527
  #: modules/flow/view/meta-flow-steps.php:87
528
  msgid "Global Checkout"
529
  msgstr ""
530
 
531
+ #: includes/admin/cartflows-general.php:72
532
  msgid "Show Templates designed with"
533
  msgstr ""
534
 
535
+ #: includes/admin/cartflows-general.php:73
536
  msgid ""
537
  "CartFlows offers flow templates that can be imported in one click. These "
538
  "templates are available in few different page builders. Please choose your "
540
  "are made using that page builder.."
541
  msgstr ""
542
 
543
+ #: includes/admin/cartflows-general.php:77
544
  msgid "Beaver Builder"
545
  msgstr ""
546
 
547
+ #: includes/admin/cartflows-general.php:78
548
  msgid "Divi"
549
  msgstr ""
550
 
551
+ #: includes/admin/cartflows-general.php:79
552
  msgid "Other"
553
  msgstr ""
554
 
555
+ #: includes/admin/cartflows-general.php:88
556
  msgid "Save Changes"
557
  msgstr ""
558
 
559
+ #: includes/admin/cartflows-general.php:100
560
  msgid "Knowledge Base"
561
  msgstr ""
562
 
563
+ #: includes/admin/cartflows-general.php:104
564
  msgid "Not sure how something works? Take a peek at the knowledge base and learn."
565
  msgstr ""
566
 
567
+ #: includes/admin/cartflows-general.php:107
568
  msgid "Visit Knowledge Base »"
569
  msgstr ""
570
 
571
+ #: includes/admin/cartflows-general.php:115
572
  msgid "Community"
573
  msgstr ""
574
 
575
+ #: includes/admin/cartflows-general.php:119
576
  msgid ""
577
  "Join the community of super helpful CartFlows users. Say hello, ask "
578
  "questions, give feedback and help each other!"
579
  msgstr ""
580
 
581
+ #: includes/admin/cartflows-general.php:122
582
  msgid "Join Our Facebook Group »"
583
  msgstr ""
584
 
585
+ #: includes/admin/cartflows-general.php:130
586
  msgid "Five Star Support"
587
  msgstr ""
588
 
589
+ #: includes/admin/cartflows-general.php:134
590
  msgid "Got a question? Get in touch with CartFlows developers. We're happy to help!"
591
  msgstr ""
592
 
593
+ #: includes/admin/cartflows-general.php:137
594
  msgid "Submit a Ticket »"
595
  msgstr ""
596
 
597
+ #: includes/admin/cartflows-general.php:147
598
+ msgid "Load Minified CSS"
599
+ msgstr ""
600
+
601
+ #: includes/admin/cartflows-general.php:152
602
+ msgid ""
603
+ "Load the Minified CSS from here. Just Enable it by checking the below given "
604
+ "checkbox."
605
+ msgstr ""
606
+
607
+ #: includes/admin/cartflows-general.php:159
608
+ msgid "Load minified CSS & JS Files"
609
+ msgstr ""
610
+
611
+ #: includes/admin/cartflows-general.php:164
612
+ msgid "Save"
613
+ msgstr ""
614
+
615
  #: includes/exporter.php:12
616
  msgid "Export Flows to a JSON file"
617
  msgstr ""
634
  msgid "Import"
635
  msgstr ""
636
 
637
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:161
638
  #: modules/thankyou/classes/class-cartflows-thankyou-markup.php:62
639
  msgid ""
640
  "WooCommerce functions not exists. If you are in iframe, please reload the "
641
  "iframe"
642
  msgstr ""
643
 
644
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:177
645
  msgid "Checkout ID not found"
646
  msgstr ""
647
 
648
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:343
649
  msgid "Variations Not set"
650
  msgstr ""
651
 
652
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:352
653
  msgid "This product can't be purcahsed"
654
  msgstr ""
655
 
656
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:948
657
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:979
658
  msgid "Coupon Code"
659
  msgstr ""
660
 
661
  #: modules/checkout/classes/class-cartflows-checkout-markup.php:953
662
+ #: modules/checkout/classes/class-cartflows-checkout-markup.php:988
663
  msgid "Apply"
664
  msgstr ""
665
 
1381
  msgid "Payment method:"
1382
  msgstr ""
1383
 
1384
+ #: woocommerce/template/global/form-login.php:34
1385
+ msgid "Username or email"
1386
+ msgstr ""
1387
+
1388
+ #: woocommerce/template/global/form-login.php:38
1389
+ msgid "Password"
1390
+ msgstr ""
1391
+
1392
+ #: woocommerce/template/global/form-login.php:48
1393
+ msgid "Login"
1394
+ msgstr ""
1395
+
1396
+ #: woocommerce/template/global/form-login.php:53
1397
+ msgid "Remember me"
1398
+ msgstr ""
1399
+
1400
+ #: woocommerce/template/global/form-login.php:57
1401
+ msgid "Lost your password?"
1402
+ msgstr ""
1403
+
1404
  #. Plugin Name of the plugin/theme
1405
  msgid "CartFlows"
1406
  msgstr ""
modules/checkout/classes/class-cartflows-checkout-markup.php CHANGED
@@ -60,14 +60,17 @@ class Cartflows_Checkout_Markup {
60
 
61
  add_filter( 'woocommerce_login_redirect', array( $this, 'after_login_redirect' ), 10, 2 );
62
 
63
- add_action( 'wp_ajax_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
64
- add_action( 'wp_ajax_nopriv_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
65
 
66
  add_filter( 'global_cartflows_js_localize', array( $this, 'add_localize_vars' ) );
67
 
68
  /* Global Checkout */
69
  add_action( 'template_redirect', array( $this, 'global_checkout_template_redirect' ), 1 );
70
 
 
 
 
71
  }
72
 
73
  /**
@@ -395,6 +398,7 @@ class Cartflows_Checkout_Markup {
395
 
396
  add_filter( 'woocommerce_checkout_fields', array( $this, 'add_three_column_layout_fields' ) );
397
 
 
398
  global $post;
399
 
400
  if ( _is_wcf_checkout_type() ) {
@@ -436,12 +440,11 @@ class Cartflows_Checkout_Markup {
436
  */
437
  function shortcode_scripts() {
438
 
439
- wp_enqueue_style( 'wcf-checkout-template', CARTFLOWS_URL . 'assets/css/checkout-template.css', '', CARTFLOWS_VER );
440
- wp_style_add_data( 'wcf-checkout-template', 'rtl', 'replace' );
441
 
442
  wp_enqueue_script(
443
  'wcf-checkout-template',
444
- CARTFLOWS_URL . 'assets/js/checkout-template.js',
445
  array( 'jquery' ),
446
  CARTFLOWS_VER,
447
  true
@@ -474,20 +477,17 @@ class Cartflows_Checkout_Markup {
474
  if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
475
  Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id )
476
  ) {
477
- wp_enqueue_style( 'wcf-checkout-template-divi', CARTFLOWS_URL . 'assets/css/checkout-template-divi.css', '', CARTFLOWS_VER );
478
- wp_style_add_data( 'wcf-checkout-template-divi', 'rtl', 'replace' );
479
  }
480
 
481
  // Add Flatsome Compatibility css if Flatsome theme is enabled.
482
  if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
483
- wp_enqueue_style( 'wcf-checkout-template-flatsome', CARTFLOWS_URL . 'assets/css/checkout-template-flatsome.css', '', CARTFLOWS_VER );
484
- wp_style_add_data( 'wcf-checkout-template-flatsome', 'rtl', 'replace' );
485
  }
486
 
487
  // Add The7 Compatibility css if The7 theme is enabled.
488
  if ( Cartflows_Compatibility::get_instance()->is_the_seven_enabled() ) {
489
- wp_enqueue_style( 'wcf-checkout-template-the-seven', CARTFLOWS_URL . 'assets/css/checkout-template-the-seven.css', '', CARTFLOWS_VER );
490
- wp_style_add_data( 'wcf-checkout-template-the-seven', 'rtl', 'replace' );
491
  }
492
  }
493
 
@@ -933,9 +933,9 @@ class Cartflows_Checkout_Markup {
933
  function display_custom_coupon_field() {
934
 
935
  $coupon_enabled = apply_filters( 'woocommerce_coupons_enabled', true );
936
- $cf_show_coupon = apply_filters( 'cartflows_show_coupon_field', true );
937
 
938
- if ( ! ( $coupon_enabled && $cf_show_coupon ) ) {
939
  return;
940
 
941
  }
@@ -945,12 +945,12 @@ class Cartflows_Checkout_Markup {
945
  <div class="wcf-custom-coupon-field">
946
  <div class="wcf-coupon-col-1">
947
  <span>
948
- <input type="text" name="coupon_code" class="input-text cf-coupon-code-input" placeholder="<?php _e( 'Coupon Code', 'cartflows' ); ?>" id="coupon_code" value="">
949
  </span>
950
  </div>
951
  <div class="wcf-coupon-col-2">
952
  <span>
953
- <button type="button" class="button cf-submit-coupon wcf-btn-small" name="apply_coupon" value="Apply"><?php _e( 'Apply', 'cartflows' ); ?></button>
954
  </span>
955
  </div>
956
  </div>
@@ -958,6 +958,18 @@ class Cartflows_Checkout_Markup {
958
  echo ob_get_clean();
959
  }
960
 
 
 
 
 
 
 
 
 
 
 
 
 
961
  /**
962
  * Apply filter to change the placeholder text of coupon field.
963
  *
@@ -981,14 +993,26 @@ class Cartflows_Checkout_Markup {
981
  */
982
  function apply_coupon() {
983
 
984
- check_ajax_referer( 'cf-apply-coupon', 'security' );
 
 
 
 
 
 
 
 
 
 
 
 
985
 
986
- $result = WC()->cart->add_discount( sanitize_text_field( wp_unslash( $_POST['coupon_code'] ) ) );
987
 
988
- echo json_encode( $result );
989
  die();
990
  }
991
 
 
992
  /**
993
  * Added ajax nonce to localize variable.
994
  *
@@ -996,7 +1020,9 @@ class Cartflows_Checkout_Markup {
996
  */
997
  function add_localize_vars( $vars ) {
998
 
999
- $vars['cf_validate_coupon_nonce'] = wp_create_nonce( 'cf-apply-coupon' );
 
 
1000
 
1001
  $vars['allow_persistance'] = apply_filters( 'cartflows_allow_persistace', 'yes' );
1002
 
@@ -1104,6 +1130,25 @@ class Cartflows_Checkout_Markup {
1104
 
1105
  echo '</div> ';
1106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1107
  }
1108
 
1109
  /**
60
 
61
  add_filter( 'woocommerce_login_redirect', array( $this, 'after_login_redirect' ), 10, 2 );
62
 
63
+ add_action( 'wp_ajax_wcf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
64
+ add_action( 'wp_ajax_nopriv_wcf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
65
 
66
  add_filter( 'global_cartflows_js_localize', array( $this, 'add_localize_vars' ) );
67
 
68
  /* Global Checkout */
69
  add_action( 'template_redirect', array( $this, 'global_checkout_template_redirect' ), 1 );
70
 
71
+ add_action( 'wp_ajax_wcf_woo_remove_coupon', array( $this, 'remove_coupon' ) );
72
+ add_action( 'wp_ajax_nopriv_wcf_woo_remove_coupon', array( $this, 'remove_coupon' ) );
73
+
74
  }
75
 
76
  /**
398
 
399
  add_filter( 'woocommerce_checkout_fields', array( $this, 'add_three_column_layout_fields' ) );
400
 
401
+ add_filter( 'woocommerce_cart_totals_coupon_html', array( $this, 'remove_coupon_text' ) );
402
  global $post;
403
 
404
  if ( _is_wcf_checkout_type() ) {
440
  */
441
  function shortcode_scripts() {
442
 
443
+ wp_enqueue_style( 'wcf-checkout-template', wcf()->utils->get_css_url( 'checkout-template' ), '', CARTFLOWS_VER );
 
444
 
445
  wp_enqueue_script(
446
  'wcf-checkout-template',
447
+ wcf()->utils->get_js_url( 'checkout-template' ),
448
  array( 'jquery' ),
449
  CARTFLOWS_VER,
450
  true
477
  if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
478
  Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id )
479
  ) {
480
+ wp_enqueue_style( 'wcf-checkout-template-divi', wcf()->utils->get_css_url( 'checkout-template-divi' ), '', CARTFLOWS_VER );
 
481
  }
482
 
483
  // Add Flatsome Compatibility css if Flatsome theme is enabled.
484
  if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
485
+ wp_enqueue_style( 'wcf-checkout-template-flatsome', wcf()->utils->get_css_url( 'checkout-template-flatsome' ), '', CARTFLOWS_VER );
 
486
  }
487
 
488
  // Add The7 Compatibility css if The7 theme is enabled.
489
  if ( Cartflows_Compatibility::get_instance()->is_the_seven_enabled() ) {
490
+ wp_enqueue_style( 'wcf-checkout-template-the-seven', wcf()->utils->get_css_url( 'checkout-template-the-seven' ), '', CARTFLOWS_VER );
 
491
  }
492
  }
493
 
933
  function display_custom_coupon_field() {
934
 
935
  $coupon_enabled = apply_filters( 'woocommerce_coupons_enabled', true );
936
+ $show_coupon = apply_filters( 'cartflows_show_coupon_field', true );
937
 
938
+ if ( ! ( $coupon_enabled && $show_coupon ) ) {
939
  return;
940
 
941
  }
945
  <div class="wcf-custom-coupon-field">
946
  <div class="wcf-coupon-col-1">
947
  <span>
948
+ <input type="text" name="coupon_code" class="input-text wcf-coupon-code-input" placeholder="<?php _e( 'Coupon Code', 'cartflows' ); ?>" id="coupon_code" value="">
949
  </span>
950
  </div>
951
  <div class="wcf-coupon-col-2">
952
  <span>
953
+ <button type="button" class="button wcf-submit-coupon wcf-btn-small" name="apply_coupon" value="Apply"><?php _e( 'Apply', 'cartflows' ); ?></button>
954
  </span>
955
  </div>
956
  </div>
958
  echo ob_get_clean();
959
  }
960
 
961
+ /**
962
+ * Apply filter to change class of remove coupon field.
963
+ *
964
+ * @param string $coupon coupon.
965
+ * @return string
966
+ */
967
+ function remove_coupon_text( $coupon ) {
968
+
969
+ $coupon = str_replace( 'woocommerce-remove-coupon', 'wcf-remove-coupon', $coupon );
970
+ return $coupon;
971
+
972
+ }
973
  /**
974
  * Apply filter to change the placeholder text of coupon field.
975
  *
993
  */
994
  function apply_coupon() {
995
 
996
+ $response = '';
997
+
998
+ check_ajax_referer( 'wcf-apply-coupon', 'security' );
999
+ if ( ! empty( $_POST['coupon_code'] ) ) {
1000
+ $result = WC()->cart->add_discount( sanitize_text_field( $_POST['coupon_code'] ) );
1001
+ } else {
1002
+ wc_add_notice( WC_Coupon::get_generic_coupon_error( WC_Coupon::E_WC_COUPON_PLEASE_ENTER ), 'error' );
1003
+ }
1004
+
1005
+ $response = array(
1006
+ 'status' => $result,
1007
+ 'msg' => wc_print_notices( true ),
1008
+ );
1009
 
1010
+ echo json_encode( $response );
1011
 
 
1012
  die();
1013
  }
1014
 
1015
+
1016
  /**
1017
  * Added ajax nonce to localize variable.
1018
  *
1020
  */
1021
  function add_localize_vars( $vars ) {
1022
 
1023
+ $vars['wcf_validate_coupon_nonce'] = wp_create_nonce( 'wcf-apply-coupon' );
1024
+
1025
+ $vars['wcf_validate_remove_coupon_nonce'] = wp_create_nonce( 'wcf-remove-coupon' );
1026
 
1027
  $vars['allow_persistance'] = apply_filters( 'cartflows_allow_persistace', 'yes' );
1028
 
1130
 
1131
  echo '</div> ';
1132
  }
1133
+
1134
+ /**
1135
+ * Remove coupon.
1136
+ */
1137
+ function remove_coupon() {
1138
+
1139
+ check_ajax_referer( 'wcf-remove-coupon', 'security' );
1140
+ $coupon = isset( $_POST['coupon_code'] ) ? wc_clean( $_POST['coupon_code'] ) : false;
1141
+
1142
+ if ( empty( $coupon ) ) {
1143
+ echo "<div class='woocommerce-error'>Sorry there was a problem removing this coupon.";
1144
+ } else {
1145
+ WC()->cart->remove_coupon( $coupon );
1146
+ echo "<div class='woocommerce-error'>Coupon has been removed.</div>";
1147
+ }
1148
+ wc_print_notices();
1149
+ wp_die();
1150
+ }
1151
+
1152
  }
1153
 
1154
  /**
modules/checkout/templates/embed/checkout-template-simple.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
- /**
3
- * Checkout template
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- $checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
9
- $fields_skins = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-fields-skins' );
10
- ?>
11
- <div id="wcf-embed-checkout-form" class="wcf-embed-checkout-form wcf-embed-checkout-form-<?php echo $checkout_layout; ?> wcf-field-<?php echo $fields_skins; ?>">
12
- <!-- CHECKOUT SHORTCODE -->
13
- <?php do_action( 'cartflows_add_before_main_section', $checkout_layout ); ?>
14
-
15
- <?php
16
- $checkout_html = do_shortcode( '[woocommerce_checkout]' );
17
-
18
- if (
19
- empty( $checkout_html ) ||
20
- trim( $checkout_html ) == '<div class="woocommerce"></div>'
21
- ) {
22
-
23
- do_action( 'cartflows_checkout_cart_empty', $checkout_id );
24
-
25
- echo __( 'Your cart is currently empty.', 'cartflows' );
26
- } else {
27
- echo $checkout_html;
28
- }
29
- ?>
30
-
31
- <?php do_action( 'cartflows_add_after_main_section', $arg = '' ); ?>
32
- <!-- END CHECKOUT SHORTCODE -->
33
- </div>
1
+ <?php
2
+ /**
3
+ * Checkout template
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ $checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
9
+ $fields_skins = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-fields-skins' );
10
+ ?>
11
+ <div id="wcf-embed-checkout-form" class="wcf-embed-checkout-form wcf-embed-checkout-form-<?php echo $checkout_layout; ?> wcf-field-<?php echo $fields_skins; ?>">
12
+ <!-- CHECKOUT SHORTCODE -->
13
+ <?php do_action( 'cartflows_add_before_main_section', $checkout_layout ); ?>
14
+
15
+ <?php
16
+ $checkout_html = do_shortcode( '[woocommerce_checkout]' );
17
+
18
+ if (
19
+ empty( $checkout_html ) ||
20
+ trim( $checkout_html ) == '<div class="woocommerce"></div>'
21
+ ) {
22
+
23
+ do_action( 'cartflows_checkout_cart_empty', $checkout_id );
24
+
25
+ echo __( 'Your cart is currently empty.', 'cartflows' );
26
+ } else {
27
+ echo $checkout_html;
28
+ }
29
+ ?>
30
+
31
+ <?php do_action( 'cartflows_add_after_main_section', $arg = '' ); ?>
32
+ <!-- END CHECKOUT SHORTCODE -->
33
+ </div>
modules/flow/class-cartflows-flow.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
- /**
3
- * Flow
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- define( 'CARTFLOWS_FLOW_DIR', CARTFLOWS_DIR . 'modules/flow/' );
9
- define( 'CARTFLOWS_FLOW_URL', CARTFLOWS_URL . 'modules/flow/' );
10
-
11
- /**
12
- * Initial Setup
13
- *
14
- * @since 1.0.0
15
- */
16
- class Cartflows_Flow {
17
-
18
-
19
- /**
20
- * Member Variable
21
- *
22
- * @var object instance
23
- */
24
- private static $instance;
25
-
26
- /**
27
- * Initiator
28
- */
29
- public static function get_instance() {
30
- if ( ! isset( self::$instance ) ) {
31
- self::$instance = new self;
32
- }
33
- return self::$instance;
34
- }
35
-
36
- /**
37
- * Constructor function that initializes required actions and hooks
38
- */
39
- public function __construct() {
40
- require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-loader.php';
41
- require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-meta.php';
42
- }
43
- }
44
-
45
- /**
46
- * Kicking this off by calling 'get_instance()' method
47
- */
48
- Cartflows_Flow::get_instance();
1
+ <?php
2
+ /**
3
+ * Flow
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ define( 'CARTFLOWS_FLOW_DIR', CARTFLOWS_DIR . 'modules/flow/' );
9
+ define( 'CARTFLOWS_FLOW_URL', CARTFLOWS_URL . 'modules/flow/' );
10
+
11
+ /**
12
+ * Initial Setup
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ class Cartflows_Flow {
17
+
18
+
19
+ /**
20
+ * Member Variable
21
+ *
22
+ * @var object instance
23
+ */
24
+ private static $instance;
25
+
26
+ /**
27
+ * Initiator
28
+ */
29
+ public static function get_instance() {
30
+ if ( ! isset( self::$instance ) ) {
31
+ self::$instance = new self;
32
+ }
33
+ return self::$instance;
34
+ }
35
+
36
+ /**
37
+ * Constructor function that initializes required actions and hooks
38
+ */
39
+ public function __construct() {
40
+ require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-loader.php';
41
+ require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-meta.php';
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Kicking this off by calling 'get_instance()' method
47
+ */
48
+ Cartflows_Flow::get_instance();
modules/flow/classes/class-cartflows-flow-meta.php CHANGED
@@ -1,743 +1,743 @@
1
- <?php
2
- /**
3
- * Flow meta
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Meta Boxes setup
10
- */
11
- class Cartflows_Flow_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;
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
- add_action( 'admin_head', array( $this, 'menu_highlight' ) );
45
-
46
- add_action( 'admin_init', array( $this, 'admin_init_actions' ) );
47
-
48
- /* Init Metabox */
49
- add_action( 'load-post.php', array( $this, 'init_metabox' ) );
50
- add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
51
-
52
- /* Add Scripts */
53
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 20 );
54
-
55
- add_action( 'wp_ajax_cartflows_setup_default_steps', array( $this, 'cartflows_setup_default_steps' ) );
56
- add_action( 'wp_ajax_cartflows_delete_flow_step', array( $this, 'cartflows_delete_flow_step' ) );
57
-
58
- add_action( 'wp_ajax_cartflows_reorder_flow_steps', array( $this, 'cartflows_reorder_flow_steps' ) );
59
-
60
- add_action( 'admin_notices', array( $this, 'admin_notices' ) );
61
-
62
- add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
63
- }
64
-
65
- /**
66
- * Display admin notices.
67
- *
68
- * @since 1.0.0
69
- *
70
- * @return void
71
- */
72
- function admin_notices() {
73
-
74
- if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type() ) {
75
- return;
76
- }
77
-
78
- $flow_id = get_post_meta( get_the_id(), 'wcf-flow-id', true );
79
- if ( $flow_id ) { ?>
80
- <div class="wcf-notice-back-edit-flow">
81
- <p>
82
- <a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button button-primary button-hero" style="text-decoration: none;">
83
- <i class="dashicons dashicons-arrow-left-alt"></i>
84
- <?php _e( 'Back to edit Flow', 'cartflows' ); ?>
85
- </a>
86
- </p>
87
- </div>
88
- <?php
89
- }
90
- }
91
-
92
- /**
93
- * Initialize admin actions.
94
- *
95
- * @since 1.0.0
96
- *
97
- * @return void
98
- */
99
- function admin_init_actions() {
100
- add_action( 'before_delete_post', array( $this, 'step_post_sync' ) );
101
- add_action( 'wp_trash_post', array( $this, 'step_post_trash_sync' ) );
102
- add_action( 'untrashed_post', array( $this, 'step_post_untrash_sync' ) );
103
- }
104
-
105
- /**
106
- * Delete term data and steps data after deleting flow.
107
- *
108
- * @since 1.0.0
109
- * @param int $pid post id.
110
- *
111
- * @return void
112
- */
113
- function step_post_sync( $pid ) {
114
-
115
- global $post_type;
116
-
117
- if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
118
-
119
- $steps = get_post_meta( $pid, 'wcf-steps', true );
120
-
121
- if ( $steps && is_array( $steps ) ) {
122
- foreach ( $steps as $i => $step ) {
123
- wp_delete_post( $step['id'], true );
124
- }
125
- }
126
-
127
- $term_data = term_exists( 'flow-' . $pid, CARTFLOWS_TAXONOMY_STEP_FLOW );
128
-
129
- if ( is_array( $term_data ) ) {
130
- wp_delete_term( $term_data['term_id'], CARTFLOWS_TAXONOMY_STEP_FLOW );
131
- }
132
- }
133
- }
134
-
135
- /**
136
- * Trash steps data after trashing flow.
137
- *
138
- * @since 1.0.0
139
- * @param int $pid post id.
140
- *
141
- * @return void
142
- */
143
- function step_post_trash_sync( $pid ) {
144
-
145
- global $post_type;
146
-
147
- if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
148
-
149
- $steps = get_post_meta( $pid, 'wcf-steps', true );
150
-
151
- if ( $steps && is_array( $steps ) ) {
152
- foreach ( $steps as $i => $step ) {
153
- wp_trash_post( $step['id'] );
154
- }
155
- }
156
- }
157
- }
158
-
159
- /**
160
- * Untrash steps data after restoring flow.
161
- *
162
- * @since 1.0.0
163
- * @param int $pid post id.
164
- *
165
- * @return void
166
- */
167
- function step_post_untrash_sync( $pid ) {
168
-
169
- global $post_type;
170
-
171
- if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
172
-
173
- $steps = get_post_meta( $pid, 'wcf-steps', true );
174
-
175
- if ( $steps && is_array( $steps ) ) {
176
- foreach ( $steps as $i => $step ) {
177
- wp_untrash_post( $step['id'] );
178
- }
179
- }
180
- }
181
- }
182
-
183
- /**
184
- * Setup default steps for flow
185
- *
186
- * @since 1.0.0
187
- *
188
- * @return void
189
- */
190
- public function cartflows_setup_default_steps() {
191
-
192
- check_ajax_referer( 'wcf-setup-default-steps', 'security' );
193
-
194
- $flow_id = intval( $_POST['post_id'] );
195
-
196
- $result = array(
197
- 'status' => false,
198
- /* translators: %s flow id */
199
- 'text' => sprintf( __( 'Steps not created for flow - %s', 'cartflows' ), $flow_id ),
200
- );
201
-
202
- if ( ! $flow_id ) {
203
- wp_send_json( $result );
204
- }
205
-
206
- $is_step_exists = get_post_meta( $flow_id, 'wcf-steps', true );
207
-
208
- if ( $is_step_exists ) {
209
-
210
- $result = array(
211
- 'status' => false,
212
- /* translators: %s flow id */
213
- 'text' => sprintf( __( 'Steps already exists. Flow - %s', 'cartflows' ), $flow_id ),
214
- );
215
-
216
- wp_send_json( $result );
217
- }
218
-
219
- /* Start Creating */
220
-
221
- $flow_steps = array();
222
-
223
- $steps_data = array(
224
- 'landing' => __( 'Landing Page', 'cartflows' ),
225
- 'checkout' => __( 'Checkout Page', 'cartflows' ),
226
- 'thankyou' => __( 'Thank You Page', 'cartflows' ),
227
- );
228
-
229
- foreach ( $steps_data as $slug => $title ) {
230
-
231
- $step_id = wp_insert_post(
232
- array(
233
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
234
- 'post_title' => $title,
235
- 'post_content' => '[cartflows_navigation]',
236
- 'post_status' => 'publish',
237
- )
238
- );
239
-
240
- if ( $step_id ) {
241
-
242
- $flow_steps[] = array(
243
- 'id' => $step_id,
244
- 'title' => $title,
245
- 'type' => $slug,
246
- );
247
-
248
- // insert post meta.
249
- update_post_meta( $step_id, 'wcf-flow-id', $flow_id );
250
- update_post_meta( $step_id, 'wcf-step-type', $slug );
251
-
252
- wp_set_object_terms( $step_id, $slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
253
- wp_set_object_terms( $step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
254
- }
255
- }
256
-
257
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
258
-
259
- $result = array(
260
- 'status' => true,
261
- /* translators: %s flow id */
262
- 'text' => sprintf( __( 'Steps created for flow - %s', 'cartflows' ), $flow_id ),
263
- 'redirect' => get_edit_post_link( $flow_id ),
264
- );
265
-
266
- wp_send_json( $result );
267
- }
268
-
269
- /**
270
- * Create step for given flow.
271
- *
272
- * @param int $flow_id flow ID.
273
- * @param int $step_type step type.
274
- * @param int $step_title step title.
275
- * @since 1.0.0
276
- *
277
- * @return int
278
- */
279
- public function create_step( $flow_id, $step_type, $step_title ) {
280
-
281
- $new_step_id = wp_insert_post(
282
- array(
283
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
284
- 'post_title' => $step_title,
285
- 'post_status' => 'publish',
286
- )
287
- );
288
-
289
- if ( $new_step_id ) {
290
-
291
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
292
-
293
- if ( ! is_array( $flow_steps ) ) {
294
- $flow_steps = array();
295
- }
296
-
297
- $flow_steps[] = array(
298
- 'id' => $new_step_id,
299
- 'title' => $step_title,
300
- 'type' => $step_type,
301
- );
302
-
303
- // insert post meta.
304
- update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
305
- update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
306
-
307
- wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
308
- wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
309
- }
310
-
311
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
312
-
313
- return $new_step_id;
314
- }
315
-
316
- /**
317
- * Delete step for flow
318
- *
319
- * @since 1.0.0
320
- *
321
- * @return void
322
- */
323
- public function cartflows_delete_flow_step() {
324
-
325
- check_ajax_referer( 'wcf-delete-flow-step', 'security' );
326
-
327
- $flow_id = intval( $_POST['post_id'] );
328
- $step_id = intval( $_POST['step_id'] );
329
-
330
- $result = array(
331
- 'status' => false,
332
- /* translators: %s flow id */
333
- 'text' => sprintf( __( 'Step not deleted for flow - %s', 'cartflows' ), $flow_id ),
334
- );
335
-
336
- if ( ! $flow_id || ! $step_id ) {
337
- wp_send_json( $result );
338
- }
339
-
340
- wp_delete_post( $step_id, true );
341
-
342
- $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
343
-
344
- if ( ! is_array( $flow_steps ) ) {
345
- wp_send_json( $result );
346
- }
347
-
348
- foreach ( $flow_steps as $index => $data ) {
349
-
350
- if ( intval( $data['id'] ) === $step_id ) {
351
- unset( $flow_steps[ $index ] );
352
- break;
353
- }
354
- }
355
-
356
- /* Set index order properly */
357
- $flow_steps = array_merge( $flow_steps );
358
-
359
- update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
360
-
361
- $result = array(
362
- 'status' => true,
363
- /* translators: %s flow id */
364
- 'text' => sprintf( __( 'Step deleted for flow - %s', 'cartflows' ), $flow_id ),
365
- );
366
-
367
- wp_send_json( $result );
368
- }
369
-
370
- /**
371
- * Reorder step flow
372
- *
373
- * @since 1.0.0
374
- *
375
- * @return void
376
- */
377
- public function cartflows_reorder_flow_steps() {
378
-
379
- check_ajax_referer( 'wcf-reorder-flow-steps', 'security' );
380
-
381
- $flow_id = intval( $_POST['post_id'] );
382
- $step_ids = array_map( 'intval', $_POST['step_ids'] );
383
-
384
- $result = array(
385
- 'status' => false,
386
- /* translators: %s flow id */
387
- 'text' => sprintf( __( 'Steps not sorted for flow - %s', 'cartflows' ), $flow_id ),
388
- );
389
-
390
- if ( ! $flow_id || ! is_array( $step_ids ) ) {
391
- wp_send_json( $result );
392
- }
393
-
394
- $new_flow_steps = array();
395
-
396
- foreach ( $step_ids as $index => $step_id ) {
397
-
398
- $new_flow_steps[] = array(
399
- 'id' => intval( $step_id ),
400
- 'title' => get_the_title( $step_id ),
401
- 'type' => get_post_meta( $step_id, 'wcf-step-type', true ),
402
- );
403
- }
404
-
405
- update_post_meta( $flow_id, 'wcf-steps', $new_flow_steps );
406
-
407
- $result = array(
408
- 'status' => true,
409
- /* translators: %s flow id */
410
- 'text' => sprintf( __( 'Steps sorted for flow - %s', 'cartflows' ), $flow_id ),
411
- );
412
-
413
- wp_send_json( $result );
414
- }
415
-
416
-
417
- /**
418
- * Load admin scripts
419
- *
420
- * @since 1.0.0
421
- *
422
- * @return void
423
- */
424
- public function admin_scripts() {
425
-
426
- global $pagenow;
427
- global $post;
428
-
429
- $screen = get_current_screen();
430
-
431
- if ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && CARTFLOWS_FLOW_POST_TYPE == $screen->post_type ) {
432
-
433
- wp_enqueue_script(
434
- 'wcf-flow-meta',
435
- CARTFLOWS_URL . 'admin/assets/js/flow-admin-edit.js',
436
- array( 'jquery', 'jquery-ui-sortable' ),
437
- CARTFLOWS_VER,
438
- true
439
- );
440
-
441
- wp_enqueue_style( 'wcf-flow-meta', CARTFLOWS_URL . 'admin/assets/css/flow-admin-edit.css', '', CARTFLOWS_VER );
442
- wp_style_add_data( 'wcf-flow-meta', 'rtl', 'replace' );
443
-
444
- $localize = array(
445
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
446
- );
447
-
448
- wp_localize_script( 'jquery', 'cartflows', apply_filters( 'wcf_js_localize', $localize ) );
449
- }
450
- }
451
-
452
- /**
453
- * Initialize meta box
454
- *
455
- * @since 1.0.0
456
- *
457
- * @return void
458
- */
459
- public function init_metabox() {
460
-
461
- /**
462
- * Fires after the title field.
463
- *
464
- * @param WP_Post $post Post object.
465
- */
466
- add_action( 'add_meta_boxes', array( $this, 'settings_meta_box' ) );
467
- add_action( 'edit_form_after_title', array( $this, 'setup_meta_box' ) );
468
- add_action( 'save_post', array( $this, 'save_meta_box' ) );
469
- }
470
-
471
- /**
472
- * Is first time import?
473
- *
474
- * @param integer $post_id post ID.
475
- * @return bool
476
- */
477
- function is_flow_imported( $post_id = 0 ) {
478
-
479
- if ( 0 === $post_id ) {
480
- $post_id = get_the_ID();
481
- }
482
-
483
- $steps = get_post_meta( $post_id, 'wcf-steps', true );
484
- $choice = get_post_meta( $post_id, 'wcf-flow-choise', true );
485
-
486
- if ( empty( $steps ) && 'import' === $choice ) {
487
- return true;
488
- }
489
-
490
- return false;
491
- }
492
-
493
- /**
494
- * Setup meta box.
495
- *
496
- * @return void
497
- */
498
- function setup_meta_box() {
499
- if ( ! Cartflows_Admin::is_flow_edit_admin() ) {
500
- return;
501
- }
502
-
503
- /**
504
- * Adding Add new step button to the top*/
505
- echo $this->add_add_new_step_button();
506
-
507
- $this->markup_meta_box();
508
- }
509
-
510
- /**
511
- * Settings meta box.
512
- *
513
- * @return void
514
- */
515
- function settings_meta_box() {
516
-
517
- if ( CARTFLOWS_FLOW_POST_TYPE == get_post_type() ) {
518
-
519
- add_meta_box(
520
- 'wcf-sandbox-settings', // Id.
521
- __( 'Flow Settings', 'cartflows' ), // Title.
522
- array( $this, 'sandbox_meta_box' ), // Callback.
523
- CARTFLOWS_FLOW_POST_TYPE, // Post_type.
524
- 'side', // Context.
525
- 'high' // Priority.
526
- );
527
-
528
- do_action( 'cartflows_add_flow_metabox' );
529
- }
530
- }
531
-
532
- /**
533
- * Metabox Markup
534
- *
535
- * @return void
536
- */
537
- function markup_meta_box() {
538
- global $post;
539
-
540
- wp_nonce_field( 'save-nonce-flow-meta', 'nonce-flow-meta' );
541
-
542
- // Get defaults.
543
- $meta = self::get_current_post_meta( $post->ID );
544
-
545
- /**
546
- * Get options
547
- */
548
- $updated_data = array(
549
- 'steps' => $meta['wcf-steps']['default'],
550
- );
551
-
552
- do_action( 'wcf_flow_settings_markup_before', $meta );
553
- $this->page_header_tab( $updated_data );
554
- do_action( 'wcf_flow_settings_markup_after', $meta );
555
- }
556
-
557
- /**
558
- * Metabox Markup
559
- *
560
- * @param object $post Post object.
561
- * @return void
562
- */
563
- function sandbox_meta_box( $post ) {
564
-
565
- // Get defaults.
566
- $meta = self::get_current_post_meta( $post->ID );
567
-
568
- /**
569
- * Get options
570
- */
571
- foreach ( $meta as $key => $value ) {
572
- $updated_data[ $key ] = $meta[ $key ]['default'];
573
- }
574
-
575
- do_action( 'wcf_flow_sandbox_markup_before', $meta );
576
- $this->sandbox_markup( $updated_data );
577
- do_action( 'wcf_flow_sandbox_markup_after', $meta );
578
- }
579
-
580
- /**
581
- * Page Header Tabs
582
- *
583
- * @param array $options Post meta.
584
- * @return void
585
- */
586
- function page_header_tab( $options ) {
587
-
588
- include_once CARTFLOWS_FLOW_DIR . 'view/meta-flow-steps.php';
589
- }
590
-
591
- /**
592
- * Sandbox Markup
593
- *
594
- * @param array $options Post meta.
595
- * @return void
596
- */
597
- function sandbox_markup( $options ) {
598
- ?>
599
- <div class="wcf-flow-sandbox-table wcf-general-metabox-wrap widefat">
600
- <div class="wcf-flow-sandbox-table-container">
601
- <?php
602
- echo wcf()->meta->get_checkbox_field(
603
- array(
604
- 'name' => 'wcf-testing',
605
- 'value' => $options['wcf-testing'],
606
- 'after' => __( 'Enable Test Mode', 'cartflows' ),
607
- )
608
- );
609
-
610
- echo wcf()->meta->get_description_field(
611
- array(
612
- 'name' => 'wcf-testing-note',
613
- 'content' => __( 'Test mode adds random products in your flow, so you can preview it easily while testing.', 'cartflows' ),
614
- )
615
- );
616
-
617
- ?>
618
- </div>
619
- </div>
620
- <?php
621
- }
622
-
623
- /**
624
- * Keep the menu open when editing the flows.
625
- * Highlights the wanted admin (sub-) menu items for the CPT.
626
- *
627
- * @since 1.0.0
628
- */
629
- public function menu_highlight() {
630
- global $parent_file, $submenu_file, $post_type;
631
- if ( CARTFLOWS_FLOW_POST_TYPE == $post_type ) :
632
- $parent_file = CARTFLOWS_SLUG;
633
- $submenu_file = 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE;
634
- endif;
635
- }
636
-
637
- /**
638
- * Get metabox options
639
- *
640
- * @param int $post_id post id.
641
- * @return array
642
- */
643
- public static function get_meta_option( $post_id ) {
644
-
645
- if ( null === self::$meta_option ) {
646
- /**
647
- * Set metabox options
648
- */
649
- self::$meta_option = wcf()->options->get_flow_fields( $post_id );
650
- }
651
-
652
- return self::$meta_option;
653
- }
654
-
655
- /**
656
- * Get metabox options
657
- *
658
- * @param int $post_id post ID.
659
- * @return array
660
- */
661
- public static function get_current_post_meta( $post_id ) {
662
-
663
- $stored = get_post_meta( $post_id );
664
-
665
- $default_meta = self::get_meta_option( $post_id );
666
-
667
- // Set stored and override defaults.
668
- foreach ( $stored as $key => $value ) {
669
- if ( array_key_exists( $key, $default_meta ) ) {
670
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
671
- } else {
672
- self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
673
- }
674
- }
675
-
676
- return self::get_meta_option( $post_id );
677
- }
678
-
679
- /**
680
- * Metabox Save
681
- *
682
- * @param number $post_id Post ID.
683
- * @return void
684
- */
685
- function save_meta_box( $post_id ) {
686
-
687
- // Checks save status.
688
- $is_autosave = wp_is_post_autosave( $post_id );
689
- $is_revision = wp_is_post_revision( $post_id );
690
-
691
- $is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( $_POST['nonce-flow-meta'], 'save-nonce-flow-meta' ) ) ? true : false;
692
-
693
- // Exits script depending on save status.
694
- if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
695
- return;
696
- }
697
-
698
- wcf()->options->save_flow_fields( $post_id );
699
- }
700
-
701
- /**
702
- * Localize variables in admin
703
- *
704
- * @param array $vars variables.
705
- */
706
- function localize_vars( $vars ) {
707
-
708
- $ajax_actions = array(
709
- 'wcf_setup_default_steps',
710
- 'wcf_add_flow_step',
711
- 'wcf_delete_flow_step',
712
- 'wcf_reorder_flow_steps',
713
- );
714
-
715
- foreach ( $ajax_actions as $action ) {
716
-
717
- $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
718
- }
719
-
720
- return $vars;
721
- }
722
-
723
- /**
724
- * Add New Step Button
725
- *
726
- * @return string
727
- */
728
- function add_add_new_step_button() {
729
- $add_new_btn_markup = '<style>.wrap{ position:relative;}</style>';
730
- $add_new_btn_markup .= "<div class='wcf-button-wrap'>";
731
- $add_new_btn_markup .= "<button class='wcf-trigger-popup page-title-action'>";
732
- $add_new_btn_markup .= esc_html( 'Add New Step', 'cartflows' );
733
- $add_new_btn_markup .= '</button>';
734
- $add_new_btn_markup .= '</div>';
735
-
736
- return $add_new_btn_markup;
737
- }
738
- }
739
-
740
- /**
741
- * Kicking this off by calling 'get_instance()' method
742
- */
743
- Cartflows_Flow_Meta::get_instance();
1
+ <?php
2
+ /**
3
+ * Flow meta
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Meta Boxes setup
10
+ */
11
+ class Cartflows_Flow_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;
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
+ add_action( 'admin_head', array( $this, 'menu_highlight' ) );
45
+
46
+ add_action( 'admin_init', array( $this, 'admin_init_actions' ) );
47
+
48
+ /* Init Metabox */
49
+ add_action( 'load-post.php', array( $this, 'init_metabox' ) );
50
+ add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
51
+
52
+ /* Add Scripts */
53
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 20 );
54
+
55
+ add_action( 'wp_ajax_cartflows_setup_default_steps', array( $this, 'cartflows_setup_default_steps' ) );
56
+ add_action( 'wp_ajax_cartflows_delete_flow_step', array( $this, 'cartflows_delete_flow_step' ) );
57
+
58
+ add_action( 'wp_ajax_cartflows_reorder_flow_steps', array( $this, 'cartflows_reorder_flow_steps' ) );
59
+
60
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
61
+
62
+ add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
63
+ }
64
+
65
+ /**
66
+ * Display admin notices.
67
+ *
68
+ * @since 1.0.0
69
+ *
70
+ * @return void
71
+ */
72
+ function admin_notices() {
73
+
74
+ if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type() ) {
75
+ return;
76
+ }
77
+
78
+ $flow_id = get_post_meta( get_the_id(), 'wcf-flow-id', true );
79
+ if ( $flow_id ) { ?>
80
+ <div class="wcf-notice-back-edit-flow">
81
+ <p>
82
+ <a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button button-primary button-hero" style="text-decoration: none;">
83
+ <i class="dashicons dashicons-arrow-left-alt"></i>
84
+ <?php _e( 'Back to edit Flow', 'cartflows' ); ?>
85
+ </a>
86
+ </p>
87
+ </div>
88
+ <?php
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Initialize admin actions.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @return void
98
+ */
99
+ function admin_init_actions() {
100
+ add_action( 'before_delete_post', array( $this, 'step_post_sync' ) );
101
+ add_action( 'wp_trash_post', array( $this, 'step_post_trash_sync' ) );
102
+ add_action( 'untrashed_post', array( $this, 'step_post_untrash_sync' ) );
103
+ }
104
+
105
+ /**
106
+ * Delete term data and steps data after deleting flow.
107
+ *
108
+ * @since 1.0.0
109
+ * @param int $pid post id.
110
+ *
111
+ * @return void
112
+ */
113
+ function step_post_sync( $pid ) {
114
+
115
+ global $post_type;
116
+
117
+ if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
118
+
119
+ $steps = get_post_meta( $pid, 'wcf-steps', true );
120
+
121
+ if ( $steps && is_array( $steps ) ) {
122
+ foreach ( $steps as $i => $step ) {
123
+ wp_delete_post( $step['id'], true );
124
+ }
125
+ }
126
+
127
+ $term_data = term_exists( 'flow-' . $pid, CARTFLOWS_TAXONOMY_STEP_FLOW );
128
+
129
+ if ( is_array( $term_data ) ) {
130
+ wp_delete_term( $term_data['term_id'], CARTFLOWS_TAXONOMY_STEP_FLOW );
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Trash steps data after trashing flow.
137
+ *
138
+ * @since 1.0.0
139
+ * @param int $pid post id.
140
+ *
141
+ * @return void
142
+ */
143
+ function step_post_trash_sync( $pid ) {
144
+
145
+ global $post_type;
146
+
147
+ if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
148
+
149
+ $steps = get_post_meta( $pid, 'wcf-steps', true );
150
+
151
+ if ( $steps && is_array( $steps ) ) {
152
+ foreach ( $steps as $i => $step ) {
153
+ wp_trash_post( $step['id'] );
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Untrash steps data after restoring flow.
161
+ *
162
+ * @since 1.0.0
163
+ * @param int $pid post id.
164
+ *
165
+ * @return void
166
+ */
167
+ function step_post_untrash_sync( $pid ) {
168
+
169
+ global $post_type;
170
+
171
+ if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
172
+
173
+ $steps = get_post_meta( $pid, 'wcf-steps', true );
174
+
175
+ if ( $steps && is_array( $steps ) ) {
176
+ foreach ( $steps as $i => $step ) {
177
+ wp_untrash_post( $step['id'] );
178
+ }
179
+ }
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Setup default steps for flow
185
+ *
186
+ * @since 1.0.0
187
+ *
188
+ * @return void
189
+ */
190
+ public function cartflows_setup_default_steps() {
191
+
192
+ check_ajax_referer( 'wcf-setup-default-steps', 'security' );
193
+
194
+ $flow_id = intval( $_POST['post_id'] );
195
+
196
+ $result = array(
197
+ 'status' => false,
198
+ /* translators: %s flow id */
199
+ 'text' => sprintf( __( 'Steps not created for flow - %s', 'cartflows' ), $flow_id ),
200
+ );
201
+
202
+ if ( ! $flow_id ) {
203
+ wp_send_json( $result );
204
+ }
205
+
206
+ $is_step_exists = get_post_meta( $flow_id, 'wcf-steps', true );
207
+
208
+ if ( $is_step_exists ) {
209
+
210
+ $result = array(
211
+ 'status' => false,
212
+ /* translators: %s flow id */
213
+ 'text' => sprintf( __( 'Steps already exists. Flow - %s', 'cartflows' ), $flow_id ),
214
+ );
215
+
216
+ wp_send_json( $result );
217
+ }
218
+
219
+ /* Start Creating */
220
+
221
+ $flow_steps = array();
222
+
223
+ $steps_data = array(
224
+ 'landing' => __( 'Landing Page', 'cartflows' ),
225
+ 'checkout' => __( 'Checkout Page', 'cartflows' ),
226
+ 'thankyou' => __( 'Thank You Page', 'cartflows' ),
227
+ );
228
+
229
+ foreach ( $steps_data as $slug => $title ) {
230
+
231
+ $step_id = wp_insert_post(
232
+ array(
233
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
234
+ 'post_title' => $title,
235
+ 'post_content' => '[cartflows_navigation]',
236
+ 'post_status' => 'publish',
237
+ )
238
+ );
239
+
240
+ if ( $step_id ) {
241
+
242
+ $flow_steps[] = array(
243
+ 'id' => $step_id,
244
+ 'title' => $title,
245
+ 'type' => $slug,
246
+ );
247
+
248
+ // insert post meta.
249
+ update_post_meta( $step_id, 'wcf-flow-id', $flow_id );
250
+ update_post_meta( $step_id, 'wcf-step-type', $slug );
251
+
252
+ wp_set_object_terms( $step_id, $slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
253
+ wp_set_object_terms( $step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
254
+ }
255
+ }
256
+
257
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
258
+
259
+ $result = array(
260
+ 'status' => true,
261
+ /* translators: %s flow id */
262
+ 'text' => sprintf( __( 'Steps created for flow - %s', 'cartflows' ), $flow_id ),
263
+ 'redirect' => get_edit_post_link( $flow_id ),
264
+ );
265
+
266
+ wp_send_json( $result );
267
+ }
268
+
269
+ /**
270
+ * Create step for given flow.
271
+ *
272
+ * @param int $flow_id flow ID.
273
+ * @param int $step_type step type.
274
+ * @param int $step_title step title.
275
+ * @since 1.0.0
276
+ *
277
+ * @return int
278
+ */
279
+ public function create_step( $flow_id, $step_type, $step_title ) {
280
+
281
+ $new_step_id = wp_insert_post(
282
+ array(
283
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
284
+ 'post_title' => $step_title,
285
+ 'post_status' => 'publish',
286
+ )
287
+ );
288
+
289
+ if ( $new_step_id ) {
290
+
291
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
292
+
293
+ if ( ! is_array( $flow_steps ) ) {
294
+ $flow_steps = array();
295
+ }
296
+
297
+ $flow_steps[] = array(
298
+ 'id' => $new_step_id,
299
+ 'title' => $step_title,
300
+ 'type' => $step_type,
301
+ );
302
+
303
+ // insert post meta.
304
+ update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
305
+ update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
306
+
307
+ wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
308
+ wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
309
+ }
310
+
311
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
312
+
313
+ return $new_step_id;
314
+ }
315
+
316
+ /**
317
+ * Delete step for flow
318
+ *
319
+ * @since 1.0.0
320
+ *
321
+ * @return void
322
+ */
323
+ public function cartflows_delete_flow_step() {
324
+
325
+ check_ajax_referer( 'wcf-delete-flow-step', 'security' );
326
+
327
+ $flow_id = intval( $_POST['post_id'] );
328
+ $step_id = intval( $_POST['step_id'] );
329
+
330
+ $result = array(
331
+ 'status' => false,
332
+ /* translators: %s flow id */
333
+ 'text' => sprintf( __( 'Step not deleted for flow - %s', 'cartflows' ), $flow_id ),
334
+ );
335
+
336
+ if ( ! $flow_id || ! $step_id ) {
337
+ wp_send_json( $result );
338
+ }
339
+
340
+ wp_delete_post( $step_id, true );
341
+
342
+ $flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
343
+
344
+ if ( ! is_array( $flow_steps ) ) {
345
+ wp_send_json( $result );
346
+ }
347
+
348
+ foreach ( $flow_steps as $index => $data ) {
349
+
350
+ if ( intval( $data['id'] ) === $step_id ) {
351
+ unset( $flow_steps[ $index ] );
352
+ break;
353
+ }
354
+ }
355
+
356
+ /* Set index order properly */
357
+ $flow_steps = array_merge( $flow_steps );
358
+
359
+ update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
360
+
361
+ $result = array(
362
+ 'status' => true,
363
+ /* translators: %s flow id */
364
+ 'text' => sprintf( __( 'Step deleted for flow - %s', 'cartflows' ), $flow_id ),
365
+ );
366
+
367
+ wp_send_json( $result );
368
+ }
369
+
370
+ /**
371
+ * Reorder step flow
372
+ *
373
+ * @since 1.0.0
374
+ *
375
+ * @return void
376
+ */
377
+ public function cartflows_reorder_flow_steps() {
378
+
379
+ check_ajax_referer( 'wcf-reorder-flow-steps', 'security' );
380
+
381
+ $flow_id = intval( $_POST['post_id'] );
382
+ $step_ids = array_map( 'intval', $_POST['step_ids'] );
383
+
384
+ $result = array(
385
+ 'status' => false,
386
+ /* translators: %s flow id */
387
+ 'text' => sprintf( __( 'Steps not sorted for flow - %s', 'cartflows' ), $flow_id ),
388
+ );
389
+
390
+ if ( ! $flow_id || ! is_array( $step_ids ) ) {
391
+ wp_send_json( $result );
392
+ }
393
+
394
+ $new_flow_steps = array();
395
+
396
+ foreach ( $step_ids as $index => $step_id ) {
397
+
398
+ $new_flow_steps[] = array(
399
+ 'id' => intval( $step_id ),
400
+ 'title' => get_the_title( $step_id ),
401
+ 'type' => get_post_meta( $step_id, 'wcf-step-type', true ),
402
+ );
403
+ }
404
+
405
+ update_post_meta( $flow_id, 'wcf-steps', $new_flow_steps );
406
+
407
+ $result = array(
408
+ 'status' => true,
409
+ /* translators: %s flow id */
410
+ 'text' => sprintf( __( 'Steps sorted for flow - %s', 'cartflows' ), $flow_id ),
411
+ );
412
+
413
+ wp_send_json( $result );
414
+ }
415
+
416
+
417
+ /**
418
+ * Load admin scripts
419
+ *
420
+ * @since 1.0.0
421
+ *
422
+ * @return void
423
+ */
424
+ public function admin_scripts() {
425
+
426
+ global $pagenow;
427
+ global $post;
428
+
429
+ $screen = get_current_screen();
430
+
431
+ if ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && CARTFLOWS_FLOW_POST_TYPE == $screen->post_type ) {
432
+
433
+ wp_enqueue_script(
434
+ 'wcf-flow-meta',
435
+ CARTFLOWS_URL . 'admin/assets/js/flow-admin-edit.js',
436
+ array( 'jquery', 'jquery-ui-sortable' ),
437
+ CARTFLOWS_VER,
438
+ true
439
+ );
440
+
441
+ wp_enqueue_style( 'wcf-flow-meta', CARTFLOWS_URL . 'admin/assets/css/flow-admin-edit.css', '', CARTFLOWS_VER );
442
+ wp_style_add_data( 'wcf-flow-meta', 'rtl', 'replace' );
443
+
444
+ $localize = array(
445
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
446
+ );
447
+
448
+ wp_localize_script( 'jquery', 'cartflows', apply_filters( 'wcf_js_localize', $localize ) );
449
+ }
450
+ }
451
+
452
+ /**
453
+ * Initialize meta box
454
+ *
455
+ * @since 1.0.0
456
+ *
457
+ * @return void
458
+ */
459
+ public function init_metabox() {
460
+
461
+ /**
462
+ * Fires after the title field.
463
+ *
464
+ * @param WP_Post $post Post object.
465
+ */
466
+ add_action( 'add_meta_boxes', array( $this, 'settings_meta_box' ) );
467
+ add_action( 'edit_form_after_title', array( $this, 'setup_meta_box' ) );
468
+ add_action( 'save_post', array( $this, 'save_meta_box' ) );
469
+ }
470
+
471
+ /**
472
+ * Is first time import?
473
+ *
474
+ * @param integer $post_id post ID.
475
+ * @return bool
476
+ */
477
+ function is_flow_imported( $post_id = 0 ) {
478
+
479
+ if ( 0 === $post_id ) {
480
+ $post_id = get_the_ID();
481
+ }
482
+
483
+ $steps = get_post_meta( $post_id, 'wcf-steps', true );
484
+ $choice = get_post_meta( $post_id, 'wcf-flow-choise', true );
485
+
486
+ if ( empty( $steps ) && 'import' === $choice ) {
487
+ return true;
488
+ }
489
+
490
+ return false;
491
+ }
492
+
493
+ /**
494
+ * Setup meta box.
495
+ *
496
+ * @return void
497
+ */
498
+ function setup_meta_box() {
499
+ if ( ! Cartflows_Admin::is_flow_edit_admin() ) {
500
+ return;
501
+ }
502
+
503
+ /**
504
+ * Adding Add new step button to the top*/
505
+ echo $this->add_add_new_step_button();
506
+
507
+ $this->markup_meta_box();
508
+ }
509
+
510
+ /**
511
+ * Settings meta box.
512
+ *
513
+ * @return void
514
+ */
515
+ function settings_meta_box() {
516
+
517
+ if ( CARTFLOWS_FLOW_POST_TYPE == get_post_type() ) {
518
+
519
+ add_meta_box(
520
+ 'wcf-sandbox-settings', // Id.
521
+ __( 'Flow Settings', 'cartflows' ), // Title.
522
+ array( $this, 'sandbox_meta_box' ), // Callback.
523
+ CARTFLOWS_FLOW_POST_TYPE, // Post_type.
524
+ 'side', // Context.
525
+ 'high' // Priority.
526
+ );
527
+
528
+ do_action( 'cartflows_add_flow_metabox' );
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Metabox Markup
534
+ *
535
+ * @return void
536
+ */
537
+ function markup_meta_box() {
538
+ global $post;
539
+
540
+ wp_nonce_field( 'save-nonce-flow-meta', 'nonce-flow-meta' );
541
+
542
+ // Get defaults.
543
+ $meta = self::get_current_post_meta( $post->ID );
544
+
545
+ /**
546
+ * Get options
547
+ */
548
+ $updated_data = array(
549
+ 'steps' => $meta['wcf-steps']['default'],
550
+ );
551
+
552
+ do_action( 'wcf_flow_settings_markup_before', $meta );
553
+ $this->page_header_tab( $updated_data );
554
+ do_action( 'wcf_flow_settings_markup_after', $meta );
555
+ }
556
+
557
+ /**
558
+ * Metabox Markup
559
+ *
560
+ * @param object $post Post object.
561
+ * @return void
562
+ */
563
+ function sandbox_meta_box( $post ) {
564
+
565
+ // Get defaults.
566
+ $meta = self::get_current_post_meta( $post->ID );
567
+
568
+ /**
569
+ * Get options
570
+ */
571
+ foreach ( $meta as $key => $value ) {
572
+ $updated_data[ $key ] = $meta[ $key ]['default'];
573
+ }
574
+
575
+ do_action( 'wcf_flow_sandbox_markup_before', $meta );
576
+ $this->sandbox_markup( $updated_data );
577
+ do_action( 'wcf_flow_sandbox_markup_after', $meta );
578
+ }
579
+
580
+ /**
581
+ * Page Header Tabs
582
+ *
583
+ * @param array $options Post meta.
584
+ * @return void
585
+ */
586
+ function page_header_tab( $options ) {
587
+
588
+ include_once CARTFLOWS_FLOW_DIR . 'view/meta-flow-steps.php';
589
+ }
590
+
591
+ /**
592
+ * Sandbox Markup
593
+ *
594
+ * @param array $options Post meta.
595
+ * @return void
596
+ */
597
+ function sandbox_markup( $options ) {
598
+ ?>
599
+ <div class="wcf-flow-sandbox-table wcf-general-metabox-wrap widefat">
600
+ <div class="wcf-flow-sandbox-table-container">
601
+ <?php
602
+ echo wcf()->meta->get_checkbox_field(
603
+ array(
604
+ 'name' => 'wcf-testing',
605
+ 'value' => $options['wcf-testing'],
606
+ 'after' => __( 'Enable Test Mode', 'cartflows' ),
607
+ )
608
+ );
609
+
610
+ echo wcf()->meta->get_description_field(
611
+ array(
612
+ 'name' => 'wcf-testing-note',
613
+ 'content' => __( 'Test mode adds random products in your flow, so you can preview it easily while testing.', 'cartflows' ),
614
+ )
615
+ );
616
+
617
+ ?>
618
+ </div>
619
+ </div>
620
+ <?php
621
+ }
622
+
623
+ /**
624
+ * Keep the menu open when editing the flows.
625
+ * Highlights the wanted admin (sub-) menu items for the CPT.
626
+ *
627
+ * @since 1.0.0
628
+ */
629
+ public function menu_highlight() {
630
+ global $parent_file, $submenu_file, $post_type;
631
+ if ( CARTFLOWS_FLOW_POST_TYPE == $post_type ) :
632
+ $parent_file = CARTFLOWS_SLUG;
633
+ $submenu_file = 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE;
634
+ endif;
635
+ }
636
+
637
+ /**
638
+ * Get metabox options
639
+ *
640
+ * @param int $post_id post id.
641
+ * @return array
642
+ */
643
+ public static function get_meta_option( $post_id ) {
644
+
645
+ if ( null === self::$meta_option ) {
646
+ /**
647
+ * Set metabox options
648
+ */
649
+ self::$meta_option = wcf()->options->get_flow_fields( $post_id );
650
+ }
651
+
652
+ return self::$meta_option;
653
+ }
654
+
655
+ /**
656
+ * Get metabox options
657
+ *
658
+ * @param int $post_id post ID.
659
+ * @return array
660
+ */
661
+ public static function get_current_post_meta( $post_id ) {
662
+
663
+ $stored = get_post_meta( $post_id );
664
+
665
+ $default_meta = self::get_meta_option( $post_id );
666
+
667
+ // Set stored and override defaults.
668
+ foreach ( $stored as $key => $value ) {
669
+ if ( array_key_exists( $key, $default_meta ) ) {
670
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
671
+ } else {
672
+ self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
673
+ }
674
+ }
675
+
676
+ return self::get_meta_option( $post_id );
677
+ }
678
+
679
+ /**
680
+ * Metabox Save
681
+ *
682
+ * @param number $post_id Post ID.
683
+ * @return void
684
+ */
685
+ function save_meta_box( $post_id ) {
686
+
687
+ // Checks save status.
688
+ $is_autosave = wp_is_post_autosave( $post_id );
689
+ $is_revision = wp_is_post_revision( $post_id );
690
+
691
+ $is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( $_POST['nonce-flow-meta'], 'save-nonce-flow-meta' ) ) ? true : false;
692
+
693
+ // Exits script depending on save status.
694
+ if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
695
+ return;
696
+ }
697
+
698
+ wcf()->options->save_flow_fields( $post_id );
699
+ }
700
+
701
+ /**
702
+ * Localize variables in admin
703
+ *
704
+ * @param array $vars variables.
705
+ */
706
+ function localize_vars( $vars ) {
707
+
708
+ $ajax_actions = array(
709
+ 'wcf_setup_default_steps',
710
+ 'wcf_add_flow_step',
711
+ 'wcf_delete_flow_step',
712
+ 'wcf_reorder_flow_steps',
713
+ );
714
+
715
+ foreach ( $ajax_actions as $action ) {
716
+
717
+ $vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
718
+ }
719
+
720
+ return $vars;
721
+ }
722
+
723
+ /**
724
+ * Add New Step Button
725
+ *
726
+ * @return string
727
+ */
728
+ function add_add_new_step_button() {
729
+ $add_new_btn_markup = '<style>.wrap{ position:relative;}</style>';
730
+ $add_new_btn_markup .= "<div class='wcf-button-wrap'>";
731
+ $add_new_btn_markup .= "<button class='wcf-trigger-popup page-title-action'>";
732
+ $add_new_btn_markup .= esc_html( 'Add New Step', 'cartflows' );
733
+ $add_new_btn_markup .= '</button>';
734
+ $add_new_btn_markup .= '</div>';
735
+
736
+ return $add_new_btn_markup;
737
+ }
738
+ }
739
+
740
+ /**
741
+ * Kicking this off by calling 'get_instance()' method
742
+ */
743
+ Cartflows_Flow_Meta::get_instance();
modules/flow/classes/class-cartflows-flow-post-type.php CHANGED
@@ -1,281 +1,281 @@
1
- <?php
2
- /**
3
- * Flow post type
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Flow_Post_Type {
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_action( 'init', array( $this, 'flow_post_type' ) );
39
- add_action( 'admin_menu', array( $this, 'register_as_submenu' ), 100 );
40
-
41
- add_filter( 'post_updated_messages', array( $this, 'custom_post_type_post_update_messages' ) );
42
-
43
- /* View Post URL */
44
- add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
45
- add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 10, 2 );
46
- add_action( 'template_redirect', array( $this, 'redirect_to_step' ), 10 );
47
- }
48
-
49
- /**
50
- * Create custom post type
51
- */
52
- function flow_post_type() {
53
-
54
- $labels = array(
55
- 'name' => esc_html_x( 'Flows', 'flow general name', 'cartflows' ),
56
- 'singular_name' => esc_html_x( 'Flow', 'flow singular name', 'cartflows' ),
57
- 'search_items' => esc_html__( 'Search Flows', 'cartflows' ),
58
- 'all_items' => esc_html__( 'All Flows', 'cartflows' ),
59
- 'edit_item' => esc_html__( 'Edit Flow', 'cartflows' ),
60
- 'view_item' => esc_html__( 'View Flow', 'cartflows' ),
61
- 'add_new' => esc_html__( 'Add New', 'cartflows' ),
62
- 'update_item' => esc_html__( 'Update Flow', 'cartflows' ),
63
- 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
64
- 'new_item_name' => esc_html__( 'New Flow Name', 'cartflows' ),
65
- );
66
-
67
- $args = array(
68
- 'labels' => $labels,
69
- 'show_in_menu' => false,
70
- 'public' => false, // it's not public, not own permalink.
71
- 'publicly_queryable' => true, // you should be able to query it.
72
- 'show_ui' => true,
73
- 'query_var' => true,
74
- 'can_export' => true,
75
- 'show_in_admin_bar' => true,
76
- 'exclude_from_search' => true,
77
- 'has_archive' => false, // it shouldn't have archive page.
78
- 'rewrite' => false, // it shouldn't have rewrite rules.
79
- 'supports' => array( 'title', 'thumbnail' ),
80
- 'capability_type' => 'post',
81
- );
82
-
83
- if ( false && ! _is_cartflows_pro() ) {
84
-
85
- $flow_posts = get_posts(
86
- array(
87
- 'posts_per_page' => 4,
88
- 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
89
- 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
90
- )
91
- );
92
-
93
- if ( is_array( $flow_posts ) ) {
94
-
95
- $flow_count = count( $flow_posts );
96
-
97
- if ( $flow_count > 3 || 3 === $flow_count ) {
98
-
99
- $args['capabilities'] = array(
100
- 'create_posts' => 'do_not_allow',
101
- );
102
- $args['map_meta_cap'] = true;
103
- }
104
- }
105
- }
106
-
107
- register_post_type( CARTFLOWS_FLOW_POST_TYPE, $args );
108
- }
109
-
110
- /**
111
- * Add post raw actions
112
- *
113
- * @param array $actions actions.
114
- * @param array $post post data.
115
- * @return array
116
- */
117
- function post_row_actions( $actions, $post ) {
118
-
119
- $first_step = $this->get_first_step_url( $post );
120
-
121
- if ( $first_step && isset( $actions['view'] ) ) {
122
-
123
- $actions['view'] = '<a href="' . $first_step . '">' . __( 'View', 'cartflows' ) . '</a>';
124
- }
125
-
126
- return $actions;
127
- }
128
-
129
- /**
130
- * Returns previous post link
131
- *
132
- * @param string $prev_link previous link.
133
- * @param array $post post data.
134
- * @return string
135
- */
136
- function preview_post_link( $prev_link, $post ) {
137
-
138
- if ( $this->is_flow_post_type( $post ) ) {
139
-
140
- $first_step = $this->get_first_step_url( $post );
141
-
142
- if ( $first_step ) {
143
-
144
- return $first_step;
145
- }
146
-
147
- return '';
148
- }
149
-
150
- return $prev_link;
151
- }
152
-
153
- /**
154
- * Check if post type is flow
155
- *
156
- * @param array $post post data.
157
- * @return bool
158
- */
159
- function is_flow_post_type( $post ) {
160
-
161
- if ( isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
162
-
163
- return true;
164
- }
165
-
166
- return false;
167
- }
168
-
169
- /**
170
- * Redirect to first step
171
- *
172
- * @return void
173
- */
174
- function redirect_to_step() {
175
-
176
- global $post;
177
-
178
- $first_step = $this->get_first_step_url( $post );
179
-
180
- if ( $first_step ) {
181
-
182
- wp_redirect( $first_step );
183
- die;
184
- }
185
- }
186
-
187
- /**
188
- * Return first step URL
189
- *
190
- * @param array $post post data.
191
- * @return bool
192
- */
193
- function get_first_step_url( $post ) {
194
-
195
- if ( $this->is_flow_post_type( $post ) ) {
196
-
197
- $flow_id = $post->ID;
198
- $title = $post->post_title;
199
- $steps = get_post_meta( $flow_id, 'wcf-steps', true );
200
-
201
- if ( is_array( $steps ) && ! empty( $steps ) && isset( $steps[0]['id'] ) ) {
202
-
203
- return get_permalink( $steps[0]['id'] );
204
- }
205
- }
206
-
207
- return false;
208
- }
209
-
210
- /**
211
- * Register the admin menu for Custom Layouts
212
- *
213
- * @since 1.0.0
214
- * Moved the menu under Appearance -> Custom Layouts
215
- public function register_admin_menu() {
216
- add_submenu_page(
217
- CARTFLOWS_SLUG,
218
- __( 'Flows', 'wcf' ),
219
- __( 'Flows', 'wcf' ),
220
- 'edit_pages',
221
- 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE
222
- );
223
- }
224
- */
225
- public function register_as_submenu() {
226
-
227
- global $submenu;
228
-
229
- $submenu[ CARTFLOWS_SLUG ][0] = array(
230
- __( 'Flows', 'cartflows' ),
231
- 'edit_pages',
232
- 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE,
233
- );
234
- }
235
-
236
- /**
237
- * Add Update messages for any custom post type
238
- *
239
- * @param array $messages Array of default messages.
240
- */
241
- function custom_post_type_post_update_messages( $messages ) {
242
-
243
- $custom_post_type = get_post_type( get_the_ID() );
244
-
245
- if ( CARTFLOWS_FLOW_POST_TYPE == $custom_post_type ) {
246
-
247
- $obj = get_post_type_object( $custom_post_type );
248
- $singular_name = $obj->labels->singular_name;
249
- $messages[ $custom_post_type ] = array(
250
- 0 => '', // Unused. Messages start at index 1.
251
- /* translators: %s: singular custom post type name */
252
- 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
253
- /* translators: %s: singular custom post type name */
254
- 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
255
- /* translators: %s: singular custom post type name */
256
- 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
257
- /* translators: %s: singular custom post type name */
258
- 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
259
- /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
260
- 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,
261
- /* translators: %s: singular custom post type name */
262
- 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
263
- /* translators: %s: singular custom post type name */
264
- 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
265
- /* translators: %s: singular custom post type name */
266
- 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
267
- /* translators: %s: singular custom post type name */
268
- 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
269
- /* translators: %s: singular custom post type name */
270
- 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
271
- );
272
- }
273
-
274
- return $messages;
275
- }
276
- }
277
-
278
- /**
279
- * Kicking this off by calling 'get_instance()' method
280
- */
281
- Cartflows_Flow_Post_Type::get_instance();
1
+ <?php
2
+ /**
3
+ * Flow post type
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Flow_Post_Type {
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_action( 'init', array( $this, 'flow_post_type' ) );
39
+ add_action( 'admin_menu', array( $this, 'register_as_submenu' ), 100 );
40
+
41
+ add_filter( 'post_updated_messages', array( $this, 'custom_post_type_post_update_messages' ) );
42
+
43
+ /* View Post URL */
44
+ add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
45
+ add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 10, 2 );
46
+ add_action( 'template_redirect', array( $this, 'redirect_to_step' ), 10 );
47
+ }
48
+
49
+ /**
50
+ * Create custom post type
51
+ */
52
+ function flow_post_type() {
53
+
54
+ $labels = array(
55
+ 'name' => esc_html_x( 'Flows', 'flow general name', 'cartflows' ),
56
+ 'singular_name' => esc_html_x( 'Flow', 'flow singular name', 'cartflows' ),
57
+ 'search_items' => esc_html__( 'Search Flows', 'cartflows' ),
58
+ 'all_items' => esc_html__( 'All Flows', 'cartflows' ),
59
+ 'edit_item' => esc_html__( 'Edit Flow', 'cartflows' ),
60
+ 'view_item' => esc_html__( 'View Flow', 'cartflows' ),
61
+ 'add_new' => esc_html__( 'Add New', 'cartflows' ),
62
+ 'update_item' => esc_html__( 'Update Flow', 'cartflows' ),
63
+ 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
64
+ 'new_item_name' => esc_html__( 'New Flow Name', 'cartflows' ),
65
+ );
66
+
67
+ $args = array(
68
+ 'labels' => $labels,
69
+ 'show_in_menu' => false,
70
+ 'public' => false, // it's not public, not own permalink.
71
+ 'publicly_queryable' => true, // you should be able to query it.
72
+ 'show_ui' => true,
73
+ 'query_var' => true,
74
+ 'can_export' => true,
75
+ 'show_in_admin_bar' => true,
76
+ 'exclude_from_search' => true,
77
+ 'has_archive' => false, // it shouldn't have archive page.
78
+ 'rewrite' => false, // it shouldn't have rewrite rules.
79
+ 'supports' => array( 'title', 'thumbnail' ),
80
+ 'capability_type' => 'post',
81
+ );
82
+
83
+ if ( false && ! _is_cartflows_pro() ) {
84
+
85
+ $flow_posts = get_posts(
86
+ array(
87
+ 'posts_per_page' => 4,
88
+ 'post_type' => CARTFLOWS_FLOW_POST_TYPE,
89
+ 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
90
+ )
91
+ );
92
+
93
+ if ( is_array( $flow_posts ) ) {
94
+
95
+ $flow_count = count( $flow_posts );
96
+
97
+ if ( $flow_count > 3 || 3 === $flow_count ) {
98
+
99
+ $args['capabilities'] = array(
100
+ 'create_posts' => 'do_not_allow',
101
+ );
102
+ $args['map_meta_cap'] = true;
103
+ }
104
+ }
105
+ }
106
+
107
+ register_post_type( CARTFLOWS_FLOW_POST_TYPE, $args );
108
+ }
109
+
110
+ /**
111
+ * Add post raw actions
112
+ *
113
+ * @param array $actions actions.
114
+ * @param array $post post data.
115
+ * @return array
116
+ */
117
+ function post_row_actions( $actions, $post ) {
118
+
119
+ $first_step = $this->get_first_step_url( $post );
120
+
121
+ if ( $first_step && isset( $actions['view'] ) ) {
122
+
123
+ $actions['view'] = '<a href="' . $first_step . '">' . __( 'View', 'cartflows' ) . '</a>';
124
+ }
125
+
126
+ return $actions;
127
+ }
128
+
129
+ /**
130
+ * Returns previous post link
131
+ *
132
+ * @param string $prev_link previous link.
133
+ * @param array $post post data.
134
+ * @return string
135
+ */
136
+ function preview_post_link( $prev_link, $post ) {
137
+
138
+ if ( $this->is_flow_post_type( $post ) ) {
139
+
140
+ $first_step = $this->get_first_step_url( $post );
141
+
142
+ if ( $first_step ) {
143
+
144
+ return $first_step;
145
+ }
146
+
147
+ return '';
148
+ }
149
+
150
+ return $prev_link;
151
+ }
152
+
153
+ /**
154
+ * Check if post type is flow
155
+ *
156
+ * @param array $post post data.
157
+ * @return bool
158
+ */
159
+ function is_flow_post_type( $post ) {
160
+
161
+ if ( isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
162
+
163
+ return true;
164
+ }
165
+
166
+ return false;
167
+ }
168
+
169
+ /**
170
+ * Redirect to first step
171
+ *
172
+ * @return void
173
+ */
174
+ function redirect_to_step() {
175
+
176
+ global $post;
177
+
178
+ $first_step = $this->get_first_step_url( $post );
179
+
180
+ if ( $first_step ) {
181
+
182
+ wp_redirect( $first_step );
183
+ die;
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Return first step URL
189
+ *
190
+ * @param array $post post data.
191
+ * @return bool
192
+ */
193
+ function get_first_step_url( $post ) {
194
+
195
+ if ( $this->is_flow_post_type( $post ) ) {
196
+
197
+ $flow_id = $post->ID;
198
+ $title = $post->post_title;
199
+ $steps = get_post_meta( $flow_id, 'wcf-steps', true );
200
+
201
+ if ( is_array( $steps ) && ! empty( $steps ) && isset( $steps[0]['id'] ) ) {
202
+
203
+ return get_permalink( $steps[0]['id'] );
204
+ }
205
+ }
206
+
207
+ return false;
208
+ }
209
+
210
+ /**
211
+ * Register the admin menu for Custom Layouts
212
+ *
213
+ * @since 1.0.0
214
+ * Moved the menu under Appearance -> Custom Layouts
215
+ public function register_admin_menu() {
216
+ add_submenu_page(
217
+ CARTFLOWS_SLUG,
218
+ __( 'Flows', 'wcf' ),
219
+ __( 'Flows', 'wcf' ),
220
+ 'edit_pages',
221
+ 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE
222
+ );
223
+ }
224
+ */
225
+ public function register_as_submenu() {
226
+
227
+ global $submenu;
228
+
229
+ $submenu[ CARTFLOWS_SLUG ][0] = array(
230
+ __( 'Flows', 'cartflows' ),
231
+ 'edit_pages',
232
+ 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE,
233
+ );
234
+ }
235
+
236
+ /**
237
+ * Add Update messages for any custom post type
238
+ *
239
+ * @param array $messages Array of default messages.
240
+ */
241
+ function custom_post_type_post_update_messages( $messages ) {
242
+
243
+ $custom_post_type = get_post_type( get_the_ID() );
244
+
245
+ if ( CARTFLOWS_FLOW_POST_TYPE == $custom_post_type ) {
246
+
247
+ $obj = get_post_type_object( $custom_post_type );
248
+ $singular_name = $obj->labels->singular_name;
249
+ $messages[ $custom_post_type ] = array(
250
+ 0 => '', // Unused. Messages start at index 1.
251
+ /* translators: %s: singular custom post type name */
252
+ 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
253
+ /* translators: %s: singular custom post type name */
254
+ 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
255
+ /* translators: %s: singular custom post type name */
256
+ 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
257
+ /* translators: %s: singular custom post type name */
258
+ 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
259
+ /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
260
+ 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,
261
+ /* translators: %s: singular custom post type name */
262
+ 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
263
+ /* translators: %s: singular custom post type name */
264
+ 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
265
+ /* translators: %s: singular custom post type name */
266
+ 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
267
+ /* translators: %s: singular custom post type name */
268
+ 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
269
+ /* translators: %s: singular custom post type name */
270
+ 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
271
+ );
272
+ }
273
+
274
+ return $messages;
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Kicking this off by calling 'get_instance()' method
280
+ */
281
+ Cartflows_Flow_Post_Type::get_instance();
modules/flow/classes/class-cartflows-step-post-type.php CHANGED
@@ -1,486 +1,486 @@
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_Step_Post_Type {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Member Variable
25
- *
26
- * @var body_classes
27
- */
28
- private $body_classes = array();
29
-
30
- /**
31
- * Initiator
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- */
43
- public function __construct() {
44
-
45
- add_action( 'init', array( $this, 'step_post_type' ) );
46
- add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
- add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
- add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
- add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
- add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
51
-
52
- add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
- add_filter( 'template_redirect', array( $this, 'query_fix' ), 3 );
54
- }
55
-
56
-
57
- /**
58
- * Trys to load page.php for a header, footer or part theme layout.
59
- *
60
- * @since 1.0.0
61
- * @param string $template The current template to be loaded.
62
- * @return string
63
- */
64
- function load_page_template( $template ) {
65
-
66
- global $post;
67
-
68
- if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
69
-
70
- /**
71
- * Remove Next/Prev Navigation
72
- * add_filter('next_post_link', '__return_empty_string');
73
- * add_filter('previous_post_link', '__return_empty_string');
74
- *
75
- * $page = locate_template( array( 'page.php' ) );
76
- *
77
- * if ( ! empty( $page ) ) {
78
- * return $page;
79
- * }
80
- */
81
-
82
- /* Remove Next / Previous Rel Link */
83
- remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
84
- add_filter( 'next_post_rel_link', '__return_empty_string' );
85
- add_filter( 'previous_post_rel_link', '__return_empty_string' );
86
-
87
- $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
88
-
89
- $page_template = apply_filters( 'cartflows_page_template', $page_template );
90
-
91
- $file = '';
92
-
93
- switch ( $page_template ) {
94
-
95
- case 'cartflows-default':
96
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
97
- $this->body_classes[] = $page_template;
98
- break;
99
- case 'cartflows-canvas':
100
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
101
- $this->body_classes[] = $page_template;
102
- break;
103
- default:
104
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
105
- $this->body_classes[] = 'cartflows-default';
106
- break;
107
- }
108
-
109
- // Just to be safe, we check if the file exist first.
110
- if ( file_exists( $file ) ) {
111
-
112
- /* Add Body Class */
113
- add_filter( 'body_class', [ $this, 'body_class' ] );
114
-
115
- return $file;
116
- } else {
117
- echo $file;
118
- }
119
- }
120
-
121
- return $template;
122
- }
123
-
124
- /**
125
- * Body classes.
126
- *
127
- * @since 1.0.0
128
- * @param array $classes Body classes.
129
- * @return array
130
- */
131
- function body_class( $classes = [] ) {
132
-
133
- $classes = array_merge( $classes, $this->body_classes );
134
-
135
- return $classes;
136
- }
137
-
138
- /**
139
- * Create custom post type
140
- */
141
- function step_post_type() {
142
-
143
- $labels = array(
144
- 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
145
- 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
146
- 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
147
- 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
148
- 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
149
- 'view_item' => esc_html__( 'View Step', 'cartflows' ),
150
- 'add_new' => esc_html__( 'Add New', 'cartflows' ),
151
- 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
152
- 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
153
- 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
154
- );
155
-
156
- $args = array(
157
- 'labels' => $labels,
158
- 'public' => true,
159
- 'query_var' => true,
160
- 'can_export' => true,
161
- 'exclude_from_search' => true,
162
- 'show_ui' => true,
163
- 'show_in_menu' => false,
164
- 'show_in_admin_bar' => true,
165
- 'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
166
- 'capability_type' => 'post',
167
- 'capabilities' => array(
168
- 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
169
- ),
170
- 'map_meta_cap' => true,
171
- );
172
-
173
- register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
174
-
175
- $args = array(
176
- 'label' => __( 'Step Type', 'cartflows' ),
177
- 'public' => false,
178
- 'rewrite' => false,
179
- 'hierarchical' => false,
180
- );
181
-
182
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
183
-
184
- $args = array(
185
- 'label' => __( 'Step Flow', 'cartflows' ),
186
- 'public' => false,
187
- 'rewrite' => false,
188
- 'hierarchical' => false,
189
- );
190
-
191
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
192
-
193
- /**
194
- * Register 'Elementor' & 'Beaver Builder' site types.
195
- *
196
- * @see self::add_terms();
197
- */
198
- $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
199
-
200
- $terms = array(
201
- array(
202
- 'name' => __( 'Landing', 'cartflows' ),
203
- 'args' => array(
204
- 'slug' => 'landing',
205
- ),
206
- ),
207
- array(
208
- 'name' => __( 'Checkout', 'cartflows' ),
209
- 'args' => array(
210
- 'slug' => 'checkout',
211
- ),
212
- ),
213
- array(
214
- 'name' => __( 'Thank You', 'cartflows' ),
215
- 'args' => array(
216
- 'slug' => 'thankyou',
217
- ),
218
- ),
219
- array(
220
- 'name' => __( 'Upsell', 'cartflows' ),
221
- 'args' => array(
222
- 'slug' => 'upsell',
223
- ),
224
- ),
225
- array(
226
- 'name' => __( 'Downsell', 'cartflows' ),
227
- 'args' => array(
228
- 'slug' => 'downsell',
229
- ),
230
- ),
231
- );
232
-
233
- $this->add_terms( $taxonomy, $terms );
234
- }
235
-
236
- /**
237
- * Add WordPress templates.
238
- *
239
- * Adds Cartflows templates to steps
240
- *
241
- * @since 1.0.0
242
- * @access public
243
- */
244
- function add_wp_templates_support() {
245
- add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
246
- }
247
-
248
- /**
249
- * Add page templates.
250
- *
251
- * @since 1.0.0
252
- * @access public
253
- *
254
- * @param array $page_templates Array of page templates.
255
- *
256
- * @param object $wp_theme wp theme.
257
- * @param object $post post.
258
- *
259
- * @return array Page templates.
260
- */
261
- function add_page_templates( $page_templates, $wp_theme, $post ) {
262
-
263
- $page_templates = array(
264
- 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
265
- );
266
-
267
- return $page_templates;
268
- }
269
-
270
- /**
271
- * Have WordPress match postname to any of our public post types.
272
- * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
273
- * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
274
- *
275
- * @param string $query query statement.
276
- */
277
- function add_cpt_post_names_to_main_query( $query ) {
278
-
279
- // Bail if this is not the main query.
280
- if ( ! $query->is_main_query() ) {
281
- return;
282
- }
283
-
284
- // Bail if this query doesn't match our very specific rewrite rule.
285
- if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
286
- return;
287
- }
288
-
289
- // Bail if we're not querying based on the post name.
290
- if ( empty( $query->query['name'] ) ) {
291
- return;
292
- }
293
-
294
- // Add cartflows step post type to existing post type array.
295
- if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
296
-
297
- $post_types = $query->query_vars['post_type'];
298
-
299
- $post_types[] = CARTFLOWS_STEP_POST_TYPE;
300
-
301
- $query->set( 'post_type', $post_types );
302
-
303
- } else {
304
-
305
- // Add CPT to the list of post types WP will include when it queries based on the post name.
306
- $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
307
- }
308
- }
309
-
310
- /**
311
- * Query fixe throwing error on 404 page due our post type changes.
312
- * We are setting post_type as empty array to fix the issue.
313
- * Ther error was throwing due to redirect_canonical function
314
- * This fix is apply for 404 page only
315
- */
316
- function query_fix() {
317
-
318
- global $wp_query;
319
-
320
- if ( $wp_query->is_404() ) {
321
- $wp_query->set( 'post_type', array() );
322
- }
323
- }
324
-
325
- /**
326
- * Modify permalink
327
- *
328
- * @param string $post_link post link.
329
- * @param array $post post data.
330
- * @param string $leavename leave name.
331
- * @return string
332
- */
333
- function post_type_permalinks( $post_link, $post, $leavename ) {
334
-
335
- // If elementor page preview, return post link as it is.
336
- if ( isset( $_REQUEST['elementor-preview'] ) ) {
337
- return $post_link;
338
- }
339
-
340
- $structure = get_option( 'permalink_structure' );
341
-
342
- if ( '/%postname%/' === $structure ) {
343
-
344
- if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
345
-
346
- $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
347
- }
348
- }
349
-
350
- return $post_link;
351
- }
352
-
353
- /**
354
- * Prevent slug duplicated
355
- *
356
- * @param string $slug post slug.
357
- * @param int $post_ID post id.
358
- * @param string $post_status post status.
359
- * @param string $post_type post type.
360
- * @param int $post_parent post parent id.
361
- * @param string $original_slug original slug.
362
- * @return string
363
- */
364
- function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
365
-
366
- $check_post_types = array(
367
- 'post',
368
- 'page',
369
- CARTFLOWS_STEP_POST_TYPE,
370
- );
371
-
372
- if ( ! in_array( $post_type, $check_post_types ) ) {
373
- return $slug;
374
- }
375
-
376
- if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
377
- // Saving a post, check for duplicates in POST or PAGE post types.
378
- $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
379
- $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
380
-
381
- if ( $post_match || $page_match ) {
382
- $slug .= '-2';
383
- }
384
- } else {
385
-
386
- // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
387
- $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
388
-
389
- if ( $custom_post_type_match ) {
390
- $slug .= '-2';
391
- }
392
- }
393
-
394
- return $slug;
395
- }
396
-
397
- /**
398
- * Add Update messages for any custom post type
399
- *
400
- * @param array $messages Array of default messages.
401
- */
402
- function post_update_messages( $messages ) {
403
-
404
- $custom_post_type = get_post_type( get_the_ID() );
405
-
406
- if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
407
-
408
- $obj = get_post_type_object( $custom_post_type );
409
- $singular_name = $obj->labels->singular_name;
410
- $messages[ $custom_post_type ] = array(
411
- 0 => '', // Unused. Messages start at index 1.
412
- /* translators: %s: singular custom post type name */
413
- 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
414
- /* translators: %s: singular custom post type name */
415
- 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
416
- /* translators: %s: singular custom post type name */
417
- 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
418
- /* translators: %s: singular custom post type name */
419
- 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
420
- /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
421
- 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,
422
- /* translators: %s: singular custom post type name */
423
- 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
424
- /* translators: %s: singular custom post type name */
425
- 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
426
- /* translators: %s: singular custom post type name */
427
- 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
428
- /* translators: %s: singular custom post type name */
429
- 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
430
- /* translators: %s: singular custom post type name */
431
- 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
432
- );
433
- }
434
-
435
- return $messages;
436
- }
437
-
438
- /**
439
- * Add Terms for Taxonomy.
440
- *
441
- * => Example.
442
- *
443
- * $taxonomy = '{taxonomy}';
444
- * $terms = array(
445
- * array(
446
- * 'name' => 'Free',
447
- * ),
448
- * array(
449
- * 'name' => 'Premium',
450
- * ),
451
- * );
452
- *
453
- * self::add_terms( $taxonomy, $terms );
454
- *
455
- * @since 1.0.0
456
- * @param string $taxonomy Taxonomy Name.
457
- * @param array $terms Terms list.
458
- * @return void
459
- */
460
- function add_terms( $taxonomy = '', $terms = array() ) {
461
-
462
- foreach ( $terms as $key => $term ) {
463
-
464
- $term_exist = term_exists( $term['name'], $taxonomy );
465
-
466
- if ( empty( $term_exist ) ) {
467
-
468
- /**
469
- * Add additional args if passed from request.
470
- *
471
- * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
472
- */
473
- if ( array_key_exists( 'args', $term ) ) {
474
- wp_insert_term( $term['name'], $taxonomy, $term['args'] );
475
- } else {
476
- wp_insert_term( $term['name'], $taxonomy );
477
- }
478
- }
479
- }
480
- }
481
- }
482
-
483
- /**
484
- * Kicking this off by calling 'get_instance()' method
485
- */
486
- Cartflows_Step_Post_Type::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_Step_Post_Type {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Member Variable
25
+ *
26
+ * @var body_classes
27
+ */
28
+ private $body_classes = array();
29
+
30
+ /**
31
+ * Initiator
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ */
43
+ public function __construct() {
44
+
45
+ add_action( 'init', array( $this, 'step_post_type' ) );
46
+ add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
+ add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
+ add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
+ add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
+ add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
51
+
52
+ add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
+ add_filter( 'template_redirect', array( $this, 'query_fix' ), 3 );
54
+ }
55
+
56
+
57
+ /**
58
+ * Trys to load page.php for a header, footer or part theme layout.
59
+ *
60
+ * @since 1.0.0
61
+ * @param string $template The current template to be loaded.
62
+ * @return string
63
+ */
64
+ function load_page_template( $template ) {
65
+
66
+ global $post;
67
+
68
+ if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
69
+
70
+ /**
71
+ * Remove Next/Prev Navigation
72
+ * add_filter('next_post_link', '__return_empty_string');
73
+ * add_filter('previous_post_link', '__return_empty_string');
74
+ *
75
+ * $page = locate_template( array( 'page.php' ) );
76
+ *
77
+ * if ( ! empty( $page ) ) {
78
+ * return $page;
79
+ * }
80
+ */
81
+
82
+ /* Remove Next / Previous Rel Link */
83
+ remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
84
+ add_filter( 'next_post_rel_link', '__return_empty_string' );
85
+ add_filter( 'previous_post_rel_link', '__return_empty_string' );
86
+
87
+ $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
88
+
89
+ $page_template = apply_filters( 'cartflows_page_template', $page_template );
90
+
91
+ $file = '';
92
+
93
+ switch ( $page_template ) {
94
+
95
+ case 'cartflows-default':
96
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
97
+ $this->body_classes[] = $page_template;
98
+ break;
99
+ case 'cartflows-canvas':
100
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
101
+ $this->body_classes[] = $page_template;
102
+ break;
103
+ default:
104
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
105
+ $this->body_classes[] = 'cartflows-default';
106
+ break;
107
+ }
108
+
109
+ // Just to be safe, we check if the file exist first.
110
+ if ( file_exists( $file ) ) {
111
+
112
+ /* Add Body Class */
113
+ add_filter( 'body_class', [ $this, 'body_class' ] );
114
+
115
+ return $file;
116
+ } else {
117
+ echo $file;
118
+ }
119
+ }
120
+
121
+ return $template;
122
+ }
123
+
124
+ /**
125
+ * Body classes.
126
+ *
127
+ * @since 1.0.0
128
+ * @param array $classes Body classes.
129
+ * @return array
130
+ */
131
+ function body_class( $classes = [] ) {
132
+
133
+ $classes = array_merge( $classes, $this->body_classes );
134
+
135
+ return $classes;
136
+ }
137
+
138
+ /**
139
+ * Create custom post type
140
+ */
141
+ function step_post_type() {
142
+
143
+ $labels = array(
144
+ 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
145
+ 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
146
+ 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
147
+ 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
148
+ 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
149
+ 'view_item' => esc_html__( 'View Step', 'cartflows' ),
150
+ 'add_new' => esc_html__( 'Add New', 'cartflows' ),
151
+ 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
152
+ 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
153
+ 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
154
+ );
155
+
156
+ $args = array(
157
+ 'labels' => $labels,
158
+ 'public' => true,
159
+ 'query_var' => true,
160
+ 'can_export' => true,
161
+ 'exclude_from_search' => true,
162
+ 'show_ui' => true,
163
+ 'show_in_menu' => false,
164
+ 'show_in_admin_bar' => true,
165
+ 'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
166
+ 'capability_type' => 'post',
167
+ 'capabilities' => array(
168
+ 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
169
+ ),
170
+ 'map_meta_cap' => true,
171
+ );
172
+
173
+ register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
174
+
175
+ $args = array(
176
+ 'label' => __( 'Step Type', 'cartflows' ),
177
+ 'public' => false,
178
+ 'rewrite' => false,
179
+ 'hierarchical' => false,
180
+ );
181
+
182
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
183
+
184
+ $args = array(
185
+ 'label' => __( 'Step Flow', 'cartflows' ),
186
+ 'public' => false,
187
+ 'rewrite' => false,
188
+ 'hierarchical' => false,
189
+ );
190
+
191
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
192
+
193
+ /**
194
+ * Register 'Elementor' & 'Beaver Builder' site types.
195
+ *
196
+ * @see self::add_terms();
197
+ */
198
+ $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
199
+
200
+ $terms = array(
201
+ array(
202
+ 'name' => __( 'Landing', 'cartflows' ),
203
+ 'args' => array(
204
+ 'slug' => 'landing',
205
+ ),
206
+ ),
207
+ array(
208
+ 'name' => __( 'Checkout', 'cartflows' ),
209
+ 'args' => array(
210
+ 'slug' => 'checkout',
211
+ ),
212
+ ),
213
+ array(
214
+ 'name' => __( 'Thank You', 'cartflows' ),
215
+ 'args' => array(
216
+ 'slug' => 'thankyou',
217
+ ),
218
+ ),
219
+ array(
220
+ 'name' => __( 'Upsell', 'cartflows' ),
221
+ 'args' => array(
222
+ 'slug' => 'upsell',
223
+ ),
224
+ ),
225
+ array(
226
+ 'name' => __( 'Downsell', 'cartflows' ),
227
+ 'args' => array(
228
+ 'slug' => 'downsell',
229
+ ),
230
+ ),
231
+ );
232
+
233
+ $this->add_terms( $taxonomy, $terms );
234
+ }
235
+
236
+ /**
237
+ * Add WordPress templates.
238
+ *
239
+ * Adds Cartflows templates to steps
240
+ *
241
+ * @since 1.0.0
242
+ * @access public
243
+ */
244
+ function add_wp_templates_support() {
245
+ add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
246
+ }
247
+
248
+ /**
249
+ * Add page templates.
250
+ *
251
+ * @since 1.0.0
252
+ * @access public
253
+ *
254
+ * @param array $page_templates Array of page templates.
255
+ *
256
+ * @param object $wp_theme wp theme.
257
+ * @param object $post post.
258
+ *
259
+ * @return array Page templates.
260
+ */
261
+ function add_page_templates( $page_templates, $wp_theme, $post ) {
262
+
263
+ $page_templates = array(
264
+ 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
265
+ );
266
+
267
+ return $page_templates;
268
+ }
269
+
270
+ /**
271
+ * Have WordPress match postname to any of our public post types.
272
+ * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
273
+ * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
274
+ *
275
+ * @param string $query query statement.
276
+ */
277
+ function add_cpt_post_names_to_main_query( $query ) {
278
+
279
+ // Bail if this is not the main query.
280
+ if ( ! $query->is_main_query() ) {
281
+ return;
282
+ }
283
+
284
+ // Bail if this query doesn't match our very specific rewrite rule.
285
+ if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
286
+ return;
287
+ }
288
+
289
+ // Bail if we're not querying based on the post name.
290
+ if ( empty( $query->query['name'] ) ) {
291
+ return;
292
+ }
293
+
294
+ // Add cartflows step post type to existing post type array.
295
+ if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
296
+
297
+ $post_types = $query->query_vars['post_type'];
298
+
299
+ $post_types[] = CARTFLOWS_STEP_POST_TYPE;
300
+
301
+ $query->set( 'post_type', $post_types );
302
+
303
+ } else {
304
+
305
+ // Add CPT to the list of post types WP will include when it queries based on the post name.
306
+ $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Query fixe throwing error on 404 page due our post type changes.
312
+ * We are setting post_type as empty array to fix the issue.
313
+ * Ther error was throwing due to redirect_canonical function
314
+ * This fix is apply for 404 page only
315
+ */
316
+ function query_fix() {
317
+
318
+ global $wp_query;
319
+
320
+ if ( $wp_query->is_404() ) {
321
+ $wp_query->set( 'post_type', array() );
322
+ }
323
+ }
324
+
325
+ /**
326
+ * Modify permalink
327
+ *
328
+ * @param string $post_link post link.
329
+ * @param array $post post data.
330
+ * @param string $leavename leave name.
331
+ * @return string
332
+ */
333
+ function post_type_permalinks( $post_link, $post, $leavename ) {
334
+
335
+ // If elementor page preview, return post link as it is.
336
+ if ( isset( $_REQUEST['elementor-preview'] ) ) {
337
+ return $post_link;
338
+ }
339
+
340
+ $structure = get_option( 'permalink_structure' );
341
+
342
+ if ( '/%postname%/' === $structure ) {
343
+
344
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
345
+
346
+ $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
347
+ }
348
+ }
349
+
350
+ return $post_link;
351
+ }
352
+
353
+ /**
354
+ * Prevent slug duplicated
355
+ *
356
+ * @param string $slug post slug.
357
+ * @param int $post_ID post id.
358
+ * @param string $post_status post status.
359
+ * @param string $post_type post type.
360
+ * @param int $post_parent post parent id.
361
+ * @param string $original_slug original slug.
362
+ * @return string
363
+ */
364
+ function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
365
+
366
+ $check_post_types = array(
367
+ 'post',
368
+ 'page',
369
+ CARTFLOWS_STEP_POST_TYPE,
370
+ );
371
+
372
+ if ( ! in_array( $post_type, $check_post_types ) ) {
373
+ return $slug;
374
+ }
375
+
376
+ if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
377
+ // Saving a post, check for duplicates in POST or PAGE post types.
378
+ $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
379
+ $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
380
+
381
+ if ( $post_match || $page_match ) {
382
+ $slug .= '-2';
383
+ }
384
+ } else {
385
+
386
+ // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
387
+ $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
388
+
389
+ if ( $custom_post_type_match ) {
390
+ $slug .= '-2';
391
+ }
392
+ }
393
+
394
+ return $slug;
395
+ }
396
+
397
+ /**
398
+ * Add Update messages for any custom post type
399
+ *
400
+ * @param array $messages Array of default messages.
401
+ */
402
+ function post_update_messages( $messages ) {
403
+
404
+ $custom_post_type = get_post_type( get_the_ID() );
405
+
406
+ if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
407
+
408
+ $obj = get_post_type_object( $custom_post_type );
409
+ $singular_name = $obj->labels->singular_name;
410
+ $messages[ $custom_post_type ] = array(
411
+ 0 => '', // Unused. Messages start at index 1.
412
+ /* translators: %s: singular custom post type name */
413
+ 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
414
+ /* translators: %s: singular custom post type name */
415
+ 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
416
+ /* translators: %s: singular custom post type name */
417
+ 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
418
+ /* translators: %s: singular custom post type name */
419
+ 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
420
+ /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
421
+ 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,
422
+ /* translators: %s: singular custom post type name */
423
+ 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
424
+ /* translators: %s: singular custom post type name */
425
+ 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
426
+ /* translators: %s: singular custom post type name */
427
+ 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
428
+ /* translators: %s: singular custom post type name */
429
+ 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
430
+ /* translators: %s: singular custom post type name */
431
+ 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
432
+ );
433
+ }
434
+
435
+ return $messages;
436
+ }
437
+
438
+ /**
439
+ * Add Terms for Taxonomy.
440
+ *
441
+ * => Example.
442
+ *
443
+ * $taxonomy = '{taxonomy}';
444
+ * $terms = array(
445
+ * array(
446
+ * 'name' => 'Free',
447
+ * ),
448
+ * array(
449
+ * 'name' => 'Premium',
450
+ * ),
451
+ * );
452
+ *
453
+ * self::add_terms( $taxonomy, $terms );
454
+ *
455
+ * @since 1.0.0
456
+ * @param string $taxonomy Taxonomy Name.
457
+ * @param array $terms Terms list.
458
+ * @return void
459
+ */
460
+ function add_terms( $taxonomy = '', $terms = array() ) {
461
+
462
+ foreach ( $terms as $key => $term ) {
463
+
464
+ $term_exist = term_exists( $term['name'], $taxonomy );
465
+
466
+ if ( empty( $term_exist ) ) {
467
+
468
+ /**
469
+ * Add additional args if passed from request.
470
+ *
471
+ * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
472
+ */
473
+ if ( array_key_exists( 'args', $term ) ) {
474
+ wp_insert_term( $term['name'], $taxonomy, $term['args'] );
475
+ } else {
476
+ wp_insert_term( $term['name'], $taxonomy );
477
+ }
478
+ }
479
+ }
480
+ }
481
+ }
482
+
483
+ /**
484
+ * Kicking this off by calling 'get_instance()' method
485
+ */
486
+ Cartflows_Step_Post_Type::get_instance();
modules/flow/templates/template-canvas.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
- /**
3
- * Template Name: No Header Footer
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
-
10
- <!DOCTYPE html>
11
- <html <?php language_attributes(); ?> class="no-js">
12
- <head>
13
- <meta charset="<?php bloginfo( 'charset' ); ?>">
14
- <meta name="viewport" content="width=device-width, initial-scale=1">
15
- <link rel="profile" href="http://gmpg.org/xfn/11">
16
- <?php wp_head(); ?>
17
- </head>
18
-
19
- <body <?php body_class(); ?>>
20
-
21
- <?php do_action( 'cartflows_body_top' ); ?>
22
-
23
- <?php
24
-
25
- $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
-
27
- ?>
28
- <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
-
30
- <?php
31
- do_action( 'cartflows_container_top' );
32
- while ( have_posts() ) :
33
-
34
- the_post();
35
- the_content();
36
-
37
- endwhile;
38
- do_action( 'cartflows_container_bottom' );
39
- ?>
40
- </div>
41
-
42
- <?php do_action( 'cartflows_wp_footer' ); ?>
43
-
44
- <?php wp_footer(); ?>
45
- </body>
46
-
47
- </html>
48
-
49
- <?php
1
+ <?php
2
+ /**
3
+ * Template Name: No Header Footer
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+
10
+ <!DOCTYPE html>
11
+ <html <?php language_attributes(); ?> class="no-js">
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <link rel="profile" href="http://gmpg.org/xfn/11">
16
+ <?php wp_head(); ?>
17
+ </head>
18
+
19
+ <body <?php body_class(); ?>>
20
+
21
+ <?php do_action( 'cartflows_body_top' ); ?>
22
+
23
+ <?php
24
+
25
+ $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
+
27
+ ?>
28
+ <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
+
30
+ <?php
31
+ do_action( 'cartflows_container_top' );
32
+ while ( have_posts() ) :
33
+
34
+ the_post();
35
+ the_content();
36
+
37
+ endwhile;
38
+ do_action( 'cartflows_container_bottom' );
39
+ ?>
40
+ </div>
41
+
42
+ <?php do_action( 'cartflows_wp_footer' ); ?>
43
+
44
+ <?php wp_footer(); ?>
45
+ </body>
46
+
47
+ </html>
48
+
49
+ <?php
modules/flow/templates/template-default.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
- /**
3
- * Template Name: No Header Footer
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- ?>
9
-
10
- <!DOCTYPE html>
11
- <html <?php language_attributes(); ?> class="no-js">
12
- <head>
13
- <meta charset="<?php bloginfo( 'charset' ); ?>">
14
- <meta name="viewport" content="width=device-width, initial-scale=1">
15
- <link rel="profile" href="http://gmpg.org/xfn/11">
16
- <?php wp_head(); ?>
17
- </head>
18
-
19
- <body <?php body_class(); ?>>
20
-
21
- <?php do_action( 'cartflows_body_top' ); ?>
22
-
23
- <?php
24
-
25
- $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
-
27
- ?>
28
- <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
- <?php
30
- do_action( 'cartflows_container_top' );
31
- ?>
32
- <div class="cartflows-primary">
33
- <?php
34
- while ( have_posts() ) :
35
-
36
- the_post();
37
- the_content();
38
-
39
- endwhile;
40
- ?>
41
- </div>
42
- <?php
43
- do_action( 'cartflows_container_bottom' );
44
- ?>
45
- </div>
46
-
47
- <?php do_action( 'cartflows_wp_footer' ); ?>
48
-
49
- <?php wp_footer(); ?>
50
- </body>
51
-
52
- </html>
53
-
54
- <?php
1
+ <?php
2
+ /**
3
+ * Template Name: No Header Footer
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ ?>
9
+
10
+ <!DOCTYPE html>
11
+ <html <?php language_attributes(); ?> class="no-js">
12
+ <head>
13
+ <meta charset="<?php bloginfo( 'charset' ); ?>">
14
+ <meta name="viewport" content="width=device-width, initial-scale=1">
15
+ <link rel="profile" href="http://gmpg.org/xfn/11">
16
+ <?php wp_head(); ?>
17
+ </head>
18
+
19
+ <body <?php body_class(); ?>>
20
+
21
+ <?php do_action( 'cartflows_body_top' ); ?>
22
+
23
+ <?php
24
+
25
+ $atts_string = Cartflows_Helper::get_cartflows_container_atts();
26
+
27
+ ?>
28
+ <div class="cartflows-container" <?php echo trim( $atts_string ); ?>>
29
+ <?php
30
+ do_action( 'cartflows_container_top' );
31
+ ?>
32
+ <div class="cartflows-primary">
33
+ <?php
34
+ while ( have_posts() ) :
35
+
36
+ the_post();
37
+ the_content();
38
+
39
+ endwhile;
40
+ ?>
41
+ </div>
42
+ <?php
43
+ do_action( 'cartflows_container_bottom' );
44
+ ?>
45
+ </div>
46
+
47
+ <?php do_action( 'cartflows_wp_footer' ); ?>
48
+
49
+ <?php wp_footer(); ?>
50
+ </body>
51
+
52
+ </html>
53
+
54
+ <?php
modules/flow/view/meta-flow-steps.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
- /**
3
- * View Flow steps
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
9
-
10
- $get_steps = array(
11
- 'landing' => __( 'Landing', 'cartflows' ),
12
- 'checkout' => __( 'Checkout', 'cartflows' ),
13
- 'thankyou' => __( 'Thank You', 'cartflows' ),
14
- 'upsell' => __( 'Upsell', 'cartflows' ),
15
- 'downsell' => __( 'Downsell', 'cartflows' ),
16
-
17
- );
18
-
19
- ?>
20
- <div class="wcf-flow-steps-meta-box">
21
- <div class="wcf-flow-settings">
22
- <?php do_action( 'cartflows_above_flow_steps' ); ?>
23
- <div class="wcf-flow-steps-wrap">
24
- <div class="wcf-flow-steps-container">
25
- <?php if ( is_array( $options['steps'] ) ) { ?>
26
- <?php foreach ( $options['steps'] as $index => $data ) { ?>
27
- <?php
28
- $term_slug = '';
29
- $term_name = '';
30
- $step_wrap_class = '';
31
- $has_product_assigned = true;
32
- $is_global_checkout = '';
33
- $common = '';
34
-
35
- if ( isset( $data['type'] ) ) {
36
- $term_slug = $data['type'];
37
- $term_name = $get_steps[ $data['type'] ];
38
- }
39
-
40
- if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
41
- $step_wrap_class .= ' invalid-step';
42
- }
43
-
44
- if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
45
- $step_wrap_class .= ' wcf-new-step-highlight';
46
- }
47
-
48
- if ( 'checkout' === $term_slug ) {
49
-
50
- $common = Cartflows_Helper::get_common_settings();
51
-
52
- $is_global_checkout = (int) $common['global_checkout'];
53
-
54
- if ( $data['id'] === $is_global_checkout ) {
55
- $step_wrap_class .= ' wcf-global-checkout';
56
- }
57
- }
58
-
59
- if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
60
-
61
- $has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
62
-
63
- if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
64
- $step_wrap_class .= ' wcf-no-product-step';
65
- }
66
- }
67
-
68
- ?>
69
- <div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
70
- <div class="wcf-step">
71
- <div class="wcf-step-left-content">
72
- <span class="dashicons dashicons-menu"></span>
73
- <span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
74
- <span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
75
-
76
- <?php
77
- if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
78
- ?>
79
- <span class="wcf-no-product-badge"><?php _e( 'No Product Assigned', 'cartflows' ); ?></span>
80
- <?php
81
- } elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
82
- ?>
83
- <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout - Remove selected checkout product', 'cartflows' ); ?></span>
84
- <?php
85
- } elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
86
- ?>
87
- <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout', 'cartflows' ); ?></span>
88
- <?php
89
- }
90
- ?>
91
-
92
- <input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
93
- </div>
94
- <div class="wcf-steps-action-buttons">
95
- <a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'View Step', 'cartflows' ); ?>" >
96
- <span class="dashicons dashicons-visibility"></span>
97
- <span class="wcf-step-act-btn-text">View</span>
98
- </a>
99
- <a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Edit Step', 'cartflows' ); ?>" >
100
- <span class="dashicons dashicons-edit"></span>
101
- <span class="wcf-step-act-btn-text">Edit</span>
102
- </a>
103
- <a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Clone Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
104
- <span class="dashicons dashicons-admin-page"></span>
105
- <span class="wcf-step-act-btn-text">Clone</span>
106
- </a>
107
- <a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Delete Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
108
- <span class="dashicons dashicons-trash"></span>
109
- <span class="wcf-step-act-btn-text">Delete</span>
110
- </a>
111
- </div>
112
- </div>
113
- </div><!-- .wcf-step-wrap -->
114
- <?php } ?>
115
- <?php } ?>
116
- </div><!-- .wcf-flow-steps-container -->
117
- </div> <!-- .wcf-flow-steps-wrap -->
118
- <div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
119
- <?php do_action( 'cartflows_bellow_flow_steps' ); ?>
120
- <div class='wcf-add-new-step-btn-wrap'>
121
- <button class='wcf-trigger-popup button button-primary'>
122
- <?php echo __( 'Add New Step', 'cartflows' ); ?>
123
- </button>
124
- </div>
125
- </div><!-- .wcf-flow-buttons-wrap -->
126
- </div><!-- .wcf-flow-settings -->
127
-
128
- <div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
129
- <div class="wcf-templates-popup-content">
130
- <div class="spinner"></div>
131
- <div class="wcf-templates-wrap wcf-templates-wrap-flows">
132
-
133
- <div id="wcf-remote-step-actions" class="wcf-template-header">
134
- <div class="wcf-template-logo-wrap">
135
- <span class="wcf-cartflows-logo-img">
136
- <span class="cartflows-logo-icon"></span>
137
- </span>
138
- <span class="wcf-cartflows-title"><?php _e( 'Steps Library', 'cartflows' ); ?></span>
139
- </div>
140
- <div class="wcf-tab-wrapper">
141
- <?php if ( 'other' !== $default_page_builder ) { ?>
142
- <div id="wcf-get-started-steps">
143
- <ul class="filter-links ">
144
- <li>
145
- <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
146
- </li>
147
- <li>
148
- <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
149
- </li>
150
- </ul>
151
- </div>
152
- <?php } ?>
153
- </div>
154
- <div class="wcf-popup-close-wrap">
155
- <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
156
- </div>
157
- </div>
158
-
159
- <!--<div class="wcf-search-form">
160
- <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
161
- <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
162
- </div>-->
163
-
164
- <div id="wcf-remote-content">
165
- <?php if ( 'other' !== $default_page_builder ) { ?>
166
- <div id="wcf-ready-templates">
167
- <div id="wcf-remote-filters">
168
- <div id="wcf-page-builders"></div>
169
- <div id="wcf-categories"></div>
170
- </div>
171
- <div class="wcf-page-builder-notice"></div>
172
- <div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
173
- <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
174
- </div>
175
- <?php } ?>
176
- <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
177
- <div class="inner">
178
- <div id="wcf-scratch-steps-categories">
179
- <select class="step-type-filter-links filter-links">
180
- <option value="" class="current"> Select Step Type </option>
181
- <option value="52" data-group="52" class="Landing" data-slug="landing" data-title="Landing">Landing</option>
182
- <option value="53" data-group="53" class="Checkout" data-slug="checkout" data-title="Checkout">Checkout</option>
183
- <option value="55" data-group="55" class="Upsell" data-slug="upsell" data-title="Upsell">Upsell</option>
184
- <option value="56" data-group="56" class="Downsell" data-slug="downsell" data-title="Downsell">Downsell</option>
185
- <option value="54" data-group="54" class="Thank You" data-slug="thankyou" data-title="Thank You">Thank You</option>
186
- </select>
187
- </div>
188
- <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create Step', 'cartflows' ); ?></a>
189
- <?php if ( ! _is_cartflows_pro() ) { ?>
190
- <div class="wcf-template-notice"><p><?php echo __( 'You need a Cartflows Pro version to import Upsell / Downsell', 'cartflows' ); ?></p></div>
191
- <?php } ?>
192
- <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
193
- </div>
194
- </div>
195
- </div>
196
- </div>
197
- </div>
198
- </div><!-- .wcf-templates-popup-overlay -->
199
- </div>
200
- <?php
1
+ <?php
2
+ /**
3
+ * View Flow steps
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ $default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
9
+
10
+ $get_steps = array(
11
+ 'landing' => __( 'Landing', 'cartflows' ),
12
+ 'checkout' => __( 'Checkout', 'cartflows' ),
13
+ 'thankyou' => __( 'Thank You', 'cartflows' ),
14
+ 'upsell' => __( 'Upsell', 'cartflows' ),
15
+ 'downsell' => __( 'Downsell', 'cartflows' ),
16
+
17
+ );
18
+
19
+ ?>
20
+ <div class="wcf-flow-steps-meta-box">
21
+ <div class="wcf-flow-settings">
22
+ <?php do_action( 'cartflows_above_flow_steps' ); ?>
23
+ <div class="wcf-flow-steps-wrap">
24
+ <div class="wcf-flow-steps-container">
25
+ <?php if ( is_array( $options['steps'] ) ) { ?>
26
+ <?php foreach ( $options['steps'] as $index => $data ) { ?>
27
+ <?php
28
+ $term_slug = '';
29
+ $term_name = '';
30
+ $step_wrap_class = '';
31
+ $has_product_assigned = true;
32
+ $is_global_checkout = '';
33
+ $common = '';
34
+
35
+ if ( isset( $data['type'] ) ) {
36
+ $term_slug = $data['type'];
37
+ $term_name = $get_steps[ $data['type'] ];
38
+ }
39
+
40
+ if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
41
+ $step_wrap_class .= ' invalid-step';
42
+ }
43
+
44
+ if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
45
+ $step_wrap_class .= ' wcf-new-step-highlight';
46
+ }
47
+
48
+ if ( 'checkout' === $term_slug ) {
49
+
50
+ $common = Cartflows_Helper::get_common_settings();
51
+
52
+ $is_global_checkout = (int) $common['global_checkout'];
53
+
54
+ if ( $data['id'] === $is_global_checkout ) {
55
+ $step_wrap_class .= ' wcf-global-checkout';
56
+ }
57
+ }
58
+
59
+ if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
60
+
61
+ $has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
62
+
63
+ if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
64
+ $step_wrap_class .= ' wcf-no-product-step';
65
+ }
66
+ }
67
+
68
+ ?>
69
+ <div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
70
+ <div class="wcf-step">
71
+ <div class="wcf-step-left-content">
72
+ <span class="dashicons dashicons-menu"></span>
73
+ <span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
74
+ <span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
75
+
76
+ <?php
77
+ if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
78
+ ?>
79
+ <span class="wcf-no-product-badge"><?php _e( 'No Product Assigned', 'cartflows' ); ?></span>
80
+ <?php
81
+ } elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
82
+ ?>
83
+ <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout - Remove selected checkout product', 'cartflows' ); ?></span>
84
+ <?php
85
+ } elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
86
+ ?>
87
+ <span class="wcf-global-checkout-badge"><?php _e( 'Global Checkout', 'cartflows' ); ?></span>
88
+ <?php
89
+ }
90
+ ?>
91
+
92
+ <input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
93
+ </div>
94
+ <div class="wcf-steps-action-buttons">
95
+ <a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'View Step', 'cartflows' ); ?>" >
96
+ <span class="dashicons dashicons-visibility"></span>
97
+ <span class="wcf-step-act-btn-text">View</span>
98
+ </a>
99
+ <a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Edit Step', 'cartflows' ); ?>" >
100
+ <span class="dashicons dashicons-edit"></span>
101
+ <span class="wcf-step-act-btn-text">Edit</span>
102
+ </a>
103
+ <a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Clone Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
104
+ <span class="dashicons dashicons-admin-page"></span>
105
+ <span class="wcf-step-act-btn-text">Clone</span>
106
+ </a>
107
+ <a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo __( 'Delete Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
108
+ <span class="dashicons dashicons-trash"></span>
109
+ <span class="wcf-step-act-btn-text">Delete</span>
110
+ </a>
111
+ </div>
112
+ </div>
113
+ </div><!-- .wcf-step-wrap -->
114
+ <?php } ?>
115
+ <?php } ?>
116
+ </div><!-- .wcf-flow-steps-container -->
117
+ </div> <!-- .wcf-flow-steps-wrap -->
118
+ <div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
119
+ <?php do_action( 'cartflows_bellow_flow_steps' ); ?>
120
+ <div class='wcf-add-new-step-btn-wrap'>
121
+ <button class='wcf-trigger-popup button button-primary'>
122
+ <?php echo __( 'Add New Step', 'cartflows' ); ?>
123
+ </button>
124
+ </div>
125
+ </div><!-- .wcf-flow-buttons-wrap -->
126
+ </div><!-- .wcf-flow-settings -->
127
+
128
+ <div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
129
+ <div class="wcf-templates-popup-content">
130
+ <div class="spinner"></div>
131
+ <div class="wcf-templates-wrap wcf-templates-wrap-flows">
132
+
133
+ <div id="wcf-remote-step-actions" class="wcf-template-header">
134
+ <div class="wcf-template-logo-wrap">
135
+ <span class="wcf-cartflows-logo-img">
136
+ <span class="cartflows-logo-icon"></span>
137
+ </span>
138
+ <span class="wcf-cartflows-title"><?php _e( 'Steps Library', 'cartflows' ); ?></span>
139
+ </div>
140
+ <div class="wcf-tab-wrapper">
141
+ <?php if ( 'other' !== $default_page_builder ) { ?>
142
+ <div id="wcf-get-started-steps">
143
+ <ul class="filter-links ">
144
+ <li>
145
+ <a href="#" class="current" data-slug="ready-templates" data-title="<?php _e( 'Ready Templates', 'cartflows' ); ?>"><?php _e( 'Ready Templates', 'cartflows' ); ?></a>
146
+ </li>
147
+ <li>
148
+ <a href="#" data-slug="canvas" data-title="<?php _e( 'Create Your Own', 'cartflows' ); ?>"><?php _e( 'Create Your Own', 'cartflows' ); ?></a>
149
+ </li>
150
+ </ul>
151
+ </div>
152
+ <?php } ?>
153
+ </div>
154
+ <div class="wcf-popup-close-wrap">
155
+ <span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
156
+ </div>
157
+ </div>
158
+
159
+ <!--<div class="wcf-search-form">
160
+ <label class="screen-reader-text" for="wp-filter-search-input"><?php _e( 'Search Sites', 'cartflows' ); ?> </label>
161
+ <input placeholder="<?php _e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
162
+ </div>-->
163
+
164
+ <div id="wcf-remote-content">
165
+ <?php if ( 'other' !== $default_page_builder ) { ?>
166
+ <div id="wcf-ready-templates">
167
+ <div id="wcf-remote-filters">
168
+ <div id="wcf-page-builders"></div>
169
+ <div id="wcf-categories"></div>
170
+ </div>
171
+ <div class="wcf-page-builder-notice"></div>
172
+ <div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
173
+ <div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
174
+ </div>
175
+ <?php } ?>
176
+ <div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
177
+ <div class="inner">
178
+ <div id="wcf-scratch-steps-categories">
179
+ <select class="step-type-filter-links filter-links">
180
+ <option value="" class="current"> Select Step Type </option>
181
+ <option value="52" data-group="52" class="Landing" data-slug="landing" data-title="Landing">Landing</option>
182
+ <option value="53" data-group="53" class="Checkout" data-slug="checkout" data-title="Checkout">Checkout</option>
183
+ <option value="55" data-group="55" class="Upsell" data-slug="upsell" data-title="Upsell">Upsell</option>
184
+ <option value="56" data-group="56" class="Downsell" data-slug="downsell" data-title="Downsell">Downsell</option>
185
+ <option value="54" data-group="54" class="Thank You" data-slug="thankyou" data-title="Thank You">Thank You</option>
186
+ </select>
187
+ </div>
188
+ <a href="#" class="button button-primary cartflows-step-import-blank"><?php _e( 'Create Step', 'cartflows' ); ?></a>
189
+ <?php if ( ! _is_cartflows_pro() ) { ?>
190
+ <div class="wcf-template-notice"><p><?php echo __( 'You need a Cartflows Pro version to import Upsell / Downsell', 'cartflows' ); ?></p></div>
191
+ <?php } ?>
192
+ <p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php _e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div><!-- .wcf-templates-popup-overlay -->
199
+ </div>
200
+ <?php
modules/landing/classes/class-cartflows-landing-markup.php CHANGED
@@ -1,139 +1,139 @@
1
- <?php
2
- /**
3
- * Markup
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Checkout Markup
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Landing_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
- add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
39
- add_action( 'template_redirect', array( $this, 'template_redirect' ) );
40
-
41
- if ( is_admin() ) {
42
- add_filter( 'wp_dropdown_pages', array( $this, 'wp_dropdown_pages' ) );
43
- }
44
- }
45
-
46
- /**
47
- * Add landing pages in WordPress reading section.
48
- *
49
- * @param array $output output.
50
- */
51
- function wp_dropdown_pages( $output ) {
52
-
53
- global $pagenow;
54
-
55
- if ( ( 'options-reading.php' === $pagenow || 'customize.php' === $pagenow ) && preg_match( '#page_on_front#', $output ) ) {
56
-
57
- $args = array(
58
- 'post_type' => CARTFLOWS_STEP_POST_TYPE,
59
- 'numberposts' => 100,
60
- 'meta_query' => array(
61
- 'relation' => 'OR',
62
- array(
63
- 'key' => 'wcf-step-type',
64
- 'value' => 'landing',
65
- ),
66
- array(
67
- 'key' => 'wcf-step-type',
68
- 'value' => 'checkout',
69
- ),
70
- ),
71
- );
72
-
73
- $landing_pages = get_posts( $args );
74
-
75
- if ( is_array( $landing_pages ) && ! empty( $landing_pages ) ) {
76
-
77
- $cartflows_custom_option = '';
78
-
79
- $front_page_id = get_option( 'page_on_front' );
80
-
81
- foreach ( $landing_pages as $key => $landing_page ) {
82
-
83
- $selected = selected( $front_page_id, $landing_page->ID, false );
84
-
85
- $cartflows_custom_option .= "<option value=\"{$landing_page->ID}\"{$selected}>{$landing_page->post_title} ( #{$landing_page->ID} - CartFlows )</option>";
86
- }
87
-
88
- $cartflows_custom_option .= '</select>';
89
-
90
- $output = str_replace( '</select>', $cartflows_custom_option, $output );
91
- }
92
- }
93
-
94
- return $output;
95
- }
96
-
97
- /**
98
- * Set post query.
99
- *
100
- * @param string $query post query.
101
- */
102
- function pre_get_posts( $query ) {
103
-
104
- if ( $query->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
105
-
106
- $post_type = $query->get( 'post_type' );
107
-
108
- $page_id = $query->get( 'page_id' );
109
-
110
- if ( empty( $post_type ) && ! empty( $page_id ) ) {
111
- $query->set( 'post_type', get_post_type( $page_id ) );
112
- }
113
- }
114
- }
115
-
116
- /**
117
- * Redirect to homepage if landing page set as home page.
118
- */
119
- function template_redirect() {
120
-
121
- $compatibiliy = Cartflows_Compatibility::get_instance();
122
-
123
- // Do not redirect for page builder preview.
124
- if ( $compatibiliy->is_page_builder_preview() ) {
125
- return;
126
- }
127
-
128
- global $post;
129
-
130
- if ( is_singular() && ! is_front_page() && get_option( 'page_on_front' ) == $post->ID ) {
131
- wp_safe_redirect( site_url(), 301 );
132
- }
133
- }
134
- }
135
-
136
- /**
137
- * Kicking this off by calling 'get_instance()' method
138
- */
139
- Cartflows_Landing_Markup::get_instance();
1
+ <?php
2
+ /**
3
+ * Markup
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Checkout Markup
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Landing_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
+ add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
39
+ add_action( 'template_redirect', array( $this, 'template_redirect' ) );
40
+
41
+ if ( is_admin() ) {
42
+ add_filter( 'wp_dropdown_pages', array( $this, 'wp_dropdown_pages' ) );
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Add landing pages in WordPress reading section.
48
+ *
49
+ * @param array $output output.
50
+ */
51
+ function wp_dropdown_pages( $output ) {
52
+
53
+ global $pagenow;
54
+
55
+ if ( ( 'options-reading.php' === $pagenow || 'customize.php' === $pagenow ) && preg_match( '#page_on_front#', $output ) ) {
56
+
57
+ $args = array(
58
+ 'post_type' => CARTFLOWS_STEP_POST_TYPE,
59
+ 'numberposts' => 100,
60
+ 'meta_query' => array(
61
+ 'relation' => 'OR',
62
+ array(
63
+ 'key' => 'wcf-step-type',
64
+ 'value' => 'landing',
65
+ ),
66
+ array(
67
+ 'key' => 'wcf-step-type',
68
+ 'value' => 'checkout',
69
+ ),
70
+ ),
71
+ );
72
+
73
+ $landing_pages = get_posts( $args );
74
+
75
+ if ( is_array( $landing_pages ) && ! empty( $landing_pages ) ) {
76
+
77
+ $cartflows_custom_option = '';
78
+
79
+ $front_page_id = get_option( 'page_on_front' );
80
+
81
+ foreach ( $landing_pages as $key => $landing_page ) {
82
+
83
+ $selected = selected( $front_page_id, $landing_page->ID, false );
84
+
85
+ $cartflows_custom_option .= "<option value=\"{$landing_page->ID}\"{$selected}>{$landing_page->post_title} ( #{$landing_page->ID} - CartFlows )</option>";
86
+ }
87
+
88
+ $cartflows_custom_option .= '</select>';
89
+
90
+ $output = str_replace( '</select>', $cartflows_custom_option, $output );
91
+ }
92
+ }
93
+
94
+ return $output;
95
+ }
96
+
97
+ /**
98
+ * Set post query.
99
+ *
100
+ * @param string $query post query.
101
+ */
102
+ function pre_get_posts( $query ) {
103
+
104
+ if ( $query->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
105
+
106
+ $post_type = $query->get( 'post_type' );
107
+
108
+ $page_id = $query->get( 'page_id' );
109
+
110
+ if ( empty( $post_type ) && ! empty( $page_id ) ) {
111
+ $query->set( 'post_type', get_post_type( $page_id ) );
112
+ }
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Redirect to homepage if landing page set as home page.
118
+ */
119
+ function template_redirect() {
120
+
121
+ $compatibiliy = Cartflows_Compatibility::get_instance();
122
+
123
+ // Do not redirect for page builder preview.
124
+ if ( $compatibiliy->is_page_builder_preview() ) {
125
+ return;
126
+ }
127
+
128
+ global $post;
129
+
130
+ if ( is_singular() && ! is_front_page() && get_option( 'page_on_front' ) == $post->ID ) {
131
+ wp_safe_redirect( site_url(), 301 );
132
+ }
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Kicking this off by calling 'get_instance()' method
138
+ */
139
+ Cartflows_Landing_Markup::get_instance();
modules/landing/classes/class-cartflows-landing-meta.php CHANGED
@@ -1,236 +1,236 @@
1
- <?php
2
- /**
3
- * Landing post meta box
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Meta Boxes setup
10
- */
11
- class Cartflows_Landing_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
- /**
50
- * Init Metabox
51
- */
52
- public function init_metabox() {
53
-
54
- add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
55
- add_action( 'save_post', array( $this, 'save_meta_box' ) );
56
- }
57
-
58
- /**
59
- * Setup Metabox
60
- */
61
- function setup_meta_box() {
62
-
63
- if ( _is_wcf_landing_type() ) {
64
- add_meta_box(
65
- 'wcf-ladning-settings', // Id.
66
- __( 'Landing Page Settings', 'cartflows' ), // Title.
67
- array( $this, 'landing_meta_box' ), // Callback.
68
- wcf()->utils->get_step_post_type(), // Post_type.
69
- 'normal', // Context.
70
- 'high' // Priority.
71
- );
72
- }
73
- }
74
-
75
- /**
76
- * Landing Metabox Markup
77
- *
78
- * @param object $post Post object.
79
- * @return void
80
- */
81
- function landing_meta_box( $post ) {
82
-
83
- wp_nonce_field( 'save-nonce-landing-step-meta', 'nonce-landing-step-meta' );
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
-
100
- /**
101
- * Get options
102
- */
103
- $landing_data = array();
104
- foreach ( $meta as $key => $value ) {
105
-
106
- $landing_data[ $key ] = $meta[ $key ]['default'];
107
- }
108
-
109
- do_action( 'wcf_landing_settings_markup_before', $meta );
110
- $this->page_header_tab( $landing_data, $post->ID );
111
- do_action( 'wcf_landing_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
- 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-info',
134
- ),
135
- array(
136
- 'title' => __( 'Custom Script', 'cartflows' ),
137
- 'id' => 'wcf-landing-custom-script-header',
138
- 'class' => 'wcf-landing-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
139
- 'icon' => 'dashicons-format-aside',
140
- ),
141
- );
142
-
143
- ?>
144
- <div class="wcf-thankyou-table wcf-metabox-wrap widefat">
145
- <div class="wcf-table-container">
146
- <div class="wcf-column-left">
147
- <div class="wcf-tab-wrapper">
148
-
149
- <?php foreach ( $tabs as $key => $tab ) { ?>
150
- <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
151
- <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
152
- <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
153
- </div>
154
- <?php } ?>
155
- <input type="hidden" id="wcf_active_tab" name="wcf_active_tab" value="<?php echo esc_attr( $active_tab ); ?>" />
156
-
157
- </div>
158
- </div>
159
- <div class="wcf-column-right">
160
- <div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
161
- <?php
162
-
163
- $next_step_link = wcf()->utils->get_linking_url(
164
- array( 'class' => 'wcf-next-step' )
165
- );
166
-
167
- echo wcf()->meta->get_shortcode_field(
168
- array(
169
- 'label' => __( 'Next Step Link', 'cartflows' ),
170
- 'name' => 'wcf-next-step-link',
171
- 'content' => $next_step_link,
172
- )
173
- );
174
-
175
- ?>
176
- </div>
177
-
178
- <?php $this->tab_custom_script( $options, $post_id ); ?>
179
-
180
- <?php $this->right_column_footer( $options, $post_id ); ?>
181
- </div>
182
- </div>
183
- </div>
184
-
185
- <?php
186
-
187
- }
188
-
189
- /**
190
- * Get metabox options
191
- *
192
- * @param int $post_id post ID.
193
- * @return array
194
- */
195
- public static function get_meta_option( $post_id ) {
196
-
197
- if ( null === self::$meta_option ) {
198
- /**
199
- * Set metabox options
200
- *
201
- * @see http://php.net/manual/en/filter.filters.sanitize.php
202
- */
203
- // self::$meta_option = array(); .
204
- self::$meta_option = wcf()->options->get_landing_fields( $post_id );
205
- }
206
-
207
- return self::$meta_option;
208
- }
209
-
210
- /**
211
- * Metabox Save
212
- *
213
- * @param number $post_id Post ID.
214
- * @return void
215
- */
216
- function save_meta_box( $post_id ) {
217
-
218
- // Checks save status.
219
- $is_autosave = wp_is_post_autosave( $post_id );
220
- $is_revision = wp_is_post_revision( $post_id );
221
-
222
- $is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( $_POST['nonce-landing-step-meta'], 'save-nonce-landing-step-meta' ) ) ? true : false;
223
-
224
- // Exits script depending on save status.
225
- if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
226
- return;
227
- }
228
-
229
- wcf()->options->save_landing_fields( $post_id );
230
- }
231
- }
232
-
233
- /**
234
- * Kicking this off by calling 'get_instance()' method
235
- */
236
- Cartflows_Landing_Meta::get_instance();
1
+ <?php
2
+ /**
3
+ * Landing post meta box
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Meta Boxes setup
10
+ */
11
+ class Cartflows_Landing_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
+ /**
50
+ * Init Metabox
51
+ */
52
+ public function init_metabox() {
53
+
54
+ add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
55
+ add_action( 'save_post', array( $this, 'save_meta_box' ) );
56
+ }
57
+
58
+ /**
59
+ * Setup Metabox
60
+ */
61
+ function setup_meta_box() {
62
+
63
+ if ( _is_wcf_landing_type() ) {
64
+ add_meta_box(
65
+ 'wcf-ladning-settings', // Id.
66
+ __( 'Landing Page Settings', 'cartflows' ), // Title.
67
+ array( $this, 'landing_meta_box' ), // Callback.
68
+ wcf()->utils->get_step_post_type(), // Post_type.
69
+ 'normal', // Context.
70
+ 'high' // Priority.
71
+ );
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Landing Metabox Markup
77
+ *
78
+ * @param object $post Post object.
79
+ * @return void
80
+ */
81
+ function landing_meta_box( $post ) {
82
+
83
+ wp_nonce_field( 'save-nonce-landing-step-meta', 'nonce-landing-step-meta' );
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
+
100
+ /**
101
+ * Get options
102
+ */
103
+ $landing_data = array();
104
+ foreach ( $meta as $key => $value ) {
105
+
106
+ $landing_data[ $key ] = $meta[ $key ]['default'];
107
+ }
108
+
109
+ do_action( 'wcf_landing_settings_markup_before', $meta );
110
+ $this->page_header_tab( $landing_data, $post->ID );
111
+ do_action( 'wcf_landing_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
+ 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-info',
134
+ ),
135
+ array(
136
+ 'title' => __( 'Custom Script', 'cartflows' ),
137
+ 'id' => 'wcf-landing-custom-script-header',
138
+ 'class' => 'wcf-landing-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
139
+ 'icon' => 'dashicons-format-aside',
140
+ ),
141
+ );
142
+
143
+ ?>
144
+ <div class="wcf-thankyou-table wcf-metabox-wrap widefat">
145
+ <div class="wcf-table-container">
146
+ <div class="wcf-column-left">
147
+ <div class="wcf-tab-wrapper">
148
+
149
+ <?php foreach ( $tabs as $key => $tab ) { ?>
150
+ <div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
151
+ <span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
152
+ <span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
153
+ </div>
154
+ <?php } ?>
155
+ <input type="hidden" id="wcf_active_tab" name="wcf_active_tab" value="<?php echo esc_attr( $active_tab ); ?>" />
156
+
157
+ </div>
158
+ </div>
159
+ <div class="wcf-column-right">
160
+ <div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
161
+ <?php
162
+
163
+ $next_step_link = wcf()->utils->get_linking_url(
164
+ array( 'class' => 'wcf-next-step' )
165
+ );
166
+
167
+ echo wcf()->meta->get_shortcode_field(
168
+ array(
169
+ 'label' => __( 'Next Step Link', 'cartflows' ),
170
+ 'name' => 'wcf-next-step-link',
171
+ 'content' => $next_step_link,
172
+ )
173
+ );
174
+
175
+ ?>
176
+ </div>
177
+
178
+ <?php $this->tab_custom_script( $options, $post_id ); ?>
179
+
180
+ <?php $this->right_column_footer( $options, $post_id ); ?>
181
+ </div>
182
+ </div>
183
+ </div>
184
+
185
+ <?php
186
+
187
+ }
188
+
189
+ /**
190
+ * Get metabox options
191
+ *
192
+ * @param int $post_id post ID.
193
+ * @return array
194
+ */
195
+ public static function get_meta_option( $post_id ) {
196
+
197
+ if ( null === self::$meta_option ) {
198
+ /**
199
+ * Set metabox options
200
+ *
201
+ * @see http://php.net/manual/en/filter.filters.sanitize.php
202
+ */
203
+ // self::$meta_option = array(); .
204
+ self::$meta_option = wcf()->options->get_landing_fields( $post_id );
205
+ }
206
+
207
+ return self::$meta_option;
208
+ }
209
+
210
+ /**
211
+ * Metabox Save
212
+ *
213
+ * @param number $post_id Post ID.
214
+ * @return void
215
+ */
216
+ function save_meta_box( $post_id ) {
217
+
218
+ // Checks save status.
219
+ $is_autosave = wp_is_post_autosave( $post_id );
220
+ $is_revision = wp_is_post_revision( $post_id );
221
+
222
+ $is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( $_POST['nonce-landing-step-meta'], 'save-nonce-landing-step-meta' ) ) ? true : false;
223
+
224
+ // Exits script depending on save status.
225
+ if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
226
+ return;
227
+ }
228
+
229
+ wcf()->options->save_landing_fields( $post_id );
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Kicking this off by calling 'get_instance()' method
235
+ */
236
+ Cartflows_Landing_Meta::get_instance();
modules/thankyou/classes/class-cartflows-thankyou-markup.php CHANGED
@@ -1,274 +1,274 @@
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
- * 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
- /* Downsell Shortcode */
38
- add_shortcode( 'cartflows_order_details', array( $this, 'cartflows_order_details_shortcode_markup' ) );
39
-
40
- add_action( 'wp_enqueue_scripts', array( $this, 'thank_you_scripts' ), 21 );
41
-
42
- add_action( 'woocommerce_is_order_received_page', array( $this, 'set_order_received_page' ) );
43
-
44
- }
45
-
46
- /**
47
- * Order shortcode markup
48
- *
49
- * @param array $atts attributes.
50
- * @since 1.0.0
51
- */
52
- function cartflows_order_details_shortcode_markup( $atts ) {
53
-
54
- $output = '';
55
-
56
- if ( _is_wcf_thankyou_type() ) {
57
-
58
- /* Remove order item link */
59
- add_filter( 'woocommerce_order_item_permalink', '__return_false' );
60
-
61
- if ( ! function_exists( 'wc_print_notices' ) ) {
62
- return '<p class="woocommerce-notice">' . __( 'WooCommerce functions not exists. If you are in iframe, please reload the iframe', 'cartflows' ) . '</p>';
63
- }
64
-
65
- $order = false;
66
-
67
- if ( ! isset( $_GET['wcf-order'] ) && wcf()->flow->is_flow_testmode() ) {
68
-
69
- $args = array(
70
- 'limit' => 1,
71
- 'order' => 'DESC',
72
- 'post_type' => 'shop_order',
73
- 'status' => array( 'completed', 'processing' ),
74
- );
75
-
76
- $latest_order = wc_get_orders( $args );
77
-
78
- $order_id = ( ! empty( $latest_order ) ) ? current( $latest_order )->get_id() : 0;
79
-
80
- if ( $order_id > 0 ) {
81
-
82
- $order = wc_get_order( $order_id );
83
-
84
- if ( ! $order ) {
85
- $order = false;
86
- }
87
- }
88
- } else {
89
- if ( ! isset( $_GET['wcf-order'] ) ) {
90
- return '<p class="woocommerce-notice">Order not found. You cannot access this page directly.</p>';
91
- }
92
-
93
- // Get the order.
94
- $order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) );
95
- $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) ); // WPCS: input var ok, CSRF ok.
96
-
97
- if ( $order_id > 0 ) {
98
-
99
- $order = wc_get_order( $order_id );
100
-
101
- if ( ! $order || $order->get_order_key() !== $order_key ) {
102
- $order = false;
103
- }
104
- }
105
- }
106
-
107
- // Empty awaiting payment session.
108
- unset( WC()->session->order_awaiting_payment );
109
-
110
- if ( null !== WC()->session ) {
111
-
112
- if ( ! isset( WC()->cart ) || '' === WC()->cart ) {
113
- WC()->cart = new WC_Cart();
114
- }
115
-
116
- if ( ! WC()->cart->is_empty() ) {
117
- // wc_empty_cart();
118
- // Empty current cart.
119
- WC()->cart->empty_cart( true );
120
-
121
- wc_clear_notices();
122
- }
123
-
124
- wc_print_notices();
125
- }
126
-
127
- ob_start();
128
- echo "<div class='wcf-thankyou-wrap'>";
129
- wc_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
130
- echo '</div>';
131
- $output = ob_get_clean();
132
- }
133
-
134
- return $output;
135
- }
136
-
137
- /**
138
- * Load Thank You scripts.
139
- *
140
- * @return void
141
- */
142
- function thank_you_scripts() {
143
-
144
- if ( _is_wcf_thankyou_type() ) {
145
-
146
- do_action( 'cartflows_thank_you_scripts' );
147
-
148
- $style = $this->generate_thank_you_style();
149
-
150
- wp_add_inline_style( 'wcf-frontend-global', $style );
151
- }
152
- }
153
-
154
- /**
155
- * Set thank you as a order received page.
156
- *
157
- * @param boolean $is_order_page order page.
158
- * @return boolean
159
- */
160
- function set_order_received_page( $is_order_page ) {
161
-
162
- if ( _is_wcf_thankyou_type() ) {
163
-
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
- 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
- color: {$heading_text_color};
215
- font-family: {$heading_font_family};
216
- font-weight: {$heading_font_weight};
217
- }
218
-
219
- .woocommerce-order ul.order_details,
220
- .woocommerce-order .woocommerce-order-details,
221
- .woocommerce-order .woocommerce-customer-details{
222
- background-color: {$section_bg_color}
223
- }
224
- img.emoji, img.wp-smiley {}
225
- ";
226
-
227
- if ( 'no' == $show_order_review ) {
228
- $output .= '
229
- .woocommerce-order ul.order_details{
230
- display: none;
231
- }
232
- ';
233
- }
234
-
235
- if ( 'no' == $show_order_details ) {
236
- $output .= '
237
- .woocommerce-order .woocommerce-order-details{
238
- display: none;
239
- }
240
- ';
241
- }
242
-
243
- if ( 'no' == $show_billing_details ) {
244
- $output .= '
245
- .woocommerce-order .woocommerce-customer-details .woocommerce-column--billing-address{
246
- display: none;
247
- }
248
- ';
249
- }
250
-
251
- if ( 'no' == $show_shipping_details ) {
252
- $output .= '
253
- .woocommerce-order .woocommerce-customer-details .woocommerce-column--shipping-address{
254
- display: none;
255
- }
256
- ';
257
- }
258
-
259
- if ( 'no' == $show_billing_details && 'no' == $show_shipping_details ) {
260
- $output .= '
261
- .woocommerce-order .woocommerce-customer-details{
262
- display: none;
263
- }
264
- ';
265
- }
266
-
267
- return $output;
268
- }
269
- }
270
-
271
- /**
272
- * Kicking this off by calling 'get_instance()' method
273
- */
274
- 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
+ * 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
+ /* Downsell Shortcode */
38
+ add_shortcode( 'cartflows_order_details', array( $this, 'cartflows_order_details_shortcode_markup' ) );
39
+
40
+ add_action( 'wp_enqueue_scripts', array( $this, 'thank_you_scripts' ), 21 );
41
+
42
+ add_action( 'woocommerce_is_order_received_page', array( $this, 'set_order_received_page' ) );
43
+
44
+ }
45
+
46
+ /**
47
+ * Order shortcode markup
48
+ *
49
+ * @param array $atts attributes.
50
+ * @since 1.0.0
51
+ */
52
+ function cartflows_order_details_shortcode_markup( $atts ) {
53
+
54
+ $output = '';
55
+
56
+ if ( _is_wcf_thankyou_type() ) {
57
+
58
+ /* Remove order item link */
59
+ add_filter( 'woocommerce_order_item_permalink', '__return_false' );
60
+
61
+ if ( ! function_exists( 'wc_print_notices' ) ) {
62
+ return '<p class="woocommerce-notice">' . __( 'WooCommerce functions not exists. If you are in iframe, please reload the iframe', 'cartflows' ) . '</p>';
63
+ }
64
+
65
+ $order = false;
66
+
67
+ if ( ! isset( $_GET['wcf-order'] ) && wcf()->flow->is_flow_testmode() ) {
68
+
69
+ $args = array(
70
+ 'limit' => 1,
71
+ 'order' => 'DESC',
72
+ 'post_type' => 'shop_order',
73
+ 'status' => array( 'completed', 'processing' ),
74
+ );
75
+
76
+ $latest_order = wc_get_orders( $args );
77
+
78
+ $order_id = ( ! empty( $latest_order ) ) ? current( $latest_order )->get_id() : 0;
79
+
80
+ if ( $order_id > 0 ) {
81
+
82
+ $order = wc_get_order( $order_id );
83
+
84
+ if ( ! $order ) {
85
+ $order = false;
86
+ }
87
+ }
88
+ } else {
89
+ if ( ! isset( $_GET['wcf-order'] ) ) {
90
+ return '<p class="woocommerce-notice">Order not found. You cannot access this page directly.</p>';
91
+ }
92
+
93
+ // Get the order.
94
+ $order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) );
95
+ $order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) ); // WPCS: input var ok, CSRF ok.
96
+
97
+ if ( $order_id > 0 ) {
98
+
99
+ $order = wc_get_order( $order_id );
100
+
101
+ if ( ! $order || $order->get_order_key() !== $order_key ) {
102
+ $order = false;
103
+ }
104
+ }
105
+ }
106
+
107
+ // Empty awaiting payment session.
108
+ unset( WC()->session->order_awaiting_payment );
109
+
110
+ if ( null !== WC()->session ) {
111
+
112
+ if ( ! isset( WC()->cart ) || '' === WC()->cart ) {
113
+ WC()->cart = new WC_Cart();
114
+ }
115
+
116
+ if ( ! WC()->cart->is_empty() ) {
117
+ // wc_empty_cart();
118
+ // Empty current cart.
119
+ WC()->cart->empty_cart( true );
120
+
121
+ wc_clear_notices();
122
+ }
123
+
124
+ wc_print_notices();
125
+ }
126
+
127
+ ob_start();
128
+ echo "<div class='wcf-thankyou-wrap'>";
129
+ wc_get_template( 'checkout/thankyou.php', array( 'order' => $order ) );
130
+ echo '</div>';
131
+ $output = ob_get_clean();
132
+ }
133
+
134
+ return $output;
135
+ }
136
+
137
+ /**
138
+ * Load Thank You scripts.
139
+ *
140
+ * @return void
141
+ */
142
+ function thank_you_scripts() {
143
+
144
+ if ( _is_wcf_thankyou_type() ) {
145
+
146
+ do_action( 'cartflows_thank_you_scripts' );
147
+
148
+ $style = $this->generate_thank_you_style();
149
+
150
+ wp_add_inline_style( 'wcf-frontend-global', $style );
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Set thank you as a order received page.
156
+ *
157
+ * @param boolean $is_order_page order page.
158
+ * @return boolean
159
+ */
160
+ function set_order_received_page( $is_order_page ) {
161
+
162
+ if ( _is_wcf_thankyou_type() ) {
163
+
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
+ 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
+ color: {$heading_text_color};
215
+ font-family: {$heading_font_family};
216
+ font-weight: {$heading_font_weight};
217
+ }
218
+
219
+ .woocommerce-order ul.order_details,
220
+ .woocommerce-order .woocommerce-order-details,
221
+ .woocommerce-order .woocommerce-customer-details{
222
+ background-color: {$section_bg_color}
223
+ }
224
+ img.emoji, img.wp-smiley {}
225
+ ";
226
+
227
+ if ( 'no' == $show_order_review ) {
228
+ $output .= '
229
+ .woocommerce-order ul.order_details{
230
+ display: none;
231
+ }
232
+ ';
233
+ }
234
+
235
+ if ( 'no' == $show_order_details ) {
236
+ $output .= '
237
+ .woocommerce-order .woocommerce-order-details{
238
+ display: none;
239
+ }
240
+ ';
241
+ }
242
+
243
+ if ( 'no' == $show_billing_details ) {
244
+ $output .= '
245
+ .woocommerce-order .woocommerce-customer-details .woocommerce-column--billing-address{
246
+ display: none;
247
+ }
248
+ ';
249
+ }
250
+
251
+ if ( 'no' == $show_shipping_details ) {
252
+ $output .= '
253
+ .woocommerce-order .woocommerce-customer-details .woocommerce-column--shipping-address{
254
+ display: none;
255
+ }
256
+ ';
257
+ }
258
+
259
+ if ( 'no' == $show_billing_details && 'no' == $show_shipping_details ) {
260
+ $output .= '
261
+ .woocommerce-order .woocommerce-customer-details{
262
+ display: none;
263
+ }
264
+ ';
265
+ }
266
+
267
+ return $output;
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Kicking this off by calling 'get_instance()' method
273
+ */
274
+ Cartflows_Thankyou_Markup::get_instance();
modules/thankyou/classes/class-cartflows-thankyou-meta.php CHANGED
@@ -1,371 +1,371 @@
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
- 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
- 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
- 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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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
- 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( $_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
+ 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
+ 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
+ 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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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' => __( '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
+ 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( $_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();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, cart
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.1
8
- Stable tag: 1.1.13
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -93,6 +93,12 @@ Say goodby to using the same ridgid checkout page that everyone else is using. C
93
 
94
  == Changelog ==
95
 
 
 
 
 
 
 
96
  = Version 1.1.13 - Tuesday, 9th April 2019 =
97
  * Improvement: Added compatibility for a Two-Step checkout style of CartFlows Pro.
98
  * Fix: CSS conflict with the Divi theme.
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.1
8
+ Stable tag: 1.1.14
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
93
 
94
  == Changelog ==
95
 
96
+ = Version 1.1.14 - Wednesday, 24th April 2019 =
97
+ * Improvement: Minify CSS and Js files filter added.
98
+ * Improvement: Inline coupon message. Now coupon message will show above coupon field.
99
+ * Fix: Divi compatibility CSS updated.
100
+ * Fix: Lost your password link was unable to click on the checkout page.
101
+
102
  = Version 1.1.13 - Tuesday, 9th April 2019 =
103
  * Improvement: Added compatibility for a Two-Step checkout style of CartFlows Pro.
104
  * Fix: CSS conflict with the Divi theme.
woocommerce/template/cart/cart-shipping.php CHANGED
@@ -1,79 +1,79 @@
1
- <?php
2
- /**
3
- * Shipping Methods Display
4
- *
5
- * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
6
- *
7
- * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
8
- *
9
- * HOWEVER, on occasion WooCommerce will need to update template files and you
10
- * (the theme developer) will need to copy the new files to your theme to
11
- * maintain compatibility. We try to do this as little as possible, but it does
12
- * happen. When this occurs the version of the template file will be bumped and
13
- * the readme will list any important changes.
14
- *
15
- * @see https://docs.woocommerce.com/document/template-structure/
16
- * @package WooCommerce/Templates
17
- * @version 3.5.0
18
- */
19
-
20
- defined( 'ABSPATH' ) || exit;
21
-
22
- $formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
23
- $has_calculated_shipping = ! empty( $has_calculated_shipping );
24
- $show_shipping_calculator = ! empty( $show_shipping_calculator );
25
- $calculator_text = '';
26
- ?>
27
- <tr class="woocommerce-shipping-totals shipping">
28
- <th><?php echo wp_kses_post( $package_name ); ?></th>
29
- <td data-title="<?php echo esc_attr( $package_name ); ?>">
30
- <?php if ( $available_methods ) : ?>
31
- <ul id="shipping_method" class="woocommerce-shipping-methods">
32
- <?php foreach ( $available_methods as $method ) : ?>
33
- <li>
34
- <?php
35
- if ( 1 < count( $available_methods ) ) {
36
- printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
37
- } else {
38
- printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
39
- }
40
- printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $method->id ) ), wc_cart_totals_shipping_method_label( $method ) ); // WPCS: XSS ok.
41
- do_action( 'woocommerce_after_shipping_rate', $method, $index );
42
- ?>
43
- </li>
44
- <?php endforeach; ?>
45
- </ul>
46
- <?php if ( is_cart() ) : ?>
47
- <p class="woocommerce-shipping-destination">
48
- <?php
49
- if ( $formatted_destination ) {
50
- // Translators: $s shipping destination.
51
- printf( esc_html__( 'Estimate for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
52
- $calculator_text = __( 'Change address', 'woocommerce' );
53
- } else {
54
- echo esc_html__( 'This is only an estimate. Prices will be updated during checkout.', 'woocommerce' );
55
- }
56
- ?>
57
- </p>
58
- <?php endif; ?>
59
- <?php
60
- elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
61
- esc_html_e( 'Enter your address to view shipping options.', 'woocommerce' );
62
- elseif ( ! is_cart() ) :
63
- echo wp_kses_post( apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping methods available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ) );
64
- else :
65
- // Translators: $s shipping destination.
66
- echo wp_kses_post( apply_filters( 'woocommerce_cart_no_shipping_available_html', sprintf( esc_html__( 'No shipping options were found for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ) ) );
67
- $calculator_text = __( 'Enter a different address', 'woocommerce' );
68
- endif;
69
- ?>
70
-
71
- <?php if ( $show_package_details ) : ?>
72
- <?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
73
- <?php endif; ?>
74
-
75
- <?php if ( $show_shipping_calculator ) : ?>
76
- <?php woocommerce_shipping_calculator( $calculator_text ); ?>
77
- <?php endif; ?>
78
- </td>
79
- </tr>
1
+ <?php
2
+ /**
3
+ * Shipping Methods Display
4
+ *
5
+ * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
6
+ *
7
+ * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
8
+ *
9
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
10
+ * (the theme developer) will need to copy the new files to your theme to
11
+ * maintain compatibility. We try to do this as little as possible, but it does
12
+ * happen. When this occurs the version of the template file will be bumped and
13
+ * the readme will list any important changes.
14
+ *
15
+ * @see https://docs.woocommerce.com/document/template-structure/
16
+ * @package WooCommerce/Templates
17
+ * @version 3.5.0
18
+ */
19
+
20
+ defined( 'ABSPATH' ) || exit;
21
+
22
+ $formatted_destination = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
23
+ $has_calculated_shipping = ! empty( $has_calculated_shipping );
24
+ $show_shipping_calculator = ! empty( $show_shipping_calculator );
25
+ $calculator_text = '';
26
+ ?>
27
+ <tr class="woocommerce-shipping-totals shipping">
28
+ <th><?php echo wp_kses_post( $package_name ); ?></th>
29
+ <td data-title="<?php echo esc_attr( $package_name ); ?>">
30
+ <?php if ( $available_methods ) : ?>
31
+ <ul id="shipping_method" class="woocommerce-shipping-methods">
32
+ <?php foreach ( $available_methods as $method ) : ?>
33
+ <li>
34
+ <?php
35
+ if ( 1 < count( $available_methods ) ) {
36
+ printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
37
+ } else {
38
+ printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
39
+ }
40
+ printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $method->id ) ), wc_cart_totals_shipping_method_label( $method ) ); // WPCS: XSS ok.
41
+ do_action( 'woocommerce_after_shipping_rate', $method, $index );
42
+ ?>
43
+ </li>
44
+ <?php endforeach; ?>
45
+ </ul>
46
+ <?php if ( is_cart() ) : ?>
47
+ <p class="woocommerce-shipping-destination">
48
+ <?php
49
+ if ( $formatted_destination ) {
50
+ // Translators: $s shipping destination.
51
+ printf( esc_html__( 'Estimate for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
52
+ $calculator_text = __( 'Change address', 'woocommerce' );
53
+ } else {
54
+ echo esc_html__( 'This is only an estimate. Prices will be updated during checkout.', 'woocommerce' );
55
+ }
56
+ ?>
57
+ </p>
58
+ <?php endif; ?>
59
+ <?php
60
+ elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
61
+ esc_html_e( 'Enter your address to view shipping options.', 'woocommerce' );
62
+ elseif ( ! is_cart() ) :
63
+ echo wp_kses_post( apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping methods available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ) );
64
+ else :
65
+ // Translators: $s shipping destination.
66
+ echo wp_kses_post( apply_filters( 'woocommerce_cart_no_shipping_available_html', sprintf( esc_html__( 'No shipping options were found for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ) ) );
67
+ $calculator_text = __( 'Enter a different address', 'woocommerce' );
68
+ endif;
69
+ ?>
70
+
71
+ <?php if ( $show_package_details ) : ?>
72
+ <?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
73
+ <?php endif; ?>
74
+
75
+ <?php if ( $show_shipping_calculator ) : ?>
76
+ <?php woocommerce_shipping_calculator( $calculator_text ); ?>
77
+ <?php endif; ?>
78
+ </td>
79
+ </tr>
woocommerce/template/checkout/form-billing.php CHANGED
@@ -1,80 +1,80 @@
1
- <?php
2
- /**
3
- * Checkout billing information form
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @author WooThemes
15
- * @package WooCommerce/Templates
16
- * @version 3.0.9
17
- */
18
-
19
- if ( ! defined( 'ABSPATH' ) ) {
20
- exit; // Exit if accessed directly.
21
- }
22
-
23
- ?>
24
- <div class="woocommerce-billing-fields">
25
- <?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
26
-
27
- <h3><?php _e( 'Billing &amp; Shipping', 'woocommerce' ); ?></h3>
28
-
29
- <?php else : ?>
30
-
31
- <h3><?php _e( 'Billing details', 'woocommerce' ); ?></h3>
32
-
33
- <?php endif; ?>
34
-
35
- <?php do_action( 'woocommerce_before_checkout_billing_form', $checkout ); ?>
36
-
37
- <div class="woocommerce-billing-fields__field-wrapper">
38
- <?php
39
- $fields = $checkout->get_checkout_fields( 'billing' );
40
-
41
- foreach ( $fields as $key => $field ) {
42
- if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) {
43
- $field['country'] = $checkout->get_value( $field['country_field'] );
44
- }
45
- woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
46
- }
47
- ?>
48
- </div>
49
-
50
- <?php do_action( 'woocommerce_after_checkout_billing_form', $checkout ); ?>
51
- </div>
52
-
53
- <?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
54
- <div class="woocommerce-account-fields">
55
- <?php if ( ! $checkout->is_registration_required() ) : ?>
56
-
57
- <p class="form-row form-row-wide create-account">
58
- <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
59
- <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php _e( 'Create an account?', 'woocommerce' ); ?></span>
60
- </label>
61
- </p>
62
-
63
- <?php endif; ?>
64
-
65
- <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
66
-
67
- <?php if ( $checkout->get_checkout_fields( 'account' ) ) : ?>
68
-
69
- <div class="create-account">
70
- <?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
71
- <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
72
- <?php endforeach; ?>
73
- <div class="clear"></div>
74
- </div>
75
-
76
- <?php endif; ?>
77
-
78
- <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
79
- </div>
80
- <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * Checkout billing information form
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @author WooThemes
15
+ * @package WooCommerce/Templates
16
+ * @version 3.0.9
17
+ */
18
+
19
+ if ( ! defined( 'ABSPATH' ) ) {
20
+ exit; // Exit if accessed directly.
21
+ }
22
+
23
+ ?>
24
+ <div class="woocommerce-billing-fields">
25
+ <?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
26
+
27
+ <h3><?php _e( 'Billing &amp; Shipping', 'woocommerce' ); ?></h3>
28
+
29
+ <?php else : ?>
30
+
31
+ <h3><?php _e( 'Billing details', 'woocommerce' ); ?></h3>
32
+
33
+ <?php endif; ?>
34
+
35
+ <?php do_action( 'woocommerce_before_checkout_billing_form', $checkout ); ?>
36
+
37
+ <div class="woocommerce-billing-fields__field-wrapper">
38
+ <?php
39
+ $fields = $checkout->get_checkout_fields( 'billing' );
40
+
41
+ foreach ( $fields as $key => $field ) {
42
+ if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) {
43
+ $field['country'] = $checkout->get_value( $field['country_field'] );
44
+ }
45
+ woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
46
+ }
47
+ ?>
48
+ </div>
49
+
50
+ <?php do_action( 'woocommerce_after_checkout_billing_form', $checkout ); ?>
51
+ </div>
52
+
53
+ <?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
54
+ <div class="woocommerce-account-fields">
55
+ <?php if ( ! $checkout->is_registration_required() ) : ?>
56
+
57
+ <p class="form-row form-row-wide create-account">
58
+ <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
59
+ <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php _e( 'Create an account?', 'woocommerce' ); ?></span>
60
+ </label>
61
+ </p>
62
+
63
+ <?php endif; ?>
64
+
65
+ <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
66
+
67
+ <?php if ( $checkout->get_checkout_fields( 'account' ) ) : ?>
68
+
69
+ <div class="create-account">
70
+ <?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
71
+ <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
72
+ <?php endforeach; ?>
73
+ <div class="clear"></div>
74
+ </div>
75
+
76
+ <?php endif; ?>
77
+
78
+ <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
79
+ </div>
80
+ <?php endif; ?>
woocommerce/template/checkout/form-checkout.php CHANGED
@@ -1,64 +1,64 @@
1
- <?php
2
- /**
3
- * Checkout Form
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-checkout.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.5.0
16
- */
17
-
18
- if ( ! defined( 'ABSPATH' ) ) {
19
- exit;
20
- }
21
-
22
- do_action( 'woocommerce_before_checkout_form', $checkout );
23
-
24
- // If checkout registration is disabled and not logged in, the user cannot checkout.
25
- if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
26
- echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) ) );
27
- return;
28
- }
29
-
30
- ?>
31
-
32
- <form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
33
-
34
- <?php if ( $checkout->get_checkout_fields() ) : ?>
35
-
36
- <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
37
-
38
- <div class="col2-set" id="customer_details">
39
- <div class="col-1">
40
- <?php do_action( 'woocommerce_checkout_billing' ); ?>
41
- </div>
42
-
43
- <div class="col-2">
44
- <?php do_action( 'woocommerce_checkout_shipping' ); ?>
45
- </div>
46
- </div>
47
-
48
- <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
49
-
50
- <?php endif; ?>
51
-
52
- <h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
53
-
54
- <?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
55
-
56
- <div id="order_review" class="woocommerce-checkout-review-order">
57
- <?php do_action( 'woocommerce_checkout_order_review' ); ?>
58
- </div>
59
-
60
- <?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
61
-
62
- </form>
63
-
64
- <?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?>
1
+ <?php
2
+ /**
3
+ * Checkout Form
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-checkout.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.5.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ do_action( 'woocommerce_before_checkout_form', $checkout );
23
+
24
+ // If checkout registration is disabled and not logged in, the user cannot checkout.
25
+ if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
26
+ echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'woocommerce' ) ) );
27
+ return;
28
+ }
29
+
30
+ ?>
31
+
32
+ <form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
33
+
34
+ <?php if ( $checkout->get_checkout_fields() ) : ?>
35
+
36
+ <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
37
+
38
+ <div class="col2-set" id="customer_details">
39
+ <div class="col-1">
40
+ <?php do_action( 'woocommerce_checkout_billing' ); ?>
41
+ </div>
42
+
43
+ <div class="col-2">
44
+ <?php do_action( 'woocommerce_checkout_shipping' ); ?>
45
+ </div>
46
+ </div>
47
+
48
+ <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
49
+
50
+ <?php endif; ?>
51
+
52
+ <h3 id="order_review_heading"><?php esc_html_e( 'Your order', 'woocommerce' ); ?></h3>
53
+
54
+ <?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
55
+
56
+ <div id="order_review" class="woocommerce-checkout-review-order">
57
+ <?php do_action( 'woocommerce_checkout_order_review' ); ?>
58
+ </div>
59
+
60
+ <?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
61
+
62
+ </form>
63
+
64
+ <?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?>
woocommerce/template/checkout/form-coupon.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php
2
- /**
3
- * Checkout coupon form
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-coupon.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.4.4
16
- */
17
-
18
- defined( 'ABSPATH' ) || exit;
19
-
20
- if ( ! wc_coupons_enabled() ) { // @codingStandardsIgnoreLine.
21
- return;
22
- }
23
-
24
- ?>
25
- <div class="woocommerce-form-coupon-toggle">
26
- <?php wc_print_notice( apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' ), 'notice' ); ?>
27
- </div>
28
-
29
- <form class="checkout_coupon woocommerce-form-coupon" method="post" style="display:none">
30
-
31
- <p><?php esc_html_e( 'If you have a coupon code, please apply it below.', 'woocommerce' ); ?></p>
32
-
33
- <p class="form-row form-row-first">
34
- <input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" />
35
- </p>
36
-
37
- <p class="form-row form-row-last">
38
- <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
39
- </p>
40
-
41
- <div class="clear"></div>
42
- </form>
1
+ <?php
2
+ /**
3
+ * Checkout coupon form
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-coupon.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.4.4
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+
20
+ if ( ! wc_coupons_enabled() ) { // @codingStandardsIgnoreLine.
21
+ return;
22
+ }
23
+
24
+ ?>
25
+ <div class="woocommerce-form-coupon-toggle">
26
+ <?php wc_print_notice( apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' ), 'notice' ); ?>
27
+ </div>
28
+
29
+ <form class="checkout_coupon woocommerce-form-coupon" method="post" style="display:none">
30
+
31
+ <p><?php esc_html_e( 'If you have a coupon code, please apply it below.', 'woocommerce' ); ?></p>
32
+
33
+ <p class="form-row form-row-first">
34
+ <input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" />
35
+ </p>
36
+
37
+ <p class="form-row form-row-last">
38
+ <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
39
+ </p>
40
+
41
+ <div class="clear"></div>
42
+ </form>
woocommerce/template/checkout/form-login.php CHANGED
@@ -1,36 +1,36 @@
1
- <?php
2
- /**
3
- * Checkout login form
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-login.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.4.0
16
- */
17
-
18
- defined( 'ABSPATH' ) || exit;
19
-
20
- if ( is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) {
21
- return;
22
- }
23
-
24
- ?>
25
- <div class="woocommerce-form-login-toggle">
26
- <?php wc_print_notice( apply_filters( 'woocommerce_checkout_login_message', __( 'Returning customer?', 'woocommerce' ) ) . ' <a href="#" class="showlogin">' . __( 'Click here to login', 'woocommerce' ) . '</a>', 'notice' ); ?>
27
- </div>
28
- <?php
29
-
30
- woocommerce_login_form(
31
- array(
32
- 'message' => __( 'If you have shopped with us before, please enter your details below. If you are a new customer, please proceed to the Billing &amp; Shipping section.', 'woocommerce' ),
33
- 'redirect' => wc_get_page_permalink( 'checkout' ),
34
- 'hidden' => true,
35
- )
36
- );
1
+ <?php
2
+ /**
3
+ * Checkout login form
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-login.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.4.0
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+
20
+ if ( is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) {
21
+ return;
22
+ }
23
+
24
+ ?>
25
+ <div class="woocommerce-form-login-toggle">
26
+ <?php wc_print_notice( apply_filters( 'woocommerce_checkout_login_message', __( 'Returning customer?', 'woocommerce' ) ) . ' <a href="#" class="showlogin">' . __( 'Click here to login', 'woocommerce' ) . '</a>', 'notice' ); ?>
27
+ </div>
28
+ <?php
29
+
30
+ woocommerce_login_form(
31
+ array(
32
+ 'message' => __( 'If you have shopped with us before, please enter your details below. If you are a new customer, please proceed to the Billing &amp; Shipping section.', 'woocommerce' ),
33
+ 'redirect' => wc_get_page_permalink( 'checkout' ),
34
+ 'hidden' => true,
35
+ )
36
+ );
woocommerce/template/checkout/payment.php CHANGED
@@ -1,61 +1,61 @@
1
- <?php
2
- /**
3
- * Checkout Payment Section
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/payment.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.5.3
16
- */
17
-
18
- defined( 'ABSPATH' ) || exit;
19
-
20
- if ( ! is_ajax() ) {
21
- do_action( 'woocommerce_review_order_before_payment' );
22
- }
23
- ?>
24
- <div id="payment" class="woocommerce-checkout-payment">
25
- <?php if ( WC()->cart->needs_payment() ) : ?>
26
- <ul class="wc_payment_methods payment_methods methods">
27
- <?php
28
- if ( ! empty( $available_gateways ) ) {
29
- foreach ( $available_gateways as $gateway ) {
30
- wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
31
- }
32
- } else {
33
- echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', WC()->customer->get_billing_country() ? esc_html__( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) : esc_html__( 'Please fill in your details above to see available payment methods.', 'woocommerce' ) ) . '</li>'; // @codingStandardsIgnoreLine
34
- }
35
- ?>
36
- </ul>
37
- <?php endif; ?>
38
- <div class="form-row place-order">
39
- <noscript>
40
- <?php
41
- /* translators: $1 and $2 opening and closing emphasis tags respectively */
42
- printf( esc_html__( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the %1$sUpdate Totals%2$s button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ), '<em>', '</em>' );
43
- ?>
44
- <br/><button type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>"><?php esc_html_e( 'Update totals', 'woocommerce' ); ?></button>
45
- </noscript>
46
-
47
- <?php wc_get_template( 'checkout/terms.php' ); ?>
48
-
49
- <?php do_action( 'woocommerce_review_order_before_submit' ); ?>
50
-
51
- <?php echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?>
52
-
53
- <?php do_action( 'woocommerce_review_order_after_submit' ); ?>
54
-
55
- <?php wp_nonce_field( 'woocommerce-process_checkout', 'woocommerce-process-checkout-nonce' ); ?>
56
- </div>
57
- </div>
58
- <?php
59
- if ( ! is_ajax() ) {
60
- do_action( 'woocommerce_review_order_after_payment' );
61
- }
1
+ <?php
2
+ /**
3
+ * Checkout Payment Section
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/payment.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.5.3
16
+ */
17
+
18
+ defined( 'ABSPATH' ) || exit;
19
+
20
+ if ( ! is_ajax() ) {
21
+ do_action( 'woocommerce_review_order_before_payment' );
22
+ }
23
+ ?>
24
+ <div id="payment" class="woocommerce-checkout-payment">
25
+ <?php if ( WC()->cart->needs_payment() ) : ?>
26
+ <ul class="wc_payment_methods payment_methods methods">
27
+ <?php
28
+ if ( ! empty( $available_gateways ) ) {
29
+ foreach ( $available_gateways as $gateway ) {
30
+ wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
31
+ }
32
+ } else {
33
+ echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', WC()->customer->get_billing_country() ? esc_html__( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) : esc_html__( 'Please fill in your details above to see available payment methods.', 'woocommerce' ) ) . '</li>'; // @codingStandardsIgnoreLine
34
+ }
35
+ ?>
36
+ </ul>
37
+ <?php endif; ?>
38
+ <div class="form-row place-order">
39
+ <noscript>
40
+ <?php
41
+ /* translators: $1 and $2 opening and closing emphasis tags respectively */
42
+ printf( esc_html__( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the %1$sUpdate Totals%2$s button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ), '<em>', '</em>' );
43
+ ?>
44
+ <br/><button type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>"><?php esc_html_e( 'Update totals', 'woocommerce' ); ?></button>
45
+ </noscript>
46
+
47
+ <?php wc_get_template( 'checkout/terms.php' ); ?>
48
+
49
+ <?php do_action( 'woocommerce_review_order_before_submit' ); ?>
50
+
51
+ <?php echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?>
52
+
53
+ <?php do_action( 'woocommerce_review_order_after_submit' ); ?>
54
+
55
+ <?php wp_nonce_field( 'woocommerce-process_checkout', 'woocommerce-process-checkout-nonce' ); ?>
56
+ </div>
57
+ </div>
58
+ <?php
59
+ if ( ! is_ajax() ) {
60
+ do_action( 'woocommerce_review_order_after_payment' );
61
+ }
woocommerce/template/checkout/review-order.php CHANGED
@@ -1,113 +1,113 @@
1
- <?php
2
- /**
3
- * Review order table
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @author WooThemes
15
- * @package WooCommerce/Templates
16
- * @version 3.3.0
17
- */
18
-
19
- if ( ! defined( 'ABSPATH' ) ) {
20
- exit;
21
- }
22
- ?>
23
- <table class="shop_table woocommerce-checkout-review-order-table">
24
- <thead>
25
- <tr>
26
- <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
27
- <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
28
- </tr>
29
- </thead>
30
- <tbody>
31
- <?php
32
- do_action( 'woocommerce_review_order_before_cart_contents' );
33
-
34
- foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
35
- $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
36
-
37
- if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
38
- ?>
39
- <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
40
- <td class="product-name">
41
- <?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;'; ?>
42
- <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
43
- <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
44
- </td>
45
- <td class="product-total">
46
- <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
47
- </td>
48
- </tr>
49
- <?php
50
- }
51
- }
52
-
53
- do_action( 'woocommerce_review_order_after_cart_contents' );
54
- ?>
55
- </tbody>
56
- <tfoot>
57
-
58
- <tr class="cart-subtotal">
59
- <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
60
- <td><?php wc_cart_totals_subtotal_html(); ?></td>
61
- </tr>
62
-
63
- <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
64
- <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
65
- <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
66
- <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
67
- </tr>
68
- <?php endforeach; ?>
69
-
70
- <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
71
-
72
- <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
73
-
74
- <?php wc_cart_totals_shipping_html(); ?>
75
-
76
- <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
77
-
78
- <?php endif; ?>
79
-
80
- <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
81
- <tr class="fee">
82
- <th><?php echo esc_html( $fee->name ); ?></th>
83
- <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
84
- </tr>
85
- <?php endforeach; ?>
86
-
87
- <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
88
- <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
89
- <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
90
- <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
91
- <th><?php echo esc_html( $tax->label ); ?></th>
92
- <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
93
- </tr>
94
- <?php endforeach; ?>
95
- <?php else : ?>
96
- <tr class="tax-total">
97
- <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
98
- <td><?php wc_cart_totals_taxes_total_html(); ?></td>
99
- </tr>
100
- <?php endif; ?>
101
- <?php endif; ?>
102
-
103
- <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
104
-
105
- <tr class="order-total">
106
- <th><?php _e( 'Total', 'woocommerce' ); ?></th>
107
- <td><?php wc_cart_totals_order_total_html(); ?></td>
108
- </tr>
109
-
110
- <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
111
-
112
- </tfoot>
113
- </table>
1
+ <?php
2
+ /**
3
+ * Review order table
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @author WooThemes
15
+ * @package WooCommerce/Templates
16
+ * @version 3.3.0
17
+ */
18
+
19
+ if ( ! defined( 'ABSPATH' ) ) {
20
+ exit;
21
+ }
22
+ ?>
23
+ <table class="shop_table woocommerce-checkout-review-order-table">
24
+ <thead>
25
+ <tr>
26
+ <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
27
+ <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <?php
32
+ do_action( 'woocommerce_review_order_before_cart_contents' );
33
+
34
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
35
+ $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
36
+
37
+ if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
38
+ ?>
39
+ <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
40
+ <td class="product-name">
41
+ <?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;'; ?>
42
+ <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?>
43
+ <?php echo wc_get_formatted_cart_item_data( $cart_item ); ?>
44
+ </td>
45
+ <td class="product-total">
46
+ <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
47
+ </td>
48
+ </tr>
49
+ <?php
50
+ }
51
+ }
52
+
53
+ do_action( 'woocommerce_review_order_after_cart_contents' );
54
+ ?>
55
+ </tbody>
56
+ <tfoot>
57
+
58
+ <tr class="cart-subtotal">
59
+ <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
60
+ <td><?php wc_cart_totals_subtotal_html(); ?></td>
61
+ </tr>
62
+
63
+ <?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
64
+ <tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
65
+ <th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
66
+ <td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
67
+ </tr>
68
+ <?php endforeach; ?>
69
+
70
+ <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
71
+
72
+ <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
73
+
74
+ <?php wc_cart_totals_shipping_html(); ?>
75
+
76
+ <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
77
+
78
+ <?php endif; ?>
79
+
80
+ <?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
81
+ <tr class="fee">
82
+ <th><?php echo esc_html( $fee->name ); ?></th>
83
+ <td><?php wc_cart_totals_fee_html( $fee ); ?></td>
84
+ </tr>
85
+ <?php endforeach; ?>
86
+
87
+ <?php if ( wc_tax_enabled() && ! WC()->cart->display_prices_including_tax() ) : ?>
88
+ <?php if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) : ?>
89
+ <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
90
+ <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
91
+ <th><?php echo esc_html( $tax->label ); ?></th>
92
+ <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
93
+ </tr>
94
+ <?php endforeach; ?>
95
+ <?php else : ?>
96
+ <tr class="tax-total">
97
+ <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
98
+ <td><?php wc_cart_totals_taxes_total_html(); ?></td>
99
+ </tr>
100
+ <?php endif; ?>
101
+ <?php endif; ?>
102
+
103
+ <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
104
+
105
+ <tr class="order-total">
106
+ <th><?php _e( 'Total', 'woocommerce' ); ?></th>
107
+ <td><?php wc_cart_totals_order_total_html(); ?></td>
108
+ </tr>
109
+
110
+ <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
111
+
112
+ </tfoot>
113
+ </table>
woocommerce/template/checkout/thankyou.php CHANGED
@@ -1,87 +1,87 @@
1
- <?php
2
- /**
3
- * Thankyou page
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/checkout/thankyou.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @author WooThemes
15
- * @package WooCommerce/Templates
16
- * @version 3.2.0
17
- */
18
-
19
- if ( ! defined( 'ABSPATH' ) ) {
20
- exit;
21
- }
22
- ?>
23
-
24
- <div class="woocommerce-order">
25
-
26
- <?php if ( $order ) : ?>
27
-
28
- <?php if ( $order->has_status( 'failed' ) ) : ?>
29
-
30
- <p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed"><?php _e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce' ); ?></p>
31
-
32
- <p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed-actions">
33
- <a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php _e( 'Pay', 'woocommerce' ); ?></a>
34
- <?php if ( is_user_logged_in() ) : ?>
35
- <a href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>" class="button pay"><?php _e( 'My account', 'woocommerce' ); ?></a>
36
- <?php endif; ?>
37
- </p>
38
-
39
- <?php else : ?>
40
-
41
- <p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
42
-
43
- <ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
44
-
45
- <li class="woocommerce-order-overview__order order">
46
- <?php _e( 'Order number:', 'woocommerce' ); ?>
47
- <strong><?php echo $order->get_order_number(); ?></strong>
48
- </li>
49
-
50
- <li class="woocommerce-order-overview__date date">
51
- <?php _e( 'Date:', 'woocommerce' ); ?>
52
- <strong><?php echo wc_format_datetime( $order->get_date_created() ); ?></strong>
53
- </li>
54
-
55
- <?php if ( is_user_logged_in() && $order->get_user_id() === get_current_user_id() && $order->get_billing_email() ) : ?>
56
- <li class="woocommerce-order-overview__email email">
57
- <?php _e( 'Email:', 'woocommerce' ); ?>
58
- <strong><?php echo $order->get_billing_email(); ?></strong>
59
- </li>
60
- <?php endif; ?>
61
-
62
- <li class="woocommerce-order-overview__total total">
63
- <?php _e( 'Total:', 'woocommerce' ); ?>
64
- <strong><?php echo $order->get_formatted_order_total(); ?></strong>
65
- </li>
66
-
67
- <?php if ( $order->get_payment_method_title() ) : ?>
68
- <li class="woocommerce-order-overview__payment-method method">
69
- <?php _e( 'Payment method:', 'woocommerce' ); ?>
70
- <strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
71
- </li>
72
- <?php endif; ?>
73
-
74
- </ul>
75
-
76
- <?php endif; ?>
77
-
78
- <?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
79
- <?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>
80
-
81
- <?php else : ?>
82
-
83
- <p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), null ); ?></p>
84
-
85
- <?php endif; ?>
86
-
87
- </div>
1
+ <?php
2
+ /**
3
+ * Thankyou page
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/checkout/thankyou.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @author WooThemes
15
+ * @package WooCommerce/Templates
16
+ * @version 3.2.0
17
+ */
18
+
19
+ if ( ! defined( 'ABSPATH' ) ) {
20
+ exit;
21
+ }
22
+ ?>
23
+
24
+ <div class="woocommerce-order">
25
+
26
+ <?php if ( $order ) : ?>
27
+
28
+ <?php if ( $order->has_status( 'failed' ) ) : ?>
29
+
30
+ <p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed"><?php _e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce' ); ?></p>
31
+
32
+ <p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed-actions">
33
+ <a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php _e( 'Pay', 'woocommerce' ); ?></a>
34
+ <?php if ( is_user_logged_in() ) : ?>
35
+ <a href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>" class="button pay"><?php _e( 'My account', 'woocommerce' ); ?></a>
36
+ <?php endif; ?>
37
+ </p>
38
+
39
+ <?php else : ?>
40
+
41
+ <p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
42
+
43
+ <ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
44
+
45
+ <li class="woocommerce-order-overview__order order">
46
+ <?php _e( 'Order number:', 'woocommerce' ); ?>
47
+ <strong><?php echo $order->get_order_number(); ?></strong>
48
+ </li>
49
+
50
+ <li class="woocommerce-order-overview__date date">
51
+ <?php _e( 'Date:', 'woocommerce' ); ?>
52
+ <strong><?php echo wc_format_datetime( $order->get_date_created() ); ?></strong>
53
+ </li>
54
+
55
+ <?php if ( is_user_logged_in() && $order->get_user_id() === get_current_user_id() && $order->get_billing_email() ) : ?>
56
+ <li class="woocommerce-order-overview__email email">
57
+ <?php _e( 'Email:', 'woocommerce' ); ?>
58
+ <strong><?php echo $order->get_billing_email(); ?></strong>
59
+ </li>
60
+ <?php endif; ?>
61
+
62
+ <li class="woocommerce-order-overview__total total">
63
+ <?php _e( 'Total:', 'woocommerce' ); ?>
64
+ <strong><?php echo $order->get_formatted_order_total(); ?></strong>
65
+ </li>
66
+
67
+ <?php if ( $order->get_payment_method_title() ) : ?>
68
+ <li class="woocommerce-order-overview__payment-method method">
69
+ <?php _e( 'Payment method:', 'woocommerce' ); ?>
70
+ <strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
71
+ </li>
72
+ <?php endif; ?>
73
+
74
+ </ul>
75
+
76
+ <?php endif; ?>
77
+
78
+ <?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
79
+ <?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>
80
+
81
+ <?php else : ?>
82
+
83
+ <p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), null ); ?></p>
84
+
85
+ <?php endif; ?>
86
+
87
+ </div>
woocommerce/template/global/form-login.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Login form
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/global/form-login.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.6.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit; // Exit if accessed directly.
20
+ }
21
+
22
+ if ( is_user_logged_in() ) {
23
+ return;
24
+ }
25
+
26
+ ?>
27
+ <form class="woocommerce-form woocommerce-form-login login" method="post" <?php echo ( $hidden ) ? 'style="display:none;"' : ''; ?>>
28
+
29
+ <?php do_action( 'woocommerce_login_form_start' ); ?>
30
+
31
+ <?php echo ( $message ) ? wpautop( wptexturize( $message ) ) : ''; // @codingStandardsIgnoreLine ?>
32
+
33
+ <p class="form-row form-row-first">
34
+ <label for="username"><?php esc_html_e( 'Username or email', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
35
+ <input type="text" class="input-text" name="username" id="username" autocomplete="username" />
36
+ </p>
37
+ <p class="form-row form-row-last">
38
+ <label for="password"><?php esc_html_e( 'Password', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
39
+ <input class="input-text" type="password" name="password" id="password" autocomplete="current-password" />
40
+ </p>
41
+ <div class="clear"></div>
42
+
43
+ <?php do_action( 'woocommerce_login_form' ); ?>
44
+
45
+ <p class="form-row">
46
+ <?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?>
47
+ <input type="hidden" name="redirect" value="<?php echo esc_url( $redirect ); ?>" />
48
+ <button type="submit" class="woocommerce-button button woocommerce-form-login__submit" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>"><?php esc_html_e( 'Login', 'woocommerce' ); ?></button>
49
+ <span class="form-row login-form-actions">
50
+ <span class="remember_me">
51
+ <label class="woocommerce-form__label woocommerce-form__label-for-checkbox woocommerce-form-login__rememberme">
52
+ <input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" />
53
+ <span><?php esc_html_e( 'Remember me', 'woocommerce' ); ?></span>
54
+ </label>
55
+ </span>
56
+ <span class="lost_password">
57
+ <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Lost your password?', 'woocommerce' ); ?></a>
58
+ </span>
59
+ </span>
60
+ </p>
61
+
62
+
63
+ <div class="clear"></div>
64
+
65
+ <?php do_action( 'woocommerce_login_form_end' ); ?>
66
+
67
+ </form>
woocommerce/template/notices/error.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
- /**
3
- * Show error messages
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/notices/error.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.5.0
16
- */
17
-
18
- if ( ! defined( 'ABSPATH' ) ) {
19
- exit;
20
- }
21
-
22
- if ( ! $messages ) {
23
- return;
24
- }
25
-
26
- ?>
27
- <ul class="woocommerce-error" role="alert">
28
- <?php foreach ( $messages as $message ) : ?>
29
- <li>
30
- <?php
31
- echo wc_kses_notice( $message );
32
- ?>
33
- </li>
34
- <?php endforeach; ?>
35
- </ul>
1
+ <?php
2
+ /**
3
+ * Show error messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/notices/error.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.5.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ if ( ! $messages ) {
23
+ return;
24
+ }
25
+
26
+ ?>
27
+ <ul class="woocommerce-error" role="alert">
28
+ <?php foreach ( $messages as $message ) : ?>
29
+ <li>
30
+ <?php
31
+ echo wc_kses_notice( $message );
32
+ ?>
33
+ </li>
34
+ <?php endforeach; ?>
35
+ </ul>
woocommerce/template/notices/notice.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Show messages
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/notices/notice.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.5.0
16
- */
17
-
18
- if ( ! defined( 'ABSPATH' ) ) {
19
- exit; // Exit if accessed directly.
20
- }
21
-
22
- if ( ! $messages ) {
23
- return;
24
- }
25
-
26
- ?>
27
-
28
- <?php foreach ( $messages as $message ) : ?>
29
- <div class="woocommerce-info">
30
- <?php
31
- echo wc_kses_notice( $message );
32
- ?>
33
- </div>
34
- <?php endforeach; ?>
1
+ <?php
2
+ /**
3
+ * Show messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/notices/notice.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.5.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit; // Exit if accessed directly.
20
+ }
21
+
22
+ if ( ! $messages ) {
23
+ return;
24
+ }
25
+
26
+ ?>
27
+
28
+ <?php foreach ( $messages as $message ) : ?>
29
+ <div class="woocommerce-info">
30
+ <?php
31
+ echo wc_kses_notice( $message );
32
+ ?>
33
+ </div>
34
+ <?php endforeach; ?>
woocommerce/template/notices/success.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Show messages
4
- *
5
- * This template can be overridden by copying it to yourtheme/woocommerce/notices/success.php.
6
- *
7
- * HOWEVER, on occasion WooCommerce will need to update template files and you
8
- * (the theme developer) will need to copy the new files to your theme to
9
- * maintain compatibility. We try to do this as little as possible, but it does
10
- * happen. When this occurs the version of the template file will be bumped and
11
- * the readme will list any important changes.
12
- *
13
- * @see https://docs.woocommerce.com/document/template-structure/
14
- * @package WooCommerce/Templates
15
- * @version 3.5.0
16
- */
17
-
18
- if ( ! defined( 'ABSPATH' ) ) {
19
- exit;
20
- }
21
-
22
- if ( ! $messages ) {
23
- return;
24
- }
25
-
26
- ?>
27
-
28
- <?php foreach ( $messages as $message ) : ?>
29
- <div class="woocommerce-message" role="alert">
30
- <?php
31
- echo wc_kses_notice( $message );
32
- ?>
33
- </div>
34
- <?php endforeach; ?>
1
+ <?php
2
+ /**
3
+ * Show messages
4
+ *
5
+ * This template can be overridden by copying it to yourtheme/woocommerce/notices/success.php.
6
+ *
7
+ * HOWEVER, on occasion WooCommerce will need to update template files and you
8
+ * (the theme developer) will need to copy the new files to your theme to
9
+ * maintain compatibility. We try to do this as little as possible, but it does
10
+ * happen. When this occurs the version of the template file will be bumped and
11
+ * the readme will list any important changes.
12
+ *
13
+ * @see https://docs.woocommerce.com/document/template-structure/
14
+ * @package WooCommerce/Templates
15
+ * @version 3.5.0
16
+ */
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ if ( ! $messages ) {
23
+ return;
24
+ }
25
+
26
+ ?>
27
+
28
+ <?php foreach ( $messages as $message ) : ?>
29
+ <div class="woocommerce-message" role="alert">
30
+ <?php
31
+ echo wc_kses_notice( $message );
32
+ ?>
33
+ </div>
34
+ <?php endforeach; ?>