Version Description
Download this release
Release Info
Developer | sandesh055 |
Plugin | Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- admin/assets/css/flow-admin-edit-rtl.css +0 -5
- admin/assets/css/flow-admin-edit.css +0 -5
- admin/assets/js/flow-admin-edit.js +0 -50
- assets/css/frontend-rtl.css +11 -3
- assets/css/frontend.css +11 -3
- assets/css/import-rtl.css +20 -3
- assets/css/import.css +20 -3
- assets/js/import.js +4 -34
- assets/min-css/frontend-rtl.min.css +1 -1
- assets/min-css/frontend.min.css +1 -1
- assets/min-css/import-rtl.min.css +1 -1
- assets/min-css/import.min.css +1 -1
- assets/min-js/import.min.js +1 -1
- cartflows.php +2 -2
- changelog.txt +4 -0
- classes/class-cartflows-api.php +381 -381
- classes/class-cartflows-compatibility.php +447 -447
- classes/class-cartflows-default-meta.php +867 -867
- classes/class-cartflows-frontend.php +654 -654
- classes/class-cartflows-helper.php +777 -777
- classes/class-cartflows-importer.php +1692 -1694
- classes/class-cartflows-loader.php +1 -1
- classes/class-cartflows-meta-fields.php +1 -1
- classes/class-cartflows-wizard.php +688 -679
- includes/admin/cartflows-general.php +522 -522
- languages/cartflows.pot +96 -123
- modules/checkout/classes/class-cartflows-checkout-markup.php +1158 -1158
- modules/checkout/includes/checkout-dynamic-css.php +162 -162
- modules/checkout/includes/checkout-dynamic-divi-css.php +169 -169
- modules/flow/classes/class-cartflows-flow-meta.php +700 -780
- modules/optin/classes/class-cartflows-optin-markup.php +712 -712
- modules/optin/includes/optin-dynamic-css.php +130 -130
- modules/optin/includes/optin-dynamic-divi-css.php +135 -135
- readme.txt +5 -1
admin/assets/css/flow-admin-edit-rtl.css
CHANGED
@@ -5,11 +5,6 @@
|
|
5 |
.wcf-flow-steps-meta-actions {
|
6 |
margin: 1em 0 2em 0;
|
7 |
}
|
8 |
-
.wcf-setup-default-steps {
|
9 |
-
padding: 10px;
|
10 |
-
border: 1px solid #e5e5e5;
|
11 |
-
display: inline-block;
|
12 |
-
}
|
13 |
.wcf-flow-steps-meta-box {
|
14 |
display: block;
|
15 |
clear: both;
|
5 |
.wcf-flow-steps-meta-actions {
|
6 |
margin: 1em 0 2em 0;
|
7 |
}
|
|
|
|
|
|
|
|
|
|
|
8 |
.wcf-flow-steps-meta-box {
|
9 |
display: block;
|
10 |
clear: both;
|
admin/assets/css/flow-admin-edit.css
CHANGED
@@ -5,11 +5,6 @@
|
|
5 |
.wcf-flow-steps-meta-actions {
|
6 |
margin: 1em 0 2em 0;
|
7 |
}
|
8 |
-
.wcf-setup-default-steps {
|
9 |
-
padding: 10px;
|
10 |
-
border: 1px solid #e5e5e5;
|
11 |
-
display: inline-block;
|
12 |
-
}
|
13 |
.wcf-flow-steps-meta-box {
|
14 |
display: block;
|
15 |
clear: both;
|
5 |
.wcf-flow-steps-meta-actions {
|
6 |
margin: 1em 0 2em 0;
|
7 |
}
|
|
|
|
|
|
|
|
|
|
|
8 |
.wcf-flow-steps-meta-box {
|
9 |
display: block;
|
10 |
clear: both;
|
admin/assets/js/flow-admin-edit.js
CHANGED
@@ -1,53 +1,5 @@
|
|
1 |
(function($){
|
2 |
|
3 |
-
/* Create default steps */
|
4 |
-
var wcf_setup_default_steps = function() {
|
5 |
-
|
6 |
-
$('.wcf-setup-default-steps').on('click', function(e) {
|
7 |
-
|
8 |
-
e.preventDefault();
|
9 |
-
|
10 |
-
if( $( 'body' ).hasClass( 'post-type-cartflows_flow' ) && $( 'body' ).hasClass( 'post-new-php' ) ) {
|
11 |
-
|
12 |
-
var $wpTitle = $( '#title' );
|
13 |
-
|
14 |
-
if ( ! $wpTitle.val() ) {
|
15 |
-
$wpTitle.val( 'Flow #' + $( '#post_ID' ).val() );
|
16 |
-
}
|
17 |
-
|
18 |
-
if ( wp.autosave ) {
|
19 |
-
wp.autosave.server.triggerSave();
|
20 |
-
}
|
21 |
-
|
22 |
-
$(window).off( 'beforeunload.edit-post' );
|
23 |
-
}
|
24 |
-
|
25 |
-
var $this = $(this);
|
26 |
-
post_id = $( 'form#post #post_ID').val();
|
27 |
-
|
28 |
-
$.ajax({
|
29 |
-
url: ajaxurl,
|
30 |
-
data: {
|
31 |
-
action: "cartflows_setup_default_steps",
|
32 |
-
post_id : post_id,
|
33 |
-
security: cartflows_admin.wcf_setup_default_steps_nonce
|
34 |
-
},
|
35 |
-
dataType: 'json',
|
36 |
-
type: 'POST',
|
37 |
-
success: function ( data ) {
|
38 |
-
|
39 |
-
if ( data.status ) {
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
location.href = data.redirect.replace( '&', '&' );
|
44 |
-
}
|
45 |
-
console.log( data );
|
46 |
-
}
|
47 |
-
});
|
48 |
-
});
|
49 |
-
}
|
50 |
-
|
51 |
var wcf_steps_hide_show_delete = function() {
|
52 |
|
53 |
$('.wcf-flow-settings .wcf-step-delete').on('click', function(e) {
|
@@ -145,8 +97,6 @@
|
|
145 |
}
|
146 |
$(document).ready(function($) {
|
147 |
|
148 |
-
wcf_setup_default_steps();
|
149 |
-
|
150 |
wcf_steps_hide_show_delete();
|
151 |
|
152 |
wcf_flow_steps_sortbale();
|
1 |
(function($){
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var wcf_steps_hide_show_delete = function() {
|
4 |
|
5 |
$('.wcf-flow-settings .wcf-step-delete').on('click', function(e) {
|
97 |
}
|
98 |
$(document).ready(function($) {
|
99 |
|
|
|
|
|
100 |
wcf_steps_hide_show_delete();
|
101 |
|
102 |
wcf_flow_steps_sortbale();
|
assets/css/frontend-rtl.css
CHANGED
@@ -182,9 +182,7 @@ body.cartflows-default {
|
|
182 |
font-size: 13px;
|
183 |
}
|
184 |
|
185 |
-
|
186 |
-
color: #404040;
|
187 |
-
}
|
188 |
/* Order Details - ThankYou page */
|
189 |
.woocommerce-order ul.order_details::before,
|
190 |
.woocommerce-order ul.order_details::after {
|
@@ -302,6 +300,7 @@ body.cartflows-default {
|
|
302 |
line-height: 1.4em;
|
303 |
border: none;
|
304 |
}
|
|
|
305 |
.woocommerce-order-details table.shop_table tbody th,
|
306 |
.woocommerce-order-details table.shop_table tfoot td,
|
307 |
.woocommerce-order-details table.shop_table tfoot th {
|
@@ -384,6 +383,15 @@ body.cartflows-default {
|
|
384 |
padding: 1.5em 2em;
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
.woocommerce-order ul.order_details li{
|
388 |
display: block;
|
389 |
width: 100%;
|
182 |
font-size: 13px;
|
183 |
}
|
184 |
|
185 |
+
|
|
|
|
|
186 |
/* Order Details - ThankYou page */
|
187 |
.woocommerce-order ul.order_details::before,
|
188 |
.woocommerce-order ul.order_details::after {
|
300 |
line-height: 1.4em;
|
301 |
border: none;
|
302 |
}
|
303 |
+
|
304 |
.woocommerce-order-details table.shop_table tbody th,
|
305 |
.woocommerce-order-details table.shop_table tfoot td,
|
306 |
.woocommerce-order-details table.shop_table tfoot th {
|
383 |
padding: 1.5em 2em;
|
384 |
}
|
385 |
|
386 |
+
.woocommerce-order .woocommerce-order-downloads{
|
387 |
+
overflow-x: auto;
|
388 |
+
}
|
389 |
+
|
390 |
+
.woocommerce-order-downloads table.shop_table td,
|
391 |
+
.woocommerce-order-downloads table.shop_table th{
|
392 |
+
padding: 0.5em 0.8em;
|
393 |
+
}
|
394 |
+
|
395 |
.woocommerce-order ul.order_details li{
|
396 |
display: block;
|
397 |
width: 100%;
|
assets/css/frontend.css
CHANGED
@@ -182,9 +182,7 @@ body.cartflows-default {
|
|
182 |
font-size: 13px;
|
183 |
}
|
184 |
|
185 |
-
|
186 |
-
color: #404040;
|
187 |
-
}
|
188 |
/* Order Details - ThankYou page */
|
189 |
.woocommerce-order ul.order_details::before,
|
190 |
.woocommerce-order ul.order_details::after {
|
@@ -302,6 +300,7 @@ body.cartflows-default {
|
|
302 |
line-height: 1.4em;
|
303 |
border: none;
|
304 |
}
|
|
|
305 |
.woocommerce-order-details table.shop_table tbody th,
|
306 |
.woocommerce-order-details table.shop_table tfoot td,
|
307 |
.woocommerce-order-details table.shop_table tfoot th {
|
@@ -384,6 +383,15 @@ body.cartflows-default {
|
|
384 |
padding: 1.5em 2em;
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
.woocommerce-order ul.order_details li{
|
388 |
display: block;
|
389 |
width: 100%;
|
182 |
font-size: 13px;
|
183 |
}
|
184 |
|
185 |
+
|
|
|
|
|
186 |
/* Order Details - ThankYou page */
|
187 |
.woocommerce-order ul.order_details::before,
|
188 |
.woocommerce-order ul.order_details::after {
|
300 |
line-height: 1.4em;
|
301 |
border: none;
|
302 |
}
|
303 |
+
|
304 |
.woocommerce-order-details table.shop_table tbody th,
|
305 |
.woocommerce-order-details table.shop_table tfoot td,
|
306 |
.woocommerce-order-details table.shop_table tfoot th {
|
383 |
padding: 1.5em 2em;
|
384 |
}
|
385 |
|
386 |
+
.woocommerce-order .woocommerce-order-downloads{
|
387 |
+
overflow-x: auto;
|
388 |
+
}
|
389 |
+
|
390 |
+
.woocommerce-order-downloads table.shop_table td,
|
391 |
+
.woocommerce-order-downloads table.shop_table th{
|
392 |
+
padding: 0.5em 0.8em;
|
393 |
+
}
|
394 |
+
|
395 |
.woocommerce-order ul.order_details li{
|
396 |
display: block;
|
397 |
width: 100%;
|
assets/css/import-rtl.css
CHANGED
@@ -676,7 +676,9 @@ div#TB_window {
|
|
676 |
-ms-transform: translate(50%, -35%);
|
677 |
transform: translate(50%, -35%);
|
678 |
width: 70%;
|
679 |
-
min-height:
|
|
|
|
|
680 |
overflow: hidden;
|
681 |
}
|
682 |
|
@@ -692,6 +694,10 @@ div#TB_window {
|
|
692 |
box-shadow: 0 0 5px 1px rgba(204, 204, 204, 0.3);
|
693 |
}
|
694 |
|
|
|
|
|
|
|
|
|
695 |
@media only screen and (max-width: 480px) {
|
696 |
.wcf-templates-popup-content{
|
697 |
width: 90%;
|
@@ -731,11 +737,22 @@ html.wcf-popup-open{
|
|
731 |
display: none !important;
|
732 |
}
|
733 |
|
|
|
|
|
|
|
|
|
734 |
#wcf-remote-content {
|
735 |
background-color: #f5f5f5;
|
736 |
overflow-y: auto;
|
737 |
-
|
738 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
739 |
padding: 20px 20px 20px 20px;
|
740 |
clear: both;
|
741 |
}
|
676 |
-ms-transform: translate(50%, -35%);
|
677 |
transform: translate(50%, -35%);
|
678 |
width: 70%;
|
679 |
+
min-height: 85%;
|
680 |
+
max-height: 85%;
|
681 |
+
height: 85%;
|
682 |
overflow: hidden;
|
683 |
}
|
684 |
|
694 |
box-shadow: 0 0 5px 1px rgba(204, 204, 204, 0.3);
|
695 |
}
|
696 |
|
697 |
+
.wcf-templates-popup-content .wcf-templates-wrap {
|
698 |
+
height: 100%;
|
699 |
+
}
|
700 |
+
|
701 |
@media only screen and (max-width: 480px) {
|
702 |
.wcf-templates-popup-content{
|
703 |
width: 90%;
|
737 |
display: none !important;
|
738 |
}
|
739 |
|
740 |
+
#wcf-remote-flow-actions {
|
741 |
+
min-height: 52px;
|
742 |
+
max-height: 55px;
|
743 |
+
}
|
744 |
#wcf-remote-content {
|
745 |
background-color: #f5f5f5;
|
746 |
overflow-y: auto;
|
747 |
+
-webkit-box-sizing: border-box;
|
748 |
+
-moz-box-sizing: border-box;
|
749 |
+
box-sizing: border-box;
|
750 |
+
height: -webkit-calc( 100% - 55px );
|
751 |
+
height: calc( 100% - 55px );
|
752 |
+
min-height: -webkit-calc( 100% - 55px );
|
753 |
+
min-height: calc( 100% - 55px );
|
754 |
+
max-height: -webkit-calc( 100% - 55px );
|
755 |
+
max-height: calc( 100% - 55px );
|
756 |
padding: 20px 20px 20px 20px;
|
757 |
clear: both;
|
758 |
}
|
assets/css/import.css
CHANGED
@@ -676,7 +676,9 @@ div#TB_window {
|
|
676 |
-ms-transform: translate(-50%, -35%);
|
677 |
transform: translate(-50%, -35%);
|
678 |
width: 70%;
|
679 |
-
min-height:
|
|
|
|
|
680 |
overflow: hidden;
|
681 |
}
|
682 |
|
@@ -692,6 +694,10 @@ div#TB_window {
|
|
692 |
box-shadow: 0 0 5px 1px rgba(204, 204, 204, 0.3);
|
693 |
}
|
694 |
|
|
|
|
|
|
|
|
|
695 |
@media only screen and (max-width: 480px) {
|
696 |
.wcf-templates-popup-content{
|
697 |
width: 90%;
|
@@ -731,11 +737,22 @@ html.wcf-popup-open{
|
|
731 |
display: none !important;
|
732 |
}
|
733 |
|
|
|
|
|
|
|
|
|
734 |
#wcf-remote-content {
|
735 |
background-color: #f5f5f5;
|
736 |
overflow-y: auto;
|
737 |
-
|
738 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
739 |
padding: 20px 20px 20px 20px;
|
740 |
clear: both;
|
741 |
}
|
676 |
-ms-transform: translate(-50%, -35%);
|
677 |
transform: translate(-50%, -35%);
|
678 |
width: 70%;
|
679 |
+
min-height: 85%;
|
680 |
+
max-height: 85%;
|
681 |
+
height: 85%;
|
682 |
overflow: hidden;
|
683 |
}
|
684 |
|
694 |
box-shadow: 0 0 5px 1px rgba(204, 204, 204, 0.3);
|
695 |
}
|
696 |
|
697 |
+
.wcf-templates-popup-content .wcf-templates-wrap {
|
698 |
+
height: 100%;
|
699 |
+
}
|
700 |
+
|
701 |
@media only screen and (max-width: 480px) {
|
702 |
.wcf-templates-popup-content{
|
703 |
width: 90%;
|
737 |
display: none !important;
|
738 |
}
|
739 |
|
740 |
+
#wcf-remote-flow-actions {
|
741 |
+
min-height: 52px;
|
742 |
+
max-height: 55px;
|
743 |
+
}
|
744 |
#wcf-remote-content {
|
745 |
background-color: #f5f5f5;
|
746 |
overflow-y: auto;
|
747 |
+
-webkit-box-sizing: border-box;
|
748 |
+
-moz-box-sizing: border-box;
|
749 |
+
box-sizing: border-box;
|
750 |
+
height: -webkit-calc( 100% - 55px );
|
751 |
+
height: calc( 100% - 55px );
|
752 |
+
min-height: -webkit-calc( 100% - 55px );
|
753 |
+
min-height: calc( 100% - 55px );
|
754 |
+
max-height: -webkit-calc( 100% - 55px );
|
755 |
+
max-height: calc( 100% - 55px );
|
756 |
padding: 20px 20px 20px 20px;
|
757 |
clear: both;
|
758 |
}
|
assets/js/import.js
CHANGED
@@ -567,7 +567,7 @@ var CartFlowsAjaxQueue = (function() {
|
|
567 |
// Add Params for API request.
|
568 |
var api_params = {
|
569 |
licence_args : CartFlowsImportVars.licence_args,
|
570 |
-
per_page :
|
571 |
_fields : CartFlowsImportVars.step_fields.toString(),
|
572 |
};
|
573 |
|
@@ -620,7 +620,7 @@ var CartFlowsAjaxQueue = (function() {
|
|
620 |
},
|
621 |
|
622 |
_apiAddParam_per_page: function() {
|
623 |
-
CartFlowsImport._api_params['per_page'] =
|
624 |
},
|
625 |
|
626 |
// Add Params for API request.
|
@@ -861,7 +861,7 @@ var CartFlowsAjaxQueue = (function() {
|
|
861 |
// Add Params for API request.
|
862 |
var api_params = {
|
863 |
licence_args : CartFlowsImportVars.licence_args,
|
864 |
-
per_page :
|
865 |
_fields : CartFlowsImportVars.step_fields.toString(),
|
866 |
};
|
867 |
|
@@ -981,37 +981,6 @@ var CartFlowsAjaxQueue = (function() {
|
|
981 |
|
982 |
},
|
983 |
|
984 |
-
_load_templates: function( args, trigger_name ) {
|
985 |
-
var self = CartFlowsImport;
|
986 |
-
|
987 |
-
if( $('body').hasClass('processing') ) {
|
988 |
-
return;
|
989 |
-
}
|
990 |
-
|
991 |
-
$('body').addClass('processing');
|
992 |
-
|
993 |
-
$.ajax({
|
994 |
-
url : ajaxurl,
|
995 |
-
type : 'POST',
|
996 |
-
data : {
|
997 |
-
action : 'cartflows_load_steps',
|
998 |
-
security: cartflows_admin.cf_load_steps_nonce,
|
999 |
-
args : args,
|
1000 |
-
},
|
1001 |
-
})
|
1002 |
-
.done(function( items, status, XHR )
|
1003 |
-
{
|
1004 |
-
self.doc.trigger( trigger_name, [items] );
|
1005 |
-
$('body').removeClass('processing');
|
1006 |
-
})
|
1007 |
-
.fail(function( jqXHR, textStatus )
|
1008 |
-
{
|
1009 |
-
})
|
1010 |
-
.always(function()
|
1011 |
-
{
|
1012 |
-
});
|
1013 |
-
},
|
1014 |
-
|
1015 |
_empty: function(data)
|
1016 |
{
|
1017 |
if(typeof(data) == 'number' || typeof(data) == 'boolean')
|
@@ -1089,6 +1058,7 @@ var CartFlowsAjaxQueue = (function() {
|
|
1089 |
var api_params = {
|
1090 |
licence_args : CartFlowsImportVars.licence_args,
|
1091 |
_fields : CartFlowsImportVars.flow_fields.toString(),
|
|
|
1092 |
};
|
1093 |
|
1094 |
// Page Builder.
|
567 |
// Add Params for API request.
|
568 |
var api_params = {
|
569 |
licence_args : CartFlowsImportVars.licence_args,
|
570 |
+
per_page : 100,
|
571 |
_fields : CartFlowsImportVars.step_fields.toString(),
|
572 |
};
|
573 |
|
620 |
},
|
621 |
|
622 |
_apiAddParam_per_page: function() {
|
623 |
+
CartFlowsImport._api_params['per_page'] = 100;
|
624 |
},
|
625 |
|
626 |
// Add Params for API request.
|
861 |
// Add Params for API request.
|
862 |
var api_params = {
|
863 |
licence_args : CartFlowsImportVars.licence_args,
|
864 |
+
per_page : 100,
|
865 |
_fields : CartFlowsImportVars.step_fields.toString(),
|
866 |
};
|
867 |
|
981 |
|
982 |
},
|
983 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
984 |
_empty: function(data)
|
985 |
{
|
986 |
if(typeof(data) == 'number' || typeof(data) == 'boolean')
|
1058 |
var api_params = {
|
1059 |
licence_args : CartFlowsImportVars.licence_args,
|
1060 |
_fields : CartFlowsImportVars.flow_fields.toString(),
|
1061 |
+
per_page : 100
|
1062 |
};
|
1063 |
|
1064 |
// Page Builder.
|
assets/min-css/frontend-rtl.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@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"}.cartflows-icon-arrow-thin-right:before{content:"\e901"}.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}.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:all;z-index:9999999}.wcf-preview-mode a{color:#fff}@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}.
|
1 |
+
@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"}.cartflows-icon-arrow-thin-right:before{content:"\e901"}.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}.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:all;z-index:9999999}.wcf-preview-mode a{color:#fff}@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}.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-bacs-bank-details,.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order .woocommerce-order-downloads,.woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{padding:0}.woocommerce-order .woocommerce-bacs-bank-details,.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order .woocommerce-order-downloads,.woocommerce-order ul.order_details{background:#f1f1f1;padding:1.5em 2.5em}.woocommerce-order .woocommerce-order-downloads__title,.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.wc-bacs-bank-details-heading,.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,.woocommerce-order-downloads table.shop_table{border:none;border-bottom:0;background-color:inherit;-webkit-border-radius:0;border-radius:0;font-family:inherit;font-weight:inherit;font-size:.95em;margin:0!important;border-collapse:collapse;text-align:right}.woocommerce-order-details table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.woocommerce-order-details table.shop_table th,.woocommerce-order-downloads table.shop_table th{border:none;font-weight:600;padding:9px 0;line-height:1.2em}.woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.woocommerce-order-details table.shop_table td,.woocommerce-order-details table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.woocommerce-order-details table.shop_table tbody th,.woocommerce-order-details table.shop_table tfoot td,.woocommerce-order-details table.shop_table tfoot th{font-weight:400;border:none}.woocommerce-order-details table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.woocommerce-order-details table.shop_table th.product-name,.woocommerce-order-details table.shop_table th.product-total{font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td,.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.recurring-total td,.woocommerce-order-details table.shop_table tfoot tr.recurring-total th,.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.woocommerce-order .wcf-col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.woocommerce-order .wcf-col2-set .wcf-col-1{margin-left:2%}.woocommerce-order .wcf-col2-set .wcf-col-1,.woocommerce-order .wcf-col2-set .wcf-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 .woocommerce-order-downloads{overflow-x:auto}.woocommerce-order-downloads table.shop_table td,.woocommerce-order-downloads table.shop_table th{padding:.5em .8em}.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 .wcf-col2-set{display:block}.woocommerce-order .wcf-col2-set .wcf-col-1,.woocommerce-order .wcf-col2-set .wcf-col-2{width:100%;display:block}}
|
assets/min-css/frontend.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@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"}.cartflows-icon-arrow-thin-right:before{content:"\e901"}.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}.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:all;z-index:9999999}.wcf-preview-mode a{color:#fff}@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}.
|
1 |
+
@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"}.cartflows-icon-arrow-thin-right:before{content:"\e901"}.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}.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:all;z-index:9999999}.wcf-preview-mode a{color:#fff}@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}.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-bacs-bank-details,.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order .woocommerce-order-downloads,.woocommerce-order ul.order_details{margin:0 0 2em;-webkit-border-radius:3px;border-radius:3px;width:100%;display:block}.woocommerce-order .woocommerce-bacs-bank-details ul.bacs_details{padding:0}.woocommerce-order .woocommerce-bacs-bank-details,.woocommerce-order .woocommerce-customer-details,.woocommerce-order .woocommerce-order-details,.woocommerce-order .woocommerce-order-downloads,.woocommerce-order ul.order_details{background:#f1f1f1;padding:1.5em 2.5em}.woocommerce-order .woocommerce-order-downloads__title,.woocommerce-order .woocommerce-thankyou-order-received,.woocommerce-order h2.wc-bacs-bank-details-heading,.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,.woocommerce-order-downloads table.shop_table{border:none;border-bottom:0;background-color:inherit;-webkit-border-radius:0;border-radius:0;font-family:inherit;font-weight:inherit;font-size:.95em;margin:0!important;border-collapse:collapse;text-align:left}.woocommerce-order-details table.shop_table #shipping_method{margin:0;padding:0;list-style:none}.woocommerce-order-details table.shop_table th,.woocommerce-order-downloads table.shop_table th{border:none;font-weight:600;padding:9px 0;line-height:1.2em}.woocommerce-order-details table.shop_table tfoot tr:last-child .woocommerce-Price-amount{font-size:1em}.woocommerce-order-details table.shop_table td,.woocommerce-order-details table.shop_table th{padding:.6em 0;line-height:1.4em;border:none}.woocommerce-order-details table.shop_table tbody th,.woocommerce-order-details table.shop_table tfoot td,.woocommerce-order-details table.shop_table tfoot th{font-weight:400;border:none}.woocommerce-order-details table.shop_table tbody{border-top:1px dashed #ccc;border-bottom:1px dashed #ccc}.woocommerce-order-details table.shop_table th.product-name,.woocommerce-order-details table.shop_table th.product-total{font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) td,.woocommerce-order-details table.shop_table tfoot tr.order-total:not(.recurring-total) th{font-weight:600;border-top:1px dashed #ccc}.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{padding-top:1.8em;font-weight:600}.woocommerce-order-details table.shop_table tfoot tr.recurring-total td,.woocommerce-order-details table.shop_table tfoot tr.recurring-total th,.woocommerce-order-details table.shop_table tfoot tr.recurring-totals th{vertical-align:top}.woocommerce-order .wcf-col2-set{-js-display:flex;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.woocommerce-order .wcf-col2-set .wcf-col-1{margin-right:2%}.woocommerce-order .wcf-col2-set .wcf-col-1,.woocommerce-order .wcf-col2-set .wcf-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 .woocommerce-order-downloads{overflow-x:auto}.woocommerce-order-downloads table.shop_table td,.woocommerce-order-downloads table.shop_table th{padding:.5em .8em}.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 .wcf-col2-set{display:block}.woocommerce-order .wcf-col2-set .wcf-col-1,.woocommerce-order .wcf-col2-set .wcf-col-2{width:100%;display:block}}
|
assets/min-css/import-rtl.min.css
CHANGED
@@ -1 +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:.6em;background:rgba(0,0,0,.8);color:#fff;font-weight:400;border:none;font-size:13px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;bottom:0;margin:0;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);left:0;right:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;-webkit-font-smoothing:antialiased}.template .notice a{color:#f16334}.template .notice p{padding:0;margin:0}#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 6px 2px 2px;line-height:25px;width:155px}#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}.wcf-notice-wrap{margin-top:20px;font-size:15px;color:red}.wcf-activate-wc{text-decoration:none}.wcf-activate-wc.button{border:none;-webkit-box-shadow:none;box-shadow:none}.wcf-hidden{display:none}
|
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:.6em;background:rgba(0,0,0,.8);color:#fff;font-weight:400;border:none;font-size:13px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;bottom:0;margin:0;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);left:0;right:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;-webkit-font-smoothing:antialiased}.template .notice a{color:#f16334}.template .notice p{padding:0;margin:0}#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 6px 2px 2px;line-height:25px;width:155px}#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:85%;max-height:85%;height:85%;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)}.wcf-templates-popup-content .wcf-templates-wrap{height:100%}@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-flow-actions{min-height:52px;max-height:55px}#wcf-remote-content{background-color:#f5f5f5;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;height:-webkit-calc(100% - 55px);height:calc(100% - 55px);min-height:-webkit-calc(100% - 55px);min-height:calc(100% - 55px);max-height:-webkit-calc(100% - 55px);max-height:calc(100% - 55px);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}.wcf-notice-wrap{margin-top:20px;font-size:15px;color:red}.wcf-activate-wc{text-decoration:none}.wcf-activate-wc.button{border:none;-webkit-box-shadow:none;box-shadow:none}.wcf-hidden{display:none}
|
assets/min-css/import.min.css
CHANGED
@@ -1 +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:.6em;background:rgba(0,0,0,.8);color:#fff;font-weight:400;border:none;font-size:13px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;bottom:0;margin:0;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);right:0;left:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;-webkit-font-smoothing:antialiased}.template .notice a{color:#f16334}.template .notice p{padding:0;margin:0}#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 2px 2px 6px;line-height:25px;width:155px}#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}.wcf-notice-wrap{margin-top:20px;font-size:15px;color:red}.wcf-activate-wc{text-decoration:none}.wcf-activate-wc.button{border:none;-webkit-box-shadow:none;box-shadow:none}.wcf-hidden{display:none}
|
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:.6em;background:rgba(0,0,0,.8);color:#fff;font-weight:400;border:none;font-size:13px;text-decoration:none;position:absolute;width:100%;vertical-align:middle;bottom:0;margin:0;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);right:0;left:0;z-index:4;text-align:center;-webkit-border-radius:3px;border-radius:0;-webkit-transition:opacity .1s ease-in-out;transition:opacity .1s ease-in-out;-webkit-font-smoothing:antialiased}.template .notice a{color:#f16334}.template .notice p{padding:0;margin:0}#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 2px 2px 6px;line-height:25px;width:155px}#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:85%;max-height:85%;height:85%;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)}.wcf-templates-popup-content .wcf-templates-wrap{height:100%}@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-flow-actions{min-height:52px;max-height:55px}#wcf-remote-content{background-color:#f5f5f5;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;height:-webkit-calc(100% - 55px);height:calc(100% - 55px);min-height:-webkit-calc(100% - 55px);min-height:calc(100% - 55px);max-height:-webkit-calc(100% - 55px);max-height:calc(100% - 55px);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}.wcf-notice-wrap{margin-top:20px;font-size:15px;color:red}.wcf-activate-wc{text-decoration:none}.wcf-activate-wc.button{border:none;-webkit-box-shadow:none;box-shadow:none}.wcf-hidden{display:none}
|
assets/min-js/import.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var CartFlowsAjaxQueue=function(){var a=[];return{add:function(t){a.push(t)},remove:function(t){-1<jQuery.inArray(t,a)&&a.splice($.inArray(t,a),1)},run:function(){var t,e=this;a.length?(t=a[0].complete,a[0].complete=function(){"function"==typeof t&&t(),a.shift(),e.run.apply(e,[])},jQuery.ajax(a[0])):e.tid=setTimeout(function(){e.run.apply(e,[])},1e3)},stop:function(){a=[],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,woo_required_steps:["checkout","upsell","downsell","thankyou","optin"],step_order:["landing","checkout","upsell","downsell","thankyou","optin"],new_step_names:{landing:"Landing",checkout:"Checkout (Woo)",upsell:"Upsell (Woo)",downsell:"Downsell (Woo)",thankyou:"Thank You (Woo)",optin:"Optin (Woo)"},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 a=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return a?a[2]?decodeURIComponent(a[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-get-started-steps",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),c(document).on("click",".wcf-activate-wc",t._installWc)},_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 a=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(a,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,security:CartFlowsImportVars.cartflows_activate_plugin_nonce},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,a){t.preventDefault(),"no"===CartFlowsImportVars.is_wc_activated&&CartFlowsImport._activateWc();var e=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(e,function(t,e){"install"===e.status&&a.slug===e.slug&&c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:e.init,security:CartFlowsImportVars.cartflows_activate_plugin_nonce}}).done(function(t,e,a){CartFlowsImport.remaining_install_plugins--,CartFlowsImport.remaining_install_plugins||CartFlowsImport._activate_all_plugins()})})},_api_request_failed:function(t,e,a,s){"error"==s&&(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 a=c(this).attr("href");c(a).removeClass("hide"),c(a).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"),a=e.attr("data-view")||"";c("#TB_window").removeClass("desktop tablet mobile"),c("#TB_window").addClass(a),c(".actions .dashicons").removeClass("active"),e.addClass("active"),c("#TB_iframeContent").removeClass(),c("#TB_iframeContent").addClass(a)},_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(),c(".wcf-notice-wrap").remove(),c(".cartflows-step-import-blank").css("pointer-events","auto").removeClass("disabled");var e=c(".step-type-filter-links").find("option:selected").val()||"";if(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(".step-type-filter-links").find("option:selected").data("slug"),!("no"!==CartFlowsImportVars.is_wc_installed&&"no"!==CartFlowsImportVars.is_wc_activated||"upsell"!==$step_type&&"downsell"!==$step_type&&"checkout"!==$step_type&&"thankyou"!==$step_type))return c(".cartflows-step-import-blank").after("<p class='wcf-notice-wrap' style='text-align: center'>You need WooCommerce plugin installed and actived to use this product flow. <br/><br/> <a href='#' class='wcf-activate-wc button-secondary'> Click here to install and activate WooCommerce </a> </p>"),void c(".cartflows-step-import-blank").addClass("disabled").css("pointer-events","none");"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 r=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("title")||"Page Builder";""!==e&&"all"!==e&&(t[CartFlowsImportVars.step_page_builder]=e);var a={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(a,function(a){a.current_step_type=s,"yes"!==CartFlowsImportVars.is_wc_activated&&c.each(a.items,function(t,e){a.items[t].woo_required=!1,0<=c.inArray(e.step_type.slug,CartFlowsImport.woo_required_steps)&&(a.items[t].woo_required=!0)});var t=wp.template("cartflows-steps-list");parseInt(a.items_count)?c("#wcf-remote-step-list").html(t(a)):(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 "+r+'.<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"),a=CartFlowsImport;t.val()||(t.val("CartFlows #"+a.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,a=!0;c.each(t,function(t,e){a&&("install"!==e.status&&"activate"!==e.status||(a=!1))}),!1===a?(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 a={licence_args:CartFlowsImportVars.licence_args,hide_empty:!0,_fields:CartFlowsImportVars.flow_type_fields.toString()},s={remote_slug:CartFlowsImportVars.flow_type,slug:CartFlowsImportVars.flow_type+"?"+decodeURIComponent(c.param(a)),wrapper_class:"flow-type-filter-links filter-links",show_all:!1};CartFlowsAPI._api_request(s,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,a=!0;c.each(t,function(t,e){a&&("install"!==e.status&&"activate"!==e.status||(a=!1))}),!1===a?(c(".wcf-page-builder-notice").html(wp.template("cartflows-page-builder-notice")),c("#wcf-remote-step-list").find(".spinner").remove()):CartFlowsImport._cache_remote_steps()}},mapOrder:function(t,r,o){return t.sort(function(t,e){var a=t[o],s=e[o];return-1===r.indexOf(a)?0:r.indexOf(a)>r.indexOf(s)?1:-1}),t},_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){t.items=CartFlowsImport.mapOrder(t.items,CartFlowsImport.step_order,"slug");var s=t,r=t.items_count;if(t.items)for(key in t.items){t.items[key].name=CartFlowsImport.new_step_names[t.items[key].slug];var e={licence_args:CartFlowsImportVars.licence_args,per_page:15,_fields:CartFlowsImportVars.step_fields.toString()};e[CartFlowsImportVars.step_type]=t.items[key].id;var a={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(e))};CartFlowsAPI._api_request(a,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 a=wp.template("cartflows-term-filters-dropdown");e=wp.template("cartflows-term-filters");c("#wcf-categories").html(e(s)),c("#wcf-scratch-steps-categories").html(a(s)),c("#wcf-scratch-steps-categories").find("option:first").addClass("current"),c("#wcf-categories").find("li a[data-slug=landing]").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 s=[];return c.each(t,function(t,e){var a=e.step_type.slug;void 0===s[a]&&(s[a]=[]),s[a].push(e)}),s},_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,s,r){var o=CartFlowsImport;c.ajax({url:ajaxurl,type:"POST",data:t}).done(function(t,e,a){s&&"function"==typeof s&&s({request:t,status:e,XHR:a}),o.doc.trigger(r+"-done",[t,e,a])}).fail(function(t,e){o.doc.trigger(r+"-fail",[t,e])}).always(function(){o.doc.trigger(r+"-always")})},_load_templates:function(t,s){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,a){r.doc.trigger(s,[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 a in t)t.hasOwnProperty(a)&&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 a={remote_slug:CartFlowsImportVars.flow,slug:CartFlowsImportVars.flow+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(a,function(s){"yes"!==CartFlowsImportVars.is_wc_activated&&c.each(s.items,function(a,t){s.items[a].woo_required=!1,c.each(t.flow_steps,function(t,e){0<=c.inArray(e.type,CartFlowsImport.woo_required_steps)&&(s.items[a].woo_required=!0)})});var t=wp.template("cartflows-flows-list");parseInt(s.items_count)?c("#wcf-remote-flow-list").html(t(s)):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,a=c(this);if(!a.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process"),a.addClass("updating-message").text("Creating Flow.."),a.parents(".template").addClass("importing");var s={action:"cartflows_default_flow",security:cartflows_admin.cf_default_flow_nonce};e._ajax(s,function(t){if(t.request.success){var e=t.request.data;setTimeout(function(){a.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=CartFlowsImport,a={action:"cartflows_activate_plugin",plugin_init:t,security:CartFlowsImportVars.cartflows_activate_plugin_nonce};e._ajax(a,function(t){})},_process_import_flow:function(t){t.preventDefault();var s=c(this);if(!s.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process");var e=CartFlowsImport;s.text("Creating Flow.."),s.addClass("updating-message"),s.parents(".template").addClass("importing");var a=s.data("flow-steps")||"",r=""!==a?JSON.parse("["+a+"]"):[],o={action:"cartflows_create_flow",security:cartflows_admin.cf_create_flow_nonce};e._ajax(o,function(t){if(t.request.success){var a=t.request.data;r&&(CartFlowsAjaxQueue.stop(),CartFlowsAjaxQueue.run(),CartFlowsImport.all_steps=r.length,s.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:a,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?(s.addClass("updating-message").text("Imported Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message").text("All Imported! Redirecting.."),window.location=CartFlowsImportVars.admin_url+"post.php?post="+a+"&action=edit"},3e3)):s.addClass("updating-message").text("Importing Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps)},error:function(t){CartFlowsImport.remaining_steps=CartFlowsImport.remaining_steps+1,template=s.parents(".template.importing"),template.find(".preview").addClass("notice notice-warning").removeClass("preview").text(t.statusText),CartFlowsImport.remaining_steps===CartFlowsImport.all_steps?(s.addClass("updating-message").text("Failed "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message button-primary").addClass("disabled")},3e3)):s.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?(s.addClass("updating-message").text("Imported "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message").text("All Step Imported! Reloading.."),location.reload()},3e3)):s.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 a=c(this),e=CartFlowsImport,s=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(all_step_type=["landing","checkout","thankyou"],c("#wcf-start-from-scratch .wcf-notice-wrap ").remove(),""!==l){if(CartFlowsImportVars._is_pro_active||"upsell"!==l&&"downsell"!==l){if(a.parents(".template").addClass("importing"),!CartFlowsImportVars._is_pro_active)if("-1"!=jQuery.inArray(l,all_step_type))if(0<c('.wcf-step-wrap[data-term-slug="'+l+'"]').length){a.parents(".template.importing");return a.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 '+l.charAt(0).toUpperCase()+l.slice(1)+" step.</p></div></div>")}if(c("#wcf-remote-step-importer").addClass("request-process"),c(".cartflows-step-import").addClass("disabled"),a.addClass("importing updating-message").text("Creating.."),c("body").hasClass("post-type-cartflows_flow")){var n={action:"cartflows_step_create_blank",flow_id:s,step_type:l,step_title:p,security:cartflows_admin.cf_step_create_blank_nonce};e._ajax(n,function(t){CartFlowsImport;var e=a.parents(".template.importing");t.request.success?(a.text("Created. Reloading.."),setTimeout(function(){window.location.href=window.location.href+"&highlight-step-id="+t.request.data},3e3)):(a.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 a=c(this),e=a.data("slug")||"",s=c('.wcf-step-wrap[data-term-slug="'+e+'"]').length||1;if((step_title=a.data("title")||"",step_custom_title=step_title+" "+(parseInt(s)+1),o=CartFlowsImport,all_step_slug=["landing","checkout","thankyou"],!CartFlowsImportVars._is_pro_active)&&("-1"!=jQuery.inArray(e,all_step_slug)&&0<c('.wcf-step-wrap[data-term-slug="'+e+'"]').length)){var r=a.parents(".template");return a.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 "+e.charAt(0).toUpperCase()+e.slice(1)+" step"),void c("#wcf-remote-step-importer").removeClass("request-process")}if(!a.hasClass("updating-message")){c("#wcf-remote-step-importer").addClass("request-process");var o=CartFlowsImport;a.addClass("updating-message"),a.parents(".template").addClass("importing");var l=a.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"),a.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=a.parents(".template.importing");t.request.success?(a.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"),a.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,a){t.preventDefault();CartFlowsImport;var s=c(".wcf-flow-steps-data-wrap-importer .template.importing");s.find(".cartflows-step-import").removeClass("importing updating-message").text("Import Failed!"),s.find(".preview").addClass("notice notice-warning").removeClass("preview").text(e.responseText)},_activateWc:function(t){c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:"woocommerce/woocommerce.php",security:CartFlowsImportVars.cartflows_activate_plugin_nonce}}).done(function(t,e,a){c(".wcf-notice-wrap").addClass("wcf-hidden"),c(".cartflows-template-selector").removeAttr("disabled"),CartFlowsImport.wc_installed=!0,CartFlowsImportVars.is_wc_installed="yes",CartFlowsImportVars.is_wc_activated="yes",location.reload(!0),window.location.search+="&add-new-flow"})},_installWc:function(t){c(this).addClass("updating-message button"),c(this).text(cartflows_admin.wc_activating_message),0==cartflows_admin.wc_status.installed?(wp.updates.shouldRequestFilesystemCredentials&&!wp.updates.ajaxLocked&&(wp.updates.requestFilesystemCredentials(t),$document.on("credential-modal-cancel",function(){c(".install-now.updating-message").removeClass("updating-message").text(wp.updates.l10n.installNow),wp.a11y.speak(wp.updates.l10n.updateCancel,"polite")})),wp.updates.installPlugin({slug:"woocommerce"})):CartFlowsImport._activateWc()}},c(function(){CartFlowsImport.init()})}(jQuery);
|
1 |
+
var CartFlowsAjaxQueue=function(){var a=[];return{add:function(t){a.push(t)},remove:function(t){-1<jQuery.inArray(t,a)&&a.splice($.inArray(t,a),1)},run:function(){var t,e=this;a.length?(t=a[0].complete,a[0].complete=function(){"function"==typeof t&&t(),a.shift(),e.run.apply(e,[])},jQuery.ajax(a[0])):e.tid=setTimeout(function(){e.run.apply(e,[])},1e3)},stop:function(){a=[],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,woo_required_steps:["checkout","upsell","downsell","thankyou","optin"],step_order:["landing","checkout","upsell","downsell","thankyou","optin"],new_step_names:{landing:"Landing",checkout:"Checkout (Woo)",upsell:"Upsell (Woo)",downsell:"Downsell (Woo)",thankyou:"Thank You (Woo)",optin:"Optin (Woo)"},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 a=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return a?a[2]?decodeURIComponent(a[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-get-started-steps",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),c(document).on("click",".wcf-activate-wc",t._installWc)},_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 a=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(a,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,security:CartFlowsImportVars.cartflows_activate_plugin_nonce},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,a){t.preventDefault(),"no"===CartFlowsImportVars.is_wc_activated&&CartFlowsImport._activateWc();var e=CartFlowsImportVars.required_plugins[CartFlowsImportVars.default_page_builder].plugins;c.each(e,function(t,e){"install"===e.status&&a.slug===e.slug&&c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:e.init,security:CartFlowsImportVars.cartflows_activate_plugin_nonce}}).done(function(t,e,a){CartFlowsImport.remaining_install_plugins--,CartFlowsImport.remaining_install_plugins||CartFlowsImport._activate_all_plugins()})})},_api_request_failed:function(t,e,a,s){"error"==s&&(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 a=c(this).attr("href");c(a).removeClass("hide"),c(a).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"),a=e.attr("data-view")||"";c("#TB_window").removeClass("desktop tablet mobile"),c("#TB_window").addClass(a),c(".actions .dashicons").removeClass("active"),e.addClass("active"),c("#TB_iframeContent").removeClass(),c("#TB_iframeContent").addClass(a)},_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(),c(".wcf-notice-wrap").remove(),c(".cartflows-step-import-blank").css("pointer-events","auto").removeClass("disabled");var e=c(".step-type-filter-links").find("option:selected").val()||"";if(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(".step-type-filter-links").find("option:selected").data("slug"),!("no"!==CartFlowsImportVars.is_wc_installed&&"no"!==CartFlowsImportVars.is_wc_activated||"upsell"!==$step_type&&"downsell"!==$step_type&&"checkout"!==$step_type&&"thankyou"!==$step_type))return c(".cartflows-step-import-blank").after("<p class='wcf-notice-wrap' style='text-align: center'>You need WooCommerce plugin installed and actived to use this product flow. <br/><br/> <a href='#' class='wcf-activate-wc button-secondary'> Click here to install and activate WooCommerce </a> </p>"),void c(".cartflows-step-import-blank").addClass("disabled").css("pointer-events","none");"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:100,_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 r=c("#wcf-page-builders .wcf-page-builder-links").find(".current").data("title")||"Page Builder";""!==e&&"all"!==e&&(t[CartFlowsImportVars.step_page_builder]=e);var a={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(a,function(a){a.current_step_type=s,"yes"!==CartFlowsImportVars.is_wc_activated&&c.each(a.items,function(t,e){a.items[t].woo_required=!1,0<=c.inArray(e.step_type.slug,CartFlowsImport.woo_required_steps)&&(a.items[t].woo_required=!0)});var t=wp.template("cartflows-steps-list");parseInt(a.items_count)?c("#wcf-remote-step-list").html(t(a)):(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 "+r+'.<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=100},_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"),a=CartFlowsImport;t.val()||(t.val("CartFlows #"+a.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,a=!0;c.each(t,function(t,e){a&&("install"!==e.status&&"activate"!==e.status||(a=!1))}),!1===a?(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 a={licence_args:CartFlowsImportVars.licence_args,hide_empty:!0,_fields:CartFlowsImportVars.flow_type_fields.toString()},s={remote_slug:CartFlowsImportVars.flow_type,slug:CartFlowsImportVars.flow_type+"?"+decodeURIComponent(c.param(a)),wrapper_class:"flow-type-filter-links filter-links",show_all:!1};CartFlowsAPI._api_request(s,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,a=!0;c.each(t,function(t,e){a&&("install"!==e.status&&"activate"!==e.status||(a=!1))}),!1===a?(c(".wcf-page-builder-notice").html(wp.template("cartflows-page-builder-notice")),c("#wcf-remote-step-list").find(".spinner").remove()):CartFlowsImport._cache_remote_steps()}},mapOrder:function(t,r,o){return t.sort(function(t,e){var a=t[o],s=e[o];return-1===r.indexOf(a)?0:r.indexOf(a)>r.indexOf(s)?1:-1}),t},_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){t.items=CartFlowsImport.mapOrder(t.items,CartFlowsImport.step_order,"slug");var s=t,r=t.items_count;if(t.items)for(key in t.items){t.items[key].name=CartFlowsImport.new_step_names[t.items[key].slug];var e={licence_args:CartFlowsImportVars.licence_args,per_page:100,_fields:CartFlowsImportVars.step_fields.toString()};e[CartFlowsImportVars.step_type]=t.items[key].id;var a={remote_slug:CartFlowsImportVars.step,slug:CartFlowsImportVars.step+"?"+decodeURIComponent(c.param(e))};CartFlowsAPI._api_request(a,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 a=wp.template("cartflows-term-filters-dropdown");e=wp.template("cartflows-term-filters");c("#wcf-categories").html(e(s)),c("#wcf-scratch-steps-categories").html(a(s)),c("#wcf-scratch-steps-categories").find("option:first").addClass("current"),c("#wcf-categories").find("li a[data-slug=landing]").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 s=[];return c.each(t,function(t,e){var a=e.step_type.slug;void 0===s[a]&&(s[a]=[]),s[a].push(e)}),s},_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,s,r){var o=CartFlowsImport;c.ajax({url:ajaxurl,type:"POST",data:t}).done(function(t,e,a){s&&"function"==typeof s&&s({request:t,status:e,XHR:a}),o.doc.trigger(r+"-done",[t,e,a])}).fail(function(t,e){o.doc.trigger(r+"-fail",[t,e])}).always(function(){o.doc.trigger(r+"-always")})},_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 a in t)t.hasOwnProperty(a)&&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(),per_page:100},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 a={remote_slug:CartFlowsImportVars.flow,slug:CartFlowsImportVars.flow+"?"+decodeURIComponent(c.param(t))};CartFlowsAPI._api_request(a,function(s){"yes"!==CartFlowsImportVars.is_wc_activated&&c.each(s.items,function(a,t){s.items[a].woo_required=!1,c.each(t.flow_steps,function(t,e){0<=c.inArray(e.type,CartFlowsImport.woo_required_steps)&&(s.items[a].woo_required=!0)})});var t=wp.template("cartflows-flows-list");parseInt(s.items_count)?c("#wcf-remote-flow-list").html(t(s)):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,a=c(this);if(!a.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process"),a.addClass("updating-message").text("Creating Flow.."),a.parents(".template").addClass("importing");var s={action:"cartflows_default_flow",security:cartflows_admin.cf_default_flow_nonce};e._ajax(s,function(t){if(t.request.success){var e=t.request.data;setTimeout(function(){a.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=CartFlowsImport,a={action:"cartflows_activate_plugin",plugin_init:t,security:CartFlowsImportVars.cartflows_activate_plugin_nonce};e._ajax(a,function(t){})},_process_import_flow:function(t){t.preventDefault();var s=c(this);if(!s.hasClass("updating-message")){c("#wcf-remote-flow-importer").addClass("request-process");var e=CartFlowsImport;s.text("Creating Flow.."),s.addClass("updating-message"),s.parents(".template").addClass("importing");var a=s.data("flow-steps")||"",r=""!==a?JSON.parse("["+a+"]"):[],o={action:"cartflows_create_flow",security:cartflows_admin.cf_create_flow_nonce};e._ajax(o,function(t){if(t.request.success){var a=t.request.data;r&&(CartFlowsAjaxQueue.stop(),CartFlowsAjaxQueue.run(),CartFlowsImport.all_steps=r.length,s.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:a,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?(s.addClass("updating-message").text("Imported Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message").text("All Imported! Redirecting.."),window.location=CartFlowsImportVars.admin_url+"post.php?post="+a+"&action=edit"},3e3)):s.addClass("updating-message").text("Importing Step "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps)},error:function(t){CartFlowsImport.remaining_steps=CartFlowsImport.remaining_steps+1,template=s.parents(".template.importing"),template.find(".preview").addClass("notice notice-warning").removeClass("preview").text(t.statusText),CartFlowsImport.remaining_steps===CartFlowsImport.all_steps?(s.addClass("updating-message").text("Failed "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message button-primary").addClass("disabled")},3e3)):s.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?(s.addClass("updating-message").text("Imported "+CartFlowsImport.remaining_steps+" of "+CartFlowsImport.all_steps),setTimeout(function(){s.removeClass("updating-message").text("All Step Imported! Reloading.."),location.reload()},3e3)):s.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 a=c(this),e=CartFlowsImport,s=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(all_step_type=["landing","checkout","thankyou"],c("#wcf-start-from-scratch .wcf-notice-wrap ").remove(),""!==l){if(CartFlowsImportVars._is_pro_active||"upsell"!==l&&"downsell"!==l){if(a.parents(".template").addClass("importing"),!CartFlowsImportVars._is_pro_active)if("-1"!=jQuery.inArray(l,all_step_type))if(0<c('.wcf-step-wrap[data-term-slug="'+l+'"]').length){a.parents(".template.importing");return a.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 '+l.charAt(0).toUpperCase()+l.slice(1)+" step.</p></div></div>")}if(c("#wcf-remote-step-importer").addClass("request-process"),c(".cartflows-step-import").addClass("disabled"),a.addClass("importing updating-message").text("Creating.."),c("body").hasClass("post-type-cartflows_flow")){var n={action:"cartflows_step_create_blank",flow_id:s,step_type:l,step_title:p,security:cartflows_admin.cf_step_create_blank_nonce};e._ajax(n,function(t){CartFlowsImport;var e=a.parents(".template.importing");t.request.success?(a.text("Created. Reloading.."),setTimeout(function(){window.location.href=window.location.href+"&highlight-step-id="+t.request.data},3e3)):(a.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 a=c(this),e=a.data("slug")||"",s=c('.wcf-step-wrap[data-term-slug="'+e+'"]').length||1;if((step_title=a.data("title")||"",step_custom_title=step_title+" "+(parseInt(s)+1),o=CartFlowsImport,all_step_slug=["landing","checkout","thankyou"],!CartFlowsImportVars._is_pro_active)&&("-1"!=jQuery.inArray(e,all_step_slug)&&0<c('.wcf-step-wrap[data-term-slug="'+e+'"]').length)){var r=a.parents(".template");return a.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 "+e.charAt(0).toUpperCase()+e.slice(1)+" step"),void c("#wcf-remote-step-importer").removeClass("request-process")}if(!a.hasClass("updating-message")){c("#wcf-remote-step-importer").addClass("request-process");var o=CartFlowsImport;a.addClass("updating-message"),a.parents(".template").addClass("importing");var l=a.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"),a.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=a.parents(".template.importing");t.request.success?(a.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"),a.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,a){t.preventDefault();CartFlowsImport;var s=c(".wcf-flow-steps-data-wrap-importer .template.importing");s.find(".cartflows-step-import").removeClass("importing updating-message").text("Import Failed!"),s.find(".preview").addClass("notice notice-warning").removeClass("preview").text(e.responseText)},_activateWc:function(t){c.ajax({url:ajaxurl,type:"POST",data:{action:"cartflows_activate_plugin",plugin_init:"woocommerce/woocommerce.php",security:CartFlowsImportVars.cartflows_activate_plugin_nonce}}).done(function(t,e,a){c(".wcf-notice-wrap").addClass("wcf-hidden"),c(".cartflows-template-selector").removeAttr("disabled"),CartFlowsImport.wc_installed=!0,CartFlowsImportVars.is_wc_installed="yes",CartFlowsImportVars.is_wc_activated="yes",location.reload(!0),window.location.search+="&add-new-flow"})},_installWc:function(t){c(this).addClass("updating-message button"),c(this).text(cartflows_admin.wc_activating_message),0==cartflows_admin.wc_status.installed?(wp.updates.shouldRequestFilesystemCredentials&&!wp.updates.ajaxLocked&&(wp.updates.requestFilesystemCredentials(t),$document.on("credential-modal-cancel",function(){c(".install-now.updating-message").removeClass("updating-message").text(wp.updates.l10n.installNow),wp.a11y.speak(wp.updates.l10n.updateCancel,"polite")})),wp.updates.installPlugin({slug:"woocommerce"})):CartFlowsImport._activateWc()}},c(function(){CartFlowsImport.init()})}(jQuery);
|
cartflows.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
-
* Version: 1.5.
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
10 |
* WC requires at least: 3.0
|
11 |
-
* WC tested up to: 4.0.
|
12 |
*
|
13 |
* @package CartFlows
|
14 |
*/
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
+
* Version: 1.5.4
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
10 |
* WC requires at least: 3.0
|
11 |
+
* WC tested up to: 4.0.1
|
12 |
*
|
13 |
* @package CartFlows
|
14 |
*/
|
changelog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
Version 1.5.3 - Wednesday, 1st April 2020
|
2 |
- Improvement: Divi CSS support added for Optin step type.
|
3 |
- Fix: FB Pixel php notice issue & conflict with Beaver Builder.
|
1 |
+
Version 1.5.4 - Tuesday, 7th April 2020
|
2 |
+
- Improvement: Hardened the security of the plugin.
|
3 |
+
- Fix: Older flows were not displaying in the library.
|
4 |
+
|
5 |
Version 1.5.3 - Wednesday, 1st April 2020
|
6 |
- Improvement: Divi CSS support added for Optin step type.
|
7 |
- Fix: FB Pixel php notice issue & conflict with Beaver Builder.
|
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.
|
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' => '
|
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' => '
|
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.
|
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' => '100',
|
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' => '100',
|
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-compatibility.php
CHANGED
@@ -1,447 +1,447 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Page builder compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class for page builder compatibility
|
12 |
-
*/
|
13 |
-
class Cartflows_Compatibility {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Member Variable
|
17 |
-
*
|
18 |
-
* @var object instance
|
19 |
-
*/
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Initiator
|
24 |
-
*/
|
25 |
-
public static function get_instance() {
|
26 |
-
if ( ! isset( self::$instance ) ) {
|
27 |
-
self::$instance = new self();
|
28 |
-
}
|
29 |
-
return self::$instance;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Constructor
|
34 |
-
*/
|
35 |
-
public function __construct() {
|
36 |
-
|
37 |
-
$this->load_files();
|
38 |
-
|
39 |
-
// Override post meta.
|
40 |
-
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
-
|
42 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Load page builder compatibility files
|
47 |
-
*/
|
48 |
-
public function load_files() {
|
49 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
-
}
|
52 |
-
|
53 |
-
if ( $this->is_divi_enabled() ) {
|
54 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
-
}
|
56 |
-
|
57 |
-
if ( $this->is_bb_enabled() ) {
|
58 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( defined( 'LEARNDASH_VERSION' ) ) {
|
66 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Check if it is beaver builder enabled.
|
72 |
-
*
|
73 |
-
* @since 1.1.4
|
74 |
-
*/
|
75 |
-
public function is_bb_enabled() {
|
76 |
-
|
77 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Check if elementor preview mode is on.
|
86 |
-
*/
|
87 |
-
public function is_elementor_preview_mode() {
|
88 |
-
|
89 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
90 |
-
|
91 |
-
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
92 |
-
return true;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Get Current Theme.
|
101 |
-
*/
|
102 |
-
public function get_current_theme() {
|
103 |
-
|
104 |
-
$theme_name = '';
|
105 |
-
$theme = wp_get_theme();
|
106 |
-
|
107 |
-
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
108 |
-
$theme_name = $theme->parent_theme;
|
109 |
-
} else {
|
110 |
-
$theme_name = $theme->name;
|
111 |
-
}
|
112 |
-
return $theme_name;
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Check if it is beaver builder preview mode
|
117 |
-
*/
|
118 |
-
public function is_bb_preview_mode() {
|
119 |
-
|
120 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
121 |
-
if ( FLBuilderModel::is_builder_active() ) {
|
122 |
-
return true;
|
123 |
-
} else {
|
124 |
-
return false;
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
return false;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Check for page builder preview mode.
|
133 |
-
*/
|
134 |
-
public function is_page_builder_preview() {
|
135 |
-
|
136 |
-
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
|
137 |
-
return true;
|
138 |
-
}
|
139 |
-
|
140 |
-
return false;
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Check if divi builder enabled for post id.
|
145 |
-
*/
|
146 |
-
public function is_divi_builder_preview() {
|
147 |
-
|
148 |
-
if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) { //phpcs:ignore
|
149 |
-
return true;
|
150 |
-
}
|
151 |
-
|
152 |
-
return false;
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Check if divi builder enabled for post id.
|
157 |
-
*
|
158 |
-
* @param int $post_id post id.
|
159 |
-
*/
|
160 |
-
public function is_divi_builder_enabled( $post_id ) {
|
161 |
-
|
162 |
-
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
163 |
-
return true;
|
164 |
-
}
|
165 |
-
|
166 |
-
return false;
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Check if compatibility theme enabled.
|
171 |
-
*/
|
172 |
-
public function is_compatibility_theme_enabled() {
|
173 |
-
|
174 |
-
$theme = wp_get_theme();
|
175 |
-
|
176 |
-
$is_compatibility = false;
|
177 |
-
|
178 |
-
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) || $this->is_pro_enabled( $theme ) || $this->is_kallyas_enabled( $theme ) ) {
|
179 |
-
|
180 |
-
$is_compatibility = true;
|
181 |
-
}
|
182 |
-
|
183 |
-
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Check if pro theme enabled for post id.
|
188 |
-
*
|
189 |
-
* @param object $theme theme data.
|
190 |
-
* @return boolean
|
191 |
-
*/
|
192 |
-
public function is_pro_enabled( $theme = false ) {
|
193 |
-
|
194 |
-
if ( ! $theme ) {
|
195 |
-
$theme = wp_get_theme();
|
196 |
-
}
|
197 |
-
|
198 |
-
if ( 'Pro' == $theme->name ) {
|
199 |
-
return true;
|
200 |
-
}
|
201 |
-
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Check if kallyas theme enabled for post id.
|
207 |
-
*
|
208 |
-
* @param object $theme theme data.
|
209 |
-
* @return boolean
|
210 |
-
*/
|
211 |
-
public function is_kallyas_enabled( $theme = false ) {
|
212 |
-
|
213 |
-
if ( ! $theme ) {
|
214 |
-
$theme = wp_get_theme();
|
215 |
-
}
|
216 |
-
|
217 |
-
if ( 'Kallyas' == $theme->name ) {
|
218 |
-
return true;
|
219 |
-
}
|
220 |
-
|
221 |
-
return false;
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Check if divi builder enabled for post id.
|
226 |
-
*
|
227 |
-
* @param object $theme theme data.
|
228 |
-
* @return boolean
|
229 |
-
*/
|
230 |
-
public function is_divi_enabled( $theme = false ) {
|
231 |
-
|
232 |
-
if ( ! $theme ) {
|
233 |
-
$theme = wp_get_theme();
|
234 |
-
}
|
235 |
-
|
236 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
237 |
-
return true;
|
238 |
-
}
|
239 |
-
|
240 |
-
return false;
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Check if Divi theme is install status.
|
245 |
-
*
|
246 |
-
* @return boolean
|
247 |
-
*/
|
248 |
-
public function is_divi_theme_installed() {
|
249 |
-
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
250 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
251 |
-
return true;
|
252 |
-
}
|
253 |
-
}
|
254 |
-
return false;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Check if Flatsome enabled for post id.
|
259 |
-
*
|
260 |
-
* @param object $theme theme data.
|
261 |
-
* @return boolean
|
262 |
-
*/
|
263 |
-
public function is_flatsome_enabled( $theme = false ) {
|
264 |
-
|
265 |
-
if ( ! $theme ) {
|
266 |
-
$theme = wp_get_theme();
|
267 |
-
}
|
268 |
-
|
269 |
-
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
270 |
-
return true;
|
271 |
-
}
|
272 |
-
|
273 |
-
return false;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Check if The7 enabled for post id.
|
278 |
-
*
|
279 |
-
* @param object $theme theme data.
|
280 |
-
* @return boolean
|
281 |
-
*/
|
282 |
-
public function is_the_seven_enabled( $theme = false ) {
|
283 |
-
|
284 |
-
if ( ! $theme ) {
|
285 |
-
$theme = wp_get_theme();
|
286 |
-
}
|
287 |
-
|
288 |
-
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
289 |
-
return true;
|
290 |
-
}
|
291 |
-
|
292 |
-
return false;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* Check if OceanWp enabled for post id.
|
297 |
-
*
|
298 |
-
* @param object $theme theme data.
|
299 |
-
* @return boolean
|
300 |
-
*/
|
301 |
-
public function is_oceanwp_enabled( $theme = false ) {
|
302 |
-
|
303 |
-
if ( ! $theme ) {
|
304 |
-
$theme = wp_get_theme();
|
305 |
-
}
|
306 |
-
|
307 |
-
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
308 |
-
return true;
|
309 |
-
}
|
310 |
-
|
311 |
-
return false;
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Check for thrive architect edit page.
|
316 |
-
*
|
317 |
-
* @param int $post_id post id.
|
318 |
-
*/
|
319 |
-
public function is_thrive_edit_page( $post_id ) {
|
320 |
-
|
321 |
-
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
322 |
-
return true;
|
323 |
-
} else {
|
324 |
-
return false;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
/**
|
329 |
-
* Check if the page being rendered is the main ID on the editor page.
|
330 |
-
*
|
331 |
-
* @since 1.0.0
|
332 |
-
* @param String $post_id Post ID which is to be rendered.
|
333 |
-
* @return boolean True if current if is being rendered is not being edited.
|
334 |
-
*/
|
335 |
-
private function is_thrive_builder_page( $post_id ) {
|
336 |
-
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false; //phpcs:ignore
|
337 |
-
$post = isset( $_GET['post'] ) ? intval( wp_unslash( $_GET['post'] ) ) : false; //phpcs:ignore
|
338 |
-
|
339 |
-
return ( true == $tve && $post_id !== $post );
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Overwrite meta for page
|
344 |
-
*/
|
345 |
-
public function override_meta() {
|
346 |
-
|
347 |
-
// don't override meta for `elementor_library` post type.
|
348 |
-
if ( 'elementor_library' == get_post_type() ) {
|
349 |
-
return;
|
350 |
-
}
|
351 |
-
|
352 |
-
if ( ! is_singular() ) {
|
353 |
-
return;
|
354 |
-
}
|
355 |
-
|
356 |
-
global $post;
|
357 |
-
$post_id = $post->ID;
|
358 |
-
$post_type = get_post_type();
|
359 |
-
|
360 |
-
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
361 |
-
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
362 |
-
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
363 |
-
|
364 |
-
if ( '' == $post->post_content ) {
|
365 |
-
|
366 |
-
$this->overwrite_template( $post_id );
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Assign cartflow canvas template to page.
|
373 |
-
*
|
374 |
-
* @param int $post_id post ID.
|
375 |
-
*/
|
376 |
-
public function overwrite_template( $post_id ) {
|
377 |
-
|
378 |
-
$template = 'cartflows-canvas';
|
379 |
-
$key = '_wp_page_template';
|
380 |
-
|
381 |
-
$record_exists = get_post_meta( $post_id, $key, true );
|
382 |
-
|
383 |
-
if ( 'cartflows-canvas' == $record_exists ) {
|
384 |
-
return;
|
385 |
-
}
|
386 |
-
|
387 |
-
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
388 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
389 |
-
|
390 |
-
global $wpdb;
|
391 |
-
|
392 |
-
if ( '' == $record_exists || ! $record_exists ) {
|
393 |
-
|
394 |
-
$wpdb->insert(
|
395 |
-
$wpdb->prefix . 'postmeta',
|
396 |
-
array(
|
397 |
-
'post_id' => $post_id,
|
398 |
-
'meta_key' => $key,//phpcs:ignore
|
399 |
-
'meta_value' => $template, //phpcs:ignore
|
400 |
-
)
|
401 |
-
);// db call ok;.
|
402 |
-
|
403 |
-
// alternative query to above query.
|
404 |
-
// $table = $wpdb->prefix . 'postmeta';
|
405 |
-
// $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
|
406 |
-
// VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
|
407 |
-
|
408 |
-
} else {
|
409 |
-
|
410 |
-
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
|
411 |
-
}
|
412 |
-
} else {
|
413 |
-
|
414 |
-
update_post_meta( $post_id, $key, $template );
|
415 |
-
}
|
416 |
-
}
|
417 |
-
|
418 |
-
/**
|
419 |
-
* Load font awesome style from oceanwp on checkout page.
|
420 |
-
*/
|
421 |
-
public function load_fontawesome() {
|
422 |
-
|
423 |
-
$theme = get_template();
|
424 |
-
|
425 |
-
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
426 |
-
|
427 |
-
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
428 |
-
|
429 |
-
if ( $load_fa ) {
|
430 |
-
|
431 |
-
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
|
432 |
-
}
|
433 |
-
|
434 |
-
$custom_css = '
|
435 |
-
#oceanwp-cart-sidebar-wrap,
|
436 |
-
#owp-qv-wrap{
|
437 |
-
display: none;
|
438 |
-
}';
|
439 |
-
|
440 |
-
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
441 |
-
}
|
442 |
-
}
|
443 |
-
}
|
444 |
-
}
|
445 |
-
|
446 |
-
Cartflows_Compatibility::get_instance();
|
447 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Page builder compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class for page builder compatibility
|
12 |
+
*/
|
13 |
+
class Cartflows_Compatibility {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Member Variable
|
17 |
+
*
|
18 |
+
* @var object instance
|
19 |
+
*/
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initiator
|
24 |
+
*/
|
25 |
+
public static function get_instance() {
|
26 |
+
if ( ! isset( self::$instance ) ) {
|
27 |
+
self::$instance = new self();
|
28 |
+
}
|
29 |
+
return self::$instance;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Constructor
|
34 |
+
*/
|
35 |
+
public function __construct() {
|
36 |
+
|
37 |
+
$this->load_files();
|
38 |
+
|
39 |
+
// Override post meta.
|
40 |
+
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
+
|
42 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Load page builder compatibility files
|
47 |
+
*/
|
48 |
+
public function load_files() {
|
49 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( $this->is_divi_enabled() ) {
|
54 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( $this->is_bb_enabled() ) {
|
58 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
+
}
|
64 |
+
|
65 |
+
if ( defined( 'LEARNDASH_VERSION' ) ) {
|
66 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Check if it is beaver builder enabled.
|
72 |
+
*
|
73 |
+
* @since 1.1.4
|
74 |
+
*/
|
75 |
+
public function is_bb_enabled() {
|
76 |
+
|
77 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Check if elementor preview mode is on.
|
86 |
+
*/
|
87 |
+
public function is_elementor_preview_mode() {
|
88 |
+
|
89 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
90 |
+
|
91 |
+
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
92 |
+
return true;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get Current Theme.
|
101 |
+
*/
|
102 |
+
public function get_current_theme() {
|
103 |
+
|
104 |
+
$theme_name = '';
|
105 |
+
$theme = wp_get_theme();
|
106 |
+
|
107 |
+
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
108 |
+
$theme_name = $theme->parent_theme;
|
109 |
+
} else {
|
110 |
+
$theme_name = $theme->name;
|
111 |
+
}
|
112 |
+
return $theme_name;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Check if it is beaver builder preview mode
|
117 |
+
*/
|
118 |
+
public function is_bb_preview_mode() {
|
119 |
+
|
120 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
121 |
+
if ( FLBuilderModel::is_builder_active() ) {
|
122 |
+
return true;
|
123 |
+
} else {
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Check for page builder preview mode.
|
133 |
+
*/
|
134 |
+
public function is_page_builder_preview() {
|
135 |
+
|
136 |
+
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Check if divi builder enabled for post id.
|
145 |
+
*/
|
146 |
+
public function is_divi_builder_preview() {
|
147 |
+
|
148 |
+
if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) { //phpcs:ignore
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
return false;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Check if divi builder enabled for post id.
|
157 |
+
*
|
158 |
+
* @param int $post_id post id.
|
159 |
+
*/
|
160 |
+
public function is_divi_builder_enabled( $post_id ) {
|
161 |
+
|
162 |
+
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
163 |
+
return true;
|
164 |
+
}
|
165 |
+
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Check if compatibility theme enabled.
|
171 |
+
*/
|
172 |
+
public function is_compatibility_theme_enabled() {
|
173 |
+
|
174 |
+
$theme = wp_get_theme();
|
175 |
+
|
176 |
+
$is_compatibility = false;
|
177 |
+
|
178 |
+
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) || $this->is_pro_enabled( $theme ) || $this->is_kallyas_enabled( $theme ) ) {
|
179 |
+
|
180 |
+
$is_compatibility = true;
|
181 |
+
}
|
182 |
+
|
183 |
+
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Check if pro theme enabled for post id.
|
188 |
+
*
|
189 |
+
* @param object $theme theme data.
|
190 |
+
* @return boolean
|
191 |
+
*/
|
192 |
+
public function is_pro_enabled( $theme = false ) {
|
193 |
+
|
194 |
+
if ( ! $theme ) {
|
195 |
+
$theme = wp_get_theme();
|
196 |
+
}
|
197 |
+
|
198 |
+
if ( 'Pro' == $theme->name ) {
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Check if kallyas theme enabled for post id.
|
207 |
+
*
|
208 |
+
* @param object $theme theme data.
|
209 |
+
* @return boolean
|
210 |
+
*/
|
211 |
+
public function is_kallyas_enabled( $theme = false ) {
|
212 |
+
|
213 |
+
if ( ! $theme ) {
|
214 |
+
$theme = wp_get_theme();
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( 'Kallyas' == $theme->name ) {
|
218 |
+
return true;
|
219 |
+
}
|
220 |
+
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Check if divi builder enabled for post id.
|
226 |
+
*
|
227 |
+
* @param object $theme theme data.
|
228 |
+
* @return boolean
|
229 |
+
*/
|
230 |
+
public function is_divi_enabled( $theme = false ) {
|
231 |
+
|
232 |
+
if ( ! $theme ) {
|
233 |
+
$theme = wp_get_theme();
|
234 |
+
}
|
235 |
+
|
236 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
237 |
+
return true;
|
238 |
+
}
|
239 |
+
|
240 |
+
return false;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Check if Divi theme is install status.
|
245 |
+
*
|
246 |
+
* @return boolean
|
247 |
+
*/
|
248 |
+
public function is_divi_theme_installed() {
|
249 |
+
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
250 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
251 |
+
return true;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
return false;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Check if Flatsome enabled for post id.
|
259 |
+
*
|
260 |
+
* @param object $theme theme data.
|
261 |
+
* @return boolean
|
262 |
+
*/
|
263 |
+
public function is_flatsome_enabled( $theme = false ) {
|
264 |
+
|
265 |
+
if ( ! $theme ) {
|
266 |
+
$theme = wp_get_theme();
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
270 |
+
return true;
|
271 |
+
}
|
272 |
+
|
273 |
+
return false;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Check if The7 enabled for post id.
|
278 |
+
*
|
279 |
+
* @param object $theme theme data.
|
280 |
+
* @return boolean
|
281 |
+
*/
|
282 |
+
public function is_the_seven_enabled( $theme = false ) {
|
283 |
+
|
284 |
+
if ( ! $theme ) {
|
285 |
+
$theme = wp_get_theme();
|
286 |
+
}
|
287 |
+
|
288 |
+
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
289 |
+
return true;
|
290 |
+
}
|
291 |
+
|
292 |
+
return false;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Check if OceanWp enabled for post id.
|
297 |
+
*
|
298 |
+
* @param object $theme theme data.
|
299 |
+
* @return boolean
|
300 |
+
*/
|
301 |
+
public function is_oceanwp_enabled( $theme = false ) {
|
302 |
+
|
303 |
+
if ( ! $theme ) {
|
304 |
+
$theme = wp_get_theme();
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
308 |
+
return true;
|
309 |
+
}
|
310 |
+
|
311 |
+
return false;
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* Check for thrive architect edit page.
|
316 |
+
*
|
317 |
+
* @param int $post_id post id.
|
318 |
+
*/
|
319 |
+
public function is_thrive_edit_page( $post_id ) {
|
320 |
+
|
321 |
+
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
322 |
+
return true;
|
323 |
+
} else {
|
324 |
+
return false;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Check if the page being rendered is the main ID on the editor page.
|
330 |
+
*
|
331 |
+
* @since 1.0.0
|
332 |
+
* @param String $post_id Post ID which is to be rendered.
|
333 |
+
* @return boolean True if current if is being rendered is not being edited.
|
334 |
+
*/
|
335 |
+
private function is_thrive_builder_page( $post_id ) {
|
336 |
+
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false; //phpcs:ignore
|
337 |
+
$post = isset( $_GET['post'] ) ? intval( wp_unslash( $_GET['post'] ) ) : false; //phpcs:ignore
|
338 |
+
|
339 |
+
return ( true == $tve && $post_id !== $post );
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Overwrite meta for page
|
344 |
+
*/
|
345 |
+
public function override_meta() {
|
346 |
+
|
347 |
+
// don't override meta for `elementor_library` post type.
|
348 |
+
if ( 'elementor_library' == get_post_type() ) {
|
349 |
+
return;
|
350 |
+
}
|
351 |
+
|
352 |
+
if ( ! is_singular() ) {
|
353 |
+
return;
|
354 |
+
}
|
355 |
+
|
356 |
+
global $post;
|
357 |
+
$post_id = $post->ID;
|
358 |
+
$post_type = get_post_type();
|
359 |
+
|
360 |
+
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
361 |
+
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
362 |
+
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
363 |
+
|
364 |
+
if ( '' == $post->post_content ) {
|
365 |
+
|
366 |
+
$this->overwrite_template( $post_id );
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Assign cartflow canvas template to page.
|
373 |
+
*
|
374 |
+
* @param int $post_id post ID.
|
375 |
+
*/
|
376 |
+
public function overwrite_template( $post_id ) {
|
377 |
+
|
378 |
+
$template = 'cartflows-canvas';
|
379 |
+
$key = '_wp_page_template';
|
380 |
+
|
381 |
+
$record_exists = get_post_meta( $post_id, $key, true );
|
382 |
+
|
383 |
+
if ( 'cartflows-canvas' == $record_exists ) {
|
384 |
+
return;
|
385 |
+
}
|
386 |
+
|
387 |
+
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
388 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
389 |
+
|
390 |
+
global $wpdb;
|
391 |
+
|
392 |
+
if ( '' == $record_exists || ! $record_exists ) {
|
393 |
+
|
394 |
+
$wpdb->insert(
|
395 |
+
$wpdb->prefix . 'postmeta',
|
396 |
+
array(
|
397 |
+
'post_id' => $post_id,
|
398 |
+
'meta_key' => $key,//phpcs:ignore
|
399 |
+
'meta_value' => $template, //phpcs:ignore
|
400 |
+
)
|
401 |
+
);// db call ok;.
|
402 |
+
|
403 |
+
// alternative query to above query.
|
404 |
+
// $table = $wpdb->prefix . 'postmeta';
|
405 |
+
// $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
|
406 |
+
// VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
|
407 |
+
|
408 |
+
} else {
|
409 |
+
|
410 |
+
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
|
411 |
+
}
|
412 |
+
} else {
|
413 |
+
|
414 |
+
update_post_meta( $post_id, $key, $template );
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Load font awesome style from oceanwp on checkout page.
|
420 |
+
*/
|
421 |
+
public function load_fontawesome() {
|
422 |
+
|
423 |
+
$theme = get_template();
|
424 |
+
|
425 |
+
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
426 |
+
|
427 |
+
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
428 |
+
|
429 |
+
if ( $load_fa ) {
|
430 |
+
|
431 |
+
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
|
432 |
+
}
|
433 |
+
|
434 |
+
$custom_css = '
|
435 |
+
#oceanwp-cart-sidebar-wrap,
|
436 |
+
#owp-qv-wrap{
|
437 |
+
display: none;
|
438 |
+
}';
|
439 |
+
|
440 |
+
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
441 |
+
}
|
442 |
+
}
|
443 |
+
}
|
444 |
+
}
|
445 |
+
|
446 |
+
Cartflows_Compatibility::get_instance();
|
447 |
+
|
classes/class-cartflows-default-meta.php
CHANGED
@@ -1,867 +1,867 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Cartflow default options.
|
4 |
-
*
|
5 |
-
* @package Cartflows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialization
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Default_Meta {
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Member Variable
|
19 |
-
*
|
20 |
-
* @var instance
|
21 |
-
*/
|
22 |
-
private static $instance;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Member Variable
|
26 |
-
*
|
27 |
-
* @var checkout_fields
|
28 |
-
*/
|
29 |
-
private static $checkout_fields = null;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Member Variable
|
33 |
-
*
|
34 |
-
* @var checkout_fields
|
35 |
-
*/
|
36 |
-
private static $thankyou_fields = null;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Member Variable
|
40 |
-
*
|
41 |
-
* @var flow_fields
|
42 |
-
*/
|
43 |
-
private static $flow_fields = null;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Member Variable
|
47 |
-
*
|
48 |
-
* @var landing_fields
|
49 |
-
*/
|
50 |
-
private static $landing_fields = null;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Member Variable
|
54 |
-
*
|
55 |
-
* @var optin_fields
|
56 |
-
*/
|
57 |
-
private static $optin_fields = null;
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Initiator
|
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 |
-
public function __construct() {
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Checkout Default fields.
|
77 |
-
*
|
78 |
-
* @param int $post_id post id.
|
79 |
-
* @return array
|
80 |
-
*/
|
81 |
-
public function get_checkout_fields( $post_id ) {
|
82 |
-
|
83 |
-
if ( null === self::$checkout_fields ) {
|
84 |
-
self::$checkout_fields = array(
|
85 |
-
'wcf-field-google-font-url' => array(
|
86 |
-
'default' => '',
|
87 |
-
'sanitize' => 'FILTER_DEFAULT',
|
88 |
-
),
|
89 |
-
'wcf-checkout-products' => array(
|
90 |
-
'default' => array(),
|
91 |
-
'sanitize' => 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS',
|
92 |
-
),
|
93 |
-
'wcf-checkout-layout' => array(
|
94 |
-
'default' => 'two-column',
|
95 |
-
'sanitize' => 'FILTER_DEFAULT',
|
96 |
-
),
|
97 |
-
'wcf-input-font-family' => array(
|
98 |
-
'default' => '',
|
99 |
-
'sanitize' => 'FILTER_DEFAULT',
|
100 |
-
),
|
101 |
-
'wcf-input-font-weight' => array(
|
102 |
-
'default' => '',
|
103 |
-
'sanitize' => 'FILTER_DEFAULT',
|
104 |
-
),
|
105 |
-
'wcf-heading-font-family' => array(
|
106 |
-
'default' => '',
|
107 |
-
'sanitize' => 'FILTER_DEFAULT',
|
108 |
-
),
|
109 |
-
'wcf-heading-font-weight' => array(
|
110 |
-
'default' => '',
|
111 |
-
'sanitize' => 'FILTER_DEFAULT',
|
112 |
-
),
|
113 |
-
'wcf-base-font-family' => array(
|
114 |
-
'default' => '',
|
115 |
-
'sanitize' => 'FILTER_DEFAULT',
|
116 |
-
),
|
117 |
-
'wcf-advance-options-fields' => array(
|
118 |
-
'default' => '',
|
119 |
-
'sanitize' => 'FILTER_DEFAULT',
|
120 |
-
),
|
121 |
-
'wcf-remove-product-field' => array(
|
122 |
-
'default' => '',
|
123 |
-
'sanitize' => 'FILTER_DEFAULT',
|
124 |
-
),
|
125 |
-
'wcf-checkout-place-order-button-text' => array(
|
126 |
-
'default' => '',
|
127 |
-
'sanitize' => 'FILTER_SANITIZE_STRING',
|
128 |
-
),
|
129 |
-
'wcf-base-font-weight' => array(
|
130 |
-
'default' => '',
|
131 |
-
'sanitize' => 'FILTER_DEFAULT',
|
132 |
-
),
|
133 |
-
'wcf-button-font-family' => array(
|
134 |
-
'default' => '',
|
135 |
-
'sanitize' => 'FILTER_DEFAULT',
|
136 |
-
),
|
137 |
-
'wcf-button-font-weight' => array(
|
138 |
-
'default' => '',
|
139 |
-
'sanitize' => 'FILTER_DEFAULT',
|
140 |
-
),
|
141 |
-
'wcf-primary-color' => array(
|
142 |
-
'default' => '',
|
143 |
-
'sanitize' => 'FILTER_DEFAULT',
|
144 |
-
),
|
145 |
-
'wcf-heading-color' => array(
|
146 |
-
'default' => '',
|
147 |
-
'sanitize' => 'FILTER_DEFAULT',
|
148 |
-
),
|
149 |
-
'wcf-section-bg-color' => array(
|
150 |
-
'default' => '',
|
151 |
-
'sanitize' => 'FILTER_DEFAULT',
|
152 |
-
),
|
153 |
-
'wcf-hl-bg-color' => array(
|
154 |
-
'default' => '',
|
155 |
-
'sanitize' => 'FILTER_DEFAULT',
|
156 |
-
),
|
157 |
-
'wcf-field-tb-padding' => array(
|
158 |
-
'default' => '',
|
159 |
-
'sanitize' => 'FILTER_DEFAULT',
|
160 |
-
),
|
161 |
-
'wcf-field-lr-padding' => array(
|
162 |
-
'default' => '',
|
163 |
-
'sanitize' => 'FILTER_DEFAULT',
|
164 |
-
),
|
165 |
-
'wcf-fields-skins' => array(
|
166 |
-
'default' => '',
|
167 |
-
'sanitize' => 'FILTER_DEFAULT',
|
168 |
-
),
|
169 |
-
'wcf-input-field-size' => array(
|
170 |
-
'default' => '33px',
|
171 |
-
'sanitize' => 'FILTER_DEFAULT',
|
172 |
-
),
|
173 |
-
'wcf-field-color' => array(
|
174 |
-
'default' => '',
|
175 |
-
'sanitize' => 'FILTER_DEFAULT',
|
176 |
-
),
|
177 |
-
'wcf-field-bg-color' => array(
|
178 |
-
'default' => '',
|
179 |
-
'sanitize' => 'FILTER_DEFAULT',
|
180 |
-
),
|
181 |
-
'wcf-field-border-color' => array(
|
182 |
-
'default' => '',
|
183 |
-
'sanitize' => 'FILTER_DEFAULT',
|
184 |
-
),
|
185 |
-
'wcf-box-border-color' => array(
|
186 |
-
'default' => '',
|
187 |
-
'sanitize' => 'FILTER_DEFAULT',
|
188 |
-
),
|
189 |
-
'wcf-field-label-color' => array(
|
190 |
-
'default' => '',
|
191 |
-
'sanitize' => 'FILTER_DEFAULT',
|
192 |
-
),
|
193 |
-
'wcf-submit-tb-padding' => array(
|
194 |
-
'default' => '',
|
195 |
-
'sanitize' => 'FILTER_DEFAULT',
|
196 |
-
),
|
197 |
-
'wcf-submit-lr-padding' => array(
|
198 |
-
'default' => '',
|
199 |
-
'sanitize' => 'FILTER_DEFAULT',
|
200 |
-
),
|
201 |
-
'wcf-input-button-size' => array(
|
202 |
-
'default' => '33px',
|
203 |
-
'sanitize' => 'FILTER_DEFAULT',
|
204 |
-
),
|
205 |
-
'wcf-submit-color' => array(
|
206 |
-
'default' => '',
|
207 |
-
'sanitize' => 'FILTER_DEFAULT',
|
208 |
-
),
|
209 |
-
'wcf-submit-hover-color' => array(
|
210 |
-
'default' => '',
|
211 |
-
'sanitize' => 'FILTER_DEFAULT',
|
212 |
-
),
|
213 |
-
'wcf-submit-bg-color' => array(
|
214 |
-
'default' => '',
|
215 |
-
'sanitize' => 'FILTER_DEFAULT',
|
216 |
-
),
|
217 |
-
'wcf-submit-bg-hover-color' => array(
|
218 |
-
'default' => '',
|
219 |
-
'sanitize' => 'FILTER_DEFAULT',
|
220 |
-
),
|
221 |
-
'wcf-submit-border-color' => array(
|
222 |
-
'default' => '',
|
223 |
-
'sanitize' => 'FILTER_DEFAULT',
|
224 |
-
),
|
225 |
-
'wcf-submit-border-hover-color' => array(
|
226 |
-
'default' => '',
|
227 |
-
'sanitize' => 'FILTER_DEFAULT',
|
228 |
-
),
|
229 |
-
'wcf-active-tab' => array(
|
230 |
-
'default' => '',
|
231 |
-
'sanitize' => 'FILTER_DEFAULT',
|
232 |
-
),
|
233 |
-
'wcf-header-logo-image' => array(
|
234 |
-
'default' => '',
|
235 |
-
'sanitize' => 'FILTER_DEFAULT',
|
236 |
-
),
|
237 |
-
'wcf-header-logo-width' => array(
|
238 |
-
'default' => '',
|
239 |
-
'sanitize' => 'FILTER_DEFAULT',
|
240 |
-
),
|
241 |
-
'wcf-custom-script' => array(
|
242 |
-
'default' => '',
|
243 |
-
'sanitize' => 'FILTER_DEFAULT',
|
244 |
-
),
|
245 |
-
);
|
246 |
-
|
247 |
-
self::$checkout_fields = apply_filters( 'cartflows_checkout_meta_options', self::$checkout_fields, $post_id );
|
248 |
-
}
|
249 |
-
|
250 |
-
return self::$checkout_fields;
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Save Checkout Meta fields.
|
255 |
-
*
|
256 |
-
* @param int $post_id post id.
|
257 |
-
* @return void
|
258 |
-
*/
|
259 |
-
public function save_checkout_fields( $post_id ) {
|
260 |
-
|
261 |
-
$post_meta = $this->get_checkout_fields( $post_id );
|
262 |
-
|
263 |
-
$this->save_meta_fields( $post_id, $post_meta );
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Save Landing Meta fields.
|
268 |
-
*
|
269 |
-
* @param int $post_id post id.
|
270 |
-
* @return void
|
271 |
-
*/
|
272 |
-
public function save_landing_fields( $post_id ) {
|
273 |
-
|
274 |
-
$post_meta = $this->get_landing_fields( $post_id );
|
275 |
-
|
276 |
-
$this->save_meta_fields( $post_id, $post_meta );
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Save ThankYou Meta fields.
|
281 |
-
*
|
282 |
-
* @param int $post_id post id.
|
283 |
-
* @return void
|
284 |
-
*/
|
285 |
-
public function save_thankyou_fields( $post_id ) {
|
286 |
-
|
287 |
-
$post_meta = $this->get_thankyou_fields( $post_id );
|
288 |
-
|
289 |
-
$this->save_meta_fields( $post_id, $post_meta );
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Flow Default fields.
|
294 |
-
*
|
295 |
-
* @param int $post_id post id.
|
296 |
-
* @return array
|
297 |
-
*/
|
298 |
-
public function get_flow_fields( $post_id ) {
|
299 |
-
|
300 |
-
if ( null === self::$flow_fields ) {
|
301 |
-
self::$flow_fields = array(
|
302 |
-
'wcf-steps' => array(
|
303 |
-
'default' => array(),
|
304 |
-
'sanitize' => 'FILTER_DEFAULT',
|
305 |
-
),
|
306 |
-
|
307 |
-
'wcf-testing' => array(
|
308 |
-
'default' => 'no',
|
309 |
-
'sanitize' => 'FILTER_DEFAULT',
|
310 |
-
),
|
311 |
-
);
|
312 |
-
}
|
313 |
-
|
314 |
-
return apply_filters( 'cartflows_flow_meta_options', self::$flow_fields );
|
315 |
-
}
|
316 |
-
|
317 |
-
/**
|
318 |
-
* Save Flow Meta fields.
|
319 |
-
*
|
320 |
-
* @param int $post_id post id.
|
321 |
-
* @return void
|
322 |
-
*/
|
323 |
-
public function save_flow_fields( $post_id ) {
|
324 |
-
|
325 |
-
$post_meta = $this->get_flow_fields( $post_id );
|
326 |
-
|
327 |
-
if ( isset( $post_meta['wcf-steps'] ) ) {
|
328 |
-
unset( $post_meta['wcf-steps'] );
|
329 |
-
}
|
330 |
-
|
331 |
-
$this->save_meta_fields( $post_id, $post_meta );
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Save Meta fields - Common Function.
|
336 |
-
*
|
337 |
-
* @param int $post_id post id.
|
338 |
-
* @param array $post_meta options to store.
|
339 |
-
* @return void
|
340 |
-
*/
|
341 |
-
public function save_meta_fields( $post_id, $post_meta ) {
|
342 |
-
|
343 |
-
if ( ! ( $post_id && is_array( $post_meta ) ) ) {
|
344 |
-
return;
|
345 |
-
}
|
346 |
-
|
347 |
-
foreach ( $post_meta as $key => $data ) {
|
348 |
-
$meta_value = false;
|
349 |
-
|
350 |
-
// Sanitize values.
|
351 |
-
$sanitize_filter = ( isset( $data['sanitize'] ) ) ? $data['sanitize'] : 'FILTER_DEFAULT';
|
352 |
-
|
353 |
-
switch ( $sanitize_filter ) {
|
354 |
-
case 'FILTER_SANITIZE_STRING':
|
355 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_STRING );
|
356 |
-
break;
|
357 |
-
|
358 |
-
case 'FILTER_SANITIZE_URL':
|
359 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_URL );
|
360 |
-
break;
|
361 |
-
|
362 |
-
case 'FILTER_SANITIZE_NUMBER_INT':
|
363 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_NUMBER_INT );
|
364 |
-
break;
|
365 |
-
|
366 |
-
case 'FILTER_CARTFLOWS_ARRAY':
|
367 |
-
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
|
368 |
-
$meta_value = array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ); //phpcs:ignore
|
369 |
-
}
|
370 |
-
break;
|
371 |
-
|
372 |
-
case 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS':
|
373 |
-
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
|
374 |
-
$i = 0;
|
375 |
-
$q = 0;
|
376 |
-
|
377 |
-
foreach ( $_POST[ $key ] as $p_index => $p_data ) { // phpcs:ignore
|
378 |
-
foreach ( $p_data as $i_key => $i_value ) {
|
379 |
-
if ( is_array( $i_value ) ) {
|
380 |
-
foreach ( $i_value as $q_key => $q_value ) {
|
381 |
-
$meta_value[ $i ][ $i_key ][ $q ] = array_map( 'sanitize_text_field', $q_value );
|
382 |
-
|
383 |
-
$q++;
|
384 |
-
}
|
385 |
-
} else {
|
386 |
-
$meta_value[ $i ][ $i_key ] = sanitize_text_field( $i_value );
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
$i++;
|
391 |
-
}
|
392 |
-
}
|
393 |
-
break;
|
394 |
-
|
395 |
-
case 'FILTER_CARTFLOWS_IMAGES':
|
396 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
397 |
-
|
398 |
-
if ( isset( $_POST[ $key . '-obj' ] )) { //phpcs:ignore
|
399 |
-
|
400 |
-
if ( ! is_serialized( $_POST[ $key . '-obj' ] ) ) { //phpcs:ignore
|
401 |
-
|
402 |
-
$image_obj = json_decode( stripcslashes( wp_unslash( $_POST[ $key . '-obj' ] ) ), true ); //phpcs:ignore
|
403 |
-
$image_url = isset( $image_obj['sizes'] ) ? $image_obj['sizes'] : array();
|
404 |
-
|
405 |
-
$image_data = array(
|
406 |
-
'id' => isset( $image_obj['id'] ) ? intval( $image_obj['id'] ) : 0,
|
407 |
-
'url' => array(
|
408 |
-
'thumbnail' => isset( $image_url['thumbnail']['url'] ) ? esc_url_raw( $image_url['thumbnail']['url'] ) : '',
|
409 |
-
'medium' => isset( $image_url['medium']['url'] ) ? esc_url_raw( $image_url['medium']['url'] ) : '',
|
410 |
-
'full' => isset( $image_url['full']['url'] ) ? esc_url_raw( $image_url['full']['url'] ) : '',
|
411 |
-
),
|
412 |
-
);
|
413 |
-
|
414 |
-
$new_meta_value = 0 !== $image_data['id'] ? $image_data : '';
|
415 |
-
update_post_meta( $post_id, $key . '-obj', $new_meta_value );
|
416 |
-
}
|
417 |
-
}
|
418 |
-
|
419 |
-
break;
|
420 |
-
|
421 |
-
default:
|
422 |
-
if ( 'FILTER_DEFAULT' === $sanitize_filter ) {
|
423 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
424 |
-
} else {
|
425 |
-
$meta_value = apply_filters( 'cartflows_save_meta_field_values', $meta_value, $post_id, $key, $sanitize_filter );
|
426 |
-
}
|
427 |
-
|
428 |
-
break;
|
429 |
-
}
|
430 |
-
|
431 |
-
if ( false !== $meta_value ) {
|
432 |
-
update_post_meta( $post_id, $key, $meta_value );
|
433 |
-
} else {
|
434 |
-
delete_post_meta( $post_id, $key );
|
435 |
-
}
|
436 |
-
}
|
437 |
-
}
|
438 |
-
|
439 |
-
/**
|
440 |
-
* Get checkout meta.
|
441 |
-
*
|
442 |
-
* @param int $post_id post id.
|
443 |
-
* @param string $key options key.
|
444 |
-
* @param mix $default options default value.
|
445 |
-
* @return string
|
446 |
-
*/
|
447 |
-
public function get_flow_meta_value( $post_id, $key, $default = false ) {
|
448 |
-
|
449 |
-
$value = $this->get_save_meta( $post_id, $key );
|
450 |
-
|
451 |
-
if ( ! $value ) {
|
452 |
-
if ( $default ) {
|
453 |
-
$value = $default;
|
454 |
-
} else {
|
455 |
-
$fields = $this->get_flow_fields( $post_id );
|
456 |
-
|
457 |
-
if ( isset( $fields[ $key ]['default'] ) ) {
|
458 |
-
$value = $fields[ $key ]['default'];
|
459 |
-
}
|
460 |
-
}
|
461 |
-
}
|
462 |
-
|
463 |
-
return $value;
|
464 |
-
}
|
465 |
-
|
466 |
-
/**
|
467 |
-
* Get checkout meta.
|
468 |
-
*
|
469 |
-
* @param int $post_id post id.
|
470 |
-
* @param string $key options key.
|
471 |
-
* @param mix $default options default value.
|
472 |
-
* @return string
|
473 |
-
*/
|
474 |
-
public function get_checkout_meta_value( $post_id = 0, $key = '', $default = false ) {
|
475 |
-
|
476 |
-
$value = $this->get_save_meta( $post_id, $key );
|
477 |
-
|
478 |
-
if ( ! $value ) {
|
479 |
-
if ( false !== $default ) {
|
480 |
-
$value = $default;
|
481 |
-
} else {
|
482 |
-
$fields = $this->get_checkout_fields( $post_id );
|
483 |
-
|
484 |
-
if ( isset( $fields[ $key ]['default'] ) ) {
|
485 |
-
$value = $fields[ $key ]['default'];
|
486 |
-
}
|
487 |
-
}
|
488 |
-
}
|
489 |
-
|
490 |
-
return $value;
|
491 |
-
}
|
492 |
-
|
493 |
-
/**
|
494 |
-
* Get post meta.
|
495 |
-
*
|
496 |
-
* @param int $post_id post id.
|
497 |
-
* @param string $key options key.
|
498 |
-
* @return string
|
499 |
-
*/
|
500 |
-
public function get_save_meta( $post_id, $key ) {
|
501 |
-
|
502 |
-
$value = get_post_meta( $post_id, $key, true );
|
503 |
-
|
504 |
-
return $value;
|
505 |
-
}
|
506 |
-
|
507 |
-
/**
|
508 |
-
* Thank You Default fields.
|
509 |
-
*
|
510 |
-
* @param int $post_id post id.
|
511 |
-
* @return array
|
512 |
-
*/
|
513 |
-
public function get_thankyou_fields( $post_id ) {
|
514 |
-
|
515 |
-
if ( null === self::$thankyou_fields ) {
|
516 |
-
self::$thankyou_fields = array(
|
517 |
-
'wcf-field-google-font-url' => array(
|
518 |
-
'default' => '',
|
519 |
-
'sanitize' => 'FILTER_DEFAULT',
|
520 |
-
),
|
521 |
-
'wcf-active-tab' => array(
|
522 |
-
'default' => '',
|
523 |
-
'sanitize' => 'FILTER_DEFAULT',
|
524 |
-
),
|
525 |
-
'wcf-tq-text-color' => array(
|
526 |
-
'default' => '',
|
527 |
-
'sanitize' => 'FILTER_DEFAULT',
|
528 |
-
),
|
529 |
-
'wcf-tq-font-family' => array(
|
530 |
-
'default' => '',
|
531 |
-
'sanitize' => 'FILTER_DEFAULT',
|
532 |
-
),
|
533 |
-
'wcf-tq-font-size' => array(
|
534 |
-
'default' => '',
|
535 |
-
'sanitize' => 'FILTER_DEFAULT',
|
536 |
-
),
|
537 |
-
'wcf-tq-heading-color' => array(
|
538 |
-
'default' => '',
|
539 |
-
'sanitize' => 'FILTER_DEFAULT',
|
540 |
-
),
|
541 |
-
'wcf-tq-heading-font-family' => array(
|
542 |
-
'default' => '',
|
543 |
-
'sanitize' => 'FILTER_DEFAULT',
|
544 |
-
),
|
545 |
-
'wcf-tq-heading-font-wt' => array(
|
546 |
-
'default' => '',
|
547 |
-
'sanitize' => 'FILTER_DEFAULT',
|
548 |
-
),
|
549 |
-
'wcf-tq-container-width' => array(
|
550 |
-
'default' => '',
|
551 |
-
'sanitize' => 'FILTER_DEFAULT',
|
552 |
-
),
|
553 |
-
'wcf-tq-section-bg-color' => array(
|
554 |
-
'default' => '',
|
555 |
-
'sanitize' => 'FILTER_DEFAULT',
|
556 |
-
),
|
557 |
-
'wcf-tq-advance-options-fields' => array(
|
558 |
-
'default' => '',
|
559 |
-
'sanitize' => 'FILTER_DEFAULT',
|
560 |
-
),
|
561 |
-
'wcf-show-overview-section' => array(
|
562 |
-
'default' => 'yes',
|
563 |
-
'sanitize' => 'FILTER_DEFAULT',
|
564 |
-
),
|
565 |
-
'wcf-show-details-section' => array(
|
566 |
-
'default' => 'yes',
|
567 |
-
'sanitize' => 'FILTER_DEFAULT',
|
568 |
-
),
|
569 |
-
'wcf-show-billing-section' => array(
|
570 |
-
'default' => 'yes',
|
571 |
-
'sanitize' => 'FILTER_DEFAULT',
|
572 |
-
),
|
573 |
-
'wcf-show-shipping-section' => array(
|
574 |
-
'default' => 'yes',
|
575 |
-
'sanitize' => 'FILTER_DEFAULT',
|
576 |
-
),
|
577 |
-
'wcf-show-tq-redirect-section' => array(
|
578 |
-
'default' => '',
|
579 |
-
'sanitize' => 'FILTER_DEFAULT',
|
580 |
-
),
|
581 |
-
'wcf-tq-redirect-link' => array(
|
582 |
-
'default' => '',
|
583 |
-
'sanitize' => 'FILTER_SANITIZE_URL',
|
584 |
-
),
|
585 |
-
'wcf-tq-text' => array(
|
586 |
-
'default' => '',
|
587 |
-
'sanitize' => 'FILTER_DEFAULT',
|
588 |
-
),
|
589 |
-
'wcf-custom-script' => array(
|
590 |
-
'default' => '',
|
591 |
-
'sanitize' => 'FILTER_DEFAULT',
|
592 |
-
),
|
593 |
-
);
|
594 |
-
}
|
595 |
-
|
596 |
-
return apply_filters( 'cartflows_thankyou_meta_options', self::$thankyou_fields, $post_id );
|
597 |
-
}
|
598 |
-
|
599 |
-
/**
|
600 |
-
* Get Thank you section meta.
|
601 |
-
*
|
602 |
-
* @param int $post_id post id.
|
603 |
-
* @param string $key options key.
|
604 |
-
* @param mix $default options default value.
|
605 |
-
* @return string
|
606 |
-
*/
|
607 |
-
public function get_thankyou_meta_value( $post_id, $key, $default = false ) {
|
608 |
-
|
609 |
-
$value = $this->get_save_meta( $post_id, $key );
|
610 |
-
|
611 |
-
if ( ! $value ) {
|
612 |
-
if ( $default ) {
|
613 |
-
$value = $default;
|
614 |
-
} else {
|
615 |
-
$fields = $this->get_thankyou_fields( $post_id );
|
616 |
-
|
617 |
-
if ( isset( $fields[ $key ]['default'] ) ) {
|
618 |
-
$value = $fields[ $key ]['default'];
|
619 |
-
}
|
620 |
-
}
|
621 |
-
}
|
622 |
-
|
623 |
-
return $value;
|
624 |
-
}
|
625 |
-
|
626 |
-
/**
|
627 |
-
* Get Landing section meta.
|
628 |
-
*
|
629 |
-
* @param int $post_id post id.
|
630 |
-
* @param string $key options key.
|
631 |
-
* @param mix $default options default value.
|
632 |
-
* @return string
|
633 |
-
*/
|
634 |
-
public function get_landing_meta_value( $post_id, $key, $default = false ) {
|
635 |
-
|
636 |
-
$value = $this->get_save_meta( $post_id, $key );
|
637 |
-
if ( ! $value ) {
|
638 |
-
if ( $default ) {
|
639 |
-
$value = $default;
|
640 |
-
} else {
|
641 |
-
$fields = $this->get_landing_fields( $post_id );
|
642 |
-
|
643 |
-
if ( isset( $fields[ $key ]['default'] ) ) {
|
644 |
-
$value = $fields[ $key ]['default'];
|
645 |
-
}
|
646 |
-
}
|
647 |
-
}
|
648 |
-
|
649 |
-
return $value;
|
650 |
-
}
|
651 |
-
|
652 |
-
/**
|
653 |
-
* Landing Default fields.
|
654 |
-
*
|
655 |
-
* @param int $post_id post id.
|
656 |
-
* @return array
|
657 |
-
*/
|
658 |
-
public function get_landing_fields( $post_id ) {
|
659 |
-
|
660 |
-
if ( null === self::$landing_fields ) {
|
661 |
-
self::$landing_fields = array(
|
662 |
-
'wcf-custom-script' => array(
|
663 |
-
'default' => '',
|
664 |
-
'sanitize' => 'FILTER_DEFAULT',
|
665 |
-
),
|
666 |
-
);
|
667 |
-
}
|
668 |
-
return apply_filters( 'cartflows_landing_meta_options', self::$landing_fields, $post_id );
|
669 |
-
}
|
670 |
-
|
671 |
-
/**
|
672 |
-
* Optin Default fields.
|
673 |
-
*
|
674 |
-
* @param int $post_id post id.
|
675 |
-
* @return array
|
676 |
-
*/
|
677 |
-
public function get_optin_fields( $post_id ) {
|
678 |
-
|
679 |
-
if ( null === self::$optin_fields ) {
|
680 |
-
self::$optin_fields = array(
|
681 |
-
|
682 |
-
'wcf-optin-product' => array(
|
683 |
-
'default' => array(),
|
684 |
-
'sanitize' => 'FILTER_CARTFLOWS_ARRAY',
|
685 |
-
),
|
686 |
-
|
687 |
-
/* Style */
|
688 |
-
'wcf-field-google-font-url' => array(
|
689 |
-
'default' => '',
|
690 |
-
'sanitize' => 'FILTER_DEFAULT',
|
691 |
-
),
|
692 |
-
'wcf-primary-color' => array(
|
693 |
-
'default' => '',
|
694 |
-
'sanitize' => 'FILTER_DEFAULT',
|
695 |
-
),
|
696 |
-
'wcf-base-font-family' => array(
|
697 |
-
'default' => '',
|
698 |
-
'sanitize' => 'FILTER_DEFAULT',
|
699 |
-
),
|
700 |
-
'wcf-input-fields-skins' => array(
|
701 |
-
'default' => '',
|
702 |
-
'sanitize' => 'FILTER_DEFAULT',
|
703 |
-
),
|
704 |
-
'wcf-input-font-family' => array(
|
705 |
-
'default' => '',
|
706 |
-
'sanitize' => 'FILTER_DEFAULT',
|
707 |
-
),
|
708 |
-
'wcf-input-font-weight' => array(
|
709 |
-
'default' => '',
|
710 |
-
'sanitize' => 'FILTER_DEFAULT',
|
711 |
-
),
|
712 |
-
'wcf-input-field-size' => array(
|
713 |
-
'default' => '33px',
|
714 |
-
'sanitize' => 'FILTER_DEFAULT',
|
715 |
-
),
|
716 |
-
'wcf-field-tb-padding' => array(
|
717 |
-
'default' => '',
|
718 |
-
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
719 |
-
),
|
720 |
-
'wcf-field-lr-padding' => array(
|
721 |
-
'default' => '',
|
722 |
-
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
723 |
-
),
|
724 |
-
'wcf-field-color' => array(
|
725 |
-
'default' => '',
|
726 |
-
'sanitize' => 'FILTER_DEFAULT',
|
727 |
-
),
|
728 |
-
'wcf-field-bg-color' => array(
|
729 |
-
'default' => '',
|
730 |
-
'sanitize' => 'FILTER_DEFAULT',
|
731 |
-
),
|
732 |
-
'wcf-field-border-color' => array(
|
733 |
-
'default' => '',
|
734 |
-
'sanitize' => 'FILTER_DEFAULT',
|
735 |
-
),
|
736 |
-
'wcf-field-label-color' => array(
|
737 |
-
'default' => '',
|
738 |
-
'sanitize' => 'FILTER_DEFAULT',
|
739 |
-
),
|
740 |
-
'wcf-submit-button-text' => array(
|
741 |
-
'default' => __( 'Submit', 'cartflows' ),
|
742 |
-
'sanitize' => 'FILTER_DEFAULT',
|
743 |
-
),
|
744 |
-
'wcf-submit-font-size' => array(
|
745 |
-
'default' => '',
|
746 |
-
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
747 |
-
),
|
748 |
-
'wcf-button-font-family' => array(
|
749 |
-
'default' => '',
|
750 |
-
'sanitize' => 'FILTER_DEFAULT',
|
751 |
-
),
|
752 |
-
'wcf-button-font-weight' => array(
|
753 |
-
'default' => '',
|
754 |
-
'sanitize' => 'FILTER_DEFAULT',
|
755 |
-
),
|
756 |
-
'wcf-submit-button-size' => array(
|
757 |
-
'default' => '33px',
|
758 |
-
'sanitize' => 'FILTER_DEFAULT',
|
759 |
-
),
|
760 |
-
'wcf-submit-tb-padding' => array(
|
761 |
-
'default' => '',
|
762 |
-
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
763 |
-
),
|
764 |
-
'wcf-submit-lr-padding' => array(
|
765 |
-
'default' => '',
|
766 |
-
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
767 |
-
),
|
768 |
-
'wcf-submit-button-position' => array(
|
769 |
-
'default' => 'center',
|
770 |
-
'sanitize' => 'FILTER_DEFAULT',
|
771 |
-
),
|
772 |
-
'wcf-submit-color' => array(
|
773 |
-
'default' => '',
|
774 |
-
'sanitize' => 'FILTER_DEFAULT',
|
775 |
-
),
|
776 |
-
'wcf-submit-hover-color' => array(
|
777 |
-
'default' => '',
|
778 |
-
'sanitize' => 'FILTER_DEFAULT',
|
779 |
-
),
|
780 |
-
'wcf-submit-bg-color' => array(
|
781 |
-
'default' => '',
|
782 |
-
'sanitize' => 'FILTER_DEFAULT',
|
783 |
-
),
|
784 |
-
'wcf-submit-bg-hover-color' => array(
|
785 |
-
'default' => '',
|
786 |
-
'sanitize' => 'FILTER_DEFAULT',
|
787 |
-
),
|
788 |
-
'wcf-submit-border-color' => array(
|
789 |
-
'default' => '',
|
790 |
-
'sanitize' => 'FILTER_DEFAULT',
|
791 |
-
),
|
792 |
-
'wcf-submit-border-hover-color' => array(
|
793 |
-
'default' => '',
|
794 |
-
'sanitize' => 'FILTER_DEFAULT',
|
795 |
-
),
|
796 |
-
|
797 |
-
/* Settings */
|
798 |
-
'wcf-optin-pass-fields' => array(
|
799 |
-
'default' => '',
|
800 |
-
'sanitize' => 'FILTER_DEFAULT',
|
801 |
-
),
|
802 |
-
'wcf-optin-pass-specific-fields' => array(
|
803 |
-
'default' => 'first_name',
|
804 |
-
'sanitize' => 'FILTER_DEFAULT',
|
805 |
-
),
|
806 |
-
|
807 |
-
/* Script */
|
808 |
-
'wcf-custom-script' => array(
|
809 |
-
'default' => '',
|
810 |
-
'sanitize' => 'FILTER_DEFAULT',
|
811 |
-
),
|
812 |
-
|
813 |
-
/* Hidden */
|
814 |
-
'wcf-active-tab' => array(
|
815 |
-
'default' => '',
|
816 |
-
'sanitize' => 'FILTER_DEFAULT',
|
817 |
-
),
|
818 |
-
);
|
819 |
-
}
|
820 |
-
return apply_filters( 'cartflows_optin_meta_options', self::$optin_fields, $post_id );
|
821 |
-
}
|
822 |
-
|
823 |
-
/**
|
824 |
-
* Save Optin Meta fields.
|
825 |
-
*
|
826 |
-
* @param int $post_id post id.
|
827 |
-
* @return void
|
828 |
-
*/
|
829 |
-
public function save_optin_fields( $post_id ) {
|
830 |
-
|
831 |
-
$post_meta = $this->get_optin_fields( $post_id );
|
832 |
-
|
833 |
-
$this->save_meta_fields( $post_id, $post_meta );
|
834 |
-
}
|
835 |
-
|
836 |
-
/**
|
837 |
-
* Get optin meta.
|
838 |
-
*
|
839 |
-
* @param int $post_id post id.
|
840 |
-
* @param string $key options key.
|
841 |
-
* @param mix $default options default value.
|
842 |
-
* @return string
|
843 |
-
*/
|
844 |
-
public function get_optin_meta_value( $post_id = 0, $key = '', $default = false ) {
|
845 |
-
|
846 |
-
$value = $this->get_save_meta( $post_id, $key );
|
847 |
-
|
848 |
-
if ( ! $value ) {
|
849 |
-
if ( false !== $default ) {
|
850 |
-
$value = $default;
|
851 |
-
} else {
|
852 |
-
$fields = $this->get_optin_fields( $post_id );
|
853 |
-
|
854 |
-
if ( isset( $fields[ $key ]['default'] ) ) {
|
855 |
-
$value = $fields[ $key ]['default'];
|
856 |
-
}
|
857 |
-
}
|
858 |
-
}
|
859 |
-
|
860 |
-
return $value;
|
861 |
-
}
|
862 |
-
}
|
863 |
-
|
864 |
-
/**
|
865 |
-
* Kicking this off by calling 'get_instance()' method
|
866 |
-
*/
|
867 |
-
Cartflows_Default_Meta::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Cartflow default options.
|
4 |
+
*
|
5 |
+
* @package Cartflows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialization
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Default_Meta {
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Member Variable
|
19 |
+
*
|
20 |
+
* @var instance
|
21 |
+
*/
|
22 |
+
private static $instance;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Member Variable
|
26 |
+
*
|
27 |
+
* @var checkout_fields
|
28 |
+
*/
|
29 |
+
private static $checkout_fields = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Member Variable
|
33 |
+
*
|
34 |
+
* @var checkout_fields
|
35 |
+
*/
|
36 |
+
private static $thankyou_fields = null;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Member Variable
|
40 |
+
*
|
41 |
+
* @var flow_fields
|
42 |
+
*/
|
43 |
+
private static $flow_fields = null;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Member Variable
|
47 |
+
*
|
48 |
+
* @var landing_fields
|
49 |
+
*/
|
50 |
+
private static $landing_fields = null;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Member Variable
|
54 |
+
*
|
55 |
+
* @var optin_fields
|
56 |
+
*/
|
57 |
+
private static $optin_fields = null;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Initiator
|
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 |
+
public function __construct() {
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Checkout Default fields.
|
77 |
+
*
|
78 |
+
* @param int $post_id post id.
|
79 |
+
* @return array
|
80 |
+
*/
|
81 |
+
public function get_checkout_fields( $post_id ) {
|
82 |
+
|
83 |
+
if ( null === self::$checkout_fields ) {
|
84 |
+
self::$checkout_fields = array(
|
85 |
+
'wcf-field-google-font-url' => array(
|
86 |
+
'default' => '',
|
87 |
+
'sanitize' => 'FILTER_DEFAULT',
|
88 |
+
),
|
89 |
+
'wcf-checkout-products' => array(
|
90 |
+
'default' => array(),
|
91 |
+
'sanitize' => 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS',
|
92 |
+
),
|
93 |
+
'wcf-checkout-layout' => array(
|
94 |
+
'default' => 'two-column',
|
95 |
+
'sanitize' => 'FILTER_DEFAULT',
|
96 |
+
),
|
97 |
+
'wcf-input-font-family' => array(
|
98 |
+
'default' => '',
|
99 |
+
'sanitize' => 'FILTER_DEFAULT',
|
100 |
+
),
|
101 |
+
'wcf-input-font-weight' => array(
|
102 |
+
'default' => '',
|
103 |
+
'sanitize' => 'FILTER_DEFAULT',
|
104 |
+
),
|
105 |
+
'wcf-heading-font-family' => array(
|
106 |
+
'default' => '',
|
107 |
+
'sanitize' => 'FILTER_DEFAULT',
|
108 |
+
),
|
109 |
+
'wcf-heading-font-weight' => array(
|
110 |
+
'default' => '',
|
111 |
+
'sanitize' => 'FILTER_DEFAULT',
|
112 |
+
),
|
113 |
+
'wcf-base-font-family' => array(
|
114 |
+
'default' => '',
|
115 |
+
'sanitize' => 'FILTER_DEFAULT',
|
116 |
+
),
|
117 |
+
'wcf-advance-options-fields' => array(
|
118 |
+
'default' => '',
|
119 |
+
'sanitize' => 'FILTER_DEFAULT',
|
120 |
+
),
|
121 |
+
'wcf-remove-product-field' => array(
|
122 |
+
'default' => '',
|
123 |
+
'sanitize' => 'FILTER_DEFAULT',
|
124 |
+
),
|
125 |
+
'wcf-checkout-place-order-button-text' => array(
|
126 |
+
'default' => '',
|
127 |
+
'sanitize' => 'FILTER_SANITIZE_STRING',
|
128 |
+
),
|
129 |
+
'wcf-base-font-weight' => array(
|
130 |
+
'default' => '',
|
131 |
+
'sanitize' => 'FILTER_DEFAULT',
|
132 |
+
),
|
133 |
+
'wcf-button-font-family' => array(
|
134 |
+
'default' => '',
|
135 |
+
'sanitize' => 'FILTER_DEFAULT',
|
136 |
+
),
|
137 |
+
'wcf-button-font-weight' => array(
|
138 |
+
'default' => '',
|
139 |
+
'sanitize' => 'FILTER_DEFAULT',
|
140 |
+
),
|
141 |
+
'wcf-primary-color' => array(
|
142 |
+
'default' => '',
|
143 |
+
'sanitize' => 'FILTER_DEFAULT',
|
144 |
+
),
|
145 |
+
'wcf-heading-color' => array(
|
146 |
+
'default' => '',
|
147 |
+
'sanitize' => 'FILTER_DEFAULT',
|
148 |
+
),
|
149 |
+
'wcf-section-bg-color' => array(
|
150 |
+
'default' => '',
|
151 |
+
'sanitize' => 'FILTER_DEFAULT',
|
152 |
+
),
|
153 |
+
'wcf-hl-bg-color' => array(
|
154 |
+
'default' => '',
|
155 |
+
'sanitize' => 'FILTER_DEFAULT',
|
156 |
+
),
|
157 |
+
'wcf-field-tb-padding' => array(
|
158 |
+
'default' => '',
|
159 |
+
'sanitize' => 'FILTER_DEFAULT',
|
160 |
+
),
|
161 |
+
'wcf-field-lr-padding' => array(
|
162 |
+
'default' => '',
|
163 |
+
'sanitize' => 'FILTER_DEFAULT',
|
164 |
+
),
|
165 |
+
'wcf-fields-skins' => array(
|
166 |
+
'default' => '',
|
167 |
+
'sanitize' => 'FILTER_DEFAULT',
|
168 |
+
),
|
169 |
+
'wcf-input-field-size' => array(
|
170 |
+
'default' => '33px',
|
171 |
+
'sanitize' => 'FILTER_DEFAULT',
|
172 |
+
),
|
173 |
+
'wcf-field-color' => array(
|
174 |
+
'default' => '',
|
175 |
+
'sanitize' => 'FILTER_DEFAULT',
|
176 |
+
),
|
177 |
+
'wcf-field-bg-color' => array(
|
178 |
+
'default' => '',
|
179 |
+
'sanitize' => 'FILTER_DEFAULT',
|
180 |
+
),
|
181 |
+
'wcf-field-border-color' => array(
|
182 |
+
'default' => '',
|
183 |
+
'sanitize' => 'FILTER_DEFAULT',
|
184 |
+
),
|
185 |
+
'wcf-box-border-color' => array(
|
186 |
+
'default' => '',
|
187 |
+
'sanitize' => 'FILTER_DEFAULT',
|
188 |
+
),
|
189 |
+
'wcf-field-label-color' => array(
|
190 |
+
'default' => '',
|
191 |
+
'sanitize' => 'FILTER_DEFAULT',
|
192 |
+
),
|
193 |
+
'wcf-submit-tb-padding' => array(
|
194 |
+
'default' => '',
|
195 |
+
'sanitize' => 'FILTER_DEFAULT',
|
196 |
+
),
|
197 |
+
'wcf-submit-lr-padding' => array(
|
198 |
+
'default' => '',
|
199 |
+
'sanitize' => 'FILTER_DEFAULT',
|
200 |
+
),
|
201 |
+
'wcf-input-button-size' => array(
|
202 |
+
'default' => '33px',
|
203 |
+
'sanitize' => 'FILTER_DEFAULT',
|
204 |
+
),
|
205 |
+
'wcf-submit-color' => array(
|
206 |
+
'default' => '',
|
207 |
+
'sanitize' => 'FILTER_DEFAULT',
|
208 |
+
),
|
209 |
+
'wcf-submit-hover-color' => array(
|
210 |
+
'default' => '',
|
211 |
+
'sanitize' => 'FILTER_DEFAULT',
|
212 |
+
),
|
213 |
+
'wcf-submit-bg-color' => array(
|
214 |
+
'default' => '',
|
215 |
+
'sanitize' => 'FILTER_DEFAULT',
|
216 |
+
),
|
217 |
+
'wcf-submit-bg-hover-color' => array(
|
218 |
+
'default' => '',
|
219 |
+
'sanitize' => 'FILTER_DEFAULT',
|
220 |
+
),
|
221 |
+
'wcf-submit-border-color' => array(
|
222 |
+
'default' => '',
|
223 |
+
'sanitize' => 'FILTER_DEFAULT',
|
224 |
+
),
|
225 |
+
'wcf-submit-border-hover-color' => array(
|
226 |
+
'default' => '',
|
227 |
+
'sanitize' => 'FILTER_DEFAULT',
|
228 |
+
),
|
229 |
+
'wcf-active-tab' => array(
|
230 |
+
'default' => '',
|
231 |
+
'sanitize' => 'FILTER_DEFAULT',
|
232 |
+
),
|
233 |
+
'wcf-header-logo-image' => array(
|
234 |
+
'default' => '',
|
235 |
+
'sanitize' => 'FILTER_DEFAULT',
|
236 |
+
),
|
237 |
+
'wcf-header-logo-width' => array(
|
238 |
+
'default' => '',
|
239 |
+
'sanitize' => 'FILTER_DEFAULT',
|
240 |
+
),
|
241 |
+
'wcf-custom-script' => array(
|
242 |
+
'default' => '',
|
243 |
+
'sanitize' => 'FILTER_DEFAULT',
|
244 |
+
),
|
245 |
+
);
|
246 |
+
|
247 |
+
self::$checkout_fields = apply_filters( 'cartflows_checkout_meta_options', self::$checkout_fields, $post_id );
|
248 |
+
}
|
249 |
+
|
250 |
+
return self::$checkout_fields;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Save Checkout Meta fields.
|
255 |
+
*
|
256 |
+
* @param int $post_id post id.
|
257 |
+
* @return void
|
258 |
+
*/
|
259 |
+
public function save_checkout_fields( $post_id ) {
|
260 |
+
|
261 |
+
$post_meta = $this->get_checkout_fields( $post_id );
|
262 |
+
|
263 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Save Landing Meta fields.
|
268 |
+
*
|
269 |
+
* @param int $post_id post id.
|
270 |
+
* @return void
|
271 |
+
*/
|
272 |
+
public function save_landing_fields( $post_id ) {
|
273 |
+
|
274 |
+
$post_meta = $this->get_landing_fields( $post_id );
|
275 |
+
|
276 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Save ThankYou Meta fields.
|
281 |
+
*
|
282 |
+
* @param int $post_id post id.
|
283 |
+
* @return void
|
284 |
+
*/
|
285 |
+
public function save_thankyou_fields( $post_id ) {
|
286 |
+
|
287 |
+
$post_meta = $this->get_thankyou_fields( $post_id );
|
288 |
+
|
289 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Flow Default fields.
|
294 |
+
*
|
295 |
+
* @param int $post_id post id.
|
296 |
+
* @return array
|
297 |
+
*/
|
298 |
+
public function get_flow_fields( $post_id ) {
|
299 |
+
|
300 |
+
if ( null === self::$flow_fields ) {
|
301 |
+
self::$flow_fields = array(
|
302 |
+
'wcf-steps' => array(
|
303 |
+
'default' => array(),
|
304 |
+
'sanitize' => 'FILTER_DEFAULT',
|
305 |
+
),
|
306 |
+
|
307 |
+
'wcf-testing' => array(
|
308 |
+
'default' => 'no',
|
309 |
+
'sanitize' => 'FILTER_DEFAULT',
|
310 |
+
),
|
311 |
+
);
|
312 |
+
}
|
313 |
+
|
314 |
+
return apply_filters( 'cartflows_flow_meta_options', self::$flow_fields );
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Save Flow Meta fields.
|
319 |
+
*
|
320 |
+
* @param int $post_id post id.
|
321 |
+
* @return void
|
322 |
+
*/
|
323 |
+
public function save_flow_fields( $post_id ) {
|
324 |
+
|
325 |
+
$post_meta = $this->get_flow_fields( $post_id );
|
326 |
+
|
327 |
+
if ( isset( $post_meta['wcf-steps'] ) ) {
|
328 |
+
unset( $post_meta['wcf-steps'] );
|
329 |
+
}
|
330 |
+
|
331 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Save Meta fields - Common Function.
|
336 |
+
*
|
337 |
+
* @param int $post_id post id.
|
338 |
+
* @param array $post_meta options to store.
|
339 |
+
* @return void
|
340 |
+
*/
|
341 |
+
public function save_meta_fields( $post_id, $post_meta ) {
|
342 |
+
|
343 |
+
if ( ! ( $post_id && is_array( $post_meta ) ) ) {
|
344 |
+
return;
|
345 |
+
}
|
346 |
+
|
347 |
+
foreach ( $post_meta as $key => $data ) {
|
348 |
+
$meta_value = false;
|
349 |
+
|
350 |
+
// Sanitize values.
|
351 |
+
$sanitize_filter = ( isset( $data['sanitize'] ) ) ? $data['sanitize'] : 'FILTER_DEFAULT';
|
352 |
+
|
353 |
+
switch ( $sanitize_filter ) {
|
354 |
+
case 'FILTER_SANITIZE_STRING':
|
355 |
+
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_STRING );
|
356 |
+
break;
|
357 |
+
|
358 |
+
case 'FILTER_SANITIZE_URL':
|
359 |
+
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_URL );
|
360 |
+
break;
|
361 |
+
|
362 |
+
case 'FILTER_SANITIZE_NUMBER_INT':
|
363 |
+
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_NUMBER_INT );
|
364 |
+
break;
|
365 |
+
|
366 |
+
case 'FILTER_CARTFLOWS_ARRAY':
|
367 |
+
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
|
368 |
+
$meta_value = array_map( 'sanitize_text_field', wp_unslash( $_POST[ $key ] ) ); //phpcs:ignore
|
369 |
+
}
|
370 |
+
break;
|
371 |
+
|
372 |
+
case 'FILTER_CARTFLOWS_CHECKOUT_PRODUCTS':
|
373 |
+
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) { //phpcs:ignore
|
374 |
+
$i = 0;
|
375 |
+
$q = 0;
|
376 |
+
|
377 |
+
foreach ( $_POST[ $key ] as $p_index => $p_data ) { // phpcs:ignore
|
378 |
+
foreach ( $p_data as $i_key => $i_value ) {
|
379 |
+
if ( is_array( $i_value ) ) {
|
380 |
+
foreach ( $i_value as $q_key => $q_value ) {
|
381 |
+
$meta_value[ $i ][ $i_key ][ $q ] = array_map( 'sanitize_text_field', $q_value );
|
382 |
+
|
383 |
+
$q++;
|
384 |
+
}
|
385 |
+
} else {
|
386 |
+
$meta_value[ $i ][ $i_key ] = sanitize_text_field( $i_value );
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
$i++;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
break;
|
394 |
+
|
395 |
+
case 'FILTER_CARTFLOWS_IMAGES':
|
396 |
+
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
397 |
+
|
398 |
+
if ( isset( $_POST[ $key . '-obj' ] )) { //phpcs:ignore
|
399 |
+
|
400 |
+
if ( ! is_serialized( $_POST[ $key . '-obj' ] ) ) { //phpcs:ignore
|
401 |
+
|
402 |
+
$image_obj = json_decode( stripcslashes( wp_unslash( $_POST[ $key . '-obj' ] ) ), true ); //phpcs:ignore
|
403 |
+
$image_url = isset( $image_obj['sizes'] ) ? $image_obj['sizes'] : array();
|
404 |
+
|
405 |
+
$image_data = array(
|
406 |
+
'id' => isset( $image_obj['id'] ) ? intval( $image_obj['id'] ) : 0,
|
407 |
+
'url' => array(
|
408 |
+
'thumbnail' => isset( $image_url['thumbnail']['url'] ) ? esc_url_raw( $image_url['thumbnail']['url'] ) : '',
|
409 |
+
'medium' => isset( $image_url['medium']['url'] ) ? esc_url_raw( $image_url['medium']['url'] ) : '',
|
410 |
+
'full' => isset( $image_url['full']['url'] ) ? esc_url_raw( $image_url['full']['url'] ) : '',
|
411 |
+
),
|
412 |
+
);
|
413 |
+
|
414 |
+
$new_meta_value = 0 !== $image_data['id'] ? $image_data : '';
|
415 |
+
update_post_meta( $post_id, $key . '-obj', $new_meta_value );
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
break;
|
420 |
+
|
421 |
+
default:
|
422 |
+
if ( 'FILTER_DEFAULT' === $sanitize_filter ) {
|
423 |
+
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
424 |
+
} else {
|
425 |
+
$meta_value = apply_filters( 'cartflows_save_meta_field_values', $meta_value, $post_id, $key, $sanitize_filter );
|
426 |
+
}
|
427 |
+
|
428 |
+
break;
|
429 |
+
}
|
430 |
+
|
431 |
+
if ( false !== $meta_value ) {
|
432 |
+
update_post_meta( $post_id, $key, $meta_value );
|
433 |
+
} else {
|
434 |
+
delete_post_meta( $post_id, $key );
|
435 |
+
}
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Get checkout meta.
|
441 |
+
*
|
442 |
+
* @param int $post_id post id.
|
443 |
+
* @param string $key options key.
|
444 |
+
* @param mix $default options default value.
|
445 |
+
* @return string
|
446 |
+
*/
|
447 |
+
public function get_flow_meta_value( $post_id, $key, $default = false ) {
|
448 |
+
|
449 |
+
$value = $this->get_save_meta( $post_id, $key );
|
450 |
+
|
451 |
+
if ( ! $value ) {
|
452 |
+
if ( $default ) {
|
453 |
+
$value = $default;
|
454 |
+
} else {
|
455 |
+
$fields = $this->get_flow_fields( $post_id );
|
456 |
+
|
457 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
458 |
+
$value = $fields[ $key ]['default'];
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
return $value;
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Get checkout meta.
|
468 |
+
*
|
469 |
+
* @param int $post_id post id.
|
470 |
+
* @param string $key options key.
|
471 |
+
* @param mix $default options default value.
|
472 |
+
* @return string
|
473 |
+
*/
|
474 |
+
public function get_checkout_meta_value( $post_id = 0, $key = '', $default = false ) {
|
475 |
+
|
476 |
+
$value = $this->get_save_meta( $post_id, $key );
|
477 |
+
|
478 |
+
if ( ! $value ) {
|
479 |
+
if ( false !== $default ) {
|
480 |
+
$value = $default;
|
481 |
+
} else {
|
482 |
+
$fields = $this->get_checkout_fields( $post_id );
|
483 |
+
|
484 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
485 |
+
$value = $fields[ $key ]['default'];
|
486 |
+
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
return $value;
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Get post meta.
|
495 |
+
*
|
496 |
+
* @param int $post_id post id.
|
497 |
+
* @param string $key options key.
|
498 |
+
* @return string
|
499 |
+
*/
|
500 |
+
public function get_save_meta( $post_id, $key ) {
|
501 |
+
|
502 |
+
$value = get_post_meta( $post_id, $key, true );
|
503 |
+
|
504 |
+
return $value;
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Thank You Default fields.
|
509 |
+
*
|
510 |
+
* @param int $post_id post id.
|
511 |
+
* @return array
|
512 |
+
*/
|
513 |
+
public function get_thankyou_fields( $post_id ) {
|
514 |
+
|
515 |
+
if ( null === self::$thankyou_fields ) {
|
516 |
+
self::$thankyou_fields = array(
|
517 |
+
'wcf-field-google-font-url' => array(
|
518 |
+
'default' => '',
|
519 |
+
'sanitize' => 'FILTER_DEFAULT',
|
520 |
+
),
|
521 |
+
'wcf-active-tab' => array(
|
522 |
+
'default' => '',
|
523 |
+
'sanitize' => 'FILTER_DEFAULT',
|
524 |
+
),
|
525 |
+
'wcf-tq-text-color' => array(
|
526 |
+
'default' => '',
|
527 |
+
'sanitize' => 'FILTER_DEFAULT',
|
528 |
+
),
|
529 |
+
'wcf-tq-font-family' => array(
|
530 |
+
'default' => '',
|
531 |
+
'sanitize' => 'FILTER_DEFAULT',
|
532 |
+
),
|
533 |
+
'wcf-tq-font-size' => array(
|
534 |
+
'default' => '',
|
535 |
+
'sanitize' => 'FILTER_DEFAULT',
|
536 |
+
),
|
537 |
+
'wcf-tq-heading-color' => array(
|
538 |
+
'default' => '',
|
539 |
+
'sanitize' => 'FILTER_DEFAULT',
|
540 |
+
),
|
541 |
+
'wcf-tq-heading-font-family' => array(
|
542 |
+
'default' => '',
|
543 |
+
'sanitize' => 'FILTER_DEFAULT',
|
544 |
+
),
|
545 |
+
'wcf-tq-heading-font-wt' => array(
|
546 |
+
'default' => '',
|
547 |
+
'sanitize' => 'FILTER_DEFAULT',
|
548 |
+
),
|
549 |
+
'wcf-tq-container-width' => array(
|
550 |
+
'default' => '',
|
551 |
+
'sanitize' => 'FILTER_DEFAULT',
|
552 |
+
),
|
553 |
+
'wcf-tq-section-bg-color' => array(
|
554 |
+
'default' => '',
|
555 |
+
'sanitize' => 'FILTER_DEFAULT',
|
556 |
+
),
|
557 |
+
'wcf-tq-advance-options-fields' => array(
|
558 |
+
'default' => '',
|
559 |
+
'sanitize' => 'FILTER_DEFAULT',
|
560 |
+
),
|
561 |
+
'wcf-show-overview-section' => array(
|
562 |
+
'default' => 'yes',
|
563 |
+
'sanitize' => 'FILTER_DEFAULT',
|
564 |
+
),
|
565 |
+
'wcf-show-details-section' => array(
|
566 |
+
'default' => 'yes',
|
567 |
+
'sanitize' => 'FILTER_DEFAULT',
|
568 |
+
),
|
569 |
+
'wcf-show-billing-section' => array(
|
570 |
+
'default' => 'yes',
|
571 |
+
'sanitize' => 'FILTER_DEFAULT',
|
572 |
+
),
|
573 |
+
'wcf-show-shipping-section' => array(
|
574 |
+
'default' => 'yes',
|
575 |
+
'sanitize' => 'FILTER_DEFAULT',
|
576 |
+
),
|
577 |
+
'wcf-show-tq-redirect-section' => array(
|
578 |
+
'default' => '',
|
579 |
+
'sanitize' => 'FILTER_DEFAULT',
|
580 |
+
),
|
581 |
+
'wcf-tq-redirect-link' => array(
|
582 |
+
'default' => '',
|
583 |
+
'sanitize' => 'FILTER_SANITIZE_URL',
|
584 |
+
),
|
585 |
+
'wcf-tq-text' => array(
|
586 |
+
'default' => '',
|
587 |
+
'sanitize' => 'FILTER_DEFAULT',
|
588 |
+
),
|
589 |
+
'wcf-custom-script' => array(
|
590 |
+
'default' => '',
|
591 |
+
'sanitize' => 'FILTER_DEFAULT',
|
592 |
+
),
|
593 |
+
);
|
594 |
+
}
|
595 |
+
|
596 |
+
return apply_filters( 'cartflows_thankyou_meta_options', self::$thankyou_fields, $post_id );
|
597 |
+
}
|
598 |
+
|
599 |
+
/**
|
600 |
+
* Get Thank you section meta.
|
601 |
+
*
|
602 |
+
* @param int $post_id post id.
|
603 |
+
* @param string $key options key.
|
604 |
+
* @param mix $default options default value.
|
605 |
+
* @return string
|
606 |
+
*/
|
607 |
+
public function get_thankyou_meta_value( $post_id, $key, $default = false ) {
|
608 |
+
|
609 |
+
$value = $this->get_save_meta( $post_id, $key );
|
610 |
+
|
611 |
+
if ( ! $value ) {
|
612 |
+
if ( $default ) {
|
613 |
+
$value = $default;
|
614 |
+
} else {
|
615 |
+
$fields = $this->get_thankyou_fields( $post_id );
|
616 |
+
|
617 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
618 |
+
$value = $fields[ $key ]['default'];
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
return $value;
|
624 |
+
}
|
625 |
+
|
626 |
+
/**
|
627 |
+
* Get Landing section meta.
|
628 |
+
*
|
629 |
+
* @param int $post_id post id.
|
630 |
+
* @param string $key options key.
|
631 |
+
* @param mix $default options default value.
|
632 |
+
* @return string
|
633 |
+
*/
|
634 |
+
public function get_landing_meta_value( $post_id, $key, $default = false ) {
|
635 |
+
|
636 |
+
$value = $this->get_save_meta( $post_id, $key );
|
637 |
+
if ( ! $value ) {
|
638 |
+
if ( $default ) {
|
639 |
+
$value = $default;
|
640 |
+
} else {
|
641 |
+
$fields = $this->get_landing_fields( $post_id );
|
642 |
+
|
643 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
644 |
+
$value = $fields[ $key ]['default'];
|
645 |
+
}
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
return $value;
|
650 |
+
}
|
651 |
+
|
652 |
+
/**
|
653 |
+
* Landing Default fields.
|
654 |
+
*
|
655 |
+
* @param int $post_id post id.
|
656 |
+
* @return array
|
657 |
+
*/
|
658 |
+
public function get_landing_fields( $post_id ) {
|
659 |
+
|
660 |
+
if ( null === self::$landing_fields ) {
|
661 |
+
self::$landing_fields = array(
|
662 |
+
'wcf-custom-script' => array(
|
663 |
+
'default' => '',
|
664 |
+
'sanitize' => 'FILTER_DEFAULT',
|
665 |
+
),
|
666 |
+
);
|
667 |
+
}
|
668 |
+
return apply_filters( 'cartflows_landing_meta_options', self::$landing_fields, $post_id );
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Optin Default fields.
|
673 |
+
*
|
674 |
+
* @param int $post_id post id.
|
675 |
+
* @return array
|
676 |
+
*/
|
677 |
+
public function get_optin_fields( $post_id ) {
|
678 |
+
|
679 |
+
if ( null === self::$optin_fields ) {
|
680 |
+
self::$optin_fields = array(
|
681 |
+
|
682 |
+
'wcf-optin-product' => array(
|
683 |
+
'default' => array(),
|
684 |
+
'sanitize' => 'FILTER_CARTFLOWS_ARRAY',
|
685 |
+
),
|
686 |
+
|
687 |
+
/* Style */
|
688 |
+
'wcf-field-google-font-url' => array(
|
689 |
+
'default' => '',
|
690 |
+
'sanitize' => 'FILTER_DEFAULT',
|
691 |
+
),
|
692 |
+
'wcf-primary-color' => array(
|
693 |
+
'default' => '',
|
694 |
+
'sanitize' => 'FILTER_DEFAULT',
|
695 |
+
),
|
696 |
+
'wcf-base-font-family' => array(
|
697 |
+
'default' => '',
|
698 |
+
'sanitize' => 'FILTER_DEFAULT',
|
699 |
+
),
|
700 |
+
'wcf-input-fields-skins' => array(
|
701 |
+
'default' => '',
|
702 |
+
'sanitize' => 'FILTER_DEFAULT',
|
703 |
+
),
|
704 |
+
'wcf-input-font-family' => array(
|
705 |
+
'default' => '',
|
706 |
+
'sanitize' => 'FILTER_DEFAULT',
|
707 |
+
),
|
708 |
+
'wcf-input-font-weight' => array(
|
709 |
+
'default' => '',
|
710 |
+
'sanitize' => 'FILTER_DEFAULT',
|
711 |
+
),
|
712 |
+
'wcf-input-field-size' => array(
|
713 |
+
'default' => '33px',
|
714 |
+
'sanitize' => 'FILTER_DEFAULT',
|
715 |
+
),
|
716 |
+
'wcf-field-tb-padding' => array(
|
717 |
+
'default' => '',
|
718 |
+
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
719 |
+
),
|
720 |
+
'wcf-field-lr-padding' => array(
|
721 |
+
'default' => '',
|
722 |
+
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
723 |
+
),
|
724 |
+
'wcf-field-color' => array(
|
725 |
+
'default' => '',
|
726 |
+
'sanitize' => 'FILTER_DEFAULT',
|
727 |
+
),
|
728 |
+
'wcf-field-bg-color' => array(
|
729 |
+
'default' => '',
|
730 |
+
'sanitize' => 'FILTER_DEFAULT',
|
731 |
+
),
|
732 |
+
'wcf-field-border-color' => array(
|
733 |
+
'default' => '',
|
734 |
+
'sanitize' => 'FILTER_DEFAULT',
|
735 |
+
),
|
736 |
+
'wcf-field-label-color' => array(
|
737 |
+
'default' => '',
|
738 |
+
'sanitize' => 'FILTER_DEFAULT',
|
739 |
+
),
|
740 |
+
'wcf-submit-button-text' => array(
|
741 |
+
'default' => __( 'Submit', 'cartflows' ),
|
742 |
+
'sanitize' => 'FILTER_DEFAULT',
|
743 |
+
),
|
744 |
+
'wcf-submit-font-size' => array(
|
745 |
+
'default' => '',
|
746 |
+
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
747 |
+
),
|
748 |
+
'wcf-button-font-family' => array(
|
749 |
+
'default' => '',
|
750 |
+
'sanitize' => 'FILTER_DEFAULT',
|
751 |
+
),
|
752 |
+
'wcf-button-font-weight' => array(
|
753 |
+
'default' => '',
|
754 |
+
'sanitize' => 'FILTER_DEFAULT',
|
755 |
+
),
|
756 |
+
'wcf-submit-button-size' => array(
|
757 |
+
'default' => '33px',
|
758 |
+
'sanitize' => 'FILTER_DEFAULT',
|
759 |
+
),
|
760 |
+
'wcf-submit-tb-padding' => array(
|
761 |
+
'default' => '',
|
762 |
+
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
763 |
+
),
|
764 |
+
'wcf-submit-lr-padding' => array(
|
765 |
+
'default' => '',
|
766 |
+
'sanitize' => 'FILTER_SANITIZE_NUMBER_INT',
|
767 |
+
),
|
768 |
+
'wcf-submit-button-position' => array(
|
769 |
+
'default' => 'center',
|
770 |
+
'sanitize' => 'FILTER_DEFAULT',
|
771 |
+
),
|
772 |
+
'wcf-submit-color' => array(
|
773 |
+
'default' => '',
|
774 |
+
'sanitize' => 'FILTER_DEFAULT',
|
775 |
+
),
|
776 |
+
'wcf-submit-hover-color' => array(
|
777 |
+
'default' => '',
|
778 |
+
'sanitize' => 'FILTER_DEFAULT',
|
779 |
+
),
|
780 |
+
'wcf-submit-bg-color' => array(
|
781 |
+
'default' => '',
|
782 |
+
'sanitize' => 'FILTER_DEFAULT',
|
783 |
+
),
|
784 |
+
'wcf-submit-bg-hover-color' => array(
|
785 |
+
'default' => '',
|
786 |
+
'sanitize' => 'FILTER_DEFAULT',
|
787 |
+
),
|
788 |
+
'wcf-submit-border-color' => array(
|
789 |
+
'default' => '',
|
790 |
+
'sanitize' => 'FILTER_DEFAULT',
|
791 |
+
),
|
792 |
+
'wcf-submit-border-hover-color' => array(
|
793 |
+
'default' => '',
|
794 |
+
'sanitize' => 'FILTER_DEFAULT',
|
795 |
+
),
|
796 |
+
|
797 |
+
/* Settings */
|
798 |
+
'wcf-optin-pass-fields' => array(
|
799 |
+
'default' => '',
|
800 |
+
'sanitize' => 'FILTER_DEFAULT',
|
801 |
+
),
|
802 |
+
'wcf-optin-pass-specific-fields' => array(
|
803 |
+
'default' => 'first_name',
|
804 |
+
'sanitize' => 'FILTER_DEFAULT',
|
805 |
+
),
|
806 |
+
|
807 |
+
/* Script */
|
808 |
+
'wcf-custom-script' => array(
|
809 |
+
'default' => '',
|
810 |
+
'sanitize' => 'FILTER_DEFAULT',
|
811 |
+
),
|
812 |
+
|
813 |
+
/* Hidden */
|
814 |
+
'wcf-active-tab' => array(
|
815 |
+
'default' => '',
|
816 |
+
'sanitize' => 'FILTER_DEFAULT',
|
817 |
+
),
|
818 |
+
);
|
819 |
+
}
|
820 |
+
return apply_filters( 'cartflows_optin_meta_options', self::$optin_fields, $post_id );
|
821 |
+
}
|
822 |
+
|
823 |
+
/**
|
824 |
+
* Save Optin Meta fields.
|
825 |
+
*
|
826 |
+
* @param int $post_id post id.
|
827 |
+
* @return void
|
828 |
+
*/
|
829 |
+
public function save_optin_fields( $post_id ) {
|
830 |
+
|
831 |
+
$post_meta = $this->get_optin_fields( $post_id );
|
832 |
+
|
833 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
834 |
+
}
|
835 |
+
|
836 |
+
/**
|
837 |
+
* Get optin meta.
|
838 |
+
*
|
839 |
+
* @param int $post_id post id.
|
840 |
+
* @param string $key options key.
|
841 |
+
* @param mix $default options default value.
|
842 |
+
* @return string
|
843 |
+
*/
|
844 |
+
public function get_optin_meta_value( $post_id = 0, $key = '', $default = false ) {
|
845 |
+
|
846 |
+
$value = $this->get_save_meta( $post_id, $key );
|
847 |
+
|
848 |
+
if ( ! $value ) {
|
849 |
+
if ( false !== $default ) {
|
850 |
+
$value = $default;
|
851 |
+
} else {
|
852 |
+
$fields = $this->get_optin_fields( $post_id );
|
853 |
+
|
854 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
855 |
+
$value = $fields[ $key ]['default'];
|
856 |
+
}
|
857 |
+
}
|
858 |
+
}
|
859 |
+
|
860 |
+
return $value;
|
861 |
+
}
|
862 |
+
}
|
863 |
+
|
864 |
+
/**
|
865 |
+
* Kicking this off by calling 'get_instance()' method
|
866 |
+
*/
|
867 |
+
Cartflows_Default_Meta::get_instance();
|
classes/class-cartflows-frontend.php
CHANGED
@@ -1,654 +1,654 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CartFlows Frontend.
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class Cartflows_Frontend.
|
10 |
-
*/
|
11 |
-
class Cartflows_Frontend {
|
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 |
-
/* 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 |
-
add_action( 'init', array( $this, 'setup_optin_checkout_filter' ) );
|
40 |
-
/* Enqueue global required scripts */
|
41 |
-
add_action( 'wp', array( $this, 'wp_actions' ), 55 );
|
42 |
-
|
43 |
-
/* Modify the checkout order received url to go thank you page in our flow */
|
44 |
-
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
45 |
-
|
46 |
-
add_action( 'wp_head', array( $this, 'facebook_pixel_init' ) );
|
47 |
-
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Redirect to thank page if upsell not exists
|
52 |
-
*
|
53 |
-
* @param string $order_recieve_url url.
|
54 |
-
* @param object $order order object.
|
55 |
-
* @since 1.0.0
|
56 |
-
*/
|
57 |
-
public function redirect_to_thankyou_page( $order_recieve_url, $order ) {
|
58 |
-
|
59 |
-
/* Only for thank you page */
|
60 |
-
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
|
61 |
-
wcf()->logger->log( 'Only for thank you page' );
|
62 |
-
|
63 |
-
if ( wcf()->flow->is_thankyou_page_exists( $order ) ) {
|
64 |
-
|
65 |
-
if ( _is_wcf_doing_checkout_ajax() ) {
|
66 |
-
|
67 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
68 |
-
|
69 |
-
if ( ! $checkout_id ) {
|
70 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
71 |
-
}
|
72 |
-
} else {
|
73 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
74 |
-
}
|
75 |
-
|
76 |
-
wcf()->logger->log( 'Checkout ID : ' . $checkout_id );
|
77 |
-
|
78 |
-
if ( $checkout_id ) {
|
79 |
-
|
80 |
-
$thankyou_step_id = wcf()->flow->get_thankyou_page_id( $order );
|
81 |
-
|
82 |
-
if ( $thankyou_step_id ) {
|
83 |
-
|
84 |
-
$order_recieve_url = get_permalink( $thankyou_step_id );
|
85 |
-
|
86 |
-
$order_recieve_url = add_query_arg(
|
87 |
-
array(
|
88 |
-
'wcf-key' => $order->get_order_key(),
|
89 |
-
'wcf-order' => $order->get_id(),
|
90 |
-
),
|
91 |
-
$order_recieve_url
|
92 |
-
);
|
93 |
-
}
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
|
98 |
-
|
99 |
-
Cartflows_Helper::send_fb_response_if_enabled( $order->get_id() );
|
100 |
-
|
101 |
-
Cartflows_Tracking::send_ga_data_if_enabled( $order->get_id() );
|
102 |
-
|
103 |
-
return $order_recieve_url;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Cancel and redirect to checkout
|
108 |
-
*
|
109 |
-
* @param string $return_url url.
|
110 |
-
* @since 1.0.0
|
111 |
-
*/
|
112 |
-
public function redirect_to_checkout_on_cancel( $return_url ) {
|
113 |
-
|
114 |
-
if ( _is_wcf_doing_checkout_ajax() ) {
|
115 |
-
|
116 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
117 |
-
|
118 |
-
if ( ! $checkout_id ) {
|
119 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
120 |
-
}
|
121 |
-
} else {
|
122 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
123 |
-
}
|
124 |
-
|
125 |
-
if ( $checkout_id ) {
|
126 |
-
|
127 |
-
$return_url = add_query_arg(
|
128 |
-
array(
|
129 |
-
'cancel_order' => 'true',
|
130 |
-
'_wpnonce' => wp_create_nonce( 'woocommerce-cancel_order' ),
|
131 |
-
),
|
132 |
-
get_permalink( $checkout_id )
|
133 |
-
);
|
134 |
-
}
|
135 |
-
|
136 |
-
return $return_url;
|
137 |
-
}
|
138 |
-
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Remove theme styles.
|
142 |
-
*
|
143 |
-
* @since 1.0.0
|
144 |
-
*/
|
145 |
-
public function remove_theme_styles() {
|
146 |
-
|
147 |
-
if ( Cartflows_Compatibility::get_instance()->is_compatibility_theme_enabled() ) {
|
148 |
-
return;
|
149 |
-
}
|
150 |
-
|
151 |
-
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
152 |
-
|
153 |
-
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
154 |
-
|
155 |
-
if ( 'default' === $page_template ) {
|
156 |
-
return;
|
157 |
-
}
|
158 |
-
|
159 |
-
// get all styles data.
|
160 |
-
global $wp_styles;
|
161 |
-
global $wp_scripts;
|
162 |
-
|
163 |
-
$get_stylesheet = 'themes/' . get_stylesheet() . '/';
|
164 |
-
$get_template = 'themes/' . get_template() . '/';
|
165 |
-
|
166 |
-
$remove_styles = apply_filters( 'cartflows_remove_theme_styles', true );
|
167 |
-
|
168 |
-
if ( $remove_styles ) {
|
169 |
-
|
170 |
-
// loop over all of the registered scripts..
|
171 |
-
foreach ( $wp_styles->registered as $handle => $data ) {
|
172 |
-
|
173 |
-
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
|
174 |
-
|
175 |
-
// remove it.
|
176 |
-
wp_deregister_style( $handle );
|
177 |
-
wp_dequeue_style( $handle );
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
$remove_scripts = apply_filters( 'cartflows_remove_theme_scripts', true );
|
183 |
-
|
184 |
-
if ( $remove_scripts ) {
|
185 |
-
|
186 |
-
// loop over all of the registered scripts.
|
187 |
-
foreach ( $wp_scripts->registered as $handle => $data ) {
|
188 |
-
|
189 |
-
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
|
190 |
-
|
191 |
-
// remove it.
|
192 |
-
wp_deregister_script( $handle );
|
193 |
-
wp_dequeue_script( $handle );
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Update main order data in transient.
|
202 |
-
*
|
203 |
-
* @param array $woo_styles new styles array.
|
204 |
-
* @since 1.0.0
|
205 |
-
* @return array.
|
206 |
-
*/
|
207 |
-
public function woo_default_css( $woo_styles ) {
|
208 |
-
|
209 |
-
$woo_styles = array(
|
210 |
-
'woocommerce-layout' => array(
|
211 |
-
'src' => plugins_url( 'assets/css/woocommerce-layout.css', WC_PLUGIN_FILE ),
|
212 |
-
'deps' => '',
|
213 |
-
'version' => WC_VERSION,
|
214 |
-
'media' => 'all',
|
215 |
-
'has_rtl' => true,
|
216 |
-
),
|
217 |
-
'woocommerce-smallscreen' => array(
|
218 |
-
'src' => plugins_url( 'assets/css/woocommerce-smallscreen.css', WC_PLUGIN_FILE ),
|
219 |
-
'deps' => 'woocommerce-layout',
|
220 |
-
'version' => WC_VERSION,
|
221 |
-
'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', '768px' ) . ')',
|
222 |
-
'has_rtl' => true,
|
223 |
-
),
|
224 |
-
'woocommerce-general' => array(
|
225 |
-
'src' => plugins_url( 'assets/css/woocommerce.css', WC_PLUGIN_FILE ),
|
226 |
-
'deps' => '',
|
227 |
-
'version' => WC_VERSION,
|
228 |
-
'media' => 'all',
|
229 |
-
'has_rtl' => true,
|
230 |
-
),
|
231 |
-
);
|
232 |
-
|
233 |
-
return $woo_styles;
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Init Actions.
|
238 |
-
*
|
239 |
-
* @since 1.0.0
|
240 |
-
*/
|
241 |
-
public function init_actions() {
|
242 |
-
|
243 |
-
$this->set_flow_session();
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Set flow session.
|
248 |
-
*
|
249 |
-
* @since 1.0.0
|
250 |
-
*/
|
251 |
-
public function set_flow_session() {
|
252 |
-
|
253 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
254 |
-
global $wp;
|
255 |
-
add_action( 'wp_head', array( $this, 'noindex_flow' ) );
|
256 |
-
|
257 |
-
wcf()->utils->do_not_cache();
|
258 |
-
|
259 |
-
if ( _is_wcf_thankyou_type() ) {
|
260 |
-
/* Set key to support pixel */
|
261 |
-
if ( isset( $_GET['wcf-key'] ) ) { //phpcs:ignore
|
262 |
-
|
263 |
-
$wcf_key = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
|
264 |
-
|
265 |
-
$_GET['key'] = $wcf_key;
|
266 |
-
$_REQUEST['key'] = $wcf_key;
|
267 |
-
}
|
268 |
-
|
269 |
-
if ( isset( $_GET['wcf-order'] ) ) { //phpcs:ignore
|
270 |
-
|
271 |
-
$wcf_order = intval( wp_unslash( $_GET['wcf-order'] ) ); //phpcs:ignore
|
272 |
-
|
273 |
-
$_GET['order'] = $wcf_order;
|
274 |
-
$_REQUEST['order'] = $wcf_order;
|
275 |
-
$_GET['order-received'] = $wcf_order;
|
276 |
-
$_REQUEST['order-received'] = $wcf_order;
|
277 |
-
|
278 |
-
$wp->set_query_var( 'order-received', $wcf_order );
|
279 |
-
}
|
280 |
-
}
|
281 |
-
}
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Add noindex, nofollow.
|
286 |
-
*
|
287 |
-
* @since 1.0.0
|
288 |
-
*/
|
289 |
-
public function noindex_flow() {
|
290 |
-
|
291 |
-
$common = Cartflows_Helper::get_common_settings();
|
292 |
-
|
293 |
-
if ( 'enable' === $common['disallow_indexing'] ) {
|
294 |
-
echo '<meta name="robots" content="noindex,nofollow">';
|
295 |
-
}
|
296 |
-
}
|
297 |
-
|
298 |
-
/**
|
299 |
-
* WP Actions.
|
300 |
-
*
|
301 |
-
* @since 1.0.0
|
302 |
-
*/
|
303 |
-
public function wp_actions() {
|
304 |
-
|
305 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
306 |
-
|
307 |
-
if ( ! wcf()->is_woo_active && wcf()->utils->check_is_woo_required_page() ) {
|
308 |
-
wp_die( ' This page requires WooCommerce plugin installed and activated!', 'WooCommerce Required' );
|
309 |
-
}
|
310 |
-
|
311 |
-
/* CSS Compatibility for All theme */
|
312 |
-
add_filter( 'woocommerce_enqueue_styles', array( $this, 'woo_default_css' ), 9999 );
|
313 |
-
|
314 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'remove_theme_styles' ), 9999 );
|
315 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'global_flow_scripts' ), 20 );
|
316 |
-
|
317 |
-
/* Load woo templates from plugin */
|
318 |
-
add_filter( 'woocommerce_locate_template', array( $this, 'override_woo_template' ), 20, 3 );
|
319 |
-
|
320 |
-
/* Add version class to body in frontend. */
|
321 |
-
add_filter( 'body_class', array( $this, 'add_cartflows_lite_version_to_body' ) );
|
322 |
-
|
323 |
-
/* Custom Script Option */
|
324 |
-
add_action( 'wp_head', array( $this, 'custom_script_option' ) );
|
325 |
-
|
326 |
-
/* Remove the action applied by the Flatsome theme */
|
327 |
-
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
328 |
-
$this->remove_flatsome_action();
|
329 |
-
}
|
330 |
-
}
|
331 |
-
}
|
332 |
-
|
333 |
-
/**
|
334 |
-
* Function for facebook pixel.
|
335 |
-
*/
|
336 |
-
public function facebook_pixel_init() {
|
337 |
-
|
338 |
-
$facebook_settings = Cartflows_Helper::get_facebook_settings();
|
339 |
-
if ( 'enable' === $facebook_settings['facebook_pixel_tracking'] ) {
|
340 |
-
|
341 |
-
$facebook_id = $facebook_settings['facebook_pixel_id'];
|
342 |
-
echo '<!-- Facebook Pixel Script By CartFlows -->';
|
343 |
-
$fb_script = "<script type='text/javascript'>
|
344 |
-
!function(f,b,e,v,n,t,s)
|
345 |
-
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
346 |
-
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
347 |
-
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
348 |
-
n.queue=[];t=b.createElement(e);t.async=!0;
|
349 |
-
t.src=v;s=b.getElementsByTagName(e)[0];
|
350 |
-
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
351 |
-
'https://connect.facebook.net/en_US/fbevents.js');
|
352 |
-
</script>
|
353 |
-
<noscript><img height='1' width='1' style='display:none' src='https://www.facebook.com/tr?id=" . $facebook_id . "&ev=PageView&noscript=1'/></noscript>";
|
354 |
-
|
355 |
-
$fb_page_view = "<script type='text/javascript'>
|
356 |
-
fbq('init', $facebook_id);
|
357 |
-
fbq('track', 'PageView', {'plugin': 'CartFlows'});
|
358 |
-
</script>";
|
359 |
-
|
360 |
-
if ( 'enable' === $facebook_settings['facebook_pixel_tracking_for_site'] && ! wcf()->utils->is_step_post_type() ) {
|
361 |
-
echo $fb_script;
|
362 |
-
echo $fb_page_view;
|
363 |
-
} else {
|
364 |
-
echo $fb_script;
|
365 |
-
}
|
366 |
-
echo '<!-- End Facebook Pixel Script By CartFlows -->';
|
367 |
-
}
|
368 |
-
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Debug Data Setting Actions.
|
373 |
-
*
|
374 |
-
* @since 1.1.14
|
375 |
-
*/
|
376 |
-
public function debug_data_setting_actions() {
|
377 |
-
|
378 |
-
add_filter( 'cartflows_load_min_assets', array( $this, 'allow_load_minify' ) );
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Get/Set the allow minify option.
|
383 |
-
*
|
384 |
-
* @since 1.1.14
|
385 |
-
*/
|
386 |
-
public function allow_load_minify() {
|
387 |
-
$debug_data = Cartflows_Helper::get_debug_settings();
|
388 |
-
$allow_minified = $debug_data['allow_minified_files'];
|
389 |
-
$allow_minify = false;
|
390 |
-
|
391 |
-
if ( 'enable' === $allow_minified ) {
|
392 |
-
$allow_minify = true;
|
393 |
-
}
|
394 |
-
|
395 |
-
return $allow_minify;
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Global flow scripts.
|
400 |
-
*
|
401 |
-
* @since 1.0.0
|
402 |
-
*/
|
403 |
-
public function global_flow_scripts() {
|
404 |
-
|
405 |
-
global $post;
|
406 |
-
|
407 |
-
$flow = get_post_meta( $post->ID, 'wcf-flow-id', true );
|
408 |
-
$current_step = $post->ID;
|
409 |
-
$next_step_link = '';
|
410 |
-
$compatibility = Cartflows_Compatibility::get_instance();
|
411 |
-
|
412 |
-
if ( _is_wcf_landing_type() ) {
|
413 |
-
|
414 |
-
$next_step_id = wcf()->utils->get_next_step_id( $flow, $current_step );
|
415 |
-
$next_step_link = get_permalink( $next_step_id );
|
416 |
-
}
|
417 |
-
|
418 |
-
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
419 |
-
|
420 |
-
$fb_active = Cartflows_Helper::get_facebook_settings();
|
421 |
-
$wcf_ga_active = Cartflows_Helper::get_google_analytics_settings();
|
422 |
-
$params = array();
|
423 |
-
$ga_param = array();
|
424 |
-
|
425 |
-
if ( 'enable' === $fb_active['facebook_pixel_tracking'] && Cartflows_Loader::get_instance()->is_woo_active ) {
|
426 |
-
|
427 |
-
$params = Cartflows_Helper::prepare_cart_data_fb_response();
|
428 |
-
}
|
429 |
-
|
430 |
-
if ( 'enable' === $wcf_ga_active['enable_google_analytics'] ) {
|
431 |
-
$ga_param = Cartflows_Tracking::get_ga_items_list();
|
432 |
-
}
|
433 |
-
|
434 |
-
$localize = array(
|
435 |
-
'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
|
436 |
-
'is_pb_preview' => $compatibility->is_page_builder_preview(),
|
437 |
-
'current_theme' => $compatibility->get_current_theme(),
|
438 |
-
'current_flow' => $flow,
|
439 |
-
'current_step' => $current_step,
|
440 |
-
'next_step' => $next_step_link,
|
441 |
-
'page_template' => $page_template,
|
442 |
-
'is_checkout_page' => _is_wcf_checkout_type(),
|
443 |
-
'params' => $params,
|
444 |
-
'fb_active' => $fb_active,
|
445 |
-
'wcf_ga_active' => $wcf_ga_active,
|
446 |
-
'ga_param' => $ga_param,
|
447 |
-
);
|
448 |
-
|
449 |
-
wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
|
450 |
-
|
451 |
-
if ( 'default' !== $page_template ) {
|
452 |
-
|
453 |
-
wp_enqueue_style( 'wcf-normalize-frontend-global', wcf()->utils->get_css_url( 'cartflows-normalize' ), array(), CARTFLOWS_VER );
|
454 |
-
}
|
455 |
-
|
456 |
-
wp_enqueue_style( 'wcf-frontend-global', wcf()->utils->get_css_url( 'frontend' ), array(), CARTFLOWS_VER );
|
457 |
-
|
458 |
-
wp_enqueue_script(
|
459 |
-
'wcf-frontend-global',
|
460 |
-
wcf()->utils->get_js_url( 'frontend' ),
|
461 |
-
array( 'jquery', 'jquery-cookie' ),
|
462 |
-
CARTFLOWS_VER,
|
463 |
-
false
|
464 |
-
);
|
465 |
-
}
|
466 |
-
|
467 |
-
/**
|
468 |
-
* Custom Script in head.
|
469 |
-
*
|
470 |
-
* @since 1.0.0
|
471 |
-
*/
|
472 |
-
public function custom_script_option() {
|
473 |
-
|
474 |
-
/* Add custom script to header in frontend. */
|
475 |
-
$script = $this->get_custom_script();
|
476 |
-
if ( '' !== $script ) {
|
477 |
-
if ( false === strpos( $script, '<script' ) ) {
|
478 |
-
$script = '<script>' . $script . '</script>';
|
479 |
-
}
|
480 |
-
echo '<!-- Custom CartFlows Script -->';
|
481 |
-
echo $script;
|
482 |
-
echo '<!-- End Custom CartFlows Script -->';
|
483 |
-
}
|
484 |
-
}
|
485 |
-
|
486 |
-
/**
|
487 |
-
* Override woo templates.
|
488 |
-
*
|
489 |
-
* @param string $template new Template full path.
|
490 |
-
* @param string $template_name Template name.
|
491 |
-
* @param string $template_path Template Path.
|
492 |
-
* @since 1.1.5
|
493 |
-
* @return string.
|
494 |
-
*/
|
495 |
-
public function override_woo_template( $template, $template_name, $template_path ) {
|
496 |
-
|
497 |
-
global $woocommerce;
|
498 |
-
|
499 |
-
$_template = $template;
|
500 |
-
|
501 |
-
$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
|
502 |
-
|
503 |
-
if ( file_exists( $plugin_path . $template_name ) ) {
|
504 |
-
$template = $plugin_path . $template_name;
|
505 |
-
}
|
506 |
-
|
507 |
-
if ( ! $template ) {
|
508 |
-
$template = $_template;
|
509 |
-
}
|
510 |
-
|
511 |
-
return $template;
|
512 |
-
}
|
513 |
-
|
514 |
-
/**
|
515 |
-
* Remove the action applied by the Flatsome theme.
|
516 |
-
*
|
517 |
-
* @since 1.1.5
|
518 |
-
* @return void.
|
519 |
-
*/
|
520 |
-
public function remove_flatsome_action() {
|
521 |
-
|
522 |
-
// Remove action where flatsome dequeued the woocommerce's default styles.
|
523 |
-
remove_action( 'wp_enqueue_scripts', 'flatsome_woocommerce_scripts_styles', 98 );
|
524 |
-
}
|
525 |
-
|
526 |
-
/**
|
527 |
-
* Add version class to body in frontend.
|
528 |
-
*
|
529 |
-
* @since 1.1.5
|
530 |
-
* @param array $classes classes.
|
531 |
-
* @return array $classes classes.
|
532 |
-
*/
|
533 |
-
public function add_cartflows_lite_version_to_body( $classes ) {
|
534 |
-
|
535 |
-
$classes[] = 'cartflows-' . CARTFLOWS_VER;
|
536 |
-
|
537 |
-
return $classes;
|
538 |
-
|
539 |
-
}
|
540 |
-
|
541 |
-
/**
|
542 |
-
* Get custom script data.
|
543 |
-
*
|
544 |
-
* @since 1.0.0
|
545 |
-
*/
|
546 |
-
public function get_custom_script() {
|
547 |
-
|
548 |
-
global $post;
|
549 |
-
|
550 |
-
$script = get_post_meta( $post->ID, 'wcf-custom-script', true );
|
551 |
-
|
552 |
-
return $script;
|
553 |
-
}
|
554 |
-
|
555 |
-
|
556 |
-
/**
|
557 |
-
* Set appropriate filter sctions.
|
558 |
-
*
|
559 |
-
* @since 1.1.14
|
560 |
-
*/
|
561 |
-
public function setup_optin_checkout_filter() {
|
562 |
-
|
563 |
-
if ( _is_wcf_doing_optin_ajax() ) {
|
564 |
-
/* Modify the optin order received url to go next step */
|
565 |
-
remove_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
566 |
-
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_optin_to_next_step' ), 10, 2 );
|
567 |
-
}
|
568 |
-
}
|
569 |
-
|
570 |
-
/**
|
571 |
-
* Redirect to thank page if upsell not exists
|
572 |
-
*
|
573 |
-
* @param string $order_recieve_url url.
|
574 |
-
* @param object $order order object.
|
575 |
-
* @since 1.0.0
|
576 |
-
*/
|
577 |
-
public function redirect_optin_to_next_step( $order_recieve_url, $order ) {
|
578 |
-
|
579 |
-
/* Only for optin page */
|
580 |
-
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
|
581 |
-
wcf()->logger->log( 'Only for optin page' );
|
582 |
-
|
583 |
-
if ( _is_wcf_doing_optin_ajax() ) {
|
584 |
-
|
585 |
-
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
586 |
-
|
587 |
-
if ( ! $optin_id ) {
|
588 |
-
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
|
589 |
-
}
|
590 |
-
} else {
|
591 |
-
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
|
592 |
-
}
|
593 |
-
|
594 |
-
wcf()->logger->log( 'Optin ID : ' . $optin_id );
|
595 |
-
|
596 |
-
if ( $optin_id ) {
|
597 |
-
|
598 |
-
$next_step_id = wcf()->flow->get_next_step_id( $order );
|
599 |
-
|
600 |
-
if ( $next_step_id ) {
|
601 |
-
|
602 |
-
$order_recieve_url = get_permalink( $next_step_id );
|
603 |
-
$query_param = array(
|
604 |
-
'wcf-key' => $order->get_order_key(),
|
605 |
-
'wcf-order' => $order->get_id(),
|
606 |
-
);
|
607 |
-
|
608 |
-
if ( 'yes' === wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-fields' ) ) {
|
609 |
-
|
610 |
-
$fields_string = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-specific-fields' );
|
611 |
-
|
612 |
-
$fields = array_map( 'trim', explode( ',', $fields_string ) );
|
613 |
-
|
614 |
-
if ( is_array( $fields ) ) {
|
615 |
-
|
616 |
-
$order_id = $order->get_id();
|
617 |
-
|
618 |
-
foreach ( $fields as $in => $key ) {
|
619 |
-
switch ( $key ) {
|
620 |
-
case 'first_name':
|
621 |
-
$query_param[ $key ] = $order->get_billing_first_name();
|
622 |
-
break;
|
623 |
-
case 'last_name':
|
624 |
-
$query_param[ $key ] = $order->get_billing_last_name();
|
625 |
-
break;
|
626 |
-
case 'email':
|
627 |
-
$query_param[ $key ] = $order->get_billing_email();
|
628 |
-
break;
|
629 |
-
default:
|
630 |
-
$query_param[ $key ] = get_post_meta( $order_id, '_billing_' . $key, true );
|
631 |
-
break;
|
632 |
-
}
|
633 |
-
}
|
634 |
-
}
|
635 |
-
}
|
636 |
-
|
637 |
-
$order_recieve_url = add_query_arg(
|
638 |
-
$query_param,
|
639 |
-
$order_recieve_url
|
640 |
-
);
|
641 |
-
}
|
642 |
-
}
|
643 |
-
|
644 |
-
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
|
645 |
-
|
646 |
-
return $order_recieve_url;
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
/**
|
651 |
-
* Prepare if class 'Cartflows_Frontend' exist.
|
652 |
-
* Kicking this off by calling 'get_instance()' method
|
653 |
-
*/
|
654 |
-
Cartflows_Frontend::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CartFlows Frontend.
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Cartflows_Frontend.
|
10 |
+
*/
|
11 |
+
class Cartflows_Frontend {
|
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 |
+
/* 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 |
+
add_action( 'init', array( $this, 'setup_optin_checkout_filter' ) );
|
40 |
+
/* Enqueue global required scripts */
|
41 |
+
add_action( 'wp', array( $this, 'wp_actions' ), 55 );
|
42 |
+
|
43 |
+
/* Modify the checkout order received url to go thank you page in our flow */
|
44 |
+
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
45 |
+
|
46 |
+
add_action( 'wp_head', array( $this, 'facebook_pixel_init' ) );
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Redirect to thank page if upsell not exists
|
52 |
+
*
|
53 |
+
* @param string $order_recieve_url url.
|
54 |
+
* @param object $order order object.
|
55 |
+
* @since 1.0.0
|
56 |
+
*/
|
57 |
+
public function redirect_to_thankyou_page( $order_recieve_url, $order ) {
|
58 |
+
|
59 |
+
/* Only for thank you page */
|
60 |
+
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
|
61 |
+
wcf()->logger->log( 'Only for thank you page' );
|
62 |
+
|
63 |
+
if ( wcf()->flow->is_thankyou_page_exists( $order ) ) {
|
64 |
+
|
65 |
+
if ( _is_wcf_doing_checkout_ajax() ) {
|
66 |
+
|
67 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
68 |
+
|
69 |
+
if ( ! $checkout_id ) {
|
70 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
74 |
+
}
|
75 |
+
|
76 |
+
wcf()->logger->log( 'Checkout ID : ' . $checkout_id );
|
77 |
+
|
78 |
+
if ( $checkout_id ) {
|
79 |
+
|
80 |
+
$thankyou_step_id = wcf()->flow->get_thankyou_page_id( $order );
|
81 |
+
|
82 |
+
if ( $thankyou_step_id ) {
|
83 |
+
|
84 |
+
$order_recieve_url = get_permalink( $thankyou_step_id );
|
85 |
+
|
86 |
+
$order_recieve_url = add_query_arg(
|
87 |
+
array(
|
88 |
+
'wcf-key' => $order->get_order_key(),
|
89 |
+
'wcf-order' => $order->get_id(),
|
90 |
+
),
|
91 |
+
$order_recieve_url
|
92 |
+
);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
|
98 |
+
|
99 |
+
Cartflows_Helper::send_fb_response_if_enabled( $order->get_id() );
|
100 |
+
|
101 |
+
Cartflows_Tracking::send_ga_data_if_enabled( $order->get_id() );
|
102 |
+
|
103 |
+
return $order_recieve_url;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Cancel and redirect to checkout
|
108 |
+
*
|
109 |
+
* @param string $return_url url.
|
110 |
+
* @since 1.0.0
|
111 |
+
*/
|
112 |
+
public function redirect_to_checkout_on_cancel( $return_url ) {
|
113 |
+
|
114 |
+
if ( _is_wcf_doing_checkout_ajax() ) {
|
115 |
+
|
116 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
117 |
+
|
118 |
+
if ( ! $checkout_id ) {
|
119 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
123 |
+
}
|
124 |
+
|
125 |
+
if ( $checkout_id ) {
|
126 |
+
|
127 |
+
$return_url = add_query_arg(
|
128 |
+
array(
|
129 |
+
'cancel_order' => 'true',
|
130 |
+
'_wpnonce' => wp_create_nonce( 'woocommerce-cancel_order' ),
|
131 |
+
),
|
132 |
+
get_permalink( $checkout_id )
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
return $return_url;
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Remove theme styles.
|
142 |
+
*
|
143 |
+
* @since 1.0.0
|
144 |
+
*/
|
145 |
+
public function remove_theme_styles() {
|
146 |
+
|
147 |
+
if ( Cartflows_Compatibility::get_instance()->is_compatibility_theme_enabled() ) {
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
152 |
+
|
153 |
+
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
154 |
+
|
155 |
+
if ( 'default' === $page_template ) {
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
|
159 |
+
// get all styles data.
|
160 |
+
global $wp_styles;
|
161 |
+
global $wp_scripts;
|
162 |
+
|
163 |
+
$get_stylesheet = 'themes/' . get_stylesheet() . '/';
|
164 |
+
$get_template = 'themes/' . get_template() . '/';
|
165 |
+
|
166 |
+
$remove_styles = apply_filters( 'cartflows_remove_theme_styles', true );
|
167 |
+
|
168 |
+
if ( $remove_styles ) {
|
169 |
+
|
170 |
+
// loop over all of the registered scripts..
|
171 |
+
foreach ( $wp_styles->registered as $handle => $data ) {
|
172 |
+
|
173 |
+
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
|
174 |
+
|
175 |
+
// remove it.
|
176 |
+
wp_deregister_style( $handle );
|
177 |
+
wp_dequeue_style( $handle );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
$remove_scripts = apply_filters( 'cartflows_remove_theme_scripts', true );
|
183 |
+
|
184 |
+
if ( $remove_scripts ) {
|
185 |
+
|
186 |
+
// loop over all of the registered scripts.
|
187 |
+
foreach ( $wp_scripts->registered as $handle => $data ) {
|
188 |
+
|
189 |
+
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
|
190 |
+
|
191 |
+
// remove it.
|
192 |
+
wp_deregister_script( $handle );
|
193 |
+
wp_dequeue_script( $handle );
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Update main order data in transient.
|
202 |
+
*
|
203 |
+
* @param array $woo_styles new styles array.
|
204 |
+
* @since 1.0.0
|
205 |
+
* @return array.
|
206 |
+
*/
|
207 |
+
public function woo_default_css( $woo_styles ) {
|
208 |
+
|
209 |
+
$woo_styles = array(
|
210 |
+
'woocommerce-layout' => array(
|
211 |
+
'src' => plugins_url( 'assets/css/woocommerce-layout.css', WC_PLUGIN_FILE ),
|
212 |
+
'deps' => '',
|
213 |
+
'version' => WC_VERSION,
|
214 |
+
'media' => 'all',
|
215 |
+
'has_rtl' => true,
|
216 |
+
),
|
217 |
+
'woocommerce-smallscreen' => array(
|
218 |
+
'src' => plugins_url( 'assets/css/woocommerce-smallscreen.css', WC_PLUGIN_FILE ),
|
219 |
+
'deps' => 'woocommerce-layout',
|
220 |
+
'version' => WC_VERSION,
|
221 |
+
'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', '768px' ) . ')',
|
222 |
+
'has_rtl' => true,
|
223 |
+
),
|
224 |
+
'woocommerce-general' => array(
|
225 |
+
'src' => plugins_url( 'assets/css/woocommerce.css', WC_PLUGIN_FILE ),
|
226 |
+
'deps' => '',
|
227 |
+
'version' => WC_VERSION,
|
228 |
+
'media' => 'all',
|
229 |
+
'has_rtl' => true,
|
230 |
+
),
|
231 |
+
);
|
232 |
+
|
233 |
+
return $woo_styles;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Init Actions.
|
238 |
+
*
|
239 |
+
* @since 1.0.0
|
240 |
+
*/
|
241 |
+
public function init_actions() {
|
242 |
+
|
243 |
+
$this->set_flow_session();
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Set flow session.
|
248 |
+
*
|
249 |
+
* @since 1.0.0
|
250 |
+
*/
|
251 |
+
public function set_flow_session() {
|
252 |
+
|
253 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
254 |
+
global $wp;
|
255 |
+
add_action( 'wp_head', array( $this, 'noindex_flow' ) );
|
256 |
+
|
257 |
+
wcf()->utils->do_not_cache();
|
258 |
+
|
259 |
+
if ( _is_wcf_thankyou_type() ) {
|
260 |
+
/* Set key to support pixel */
|
261 |
+
if ( isset( $_GET['wcf-key'] ) ) { //phpcs:ignore
|
262 |
+
|
263 |
+
$wcf_key = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
|
264 |
+
|
265 |
+
$_GET['key'] = $wcf_key;
|
266 |
+
$_REQUEST['key'] = $wcf_key;
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( isset( $_GET['wcf-order'] ) ) { //phpcs:ignore
|
270 |
+
|
271 |
+
$wcf_order = intval( wp_unslash( $_GET['wcf-order'] ) ); //phpcs:ignore
|
272 |
+
|
273 |
+
$_GET['order'] = $wcf_order;
|
274 |
+
$_REQUEST['order'] = $wcf_order;
|
275 |
+
$_GET['order-received'] = $wcf_order;
|
276 |
+
$_REQUEST['order-received'] = $wcf_order;
|
277 |
+
|
278 |
+
$wp->set_query_var( 'order-received', $wcf_order );
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Add noindex, nofollow.
|
286 |
+
*
|
287 |
+
* @since 1.0.0
|
288 |
+
*/
|
289 |
+
public function noindex_flow() {
|
290 |
+
|
291 |
+
$common = Cartflows_Helper::get_common_settings();
|
292 |
+
|
293 |
+
if ( 'enable' === $common['disallow_indexing'] ) {
|
294 |
+
echo '<meta name="robots" content="noindex,nofollow">';
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* WP Actions.
|
300 |
+
*
|
301 |
+
* @since 1.0.0
|
302 |
+
*/
|
303 |
+
public function wp_actions() {
|
304 |
+
|
305 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
306 |
+
|
307 |
+
if ( ! wcf()->is_woo_active && wcf()->utils->check_is_woo_required_page() ) {
|
308 |
+
wp_die( ' This page requires WooCommerce plugin installed and activated!', 'WooCommerce Required' );
|
309 |
+
}
|
310 |
+
|
311 |
+
/* CSS Compatibility for All theme */
|
312 |
+
add_filter( 'woocommerce_enqueue_styles', array( $this, 'woo_default_css' ), 9999 );
|
313 |
+
|
314 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'remove_theme_styles' ), 9999 );
|
315 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'global_flow_scripts' ), 20 );
|
316 |
+
|
317 |
+
/* Load woo templates from plugin */
|
318 |
+
add_filter( 'woocommerce_locate_template', array( $this, 'override_woo_template' ), 20, 3 );
|
319 |
+
|
320 |
+
/* Add version class to body in frontend. */
|
321 |
+
add_filter( 'body_class', array( $this, 'add_cartflows_lite_version_to_body' ) );
|
322 |
+
|
323 |
+
/* Custom Script Option */
|
324 |
+
add_action( 'wp_head', array( $this, 'custom_script_option' ) );
|
325 |
+
|
326 |
+
/* Remove the action applied by the Flatsome theme */
|
327 |
+
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
328 |
+
$this->remove_flatsome_action();
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Function for facebook pixel.
|
335 |
+
*/
|
336 |
+
public function facebook_pixel_init() {
|
337 |
+
|
338 |
+
$facebook_settings = Cartflows_Helper::get_facebook_settings();
|
339 |
+
if ( 'enable' === $facebook_settings['facebook_pixel_tracking'] ) {
|
340 |
+
|
341 |
+
$facebook_id = $facebook_settings['facebook_pixel_id'];
|
342 |
+
echo '<!-- Facebook Pixel Script By CartFlows -->';
|
343 |
+
$fb_script = "<script type='text/javascript'>
|
344 |
+
!function(f,b,e,v,n,t,s)
|
345 |
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
346 |
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
347 |
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
348 |
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
349 |
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
350 |
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
351 |
+
'https://connect.facebook.net/en_US/fbevents.js');
|
352 |
+
</script>
|
353 |
+
<noscript><img height='1' width='1' style='display:none' src='https://www.facebook.com/tr?id=" . $facebook_id . "&ev=PageView&noscript=1'/></noscript>";
|
354 |
+
|
355 |
+
$fb_page_view = "<script type='text/javascript'>
|
356 |
+
fbq('init', $facebook_id);
|
357 |
+
fbq('track', 'PageView', {'plugin': 'CartFlows'});
|
358 |
+
</script>";
|
359 |
+
|
360 |
+
if ( 'enable' === $facebook_settings['facebook_pixel_tracking_for_site'] && ! wcf()->utils->is_step_post_type() ) {
|
361 |
+
echo $fb_script;
|
362 |
+
echo $fb_page_view;
|
363 |
+
} else {
|
364 |
+
echo $fb_script;
|
365 |
+
}
|
366 |
+
echo '<!-- End Facebook Pixel Script By CartFlows -->';
|
367 |
+
}
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Debug Data Setting Actions.
|
373 |
+
*
|
374 |
+
* @since 1.1.14
|
375 |
+
*/
|
376 |
+
public function debug_data_setting_actions() {
|
377 |
+
|
378 |
+
add_filter( 'cartflows_load_min_assets', array( $this, 'allow_load_minify' ) );
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Get/Set the allow minify option.
|
383 |
+
*
|
384 |
+
* @since 1.1.14
|
385 |
+
*/
|
386 |
+
public function allow_load_minify() {
|
387 |
+
$debug_data = Cartflows_Helper::get_debug_settings();
|
388 |
+
$allow_minified = $debug_data['allow_minified_files'];
|
389 |
+
$allow_minify = false;
|
390 |
+
|
391 |
+
if ( 'enable' === $allow_minified ) {
|
392 |
+
$allow_minify = true;
|
393 |
+
}
|
394 |
+
|
395 |
+
return $allow_minify;
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Global flow scripts.
|
400 |
+
*
|
401 |
+
* @since 1.0.0
|
402 |
+
*/
|
403 |
+
public function global_flow_scripts() {
|
404 |
+
|
405 |
+
global $post;
|
406 |
+
|
407 |
+
$flow = get_post_meta( $post->ID, 'wcf-flow-id', true );
|
408 |
+
$current_step = $post->ID;
|
409 |
+
$next_step_link = '';
|
410 |
+
$compatibility = Cartflows_Compatibility::get_instance();
|
411 |
+
|
412 |
+
if ( _is_wcf_landing_type() ) {
|
413 |
+
|
414 |
+
$next_step_id = wcf()->utils->get_next_step_id( $flow, $current_step );
|
415 |
+
$next_step_link = get_permalink( $next_step_id );
|
416 |
+
}
|
417 |
+
|
418 |
+
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
419 |
+
|
420 |
+
$fb_active = Cartflows_Helper::get_facebook_settings();
|
421 |
+
$wcf_ga_active = Cartflows_Helper::get_google_analytics_settings();
|
422 |
+
$params = array();
|
423 |
+
$ga_param = array();
|
424 |
+
|
425 |
+
if ( 'enable' === $fb_active['facebook_pixel_tracking'] && Cartflows_Loader::get_instance()->is_woo_active ) {
|
426 |
+
|
427 |
+
$params = Cartflows_Helper::prepare_cart_data_fb_response();
|
428 |
+
}
|
429 |
+
|
430 |
+
if ( 'enable' === $wcf_ga_active['enable_google_analytics'] ) {
|
431 |
+
$ga_param = Cartflows_Tracking::get_ga_items_list();
|
432 |
+
}
|
433 |
+
|
434 |
+
$localize = array(
|
435 |
+
'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
|
436 |
+
'is_pb_preview' => $compatibility->is_page_builder_preview(),
|
437 |
+
'current_theme' => $compatibility->get_current_theme(),
|
438 |
+
'current_flow' => $flow,
|
439 |
+
'current_step' => $current_step,
|
440 |
+
'next_step' => $next_step_link,
|
441 |
+
'page_template' => $page_template,
|
442 |
+
'is_checkout_page' => _is_wcf_checkout_type(),
|
443 |
+
'params' => $params,
|
444 |
+
'fb_active' => $fb_active,
|
445 |
+
'wcf_ga_active' => $wcf_ga_active,
|
446 |
+
'ga_param' => $ga_param,
|
447 |
+
);
|
448 |
+
|
449 |
+
wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
|
450 |
+
|
451 |
+
if ( 'default' !== $page_template ) {
|
452 |
+
|
453 |
+
wp_enqueue_style( 'wcf-normalize-frontend-global', wcf()->utils->get_css_url( 'cartflows-normalize' ), array(), CARTFLOWS_VER );
|
454 |
+
}
|
455 |
+
|
456 |
+
wp_enqueue_style( 'wcf-frontend-global', wcf()->utils->get_css_url( 'frontend' ), array(), CARTFLOWS_VER );
|
457 |
+
|
458 |
+
wp_enqueue_script(
|
459 |
+
'wcf-frontend-global',
|
460 |
+
wcf()->utils->get_js_url( 'frontend' ),
|
461 |
+
array( 'jquery', 'jquery-cookie' ),
|
462 |
+
CARTFLOWS_VER,
|
463 |
+
false
|
464 |
+
);
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Custom Script in head.
|
469 |
+
*
|
470 |
+
* @since 1.0.0
|
471 |
+
*/
|
472 |
+
public function custom_script_option() {
|
473 |
+
|
474 |
+
/* Add custom script to header in frontend. */
|
475 |
+
$script = $this->get_custom_script();
|
476 |
+
if ( '' !== $script ) {
|
477 |
+
if ( false === strpos( $script, '<script' ) ) {
|
478 |
+
$script = '<script>' . $script . '</script>';
|
479 |
+
}
|
480 |
+
echo '<!-- Custom CartFlows Script -->';
|
481 |
+
echo $script;
|
482 |
+
echo '<!-- End Custom CartFlows Script -->';
|
483 |
+
}
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Override woo templates.
|
488 |
+
*
|
489 |
+
* @param string $template new Template full path.
|
490 |
+
* @param string $template_name Template name.
|
491 |
+
* @param string $template_path Template Path.
|
492 |
+
* @since 1.1.5
|
493 |
+
* @return string.
|
494 |
+
*/
|
495 |
+
public function override_woo_template( $template, $template_name, $template_path ) {
|
496 |
+
|
497 |
+
global $woocommerce;
|
498 |
+
|
499 |
+
$_template = $template;
|
500 |
+
|
501 |
+
$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
|
502 |
+
|
503 |
+
if ( file_exists( $plugin_path . $template_name ) ) {
|
504 |
+
$template = $plugin_path . $template_name;
|
505 |
+
}
|
506 |
+
|
507 |
+
if ( ! $template ) {
|
508 |
+
$template = $_template;
|
509 |
+
}
|
510 |
+
|
511 |
+
return $template;
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Remove the action applied by the Flatsome theme.
|
516 |
+
*
|
517 |
+
* @since 1.1.5
|
518 |
+
* @return void.
|
519 |
+
*/
|
520 |
+
public function remove_flatsome_action() {
|
521 |
+
|
522 |
+
// Remove action where flatsome dequeued the woocommerce's default styles.
|
523 |
+
remove_action( 'wp_enqueue_scripts', 'flatsome_woocommerce_scripts_styles', 98 );
|
524 |
+
}
|
525 |
+
|
526 |
+
/**
|
527 |
+
* Add version class to body in frontend.
|
528 |
+
*
|
529 |
+
* @since 1.1.5
|
530 |
+
* @param array $classes classes.
|
531 |
+
* @return array $classes classes.
|
532 |
+
*/
|
533 |
+
public function add_cartflows_lite_version_to_body( $classes ) {
|
534 |
+
|
535 |
+
$classes[] = 'cartflows-' . CARTFLOWS_VER;
|
536 |
+
|
537 |
+
return $classes;
|
538 |
+
|
539 |
+
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* Get custom script data.
|
543 |
+
*
|
544 |
+
* @since 1.0.0
|
545 |
+
*/
|
546 |
+
public function get_custom_script() {
|
547 |
+
|
548 |
+
global $post;
|
549 |
+
|
550 |
+
$script = get_post_meta( $post->ID, 'wcf-custom-script', true );
|
551 |
+
|
552 |
+
return $script;
|
553 |
+
}
|
554 |
+
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Set appropriate filter sctions.
|
558 |
+
*
|
559 |
+
* @since 1.1.14
|
560 |
+
*/
|
561 |
+
public function setup_optin_checkout_filter() {
|
562 |
+
|
563 |
+
if ( _is_wcf_doing_optin_ajax() ) {
|
564 |
+
/* Modify the optin order received url to go next step */
|
565 |
+
remove_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
566 |
+
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_optin_to_next_step' ), 10, 2 );
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Redirect to thank page if upsell not exists
|
572 |
+
*
|
573 |
+
* @param string $order_recieve_url url.
|
574 |
+
* @param object $order order object.
|
575 |
+
* @since 1.0.0
|
576 |
+
*/
|
577 |
+
public function redirect_optin_to_next_step( $order_recieve_url, $order ) {
|
578 |
+
|
579 |
+
/* Only for optin page */
|
580 |
+
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
|
581 |
+
wcf()->logger->log( 'Only for optin page' );
|
582 |
+
|
583 |
+
if ( _is_wcf_doing_optin_ajax() ) {
|
584 |
+
|
585 |
+
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
586 |
+
|
587 |
+
if ( ! $optin_id ) {
|
588 |
+
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
|
589 |
+
}
|
590 |
+
} else {
|
591 |
+
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
|
592 |
+
}
|
593 |
+
|
594 |
+
wcf()->logger->log( 'Optin ID : ' . $optin_id );
|
595 |
+
|
596 |
+
if ( $optin_id ) {
|
597 |
+
|
598 |
+
$next_step_id = wcf()->flow->get_next_step_id( $order );
|
599 |
+
|
600 |
+
if ( $next_step_id ) {
|
601 |
+
|
602 |
+
$order_recieve_url = get_permalink( $next_step_id );
|
603 |
+
$query_param = array(
|
604 |
+
'wcf-key' => $order->get_order_key(),
|
605 |
+
'wcf-order' => $order->get_id(),
|
606 |
+
);
|
607 |
+
|
608 |
+
if ( 'yes' === wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-fields' ) ) {
|
609 |
+
|
610 |
+
$fields_string = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-specific-fields' );
|
611 |
+
|
612 |
+
$fields = array_map( 'trim', explode( ',', $fields_string ) );
|
613 |
+
|
614 |
+
if ( is_array( $fields ) ) {
|
615 |
+
|
616 |
+
$order_id = $order->get_id();
|
617 |
+
|
618 |
+
foreach ( $fields as $in => $key ) {
|
619 |
+
switch ( $key ) {
|
620 |
+
case 'first_name':
|
621 |
+
$query_param[ $key ] = $order->get_billing_first_name();
|
622 |
+
break;
|
623 |
+
case 'last_name':
|
624 |
+
$query_param[ $key ] = $order->get_billing_last_name();
|
625 |
+
break;
|
626 |
+
case 'email':
|
627 |
+
$query_param[ $key ] = $order->get_billing_email();
|
628 |
+
break;
|
629 |
+
default:
|
630 |
+
$query_param[ $key ] = get_post_meta( $order_id, '_billing_' . $key, true );
|
631 |
+
break;
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}
|
635 |
+
}
|
636 |
+
|
637 |
+
$order_recieve_url = add_query_arg(
|
638 |
+
$query_param,
|
639 |
+
$order_recieve_url
|
640 |
+
);
|
641 |
+
}
|
642 |
+
}
|
643 |
+
|
644 |
+
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
|
645 |
+
|
646 |
+
return $order_recieve_url;
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* Prepare if class 'Cartflows_Frontend' exist.
|
652 |
+
* Kicking this off by calling 'get_instance()' method
|
653 |
+
*/
|
654 |
+
Cartflows_Frontend::get_instance();
|
classes/class-cartflows-helper.php
CHANGED
@@ -1,777 +1,777 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CARTFLOWS Helper.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit; // Exit if accessed directly.
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class Cartflows_Helper.
|
14 |
-
*/
|
15 |
-
class Cartflows_Helper {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Common global data
|
19 |
-
*
|
20 |
-
* @var zapier
|
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 |
-
/**
|
33 |
-
* Permalink settings
|
34 |
-
*
|
35 |
-
* @var permalink_setting
|
36 |
-
*/
|
37 |
-
private static $permalink_setting = null;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Google Analytics Settings
|
41 |
-
*
|
42 |
-
* @var permalink_setting
|
43 |
-
*/
|
44 |
-
private static $google_analytics_settings = null;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Installed Plugins
|
48 |
-
*
|
49 |
-
* @since 1.1.4
|
50 |
-
*
|
51 |
-
* @access private
|
52 |
-
* @var array Installed plugins list.
|
53 |
-
*/
|
54 |
-
private static $installed_plugins = null;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Checkout Fields
|
58 |
-
*
|
59 |
-
* @var checkout_fields
|
60 |
-
*/
|
61 |
-
private static $checkout_fields = null;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Facebook pixel global data
|
65 |
-
*
|
66 |
-
* @var faceboook
|
67 |
-
*/
|
68 |
-
private static $facebook = null;
|
69 |
-
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Returns an option from the database for
|
73 |
-
* the admin settings page.
|
74 |
-
*
|
75 |
-
* @param string $key The option key.
|
76 |
-
* @param mixed $default Option default value if option is not available.
|
77 |
-
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
78 |
-
* @return string Return the option value
|
79 |
-
*/
|
80 |
-
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
81 |
-
|
82 |
-
// Get the site-wide option if we're in the network admin.
|
83 |
-
if ( $network_override && is_multisite() ) {
|
84 |
-
$value = get_site_option( $key, $default );
|
85 |
-
} else {
|
86 |
-
$value = get_option( $key, $default );
|
87 |
-
}
|
88 |
-
|
89 |
-
return $value;
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Updates an option from the admin settings page.
|
94 |
-
*
|
95 |
-
* @param string $key The option key.
|
96 |
-
* @param mixed $value The value to update.
|
97 |
-
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
98 |
-
* @return mixed
|
99 |
-
*/
|
100 |
-
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
101 |
-
|
102 |
-
// Update the site-wide option since we're in the network admin.
|
103 |
-
if ( $network && is_multisite() ) {
|
104 |
-
update_site_option( $key, $value );
|
105 |
-
} else {
|
106 |
-
update_option( $key, $value );
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Get single setting
|
113 |
-
*
|
114 |
-
* @since 1.1.4
|
115 |
-
*
|
116 |
-
* @param string $key Option key.
|
117 |
-
* @param string $default Option default value if not exist.
|
118 |
-
* @return mixed
|
119 |
-
*/
|
120 |
-
public static function get_common_setting( $key = '', $default = '' ) {
|
121 |
-
$settings = self::get_common_settings();
|
122 |
-
|
123 |
-
if ( $settings && array_key_exists( $key, $settings ) ) {
|
124 |
-
return $settings[ $key ];
|
125 |
-
}
|
126 |
-
|
127 |
-
return $default;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Get single debug options
|
132 |
-
*
|
133 |
-
* @since 1.1.4
|
134 |
-
*
|
135 |
-
* @param string $key Option key.
|
136 |
-
* @param string $default Option default value if not exist.
|
137 |
-
* @return mixed
|
138 |
-
*/
|
139 |
-
public static function get_debug_setting( $key = '', $default = '' ) {
|
140 |
-
$debug_data = self::get_debug_settings();
|
141 |
-
|
142 |
-
if ( $debug_data && array_key_exists( $key, $debug_data ) ) {
|
143 |
-
return $debug_data[ $key ];
|
144 |
-
}
|
145 |
-
|
146 |
-
return $default;
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Get required plugins for page builder
|
151 |
-
*
|
152 |
-
* @since 1.1.4
|
153 |
-
*
|
154 |
-
* @param string $page_builder_slug Page builder slug.
|
155 |
-
* @param string $default Default page builder.
|
156 |
-
* @return array selected page builder required plugins list.
|
157 |
-
*/
|
158 |
-
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
159 |
-
$plugins = self::get_plugins_groupby_page_builders();
|
160 |
-
|
161 |
-
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
162 |
-
return $plugins[ $page_builder_slug ];
|
163 |
-
}
|
164 |
-
|
165 |
-
return $plugins[ $default ];
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Get Plugins list by page builder.
|
170 |
-
*
|
171 |
-
* @since 1.1.4
|
172 |
-
*
|
173 |
-
* @return array Required Plugins list.
|
174 |
-
*/
|
175 |
-
public static function get_plugins_groupby_page_builders() {
|
176 |
-
|
177 |
-
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
178 |
-
$theme_status = 'not-installed';
|
179 |
-
if ( $divi_status ) {
|
180 |
-
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
181 |
-
$theme_status = 'installed';
|
182 |
-
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
183 |
-
$theme_status = 'deactivate';
|
184 |
-
$divi_status = 'activate';
|
185 |
-
} else {
|
186 |
-
$divi_status = '';
|
187 |
-
}
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
$plugins = array(
|
192 |
-
'elementor' => array(
|
193 |
-
'title' => 'Elementor',
|
194 |
-
'plugins' => array(
|
195 |
-
array(
|
196 |
-
'slug' => 'elementor', // For download from wp.org.
|
197 |
-
'init' => 'elementor/elementor.php',
|
198 |
-
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
199 |
-
),
|
200 |
-
),
|
201 |
-
),
|
202 |
-
'divi' => array(
|
203 |
-
'title' => 'Divi',
|
204 |
-
'theme-status' => $theme_status,
|
205 |
-
'plugin-status' => $divi_status,
|
206 |
-
'plugins' => array(
|
207 |
-
array(
|
208 |
-
'slug' => 'divi-builder', // For download from wp.org.
|
209 |
-
'init' => 'divi-builder/divi-builder.php',
|
210 |
-
'status' => $divi_status,
|
211 |
-
),
|
212 |
-
),
|
213 |
-
),
|
214 |
-
);
|
215 |
-
|
216 |
-
$plugins['beaver-builder'] = array(
|
217 |
-
'title' => 'Beaver Builder',
|
218 |
-
'plugins' => array(),
|
219 |
-
);
|
220 |
-
|
221 |
-
// Check Pro Exist.
|
222 |
-
if ( file_exists( WP_PLUGIN_DIR . '/bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
223 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
224 |
-
'slug' => 'bb-plugin',
|
225 |
-
'init' => 'bb-plugin/fl-builder.php',
|
226 |
-
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
227 |
-
);
|
228 |
-
} else {
|
229 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
230 |
-
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
231 |
-
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
232 |
-
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
233 |
-
);
|
234 |
-
}
|
235 |
-
|
236 |
-
if ( file_exists( WP_PLUGIN_DIR . '/bb-ultimate-addon/bb-ultimate-addon.php' ) && ! is_plugin_active( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ) ) {
|
237 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
238 |
-
'slug' => 'bb-ultimate-addon',
|
239 |
-
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
240 |
-
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
241 |
-
);
|
242 |
-
} else {
|
243 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
244 |
-
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
245 |
-
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
246 |
-
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
247 |
-
);
|
248 |
-
}
|
249 |
-
|
250 |
-
return $plugins;
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Get plugin status
|
255 |
-
*
|
256 |
-
* @since 1.1.4
|
257 |
-
*
|
258 |
-
* @param string $plugin_init_file Plguin init file.
|
259 |
-
* @return mixed
|
260 |
-
*/
|
261 |
-
public static function get_plugin_status( $plugin_init_file ) {
|
262 |
-
|
263 |
-
if ( null == self::$installed_plugins ) {
|
264 |
-
self::$installed_plugins = get_plugins();
|
265 |
-
}
|
266 |
-
|
267 |
-
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
268 |
-
return 'install';
|
269 |
-
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
270 |
-
return 'activate';
|
271 |
-
} else {
|
272 |
-
return;
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Get zapier settings.
|
278 |
-
*
|
279 |
-
* @return array.
|
280 |
-
*/
|
281 |
-
public static function get_common_settings() {
|
282 |
-
|
283 |
-
if ( null === self::$common ) {
|
284 |
-
|
285 |
-
$common_default = apply_filters(
|
286 |
-
'cartflows_common_settings_default',
|
287 |
-
array(
|
288 |
-
'disallow_indexing' => 'disable',
|
289 |
-
'global_checkout' => '',
|
290 |
-
'default_page_builder' => 'elementor',
|
291 |
-
)
|
292 |
-
);
|
293 |
-
|
294 |
-
$common = self::get_admin_settings_option( '_cartflows_common', false, false );
|
295 |
-
|
296 |
-
$common = wp_parse_args( $common, $common_default );
|
297 |
-
|
298 |
-
if ( ! did_action( 'wp' ) ) {
|
299 |
-
return $common;
|
300 |
-
} else {
|
301 |
-
self::$common = $common;
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
return self::$common;
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Get debug settings data.
|
310 |
-
*
|
311 |
-
* @return array.
|
312 |
-
*/
|
313 |
-
public static function get_debug_settings() {
|
314 |
-
|
315 |
-
if ( null === self::$debug_data ) {
|
316 |
-
|
317 |
-
$debug_data_default = apply_filters(
|
318 |
-
'cartflows_debug_settings_default',
|
319 |
-
array(
|
320 |
-
'allow_minified_files' => 'disable',
|
321 |
-
)
|
322 |
-
);
|
323 |
-
|
324 |
-
$debug_data = self::get_admin_settings_option( '_cartflows_debug_data', false, false );
|
325 |
-
|
326 |
-
$debug_data = wp_parse_args( $debug_data, $debug_data_default );
|
327 |
-
|
328 |
-
if ( ! did_action( 'wp' ) ) {
|
329 |
-
return $debug_data;
|
330 |
-
} else {
|
331 |
-
self::$debug_data = $debug_data;
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
return self::$debug_data;
|
336 |
-
}
|
337 |
-
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Get debug settings data.
|
341 |
-
*
|
342 |
-
* @return array.
|
343 |
-
*/
|
344 |
-
public static function get_permalink_settings() {
|
345 |
-
|
346 |
-
if ( null === self::$permalink_setting ) {
|
347 |
-
|
348 |
-
$permalink_default = apply_filters(
|
349 |
-
'cartflows_permalink_settings_default',
|
350 |
-
array(
|
351 |
-
'permalink' => CARTFLOWS_STEP_POST_TYPE,
|
352 |
-
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
|
353 |
-
'permalink_structure' => '',
|
354 |
-
|
355 |
-
)
|
356 |
-
);
|
357 |
-
|
358 |
-
$permalink_data = self::get_admin_settings_option( '_cartflows_permalink', false, false );
|
359 |
-
|
360 |
-
$permalink_data = wp_parse_args( $permalink_data, $permalink_default );
|
361 |
-
|
362 |
-
if ( ! did_action( 'wp' ) ) {
|
363 |
-
return $permalink_data;
|
364 |
-
} else {
|
365 |
-
self::$permalink_setting = $permalink_data;
|
366 |
-
}
|
367 |
-
}
|
368 |
-
|
369 |
-
return self::$permalink_setting;
|
370 |
-
}
|
371 |
-
|
372 |
-
|
373 |
-
/**
|
374 |
-
* Get debug settings data.
|
375 |
-
*
|
376 |
-
* @return array.
|
377 |
-
*/
|
378 |
-
public static function get_google_analytics_settings() {
|
379 |
-
|
380 |
-
if ( null === self::$google_analytics_settings ) {
|
381 |
-
|
382 |
-
$google_analytics_settings_default = apply_filters(
|
383 |
-
'cartflows_google_analytics_settings_default',
|
384 |
-
array(
|
385 |
-
'enable_google_analytics' => 'disable',
|
386 |
-
'enable_google_analytics_for_site' => 'disable',
|
387 |
-
'google_analytics_id' => '',
|
388 |
-
'enable_begin_checkout' => 'disable',
|
389 |
-
'enable_add_to_cart' => 'disable',
|
390 |
-
'enable_add_payment_info' => 'disable',
|
391 |
-
'enable_purchase_event' => 'disable',
|
392 |
-
)
|
393 |
-
);
|
394 |
-
|
395 |
-
$google_analytics_settings_data = self::get_admin_settings_option( '_cartflows_google_analytics', false, true );
|
396 |
-
|
397 |
-
$google_analytics_settings_data = wp_parse_args( $google_analytics_settings_data, $google_analytics_settings_default );
|
398 |
-
|
399 |
-
if ( ! did_action( 'wp' ) ) {
|
400 |
-
return $google_analytics_settings_data;
|
401 |
-
} else {
|
402 |
-
self::$google_analytics_settings = $google_analytics_settings_data;
|
403 |
-
}
|
404 |
-
}
|
405 |
-
|
406 |
-
return self::$google_analytics_settings = $google_analytics_settings_data; //phpcs:ignore
|
407 |
-
}
|
408 |
-
|
409 |
-
/**
|
410 |
-
* Get Checkout field.
|
411 |
-
*
|
412 |
-
* @param string $key Field key.
|
413 |
-
* @param int $post_id Post id.
|
414 |
-
* @return array.
|
415 |
-
*/
|
416 |
-
public static function get_checkout_fields( $key, $post_id ) {
|
417 |
-
|
418 |
-
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
419 |
-
|
420 |
-
if ( ! $saved_fields ) {
|
421 |
-
$saved_fields = array();
|
422 |
-
}
|
423 |
-
|
424 |
-
$fields = array_filter( $saved_fields );
|
425 |
-
|
426 |
-
if ( empty( $fields ) ) {
|
427 |
-
if ( 'billing' === $key || 'shipping' === $key ) {
|
428 |
-
|
429 |
-
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
430 |
-
|
431 |
-
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
432 |
-
}
|
433 |
-
}
|
434 |
-
|
435 |
-
return $fields;
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Add Checkout field.
|
440 |
-
*
|
441 |
-
* @param string $type Field type.
|
442 |
-
* @param string $field_key Field key.
|
443 |
-
* @param array $field_data Field data.
|
444 |
-
* @param int $post_id Post id.
|
445 |
-
* @return boolean.
|
446 |
-
*/
|
447 |
-
public static function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
448 |
-
|
449 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
450 |
-
|
451 |
-
$fields[ $field_key ] = $field_data;
|
452 |
-
|
453 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
454 |
-
|
455 |
-
return true;
|
456 |
-
}
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Get checkout fields settings.
|
460 |
-
*
|
461 |
-
* @param string $type Field type.
|
462 |
-
* @param string $field_key Field key.
|
463 |
-
* @param int $post_id Post id.
|
464 |
-
* @return array.
|
465 |
-
*/
|
466 |
-
public static function delete_checkout_field( $type, $field_key, $post_id ) {
|
467 |
-
|
468 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
469 |
-
|
470 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
471 |
-
unset( $fields[ $field_key ] );
|
472 |
-
}
|
473 |
-
|
474 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
475 |
-
|
476 |
-
return true;
|
477 |
-
}
|
478 |
-
|
479 |
-
/**
|
480 |
-
* Get checkout fields settings.
|
481 |
-
*
|
482 |
-
* @return array.
|
483 |
-
*/
|
484 |
-
public static function get_checkout_fields_settings() {
|
485 |
-
|
486 |
-
if ( null === self::$checkout_fields ) {
|
487 |
-
$checkout_fields_default = array(
|
488 |
-
'enable_customization' => 'disable',
|
489 |
-
'enable_billing_fields' => 'disable',
|
490 |
-
);
|
491 |
-
|
492 |
-
$billing_fields = self::get_checkout_fields( 'billing' );
|
493 |
-
|
494 |
-
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
495 |
-
|
496 |
-
foreach ( $billing_fields as $key => $value ) {
|
497 |
-
|
498 |
-
$checkout_fields_default[ $key ] = 'enable';
|
499 |
-
}
|
500 |
-
}
|
501 |
-
|
502 |
-
$checkout_fields = self::get_admin_settings_option( '_wcf_checkout_fields', false, false );
|
503 |
-
|
504 |
-
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
505 |
-
}
|
506 |
-
|
507 |
-
return self::$checkout_fields;
|
508 |
-
}
|
509 |
-
|
510 |
-
/**
|
511 |
-
* Get meta options
|
512 |
-
*
|
513 |
-
* @since 1.0.0
|
514 |
-
* @param int $post_id Product ID.
|
515 |
-
* @param string $key Meta Key.
|
516 |
-
* @param string $default Default value.
|
517 |
-
* @return string Meta Value.
|
518 |
-
*/
|
519 |
-
public static function get_meta_option( $post_id, $key, $default = '' ) {
|
520 |
-
|
521 |
-
$value = get_post_meta( $post_id, $key, true );
|
522 |
-
|
523 |
-
if ( ! $value ) {
|
524 |
-
$value = $default;
|
525 |
-
}
|
526 |
-
|
527 |
-
return $value;
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Save meta option
|
532 |
-
*
|
533 |
-
* @since 1.0.0
|
534 |
-
* @param int $post_id Product ID.
|
535 |
-
* @param array $args Arguments array.
|
536 |
-
*/
|
537 |
-
public static function save_meta_option( $post_id, $args = array() ) {
|
538 |
-
|
539 |
-
if ( is_array( $args ) && ! empty( $args ) ) {
|
540 |
-
|
541 |
-
foreach ( $args as $key => $value ) {
|
542 |
-
|
543 |
-
update_post_meta( $post_id, $key, $value );
|
544 |
-
}
|
545 |
-
}
|
546 |
-
}
|
547 |
-
|
548 |
-
/**
|
549 |
-
* Check if Elementor page builder is installed
|
550 |
-
*
|
551 |
-
* @since 1.0.0
|
552 |
-
*
|
553 |
-
* @access public
|
554 |
-
*/
|
555 |
-
public static function is_elementor_installed() {
|
556 |
-
$path = 'elementor/elementor.php';
|
557 |
-
$plugins = get_plugins();
|
558 |
-
|
559 |
-
return isset( $plugins[ $path ] );
|
560 |
-
}
|
561 |
-
|
562 |
-
/**
|
563 |
-
* Check if Step has product assigned.
|
564 |
-
*
|
565 |
-
* @since 1.0.0
|
566 |
-
* @param int $step_id step ID.
|
567 |
-
*
|
568 |
-
* @access public
|
569 |
-
*/
|
570 |
-
public static function has_product_assigned( $step_id ) {
|
571 |
-
|
572 |
-
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
573 |
-
|
574 |
-
if ( 'checkout' == $step_type ) {
|
575 |
-
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
576 |
-
} else {
|
577 |
-
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
578 |
-
}
|
579 |
-
|
580 |
-
if ( ! empty( $product ) ) {
|
581 |
-
return true;
|
582 |
-
}
|
583 |
-
return false;
|
584 |
-
|
585 |
-
}
|
586 |
-
|
587 |
-
/**
|
588 |
-
* Get attributes for cartflows wrap.
|
589 |
-
*
|
590 |
-
* @since 1.1.4
|
591 |
-
*
|
592 |
-
* @access public
|
593 |
-
*/
|
594 |
-
public static function get_cartflows_container_atts() {
|
595 |
-
|
596 |
-
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
597 |
-
$atts_string = '';
|
598 |
-
|
599 |
-
foreach ( $attributes as $key => $value ) {
|
600 |
-
|
601 |
-
if ( ! $value ) {
|
602 |
-
continue;
|
603 |
-
}
|
604 |
-
|
605 |
-
if ( true === $value ) {
|
606 |
-
$atts_string .= esc_html( $key ) . ' ';
|
607 |
-
} else {
|
608 |
-
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
609 |
-
}
|
610 |
-
}
|
611 |
-
|
612 |
-
return $atts_string;
|
613 |
-
}
|
614 |
-
|
615 |
-
/**
|
616 |
-
* Get facebook pixel settings.
|
617 |
-
*
|
618 |
-
* @return facebook array.
|
619 |
-
*/
|
620 |
-
public static function get_facebook_settings() {
|
621 |
-
|
622 |
-
if ( null === self::$facebook ) {
|
623 |
-
|
624 |
-
$facebook_default = array(
|
625 |
-
'facebook_pixel_id' => '',
|
626 |
-
'facebook_pixel_add_to_cart' => 'enable',
|
627 |
-
'facebook_pixel_initiate_checkout' => 'enable',
|
628 |
-
'facebook_pixel_add_payment_info' => 'enable',
|
629 |
-
'facebook_pixel_purchase_complete' => 'enable',
|
630 |
-
'facebook_pixel_tracking' => 'disable',
|
631 |
-
'facebook_pixel_tracking_for_site' => 'disable',
|
632 |
-
);
|
633 |
-
|
634 |
-
$facebook = self::get_admin_settings_option( '_cartflows_facebook', false, false );
|
635 |
-
|
636 |
-
$facebook = wp_parse_args( $facebook, $facebook_default );
|
637 |
-
|
638 |
-
self::$facebook = apply_filters( 'cartflows_facebook_settings_default', $facebook );
|
639 |
-
|
640 |
-
}
|
641 |
-
|
642 |
-
return self::$facebook;
|
643 |
-
}
|
644 |
-
|
645 |
-
|
646 |
-
/**
|
647 |
-
* Prepare response data for facebook.
|
648 |
-
*
|
649 |
-
* @param int $order_id order_id.
|
650 |
-
* @param array $offer_data offer data.
|
651 |
-
*/
|
652 |
-
public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) {
|
653 |
-
|
654 |
-
// Stop Execution if WooCommerce is not installed & don't set the cookie.
|
655 |
-
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
656 |
-
return;
|
657 |
-
}
|
658 |
-
|
659 |
-
$fb_settings = self::get_facebook_settings();
|
660 |
-
if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) {
|
661 |
-
setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/' );
|
662 |
-
}
|
663 |
-
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* Prepare purchase response for facebook purcase event.
|
668 |
-
*
|
669 |
-
* @param integer $order_id order id.
|
670 |
-
* @param array $offer_data offer data.
|
671 |
-
* @return mixed
|
672 |
-
*/
|
673 |
-
public static function prepare_purchase_data_fb_response( $order_id, $offer_data = array() ) {
|
674 |
-
|
675 |
-
$thankyou = array();
|
676 |
-
|
677 |
-
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
678 |
-
return $thankyou;
|
679 |
-
}
|
680 |
-
|
681 |
-
$thankyou['order_id'] = $order_id;
|
682 |
-
$thankyou['content_type'] = 'product';
|
683 |
-
$thankyou['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' );
|
684 |
-
$thankyou['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' );
|
685 |
-
$thankyou['plugin'] = 'CartFlows';
|
686 |
-
$order = wc_get_order( $order_id );
|
687 |
-
if ( empty( $offer_data ) ) {
|
688 |
-
// Iterating through each WC_Order_Item_Product objects.
|
689 |
-
foreach ( $order->get_items() as $item_key => $item ) {
|
690 |
-
$product = $item->get_product(); // Get the WC_Product object.
|
691 |
-
$thankyou['content_ids'][] = (string) $product->get_id();
|
692 |
-
}
|
693 |
-
$thankyou['value'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_total' );
|
694 |
-
} else {
|
695 |
-
$thankyou['content_ids'][] = (string) $offer_data['id'];
|
696 |
-
$thankyou['value'] = $offer_data['total'];
|
697 |
-
}
|
698 |
-
|
699 |
-
return $thankyou;
|
700 |
-
}
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Prepare cart data for fb response.
|
704 |
-
*
|
705 |
-
* @return array
|
706 |
-
*/
|
707 |
-
public static function prepare_cart_data_fb_response() {
|
708 |
-
|
709 |
-
$params = array();
|
710 |
-
|
711 |
-
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
712 |
-
return $params;
|
713 |
-
}
|
714 |
-
|
715 |
-
$cart_total = WC()->cart->get_cart_contents_total();
|
716 |
-
$cart_items_count = WC()->cart->get_cart_contents_count();
|
717 |
-
$items = WC()->cart->get_cart();
|
718 |
-
$product_names = '';
|
719 |
-
$category_names = '';
|
720 |
-
$cart_contents = array();
|
721 |
-
foreach ( $items as $item => $value ) {
|
722 |
-
|
723 |
-
$_product = wc_get_product( $value['product_id'] );
|
724 |
-
$params['content_ids'][] = (string) $_product->get_id();
|
725 |
-
$product_names = $product_names . ', ' . $_product->get_title();
|
726 |
-
$category_names = $category_names . ', ' . wp_strip_all_tags( wc_get_product_category_list( $_product->get_id() ) );
|
727 |
-
array_push(
|
728 |
-
$cart_contents,
|
729 |
-
array(
|
730 |
-
'id' => $_product->get_id(),
|
731 |
-
'name' => $_product->get_title(),
|
732 |
-
'quantity' => $value['quantity'],
|
733 |
-
'item_price' => $_product->get_price(),
|
734 |
-
)
|
735 |
-
);
|
736 |
-
}
|
737 |
-
|
738 |
-
$user = wp_get_current_user();
|
739 |
-
$roles = implode( ', ', $user->roles );
|
740 |
-
$params['content_name'] = substr( $product_names, 2 );
|
741 |
-
$params['categoey_name'] = substr( $category_names, 2 );
|
742 |
-
$params['user_roles'] = $roles;
|
743 |
-
$params['plugin'] = 'CartFlows';
|
744 |
-
$params['contents'] = wp_json_encode( $cart_contents );
|
745 |
-
$params['content_type'] = 'product';
|
746 |
-
$params['value'] = $cart_total;
|
747 |
-
$params['num_items'] = $cart_items_count;
|
748 |
-
$params['currency'] = get_woocommerce_currency();
|
749 |
-
$params['language'] = get_bloginfo( 'language' );
|
750 |
-
$params['userAgent'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); //phpcs:ignore
|
751 |
-
$params['product_catalog_id'] = '';
|
752 |
-
$params['domain'] = get_site_url();
|
753 |
-
return $params;
|
754 |
-
}
|
755 |
-
|
756 |
-
/**
|
757 |
-
* Get the image url of size.
|
758 |
-
*
|
759 |
-
* @param int $post_id post id.
|
760 |
-
* @param array $key key.
|
761 |
-
* @param string $size image size.
|
762 |
-
*
|
763 |
-
* @return array
|
764 |
-
*/
|
765 |
-
public static function get_image_url( $post_id, $key, $size = false ) {
|
766 |
-
|
767 |
-
$url = get_post_meta( $post_id, $key, true );
|
768 |
-
$img_obj = get_post_meta( $post_id, $key . '-obj', true );
|
769 |
-
if ( is_array( $img_obj ) && ! empty( $img_obj ) && false !== $size ) {
|
770 |
-
|
771 |
-
$url = ! empty( $img_obj['url'][ $size ] ) ? $img_obj['url'][ $size ] : $url;
|
772 |
-
}
|
773 |
-
|
774 |
-
return $url;
|
775 |
-
}
|
776 |
-
|
777 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CARTFLOWS Helper.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly.
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class Cartflows_Helper.
|
14 |
+
*/
|
15 |
+
class Cartflows_Helper {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Common global data
|
19 |
+
*
|
20 |
+
* @var zapier
|
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 |
+
/**
|
33 |
+
* Permalink settings
|
34 |
+
*
|
35 |
+
* @var permalink_setting
|
36 |
+
*/
|
37 |
+
private static $permalink_setting = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Google Analytics Settings
|
41 |
+
*
|
42 |
+
* @var permalink_setting
|
43 |
+
*/
|
44 |
+
private static $google_analytics_settings = null;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Installed Plugins
|
48 |
+
*
|
49 |
+
* @since 1.1.4
|
50 |
+
*
|
51 |
+
* @access private
|
52 |
+
* @var array Installed plugins list.
|
53 |
+
*/
|
54 |
+
private static $installed_plugins = null;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Checkout Fields
|
58 |
+
*
|
59 |
+
* @var checkout_fields
|
60 |
+
*/
|
61 |
+
private static $checkout_fields = null;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Facebook pixel global data
|
65 |
+
*
|
66 |
+
* @var faceboook
|
67 |
+
*/
|
68 |
+
private static $facebook = null;
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Returns an option from the database for
|
73 |
+
* the admin settings page.
|
74 |
+
*
|
75 |
+
* @param string $key The option key.
|
76 |
+
* @param mixed $default Option default value if option is not available.
|
77 |
+
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
78 |
+
* @return string Return the option value
|
79 |
+
*/
|
80 |
+
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
81 |
+
|
82 |
+
// Get the site-wide option if we're in the network admin.
|
83 |
+
if ( $network_override && is_multisite() ) {
|
84 |
+
$value = get_site_option( $key, $default );
|
85 |
+
} else {
|
86 |
+
$value = get_option( $key, $default );
|
87 |
+
}
|
88 |
+
|
89 |
+
return $value;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Updates an option from the admin settings page.
|
94 |
+
*
|
95 |
+
* @param string $key The option key.
|
96 |
+
* @param mixed $value The value to update.
|
97 |
+
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
98 |
+
* @return mixed
|
99 |
+
*/
|
100 |
+
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
101 |
+
|
102 |
+
// Update the site-wide option since we're in the network admin.
|
103 |
+
if ( $network && is_multisite() ) {
|
104 |
+
update_site_option( $key, $value );
|
105 |
+
} else {
|
106 |
+
update_option( $key, $value );
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get single setting
|
113 |
+
*
|
114 |
+
* @since 1.1.4
|
115 |
+
*
|
116 |
+
* @param string $key Option key.
|
117 |
+
* @param string $default Option default value if not exist.
|
118 |
+
* @return mixed
|
119 |
+
*/
|
120 |
+
public static function get_common_setting( $key = '', $default = '' ) {
|
121 |
+
$settings = self::get_common_settings();
|
122 |
+
|
123 |
+
if ( $settings && array_key_exists( $key, $settings ) ) {
|
124 |
+
return $settings[ $key ];
|
125 |
+
}
|
126 |
+
|
127 |
+
return $default;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Get single debug options
|
132 |
+
*
|
133 |
+
* @since 1.1.4
|
134 |
+
*
|
135 |
+
* @param string $key Option key.
|
136 |
+
* @param string $default Option default value if not exist.
|
137 |
+
* @return mixed
|
138 |
+
*/
|
139 |
+
public static function get_debug_setting( $key = '', $default = '' ) {
|
140 |
+
$debug_data = self::get_debug_settings();
|
141 |
+
|
142 |
+
if ( $debug_data && array_key_exists( $key, $debug_data ) ) {
|
143 |
+
return $debug_data[ $key ];
|
144 |
+
}
|
145 |
+
|
146 |
+
return $default;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Get required plugins for page builder
|
151 |
+
*
|
152 |
+
* @since 1.1.4
|
153 |
+
*
|
154 |
+
* @param string $page_builder_slug Page builder slug.
|
155 |
+
* @param string $default Default page builder.
|
156 |
+
* @return array selected page builder required plugins list.
|
157 |
+
*/
|
158 |
+
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
159 |
+
$plugins = self::get_plugins_groupby_page_builders();
|
160 |
+
|
161 |
+
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
162 |
+
return $plugins[ $page_builder_slug ];
|
163 |
+
}
|
164 |
+
|
165 |
+
return $plugins[ $default ];
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Get Plugins list by page builder.
|
170 |
+
*
|
171 |
+
* @since 1.1.4
|
172 |
+
*
|
173 |
+
* @return array Required Plugins list.
|
174 |
+
*/
|
175 |
+
public static function get_plugins_groupby_page_builders() {
|
176 |
+
|
177 |
+
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
178 |
+
$theme_status = 'not-installed';
|
179 |
+
if ( $divi_status ) {
|
180 |
+
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
181 |
+
$theme_status = 'installed';
|
182 |
+
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
183 |
+
$theme_status = 'deactivate';
|
184 |
+
$divi_status = 'activate';
|
185 |
+
} else {
|
186 |
+
$divi_status = '';
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$plugins = array(
|
192 |
+
'elementor' => array(
|
193 |
+
'title' => 'Elementor',
|
194 |
+
'plugins' => array(
|
195 |
+
array(
|
196 |
+
'slug' => 'elementor', // For download from wp.org.
|
197 |
+
'init' => 'elementor/elementor.php',
|
198 |
+
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
199 |
+
),
|
200 |
+
),
|
201 |
+
),
|
202 |
+
'divi' => array(
|
203 |
+
'title' => 'Divi',
|
204 |
+
'theme-status' => $theme_status,
|
205 |
+
'plugin-status' => $divi_status,
|
206 |
+
'plugins' => array(
|
207 |
+
array(
|
208 |
+
'slug' => 'divi-builder', // For download from wp.org.
|
209 |
+
'init' => 'divi-builder/divi-builder.php',
|
210 |
+
'status' => $divi_status,
|
211 |
+
),
|
212 |
+
),
|
213 |
+
),
|
214 |
+
);
|
215 |
+
|
216 |
+
$plugins['beaver-builder'] = array(
|
217 |
+
'title' => 'Beaver Builder',
|
218 |
+
'plugins' => array(),
|
219 |
+
);
|
220 |
+
|
221 |
+
// Check Pro Exist.
|
222 |
+
if ( file_exists( WP_PLUGIN_DIR . '/bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
223 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
224 |
+
'slug' => 'bb-plugin',
|
225 |
+
'init' => 'bb-plugin/fl-builder.php',
|
226 |
+
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
227 |
+
);
|
228 |
+
} else {
|
229 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
230 |
+
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
231 |
+
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
232 |
+
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
233 |
+
);
|
234 |
+
}
|
235 |
+
|
236 |
+
if ( file_exists( WP_PLUGIN_DIR . '/bb-ultimate-addon/bb-ultimate-addon.php' ) && ! is_plugin_active( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ) ) {
|
237 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
238 |
+
'slug' => 'bb-ultimate-addon',
|
239 |
+
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
240 |
+
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
241 |
+
);
|
242 |
+
} else {
|
243 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
244 |
+
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
245 |
+
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
246 |
+
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
247 |
+
);
|
248 |
+
}
|
249 |
+
|
250 |
+
return $plugins;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Get plugin status
|
255 |
+
*
|
256 |
+
* @since 1.1.4
|
257 |
+
*
|
258 |
+
* @param string $plugin_init_file Plguin init file.
|
259 |
+
* @return mixed
|
260 |
+
*/
|
261 |
+
public static function get_plugin_status( $plugin_init_file ) {
|
262 |
+
|
263 |
+
if ( null == self::$installed_plugins ) {
|
264 |
+
self::$installed_plugins = get_plugins();
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
268 |
+
return 'install';
|
269 |
+
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
270 |
+
return 'activate';
|
271 |
+
} else {
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Get zapier settings.
|
278 |
+
*
|
279 |
+
* @return array.
|
280 |
+
*/
|
281 |
+
public static function get_common_settings() {
|
282 |
+
|
283 |
+
if ( null === self::$common ) {
|
284 |
+
|
285 |
+
$common_default = apply_filters(
|
286 |
+
'cartflows_common_settings_default',
|
287 |
+
array(
|
288 |
+
'disallow_indexing' => 'disable',
|
289 |
+
'global_checkout' => '',
|
290 |
+
'default_page_builder' => 'elementor',
|
291 |
+
)
|
292 |
+
);
|
293 |
+
|
294 |
+
$common = self::get_admin_settings_option( '_cartflows_common', false, false );
|
295 |
+
|
296 |
+
$common = wp_parse_args( $common, $common_default );
|
297 |
+
|
298 |
+
if ( ! did_action( 'wp' ) ) {
|
299 |
+
return $common;
|
300 |
+
} else {
|
301 |
+
self::$common = $common;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
return self::$common;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Get debug settings data.
|
310 |
+
*
|
311 |
+
* @return array.
|
312 |
+
*/
|
313 |
+
public static function get_debug_settings() {
|
314 |
+
|
315 |
+
if ( null === self::$debug_data ) {
|
316 |
+
|
317 |
+
$debug_data_default = apply_filters(
|
318 |
+
'cartflows_debug_settings_default',
|
319 |
+
array(
|
320 |
+
'allow_minified_files' => 'disable',
|
321 |
+
)
|
322 |
+
);
|
323 |
+
|
324 |
+
$debug_data = self::get_admin_settings_option( '_cartflows_debug_data', false, false );
|
325 |
+
|
326 |
+
$debug_data = wp_parse_args( $debug_data, $debug_data_default );
|
327 |
+
|
328 |
+
if ( ! did_action( 'wp' ) ) {
|
329 |
+
return $debug_data;
|
330 |
+
} else {
|
331 |
+
self::$debug_data = $debug_data;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
return self::$debug_data;
|
336 |
+
}
|
337 |
+
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Get debug settings data.
|
341 |
+
*
|
342 |
+
* @return array.
|
343 |
+
*/
|
344 |
+
public static function get_permalink_settings() {
|
345 |
+
|
346 |
+
if ( null === self::$permalink_setting ) {
|
347 |
+
|
348 |
+
$permalink_default = apply_filters(
|
349 |
+
'cartflows_permalink_settings_default',
|
350 |
+
array(
|
351 |
+
'permalink' => CARTFLOWS_STEP_POST_TYPE,
|
352 |
+
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
|
353 |
+
'permalink_structure' => '',
|
354 |
+
|
355 |
+
)
|
356 |
+
);
|
357 |
+
|
358 |
+
$permalink_data = self::get_admin_settings_option( '_cartflows_permalink', false, false );
|
359 |
+
|
360 |
+
$permalink_data = wp_parse_args( $permalink_data, $permalink_default );
|
361 |
+
|
362 |
+
if ( ! did_action( 'wp' ) ) {
|
363 |
+
return $permalink_data;
|
364 |
+
} else {
|
365 |
+
self::$permalink_setting = $permalink_data;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
return self::$permalink_setting;
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Get debug settings data.
|
375 |
+
*
|
376 |
+
* @return array.
|
377 |
+
*/
|
378 |
+
public static function get_google_analytics_settings() {
|
379 |
+
|
380 |
+
if ( null === self::$google_analytics_settings ) {
|
381 |
+
|
382 |
+
$google_analytics_settings_default = apply_filters(
|
383 |
+
'cartflows_google_analytics_settings_default',
|
384 |
+
array(
|
385 |
+
'enable_google_analytics' => 'disable',
|
386 |
+
'enable_google_analytics_for_site' => 'disable',
|
387 |
+
'google_analytics_id' => '',
|
388 |
+
'enable_begin_checkout' => 'disable',
|
389 |
+
'enable_add_to_cart' => 'disable',
|
390 |
+
'enable_add_payment_info' => 'disable',
|
391 |
+
'enable_purchase_event' => 'disable',
|
392 |
+
)
|
393 |
+
);
|
394 |
+
|
395 |
+
$google_analytics_settings_data = self::get_admin_settings_option( '_cartflows_google_analytics', false, true );
|
396 |
+
|
397 |
+
$google_analytics_settings_data = wp_parse_args( $google_analytics_settings_data, $google_analytics_settings_default );
|
398 |
+
|
399 |
+
if ( ! did_action( 'wp' ) ) {
|
400 |
+
return $google_analytics_settings_data;
|
401 |
+
} else {
|
402 |
+
self::$google_analytics_settings = $google_analytics_settings_data;
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
return self::$google_analytics_settings = $google_analytics_settings_data; //phpcs:ignore
|
407 |
+
}
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Get Checkout field.
|
411 |
+
*
|
412 |
+
* @param string $key Field key.
|
413 |
+
* @param int $post_id Post id.
|
414 |
+
* @return array.
|
415 |
+
*/
|
416 |
+
public static function get_checkout_fields( $key, $post_id ) {
|
417 |
+
|
418 |
+
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
419 |
+
|
420 |
+
if ( ! $saved_fields ) {
|
421 |
+
$saved_fields = array();
|
422 |
+
}
|
423 |
+
|
424 |
+
$fields = array_filter( $saved_fields );
|
425 |
+
|
426 |
+
if ( empty( $fields ) ) {
|
427 |
+
if ( 'billing' === $key || 'shipping' === $key ) {
|
428 |
+
|
429 |
+
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
430 |
+
|
431 |
+
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
return $fields;
|
436 |
+
}
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Add Checkout field.
|
440 |
+
*
|
441 |
+
* @param string $type Field type.
|
442 |
+
* @param string $field_key Field key.
|
443 |
+
* @param array $field_data Field data.
|
444 |
+
* @param int $post_id Post id.
|
445 |
+
* @return boolean.
|
446 |
+
*/
|
447 |
+
public static function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
448 |
+
|
449 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
450 |
+
|
451 |
+
$fields[ $field_key ] = $field_data;
|
452 |
+
|
453 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
454 |
+
|
455 |
+
return true;
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Get checkout fields settings.
|
460 |
+
*
|
461 |
+
* @param string $type Field type.
|
462 |
+
* @param string $field_key Field key.
|
463 |
+
* @param int $post_id Post id.
|
464 |
+
* @return array.
|
465 |
+
*/
|
466 |
+
public static function delete_checkout_field( $type, $field_key, $post_id ) {
|
467 |
+
|
468 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
469 |
+
|
470 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
471 |
+
unset( $fields[ $field_key ] );
|
472 |
+
}
|
473 |
+
|
474 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
475 |
+
|
476 |
+
return true;
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Get checkout fields settings.
|
481 |
+
*
|
482 |
+
* @return array.
|
483 |
+
*/
|
484 |
+
public static function get_checkout_fields_settings() {
|
485 |
+
|
486 |
+
if ( null === self::$checkout_fields ) {
|
487 |
+
$checkout_fields_default = array(
|
488 |
+
'enable_customization' => 'disable',
|
489 |
+
'enable_billing_fields' => 'disable',
|
490 |
+
);
|
491 |
+
|
492 |
+
$billing_fields = self::get_checkout_fields( 'billing' );
|
493 |
+
|
494 |
+
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
495 |
+
|
496 |
+
foreach ( $billing_fields as $key => $value ) {
|
497 |
+
|
498 |
+
$checkout_fields_default[ $key ] = 'enable';
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
$checkout_fields = self::get_admin_settings_option( '_wcf_checkout_fields', false, false );
|
503 |
+
|
504 |
+
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
505 |
+
}
|
506 |
+
|
507 |
+
return self::$checkout_fields;
|
508 |
+
}
|
509 |
+
|
510 |
+
/**
|
511 |
+
* Get meta options
|
512 |
+
*
|
513 |
+
* @since 1.0.0
|
514 |
+
* @param int $post_id Product ID.
|
515 |
+
* @param string $key Meta Key.
|
516 |
+
* @param string $default Default value.
|
517 |
+
* @return string Meta Value.
|
518 |
+
*/
|
519 |
+
public static function get_meta_option( $post_id, $key, $default = '' ) {
|
520 |
+
|
521 |
+
$value = get_post_meta( $post_id, $key, true );
|
522 |
+
|
523 |
+
if ( ! $value ) {
|
524 |
+
$value = $default;
|
525 |
+
}
|
526 |
+
|
527 |
+
return $value;
|
528 |
+
}
|
529 |
+
|
530 |
+
/**
|
531 |
+
* Save meta option
|
532 |
+
*
|
533 |
+
* @since 1.0.0
|
534 |
+
* @param int $post_id Product ID.
|
535 |
+
* @param array $args Arguments array.
|
536 |
+
*/
|
537 |
+
public static function save_meta_option( $post_id, $args = array() ) {
|
538 |
+
|
539 |
+
if ( is_array( $args ) && ! empty( $args ) ) {
|
540 |
+
|
541 |
+
foreach ( $args as $key => $value ) {
|
542 |
+
|
543 |
+
update_post_meta( $post_id, $key, $value );
|
544 |
+
}
|
545 |
+
}
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Check if Elementor page builder is installed
|
550 |
+
*
|
551 |
+
* @since 1.0.0
|
552 |
+
*
|
553 |
+
* @access public
|
554 |
+
*/
|
555 |
+
public static function is_elementor_installed() {
|
556 |
+
$path = 'elementor/elementor.php';
|
557 |
+
$plugins = get_plugins();
|
558 |
+
|
559 |
+
return isset( $plugins[ $path ] );
|
560 |
+
}
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Check if Step has product assigned.
|
564 |
+
*
|
565 |
+
* @since 1.0.0
|
566 |
+
* @param int $step_id step ID.
|
567 |
+
*
|
568 |
+
* @access public
|
569 |
+
*/
|
570 |
+
public static function has_product_assigned( $step_id ) {
|
571 |
+
|
572 |
+
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
573 |
+
|
574 |
+
if ( 'checkout' == $step_type ) {
|
575 |
+
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
576 |
+
} else {
|
577 |
+
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
578 |
+
}
|
579 |
+
|
580 |
+
if ( ! empty( $product ) ) {
|
581 |
+
return true;
|
582 |
+
}
|
583 |
+
return false;
|
584 |
+
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Get attributes for cartflows wrap.
|
589 |
+
*
|
590 |
+
* @since 1.1.4
|
591 |
+
*
|
592 |
+
* @access public
|
593 |
+
*/
|
594 |
+
public static function get_cartflows_container_atts() {
|
595 |
+
|
596 |
+
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
597 |
+
$atts_string = '';
|
598 |
+
|
599 |
+
foreach ( $attributes as $key => $value ) {
|
600 |
+
|
601 |
+
if ( ! $value ) {
|
602 |
+
continue;
|
603 |
+
}
|
604 |
+
|
605 |
+
if ( true === $value ) {
|
606 |
+
$atts_string .= esc_html( $key ) . ' ';
|
607 |
+
} else {
|
608 |
+
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
return $atts_string;
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* Get facebook pixel settings.
|
617 |
+
*
|
618 |
+
* @return facebook array.
|
619 |
+
*/
|
620 |
+
public static function get_facebook_settings() {
|
621 |
+
|
622 |
+
if ( null === self::$facebook ) {
|
623 |
+
|
624 |
+
$facebook_default = array(
|
625 |
+
'facebook_pixel_id' => '',
|
626 |
+
'facebook_pixel_add_to_cart' => 'enable',
|
627 |
+
'facebook_pixel_initiate_checkout' => 'enable',
|
628 |
+
'facebook_pixel_add_payment_info' => 'enable',
|
629 |
+
'facebook_pixel_purchase_complete' => 'enable',
|
630 |
+
'facebook_pixel_tracking' => 'disable',
|
631 |
+
'facebook_pixel_tracking_for_site' => 'disable',
|
632 |
+
);
|
633 |
+
|
634 |
+
$facebook = self::get_admin_settings_option( '_cartflows_facebook', false, false );
|
635 |
+
|
636 |
+
$facebook = wp_parse_args( $facebook, $facebook_default );
|
637 |
+
|
638 |
+
self::$facebook = apply_filters( 'cartflows_facebook_settings_default', $facebook );
|
639 |
+
|
640 |
+
}
|
641 |
+
|
642 |
+
return self::$facebook;
|
643 |
+
}
|
644 |
+
|
645 |
+
|
646 |
+
/**
|
647 |
+
* Prepare response data for facebook.
|
648 |
+
*
|
649 |
+
* @param int $order_id order_id.
|
650 |
+
* @param array $offer_data offer data.
|
651 |
+
*/
|
652 |
+
public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) {
|
653 |
+
|
654 |
+
// Stop Execution if WooCommerce is not installed & don't set the cookie.
|
655 |
+
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
656 |
+
return;
|
657 |
+
}
|
658 |
+
|
659 |
+
$fb_settings = self::get_facebook_settings();
|
660 |
+
if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) {
|
661 |
+
setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/' );
|
662 |
+
}
|
663 |
+
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Prepare purchase response for facebook purcase event.
|
668 |
+
*
|
669 |
+
* @param integer $order_id order id.
|
670 |
+
* @param array $offer_data offer data.
|
671 |
+
* @return mixed
|
672 |
+
*/
|
673 |
+
public static function prepare_purchase_data_fb_response( $order_id, $offer_data = array() ) {
|
674 |
+
|
675 |
+
$thankyou = array();
|
676 |
+
|
677 |
+
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
678 |
+
return $thankyou;
|
679 |
+
}
|
680 |
+
|
681 |
+
$thankyou['order_id'] = $order_id;
|
682 |
+
$thankyou['content_type'] = 'product';
|
683 |
+
$thankyou['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' );
|
684 |
+
$thankyou['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' );
|
685 |
+
$thankyou['plugin'] = 'CartFlows';
|
686 |
+
$order = wc_get_order( $order_id );
|
687 |
+
if ( empty( $offer_data ) ) {
|
688 |
+
// Iterating through each WC_Order_Item_Product objects.
|
689 |
+
foreach ( $order->get_items() as $item_key => $item ) {
|
690 |
+
$product = $item->get_product(); // Get the WC_Product object.
|
691 |
+
$thankyou['content_ids'][] = (string) $product->get_id();
|
692 |
+
}
|
693 |
+
$thankyou['value'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_total' );
|
694 |
+
} else {
|
695 |
+
$thankyou['content_ids'][] = (string) $offer_data['id'];
|
696 |
+
$thankyou['value'] = $offer_data['total'];
|
697 |
+
}
|
698 |
+
|
699 |
+
return $thankyou;
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Prepare cart data for fb response.
|
704 |
+
*
|
705 |
+
* @return array
|
706 |
+
*/
|
707 |
+
public static function prepare_cart_data_fb_response() {
|
708 |
+
|
709 |
+
$params = array();
|
710 |
+
|
711 |
+
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
|
712 |
+
return $params;
|
713 |
+
}
|
714 |
+
|
715 |
+
$cart_total = WC()->cart->get_cart_contents_total();
|
716 |
+
$cart_items_count = WC()->cart->get_cart_contents_count();
|
717 |
+
$items = WC()->cart->get_cart();
|
718 |
+
$product_names = '';
|
719 |
+
$category_names = '';
|
720 |
+
$cart_contents = array();
|
721 |
+
foreach ( $items as $item => $value ) {
|
722 |
+
|
723 |
+
$_product = wc_get_product( $value['product_id'] );
|
724 |
+
$params['content_ids'][] = (string) $_product->get_id();
|
725 |
+
$product_names = $product_names . ', ' . $_product->get_title();
|
726 |
+
$category_names = $category_names . ', ' . wp_strip_all_tags( wc_get_product_category_list( $_product->get_id() ) );
|
727 |
+
array_push(
|
728 |
+
$cart_contents,
|
729 |
+
array(
|
730 |
+
'id' => $_product->get_id(),
|
731 |
+
'name' => $_product->get_title(),
|
732 |
+
'quantity' => $value['quantity'],
|
733 |
+
'item_price' => $_product->get_price(),
|
734 |
+
)
|
735 |
+
);
|
736 |
+
}
|
737 |
+
|
738 |
+
$user = wp_get_current_user();
|
739 |
+
$roles = implode( ', ', $user->roles );
|
740 |
+
$params['content_name'] = substr( $product_names, 2 );
|
741 |
+
$params['categoey_name'] = substr( $category_names, 2 );
|
742 |
+
$params['user_roles'] = $roles;
|
743 |
+
$params['plugin'] = 'CartFlows';
|
744 |
+
$params['contents'] = wp_json_encode( $cart_contents );
|
745 |
+
$params['content_type'] = 'product';
|
746 |
+
$params['value'] = $cart_total;
|
747 |
+
$params['num_items'] = $cart_items_count;
|
748 |
+
$params['currency'] = get_woocommerce_currency();
|
749 |
+
$params['language'] = get_bloginfo( 'language' );
|
750 |
+
$params['userAgent'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); //phpcs:ignore
|
751 |
+
$params['product_catalog_id'] = '';
|
752 |
+
$params['domain'] = get_site_url();
|
753 |
+
return $params;
|
754 |
+
}
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Get the image url of size.
|
758 |
+
*
|
759 |
+
* @param int $post_id post id.
|
760 |
+
* @param array $key key.
|
761 |
+
* @param string $size image size.
|
762 |
+
*
|
763 |
+
* @return array
|
764 |
+
*/
|
765 |
+
public static function get_image_url( $post_id, $key, $size = false ) {
|
766 |
+
|
767 |
+
$url = get_post_meta( $post_id, $key, true );
|
768 |
+
$img_obj = get_post_meta( $post_id, $key . '-obj', true );
|
769 |
+
if ( is_array( $img_obj ) && ! empty( $img_obj ) && false !== $size ) {
|
770 |
+
|
771 |
+
$url = ! empty( $img_obj['url'][ $size ] ) ? $img_obj['url'][ $size ] : $url;
|
772 |
+
}
|
773 |
+
|
774 |
+
return $url;
|
775 |
+
}
|
776 |
+
|
777 |
+
}
|
classes/class-cartflows-importer.php
CHANGED
@@ -1,1694 +1,1692 @@
|
|
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 |
-
|
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( '
|
52 |
-
add_action( '
|
53 |
-
add_action( '
|
54 |
-
|
55 |
-
add_action( '
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
add_action( '
|
63 |
-
add_action( 'admin_init', array( $this, '
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
*
|
71 |
-
*
|
72 |
-
*
|
73 |
-
*
|
74 |
-
* @param
|
75 |
-
*
|
76 |
-
*
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
*
|
88 |
-
*
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
*
|
98 |
-
*
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
$flows
|
115 |
-
$flows
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
header( 'Content-
|
120 |
-
header( '
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
*
|
129 |
-
*
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
*
|
138 |
-
*
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
*
|
147 |
-
*
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
$flows =
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
header( 'Content-
|
168 |
-
header( '
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
*
|
177 |
-
*
|
178 |
-
*
|
179 |
-
*
|
180 |
-
* @
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
'
|
189 |
-
'
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
$
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
'
|
222 |
-
'
|
223 |
-
'
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
'
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
*
|
247 |
-
*
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
'
|
257 |
-
'
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
$
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
*
|
274 |
-
*
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
$
|
291 |
-
$
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
*
|
315 |
-
* @
|
316 |
-
* @
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
'
|
334 |
-
'
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
*
|
344 |
-
*
|
345 |
-
* @
|
346 |
-
* @param
|
347 |
-
* @param array $
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
'
|
359 |
-
'
|
360 |
-
'
|
361 |
-
'
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
*
|
370 |
-
*
|
371 |
-
* @
|
372 |
-
* @param int $
|
373 |
-
* @param
|
374 |
-
* @param array $
|
375 |
-
* @param array $
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
$
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
$
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
'
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
*
|
420 |
-
*
|
421 |
-
*
|
422 |
-
*
|
423 |
-
* @
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
$
|
429 |
-
$
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
'
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
*
|
472 |
-
*
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
*
|
485 |
-
*
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
*
|
497 |
-
*
|
498 |
-
*
|
499 |
-
*
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
<
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
<
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
<
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
<
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
<a class="
|
596 |
-
<a class="
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
<# console.log( data.items ) #>
|
608 |
-
<#
|
609 |
-
|
610 |
-
<#
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
<#
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
<
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
<
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
<
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
<#
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
<
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
<
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
var
|
756 |
-
var
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
<
|
798 |
-
<p><?php esc_html_e( '
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
$
|
811 |
-
$
|
812 |
-
|
813 |
-
|
814 |
-
$
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
$
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
<p
|
830 |
-
<p>
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
<#
|
846 |
-
|
847 |
-
|
848 |
-
<#
|
849 |
-
<#
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
<#
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
*
|
938 |
-
*
|
939 |
-
*
|
940 |
-
*
|
941 |
-
* @
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
$
|
956 |
-
$
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
'
|
961 |
-
'
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
'
|
966 |
-
|
967 |
-
'
|
968 |
-
'
|
969 |
-
'
|
970 |
-
'
|
971 |
-
'
|
972 |
-
'
|
973 |
-
'
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
'
|
979 |
-
|
980 |
-
'
|
981 |
-
'
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
'
|
987 |
-
|
988 |
-
'
|
989 |
-
'
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
'
|
995 |
-
|
996 |
-
'
|
997 |
-
'
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
'
|
1003 |
-
|
1004 |
-
'
|
1005 |
-
'
|
1006 |
-
'
|
1007 |
-
'
|
1008 |
-
'
|
1009 |
-
'
|
1010 |
-
'
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
'
|
1016 |
-
|
1017 |
-
'
|
1018 |
-
'
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
'
|
1023 |
-
'
|
1024 |
-
'
|
1025 |
-
'
|
1026 |
-
'
|
1027 |
-
'
|
1028 |
-
'
|
1029 |
-
'
|
1030 |
-
'
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
//
|
1041 |
-
//
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
wp_localize_script( 'cartflows-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
*
|
1051 |
-
*
|
1052 |
-
*
|
1053 |
-
*
|
1054 |
-
* @
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
wcf()->logger->import_log( '
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
);
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
$
|
1144 |
-
$
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
$
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
'
|
1265 |
-
'
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
array(
|
1277 |
-
'
|
1278 |
-
'
|
1279 |
-
'
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
);
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
$
|
1351 |
-
|
1352 |
-
$
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
$
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
$
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
'
|
1438 |
-
'
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
);
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
$
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
*
|
1491 |
-
*
|
1492 |
-
* @
|
1493 |
-
*
|
1494 |
-
* @
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
$metadata
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
$raw_data =
|
1509 |
-
}
|
1510 |
-
$raw_data =
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
$raw_data = wp_slash(
|
1518 |
-
}
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
*
|
1539 |
-
*
|
1540 |
-
* @
|
1541 |
-
*
|
1542 |
-
* @param
|
1543 |
-
* @
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
$data
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
*
|
1566 |
-
*
|
1567 |
-
* @
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
*
|
1582 |
-
*
|
1583 |
-
* @
|
1584 |
-
*
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
*
|
1599 |
-
*
|
1600 |
-
* @param
|
1601 |
-
* @param
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
'
|
1615 |
-
|
1616 |
-
|
1617 |
-
);
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
*
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
'
|
1631 |
-
'
|
1632 |
-
'
|
1633 |
-
'
|
1634 |
-
|
1635 |
-
|
1636 |
-
)
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
$
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
'
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
'
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
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 |
+
|
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_import_flow_step', array( $this, 'import_flow' ) );
|
52 |
+
add_action( 'wp_ajax_cartflows_default_flow', array( $this, 'create_default_flow' ) );
|
53 |
+
add_action( 'wp_ajax_cartflows_step_create_blank', array( $this, 'step_create_blank' ) );
|
54 |
+
|
55 |
+
add_action( 'admin_footer', array( $this, 'js_templates' ) );
|
56 |
+
add_action( 'cartflows_import_complete', array( $this, 'clear_cache' ) );
|
57 |
+
|
58 |
+
add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
|
59 |
+
|
60 |
+
add_action( 'wp_ajax_cartflows_activate_plugin', array( $this, 'activate_plugin' ) );
|
61 |
+
|
62 |
+
add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
|
63 |
+
add_action( 'admin_init', array( $this, 'export_json' ) );
|
64 |
+
add_action( 'admin_init', array( $this, 'import_json' ) );
|
65 |
+
add_filter( 'post_row_actions', array( $this, 'export_link' ), 10, 2 );
|
66 |
+
add_action( 'admin_action_cartflows_export_flow', array( $this, 'export_flow' ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Add the export link to action list for flows row actions
|
71 |
+
*
|
72 |
+
* @since 1.1.4
|
73 |
+
*
|
74 |
+
* @param array $actions Actions array.
|
75 |
+
* @param object $post Post object.
|
76 |
+
*
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
public function export_link( $actions, $post ) {
|
80 |
+
if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
|
81 |
+
$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>';
|
82 |
+
}
|
83 |
+
return $actions;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Add menus
|
88 |
+
*
|
89 |
+
* @since 1.1.4
|
90 |
+
*/
|
91 |
+
public function add_to_menus() {
|
92 |
+
add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Export', 'cartflows' ), __( 'Flow Export', 'cartflows' ), 'export', 'flow_exporter', array( $this, 'exporter_markup' ) );
|
93 |
+
add_submenu_page( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE, __( 'Flow Import', 'cartflows' ), __( 'Flow Import', 'cartflows' ), 'import', 'flow_importer', array( $this, 'importer_markup' ) );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Export flow with steps and its meta
|
98 |
+
*
|
99 |
+
* @since 1.1.4
|
100 |
+
*/
|
101 |
+
public function export_flow() {
|
102 |
+
|
103 |
+
if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_export_flow' == $_REQUEST['action'] ) ) ) {
|
104 |
+
wp_die( esc_html__( 'No post to export has been supplied!', 'cartflows' ) );
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( ! isset( $_GET['flow_export_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['flow_export_nonce'] ) ), basename( __FILE__ ) ) ) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
// Get the original post id.
|
112 |
+
$flow_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
|
113 |
+
|
114 |
+
$flows = array();
|
115 |
+
$flows[] = $this->get_flow_export_data( $flow_id );
|
116 |
+
$flows = apply_filters( 'cartflows_export_data', $flows );
|
117 |
+
|
118 |
+
nocache_headers();
|
119 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
120 |
+
header( 'Content-Disposition: attachment; filename=cartflows-flow-' . $flow_id . '-' . gmdate( 'm-d-Y' ) . '.json' );
|
121 |
+
header( 'Expires: 0' );
|
122 |
+
|
123 |
+
echo wp_json_encode( $flows );
|
124 |
+
exit;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Export flow markup
|
129 |
+
*
|
130 |
+
* @since 1.1.4
|
131 |
+
*/
|
132 |
+
public function exporter_markup() {
|
133 |
+
include_once CARTFLOWS_DIR . 'includes/exporter.php';
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Import flow markup
|
138 |
+
*
|
139 |
+
* @since 1.1.4
|
140 |
+
*/
|
141 |
+
public function importer_markup() {
|
142 |
+
include_once CARTFLOWS_DIR . 'includes/importer.php';
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Export flow
|
147 |
+
*
|
148 |
+
* @since 1.1.4
|
149 |
+
*/
|
150 |
+
public function export_json() {
|
151 |
+
if ( empty( $_POST['cartflows-action'] ) || 'export' != $_POST['cartflows-action'] ) {
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-action-nonce'] ) ), 'cartflows-action-nonce' ) ) {
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
|
163 |
+
$flows = $this->get_all_flow_export_data();
|
164 |
+
$flows = apply_filters( 'cartflows_export_data', $flows );
|
165 |
+
|
166 |
+
nocache_headers();
|
167 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
168 |
+
header( 'Content-Disposition: attachment; filename=cartflows-flow-export-' . gmdate( 'm-d-Y' ) . '.json' );
|
169 |
+
header( 'Expires: 0' );
|
170 |
+
|
171 |
+
echo wp_json_encode( $flows );
|
172 |
+
exit;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Get flow export data
|
177 |
+
*
|
178 |
+
* @since 1.1.4
|
179 |
+
*
|
180 |
+
* @param integer $flow_id Flow ID.
|
181 |
+
* @return array
|
182 |
+
*/
|
183 |
+
public function get_flow_export_data( $flow_id ) {
|
184 |
+
|
185 |
+
$export_all = apply_filters( 'cartflows_export_all', false );
|
186 |
+
|
187 |
+
$valid_step_meta_keys = array(
|
188 |
+
'_wp_page_template',
|
189 |
+
'_thumbnail_id',
|
190 |
+
'classic-editor-remember',
|
191 |
+
);
|
192 |
+
|
193 |
+
$new_steps = array();
|
194 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
195 |
+
if ( $steps ) {
|
196 |
+
foreach ( $steps as $key => $step ) {
|
197 |
+
|
198 |
+
// Add step post meta.
|
199 |
+
$new_all_meta = array();
|
200 |
+
$all_meta = get_post_meta( $step['id'] );
|
201 |
+
if ( is_array( $all_meta ) ) {
|
202 |
+
|
203 |
+
if ( $export_all ) {
|
204 |
+
foreach ( $all_meta as $meta_key => $value ) {
|
205 |
+
$new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
|
206 |
+
}
|
207 |
+
} else {
|
208 |
+
|
209 |
+
foreach ( $all_meta as $meta_key => $value ) {
|
210 |
+
if ( substr( $meta_key, 0, strlen( 'wcf' ) ) === 'wcf' ) {
|
211 |
+
$new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
|
212 |
+
} elseif ( in_array( $meta_key, $valid_step_meta_keys, true ) ) {
|
213 |
+
$new_all_meta[ $meta_key ] = maybe_unserialize( $value[0] );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
// Add single step.
|
220 |
+
$step_data_arr = array(
|
221 |
+
'title' => get_the_title( $step['id'] ),
|
222 |
+
'type' => $step['type'],
|
223 |
+
'meta' => $new_all_meta,
|
224 |
+
'post_content' => '',
|
225 |
+
);
|
226 |
+
|
227 |
+
if ( $export_all ) {
|
228 |
+
|
229 |
+
$step_post_obj = get_post( $step['id'] );
|
230 |
+
|
231 |
+
$step_data_arr['post_content'] = $step_post_obj->post_content;
|
232 |
+
}
|
233 |
+
|
234 |
+
$new_steps[] = $step_data_arr;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
// Add single flow.
|
239 |
+
return array(
|
240 |
+
'title' => get_the_title( $flow_id ),
|
241 |
+
'steps' => $new_steps,
|
242 |
+
);
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get all flow export data
|
247 |
+
*
|
248 |
+
* @since 1.1.4
|
249 |
+
*/
|
250 |
+
public function get_all_flow_export_data() {
|
251 |
+
|
252 |
+
$query_args = array(
|
253 |
+
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
254 |
+
|
255 |
+
// Query performance optimization.
|
256 |
+
'fields' => 'ids',
|
257 |
+
'no_found_rows' => true,
|
258 |
+
'posts_per_page' => -1,
|
259 |
+
);
|
260 |
+
|
261 |
+
$query = new WP_Query( $query_args );
|
262 |
+
$flows = array();
|
263 |
+
if ( $query->posts ) {
|
264 |
+
foreach ( $query->posts as $key => $post_id ) {
|
265 |
+
$flows[] = $this->get_flow_export_data( $post_id );
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
return $flows;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Import our exported file
|
274 |
+
*
|
275 |
+
* @since 1.1.4
|
276 |
+
*/
|
277 |
+
public function import_json() {
|
278 |
+
if ( empty( $_POST['cartflows-action'] ) || 'import' != $_POST['cartflows-action'] ) {
|
279 |
+
return;
|
280 |
+
}
|
281 |
+
|
282 |
+
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-action-nonce'] ) ), 'cartflows-action-nonce' ) ) {
|
283 |
+
return;
|
284 |
+
}
|
285 |
+
|
286 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
287 |
+
return;
|
288 |
+
}
|
289 |
+
|
290 |
+
$filename = $_FILES['file']['name']; //phpcs:ignore
|
291 |
+
$file_info = explode( '.', $filename );
|
292 |
+
$extension = end( $file_info );
|
293 |
+
|
294 |
+
if ( 'json' != $extension ) {
|
295 |
+
wp_die( esc_html__( 'Please upload a valid .json file', 'cartflows' ) );
|
296 |
+
}
|
297 |
+
|
298 |
+
$file = $_FILES['file']['tmp_name']; //phpcs:ignore
|
299 |
+
|
300 |
+
if ( empty( $file ) ) {
|
301 |
+
wp_die( esc_html__( 'Please upload a file to import', 'cartflows' ) );
|
302 |
+
}
|
303 |
+
|
304 |
+
// Retrieve the settings from the file and convert the JSON object to an array.
|
305 |
+
$flows = json_decode( file_get_contents( $file ), true );//phpcs:ignore
|
306 |
+
|
307 |
+
$this->import_from_json_data( $flows );
|
308 |
+
|
309 |
+
add_action( 'admin_notices', array( $this, 'imported_successfully' ) );
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Import flow from the JSON data
|
314 |
+
*
|
315 |
+
* @since x.x.x
|
316 |
+
* @param array $flows JSON array.
|
317 |
+
* @return void
|
318 |
+
*/
|
319 |
+
public function import_from_json_data( $flows ) {
|
320 |
+
if ( $flows ) {
|
321 |
+
|
322 |
+
foreach ( $flows as $key => $flow ) {
|
323 |
+
|
324 |
+
$flow_title = $flow['title'];
|
325 |
+
if ( post_exists( $flow['title'] ) ) {
|
326 |
+
$flow_title = $flow['title'] . ' Copy';
|
327 |
+
}
|
328 |
+
|
329 |
+
// Create post object.
|
330 |
+
$new_flow_args = apply_filters(
|
331 |
+
'cartflows_flow_importer_args',
|
332 |
+
array(
|
333 |
+
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
334 |
+
'post_title' => $flow_title,
|
335 |
+
'post_status' => 'draft',
|
336 |
+
)
|
337 |
+
);
|
338 |
+
|
339 |
+
// Insert the post into the database.
|
340 |
+
$flow_id = wp_insert_post( $new_flow_args );
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Fire after flow import
|
344 |
+
*
|
345 |
+
* @since x.x.x
|
346 |
+
* @param int $flow_id Flow ID.
|
347 |
+
* @param array $new_flow_args Flow post args.
|
348 |
+
* @param array $flows Flow JSON data.
|
349 |
+
*/
|
350 |
+
do_action( 'cartflows_flow_imported', $flow_id, $new_flow_args, $flows );
|
351 |
+
|
352 |
+
if ( $flow['steps'] ) {
|
353 |
+
foreach ( $flow['steps'] as $key => $step ) {
|
354 |
+
|
355 |
+
$new_step_args = apply_filters(
|
356 |
+
'cartflows_step_importer_args',
|
357 |
+
array(
|
358 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
359 |
+
'post_title' => $step['title'],
|
360 |
+
'post_status' => 'publish',
|
361 |
+
'meta_input' => $step['meta'],
|
362 |
+
'post_content' => isset( $step['post_content'] ) ? $step['post_content'] : '',
|
363 |
+
)
|
364 |
+
);
|
365 |
+
|
366 |
+
$new_step_id = wp_insert_post( $new_step_args );
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Fire after step import
|
370 |
+
*
|
371 |
+
* @since x.x.x
|
372 |
+
* @param int $new_step_id step ID.
|
373 |
+
* @param int $flow_id flow ID.
|
374 |
+
* @param array $new_step_args Step post args.
|
375 |
+
* @param array $flow_steps Flow steps.
|
376 |
+
* @param array $flows All flows JSON data.
|
377 |
+
*/
|
378 |
+
do_action( 'cartflows_step_imported', $new_step_id, $flow_id, $new_step_args, $flow['steps'], $flows );
|
379 |
+
|
380 |
+
// Insert post meta.
|
381 |
+
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
382 |
+
|
383 |
+
$step_taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
384 |
+
$current_term = term_exists( $step['type'], $step_taxonomy );
|
385 |
+
|
386 |
+
// // Set type object.
|
387 |
+
$data = get_term( $current_term['term_id'], $step_taxonomy );
|
388 |
+
$step_slug = $data->slug;
|
389 |
+
wp_set_object_terms( $new_step_id, $data->slug, $step_taxonomy );
|
390 |
+
|
391 |
+
// Set type.
|
392 |
+
update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
|
393 |
+
|
394 |
+
// Set flow.
|
395 |
+
wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
396 |
+
|
397 |
+
self::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step['title'], $step_slug );
|
398 |
+
|
399 |
+
if ( isset( $step['post_content'] ) && ! empty( $step['post_content'] ) ) {
|
400 |
+
|
401 |
+
// Download and replace images.
|
402 |
+
$content = $this->get_content( $step['post_content'] );
|
403 |
+
|
404 |
+
// Update post content.
|
405 |
+
wp_update_post(
|
406 |
+
array(
|
407 |
+
'ID' => $new_step_id,
|
408 |
+
'post_content' => $content,
|
409 |
+
)
|
410 |
+
);
|
411 |
+
}
|
412 |
+
}
|
413 |
+
}
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Download and Replace hotlink images
|
420 |
+
*
|
421 |
+
* @since x.x.x
|
422 |
+
*
|
423 |
+
* @param string $content Mixed post content.
|
424 |
+
* @return array Hotlink image array.
|
425 |
+
*/
|
426 |
+
public function get_content( $content = '' ) {
|
427 |
+
|
428 |
+
$all_links = wp_extract_urls( $content );
|
429 |
+
$image_links = array();
|
430 |
+
$image_map = array();
|
431 |
+
|
432 |
+
// Not have any link.
|
433 |
+
if ( empty( $all_links ) ) {
|
434 |
+
return $content;
|
435 |
+
}
|
436 |
+
|
437 |
+
foreach ( $all_links as $key => $link ) {
|
438 |
+
if ( preg_match( '/\.(jpg|jpeg|png|gif)/i', $link ) ) {
|
439 |
+
$image_links[] = $link;
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
// Not have any image link.
|
444 |
+
if ( empty( $image_links ) ) {
|
445 |
+
return $content;
|
446 |
+
}
|
447 |
+
|
448 |
+
foreach ( $image_links as $key => $image_url ) {
|
449 |
+
|
450 |
+
// Download remote image.
|
451 |
+
$image = array(
|
452 |
+
'url' => $image_url,
|
453 |
+
'id' => wp_rand( 000, 999 ),
|
454 |
+
);
|
455 |
+
$downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
|
456 |
+
|
457 |
+
// Old and New image mapping links.
|
458 |
+
$image_map[ $image_url ] = $downloaded_image['url'];
|
459 |
+
}
|
460 |
+
|
461 |
+
// Replace old image links with new image links.
|
462 |
+
foreach ( $image_map as $old_url => $new_url ) {
|
463 |
+
$content = str_replace( $old_url, $new_url, $content );
|
464 |
+
}
|
465 |
+
|
466 |
+
return $content;
|
467 |
+
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Imported notice
|
472 |
+
*
|
473 |
+
* @since 1.1.4
|
474 |
+
*/
|
475 |
+
public function imported_successfully() {
|
476 |
+
?>
|
477 |
+
<div class="notice notice-success">
|
478 |
+
<p><?php esc_html_e( 'Successfully imported flows.', 'cartflows' ); ?></p>
|
479 |
+
</div>
|
480 |
+
<?php
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* Clear Cache.
|
485 |
+
*
|
486 |
+
* @since 1.0.0
|
487 |
+
*/
|
488 |
+
public function clear_cache() {
|
489 |
+
// Clear 'Elementor' file cache.
|
490 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
491 |
+
Elementor\Plugin::$instance->files_manager->clear_cache();
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* JS Templates
|
497 |
+
*
|
498 |
+
* @since 1.0.0
|
499 |
+
*
|
500 |
+
* @return void
|
501 |
+
*/
|
502 |
+
public function js_templates() {
|
503 |
+
|
504 |
+
// Loading Templates.
|
505 |
+
?>
|
506 |
+
<script type="text/template" id="tmpl-cartflows-step-loading">
|
507 |
+
<div class="template-message-block cartflows-step-loading">
|
508 |
+
<h2>
|
509 |
+
<span class="spinner"></span>
|
510 |
+
<?php esc_html_e( 'Loading Steps', 'cartflows' ); ?>
|
511 |
+
</h2>
|
512 |
+
<p class="description"><?php esc_html_e( 'Getting steps from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
|
513 |
+
</div>
|
514 |
+
</script>
|
515 |
+
|
516 |
+
<?php
|
517 |
+
// Search Templates.
|
518 |
+
?>
|
519 |
+
<script type="text/template" id="tmpl-cartflows-searching-templates">
|
520 |
+
<div class="template-message-block cartflows-searching-templates">
|
521 |
+
<h2>
|
522 |
+
<span class="spinner"></span>
|
523 |
+
<?php esc_html_e( 'Searching Template..', 'cartflows' ); ?>
|
524 |
+
</h2>
|
525 |
+
<p class="description"><?php esc_html_e( 'Getting templates from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
|
526 |
+
</div>
|
527 |
+
</script>
|
528 |
+
|
529 |
+
<?php
|
530 |
+
// CartFlows Importing Template.
|
531 |
+
?>
|
532 |
+
<script type="text/template" id="tmpl-cartflows-step-importing">
|
533 |
+
<div class="template-message-block cartflows-step-importing">
|
534 |
+
<h2><span class="spinner"></span> <?php esc_html_e( 'Importing..', 'cartflows' ); ?></h2>
|
535 |
+
</div>
|
536 |
+
</script>
|
537 |
+
|
538 |
+
<?php
|
539 |
+
// CartFlows Imported.
|
540 |
+
?>
|
541 |
+
<script type="text/template" id="tmpl-cartflows-step-imported">
|
542 |
+
<div class="template-message-block cartflows-step-imported">
|
543 |
+
<h2><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Imported', 'cartflows' ); ?></h2>
|
544 |
+
<p class="description"><?php esc_html_e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span></p></div>
|
545 |
+
</script>
|
546 |
+
|
547 |
+
<?php
|
548 |
+
// No templates.
|
549 |
+
?>
|
550 |
+
<script type="text/template" id="tmpl-cartflows-no-steps">
|
551 |
+
<div class="cartflows-no-steps">
|
552 |
+
<div class="template-message-block">
|
553 |
+
<h2><?php esc_html_e( 'Coming Soon!', 'cartflows' ); ?></h2>
|
554 |
+
<p class="description"></p>
|
555 |
+
</div>
|
556 |
+
</div>
|
557 |
+
</script>
|
558 |
+
|
559 |
+
<?php
|
560 |
+
// No templates.
|
561 |
+
?>
|
562 |
+
<script type="text/template" id="tmpl-cartflows-no-flows">
|
563 |
+
<div class="cartflows-no-flows">
|
564 |
+
<div class="template-message-block">
|
565 |
+
<h2><?php esc_html_e( 'Coming Soon!', 'cartflows' ); ?></h2>
|
566 |
+
<p class="description"></p>
|
567 |
+
</div>
|
568 |
+
</div>
|
569 |
+
</script>
|
570 |
+
|
571 |
+
<?php
|
572 |
+
// Error handling.
|
573 |
+
?>
|
574 |
+
<script type="text/template" id="tmpl-templator-error">
|
575 |
+
<div class="notice notice-error"><p>{{ data }}</p></div>
|
576 |
+
</script>
|
577 |
+
|
578 |
+
<?php
|
579 |
+
// Redirect to Elementor.
|
580 |
+
?>
|
581 |
+
<script type="text/template" id="tmpl-templator-redirect-to-elementor">
|
582 |
+
<div class="template-message-block templator-redirect-to-elementor">
|
583 |
+
<h2><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Imported', 'cartflows' ); ?></h2>
|
584 |
+
<p class="description"><?php esc_html_e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span><br/><br/><?php esc_html_e( 'Redirecting to the Elementor edit window.', 'cartflows' ); ?> </p></div>
|
585 |
+
</script>
|
586 |
+
|
587 |
+
<?php
|
588 |
+
/**
|
589 |
+
* Responsive Buttons
|
590 |
+
*/
|
591 |
+
?>
|
592 |
+
<script type="text/template" id="tmpl-cartflows-responsive-view">
|
593 |
+
<span class="responsive-view">
|
594 |
+
<span class="actions">
|
595 |
+
<a class="desktop" href="#"><span data-view="desktop " class="active dashicons dashicons-desktop"></span></a>
|
596 |
+
<a class="tablet" href="#"><span data-view="tablet" class="dashicons dashicons-tablet"></span></a>
|
597 |
+
<a class="mobile" href="#"><span data-view="mobile" class="dashicons dashicons-smartphone"></span></a>
|
598 |
+
</span>
|
599 |
+
</span>
|
600 |
+
</script>
|
601 |
+
|
602 |
+
<?php
|
603 |
+
// Templates data.
|
604 |
+
?>
|
605 |
+
<script type="text/template" id="tmpl-cartflows-flows-list">
|
606 |
+
|
607 |
+
<# console.log( data.items.length ) #>
|
608 |
+
<# console.log( data.items ) #>
|
609 |
+
<# if ( data.items.length ) { #>
|
610 |
+
<# for ( key in data.items ) { #>
|
611 |
+
<#
|
612 |
+
var flow_steps = [];
|
613 |
+
if( data.items[ key ].flow_steps ) {
|
614 |
+
flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
|
615 |
+
return value['id'];
|
616 |
+
});
|
617 |
+
}
|
618 |
+
#>
|
619 |
+
<div class="inner">
|
620 |
+
<div class="template">
|
621 |
+
<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 }}">
|
622 |
+
<div class="template-screenshot">
|
623 |
+
<# if( data.items[ key ].featured_image_url ) { #>
|
624 |
+
<img src="{{ data.items[ key ].featured_image_url }}" />
|
625 |
+
<# } else { #>
|
626 |
+
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
|
627 |
+
<# } #>
|
628 |
+
</div>
|
629 |
+
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
630 |
+
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
|
631 |
+
<# } #>
|
632 |
+
<# if( data.items[ key ].woo_required ) { #>
|
633 |
+
<div class="notice notice-info" style="width: auto;">
|
634 |
+
<p class="wcf-learn-how">
|
635 |
+
Install/Activate WooCommerce to use this template.
|
636 |
+
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
637 |
+
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
|
638 |
+
<i class="dashicons dashicons-external"></i>
|
639 |
+
</a>
|
640 |
+
</p>
|
641 |
+
</div>
|
642 |
+
<# } else { #>
|
643 |
+
<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>
|
644 |
+
<# } #>
|
645 |
+
|
646 |
+
</span>
|
647 |
+
<div class="template-id-container">
|
648 |
+
<h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
|
649 |
+
<div class="template-actions">
|
650 |
+
|
651 |
+
<#
|
652 |
+
if( data.items[ key ].page_builder.slug ) {
|
653 |
+
required_plugin_group = data.items[ key ].page_builder.slug;
|
654 |
+
} else {
|
655 |
+
required_plugin_group = '';
|
656 |
+
}
|
657 |
+
|
658 |
+
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 ) {
|
659 |
+
import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
|
660 |
+
} else {
|
661 |
+
import_btn_title = 'Import';
|
662 |
+
} #>
|
663 |
+
|
664 |
+
<# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
|
665 |
+
<# if( ! data.items[ key ].woo_required ) { #>
|
666 |
+
<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>
|
667 |
+
<# } else { #>
|
668 |
+
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
|
669 |
+
<# } #>
|
670 |
+
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
671 |
+
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate License', 'cartflows' ); ?></a>
|
672 |
+
<# } else { #>
|
673 |
+
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php esc_html_e( 'Get Pro', 'cartflows' ); ?></a>
|
674 |
+
<# } #>
|
675 |
+
</div>
|
676 |
+
</div>
|
677 |
+
</div>
|
678 |
+
</div>
|
679 |
+
<# } #>
|
680 |
+
<# } #>
|
681 |
+
</script>
|
682 |
+
|
683 |
+
<?php
|
684 |
+
// Empty Step.
|
685 |
+
?>
|
686 |
+
<script type="text/template" id="tmpl-cartflows-create-blank-step">
|
687 |
+
<div class="inner">
|
688 |
+
<div class="template">
|
689 |
+
<span class="thumbnail site-preview cartflows-flow-preview">
|
690 |
+
<div class="template-screenshot">
|
691 |
+
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/start-scratch.jpg" />
|
692 |
+
</div>
|
693 |
+
<div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
|
694 |
+
</span>
|
695 |
+
<div class="template-id-container">
|
696 |
+
<h3 class="template-name"> Blank </h3>
|
697 |
+
<div class="template-actions">
|
698 |
+
<a href="#" class="button button-primary cartflows-step-import-blank"><?php esc_html_e( 'Create', 'cartflows' ); ?></a>
|
699 |
+
</div>
|
700 |
+
</div>
|
701 |
+
</div>
|
702 |
+
</div>
|
703 |
+
</script>
|
704 |
+
|
705 |
+
<?php
|
706 |
+
// Templates data.
|
707 |
+
?>
|
708 |
+
<script type="text/template" id="tmpl-cartflows-steps-list">
|
709 |
+
<# if ( data.items.length ) { #>
|
710 |
+
<# for ( key in data.items ) { #>
|
711 |
+
<#
|
712 |
+
var flow_steps = [];
|
713 |
+
if( data.items[ key ].flow_steps ) {
|
714 |
+
flow_steps = data.items[ key ].flow_steps.map(function(value,index) {
|
715 |
+
return value['id'];
|
716 |
+
});
|
717 |
+
}
|
718 |
+
#>
|
719 |
+
<div class="inner">
|
720 |
+
<div class="template">
|
721 |
+
<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 }}">
|
722 |
+
<div class="template-screenshot">
|
723 |
+
<# if( data.items[ key ].featured_image_url ) { #>
|
724 |
+
<img src="{{ data.items[ key ].featured_image_url }}" />
|
725 |
+
<# } else { #>
|
726 |
+
<img src="<?php echo esc_attr( CARTFLOWS_URL ); ?>assets/images/400x400.jpg" />
|
727 |
+
<# } #>
|
728 |
+
</div>
|
729 |
+
<div id="wcf_create_notice" class=""><a href="https://cartflows.com/" target="_blank"></a></div>
|
730 |
+
|
731 |
+
<# if( data.items[ key ].woo_required ) { #>
|
732 |
+
<div class="notice notice-info" style="width: auto;">
|
733 |
+
<p class="wcf-learn-how">
|
734 |
+
Install/Activate WooCommerce to use this template.
|
735 |
+
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
736 |
+
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
|
737 |
+
<i class="dashicons dashicons-external"></i>
|
738 |
+
</a>
|
739 |
+
</p>
|
740 |
+
</div>
|
741 |
+
<# } else { #>
|
742 |
+
<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>
|
743 |
+
<# } #>
|
744 |
+
|
745 |
+
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
746 |
+
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
|
747 |
+
<# } #>
|
748 |
+
</span>
|
749 |
+
<div class="template-id-container">
|
750 |
+
<h3 class="template-name"> {{{ data.items[ key ].title.rendered }}} </h3>
|
751 |
+
<div class="template-actions">
|
752 |
+
|
753 |
+
<#
|
754 |
+
|
755 |
+
var step_slug = data.items[ key ].step_type.slug || '';
|
756 |
+
var step_title = data.items[ key ].step_type.name || '';
|
757 |
+
var import_btn_title = 'Import';
|
758 |
+
|
759 |
+
var required_plugin_group = '';
|
760 |
+
if( data.items[ key ].page_builder ) {
|
761 |
+
required_plugin_group = data.items[ key ].page_builder.slug;
|
762 |
+
|
763 |
+
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 ) {
|
764 |
+
import_btn_title = CartFlowsImportVars.required_plugins[ data.items[ key ].page_builder.slug ].button_title;
|
765 |
+
}
|
766 |
+
}
|
767 |
+
#>
|
768 |
+
|
769 |
+
<# if( data.items[ key ].licence_status && 'valid' === data.items[ key ].licence_status ) { #>
|
770 |
+
|
771 |
+
<# if( ! data.items[ key ].woo_required ) { #>
|
772 |
+
<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>
|
773 |
+
<# } else { #>
|
774 |
+
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
|
775 |
+
<# } #>
|
776 |
+
|
777 |
+
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
778 |
+
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate License', 'cartflows' ); ?></a>
|
779 |
+
<# } else { #>
|
780 |
+
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php esc_html_e( 'Get Pro', 'cartflows' ); ?></a>
|
781 |
+
<# } #>
|
782 |
+
</div>
|
783 |
+
</div>
|
784 |
+
</div>
|
785 |
+
</div>
|
786 |
+
<# } #>
|
787 |
+
<# } #>
|
788 |
+
</script>
|
789 |
+
|
790 |
+
<?php
|
791 |
+
/**
|
792 |
+
* TMPL - Website Unreachable
|
793 |
+
*/
|
794 |
+
?>
|
795 |
+
<script type="text/template" id="tmpl-cartflows-website-unreachable">
|
796 |
+
<div class="postbox cartflows-website-unreachable">
|
797 |
+
<h2><?php esc_html_e( 'Under Maintenance..', 'cartflows' ); ?></h2>
|
798 |
+
<p><?php esc_html_e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly.', 'cartflows' ); ?></p>
|
799 |
+
<p><?php esc_html_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>
|
800 |
+
</div>
|
801 |
+
</script>
|
802 |
+
|
803 |
+
<?php
|
804 |
+
/**
|
805 |
+
* TMPL - Filters
|
806 |
+
*/
|
807 |
+
?>
|
808 |
+
<script type="text/template" id="tmpl-cartflows-page-builder-notice">
|
809 |
+
<?php
|
810 |
+
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
811 |
+
$page_builder = Cartflows_Helper::get_required_plugins_for_page_builder( Cartflows_Helper::get_common_setting( 'default_page_builder' ) );
|
812 |
+
$title = $page_builder['title'];
|
813 |
+
|
814 |
+
$plugin_string = '<a href="#" data-slug="' . esc_html( $default_page_builder ) . '" class="wcf-install-plugin">Please click here and activate ' . esc_html( $title ) . '</a>';
|
815 |
+
$theme_status = '';
|
816 |
+
if ( 'divi' === $default_page_builder ) {
|
817 |
+
|
818 |
+
$theme_status = $page_builder['theme-status'];
|
819 |
+
$plugin_status = $page_builder['plugin-status'];
|
820 |
+
|
821 |
+
if ( 'deactivate' === $theme_status || 'install' === $plugin_status ) {
|
822 |
+
$plugin_string = 'Please activate ' . esc_html( $title );
|
823 |
+
} elseif ( ( 'deactivate' === $theme_status || 'not-installed' === $theme_status ) && 'install' === $plugin_status ) {
|
824 |
+
$plugin_string = 'Please install and activate ' . esc_html( $title );
|
825 |
+
}
|
826 |
+
}
|
827 |
+
?>
|
828 |
+
<div class="wcf-page-builder-message">
|
829 |
+
<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>
|
830 |
+
<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>
|
831 |
+
<p>We plan to add design templates made with more page builder shortly!</p>
|
832 |
+
</div>
|
833 |
+
</script>
|
834 |
+
|
835 |
+
<?php
|
836 |
+
/**
|
837 |
+
* TMPL - Filters
|
838 |
+
*/
|
839 |
+
?>
|
840 |
+
<script type="text/template" id="tmpl-cartflows-term-filters-dropdown">
|
841 |
+
<# if ( data ) { #>
|
842 |
+
<select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
|
843 |
+
<# if ( data.args.show_all ) { #>
|
844 |
+
<option value="all"> <?php esc_html_e( 'All', 'cartflows' ); ?> </option>
|
845 |
+
<# } #>
|
846 |
+
<# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
|
847 |
+
<option value=""> <?php esc_html_e( 'Select Step Type', 'cartflows' ); ?> </option>
|
848 |
+
<# } #>
|
849 |
+
<# var step_slug_data = []; #>
|
850 |
+
<# for ( key in data.items ) { #>
|
851 |
+
<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>
|
852 |
+
|
853 |
+
<# step_slug_data.push( data.items[ key ].slug ); #>
|
854 |
+
|
855 |
+
<# } #>
|
856 |
+
<# if( step_slug_data.indexOf("optin") === -1){ #>
|
857 |
+
<option value='0' data-group='0' class="Optin (Woo)" data-slug="optin" data-title="Optin (Woo)">Optin (Woo)</option>
|
858 |
+
<# } #>
|
859 |
+
</select>
|
860 |
+
<# } #>
|
861 |
+
</script>
|
862 |
+
|
863 |
+
<script type="text/template" id="tmpl-cartflows-term-filters">
|
864 |
+
|
865 |
+
<# if ( data ) { #>
|
866 |
+
|
867 |
+
<?php /* <# if ( CartFlowsImportVars.flow_page_builder === data.args.remote_slug || CartFlowsImportVars.step_page_builder === data.args.remote_slug ) { #> */ ?>
|
868 |
+
<ul class="{{ data.args.wrapper_class }} {{ data.args.class }}">
|
869 |
+
|
870 |
+
<# if ( data.args.show_all ) { #>
|
871 |
+
<li>
|
872 |
+
<a href="#" data-group="all"> All </a>
|
873 |
+
</li>
|
874 |
+
<# } #>
|
875 |
+
|
876 |
+
<# for ( key in data.items ) { #>
|
877 |
+
<li>
|
878 |
+
<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>
|
879 |
+
</li>
|
880 |
+
<# } #>
|
881 |
+
|
882 |
+
</ul>
|
883 |
+
|
884 |
+
<?php
|
885 |
+
|
886 |
+
/**
|
887 |
+
<# } else { #>
|
888 |
+
<select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
|
889 |
+
|
890 |
+
<# if ( data.args.show_all ) { #>
|
891 |
+
<option value="all"> <?php _e( 'All', 'cartflows' ); ?> </option>
|
892 |
+
<# } #>
|
893 |
+
|
894 |
+
<# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
|
895 |
+
<option value=""> <?php _e( 'Select Step Type', 'cartflows' ); ?> </option>
|
896 |
+
<# } #>
|
897 |
+
|
898 |
+
<# for ( key in data.items ) { #>
|
899 |
+
<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>
|
900 |
+
<# } #>
|
901 |
+
|
902 |
+
</select>
|
903 |
+
*/
|
904 |
+
?>
|
905 |
+
|
906 |
+
<?php /* <# } #> */ ?>
|
907 |
+
|
908 |
+
<# } #>
|
909 |
+
</script>
|
910 |
+
|
911 |
+
<?php
|
912 |
+
// Step Type.
|
913 |
+
?>
|
914 |
+
<script type="text/template" id="tmpl-cartflows-step-types">
|
915 |
+
<ul class="wcf-tab nav-tabs">
|
916 |
+
<# if( data.items_count ) { #>
|
917 |
+
<# for( key in data.items ) { #>
|
918 |
+
<# console.log( data.items[ key ].id ) #>
|
919 |
+
<li data-slug="{{data.items[ key ].slug}}" data-title="{{ data.items[ key ].name }}">
|
920 |
+
<a href="#{{{ data.items[ key ].slug }}}">{{{ data.items[ key ].name }}}</a>
|
921 |
+
</li>
|
922 |
+
<# } #>
|
923 |
+
<# } #>
|
924 |
+
</ul>
|
925 |
+
</script>
|
926 |
+
|
927 |
+
<?php
|
928 |
+
// Add to library button.
|
929 |
+
?>
|
930 |
+
<script type="text/template" id="tmpl-templator-add-to-library">
|
931 |
+
<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>
|
932 |
+
</script>
|
933 |
+
<?php
|
934 |
+
}
|
935 |
+
|
936 |
+
/**
|
937 |
+
* Enqueue scripts
|
938 |
+
*
|
939 |
+
* @since 1.0.0
|
940 |
+
*
|
941 |
+
* @hook admin_enqueue_scripts
|
942 |
+
* @param string $hook Current page hook.
|
943 |
+
*/
|
944 |
+
public function scripts( $hook = '' ) {
|
945 |
+
|
946 |
+
if ( ! self::is_supported_post( get_current_screen()->post_type ) ) {
|
947 |
+
return;
|
948 |
+
}
|
949 |
+
|
950 |
+
wp_enqueue_script( 'cartflows-rest-api', CARTFLOWS_URL . 'assets/js/rest-api.js', array( 'jquery' ), CARTFLOWS_VER, true );
|
951 |
+
wp_enqueue_style( 'cartflows-import', CARTFLOWS_URL . 'assets/css/import.css', null, CARTFLOWS_VER, 'all' );
|
952 |
+
wp_style_add_data( 'cartflows-import', 'rtl', 'replace' );
|
953 |
+
wp_enqueue_script( 'cartflows-import', CARTFLOWS_URL . 'assets/js/import.js', array( 'jquery', 'wp-util', 'cartflows-rest-api', 'updates' ), CARTFLOWS_VER, true );
|
954 |
+
|
955 |
+
$installed_plugins = get_plugins();
|
956 |
+
$is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? 'yes' : 'no';
|
957 |
+
$is_wc_activated = wcf()->is_woo_active ? 'yes' : 'no';
|
958 |
+
|
959 |
+
$localize_vars = array(
|
960 |
+
'_is_pro_active' => _is_cartflows_pro(),
|
961 |
+
'is_wc_installed' => $is_wc_installed,
|
962 |
+
'is_wc_activated' => $is_wc_activated,
|
963 |
+
|
964 |
+
// Flow and its rest fields.
|
965 |
+
'flow' => CARTFLOWS_FLOW_POST_TYPE,
|
966 |
+
'flow_fields' => array(
|
967 |
+
'id',
|
968 |
+
'title',
|
969 |
+
'flow_type',
|
970 |
+
'page_builder',
|
971 |
+
'flow_steps',
|
972 |
+
'licence_status',
|
973 |
+
'featured_image_url',
|
974 |
+
'featured_media', // @required for field `featured_image_url`.
|
975 |
+
),
|
976 |
+
|
977 |
+
// Flow type and rest fields.
|
978 |
+
'flow_type' => CARTFLOWS_TAXONOMY_FLOW_CATEGORY,
|
979 |
+
'flow_type_fields' => array(
|
980 |
+
'id',
|
981 |
+
'name',
|
982 |
+
'slug',
|
983 |
+
),
|
984 |
+
|
985 |
+
// Flow page builder and rest fields.
|
986 |
+
'flow_page_builder' => CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER,
|
987 |
+
'flow_page_builder_fields' => array(
|
988 |
+
'id',
|
989 |
+
'name',
|
990 |
+
'slug',
|
991 |
+
),
|
992 |
+
|
993 |
+
// Step page builder and rest fields.
|
994 |
+
'step_page_builder' => CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER,
|
995 |
+
'step_page_builder_fields' => array(
|
996 |
+
'id',
|
997 |
+
'name',
|
998 |
+
'slug',
|
999 |
+
),
|
1000 |
+
|
1001 |
+
// Step and its rest fields.
|
1002 |
+
'step' => CARTFLOWS_STEP_POST_TYPE,
|
1003 |
+
'step_fields' => array(
|
1004 |
+
'title',
|
1005 |
+
'featured_image_url',
|
1006 |
+
'featured_media', // @required for field `featured_image_url`.
|
1007 |
+
'id',
|
1008 |
+
'flow_type',
|
1009 |
+
'step_type',
|
1010 |
+
'page_builder',
|
1011 |
+
'licence_status',
|
1012 |
+
),
|
1013 |
+
|
1014 |
+
// Step type and its rest fields.
|
1015 |
+
'step_type' => CARTFLOWS_TAXONOMY_STEP_TYPE,
|
1016 |
+
'step_type_fields' => array(
|
1017 |
+
'id',
|
1018 |
+
'name',
|
1019 |
+
'slug',
|
1020 |
+
),
|
1021 |
+
|
1022 |
+
'domain_url' => CARTFLOWS_DOMAIN_URL,
|
1023 |
+
'server_url' => CARTFLOWS_TEMPLATES_URL,
|
1024 |
+
'server_rest_url' => CARTFLOWS_TEMPLATES_URL . 'wp-json/wp/v2/',
|
1025 |
+
'site_url' => site_url(),
|
1026 |
+
'import_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_importer' ),
|
1027 |
+
'export_url' => admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&page=flow_exporter' ),
|
1028 |
+
'admin_url' => admin_url(),
|
1029 |
+
'licence_args' => CartFlows_API::get_instance()->get_licence_args(),
|
1030 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
1031 |
+
'debug' => ( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || isset( $_GET['debug'] ) ) ? true : false, //phpcs:ignore
|
1032 |
+
|
1033 |
+
'required_plugins' => Cartflows_Helper::get_plugins_groupby_page_builders(),
|
1034 |
+
|
1035 |
+
'default_page_builder' => Cartflows_Helper::get_common_setting( 'default_page_builder' ),
|
1036 |
+
);
|
1037 |
+
|
1038 |
+
$localize_vars['cartflows_activate_plugin_nonce'] = wp_create_nonce( 'cartflows_activate_plugin' );
|
1039 |
+
|
1040 |
+
// var_dump(Cartflows_Helper::get_common_setting( 'default_page_builder' ));
|
1041 |
+
// wp_die( );
|
1042 |
+
// Add thickbox.
|
1043 |
+
add_thickbox();
|
1044 |
+
|
1045 |
+
wp_localize_script( 'cartflows-import', 'CartFlowsImportVars', $localize_vars );
|
1046 |
+
wp_localize_script( 'cartflows-rest-api', 'CartFlowsImportVars', $localize_vars );
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
/**
|
1050 |
+
* Import.
|
1051 |
+
*
|
1052 |
+
* @since 1.0.0
|
1053 |
+
*
|
1054 |
+
* @hook wp_ajax_cartflows_import_flow_step
|
1055 |
+
* @return void
|
1056 |
+
*/
|
1057 |
+
public function import_flow() {
|
1058 |
+
|
1059 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
1060 |
+
return;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
check_ajax_referer( 'cf-import-flow-step', 'security' );
|
1064 |
+
|
1065 |
+
$flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
|
1066 |
+
$template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
|
1067 |
+
|
1068 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1069 |
+
wcf()->logger->import_log( 'STARTED! Importing FLOW' );
|
1070 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1071 |
+
wcf()->logger->import_log( '(✓) Creating new step from remote step [' . $template_id . '] for FLOW ' . get_the_title( $flow_id ) . ' [' . $flow_id . ']' );
|
1072 |
+
|
1073 |
+
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1074 |
+
|
1075 |
+
$post_content = isset( $response['data']['content']->rendered ) ? $response['data']['content']->rendered : '';
|
1076 |
+
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1077 |
+
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1078 |
+
$post_content = $response['data']['divi_content'];
|
1079 |
+
}
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
if ( false === $response['success'] ) {
|
1083 |
+
wcf()->logger->import_log( '(✕) Failed to fetch remote data.' );
|
1084 |
+
wp_send_json_error( $response );
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
wcf()->logger->import_log( '(✓) Successfully getting remote step response ' . wp_json_encode( $response ) );
|
1088 |
+
|
1089 |
+
$new_step_id = wp_insert_post(
|
1090 |
+
array(
|
1091 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
1092 |
+
'post_title' => $response['title'],
|
1093 |
+
'post_content' => $post_content,
|
1094 |
+
'post_status' => 'publish',
|
1095 |
+
)
|
1096 |
+
);
|
1097 |
+
|
1098 |
+
if ( is_wp_error( $new_step_id ) ) {
|
1099 |
+
wcf()->logger->import_log( '(✕) Failed to create new step for flow ' . $flow_id );
|
1100 |
+
wp_send_json_error( $new_step_id );
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1104 |
+
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1105 |
+
update_post_meta( $new_step_id, 'divi_content', $response['data']['divi_content'] );
|
1106 |
+
}
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
/* Imported Step */
|
1110 |
+
update_post_meta( $new_step_id, 'cartflows_imported_step', 'yes' );
|
1111 |
+
|
1112 |
+
wcf()->logger->import_log( '(✓) Created new step ' . '"' . $response['title'] . '" id ' . $new_step_id );//phpcs:ignore
|
1113 |
+
// insert post meta.
|
1114 |
+
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
1115 |
+
wcf()->logger->import_log( '(✓) Added flow ID ' . $flow_id . ' in post meta key wcf-flow-id.' );
|
1116 |
+
|
1117 |
+
/**
|
1118 |
+
* Import & Set type.
|
1119 |
+
*/
|
1120 |
+
$term = isset( $response['data']['step_type'] ) ? $response['data']['step_type'] : '';
|
1121 |
+
|
1122 |
+
$term_slug = '';
|
1123 |
+
if ( $term ) {
|
1124 |
+
|
1125 |
+
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
1126 |
+
$term_exist = term_exists( $term->slug, $taxonomy );
|
1127 |
+
|
1128 |
+
if ( empty( $term_exist ) ) {
|
1129 |
+
$terms = array(
|
1130 |
+
array(
|
1131 |
+
'name' => $term->name,
|
1132 |
+
'slug' => $term->slug,
|
1133 |
+
),
|
1134 |
+
);
|
1135 |
+
|
1136 |
+
Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
|
1137 |
+
wcf()->logger->import_log( '(✓) Created new term name ' . $term->name . ' | term slug ' . $term->slug );
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
$current_term = term_exists( $term->slug, $taxonomy );
|
1141 |
+
|
1142 |
+
// Set type object.
|
1143 |
+
$data = get_term( $current_term['term_id'], $taxonomy );
|
1144 |
+
$term_slug = $data->slug;
|
1145 |
+
$term_name = $data->name;
|
1146 |
+
wp_set_object_terms( $new_step_id, $term_slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
|
1147 |
+
wcf()->logger->import_log( '(✓) Assigned existing term ' . $term_name . ' to the template ' . $new_step_id );
|
1148 |
+
|
1149 |
+
// Set type.
|
1150 |
+
update_post_meta( $new_step_id, 'wcf-step-type', $term_slug );
|
1151 |
+
wcf()->logger->import_log( '(✓) Updated term ' . $term_name . ' to the post meta wcf-step-type.' );
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
// Set flow.
|
1155 |
+
wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
1156 |
+
wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* Update steps for the current flow.
|
1160 |
+
*/
|
1161 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
1162 |
+
|
1163 |
+
if ( ! is_array( $flow_steps ) ) {
|
1164 |
+
$flow_steps = array();
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
$flow_steps[] = array(
|
1168 |
+
'id' => $new_step_id,
|
1169 |
+
'title' => $response['title'],
|
1170 |
+
'type' => $term_slug,
|
1171 |
+
);
|
1172 |
+
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
|
1173 |
+
wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . wp_json_encode( $flow_steps ) );
|
1174 |
+
|
1175 |
+
// Import Post Meta.
|
1176 |
+
self::import_post_meta( $new_step_id, $response );
|
1177 |
+
|
1178 |
+
wcf()->logger->import_log( '(✓) Importing step "' . get_the_title( $new_step_id ) . '" [' . $new_step_id . '] for FLOW "' . get_the_title( $flow_id ) . '" [' . $flow_id . ']' );
|
1179 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1180 |
+
wcf()->logger->import_log( 'COMPLETE! Importing FLOW' );
|
1181 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1182 |
+
|
1183 |
+
do_action( 'cartflows_import_complete' );
|
1184 |
+
wcf()->logger->import_log( '(✓) BATCH STARTED for step ' . $new_step_id . ' for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
|
1185 |
+
|
1186 |
+
// Batch Process.
|
1187 |
+
do_action( 'cartflows_after_template_import', $new_step_id, $response );
|
1188 |
+
|
1189 |
+
/**
|
1190 |
+
* End
|
1191 |
+
*/
|
1192 |
+
wp_send_json_success( $new_step_id );
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
/**
|
1196 |
+
* Import Step.
|
1197 |
+
*
|
1198 |
+
* @since 1.0.0
|
1199 |
+
* @hook wp_ajax_cartflows_step_import
|
1200 |
+
*
|
1201 |
+
* @return void
|
1202 |
+
*/
|
1203 |
+
public function create_default_flow() {
|
1204 |
+
|
1205 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
1206 |
+
return;
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
check_ajax_referer( 'cf-default-flow', 'security' );
|
1210 |
+
|
1211 |
+
// Create post object.
|
1212 |
+
$new_flow_post = array(
|
1213 |
+
'post_content' => '',
|
1214 |
+
'post_status' => 'publish',
|
1215 |
+
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
1216 |
+
);
|
1217 |
+
|
1218 |
+
// Insert the post into the database.
|
1219 |
+
$flow_id = wp_insert_post( $new_flow_post );
|
1220 |
+
|
1221 |
+
if ( is_wp_error( $flow_id ) ) {
|
1222 |
+
wp_send_json_error( $flow_id->get_error_message() );
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
$flow_steps = array();
|
1226 |
+
|
1227 |
+
if ( wcf()->is_woo_active ) {
|
1228 |
+
$steps_data = array(
|
1229 |
+
'sales' => array(
|
1230 |
+
'title' => __( 'Sales Landing', 'cartflows' ),
|
1231 |
+
'type' => 'landing',
|
1232 |
+
),
|
1233 |
+
'order-form' => array(
|
1234 |
+
'title' => __( 'Checkout (Woo)', 'cartflows' ),
|
1235 |
+
'type' => 'checkout',
|
1236 |
+
),
|
1237 |
+
'order-confirmation' => array(
|
1238 |
+
'title' => __( 'Thank You (Woo)', 'cartflows' ),
|
1239 |
+
'type' => 'thankyou',
|
1240 |
+
),
|
1241 |
+
);
|
1242 |
+
|
1243 |
+
} else {
|
1244 |
+
$steps_data = array(
|
1245 |
+
'landing' => array(
|
1246 |
+
'title' => __( 'Landing', 'cartflows' ),
|
1247 |
+
'type' => 'landing',
|
1248 |
+
),
|
1249 |
+
'thankyou' => array(
|
1250 |
+
'title' => __( 'Thank You', 'cartflows' ),
|
1251 |
+
'type' => 'landing',
|
1252 |
+
),
|
1253 |
+
);
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
foreach ( $steps_data as $slug => $data ) {
|
1257 |
+
|
1258 |
+
$post_content = '';
|
1259 |
+
$step_type = trim( $data['type'] );
|
1260 |
+
|
1261 |
+
$step_id = wp_insert_post(
|
1262 |
+
array(
|
1263 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
1264 |
+
'post_title' => $data['title'],
|
1265 |
+
'post_content' => $post_content,
|
1266 |
+
'post_status' => 'publish',
|
1267 |
+
)
|
1268 |
+
);
|
1269 |
+
|
1270 |
+
if ( is_wp_error( $step_id ) ) {
|
1271 |
+
wp_send_json_error( $step_id->get_error_message() );
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
if ( $step_id ) {
|
1275 |
+
|
1276 |
+
$flow_steps[] = array(
|
1277 |
+
'id' => $step_id,
|
1278 |
+
'title' => $data['title'],
|
1279 |
+
'type' => $step_type,
|
1280 |
+
);
|
1281 |
+
|
1282 |
+
// insert post meta.
|
1283 |
+
update_post_meta( $step_id, 'wcf-flow-id', $flow_id );
|
1284 |
+
update_post_meta( $step_id, 'wcf-step-type', $step_type );
|
1285 |
+
|
1286 |
+
wp_set_object_terms( $step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
|
1287 |
+
wp_set_object_terms( $step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
1288 |
+
|
1289 |
+
update_post_meta( $step_id, '_wp_page_template', 'cartflows-default' );
|
1290 |
+
}
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
|
1294 |
+
|
1295 |
+
wp_send_json_success( $flow_id );
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
/**
|
1299 |
+
* Create Flow
|
1300 |
+
*
|
1301 |
+
* @return void
|
1302 |
+
*/
|
1303 |
+
public function create_flow() {
|
1304 |
+
|
1305 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
1306 |
+
return;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
check_ajax_referer( 'cf-create-flow', 'security' );
|
1310 |
+
|
1311 |
+
// Create post object.
|
1312 |
+
$new_flow_post = array(
|
1313 |
+
'post_content' => '',
|
1314 |
+
'post_status' => 'publish',
|
1315 |
+
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
1316 |
+
);
|
1317 |
+
|
1318 |
+
// Insert the post into the database.
|
1319 |
+
$flow_id = wp_insert_post( $new_flow_post );
|
1320 |
+
|
1321 |
+
if ( is_wp_error( $flow_id ) ) {
|
1322 |
+
wp_send_json_error( $flow_id->get_error_message() );
|
1323 |
+
}
|
1324 |
+
|
1325 |
+
/* Imported Flow */
|
1326 |
+
update_post_meta( $flow_id, 'cartflows_imported_flow', 'yes' );
|
1327 |
+
|
1328 |
+
wp_send_json_success( $flow_id );
|
1329 |
+
}
|
1330 |
+
|
1331 |
+
/**
|
1332 |
+
* Create Step
|
1333 |
+
*
|
1334 |
+
* @return void
|
1335 |
+
*/
|
1336 |
+
public function import_step() {
|
1337 |
+
|
1338 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
1339 |
+
return;
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
check_ajax_referer( 'cf-step-import', 'security' );
|
1343 |
+
|
1344 |
+
$template_id = isset( $_POST['template_id'] ) ? intval( $_POST['template_id'] ) : '';
|
1345 |
+
$flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
|
1346 |
+
$step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( wp_unslash( $_POST['step_title'] ) ) : '';
|
1347 |
+
$step_type = isset( $_POST['step_type'] ) ? sanitize_title( wp_unslash( $_POST['step_type'] ) ) : '';
|
1348 |
+
$step_custom_title = isset( $_POST['step_custom_title'] ) ? sanitize_title( wp_unslash( $_POST['step_custom_title'] ) ) : $step_title;
|
1349 |
+
|
1350 |
+
$cartflow_meta = Cartflows_Flow_Meta::get_instance();
|
1351 |
+
|
1352 |
+
$post_id = $cartflow_meta->create_step( $flow_id, $step_type, $step_custom_title );
|
1353 |
+
|
1354 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1355 |
+
wcf()->logger->import_log( 'STARTED! Importing STEP' );
|
1356 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1357 |
+
|
1358 |
+
if ( empty( $template_id ) || empty( $post_id ) ) {
|
1359 |
+
/* translators: %s: template ID */
|
1360 |
+
$data = sprintf( __( 'Invalid template id %1$s or post id %2$s.', 'cartflows' ), $template_id, $post_id );
|
1361 |
+
wcf()->logger->import_log( $data );
|
1362 |
+
wp_send_json_error( $data );
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
wcf()->logger->import_log( 'Remote Step ' . $template_id . ' for local flow "' . get_the_title( $post_id ) . '" [' . $post_id . ']' );
|
1366 |
+
|
1367 |
+
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1368 |
+
|
1369 |
+
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1370 |
+
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1371 |
+
update_post_meta( $post_id, 'divi_content', $response['data']['divi_content'] );
|
1372 |
+
|
1373 |
+
wp_update_post(
|
1374 |
+
array(
|
1375 |
+
'ID' => $post_id,
|
1376 |
+
'post_content' => $response['data']['divi_content'],
|
1377 |
+
)
|
1378 |
+
);
|
1379 |
+
}
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
/* Imported Step */
|
1383 |
+
update_post_meta( $post_id, 'cartflows_imported_step', 'yes' );
|
1384 |
+
|
1385 |
+
// Import Post Meta.
|
1386 |
+
self::import_post_meta( $post_id, $response );
|
1387 |
+
|
1388 |
+
do_action( 'cartflows_import_complete' );
|
1389 |
+
|
1390 |
+
// Batch Process.
|
1391 |
+
do_action( 'cartflows_after_template_import', $post_id, $response );
|
1392 |
+
|
1393 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1394 |
+
wcf()->logger->import_log( 'COMPLETE! Importing Step' );
|
1395 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1396 |
+
|
1397 |
+
wp_send_json_success( $post_id );
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
/**
|
1401 |
+
* Import Step.
|
1402 |
+
*
|
1403 |
+
* @since 1.0.0
|
1404 |
+
* @hook wp_ajax_cartflows_step_create_blank
|
1405 |
+
*
|
1406 |
+
* @return void
|
1407 |
+
*/
|
1408 |
+
public function step_create_blank() {
|
1409 |
+
|
1410 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
1411 |
+
return;
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
check_ajax_referer( 'cf-step-create-blank', 'security' );
|
1415 |
+
|
1416 |
+
$flow_id = isset( $_POST['flow_id'] ) ? intval( $_POST['flow_id'] ) : '';
|
1417 |
+
$step_type = isset( $_POST['step_type'] ) ? sanitize_text_field( wp_unslash( $_POST['step_type'] ) ) : '';
|
1418 |
+
$step_title = isset( $_POST['step_title'] ) ? sanitize_text_field( wp_unslash( $_POST['step_title'] ) ) : '';
|
1419 |
+
|
1420 |
+
if ( empty( $flow_id ) || empty( $step_type ) ) {
|
1421 |
+
/* translators: %s: flow ID */
|
1422 |
+
$data = sprintf( __( 'Invalid flow id %1$s OR step type %2$s.', 'cartflows' ), $flow_id, $step_type );
|
1423 |
+
wcf()->logger->import_log( $data );
|
1424 |
+
wp_send_json_error( $data );
|
1425 |
+
}
|
1426 |
+
|
1427 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1428 |
+
wcf()->logger->import_log( 'STARTED! Creating Blank STEP for Flow ' . $flow_id );
|
1429 |
+
|
1430 |
+
$step_type_title = str_replace( '-', ' ', $step_type );
|
1431 |
+
$step_type_slug = strtolower( str_replace( '-', ' ', $step_type ) );
|
1432 |
+
|
1433 |
+
$new_step_id = wp_insert_post(
|
1434 |
+
array(
|
1435 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
1436 |
+
'post_title' => $step_title,
|
1437 |
+
'post_content' => '',
|
1438 |
+
'post_status' => 'publish',
|
1439 |
+
)
|
1440 |
+
);
|
1441 |
+
|
1442 |
+
// insert post meta.
|
1443 |
+
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
1444 |
+
|
1445 |
+
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
1446 |
+
$term_exist = term_exists( $step_type_slug, $taxonomy );
|
1447 |
+
|
1448 |
+
if ( empty( $term_exist ) ) {
|
1449 |
+
$terms = array(
|
1450 |
+
array(
|
1451 |
+
'name' => $step_type_title,
|
1452 |
+
'slug' => $step_type_slug,
|
1453 |
+
),
|
1454 |
+
);
|
1455 |
+
|
1456 |
+
Cartflows_Step_Post_Type::get_instance()->add_terms( $taxonomy, $terms );
|
1457 |
+
wcf()->logger->import_log( '(✓) Created new term name ' . $step_type_title . ' | term slug ' . $step_type_slug );
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
$current_term = term_exists( $step_type_slug, $taxonomy );
|
1461 |
+
|
1462 |
+
// Set type object.
|
1463 |
+
$data = get_term( $current_term['term_id'], $taxonomy );
|
1464 |
+
$step_slug = $data->slug;
|
1465 |
+
wp_set_object_terms( $new_step_id, $data->slug, CARTFLOWS_TAXONOMY_STEP_TYPE );
|
1466 |
+
wcf()->logger->import_log( '(✓) Assigned existing term ' . $step_type_title . ' to the template ' . $new_step_id );
|
1467 |
+
|
1468 |
+
// Set Default page Layout.
|
1469 |
+
update_post_meta( $new_step_id, '_wp_page_template', 'cartflows-default' );
|
1470 |
+
|
1471 |
+
// Set type.
|
1472 |
+
update_post_meta( $new_step_id, 'wcf-step-type', $data->slug );
|
1473 |
+
wcf()->logger->import_log( '(✓) Updated term ' . $data->name . ' to the post meta wcf-step-type.' );
|
1474 |
+
|
1475 |
+
// Set flow.
|
1476 |
+
wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
1477 |
+
wcf()->logger->import_log( '(✓) Assigned flow step flow-' . $flow_id );
|
1478 |
+
|
1479 |
+
self::get_instance()->set_step_to_flow( $flow_id, $new_step_id, $step_type_title, $step_slug );
|
1480 |
+
|
1481 |
+
wcf()->logger->import_log( 'COMPLETE! Creating Blank STEP for Flow ' . $flow_id );
|
1482 |
+
wcf()->logger->import_log( '------------------------------------' );
|
1483 |
+
|
1484 |
+
wp_send_json_success( $new_step_id );
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
/**
|
1488 |
+
* Import Post Meta
|
1489 |
+
*
|
1490 |
+
* @since 1.0.0
|
1491 |
+
*
|
1492 |
+
* @param integer $post_id Post ID.
|
1493 |
+
* @param array $response Post meta.
|
1494 |
+
* @return void
|
1495 |
+
*/
|
1496 |
+
public static function import_post_meta( $post_id, $response ) {
|
1497 |
+
|
1498 |
+
$metadata = (array) $response['post_meta'];
|
1499 |
+
|
1500 |
+
foreach ( $metadata as $meta_key => $meta_value ) {
|
1501 |
+
$meta_value = isset( $meta_value[0] ) ? $meta_value[0] : '';
|
1502 |
+
|
1503 |
+
if ( $meta_value ) {
|
1504 |
+
|
1505 |
+
if ( is_serialized( $meta_value, true ) ) {
|
1506 |
+
$raw_data = maybe_unserialize( stripslashes( $meta_value ) );
|
1507 |
+
} elseif ( is_array( $meta_value ) ) {
|
1508 |
+
$raw_data = json_decode( stripslashes( $meta_value ), true );
|
1509 |
+
} else {
|
1510 |
+
$raw_data = $meta_value;
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
if ( '_elementor_data' === $meta_key ) {
|
1514 |
+
if ( is_array( $raw_data ) ) {
|
1515 |
+
$raw_data = wp_slash( wp_json_encode( $raw_data ) );
|
1516 |
+
} else {
|
1517 |
+
$raw_data = wp_slash( $raw_data );
|
1518 |
+
}
|
1519 |
+
}
|
1520 |
+
if ( '_elementor_data' !== $meta_key && '_elementor_draft' !== $meta_key && '_fl_builder_data' !== $meta_key && '_fl_builder_draft' !== $meta_key ) {
|
1521 |
+
if ( is_array( $raw_data ) ) {
|
1522 |
+
wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . wp_json_encode( $raw_data ) );
|
1523 |
+
} else {
|
1524 |
+
if ( ! is_object( $raw_data ) ) {
|
1525 |
+
wcf()->logger->import_log( '(✓) Added post meta ' . $meta_key . ' | ' . $raw_data );
|
1526 |
+
}
|
1527 |
+
}
|
1528 |
+
}
|
1529 |
+
|
1530 |
+
update_post_meta( $post_id, $meta_key, $raw_data );
|
1531 |
+
}
|
1532 |
+
}
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
/**
|
1536 |
+
* Import Template for Elementor
|
1537 |
+
*
|
1538 |
+
* @since 1.0.0
|
1539 |
+
*
|
1540 |
+
* @param integer $post_id Post ID.
|
1541 |
+
* @param array $response Post meta.
|
1542 |
+
* @param array $page_build_data Page build data.
|
1543 |
+
* @return void
|
1544 |
+
*/
|
1545 |
+
public static function import_template_elementor( $post_id, $response, $page_build_data ) {
|
1546 |
+
if ( ! is_plugin_active( 'elementor/elementor.php' ) ) {
|
1547 |
+
$data = __( 'Elementor is not activated. Please activate plugin Elementor Page Builder to import the step.', 'cartflows' );
|
1548 |
+
wcf()->logger->import_log( $data );
|
1549 |
+
wp_send_json_error( $data );
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
|
1553 |
+
|
1554 |
+
wcf()->logger->import_log( '# Started "importing page builder data" for step ' . $post_id );
|
1555 |
+
|
1556 |
+
$obj = new \Elementor\TemplateLibrary\CartFlows_Importer_Elementor();
|
1557 |
+
$obj->import_single_template( $post_id );
|
1558 |
+
|
1559 |
+
wcf()->logger->import_log( '# Complete "importing page builder data" for step ' . $post_id );
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
/**
|
1563 |
+
* Supported post types
|
1564 |
+
*
|
1565 |
+
* @since 1.0.0
|
1566 |
+
*
|
1567 |
+
* @return array Supported post types.
|
1568 |
+
*/
|
1569 |
+
public static function supported_post_types() {
|
1570 |
+
return apply_filters(
|
1571 |
+
'cartflows_supported_post_types',
|
1572 |
+
array(
|
1573 |
+
CARTFLOWS_FLOW_POST_TYPE,
|
1574 |
+
)
|
1575 |
+
);
|
1576 |
+
}
|
1577 |
+
|
1578 |
+
/**
|
1579 |
+
* Check supported post type
|
1580 |
+
*
|
1581 |
+
* @since 1.0.0
|
1582 |
+
*
|
1583 |
+
* @param string $post_type Post type.
|
1584 |
+
* @return boolean Supported post type status.
|
1585 |
+
*/
|
1586 |
+
public static function is_supported_post( $post_type = '' ) {
|
1587 |
+
|
1588 |
+
if ( in_array( $post_type, self::supported_post_types(), true ) ) {
|
1589 |
+
return true;
|
1590 |
+
}
|
1591 |
+
|
1592 |
+
return false;
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
/**
|
1596 |
+
* Set steps to the flow
|
1597 |
+
*
|
1598 |
+
* @param integer $flow_id Flow ID.
|
1599 |
+
* @param integer $new_step_id New step ID.
|
1600 |
+
* @param string $step_title Flow Type.
|
1601 |
+
* @param string $step_slug Flow Type.
|
1602 |
+
*/
|
1603 |
+
public function set_step_to_flow( $flow_id, $new_step_id, $step_title, $step_slug ) {
|
1604 |
+
// Update steps for the current flow.
|
1605 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
1606 |
+
|
1607 |
+
if ( ! is_array( $flow_steps ) ) {
|
1608 |
+
$flow_steps = array();
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
$flow_steps[] = array(
|
1612 |
+
'id' => $new_step_id,
|
1613 |
+
'title' => $step_title,
|
1614 |
+
'type' => $step_slug,
|
1615 |
+
);
|
1616 |
+
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
|
1617 |
+
wcf()->logger->import_log( '(✓) Updated flow steps post meta key \'wcf-steps\' ' . wp_json_encode( $flow_steps ) );
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
/**
|
1621 |
+
* Localize variables in admin
|
1622 |
+
*
|
1623 |
+
* @param array $vars variables.
|
1624 |
+
*/
|
1625 |
+
public function localize_vars( $vars ) {
|
1626 |
+
|
1627 |
+
$ajax_actions = array(
|
1628 |
+
'cf_step_import',
|
1629 |
+
'cf_load_steps',
|
1630 |
+
'cf_create_flow',
|
1631 |
+
'cf_default_flow',
|
1632 |
+
'cf_step_create_blank',
|
1633 |
+
'cf_import_flow_step',
|
1634 |
+
);
|
1635 |
+
|
1636 |
+
foreach ( $ajax_actions as $action ) {
|
1637 |
+
|
1638 |
+
$vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
return $vars;
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
/**
|
1645 |
+
* Ajax action to activate plugin
|
1646 |
+
*/
|
1647 |
+
public function activate_plugin() {
|
1648 |
+
|
1649 |
+
if ( ! check_ajax_referer( 'cartflows_activate_plugin', 'security', false ) ) {
|
1650 |
+
wp_send_json_error( esc_html__( 'Action failed. Invalid Security Nonce.', 'cartflows' ) );
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
if ( ! current_user_can( 'activate_plugins' ) ) {
|
1654 |
+
wp_send_json_error(
|
1655 |
+
array(
|
1656 |
+
'success' => false,
|
1657 |
+
'message' => __( 'User have not plugin install permissions.', 'cartflows' ),
|
1658 |
+
)
|
1659 |
+
);
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
$plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_init'] ) ) : '';
|
1663 |
+
|
1664 |
+
$activate = activate_plugin( $plugin_init, '', false, true );
|
1665 |
+
|
1666 |
+
if ( is_wp_error( $activate ) ) {
|
1667 |
+
wp_send_json_error(
|
1668 |
+
array(
|
1669 |
+
'success' => false,
|
1670 |
+
'message' => $activate->get_error_message(),
|
1671 |
+
'init' => $plugin_init,
|
1672 |
+
)
|
1673 |
+
);
|
1674 |
+
}
|
1675 |
+
|
1676 |
+
wp_send_json_success(
|
1677 |
+
array(
|
1678 |
+
'success' => true,
|
1679 |
+
'message' => __( 'Plugin Successfully Activated', 'cartflows' ),
|
1680 |
+
'init' => $plugin_init,
|
1681 |
+
)
|
1682 |
+
);
|
1683 |
+
}
|
1684 |
+
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
/**
|
1688 |
+
* Initialize class object with 'get_instance()' method
|
1689 |
+
*/
|
1690 |
+
CartFlows_Importer::get_instance();
|
1691 |
+
|
1692 |
+
endif;
|
|
|
|
classes/class-cartflows-loader.php
CHANGED
@@ -125,7 +125,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
|
|
125 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
126 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
127 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
128 |
-
define( 'CARTFLOWS_VER', '1.5.
|
129 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
130 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
131 |
|
125 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
126 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
127 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
128 |
+
define( 'CARTFLOWS_VER', '1.5.4' );
|
129 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
130 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
131 |
|
classes/class-cartflows-meta-fields.php
CHANGED
@@ -168,7 +168,7 @@ class Cartflows_Meta_Fields {
|
|
168 |
array(
|
169 |
's' => $search_string,
|
170 |
'post_type' => 'page',
|
171 |
-
'posts_per_page' => -
|
172 |
)
|
173 |
);
|
174 |
|
168 |
array(
|
169 |
's' => $search_string,
|
170 |
'post_type' => 'page',
|
171 |
+
'posts_per_page' => -1,
|
172 |
)
|
173 |
);
|
174 |
|
classes/class-cartflows-wizard.php
CHANGED
@@ -1,679 +1,688 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CartFlows- Onboarding Wizard
|
4 |
-
*
|
5 |
-
* @package cartflows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
13 |
-
|
14 |
-
/**
|
15 |
-
* CartFlows_Wizard class.
|
16 |
-
*/
|
17 |
-
class CartFlows_Wizard {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Hook in tabs.
|
21 |
-
*/
|
22 |
-
public function __construct() {
|
23 |
-
|
24 |
-
if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
|
25 |
-
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
26 |
-
add_action( 'admin_init', array( $this, 'setup_wizard' ) );
|
27 |
-
add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
|
28 |
-
add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
|
29 |
-
add_action( 'wp_ajax_page_builder_save_option', array( $this, 'save_page_builder_option' ) );
|
30 |
-
add_action( 'admin_head', array( $this, 'add_mautic_form_script' ) );
|
31 |
-
add_action( 'woocommerce_installed', array( $this, 'disable_woo_setup_redirect' ) );
|
32 |
-
|
33 |
-
add_action( 'wp_ajax_wcf_activate_wc_plugins', array( $this, 'activate_wc_plugins' ) );
|
34 |
-
|
35 |
-
add_action( 'admin_init', array( $this, 'hide_notices' ) );
|
36 |
-
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Hide a notice if the GET variable is set.
|
43 |
-
*/
|
44 |
-
public function hide_notices() {
|
45 |
-
|
46 |
-
if ( ! isset( $_GET['wcf-hide-notice'] ) ) {
|
47 |
-
return;
|
48 |
-
}
|
49 |
-
|
50 |
-
$wcf_hide_notice = filter_input( INPUT_GET, 'wcf-hide-notice', FILTER_SANITIZE_STRING );
|
51 |
-
$_wcf_notice_nonce = filter_input( INPUT_GET, '_wcf_notice_nonce', FILTER_SANITIZE_STRING );
|
52 |
-
|
53 |
-
if ( $wcf_hide_notice && $_wcf_notice_nonce && wp_verify_nonce( sanitize_text_field( wp_unslash( $_wcf_notice_nonce ) ), 'wcf_hide_notices_nonce' ) ) {
|
54 |
-
update_option( 'wcf_setup_skipped', true );
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Disable the woo redirect for new setup.
|
60 |
-
*/
|
61 |
-
public function disable_woo_setup_redirect() {
|
62 |
-
|
63 |
-
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
64 |
-
return;
|
65 |
-
}
|
66 |
-
|
67 |
-
delete_transient( '_wc_activation_redirect' );
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Show action links on the plugin screen.
|
72 |
-
*
|
73 |
-
* @since 1.0.0
|
74 |
-
* @return void
|
75 |
-
*/
|
76 |
-
public function show_setup_wizard() {
|
77 |
-
|
78 |
-
$status = get_option( 'wcf_setup_complete', false );
|
79 |
-
$skip_setup = get_option( 'wcf_setup_skipped', false );
|
80 |
-
|
81 |
-
if ( false === $status && ! $skip_setup ) { ?>
|
82 |
-
<div class="notice notice-info">
|
83 |
-
<p><b><?php esc_html_e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
|
84 |
-
<p><?php esc_html_e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
|
85 |
-
<p>
|
86 |
-
<a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php esc_html_e( 'Start Wizard', 'cartflows' ); ?></a>
|
87 |
-
<a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'cartflows' ); ?></a>
|
88 |
-
</p>
|
89 |
-
</div>
|
90 |
-
<?php
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Add admin menus/screens.
|
96 |
-
*/
|
97 |
-
public function admin_menus() {
|
98 |
-
|
99 |
-
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
|
103 |
-
add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Show the setup wizard.
|
108 |
-
*/
|
109 |
-
public function setup_wizard() {
|
110 |
-
|
111 |
-
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
112 |
-
return;
|
113 |
-
}
|
114 |
-
|
115 |
-
$this->steps = array(
|
116 |
-
'basic-config' => array(
|
117 |
-
'name' => __( 'Welcome', 'cartflows' ),
|
118 |
-
'view' => array( $this, 'welcome_step' ),
|
119 |
-
'handler' => array( $this, 'welcome_step_save' ),
|
120 |
-
),
|
121 |
-
'page-builder' => array(
|
122 |
-
'name' => __( 'Page Builder', 'cartflows' ),
|
123 |
-
'view' => array( $this, 'page_builder_step' ),
|
124 |
-
),
|
125 |
-
'checkout' => array(
|
126 |
-
'name' => __( 'Checkout', 'cartflows' ),
|
127 |
-
'view' => array( $this, 'checkout_step' ),
|
128 |
-
),
|
129 |
-
'training' => array(
|
130 |
-
'name' => __( 'Training', 'cartflows' ),
|
131 |
-
'view' => array( $this, 'training_step' ),
|
132 |
-
),
|
133 |
-
'setup-ready' => array(
|
134 |
-
'name' => __( 'Ready!', 'cartflows' ),
|
135 |
-
'view' => array( $this, 'ready_step' ),
|
136 |
-
'handler' => '',
|
137 |
-
),
|
138 |
-
);
|
139 |
-
|
140 |
-
$this->step = isset( $_GET['step'] ) ? sanitize_text_field( $_GET['step'] ) : current( array_keys( $this->steps ) ); //phpcs:ignore
|
141 |
-
|
142 |
-
wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
|
143 |
-
wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
|
144 |
-
|
145 |
-
wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
|
146 |
-
|
147 |
-
wp_localize_script( 'cartflows-setup', 'cartflows_setup_vars', self::localize_vars() );
|
148 |
-
|
149 |
-
wp_enqueue_media();
|
150 |
-
|
151 |
-
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { //phpcs:ignore
|
152 |
-
call_user_func( $this->steps[ $this->step ]['handler'] );
|
153 |
-
}
|
154 |
-
|
155 |
-
ob_start();
|
156 |
-
$this->setup_wizard_header();
|
157 |
-
$this->setup_wizard_steps();
|
158 |
-
$this->setup_wizard_content();
|
159 |
-
$this->setup_wizard_footer();
|
160 |
-
exit;
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Get current step slug
|
165 |
-
*/
|
166 |
-
public function get_current_step_slug() {
|
167 |
-
$keys = array_keys( $this->steps );
|
168 |
-
return $keys[ array_search( $this->step, array_keys( $this->steps ), true ) ];
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Get previous step link
|
173 |
-
*/
|
174 |
-
public function get_prev_step_link() {
|
175 |
-
$keys = array_keys( $this->steps );
|
176 |
-
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) - 1 ] );
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Get next step link
|
181 |
-
*/
|
182 |
-
public function get_next_step_link() {
|
183 |
-
$keys = array_keys( $this->steps );
|
184 |
-
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ] );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Get next step link
|
189 |
-
*/
|
190 |
-
public function get_next_step_plain_link() {
|
191 |
-
$keys = array_keys( $this->steps );
|
192 |
-
$step_index = array_search( $this->step, $keys, true );
|
193 |
-
$step_index = ( count( $keys ) == $step_index + 1 ) ? $step_index : $step_index + 1;
|
194 |
-
$step = $keys[ $step_index ];
|
195 |
-
return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Setup Wizard Header.
|
200 |
-
*/
|
201 |
-
public function setup_wizard_header() {
|
202 |
-
|
203 |
-
|
204 |
-
<html
|
205 |
-
<
|
206 |
-
|
207 |
-
<meta
|
208 |
-
<
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
var
|
214 |
-
|
215 |
-
|
216 |
-
<?php
|
217 |
-
<?php do_action( '
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
</
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
$
|
253 |
-
|
254 |
-
|
255 |
-
$
|
256 |
-
|
257 |
-
|
258 |
-
$
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
<?php
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
<
|
289 |
-
<
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
<
|
323 |
-
<
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
$
|
333 |
-
|
334 |
-
|
335 |
-
'
|
336 |
-
'
|
337 |
-
|
338 |
-
'
|
339 |
-
'
|
340 |
-
'
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
'
|
346 |
-
'
|
347 |
-
|
348 |
-
'
|
349 |
-
'
|
350 |
-
'
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
'
|
356 |
-
'
|
357 |
-
|
358 |
-
'
|
359 |
-
'
|
360 |
-
'
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
'
|
366 |
-
'
|
367 |
-
|
368 |
-
'
|
369 |
-
'
|
370 |
-
'
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
<
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
<
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
<a href="
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
$
|
408 |
-
$
|
409 |
-
$
|
410 |
-
$
|
411 |
-
|
412 |
-
|
413 |
-
<
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
<
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
<a
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
'
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
'
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
'
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
$
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
</div>
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
var
|
668 |
-
var
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CartFlows- Onboarding Wizard
|
4 |
+
*
|
5 |
+
* @package cartflows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
13 |
+
|
14 |
+
/**
|
15 |
+
* CartFlows_Wizard class.
|
16 |
+
*/
|
17 |
+
class CartFlows_Wizard {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Hook in tabs.
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
|
24 |
+
if ( apply_filters( 'cartflows_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
|
25 |
+
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
26 |
+
add_action( 'admin_init', array( $this, 'setup_wizard' ) );
|
27 |
+
add_action( 'admin_notices', array( $this, 'show_setup_wizard' ) );
|
28 |
+
add_action( 'wp_ajax_page_builder_step_save', array( $this, 'page_builder_step_save' ) );
|
29 |
+
add_action( 'wp_ajax_page_builder_save_option', array( $this, 'save_page_builder_option' ) );
|
30 |
+
add_action( 'admin_head', array( $this, 'add_mautic_form_script' ) );
|
31 |
+
add_action( 'woocommerce_installed', array( $this, 'disable_woo_setup_redirect' ) );
|
32 |
+
|
33 |
+
add_action( 'wp_ajax_wcf_activate_wc_plugins', array( $this, 'activate_wc_plugins' ) );
|
34 |
+
|
35 |
+
add_action( 'admin_init', array( $this, 'hide_notices' ) );
|
36 |
+
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Hide a notice if the GET variable is set.
|
43 |
+
*/
|
44 |
+
public function hide_notices() {
|
45 |
+
|
46 |
+
if ( ! isset( $_GET['wcf-hide-notice'] ) ) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
$wcf_hide_notice = filter_input( INPUT_GET, 'wcf-hide-notice', FILTER_SANITIZE_STRING );
|
51 |
+
$_wcf_notice_nonce = filter_input( INPUT_GET, '_wcf_notice_nonce', FILTER_SANITIZE_STRING );
|
52 |
+
|
53 |
+
if ( $wcf_hide_notice && $_wcf_notice_nonce && wp_verify_nonce( sanitize_text_field( wp_unslash( $_wcf_notice_nonce ) ), 'wcf_hide_notices_nonce' ) ) {
|
54 |
+
update_option( 'wcf_setup_skipped', true );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Disable the woo redirect for new setup.
|
60 |
+
*/
|
61 |
+
public function disable_woo_setup_redirect() {
|
62 |
+
|
63 |
+
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
delete_transient( '_wc_activation_redirect' );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Show action links on the plugin screen.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
public function show_setup_wizard() {
|
77 |
+
|
78 |
+
$status = get_option( 'wcf_setup_complete', false );
|
79 |
+
$skip_setup = get_option( 'wcf_setup_skipped', false );
|
80 |
+
|
81 |
+
if ( false === $status && ! $skip_setup ) { ?>
|
82 |
+
<div class="notice notice-info">
|
83 |
+
<p><b><?php esc_html_e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
|
84 |
+
<p><?php esc_html_e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
|
85 |
+
<p>
|
86 |
+
<a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php esc_html_e( 'Start Wizard', 'cartflows' ); ?></a>
|
87 |
+
<a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'cartflows' ); ?></a>
|
88 |
+
</p>
|
89 |
+
</div>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Add admin menus/screens.
|
96 |
+
*/
|
97 |
+
public function admin_menus() {
|
98 |
+
|
99 |
+
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
|
103 |
+
add_dashboard_page( '', '', 'manage_options', 'cartflow-setup', '' );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Show the setup wizard.
|
108 |
+
*/
|
109 |
+
public function setup_wizard() {
|
110 |
+
|
111 |
+
if ( empty( $_GET['page'] ) || 'cartflow-setup' !== $_GET['page'] ) { //phpcs:ignore
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
|
115 |
+
$this->steps = array(
|
116 |
+
'basic-config' => array(
|
117 |
+
'name' => __( 'Welcome', 'cartflows' ),
|
118 |
+
'view' => array( $this, 'welcome_step' ),
|
119 |
+
'handler' => array( $this, 'welcome_step_save' ),
|
120 |
+
),
|
121 |
+
'page-builder' => array(
|
122 |
+
'name' => __( 'Page Builder', 'cartflows' ),
|
123 |
+
'view' => array( $this, 'page_builder_step' ),
|
124 |
+
),
|
125 |
+
'checkout' => array(
|
126 |
+
'name' => __( 'Checkout', 'cartflows' ),
|
127 |
+
'view' => array( $this, 'checkout_step' ),
|
128 |
+
),
|
129 |
+
'training' => array(
|
130 |
+
'name' => __( 'Training', 'cartflows' ),
|
131 |
+
'view' => array( $this, 'training_step' ),
|
132 |
+
),
|
133 |
+
'setup-ready' => array(
|
134 |
+
'name' => __( 'Ready!', 'cartflows' ),
|
135 |
+
'view' => array( $this, 'ready_step' ),
|
136 |
+
'handler' => '',
|
137 |
+
),
|
138 |
+
);
|
139 |
+
|
140 |
+
$this->step = isset( $_GET['step'] ) ? sanitize_text_field( $_GET['step'] ) : current( array_keys( $this->steps ) ); //phpcs:ignore
|
141 |
+
|
142 |
+
wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
|
143 |
+
wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
|
144 |
+
|
145 |
+
wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
|
146 |
+
|
147 |
+
wp_localize_script( 'cartflows-setup', 'cartflows_setup_vars', self::localize_vars() );
|
148 |
+
|
149 |
+
wp_enqueue_media();
|
150 |
+
|
151 |
+
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { //phpcs:ignore
|
152 |
+
call_user_func( $this->steps[ $this->step ]['handler'] );
|
153 |
+
}
|
154 |
+
|
155 |
+
ob_start();
|
156 |
+
$this->setup_wizard_header();
|
157 |
+
$this->setup_wizard_steps();
|
158 |
+
$this->setup_wizard_content();
|
159 |
+
$this->setup_wizard_footer();
|
160 |
+
exit;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Get current step slug
|
165 |
+
*/
|
166 |
+
public function get_current_step_slug() {
|
167 |
+
$keys = array_keys( $this->steps );
|
168 |
+
return $keys[ array_search( $this->step, array_keys( $this->steps ), true ) ];
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Get previous step link
|
173 |
+
*/
|
174 |
+
public function get_prev_step_link() {
|
175 |
+
$keys = array_keys( $this->steps );
|
176 |
+
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) - 1 ] );
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Get next step link
|
181 |
+
*/
|
182 |
+
public function get_next_step_link() {
|
183 |
+
$keys = array_keys( $this->steps );
|
184 |
+
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ] );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Get next step link
|
189 |
+
*/
|
190 |
+
public function get_next_step_plain_link() {
|
191 |
+
$keys = array_keys( $this->steps );
|
192 |
+
$step_index = array_search( $this->step, $keys, true );
|
193 |
+
$step_index = ( count( $keys ) == $step_index + 1 ) ? $step_index : $step_index + 1;
|
194 |
+
$step = $keys[ $step_index ];
|
195 |
+
return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Setup Wizard Header.
|
200 |
+
*/
|
201 |
+
public function setup_wizard_header() {
|
202 |
+
set_current_screen();
|
203 |
+
?>
|
204 |
+
<html <?php language_attributes(); ?>>
|
205 |
+
<html>
|
206 |
+
<head>
|
207 |
+
<meta name="viewport" content="width=device-width" />
|
208 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
209 |
+
<title><?php esc_html_e( 'CartFlows Setup', 'cartflows' ); ?></title>
|
210 |
+
|
211 |
+
<script type="text/javascript">
|
212 |
+
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();}}};
|
213 |
+
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
|
214 |
+
var pagenow = '';
|
215 |
+
</script>
|
216 |
+
<?php wp_print_scripts( array( 'cartflows-setup' ) ); ?>
|
217 |
+
<?php do_action( 'admin_print_styles' ); ?>
|
218 |
+
<?php do_action( 'admin_head' ); ?>
|
219 |
+
</head>
|
220 |
+
<body class="cartflows-setup wp-core-ui cartflows-step-<?php echo esc_attr( $this->get_current_step_slug() ); ?>">
|
221 |
+
<div id="cartflows-logo">
|
222 |
+
<img height="40" class="wcf-logo" src="<?php echo CARTFLOWS_URL . 'assets/images/cartflows-logo.svg'; ?>" />
|
223 |
+
</div>
|
224 |
+
<?php
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Setup Wizard Footer.
|
229 |
+
*/
|
230 |
+
public function setup_wizard_footer() {
|
231 |
+
|
232 |
+
$admin_url = admin_url( 'admin.php?page=cartflows_settings' );
|
233 |
+
?>
|
234 |
+
<div class="close-button-wrapper">
|
235 |
+
<a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
|
236 |
+
</div>
|
237 |
+
</body>
|
238 |
+
</html>
|
239 |
+
<?php
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Output the steps.
|
244 |
+
*/
|
245 |
+
public function setup_wizard_steps() {
|
246 |
+
|
247 |
+
$ouput_steps = $this->steps;
|
248 |
+
?>
|
249 |
+
<ol class="cartflows-setup-steps">
|
250 |
+
<?php
|
251 |
+
foreach ( $ouput_steps as $step_key => $step ) :
|
252 |
+
$classes = '';
|
253 |
+
$activated = false;
|
254 |
+
if ( $step_key === $this->step ) {
|
255 |
+
$classes = 'active';
|
256 |
+
$activated = true;
|
257 |
+
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
|
258 |
+
$classes = 'done';
|
259 |
+
$activated = true;
|
260 |
+
}
|
261 |
+
?>
|
262 |
+
<li class="<?php echo esc_attr( $classes ); ?>">
|
263 |
+
<span><?php echo esc_html( $step['name'] ); ?></span>
|
264 |
+
</li>
|
265 |
+
<?php endforeach; ?>
|
266 |
+
</ol>
|
267 |
+
<?php
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Output the content for the current step.
|
272 |
+
*/
|
273 |
+
public function setup_wizard_content() {
|
274 |
+
?>
|
275 |
+
<input type="hidden" class="wcf-redirect-link" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" >
|
276 |
+
<?php
|
277 |
+
|
278 |
+
echo '<div class="cartflows-setup-content">';
|
279 |
+
call_user_func( $this->steps[ $this->step ]['view'] );
|
280 |
+
echo '</div>';
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Introduction step.
|
285 |
+
*/
|
286 |
+
public function welcome_step() {
|
287 |
+
?>
|
288 |
+
<h1><?php esc_html_e( 'Welcome to CartFlows!', 'cartflows' ); ?></h1>
|
289 |
+
<p><?php esc_html_e( 'Thank you for choosing CartFlows to get more leads, increase conversions, & maximize profits. This short setup wizard will guide you though configuring CartFlows and creating your first funnel.', 'cartflows' ); ?></p>
|
290 |
+
<form method="post">
|
291 |
+
<div class="cartflows-setup-actions step">
|
292 |
+
<div class="button-prev-wrap">
|
293 |
+
</div>
|
294 |
+
<div class="button-next-wrap">
|
295 |
+
<input type="submit" class="uct-activate button-primary button button-large " value="<?php esc_html_e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
|
296 |
+
</div>
|
297 |
+
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
298 |
+
</div>
|
299 |
+
</form>
|
300 |
+
<?php
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Save Locale Settings.
|
305 |
+
*/
|
306 |
+
public function welcome_step_save() {
|
307 |
+
check_admin_referer( 'cartflow-setup' );
|
308 |
+
|
309 |
+
// Update site title & tagline.
|
310 |
+
$redirect_url = $this->get_next_step_link();
|
311 |
+
|
312 |
+
wp_safe_redirect( esc_url_raw( $redirect_url ) );
|
313 |
+
exit;
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Locale settings
|
318 |
+
*/
|
319 |
+
public function page_builder_step() {
|
320 |
+
?>
|
321 |
+
|
322 |
+
<h1><?php esc_html_e( 'Page Builder Setup', 'cartflows' ); ?></h1>
|
323 |
+
<p class="description"><?php esc_html_e( 'Please select a page builder you would like to use with CartFlows.', 'cartflows' ); ?></p>
|
324 |
+
<form method="post">
|
325 |
+
<table class="cartflows-table widefat">
|
326 |
+
<tr class="cartflows-row">
|
327 |
+
<td class="cartflows-row-heading">
|
328 |
+
<label><?php esc_html_e( 'Select Page Builder', 'cartflows' ); ?></label>
|
329 |
+
</td>
|
330 |
+
<td class="cartflows-row-content">
|
331 |
+
<?php
|
332 |
+
$installed_plugins = get_plugins();
|
333 |
+
$plugins = array(
|
334 |
+
array(
|
335 |
+
'title' => __( 'Elementor', 'cartflows' ),
|
336 |
+
'value' => 'elementor',
|
337 |
+
'data' => array(
|
338 |
+
'slug' => 'elementor',
|
339 |
+
'init' => 'elementor/elementor.php',
|
340 |
+
'active' => is_plugin_active( 'elementor/elementor.php' ) ? 'yes' : 'no',
|
341 |
+
'install' => isset( $installed_plugins['elementor/elementor.php'] ) ? 'yes' : 'no',
|
342 |
+
),
|
343 |
+
),
|
344 |
+
array(
|
345 |
+
'title' => __( 'Beaver Builder Plugin (Lite Version)', 'cartflows' ),
|
346 |
+
'value' => 'beaver-builder',
|
347 |
+
'data' => array(
|
348 |
+
'slug' => 'beaver-builder-lite-version',
|
349 |
+
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
350 |
+
'active' => is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ? 'yes' : 'no',
|
351 |
+
'install' => isset( $installed_plugins['beaver-builder-lite-version/fl-builder.php'] ) ? 'yes' : 'no',
|
352 |
+
),
|
353 |
+
),
|
354 |
+
array(
|
355 |
+
'title' => __( 'Divi', 'cartflows' ),
|
356 |
+
'value' => 'divi',
|
357 |
+
'data' => array(
|
358 |
+
'slug' => 'divi',
|
359 |
+
'init' => 'divi',
|
360 |
+
'active' => 'yes',
|
361 |
+
'install' => 'NA',
|
362 |
+
),
|
363 |
+
),
|
364 |
+
array(
|
365 |
+
'title' => __( 'Other', 'cartflows' ),
|
366 |
+
'value' => 'other',
|
367 |
+
'data' => array(
|
368 |
+
'slug' => 'other',
|
369 |
+
'init' => false,
|
370 |
+
'active' => 'yes',
|
371 |
+
'install' => 'NA',
|
372 |
+
),
|
373 |
+
),
|
374 |
+
);
|
375 |
+
?>
|
376 |
+
<input type="hidden" name="save-pb-input" id="save-pb-option" value="1" />
|
377 |
+
<select name="page-builder" class="page-builder-list" data-redirect-link="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>">
|
378 |
+
<?php
|
379 |
+
foreach ( $plugins as $key => $plugin ) {
|
380 |
+
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>';
|
381 |
+
}
|
382 |
+
?>
|
383 |
+
</select>
|
384 |
+
</td>
|
385 |
+
</tr>
|
386 |
+
</table>
|
387 |
+
<p><?php esc_html_e( 'While CartFlows Should work with most page builders, we offer templates for the above page builders.', 'cartflows' ); ?></p>
|
388 |
+
<div class="cartflows-setup-actions step">
|
389 |
+
<div class="button-prev-wrap">
|
390 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
391 |
+
</div>
|
392 |
+
<div class="button-next-wrap">
|
393 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next" ><?php esc_html_e( 'Skip this step', 'cartflows' ); ?></a>
|
394 |
+
<a href="#" class="button button-primary wcf-install-plugins"><?php esc_html_e( 'Next »', 'cartflows' ); ?></a>
|
395 |
+
</div>
|
396 |
+
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
397 |
+
</div>
|
398 |
+
</form>
|
399 |
+
<?php
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Render checkout step.
|
404 |
+
*/
|
405 |
+
public function checkout_step() {
|
406 |
+
|
407 |
+
$installed_plugins = get_plugins();
|
408 |
+
$is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? 'yes' : 'no';
|
409 |
+
$is_wcf_ca_installed = isset( $installed_plugins['woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php'] ) ? 'yes' : 'no';
|
410 |
+
$is_active = class_exists( 'WooCommerce' ) ? 'yes' : 'no';
|
411 |
+
$is_wcf_ca_active = class_exists( 'CARTFLOWS_CA_Loader' ) ? 'yes' : 'no';
|
412 |
+
?>
|
413 |
+
<h1><?php esc_html_e( 'Choose a checkout', 'cartflows' ); ?></h1>
|
414 |
+
<div class="cartflows-setup-message">
|
415 |
+
<p>
|
416 |
+
<?php esc_html_e( 'While CartFlows is designed to use WooCommerce sell digital and physical products, not all funnels need a checkout system.', 'cartflows' ); ?>
|
417 |
+
</p>
|
418 |
+
<h4 class="cartflows-setup-message-title"><?php esc_html_e( 'Would you like to install WooCommerce to sell digital and physical products in your funnels?', 'cartflows' ); ?></h4>
|
419 |
+
<span><input data-wcf-ca-active="<?php echo esc_attr( $is_wcf_ca_active ); ?>" data-wcf-ca-install="<?php echo esc_attr( $is_wcf_ca_installed ); ?>" data-woo-active="<?php echo esc_attr( $is_active ); ?>" data-woo-install="<?php echo esc_attr( $is_wc_installed ); ?>" type="hidden" class="wcf-install-wc-input" name="installl-woocommerce" value="" checked></span>
|
420 |
+
</div>
|
421 |
+
|
422 |
+
<div class="cartflows-setup-extra-notice">
|
423 |
+
|
424 |
+
<span>
|
425 |
+
<?php esc_html_e( 'The following plugin will be installed and activated for you:', 'cartflows' ); ?>
|
426 |
+
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce', 'cartflows' ); ?></a>,
|
427 |
+
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce Cart Abandonment Recovery', 'cartflows' ); ?></a>
|
428 |
+
|
429 |
+
</span>
|
430 |
+
|
431 |
+
</div>
|
432 |
+
|
433 |
+
<div class="cartflows-setup-actions step">
|
434 |
+
<div class="button-prev-wrap">
|
435 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
436 |
+
</div>
|
437 |
+
<div class="button-next-wrap">
|
438 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
|
439 |
+
<a class="wcf-install-wc button-primary button button-large" name="save_step" > <?php esc_html_e( 'Yes', 'cartflows' ); ?> </a>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
|
443 |
+
<?php
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Save Locale Settings.
|
448 |
+
*/
|
449 |
+
public function activate_wc_plugins() {
|
450 |
+
|
451 |
+
check_ajax_referer( 'wcf-wc-plugins-activate', 'security' );
|
452 |
+
|
453 |
+
$plugin_slug_arr = array(
|
454 |
+
'woocommerce/woocommerce.php' => true,
|
455 |
+
'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
|
456 |
+
);
|
457 |
+
|
458 |
+
$activate = array(
|
459 |
+
'woocommerce/woocommerce.php' => false,
|
460 |
+
'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
|
461 |
+
);
|
462 |
+
|
463 |
+
foreach ( $plugin_slug_arr as $slug => $do_silently ) {
|
464 |
+
|
465 |
+
$activate[ $slug ] = activate_plugin( $slug, '', false, $do_silently );
|
466 |
+
}
|
467 |
+
|
468 |
+
foreach ( $activate as $slug => $data ) {
|
469 |
+
|
470 |
+
if ( is_wp_error( $data ) ) {
|
471 |
+
wp_send_json_error(
|
472 |
+
array(
|
473 |
+
'success' => false,
|
474 |
+
'message' => $data->get_error_message(),
|
475 |
+
)
|
476 |
+
);
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
wp_send_json_success();
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* Save Locale Settings.
|
485 |
+
*/
|
486 |
+
public function page_builder_step_save() {
|
487 |
+
|
488 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
489 |
+
return;
|
490 |
+
}
|
491 |
+
|
492 |
+
check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
|
493 |
+
|
494 |
+
$plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_init'] ) ) : '';
|
495 |
+
$save_option = ( isset( $_POST['save_builder_option'] ) && 'true' == $_POST['save_builder_option'] ) ? true : false;
|
496 |
+
$plugin_slug = filter_input( INPUT_POST, 'page_builder', FILTER_SANITIZE_STRING );
|
497 |
+
|
498 |
+
$do_sliently = true;
|
499 |
+
if ( 'woo-cart-abandonment-recovery' === $plugin_slug ) {
|
500 |
+
$do_sliently = false;
|
501 |
+
}
|
502 |
+
|
503 |
+
$activate = activate_plugin( $plugin_init, '', false, $do_sliently );
|
504 |
+
|
505 |
+
if ( $save_option ) {
|
506 |
+
$this->save_page_builder_option();
|
507 |
+
}
|
508 |
+
|
509 |
+
if ( is_wp_error( $activate ) ) {
|
510 |
+
wp_send_json_error(
|
511 |
+
array(
|
512 |
+
'success' => false,
|
513 |
+
'message' => $activate->get_error_message(),
|
514 |
+
)
|
515 |
+
);
|
516 |
+
}
|
517 |
+
|
518 |
+
wp_send_json_success(
|
519 |
+
array( 'plugin' => $plugin_slug )
|
520 |
+
);
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Save selected page builder in options database.
|
525 |
+
*/
|
526 |
+
public function save_page_builder_option() {
|
527 |
+
|
528 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
529 |
+
return;
|
530 |
+
}
|
531 |
+
|
532 |
+
$page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( wp_unslash( $_POST['page_builder'] ) ) : ''; //phpcs:ignore
|
533 |
+
|
534 |
+
$wcf_settings = get_option( '_cartflows_common', array() );
|
535 |
+
|
536 |
+
if ( false !== strpos( $page_builder, 'beaver-builder' ) ) {
|
537 |
+
$page_builder = 'beaver-builder';
|
538 |
+
}
|
539 |
+
|
540 |
+
$wcf_settings['default_page_builder'] = $page_builder;
|
541 |
+
|
542 |
+
update_option( '_cartflows_common', $wcf_settings );
|
543 |
+
|
544 |
+
wp_send_json_success(
|
545 |
+
array( 'plugin' => $page_builder )
|
546 |
+
);
|
547 |
+
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Final step.
|
552 |
+
*/
|
553 |
+
public function ready_step() {
|
554 |
+
|
555 |
+
// Set setup wizard status to complete.
|
556 |
+
update_option( 'wcf_setup_complete', true );
|
557 |
+
?>
|
558 |
+
<h1><?php esc_html_e( 'Congratulations, You Did It!', 'cartflows' ); ?></h1>
|
559 |
+
|
560 |
+
<div class="cartflows-setup-next-steps">
|
561 |
+
<div class="cartflows-setup-next-steps-last">
|
562 |
+
|
563 |
+
<p class="success">
|
564 |
+
<?php
|
565 |
+
esc_html_e( 'CartFlows is ready to use on your website. You\'ve successfully completed the setup process and all that is left for you to do is create your first flow.', 'cartflows' )
|
566 |
+
?>
|
567 |
+
</p>
|
568 |
+
|
569 |
+
|
570 |
+
<ul class="wcf-wizard-next-steps">
|
571 |
+
<li class="wcf-wizard-next-step-item">
|
572 |
+
<div class="wcf-wizard-next-step-description">
|
573 |
+
<p class="next-step-heading">Next step</p>
|
574 |
+
<h3 class="next-step-description">Create First Flow</h3>
|
575 |
+
<p class="next-step-extra-info">You're ready to add flows to your website.</p>
|
576 |
+
</div>
|
577 |
+
<div class="wcf-wizard-next-step-action">
|
578 |
+
<p class="wc-setup-actions step">
|
579 |
+
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=cartflows_flow&add-new-flow' ) ); ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Create a flow', 'cartflows' ); ?></a>
|
580 |
+
</p>
|
581 |
+
</div>
|
582 |
+
</li>
|
583 |
+
</ul>
|
584 |
+
|
585 |
+
</div>
|
586 |
+
</div>
|
587 |
+
<?php
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* Training course step.
|
592 |
+
*/
|
593 |
+
public function training_step() {
|
594 |
+
$current_user = wp_get_current_user();
|
595 |
+
?>
|
596 |
+
<h1><?php esc_html_e( 'Exclusive CartFlows Training Course Offer', 'cartflows' ); ?></h1>
|
597 |
+
|
598 |
+
<div id="mauticform_wrapper_cartflowsonboarding" class="mauticform_wrapper">
|
599 |
+
<form autocomplete="false" role="form" method="post" action="https://go.cartflows.com/form/submit?formId=2" id="mauticform_cartflowsonboarding" data-mautic-form="cartflowsonboarding" enctype="multipart/form-data">
|
600 |
+
<div class="mauticform-error" id="mauticform_cartflowsonboarding_error"></div>
|
601 |
+
<div class="mauticform-message" id="mauticform_cartflowsonboarding_message"></div>
|
602 |
+
<div class="mauticform-innerform">
|
603 |
+
<div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">
|
604 |
+
<div id="mauticform_cartflowsonboarding_enter_your_email" class="mauticform-row mauticform-email mauticform-field-1">
|
605 |
+
<div class="cartflows-setup-message">
|
606 |
+
<p>
|
607 |
+
<?php esc_html_e( 'We want you to get off to a great start using CartFlows, so we would like to give access to our exclusive training course.', 'cartflows' ); ?>
|
608 |
+
<?php esc_html_e( 'Get access to this couse, for free, by entering your email below.', 'cartflows' ); ?>
|
609 |
+
</p>
|
610 |
+
<input id="mauticform_input_cartflowsonboarding_enter_your_email" name="mauticform[enter_your_email]" placeholder="<?php esc_html_e( 'Enter Email address', 'cartflows' ); ?>" value="<?php echo $current_user->user_email; ?>" class="mauticform-input" type="email">
|
611 |
+
</div>
|
612 |
+
<span class="mauticform-errormsg" style="display: none;"></span>
|
613 |
+
</div>
|
614 |
+
</div>
|
615 |
+
</div>
|
616 |
+
|
617 |
+
<input type="hidden" name="mauticform[formId]" id="mauticform_cartflowsonboarding_id" value="2">
|
618 |
+
<input type="hidden" name="mauticform[return]" id="mauticform_cartflowsonboarding_return" value="">
|
619 |
+
<input type="hidden" name="mauticform[formName]" id="mauticform_cartflowsonboarding_name" value="cartflowsonboarding">
|
620 |
+
<div class="cartflows-setup-actions step">
|
621 |
+
<div class="button-prev-wrap">
|
622 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
623 |
+
</div>
|
624 |
+
<div class="button-next-wrap">
|
625 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
|
626 |
+
<button type="submit" name="mauticform[submit]" id="mauticform_input_cartflowsonboarding_submit" value="<?php esc_html_e( 'Allow', 'cartflows' ); ?>" class="mautic-form-submit btn btn-default button-primary button button-large button-next" name="save_step"><?php esc_html_e( 'Allow', 'cartflows' ); ?></button>
|
627 |
+
</div>
|
628 |
+
</div>
|
629 |
+
</form>
|
630 |
+
</div>
|
631 |
+
<?php
|
632 |
+
}
|
633 |
+
|
634 |
+
/**
|
635 |
+
* Localize variables in admin
|
636 |
+
*/
|
637 |
+
public function localize_vars() {
|
638 |
+
|
639 |
+
$vars = array();
|
640 |
+
|
641 |
+
$ajax_actions = array(
|
642 |
+
'wcf_page_builder_step_save',
|
643 |
+
'wcf_wc_plugins_activate',
|
644 |
+
);
|
645 |
+
|
646 |
+
foreach ( $ajax_actions as $action ) {
|
647 |
+
|
648 |
+
$vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
|
649 |
+
}
|
650 |
+
|
651 |
+
return $vars;
|
652 |
+
}
|
653 |
+
|
654 |
+
/**
|
655 |
+
* Add JS script for mautic form
|
656 |
+
*/
|
657 |
+
public function add_mautic_form_script() {
|
658 |
+
|
659 |
+
if ( ! isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && 'cartflow-setup' !== $_REQUEST['page'] ) ) { //phpcs:ignore
|
660 |
+
return;
|
661 |
+
}
|
662 |
+
?>
|
663 |
+
|
664 |
+
<script type="text/javascript">
|
665 |
+
/** This section is only needed once per page if manually copying **/
|
666 |
+
if (typeof MauticSDKLoaded == 'undefined') {
|
667 |
+
var MauticSDKLoaded = true;
|
668 |
+
var head = document.getElementsByTagName('head')[0];
|
669 |
+
var script = document.createElement('script');
|
670 |
+
script.type = 'text/javascript';
|
671 |
+
script.src = 'https://go.cartflows.com/media/js/mautic-form.js';
|
672 |
+
script.onload = function() {
|
673 |
+
MauticSDK.onLoad();
|
674 |
+
};
|
675 |
+
head.appendChild(script);
|
676 |
+
var MauticDomain = 'https://go.cartflows.com';
|
677 |
+
var MauticLang = {
|
678 |
+
'submittingMessage': "Please wait..."
|
679 |
+
};
|
680 |
+
}
|
681 |
+
</script>
|
682 |
+
<?php
|
683 |
+
}
|
684 |
+
}
|
685 |
+
|
686 |
+
new CartFlows_Wizard();
|
687 |
+
|
688 |
+
endif;
|
includes/admin/cartflows-general.php
CHANGED
@@ -1,522 +1,522 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* General settings
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$settings = Cartflows_Helper::get_common_settings();
|
9 |
-
|
10 |
-
$debug_data = Cartflows_Helper::get_debug_settings();
|
11 |
-
|
12 |
-
$permalink_settings = Cartflows_Helper::get_permalink_settings();
|
13 |
-
|
14 |
-
$google_analytics_settings = Cartflows_Helper::get_google_analytics_settings();
|
15 |
-
|
16 |
-
$facebook_settings = Cartflows_Helper::get_facebook_settings();
|
17 |
-
|
18 |
-
$debug_on = ( isset( $_GET['debug'] ) ) ? sanitize_text_field( wp_unslash( $_GET['debug'] ) ) : 'false'; //phpcs:ignore
|
19 |
-
|
20 |
-
$error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOOLEAN );
|
21 |
-
?>
|
22 |
-
|
23 |
-
|
24 |
-
<?php if ( $error_log ) : ?>
|
25 |
-
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
26 |
-
<?php Cartflows_Logger::status_logs_file(); ?>
|
27 |
-
</div>
|
28 |
-
<?php else : ?>
|
29 |
-
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
30 |
-
<input type="hidden" name="action" value="wcf_save_common_settings">
|
31 |
-
<h1 class="screen-reader-text"><?php esc_html_e( 'General Settings', 'cartflows' ); ?></h1>
|
32 |
-
|
33 |
-
<div id="poststuff">
|
34 |
-
<div id="post-body" class="columns-2">
|
35 |
-
<div id="post-body-content">
|
36 |
-
|
37 |
-
<!-- Getting Started -->
|
38 |
-
<div class="postbox introduction">
|
39 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
40 |
-
<span><?php esc_html_e( 'Getting Started', 'cartflows' ); ?></span>
|
41 |
-
</h2>
|
42 |
-
<div class="inside">
|
43 |
-
<div class="iframe-wrap">
|
44 |
-
<iframe width="560" height="315" src="https://www.youtube.com/embed/SlE0moPKjMY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
45 |
-
</div>
|
46 |
-
<p>
|
47 |
-
<?php
|
48 |
-
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
49 |
-
?>
|
50 |
-
</p>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
<!-- Getting Started -->
|
54 |
-
|
55 |
-
<!-- General Settings -->
|
56 |
-
<div class="general-settings-form postbox">
|
57 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
58 |
-
<span><?php esc_html_e( 'General Settings', 'cartflows' ); ?></span>
|
59 |
-
</h2>
|
60 |
-
<div class="inside">
|
61 |
-
<form method="post" class="wrap wcf-clear" action="" >
|
62 |
-
<div class="form-wrap">
|
63 |
-
<?php
|
64 |
-
|
65 |
-
do_action( 'cartflows_before_settings_fields', $settings );
|
66 |
-
|
67 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
68 |
-
array(
|
69 |
-
'id' => 'wcf_disallow_indexing',
|
70 |
-
'name' => '_cartflows_common[disallow_indexing]',
|
71 |
-
'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
|
72 |
-
'value' => $settings['disallow_indexing'],
|
73 |
-
)
|
74 |
-
);
|
75 |
-
|
76 |
-
if ( wcf()->is_woo_active ) {
|
77 |
-
echo Cartflows_Admin_Fields::flow_checkout_selection_field(
|
78 |
-
array(
|
79 |
-
'id' => 'wcf_global_checkout',
|
80 |
-
'name' => '_cartflows_common[global_checkout]',
|
81 |
-
'title' => __( 'Global Checkout', 'cartflows' ),
|
82 |
-
'value' => $settings['global_checkout'],
|
83 |
-
)
|
84 |
-
);
|
85 |
-
}
|
86 |
-
echo Cartflows_Admin_Fields::select_field(
|
87 |
-
array(
|
88 |
-
'id' => 'wcf_default_page_builder',
|
89 |
-
'name' => '_cartflows_common[default_page_builder]',
|
90 |
-
'title' => __( 'Show Templates designed with', 'cartflows' ),
|
91 |
-
'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' ),
|
92 |
-
'value' => $settings['default_page_builder'],
|
93 |
-
'options' => array(
|
94 |
-
'elementor' => __( 'Elementor', 'cartflows' ),
|
95 |
-
'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
|
96 |
-
'divi' => __( 'Divi', 'cartflows' ),
|
97 |
-
'other' => __( 'Other', 'cartflows' ),
|
98 |
-
),
|
99 |
-
)
|
100 |
-
);
|
101 |
-
|
102 |
-
do_action( 'cartflows_after_settings_fields', $settings );
|
103 |
-
|
104 |
-
?>
|
105 |
-
</div>
|
106 |
-
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
107 |
-
<?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
|
108 |
-
</form>
|
109 |
-
</div>
|
110 |
-
</div>
|
111 |
-
<!-- General Settings -->
|
112 |
-
|
113 |
-
<!-- Permalink Settings -->
|
114 |
-
<div class="general-settingss-form postbox">
|
115 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
116 |
-
<span><?php esc_html_e( 'Permalink Settings', 'cartflows' ); ?></span>
|
117 |
-
</h2>
|
118 |
-
<div class="inside">
|
119 |
-
<form method="post" class="wrap wcf-clear" action="" >
|
120 |
-
<div class="form-wrap wcf_permalink_settings">
|
121 |
-
<?php
|
122 |
-
|
123 |
-
echo Cartflows_Admin_Fields::radio_field(
|
124 |
-
array(
|
125 |
-
'id' => 'permalink_structure',
|
126 |
-
'name' => '_cartflows_permalink[permalink_structure]',
|
127 |
-
'value' => $permalink_settings['permalink_structure'],
|
128 |
-
'options' => array(
|
129 |
-
'' =>
|
130 |
-
array(
|
131 |
-
'label' => __( 'Default', 'cartflows' ),
|
132 |
-
'description' => 'Default WordPress Permalink',
|
133 |
-
),
|
134 |
-
|
135 |
-
'/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
|
136 |
-
array(
|
137 |
-
'label' => __( 'Flow and Step Slug', 'cartflows' ),
|
138 |
-
'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
|
139 |
-
),
|
140 |
-
|
141 |
-
'/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%' =>
|
142 |
-
array(
|
143 |
-
'label' => __( 'Flow Slug', 'cartflows' ),
|
144 |
-
'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/%stepname%/',
|
145 |
-
),
|
146 |
-
|
147 |
-
'/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
|
148 |
-
array(
|
149 |
-
'label' => __( 'Step Slug', 'cartflows' ),
|
150 |
-
'description' => '/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
|
151 |
-
),
|
152 |
-
),
|
153 |
-
)
|
154 |
-
);
|
155 |
-
?>
|
156 |
-
<hr/>
|
157 |
-
<?php
|
158 |
-
|
159 |
-
echo Cartflows_Admin_Fields::title_field(
|
160 |
-
array(
|
161 |
-
'title' => __( 'Post Type Permalink Base', 'cartflows' ),
|
162 |
-
)
|
163 |
-
);
|
164 |
-
|
165 |
-
echo Cartflows_Admin_Fields::text_field(
|
166 |
-
array(
|
167 |
-
'id' => 'wcf_permalink_step_base',
|
168 |
-
'name' => '_cartflows_permalink[permalink]',
|
169 |
-
'title' => __( 'Step Base', 'cartflows' ),
|
170 |
-
'value' => $permalink_settings['permalink'],
|
171 |
-
'placeholder' => CARTFLOWS_STEP_POST_TYPE,
|
172 |
-
)
|
173 |
-
);
|
174 |
-
|
175 |
-
echo Cartflows_Admin_Fields::text_field(
|
176 |
-
array(
|
177 |
-
'id' => 'wcf_permalink_flow_base',
|
178 |
-
'name' => '_cartflows_permalink[permalink_flow_base]',
|
179 |
-
'title' => __( 'Flow Base', 'cartflows' ),
|
180 |
-
'value' => $permalink_settings['permalink_flow_base'],
|
181 |
-
'placeholder' => CARTFLOWS_FLOW_POST_TYPE,
|
182 |
-
)
|
183 |
-
);
|
184 |
-
|
185 |
-
?>
|
186 |
-
|
187 |
-
|
188 |
-
</div>
|
189 |
-
<p>
|
190 |
-
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
191 |
-
<?php submit_button( __( 'Set Default', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'reset', false ); ?>
|
192 |
-
<?php wp_nonce_field( 'cartflows-permalink-settings', 'cartflows-permalink-settings-nonce' ); ?>
|
193 |
-
</p>
|
194 |
-
|
195 |
-
|
196 |
-
</form>
|
197 |
-
</div>
|
198 |
-
</div>
|
199 |
-
<!-- Permalink Settings -->
|
200 |
-
|
201 |
-
<!-- Facebook Pixel Tracking -->
|
202 |
-
<div class="general-settingss-form postbox">
|
203 |
-
<h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
|
204 |
-
|
205 |
-
<span><?php esc_html_e( 'Facebook Pixel Settings', 'cartflows' ); ?></span>
|
206 |
-
</h2>
|
207 |
-
|
208 |
-
<form method="post" class="wrap wcf-clear" action="">
|
209 |
-
<div class="form-wrap">
|
210 |
-
<input type="hidden" name="action" value="wcf_save_facebook_pixel_settings">
|
211 |
-
<div id="post-body">
|
212 |
-
|
213 |
-
<div class="inside">
|
214 |
-
<div class="form-wrap">
|
215 |
-
<?php
|
216 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
217 |
-
array(
|
218 |
-
'id' => 'wcf_facebook_pixel_tracking',
|
219 |
-
'name' => '_cartflows_facebook[facebook_pixel_tracking]',
|
220 |
-
'title' => __( 'Enable Facebook Pixel Tracking', 'cartflows' ),
|
221 |
-
'value' => $facebook_settings['facebook_pixel_tracking'],
|
222 |
-
)
|
223 |
-
);
|
224 |
-
|
225 |
-
echo "<div class='wcf-fb-pixel-wrapper'>";
|
226 |
-
?>
|
227 |
-
<hr/>
|
228 |
-
<?php
|
229 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
230 |
-
array(
|
231 |
-
'id' => 'wcf_facebook_pixel_tracking_for_site',
|
232 |
-
'name' => '_cartflows_facebook[facebook_pixel_tracking_for_site]',
|
233 |
-
'title' => __( 'Enable for the whole site', 'cartflows' ),
|
234 |
-
'value' => $facebook_settings['facebook_pixel_tracking_for_site'],
|
235 |
-
)
|
236 |
-
);
|
237 |
-
|
238 |
-
echo Cartflows_Admin_Fields::title_field(
|
239 |
-
array(
|
240 |
-
'title' => '',
|
241 |
-
'description' => __( 'If this option is unchecked, it will only apply to CartFlows steps.', 'cartflows' ),
|
242 |
-
)
|
243 |
-
);
|
244 |
-
?>
|
245 |
-
<hr/>
|
246 |
-
<?php
|
247 |
-
echo Cartflows_Admin_Fields::text_field(
|
248 |
-
array(
|
249 |
-
'id' => 'wcf_facebook_pixel_id',
|
250 |
-
'name' => '_cartflows_facebook[facebook_pixel_id]',
|
251 |
-
'title' => __( 'Enter Facebook pixel ID', 'cartflows' ),
|
252 |
-
'value' => $facebook_settings['facebook_pixel_id'],
|
253 |
-
)
|
254 |
-
);
|
255 |
-
|
256 |
-
|
257 |
-
echo Cartflows_Admin_Fields::title_field(
|
258 |
-
array(
|
259 |
-
'title' => __( 'Enable Events:', 'cartflows' ),
|
260 |
-
)
|
261 |
-
);
|
262 |
-
|
263 |
-
|
264 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
265 |
-
array(
|
266 |
-
'id' => 'wcf_facebook_pixel_initiate_checkout',
|
267 |
-
'name' => '_cartflows_facebook[facebook_pixel_initiate_checkout]',
|
268 |
-
'title' => __( 'Initiate Checkout', 'cartflows' ),
|
269 |
-
'value' => $facebook_settings['facebook_pixel_initiate_checkout'],
|
270 |
-
)
|
271 |
-
);
|
272 |
-
|
273 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
274 |
-
array(
|
275 |
-
'id' => 'wcf_facebook_pixel_add_payment_info',
|
276 |
-
'name' => '_cartflows_facebook[facebook_pixel_add_payment_info]',
|
277 |
-
'title' => __( 'Add Payment Info', 'cartflows' ),
|
278 |
-
'value' => $facebook_settings['facebook_pixel_add_payment_info'],
|
279 |
-
)
|
280 |
-
);
|
281 |
-
|
282 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
283 |
-
array(
|
284 |
-
'id' => 'wcf_facebook_pixel_purchase_complete',
|
285 |
-
'name' => '_cartflows_facebook[facebook_pixel_purchase_complete]',
|
286 |
-
'title' => __( 'Purchase Complete', 'cartflows' ),
|
287 |
-
'value' => $facebook_settings['facebook_pixel_purchase_complete'],
|
288 |
-
)
|
289 |
-
);
|
290 |
-
|
291 |
-
echo '</div>';
|
292 |
-
|
293 |
-
?>
|
294 |
-
</div>
|
295 |
-
|
296 |
-
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-facebook-setting-save-btn button-primary button', 'submit', false ); ?>
|
297 |
-
<?php wp_nonce_field( 'cartflows-facebook-settings', 'cartflows-facebook-settings-nonce' ); ?>
|
298 |
-
</div>
|
299 |
-
</div>
|
300 |
-
</div>
|
301 |
-
</form>
|
302 |
-
</div>
|
303 |
-
<!-- Facebook Pixel Tracking -->
|
304 |
-
|
305 |
-
<!-- Google Analytics Tracking -->
|
306 |
-
<div class="general-settingss-form postbox">
|
307 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
308 |
-
<span><?php esc_html_e( 'Google Analytics Settings', 'cartflows' ); ?></span>
|
309 |
-
</h2>
|
310 |
-
<div class="inside">
|
311 |
-
<form method="post" class="wrap wcf-clear" action="" >
|
312 |
-
<div class="form-wrap">
|
313 |
-
<?php
|
314 |
-
|
315 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
316 |
-
array(
|
317 |
-
'id' => 'enable_google-analytics-id',
|
318 |
-
'name' => '_cartflows_google_analytics[enable_google_analytics]',
|
319 |
-
'title' => __( 'Enable Google Analytics Tracking', 'cartflows' ),
|
320 |
-
'value' => $google_analytics_settings['enable_google_analytics'],
|
321 |
-
)
|
322 |
-
);
|
323 |
-
|
324 |
-
echo "<div class='wcf-google-analytics-wrapper'>";
|
325 |
-
?>
|
326 |
-
<hr/>
|
327 |
-
<?php
|
328 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
329 |
-
array(
|
330 |
-
'id' => 'enable_google_analytics_for_site',
|
331 |
-
'name' => '_cartflows_google_analytics[enable_google_analytics_for_site]',
|
332 |
-
'title' => __( 'Enable for the whole website', 'cartflows' ),
|
333 |
-
'value' => $google_analytics_settings['enable_google_analytics_for_site'],
|
334 |
-
)
|
335 |
-
);
|
336 |
-
|
337 |
-
echo Cartflows_Admin_Fields::title_field(
|
338 |
-
array(
|
339 |
-
'title' => '',
|
340 |
-
'description' => __( 'If this option is unchecked, it will only apply to CartFlows steps.', 'cartflows' ),
|
341 |
-
)
|
342 |
-
);
|
343 |
-
?>
|
344 |
-
<hr/>
|
345 |
-
<?php
|
346 |
-
echo Cartflows_Admin_Fields::text_field(
|
347 |
-
array(
|
348 |
-
'id' => 'google-analytics-id',
|
349 |
-
'name' => '_cartflows_google_analytics[google_analytics_id]',
|
350 |
-
'title' => __( 'Google Analytics ID', 'cartflows' ),
|
351 |
-
'value' => $google_analytics_settings['google_analytics_id'],
|
352 |
-
'description' => __( 'Log into your <a href="https://analytics.google.com/" target="_blank">google analytics account</a> to find your ID. eg: UA-XXXXXX-X.', 'cartflows' ),
|
353 |
-
)
|
354 |
-
);
|
355 |
-
|
356 |
-
echo Cartflows_Admin_Fields::title_field(
|
357 |
-
array(
|
358 |
-
'title' => __( 'Enable Events:', 'cartflows' ),
|
359 |
-
)
|
360 |
-
);
|
361 |
-
|
362 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
363 |
-
array(
|
364 |
-
'id' => 'enable_begin_checkout',
|
365 |
-
'name' => '_cartflows_google_analytics[enable_begin_checkout]',
|
366 |
-
'title' => __( 'Begin Checkout', 'cartflows' ),
|
367 |
-
'value' => $google_analytics_settings['enable_begin_checkout'],
|
368 |
-
)
|
369 |
-
);
|
370 |
-
|
371 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
372 |
-
array(
|
373 |
-
'id' => 'enable_add_to_cart',
|
374 |
-
'name' => '_cartflows_google_analytics[enable_add_to_cart]',
|
375 |
-
'title' => __( 'Add To Cart', 'cartflows' ),
|
376 |
-
'value' => $google_analytics_settings['enable_add_to_cart'],
|
377 |
-
)
|
378 |
-
);
|
379 |
-
|
380 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
381 |
-
array(
|
382 |
-
'id' => 'enable_add_payment_info',
|
383 |
-
'name' => '_cartflows_google_analytics[enable_add_payment_info]',
|
384 |
-
'title' => __( 'Add Payment Info', 'cartflows' ),
|
385 |
-
'value' => $google_analytics_settings['enable_add_payment_info'],
|
386 |
-
)
|
387 |
-
);
|
388 |
-
|
389 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
390 |
-
array(
|
391 |
-
'id' => 'enable_purchase_event',
|
392 |
-
'name' => '_cartflows_google_analytics[enable_purchase_event]',
|
393 |
-
'title' => __( 'Purchase', 'cartflows' ),
|
394 |
-
'value' => $google_analytics_settings['enable_purchase_event'],
|
395 |
-
)
|
396 |
-
);
|
397 |
-
|
398 |
-
echo Cartflows_Admin_Fields::title_field(
|
399 |
-
array(
|
400 |
-
'title' => '',
|
401 |
-
'description' => __( 'Google Analytics not working correctly? <a href="https://cartflows.com/docs/troubleshooting-google-analytics-tracking-issues/" > Click here </a> to know more. ', 'cartflows' ),
|
402 |
-
)
|
403 |
-
);
|
404 |
-
|
405 |
-
do_action( 'cartflows_google_analytics_admin_fields', $google_analytics_settings );
|
406 |
-
|
407 |
-
echo '</div>';
|
408 |
-
?>
|
409 |
-
|
410 |
-
|
411 |
-
</div>
|
412 |
-
<p>
|
413 |
-
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
414 |
-
<?php wp_nonce_field( 'cartflows-google-analytics-settings', 'cartflows-google-analytics-settings-nonce' ); ?>
|
415 |
-
</p>
|
416 |
-
|
417 |
-
|
418 |
-
</form>
|
419 |
-
</div>
|
420 |
-
</div>
|
421 |
-
<!-- Google Analytics Tracking -->
|
422 |
-
|
423 |
-
<?php do_action( 'cartflows_register_general_settings' ); ?>
|
424 |
-
|
425 |
-
</div>
|
426 |
-
|
427 |
-
<!-- Right Sidebar -->
|
428 |
-
<div class="postbox-container" id="postbox-container-1">
|
429 |
-
<div id="side-sortables">
|
430 |
-
|
431 |
-
<div class="postbox">
|
432 |
-
<h2 class="hndle">
|
433 |
-
<span class="dashicons dashicons-book"></span>
|
434 |
-
<span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
|
435 |
-
</h2>
|
436 |
-
<div class="inside">
|
437 |
-
<p>
|
438 |
-
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
439 |
-
</p>
|
440 |
-
<p>
|
441 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
|
442 |
-
</p>
|
443 |
-
</div>
|
444 |
-
</div>
|
445 |
-
|
446 |
-
<div class="postbox">
|
447 |
-
<h2 class="hndle">
|
448 |
-
<span class="dashicons dashicons-groups"></span>
|
449 |
-
<span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
|
450 |
-
</h2>
|
451 |
-
<div class="inside">
|
452 |
-
<p>
|
453 |
-
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
454 |
-
</p>
|
455 |
-
<p>
|
456 |
-
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
|
457 |
-
</p>
|
458 |
-
</div>
|
459 |
-
</div>
|
460 |
-
|
461 |
-
<div class="postbox">
|
462 |
-
<h2 class="hndle">
|
463 |
-
<span class="dashicons dashicons-sos"></span>
|
464 |
-
<span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
|
465 |
-
</h2>
|
466 |
-
<div class="inside">
|
467 |
-
<p>
|
468 |
-
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
469 |
-
</p>
|
470 |
-
<p>
|
471 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a Ticket »', 'cartflows' ); ?></a>
|
472 |
-
</p>
|
473 |
-
</div>
|
474 |
-
</div>
|
475 |
-
<?php
|
476 |
-
if ( 'true' == $debug_on ) {
|
477 |
-
?>
|
478 |
-
<div class="postbox">
|
479 |
-
<h2 class="hndle">
|
480 |
-
<span class="dashicons dashicons-editor-code"></span>
|
481 |
-
<span><?php esc_html_e( 'Load Minified CSS', 'cartflows' ); ?></span>
|
482 |
-
</h2>
|
483 |
-
<div class="inside">
|
484 |
-
<form method="post" class="wrap wcf-clear" action="">
|
485 |
-
<p>
|
486 |
-
<?php esc_html_e( 'Load the Minified CSS from here. Just Enable it by checking the below given checkbox.', 'cartflows' ); ?>
|
487 |
-
</p>
|
488 |
-
<?php
|
489 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
490 |
-
array(
|
491 |
-
'id' => 'allow_minified_files',
|
492 |
-
'name' => '_cartflows_debug_data[allow_minified_files]',
|
493 |
-
'title' => __( 'Load minified CSS & JS Files', 'cartflows' ),
|
494 |
-
'value' => $debug_data['allow_minified_files'],
|
495 |
-
)
|
496 |
-
);
|
497 |
-
?>
|
498 |
-
<?php submit_button( __( 'Save', 'cartflows' ), 'button-primary button', 'submit', false ); ?>
|
499 |
-
<?php wp_nonce_field( 'cartflows-debug-settings', 'cartflows-debug-settings-nonce' ); ?>
|
500 |
-
</form>
|
501 |
-
</div>
|
502 |
-
</div>
|
503 |
-
<?php
|
504 |
-
}
|
505 |
-
?>
|
506 |
-
</div>
|
507 |
-
</div>
|
508 |
-
<!-- Right Sidebar -->
|
509 |
-
|
510 |
-
</div>
|
511 |
-
<!-- /post-body -->
|
512 |
-
<br class="clear">
|
513 |
-
</div>
|
514 |
-
</div>
|
515 |
-
<?php endif; ?>
|
516 |
-
|
517 |
-
<?php
|
518 |
-
/**
|
519 |
-
* Loads Zapier settings admin view.
|
520 |
-
*/
|
521 |
-
do_action( 'cartflows_after_general_settings' );
|
522 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* General settings
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$settings = Cartflows_Helper::get_common_settings();
|
9 |
+
|
10 |
+
$debug_data = Cartflows_Helper::get_debug_settings();
|
11 |
+
|
12 |
+
$permalink_settings = Cartflows_Helper::get_permalink_settings();
|
13 |
+
|
14 |
+
$google_analytics_settings = Cartflows_Helper::get_google_analytics_settings();
|
15 |
+
|
16 |
+
$facebook_settings = Cartflows_Helper::get_facebook_settings();
|
17 |
+
|
18 |
+
$debug_on = ( isset( $_GET['debug'] ) ) ? sanitize_text_field( wp_unslash( $_GET['debug'] ) ) : 'false'; //phpcs:ignore
|
19 |
+
|
20 |
+
$error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOOLEAN );
|
21 |
+
?>
|
22 |
+
|
23 |
+
|
24 |
+
<?php if ( $error_log ) : ?>
|
25 |
+
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
26 |
+
<?php Cartflows_Logger::status_logs_file(); ?>
|
27 |
+
</div>
|
28 |
+
<?php else : ?>
|
29 |
+
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
30 |
+
<input type="hidden" name="action" value="wcf_save_common_settings">
|
31 |
+
<h1 class="screen-reader-text"><?php esc_html_e( 'General Settings', 'cartflows' ); ?></h1>
|
32 |
+
|
33 |
+
<div id="poststuff">
|
34 |
+
<div id="post-body" class="columns-2">
|
35 |
+
<div id="post-body-content">
|
36 |
+
|
37 |
+
<!-- Getting Started -->
|
38 |
+
<div class="postbox introduction">
|
39 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
40 |
+
<span><?php esc_html_e( 'Getting Started', 'cartflows' ); ?></span>
|
41 |
+
</h2>
|
42 |
+
<div class="inside">
|
43 |
+
<div class="iframe-wrap">
|
44 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/SlE0moPKjMY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
45 |
+
</div>
|
46 |
+
<p>
|
47 |
+
<?php
|
48 |
+
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
49 |
+
?>
|
50 |
+
</p>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<!-- Getting Started -->
|
54 |
+
|
55 |
+
<!-- General Settings -->
|
56 |
+
<div class="general-settings-form postbox">
|
57 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
58 |
+
<span><?php esc_html_e( 'General Settings', 'cartflows' ); ?></span>
|
59 |
+
</h2>
|
60 |
+
<div class="inside">
|
61 |
+
<form method="post" class="wrap wcf-clear" action="" >
|
62 |
+
<div class="form-wrap">
|
63 |
+
<?php
|
64 |
+
|
65 |
+
do_action( 'cartflows_before_settings_fields', $settings );
|
66 |
+
|
67 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
68 |
+
array(
|
69 |
+
'id' => 'wcf_disallow_indexing',
|
70 |
+
'name' => '_cartflows_common[disallow_indexing]',
|
71 |
+
'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
|
72 |
+
'value' => $settings['disallow_indexing'],
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
if ( wcf()->is_woo_active ) {
|
77 |
+
echo Cartflows_Admin_Fields::flow_checkout_selection_field(
|
78 |
+
array(
|
79 |
+
'id' => 'wcf_global_checkout',
|
80 |
+
'name' => '_cartflows_common[global_checkout]',
|
81 |
+
'title' => __( 'Global Checkout', 'cartflows' ),
|
82 |
+
'value' => $settings['global_checkout'],
|
83 |
+
)
|
84 |
+
);
|
85 |
+
}
|
86 |
+
echo Cartflows_Admin_Fields::select_field(
|
87 |
+
array(
|
88 |
+
'id' => 'wcf_default_page_builder',
|
89 |
+
'name' => '_cartflows_common[default_page_builder]',
|
90 |
+
'title' => __( 'Show Templates designed with', 'cartflows' ),
|
91 |
+
'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' ),
|
92 |
+
'value' => $settings['default_page_builder'],
|
93 |
+
'options' => array(
|
94 |
+
'elementor' => __( 'Elementor', 'cartflows' ),
|
95 |
+
'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
|
96 |
+
'divi' => __( 'Divi', 'cartflows' ),
|
97 |
+
'other' => __( 'Other', 'cartflows' ),
|
98 |
+
),
|
99 |
+
)
|
100 |
+
);
|
101 |
+
|
102 |
+
do_action( 'cartflows_after_settings_fields', $settings );
|
103 |
+
|
104 |
+
?>
|
105 |
+
</div>
|
106 |
+
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
107 |
+
<?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
|
108 |
+
</form>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
<!-- General Settings -->
|
112 |
+
|
113 |
+
<!-- Permalink Settings -->
|
114 |
+
<div class="general-settingss-form postbox">
|
115 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
116 |
+
<span><?php esc_html_e( 'Permalink Settings', 'cartflows' ); ?></span>
|
117 |
+
</h2>
|
118 |
+
<div class="inside">
|
119 |
+
<form method="post" class="wrap wcf-clear" action="" >
|
120 |
+
<div class="form-wrap wcf_permalink_settings">
|
121 |
+
<?php
|
122 |
+
|
123 |
+
echo Cartflows_Admin_Fields::radio_field(
|
124 |
+
array(
|
125 |
+
'id' => 'permalink_structure',
|
126 |
+
'name' => '_cartflows_permalink[permalink_structure]',
|
127 |
+
'value' => $permalink_settings['permalink_structure'],
|
128 |
+
'options' => array(
|
129 |
+
'' =>
|
130 |
+
array(
|
131 |
+
'label' => __( 'Default', 'cartflows' ),
|
132 |
+
'description' => 'Default WordPress Permalink',
|
133 |
+
),
|
134 |
+
|
135 |
+
'/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
|
136 |
+
array(
|
137 |
+
'label' => __( 'Flow and Step Slug', 'cartflows' ),
|
138 |
+
'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
|
139 |
+
),
|
140 |
+
|
141 |
+
'/' . CARTFLOWS_FLOW_POST_TYPE . '/%flowname%' =>
|
142 |
+
array(
|
143 |
+
'label' => __( 'Flow Slug', 'cartflows' ),
|
144 |
+
'description' => '/<code>' . CARTFLOWS_FLOW_POST_TYPE . '</code>/%flowname%/%stepname%/',
|
145 |
+
),
|
146 |
+
|
147 |
+
'/%flowname%/' . CARTFLOWS_STEP_POST_TYPE =>
|
148 |
+
array(
|
149 |
+
'label' => __( 'Step Slug', 'cartflows' ),
|
150 |
+
'description' => '/%flowname%/<code>' . CARTFLOWS_STEP_POST_TYPE . '</code>/%stepname%/',
|
151 |
+
),
|
152 |
+
),
|
153 |
+
)
|
154 |
+
);
|
155 |
+
?>
|
156 |
+
<hr/>
|
157 |
+
<?php
|
158 |
+
|
159 |
+
echo Cartflows_Admin_Fields::title_field(
|
160 |
+
array(
|
161 |
+
'title' => __( 'Post Type Permalink Base', 'cartflows' ),
|
162 |
+
)
|
163 |
+
);
|
164 |
+
|
165 |
+
echo Cartflows_Admin_Fields::text_field(
|
166 |
+
array(
|
167 |
+
'id' => 'wcf_permalink_step_base',
|
168 |
+
'name' => '_cartflows_permalink[permalink]',
|
169 |
+
'title' => __( 'Step Base', 'cartflows' ),
|
170 |
+
'value' => $permalink_settings['permalink'],
|
171 |
+
'placeholder' => CARTFLOWS_STEP_POST_TYPE,
|
172 |
+
)
|
173 |
+
);
|
174 |
+
|
175 |
+
echo Cartflows_Admin_Fields::text_field(
|
176 |
+
array(
|
177 |
+
'id' => 'wcf_permalink_flow_base',
|
178 |
+
'name' => '_cartflows_permalink[permalink_flow_base]',
|
179 |
+
'title' => __( 'Flow Base', 'cartflows' ),
|
180 |
+
'value' => $permalink_settings['permalink_flow_base'],
|
181 |
+
'placeholder' => CARTFLOWS_FLOW_POST_TYPE,
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
?>
|
186 |
+
|
187 |
+
|
188 |
+
</div>
|
189 |
+
<p>
|
190 |
+
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
191 |
+
<?php submit_button( __( 'Set Default', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'reset', false ); ?>
|
192 |
+
<?php wp_nonce_field( 'cartflows-permalink-settings', 'cartflows-permalink-settings-nonce' ); ?>
|
193 |
+
</p>
|
194 |
+
|
195 |
+
|
196 |
+
</form>
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
<!-- Permalink Settings -->
|
200 |
+
|
201 |
+
<!-- Facebook Pixel Tracking -->
|
202 |
+
<div class="general-settingss-form postbox">
|
203 |
+
<h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
|
204 |
+
|
205 |
+
<span><?php esc_html_e( 'Facebook Pixel Settings', 'cartflows' ); ?></span>
|
206 |
+
</h2>
|
207 |
+
|
208 |
+
<form method="post" class="wrap wcf-clear" action="">
|
209 |
+
<div class="form-wrap">
|
210 |
+
<input type="hidden" name="action" value="wcf_save_facebook_pixel_settings">
|
211 |
+
<div id="post-body">
|
212 |
+
|
213 |
+
<div class="inside">
|
214 |
+
<div class="form-wrap">
|
215 |
+
<?php
|
216 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
217 |
+
array(
|
218 |
+
'id' => 'wcf_facebook_pixel_tracking',
|
219 |
+
'name' => '_cartflows_facebook[facebook_pixel_tracking]',
|
220 |
+
'title' => __( 'Enable Facebook Pixel Tracking', 'cartflows' ),
|
221 |
+
'value' => $facebook_settings['facebook_pixel_tracking'],
|
222 |
+
)
|
223 |
+
);
|
224 |
+
|
225 |
+
echo "<div class='wcf-fb-pixel-wrapper'>";
|
226 |
+
?>
|
227 |
+
<hr/>
|
228 |
+
<?php
|
229 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
230 |
+
array(
|
231 |
+
'id' => 'wcf_facebook_pixel_tracking_for_site',
|
232 |
+
'name' => '_cartflows_facebook[facebook_pixel_tracking_for_site]',
|
233 |
+
'title' => __( 'Enable for the whole site', 'cartflows' ),
|
234 |
+
'value' => $facebook_settings['facebook_pixel_tracking_for_site'],
|
235 |
+
)
|
236 |
+
);
|
237 |
+
|
238 |
+
echo Cartflows_Admin_Fields::title_field(
|
239 |
+
array(
|
240 |
+
'title' => '',
|
241 |
+
'description' => __( 'If this option is unchecked, it will only apply to CartFlows steps.', 'cartflows' ),
|
242 |
+
)
|
243 |
+
);
|
244 |
+
?>
|
245 |
+
<hr/>
|
246 |
+
<?php
|
247 |
+
echo Cartflows_Admin_Fields::text_field(
|
248 |
+
array(
|
249 |
+
'id' => 'wcf_facebook_pixel_id',
|
250 |
+
'name' => '_cartflows_facebook[facebook_pixel_id]',
|
251 |
+
'title' => __( 'Enter Facebook pixel ID', 'cartflows' ),
|
252 |
+
'value' => $facebook_settings['facebook_pixel_id'],
|
253 |
+
)
|
254 |
+
);
|
255 |
+
|
256 |
+
|
257 |
+
echo Cartflows_Admin_Fields::title_field(
|
258 |
+
array(
|
259 |
+
'title' => __( 'Enable Events:', 'cartflows' ),
|
260 |
+
)
|
261 |
+
);
|
262 |
+
|
263 |
+
|
264 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
265 |
+
array(
|
266 |
+
'id' => 'wcf_facebook_pixel_initiate_checkout',
|
267 |
+
'name' => '_cartflows_facebook[facebook_pixel_initiate_checkout]',
|
268 |
+
'title' => __( 'Initiate Checkout', 'cartflows' ),
|
269 |
+
'value' => $facebook_settings['facebook_pixel_initiate_checkout'],
|
270 |
+
)
|
271 |
+
);
|
272 |
+
|
273 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
274 |
+
array(
|
275 |
+
'id' => 'wcf_facebook_pixel_add_payment_info',
|
276 |
+
'name' => '_cartflows_facebook[facebook_pixel_add_payment_info]',
|
277 |
+
'title' => __( 'Add Payment Info', 'cartflows' ),
|
278 |
+
'value' => $facebook_settings['facebook_pixel_add_payment_info'],
|
279 |
+
)
|
280 |
+
);
|
281 |
+
|
282 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
283 |
+
array(
|
284 |
+
'id' => 'wcf_facebook_pixel_purchase_complete',
|
285 |
+
'name' => '_cartflows_facebook[facebook_pixel_purchase_complete]',
|
286 |
+
'title' => __( 'Purchase Complete', 'cartflows' ),
|
287 |
+
'value' => $facebook_settings['facebook_pixel_purchase_complete'],
|
288 |
+
)
|
289 |
+
);
|
290 |
+
|
291 |
+
echo '</div>';
|
292 |
+
|
293 |
+
?>
|
294 |
+
</div>
|
295 |
+
|
296 |
+
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-facebook-setting-save-btn button-primary button', 'submit', false ); ?>
|
297 |
+
<?php wp_nonce_field( 'cartflows-facebook-settings', 'cartflows-facebook-settings-nonce' ); ?>
|
298 |
+
</div>
|
299 |
+
</div>
|
300 |
+
</div>
|
301 |
+
</form>
|
302 |
+
</div>
|
303 |
+
<!-- Facebook Pixel Tracking -->
|
304 |
+
|
305 |
+
<!-- Google Analytics Tracking -->
|
306 |
+
<div class="general-settingss-form postbox">
|
307 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
308 |
+
<span><?php esc_html_e( 'Google Analytics Settings', 'cartflows' ); ?></span>
|
309 |
+
</h2>
|
310 |
+
<div class="inside">
|
311 |
+
<form method="post" class="wrap wcf-clear" action="" >
|
312 |
+
<div class="form-wrap">
|
313 |
+
<?php
|
314 |
+
|
315 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
316 |
+
array(
|
317 |
+
'id' => 'enable_google-analytics-id',
|
318 |
+
'name' => '_cartflows_google_analytics[enable_google_analytics]',
|
319 |
+
'title' => __( 'Enable Google Analytics Tracking', 'cartflows' ),
|
320 |
+
'value' => $google_analytics_settings['enable_google_analytics'],
|
321 |
+
)
|
322 |
+
);
|
323 |
+
|
324 |
+
echo "<div class='wcf-google-analytics-wrapper'>";
|
325 |
+
?>
|
326 |
+
<hr/>
|
327 |
+
<?php
|
328 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
329 |
+
array(
|
330 |
+
'id' => 'enable_google_analytics_for_site',
|
331 |
+
'name' => '_cartflows_google_analytics[enable_google_analytics_for_site]',
|
332 |
+
'title' => __( 'Enable for the whole website', 'cartflows' ),
|
333 |
+
'value' => $google_analytics_settings['enable_google_analytics_for_site'],
|
334 |
+
)
|
335 |
+
);
|
336 |
+
|
337 |
+
echo Cartflows_Admin_Fields::title_field(
|
338 |
+
array(
|
339 |
+
'title' => '',
|
340 |
+
'description' => __( 'If this option is unchecked, it will only apply to CartFlows steps.', 'cartflows' ),
|
341 |
+
)
|
342 |
+
);
|
343 |
+
?>
|
344 |
+
<hr/>
|
345 |
+
<?php
|
346 |
+
echo Cartflows_Admin_Fields::text_field(
|
347 |
+
array(
|
348 |
+
'id' => 'google-analytics-id',
|
349 |
+
'name' => '_cartflows_google_analytics[google_analytics_id]',
|
350 |
+
'title' => __( 'Google Analytics ID', 'cartflows' ),
|
351 |
+
'value' => $google_analytics_settings['google_analytics_id'],
|
352 |
+
'description' => __( 'Log into your <a href="https://analytics.google.com/" target="_blank">google analytics account</a> to find your ID. eg: UA-XXXXXX-X.', 'cartflows' ),
|
353 |
+
)
|
354 |
+
);
|
355 |
+
|
356 |
+
echo Cartflows_Admin_Fields::title_field(
|
357 |
+
array(
|
358 |
+
'title' => __( 'Enable Events:', 'cartflows' ),
|
359 |
+
)
|
360 |
+
);
|
361 |
+
|
362 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
363 |
+
array(
|
364 |
+
'id' => 'enable_begin_checkout',
|
365 |
+
'name' => '_cartflows_google_analytics[enable_begin_checkout]',
|
366 |
+
'title' => __( 'Begin Checkout', 'cartflows' ),
|
367 |
+
'value' => $google_analytics_settings['enable_begin_checkout'],
|
368 |
+
)
|
369 |
+
);
|
370 |
+
|
371 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
372 |
+
array(
|
373 |
+
'id' => 'enable_add_to_cart',
|
374 |
+
'name' => '_cartflows_google_analytics[enable_add_to_cart]',
|
375 |
+
'title' => __( 'Add To Cart', 'cartflows' ),
|
376 |
+
'value' => $google_analytics_settings['enable_add_to_cart'],
|
377 |
+
)
|
378 |
+
);
|
379 |
+
|
380 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
381 |
+
array(
|
382 |
+
'id' => 'enable_add_payment_info',
|
383 |
+
'name' => '_cartflows_google_analytics[enable_add_payment_info]',
|
384 |
+
'title' => __( 'Add Payment Info', 'cartflows' ),
|
385 |
+
'value' => $google_analytics_settings['enable_add_payment_info'],
|
386 |
+
)
|
387 |
+
);
|
388 |
+
|
389 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
390 |
+
array(
|
391 |
+
'id' => 'enable_purchase_event',
|
392 |
+
'name' => '_cartflows_google_analytics[enable_purchase_event]',
|
393 |
+
'title' => __( 'Purchase', 'cartflows' ),
|
394 |
+
'value' => $google_analytics_settings['enable_purchase_event'],
|
395 |
+
)
|
396 |
+
);
|
397 |
+
|
398 |
+
echo Cartflows_Admin_Fields::title_field(
|
399 |
+
array(
|
400 |
+
'title' => '',
|
401 |
+
'description' => __( 'Google Analytics not working correctly? <a href="https://cartflows.com/docs/troubleshooting-google-analytics-tracking-issues/" > Click here </a> to know more. ', 'cartflows' ),
|
402 |
+
)
|
403 |
+
);
|
404 |
+
|
405 |
+
do_action( 'cartflows_google_analytics_admin_fields', $google_analytics_settings );
|
406 |
+
|
407 |
+
echo '</div>';
|
408 |
+
?>
|
409 |
+
|
410 |
+
|
411 |
+
</div>
|
412 |
+
<p>
|
413 |
+
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
414 |
+
<?php wp_nonce_field( 'cartflows-google-analytics-settings', 'cartflows-google-analytics-settings-nonce' ); ?>
|
415 |
+
</p>
|
416 |
+
|
417 |
+
|
418 |
+
</form>
|
419 |
+
</div>
|
420 |
+
</div>
|
421 |
+
<!-- Google Analytics Tracking -->
|
422 |
+
|
423 |
+
<?php do_action( 'cartflows_register_general_settings' ); ?>
|
424 |
+
|
425 |
+
</div>
|
426 |
+
|
427 |
+
<!-- Right Sidebar -->
|
428 |
+
<div class="postbox-container" id="postbox-container-1">
|
429 |
+
<div id="side-sortables">
|
430 |
+
|
431 |
+
<div class="postbox">
|
432 |
+
<h2 class="hndle">
|
433 |
+
<span class="dashicons dashicons-book"></span>
|
434 |
+
<span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
|
435 |
+
</h2>
|
436 |
+
<div class="inside">
|
437 |
+
<p>
|
438 |
+
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
439 |
+
</p>
|
440 |
+
<p>
|
441 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
|
442 |
+
</p>
|
443 |
+
</div>
|
444 |
+
</div>
|
445 |
+
|
446 |
+
<div class="postbox">
|
447 |
+
<h2 class="hndle">
|
448 |
+
<span class="dashicons dashicons-groups"></span>
|
449 |
+
<span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
|
450 |
+
</h2>
|
451 |
+
<div class="inside">
|
452 |
+
<p>
|
453 |
+
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
454 |
+
</p>
|
455 |
+
<p>
|
456 |
+
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
|
457 |
+
</p>
|
458 |
+
</div>
|
459 |
+
</div>
|
460 |
+
|
461 |
+
<div class="postbox">
|
462 |
+
<h2 class="hndle">
|
463 |
+
<span class="dashicons dashicons-sos"></span>
|
464 |
+
<span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
|
465 |
+
</h2>
|
466 |
+
<div class="inside">
|
467 |
+
<p>
|
468 |
+
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
469 |
+
</p>
|
470 |
+
<p>
|
471 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a Ticket »', 'cartflows' ); ?></a>
|
472 |
+
</p>
|
473 |
+
</div>
|
474 |
+
</div>
|
475 |
+
<?php
|
476 |
+
if ( 'true' == $debug_on ) {
|
477 |
+
?>
|
478 |
+
<div class="postbox">
|
479 |
+
<h2 class="hndle">
|
480 |
+
<span class="dashicons dashicons-editor-code"></span>
|
481 |
+
<span><?php esc_html_e( 'Load Minified CSS', 'cartflows' ); ?></span>
|
482 |
+
</h2>
|
483 |
+
<div class="inside">
|
484 |
+
<form method="post" class="wrap wcf-clear" action="">
|
485 |
+
<p>
|
486 |
+
<?php esc_html_e( 'Load the Minified CSS from here. Just Enable it by checking the below given checkbox.', 'cartflows' ); ?>
|
487 |
+
</p>
|
488 |
+
<?php
|
489 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
490 |
+
array(
|
491 |
+
'id' => 'allow_minified_files',
|
492 |
+
'name' => '_cartflows_debug_data[allow_minified_files]',
|
493 |
+
'title' => __( 'Load minified CSS & JS Files', 'cartflows' ),
|
494 |
+
'value' => $debug_data['allow_minified_files'],
|
495 |
+
)
|
496 |
+
);
|
497 |
+
?>
|
498 |
+
<?php submit_button( __( 'Save', 'cartflows' ), 'button-primary button', 'submit', false ); ?>
|
499 |
+
<?php wp_nonce_field( 'cartflows-debug-settings', 'cartflows-debug-settings-nonce' ); ?>
|
500 |
+
</form>
|
501 |
+
</div>
|
502 |
+
</div>
|
503 |
+
<?php
|
504 |
+
}
|
505 |
+
?>
|
506 |
+
</div>
|
507 |
+
</div>
|
508 |
+
<!-- Right Sidebar -->
|
509 |
+
|
510 |
+
</div>
|
511 |
+
<!-- /post-body -->
|
512 |
+
<br class="clear">
|
513 |
+
</div>
|
514 |
+
</div>
|
515 |
+
<?php endif; ?>
|
516 |
+
|
517 |
+
<?php
|
518 |
+
/**
|
519 |
+
* Loads Zapier settings admin view.
|
520 |
+
*/
|
521 |
+
do_action( 'cartflows_after_general_settings' );
|
522 |
+
?>
|
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.5.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
-
"POT-Creation-Date: 2020-04-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -95,8 +95,8 @@ msgid "Design Your Flow"
|
|
95 |
msgstr ""
|
96 |
|
97 |
#: classes/class-cartflows-admin.php:531
|
98 |
-
#: classes/class-cartflows-importer.php:
|
99 |
-
#: classes/class-cartflows-importer.php:
|
100 |
#: modules/flow/view/meta-flow-steps.php:202
|
101 |
msgid "Learn How"
|
102 |
msgstr ""
|
@@ -129,184 +129,184 @@ msgstr ""
|
|
129 |
msgid "Click here to disable it"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: classes/class-cartflows-importer.php:
|
133 |
msgid "Export this flow"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: classes/class-cartflows-importer.php:
|
137 |
msgid "Export"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: classes/class-cartflows-importer.php:
|
141 |
msgid "Flow Export"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: classes/class-cartflows-importer.php:
|
145 |
msgid "Flow Import"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: classes/class-cartflows-importer.php:
|
149 |
msgid "No post to export has been supplied!"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: classes/class-cartflows-importer.php:
|
153 |
msgid "Please upload a valid .json file"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: classes/class-cartflows-importer.php:
|
157 |
msgid "Please upload a file to import"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: classes/class-cartflows-importer.php:
|
161 |
msgid "Successfully imported flows."
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: classes/class-cartflows-importer.php:
|
165 |
msgid "Loading Steps"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: classes/class-cartflows-importer.php:
|
169 |
msgid "Getting steps from the cloud. Please wait for the moment."
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: classes/class-cartflows-importer.php:
|
173 |
msgid "Searching Template.."
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: classes/class-cartflows-importer.php:
|
177 |
msgid "Getting templates from the cloud. Please wait for the moment."
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: classes/class-cartflows-importer.php:
|
181 |
msgid "Importing.."
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: classes/class-cartflows-importer.php:
|
185 |
-
#: classes/class-cartflows-importer.php:
|
186 |
msgid "Imported"
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: classes/class-cartflows-importer.php:
|
190 |
-
#: classes/class-cartflows-importer.php:
|
191 |
msgid "Thanks for patience"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: classes/class-cartflows-importer.php:
|
195 |
-
#: classes/class-cartflows-importer.php:
|
196 |
msgid "Coming Soon!"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: classes/class-cartflows-importer.php:
|
200 |
msgid "Redirecting to the Elementor edit window."
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: classes/class-cartflows-importer.php:
|
204 |
-
#: classes/class-cartflows-importer.php:
|
205 |
msgid "Pro"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: classes/class-cartflows-importer.php:
|
209 |
-
#: classes/class-cartflows-importer.php:
|
210 |
msgid "Activate License"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: classes/class-cartflows-importer.php:
|
214 |
-
#: classes/class-cartflows-importer.php:
|
215 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
216 |
msgid "Get Pro"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: classes/class-cartflows-importer.php:
|
220 |
msgid "Create"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: classes/class-cartflows-importer.php:
|
224 |
msgid "Under Maintenance.."
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: classes/class-cartflows-importer.php:
|
228 |
msgid ""
|
229 |
"If you are seeing this message, most likely our servers are under routine "
|
230 |
"maintenance and we will be back shortly."
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: classes/class-cartflows-importer.php:
|
234 |
msgid ""
|
235 |
"In rare case, it is possible your website is having trouble connecting with "
|
236 |
"ours. If you need help, please feel free to get in touch with us from our "
|
237 |
"website.."
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: classes/class-cartflows-importer.php:
|
241 |
#. translators: %s: Plugin string
|
242 |
msgid ""
|
243 |
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
244 |
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: classes/class-cartflows-importer.php:
|
248 |
msgid "All"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: classes/class-cartflows-importer.php:
|
252 |
msgid "Select Step Type"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: classes/class-cartflows-importer.php:
|
256 |
msgid "Import from Cloud"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: classes/class-cartflows-importer.php:
|
260 |
msgid "Sales Landing"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: classes/class-cartflows-importer.php:
|
264 |
#: modules/flow/classes/class-cartflows-step-post-type.php:251
|
265 |
#: modules/flow/view/meta-flow-steps.php:12
|
266 |
msgid "Checkout (Woo)"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: classes/class-cartflows-importer.php:
|
270 |
#: modules/flow/classes/class-cartflows-step-post-type.php:258
|
271 |
#: modules/flow/view/meta-flow-steps.php:13
|
272 |
msgid "Thank You (Woo)"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: classes/class-cartflows-importer.php:
|
276 |
#: modules/flow/classes/class-cartflows-step-post-type.php:237
|
277 |
#: modules/flow/view/meta-flow-steps.php:11
|
278 |
msgid "Landing"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: classes/class-cartflows-importer.php:
|
282 |
msgid "Thank You"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: classes/class-cartflows-importer.php:
|
286 |
#. translators: %s: template ID
|
287 |
msgid "Invalid template id %1$s or post id %2$s."
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: classes/class-cartflows-importer.php:
|
291 |
#. translators: %s: flow ID
|
292 |
msgid "Invalid flow id %1$s OR step type %2$s."
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: classes/class-cartflows-importer.php:
|
296 |
msgid ""
|
297 |
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
298 |
"to import the step."
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: classes/class-cartflows-importer.php:
|
302 |
msgid "Action failed. Invalid Security Nonce."
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: classes/class-cartflows-importer.php:
|
306 |
msgid "User have not plugin install permissions."
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: classes/class-cartflows-importer.php:
|
310 |
msgid "Plugin Successfully Activated"
|
311 |
msgstr ""
|
312 |
|
@@ -413,7 +413,7 @@ msgid "Update"
|
|
413 |
msgstr ""
|
414 |
|
415 |
#: classes/class-cartflows-meta.php:42
|
416 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
417 |
msgid "Back to edit Flow"
|
418 |
msgstr ""
|
419 |
|
@@ -474,151 +474,151 @@ msgstr ""
|
|
474 |
msgid "Ready!"
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: classes/class-cartflows-wizard.php:
|
478 |
msgid "CartFlows Setup"
|
479 |
msgstr ""
|
480 |
|
481 |
-
#: classes/class-cartflows-wizard.php:
|
482 |
msgid "Exit Setup Wizard"
|
483 |
msgstr ""
|
484 |
|
485 |
-
#: classes/class-cartflows-wizard.php:
|
486 |
msgid "Welcome to CartFlows!"
|
487 |
msgstr ""
|
488 |
|
489 |
-
#: classes/class-cartflows-wizard.php:
|
490 |
msgid ""
|
491 |
"Thank you for choosing CartFlows to get more leads, increase conversions, & "
|
492 |
"maximize profits. This short setup wizard will guide you though configuring "
|
493 |
"CartFlows and creating your first funnel."
|
494 |
msgstr ""
|
495 |
|
496 |
-
#: classes/class-cartflows-wizard.php:
|
497 |
msgid "Lets Go »"
|
498 |
msgstr ""
|
499 |
|
500 |
-
#: classes/class-cartflows-wizard.php:
|
501 |
msgid "Page Builder Setup"
|
502 |
msgstr ""
|
503 |
|
504 |
-
#: classes/class-cartflows-wizard.php:
|
505 |
msgid "Please select a page builder you would like to use with CartFlows."
|
506 |
msgstr ""
|
507 |
|
508 |
-
#: classes/class-cartflows-wizard.php:
|
509 |
msgid "Select Page Builder"
|
510 |
msgstr ""
|
511 |
|
512 |
-
#: classes/class-cartflows-wizard.php:
|
513 |
#: includes/admin/cartflows-general.php:94
|
514 |
msgid "Elementor"
|
515 |
msgstr ""
|
516 |
|
517 |
-
#: classes/class-cartflows-wizard.php:
|
518 |
msgid "Beaver Builder Plugin (Lite Version)"
|
519 |
msgstr ""
|
520 |
|
521 |
-
#: classes/class-cartflows-wizard.php:
|
522 |
#: includes/admin/cartflows-general.php:96
|
523 |
msgid "Divi"
|
524 |
msgstr ""
|
525 |
|
526 |
-
#: classes/class-cartflows-wizard.php:
|
527 |
#: includes/admin/cartflows-general.php:97
|
528 |
msgid "Other"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: classes/class-cartflows-wizard.php:
|
532 |
msgid ""
|
533 |
"While CartFlows Should work with most page builders, we offer templates for "
|
534 |
"the above page builders."
|
535 |
msgstr ""
|
536 |
|
537 |
-
#: classes/class-cartflows-wizard.php:
|
538 |
-
#: classes/class-cartflows-wizard.php:
|
539 |
-
#: classes/class-cartflows-wizard.php:
|
540 |
msgid "« Previous"
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: classes/class-cartflows-wizard.php:
|
544 |
msgid "Skip this step"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: classes/class-cartflows-wizard.php:
|
548 |
msgid "Next »"
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: classes/class-cartflows-wizard.php:
|
552 |
msgid "Choose a checkout"
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: classes/class-cartflows-wizard.php:
|
556 |
msgid ""
|
557 |
"While CartFlows is designed to use WooCommerce sell digital and physical "
|
558 |
"products, not all funnels need a checkout system."
|
559 |
msgstr ""
|
560 |
|
561 |
-
#: classes/class-cartflows-wizard.php:
|
562 |
msgid ""
|
563 |
"Would you like to install WooCommerce to sell digital and physical products "
|
564 |
"in your funnels?"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: classes/class-cartflows-wizard.php:
|
568 |
msgid "The following plugin will be installed and activated for you:"
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: classes/class-cartflows-wizard.php:
|
572 |
msgid "WooCommerce"
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: classes/class-cartflows-wizard.php:
|
576 |
msgid "WooCommerce Cart Abandonment Recovery"
|
577 |
msgstr ""
|
578 |
|
579 |
-
#: classes/class-cartflows-wizard.php:
|
580 |
-
#: classes/class-cartflows-wizard.php:
|
581 |
msgid "No thanks"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: classes/class-cartflows-wizard.php:
|
585 |
msgid "Yes"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: classes/class-cartflows-wizard.php:
|
589 |
msgid "Congratulations, You Did It!"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: classes/class-cartflows-wizard.php:
|
593 |
msgid ""
|
594 |
"CartFlows is ready to use on your website. You've successfully completed "
|
595 |
"the setup process and all that is left for you to do is create your first "
|
596 |
"flow."
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: classes/class-cartflows-wizard.php:
|
600 |
msgid "Create a flow"
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: classes/class-cartflows-wizard.php:
|
604 |
msgid "Exclusive CartFlows Training Course Offer"
|
605 |
msgstr ""
|
606 |
|
607 |
-
#: classes/class-cartflows-wizard.php:
|
608 |
msgid ""
|
609 |
"We want you to get off to a great start using CartFlows, so we would like "
|
610 |
"to give access to our exclusive training course."
|
611 |
msgstr ""
|
612 |
|
613 |
-
#: classes/class-cartflows-wizard.php:
|
614 |
msgid "Get access to this couse, for free, by entering your email below."
|
615 |
msgstr ""
|
616 |
|
617 |
-
#: classes/class-cartflows-wizard.php:
|
618 |
msgid "Enter Email address"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#: classes/class-cartflows-wizard.php:
|
622 |
msgid "Allow"
|
623 |
msgstr ""
|
624 |
|
@@ -1298,77 +1298,50 @@ msgstr ""
|
|
1298 |
msgid "All Rights Reserved"
|
1299 |
msgstr ""
|
1300 |
|
1301 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1302 |
-
#. translators: %s flow id
|
1303 |
-
msgid "Steps not created for flow - %s"
|
1304 |
-
msgstr ""
|
1305 |
-
|
1306 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:213
|
1307 |
-
#. translators: %s flow id
|
1308 |
-
msgid "Steps already exists. Flow - %s"
|
1309 |
-
msgstr ""
|
1310 |
-
|
1311 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:224
|
1312 |
-
msgid "Landing Page"
|
1313 |
-
msgstr ""
|
1314 |
-
|
1315 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:225
|
1316 |
-
msgid "Checkout Page"
|
1317 |
-
msgstr ""
|
1318 |
-
|
1319 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:226
|
1320 |
-
msgid "Thank You Page"
|
1321 |
-
msgstr ""
|
1322 |
-
|
1323 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:262
|
1324 |
-
#. translators: %s flow id
|
1325 |
-
msgid "Steps created for flow - %s"
|
1326 |
-
msgstr ""
|
1327 |
-
|
1328 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:334
|
1329 |
#. translators: %s flow id
|
1330 |
msgid "Step not deleted for flow - %s"
|
1331 |
msgstr ""
|
1332 |
|
1333 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1334 |
#. translators: %s flow id
|
1335 |
msgid "Step deleted for flow - %s"
|
1336 |
msgstr ""
|
1337 |
|
1338 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1339 |
#. translators: %s flow id
|
1340 |
msgid "Steps not sorted for flow - %s"
|
1341 |
msgstr ""
|
1342 |
|
1343 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1344 |
#. translators: %s flow id
|
1345 |
msgid "Steps sorted for flow - %s"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1349 |
msgid "Analytics"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1353 |
#. translators: %s: link
|
1354 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Analytics feature"
|
1355 |
msgstr ""
|
1356 |
|
1357 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1358 |
msgid "Flow Settings"
|
1359 |
msgstr ""
|
1360 |
|
1361 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1362 |
msgid "Enable Test Mode"
|
1363 |
msgstr ""
|
1364 |
|
1365 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1366 |
msgid ""
|
1367 |
"If you are using WooCommerce plugin then test mode will add random products "
|
1368 |
"in your flow, so you can preview it easily while testing."
|
1369 |
msgstr ""
|
1370 |
|
1371 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:
|
1372 |
#: modules/flow/view/meta-flow-steps.php:133
|
1373 |
msgid "Add New Step"
|
1374 |
msgstr ""
|
2 |
# This file is distributed under the same license as the CartFlows package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: CartFlows 1.5.4\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
+
"POT-Creation-Date: 2020-04-07 06:33:57+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
95 |
msgstr ""
|
96 |
|
97 |
#: classes/class-cartflows-admin.php:531
|
98 |
+
#: classes/class-cartflows-importer.php:637
|
99 |
+
#: classes/class-cartflows-importer.php:736
|
100 |
#: modules/flow/view/meta-flow-steps.php:202
|
101 |
msgid "Learn How"
|
102 |
msgstr ""
|
129 |
msgid "Click here to disable it"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: classes/class-cartflows-importer.php:81
|
133 |
msgid "Export this flow"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: classes/class-cartflows-importer.php:81 includes/exporter.php:18
|
137 |
msgid "Export"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: classes/class-cartflows-importer.php:92
|
141 |
msgid "Flow Export"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: classes/class-cartflows-importer.php:93
|
145 |
msgid "Flow Import"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: classes/class-cartflows-importer.php:104
|
149 |
msgid "No post to export has been supplied!"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: classes/class-cartflows-importer.php:295
|
153 |
msgid "Please upload a valid .json file"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: classes/class-cartflows-importer.php:301
|
157 |
msgid "Please upload a file to import"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: classes/class-cartflows-importer.php:478
|
161 |
msgid "Successfully imported flows."
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: classes/class-cartflows-importer.php:510
|
165 |
msgid "Loading Steps"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: classes/class-cartflows-importer.php:512
|
169 |
msgid "Getting steps from the cloud. Please wait for the moment."
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/class-cartflows-importer.php:523
|
173 |
msgid "Searching Template.."
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: classes/class-cartflows-importer.php:525
|
177 |
msgid "Getting templates from the cloud. Please wait for the moment."
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: classes/class-cartflows-importer.php:534
|
181 |
msgid "Importing.."
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: classes/class-cartflows-importer.php:543
|
185 |
+
#: classes/class-cartflows-importer.php:583
|
186 |
msgid "Imported"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: classes/class-cartflows-importer.php:544
|
190 |
+
#: classes/class-cartflows-importer.php:584
|
191 |
msgid "Thanks for patience"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: classes/class-cartflows-importer.php:553
|
195 |
+
#: classes/class-cartflows-importer.php:565
|
196 |
msgid "Coming Soon!"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: classes/class-cartflows-importer.php:584
|
200 |
msgid "Redirecting to the Elementor edit window."
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: classes/class-cartflows-importer.php:630
|
204 |
+
#: classes/class-cartflows-importer.php:746
|
205 |
msgid "Pro"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: classes/class-cartflows-importer.php:671
|
209 |
+
#: classes/class-cartflows-importer.php:778
|
210 |
msgid "Activate License"
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: classes/class-cartflows-importer.php:673
|
214 |
+
#: classes/class-cartflows-importer.php:780
|
215 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:461
|
216 |
msgid "Get Pro"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: classes/class-cartflows-importer.php:698
|
220 |
msgid "Create"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: classes/class-cartflows-importer.php:797
|
224 |
msgid "Under Maintenance.."
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: classes/class-cartflows-importer.php:798
|
228 |
msgid ""
|
229 |
"If you are seeing this message, most likely our servers are under routine "
|
230 |
"maintenance and we will be back shortly."
|
231 |
msgstr ""
|
232 |
|
233 |
+
#: classes/class-cartflows-importer.php:799
|
234 |
msgid ""
|
235 |
"In rare case, it is possible your website is having trouble connecting with "
|
236 |
"ours. If you need help, please feel free to get in touch with us from our "
|
237 |
"website.."
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: classes/class-cartflows-importer.php:829
|
241 |
#. translators: %s: Plugin string
|
242 |
msgid ""
|
243 |
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
244 |
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: classes/class-cartflows-importer.php:844
|
248 |
msgid "All"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: classes/class-cartflows-importer.php:847
|
252 |
msgid "Select Step Type"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: classes/class-cartflows-importer.php:931
|
256 |
msgid "Import from Cloud"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: classes/class-cartflows-importer.php:1230
|
260 |
msgid "Sales Landing"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: classes/class-cartflows-importer.php:1234
|
264 |
#: modules/flow/classes/class-cartflows-step-post-type.php:251
|
265 |
#: modules/flow/view/meta-flow-steps.php:12
|
266 |
msgid "Checkout (Woo)"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: classes/class-cartflows-importer.php:1238
|
270 |
#: modules/flow/classes/class-cartflows-step-post-type.php:258
|
271 |
#: modules/flow/view/meta-flow-steps.php:13
|
272 |
msgid "Thank You (Woo)"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: classes/class-cartflows-importer.php:1246
|
276 |
#: modules/flow/classes/class-cartflows-step-post-type.php:237
|
277 |
#: modules/flow/view/meta-flow-steps.php:11
|
278 |
msgid "Landing"
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: classes/class-cartflows-importer.php:1250
|
282 |
msgid "Thank You"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: classes/class-cartflows-importer.php:1360
|
286 |
#. translators: %s: template ID
|
287 |
msgid "Invalid template id %1$s or post id %2$s."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: classes/class-cartflows-importer.php:1422
|
291 |
#. translators: %s: flow ID
|
292 |
msgid "Invalid flow id %1$s OR step type %2$s."
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: classes/class-cartflows-importer.php:1547
|
296 |
msgid ""
|
297 |
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
298 |
"to import the step."
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: classes/class-cartflows-importer.php:1650
|
302 |
msgid "Action failed. Invalid Security Nonce."
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: classes/class-cartflows-importer.php:1657
|
306 |
msgid "User have not plugin install permissions."
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: classes/class-cartflows-importer.php:1679
|
310 |
msgid "Plugin Successfully Activated"
|
311 |
msgstr ""
|
312 |
|
413 |
msgstr ""
|
414 |
|
415 |
#: classes/class-cartflows-meta.php:42
|
416 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:82
|
417 |
msgid "Back to edit Flow"
|
418 |
msgstr ""
|
419 |
|
474 |
msgid "Ready!"
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: classes/class-cartflows-wizard.php:209
|
478 |
msgid "CartFlows Setup"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: classes/class-cartflows-wizard.php:235
|
482 |
msgid "Exit Setup Wizard"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: classes/class-cartflows-wizard.php:288
|
486 |
msgid "Welcome to CartFlows!"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: classes/class-cartflows-wizard.php:289
|
490 |
msgid ""
|
491 |
"Thank you for choosing CartFlows to get more leads, increase conversions, & "
|
492 |
"maximize profits. This short setup wizard will guide you though configuring "
|
493 |
"CartFlows and creating your first funnel."
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: classes/class-cartflows-wizard.php:295
|
497 |
msgid "Lets Go »"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: classes/class-cartflows-wizard.php:322
|
501 |
msgid "Page Builder Setup"
|
502 |
msgstr ""
|
503 |
|
504 |
+
#: classes/class-cartflows-wizard.php:323
|
505 |
msgid "Please select a page builder you would like to use with CartFlows."
|
506 |
msgstr ""
|
507 |
|
508 |
+
#: classes/class-cartflows-wizard.php:328
|
509 |
msgid "Select Page Builder"
|
510 |
msgstr ""
|
511 |
|
512 |
+
#: classes/class-cartflows-wizard.php:335
|
513 |
#: includes/admin/cartflows-general.php:94
|
514 |
msgid "Elementor"
|
515 |
msgstr ""
|
516 |
|
517 |
+
#: classes/class-cartflows-wizard.php:345
|
518 |
msgid "Beaver Builder Plugin (Lite Version)"
|
519 |
msgstr ""
|
520 |
|
521 |
+
#: classes/class-cartflows-wizard.php:355
|
522 |
#: includes/admin/cartflows-general.php:96
|
523 |
msgid "Divi"
|
524 |
msgstr ""
|
525 |
|
526 |
+
#: classes/class-cartflows-wizard.php:365
|
527 |
#: includes/admin/cartflows-general.php:97
|
528 |
msgid "Other"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: classes/class-cartflows-wizard.php:387
|
532 |
msgid ""
|
533 |
"While CartFlows Should work with most page builders, we offer templates for "
|
534 |
"the above page builders."
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: classes/class-cartflows-wizard.php:390
|
538 |
+
#: classes/class-cartflows-wizard.php:435
|
539 |
+
#: classes/class-cartflows-wizard.php:622
|
540 |
msgid "« Previous"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: classes/class-cartflows-wizard.php:393
|
544 |
msgid "Skip this step"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: classes/class-cartflows-wizard.php:394
|
548 |
msgid "Next »"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: classes/class-cartflows-wizard.php:413
|
552 |
msgid "Choose a checkout"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: classes/class-cartflows-wizard.php:416
|
556 |
msgid ""
|
557 |
"While CartFlows is designed to use WooCommerce sell digital and physical "
|
558 |
"products, not all funnels need a checkout system."
|
559 |
msgstr ""
|
560 |
|
561 |
+
#: classes/class-cartflows-wizard.php:418
|
562 |
msgid ""
|
563 |
"Would you like to install WooCommerce to sell digital and physical products "
|
564 |
"in your funnels?"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: classes/class-cartflows-wizard.php:425
|
568 |
msgid "The following plugin will be installed and activated for you:"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: classes/class-cartflows-wizard.php:426
|
572 |
msgid "WooCommerce"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: classes/class-cartflows-wizard.php:427
|
576 |
msgid "WooCommerce Cart Abandonment Recovery"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: classes/class-cartflows-wizard.php:438
|
580 |
+
#: classes/class-cartflows-wizard.php:625
|
581 |
msgid "No thanks"
|
582 |
msgstr ""
|
583 |
|
584 |
+
#: classes/class-cartflows-wizard.php:439
|
585 |
msgid "Yes"
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: classes/class-cartflows-wizard.php:558
|
589 |
msgid "Congratulations, You Did It!"
|
590 |
msgstr ""
|
591 |
|
592 |
+
#: classes/class-cartflows-wizard.php:565
|
593 |
msgid ""
|
594 |
"CartFlows is ready to use on your website. You've successfully completed "
|
595 |
"the setup process and all that is left for you to do is create your first "
|
596 |
"flow."
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: classes/class-cartflows-wizard.php:579
|
600 |
msgid "Create a flow"
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: classes/class-cartflows-wizard.php:596
|
604 |
msgid "Exclusive CartFlows Training Course Offer"
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: classes/class-cartflows-wizard.php:607
|
608 |
msgid ""
|
609 |
"We want you to get off to a great start using CartFlows, so we would like "
|
610 |
"to give access to our exclusive training course."
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: classes/class-cartflows-wizard.php:608
|
614 |
msgid "Get access to this couse, for free, by entering your email below."
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: classes/class-cartflows-wizard.php:610
|
618 |
msgid "Enter Email address"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: classes/class-cartflows-wizard.php:626
|
622 |
msgid "Allow"
|
623 |
msgstr ""
|
624 |
|
1298 |
msgid "All Rights Reserved"
|
1299 |
msgstr ""
|
1300 |
|
1301 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:250
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1302 |
#. translators: %s flow id
|
1303 |
msgid "Step not deleted for flow - %s"
|
1304 |
msgstr ""
|
1305 |
|
1306 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:281
|
1307 |
#. translators: %s flow id
|
1308 |
msgid "Step deleted for flow - %s"
|
1309 |
msgstr ""
|
1310 |
|
1311 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:309
|
1312 |
#. translators: %s flow id
|
1313 |
msgid "Steps not sorted for flow - %s"
|
1314 |
msgstr ""
|
1315 |
|
1316 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:332
|
1317 |
#. translators: %s flow id
|
1318 |
msgid "Steps sorted for flow - %s"
|
1319 |
msgstr ""
|
1320 |
|
1321 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:443
|
1322 |
msgid "Analytics"
|
1323 |
msgstr ""
|
1324 |
|
1325 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:460
|
1326 |
#. translators: %s: link
|
1327 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Analytics feature"
|
1328 |
msgstr ""
|
1329 |
|
1330 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:478
|
1331 |
msgid "Flow Settings"
|
1332 |
msgstr ""
|
1333 |
|
1334 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:563
|
1335 |
msgid "Enable Test Mode"
|
1336 |
msgstr ""
|
1337 |
|
1338 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:570
|
1339 |
msgid ""
|
1340 |
"If you are using WooCommerce plugin then test mode will add random products "
|
1341 |
"in your flow, so you can preview it easily while testing."
|
1342 |
msgstr ""
|
1343 |
|
1344 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:689
|
1345 |
#: modules/flow/view/meta-flow-steps.php:133
|
1346 |
msgid "Add New Step"
|
1347 |
msgstr ""
|
modules/checkout/classes/class-cartflows-checkout-markup.php
CHANGED
@@ -1,1158 +1,1158 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Checkout markup.
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Checkout Markup
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Checkout_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 |
-
/* Set is checkout flag */
|
38 |
-
add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
|
39 |
-
|
40 |
-
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_checkout_fields' ), 10, 2 );
|
41 |
-
|
42 |
-
/* Show notice if cart is empty */
|
43 |
-
add_action( 'cartflows_checkout_cart_empty', array( $this, 'display_woo_notices' ) );
|
44 |
-
|
45 |
-
/* Checkout Shortcode */
|
46 |
-
add_shortcode( 'cartflows_checkout', array( $this, 'checkout_shortcode_markup' ) );
|
47 |
-
|
48 |
-
/* Preconfigured cart data */
|
49 |
-
add_action( 'wp', array( $this, 'preconfigured_cart_data' ), 1 );
|
50 |
-
|
51 |
-
/* Embed Checkout */
|
52 |
-
add_action( 'wp', array( $this, 'shortcode_load_data' ), 999 );
|
53 |
-
|
54 |
-
/* Ajax Endpoint */
|
55 |
-
add_filter( 'woocommerce_ajax_get_endpoint', array( $this, 'get_ajax_endpoint' ), 10, 2 );
|
56 |
-
|
57 |
-
add_filter( 'cartflows_add_before_main_section', array( $this, 'enable_logo_in_header' ) );
|
58 |
-
|
59 |
-
add_filter( 'cartflows_primary_container_bottom', array( $this, 'show_cartflows_copyright_message' ) );
|
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 |
-
add_action( 'wp_ajax_wcf_woo_remove_cart_product', array( $this, 'wcf_woo_remove_cart_product' ) );
|
75 |
-
add_action( 'wp_ajax_nopriv_wcf_woo_remove_cart_product', array( $this, 'wcf_woo_remove_cart_product' ) );
|
76 |
-
|
77 |
-
add_filter( 'woocommerce_paypal_args', array( $this, 'modify_paypal_args' ), 10, 2 );
|
78 |
-
|
79 |
-
add_filter( 'woocommerce_cart_item_name', array( $this, 'wcf_add_remove_label' ), 10, 3 );
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Modify WooCommerce paypal arguments.
|
84 |
-
*
|
85 |
-
* @param array $args argumenets for payment.
|
86 |
-
* @param WC_Order $order order data.
|
87 |
-
* @return array
|
88 |
-
*/
|
89 |
-
public function modify_paypal_args( $args, $order ) {
|
90 |
-
|
91 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
92 |
-
|
93 |
-
if ( ! $checkout_id ) {
|
94 |
-
return $args;
|
95 |
-
}
|
96 |
-
|
97 |
-
// Set cancel return URL.
|
98 |
-
$args['cancel_return'] = esc_url_raw( $order->get_cancel_order_url_raw( get_permalink( $checkout_id ) ) );
|
99 |
-
|
100 |
-
return $args;
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Modify WooCommerce paypal arguments.
|
105 |
-
*
|
106 |
-
* @param string $product_name product name.
|
107 |
-
* @param object $cart_item cart item.
|
108 |
-
* @param string $cart_item_key cart item key.
|
109 |
-
* @return string
|
110 |
-
*/
|
111 |
-
public function wcf_add_remove_label( $product_name, $cart_item, $cart_item_key ) {
|
112 |
-
|
113 |
-
$checkout_id = get_the_ID();
|
114 |
-
if ( ! $checkout_id ) {
|
115 |
-
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? wp_unslash( $_POST['option']['checkout_id'] ) : '';//phpcs:ignore
|
116 |
-
}
|
117 |
-
|
118 |
-
if ( ! empty( $checkout_id ) ) {
|
119 |
-
$is_remove_product_option = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-remove-product-field' );
|
120 |
-
if ( 'checkout' === get_post_meta( $checkout_id, 'wcf-step-type', true ) && ( 'yes' === $is_remove_product_option ) ) {
|
121 |
-
$remove_label = apply_filters(
|
122 |
-
'woocommerce_cart_item_remove_link',
|
123 |
-
sprintf(
|
124 |
-
'<a href="#" rel="nofollow" class="remove cartflows-icon-close" data-id="%s" data-item-key="%s" ></a>',
|
125 |
-
esc_attr( $cart_item['product_id'] ),
|
126 |
-
$cart_item_key
|
127 |
-
),
|
128 |
-
$cart_item_key
|
129 |
-
);
|
130 |
-
|
131 |
-
$product_name = $remove_label . $product_name;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
return $product_name;
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Change order button text .
|
141 |
-
*
|
142 |
-
* @param string $woo_button_text place order.
|
143 |
-
* @return string
|
144 |
-
*/
|
145 |
-
public function place_order_button_text( $woo_button_text ) {
|
146 |
-
|
147 |
-
$checkout_id = get_the_ID();
|
148 |
-
if ( ! $checkout_id ) {
|
149 |
-
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? intval( $_POST['option']['checkout_id'] ) : 0; //phpcs:ignore
|
150 |
-
}
|
151 |
-
|
152 |
-
$wcf_order_button_text = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-place-order-button-text' );
|
153 |
-
|
154 |
-
if ( ! empty( $wcf_order_button_text ) ) {
|
155 |
-
$woo_button_text = $wcf_order_button_text;
|
156 |
-
}
|
157 |
-
|
158 |
-
return $woo_button_text;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Display all WooCommerce notices.
|
163 |
-
*
|
164 |
-
* @since 1.1.5
|
165 |
-
*/
|
166 |
-
public function display_woo_notices() {
|
167 |
-
|
168 |
-
if ( null != WC()->session && function_exists( 'woocommerce_output_all_notices' ) ) {
|
169 |
-
woocommerce_output_all_notices();
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Redirect from default to the global checkout page
|
176 |
-
*
|
177 |
-
* @since 1.0.0
|
178 |
-
*/
|
179 |
-
public function global_checkout_template_redirect() {
|
180 |
-
|
181 |
-
if ( ! is_checkout() ) {
|
182 |
-
return;
|
183 |
-
}
|
184 |
-
|
185 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
186 |
-
return;
|
187 |
-
}
|
188 |
-
|
189 |
-
// Return if the key OR Order paramater is found in the URL for certain Payment gateways.
|
190 |
-
if ( isset( $_GET['key'] ) || isset( $_GET['order'] ) ) { //phpcs:ignore
|
191 |
-
return;
|
192 |
-
}
|
193 |
-
|
194 |
-
// redirect only for cartflows checkout pages.
|
195 |
-
$order_pay_endpoint = get_option( 'woocommerce_checkout_pay_endpoint', 'order-pay' );
|
196 |
-
$order_received_endpoint = get_option( 'woocommerce_checkout_order_received_endpoint', 'order-received' );
|
197 |
-
|
198 |
-
$common = Cartflows_Helper::get_common_settings();
|
199 |
-
|
200 |
-
$global_checkout = $common['global_checkout'];
|
201 |
-
|
202 |
-
if (
|
203 |
-
isset( $_SERVER['REQUEST_URI'] ) &&
|
204 |
-
// ignore on order-pay.
|
205 |
-
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_pay_endpoint . '/' ) &&
|
206 |
-
// ignore on TY page.
|
207 |
-
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_received_endpoint . '/' ) &&
|
208 |
-
// ignore if order-pay in query param.
|
209 |
-
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), $order_pay_endpoint . '=' )
|
210 |
-
) {
|
211 |
-
|
212 |
-
if ( '' !== $global_checkout ) {
|
213 |
-
|
214 |
-
$link = apply_filters( 'cartflows_global_checkout_url', get_permalink( $global_checkout ) );
|
215 |
-
|
216 |
-
if ( ! empty( $link ) ) {
|
217 |
-
|
218 |
-
wp_safe_redirect( $link );
|
219 |
-
die();
|
220 |
-
}
|
221 |
-
}
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Check for checkout flag
|
227 |
-
*
|
228 |
-
* @param bool $is_checkout is checkout.
|
229 |
-
*
|
230 |
-
* @return bool
|
231 |
-
*/
|
232 |
-
public function woo_checkout_flag( $is_checkout ) {
|
233 |
-
|
234 |
-
if ( ! is_admin() ) {
|
235 |
-
|
236 |
-
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
237 |
-
|
238 |
-
$is_checkout = true;
|
239 |
-
}
|
240 |
-
}
|
241 |
-
|
242 |
-
return $is_checkout;
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Render checkout shortcode markup.
|
247 |
-
*
|
248 |
-
* @param array $atts attributes.
|
249 |
-
* @return string
|
250 |
-
*/
|
251 |
-
public function checkout_shortcode_markup( $atts ) {
|
252 |
-
|
253 |
-
if ( ! function_exists( 'wc_print_notices' ) ) {
|
254 |
-
$notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
|
255 |
-
$notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
|
256 |
-
|
257 |
-
return $notice_out;
|
258 |
-
}
|
259 |
-
|
260 |
-
$atts = shortcode_atts(
|
261 |
-
array(
|
262 |
-
'id' => 0,
|
263 |
-
),
|
264 |
-
$atts
|
265 |
-
);
|
266 |
-
|
267 |
-
$checkout_id = intval( $atts['id'] );
|
268 |
-
|
269 |
-
if ( empty( $checkout_id ) ) {
|
270 |
-
|
271 |
-
if ( ! _is_wcf_checkout_type() ) {
|
272 |
-
|
273 |
-
return '<h4>' . __( 'Checkout ID not found', 'cartflows' ) . '</h4>';
|
274 |
-
}
|
275 |
-
|
276 |
-
global $post;
|
277 |
-
|
278 |
-
$checkout_id = intval( $post->ID );
|
279 |
-
}
|
280 |
-
|
281 |
-
$output = '';
|
282 |
-
|
283 |
-
ob_start();
|
284 |
-
|
285 |
-
do_action( 'cartflows_checkout_form_before', $checkout_id );
|
286 |
-
|
287 |
-
$checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
|
288 |
-
|
289 |
-
$template_default = CARTFLOWS_CHECKOUT_DIR . 'templates/embed/checkout-template-simple.php';
|
290 |
-
|
291 |
-
$template_layout = apply_filters( 'cartflows_checkout_layout_template', $checkout_layout );
|
292 |
-
|
293 |
-
if ( file_exists( $template_layout ) ) {
|
294 |
-
include $template_layout;
|
295 |
-
} else {
|
296 |
-
include $template_default;
|
297 |
-
}
|
298 |
-
|
299 |
-
$output .= ob_get_clean();
|
300 |
-
|
301 |
-
return $output;
|
302 |
-
}
|
303 |
-
|
304 |
-
/**
|
305 |
-
* Configure Cart Data.
|
306 |
-
*
|
307 |
-
* @since 1.0.0
|
308 |
-
*
|
309 |
-
* @return void
|
310 |
-
*/
|
311 |
-
public function preconfigured_cart_data() {
|
312 |
-
|
313 |
-
if ( is_admin() ) {
|
314 |
-
return;
|
315 |
-
}
|
316 |
-
|
317 |
-
global $post;
|
318 |
-
|
319 |
-
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
320 |
-
|
321 |
-
if ( wp_doing_ajax() ) {
|
322 |
-
return;
|
323 |
-
} else {
|
324 |
-
|
325 |
-
if ( _is_wcf_checkout_type() ) {
|
326 |
-
$checkout_id = $post->ID;
|
327 |
-
} else {
|
328 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
329 |
-
}
|
330 |
-
|
331 |
-
$global_checkout = intval( Cartflows_Helper::get_common_setting( 'global_checkout' ) );
|
332 |
-
|
333 |
-
if ( ! empty( $global_checkout ) && $checkout_id === $global_checkout ) {
|
334 |
-
|
335 |
-
if ( WC()->cart->is_empty() ) {
|
336 |
-
wc_add_notice( __( 'Your cart is currently empty.', 'cartflows' ), 'error' );
|
337 |
-
}
|
338 |
-
|
339 |
-
return;
|
340 |
-
}
|
341 |
-
|
342 |
-
if ( apply_filters( 'cartflows_skip_configure_cart', false, $checkout_id ) ) {
|
343 |
-
return;
|
344 |
-
}
|
345 |
-
|
346 |
-
do_action( 'cartflows_checkout_before_configure_cart', $checkout_id );
|
347 |
-
|
348 |
-
$flow_id = wcf()->utils->get_flow_id_from_step_id( $checkout_id );
|
349 |
-
|
350 |
-
if ( wcf()->flow->is_flow_testmode( $flow_id ) ) {
|
351 |
-
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products', 'dummy' );
|
352 |
-
} else {
|
353 |
-
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products' );
|
354 |
-
}
|
355 |
-
|
356 |
-
if ( ! is_array( $products ) ) {
|
357 |
-
|
358 |
-
if ( 'dummy' === $products ) {
|
359 |
-
|
360 |
-
$args = array(
|
361 |
-
'posts_per_page' => 1,
|
362 |
-
'orderby' => 'rand',
|
363 |
-
'post_type' => 'product',
|
364 |
-
'meta_query' => array( //phpcs:ignore
|
365 |
-
// Exclude out of stock products.
|
366 |
-
array(
|
367 |
-
'key' => '_stock_status',
|
368 |
-
'value' => 'outofstock',
|
369 |
-
'compare' => 'NOT IN',
|
370 |
-
),
|
371 |
-
),
|
372 |
-
'tax_query' => array( //phpcs:ignore
|
373 |
-
array(
|
374 |
-
'taxonomy' => 'product_type',
|
375 |
-
'field' => 'slug',
|
376 |
-
'terms' => 'simple',
|
377 |
-
),
|
378 |
-
),
|
379 |
-
);
|
380 |
-
|
381 |
-
$random_product = get_posts( $args );
|
382 |
-
|
383 |
-
if ( isset( $random_product[0]->ID ) ) {
|
384 |
-
$products = array(
|
385 |
-
array(
|
386 |
-
'product' => $random_product[0]->ID,
|
387 |
-
),
|
388 |
-
);
|
389 |
-
} else {
|
390 |
-
return;
|
391 |
-
}
|
392 |
-
} else {
|
393 |
-
return;
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
/* Empty the current cart */
|
398 |
-
WC()->cart->empty_cart();
|
399 |
-
|
400 |
-
if ( is_array( $products ) && count( $products ) < 1 ) {
|
401 |
-
wc_add_notice( __( 'No product is selected. Please select products from the checkout meta settings to continue.', 'cartflows' ), 'error' );
|
402 |
-
return;
|
403 |
-
}
|
404 |
-
|
405 |
-
/* Set customer session if not set */
|
406 |
-
if ( ! is_user_logged_in() && WC()->cart->is_empty() ) {
|
407 |
-
WC()->session->set_customer_session_cookie( true );
|
408 |
-
}
|
409 |
-
|
410 |
-
$cart_product_count = 0;
|
411 |
-
|
412 |
-
foreach ( $products as $index => $data ) {
|
413 |
-
|
414 |
-
if ( ! isset( $data['product'] ) ) {
|
415 |
-
return;
|
416 |
-
}
|
417 |
-
|
418 |
-
if ( apply_filters( 'cartflows_skip_other_products', false, $cart_product_count ) ) {
|
419 |
-
break;
|
420 |
-
}
|
421 |
-
|
422 |
-
$product_id = $data['product'];
|
423 |
-
$_product = wc_get_product( $product_id );
|
424 |
-
|
425 |
-
if ( ! empty( $_product ) ) {
|
426 |
-
|
427 |
-
$quantity = 1;
|
428 |
-
|
429 |
-
if ( ! $_product->is_type( 'grouped' ) && ! $_product->is_type( 'external' ) ) {
|
430 |
-
|
431 |
-
if ( $_product->is_type( 'variable' ) ) {
|
432 |
-
|
433 |
-
$default_attributes = $_product->get_default_attributes();
|
434 |
-
|
435 |
-
if ( ! empty( $default_attributes ) ) {
|
436 |
-
|
437 |
-
foreach ( $_product->get_children() as $variation_id ) {
|
438 |
-
|
439 |
-
$single_variation = new WC_Product_Variation( $variation_id );
|
440 |
-
|
441 |
-
if ( $default_attributes == $single_variation->get_attributes() ) {
|
442 |
-
WC()->cart->add_to_cart( $variation_id, $quantity );
|
443 |
-
$cart_product_count++;
|
444 |
-
}
|
445 |
-
}
|
446 |
-
} else {
|
447 |
-
|
448 |
-
$product_childrens = $_product->get_children();
|
449 |
-
|
450 |
-
if ( isset( $product_childrens[0] ) ) {
|
451 |
-
WC()->cart->add_to_cart( $product_childrens[0], $quantity );
|
452 |
-
$cart_product_count++;
|
453 |
-
} else {
|
454 |
-
echo '<p>' . esc_html__( 'Variations Not set', 'cartflows' ) . '</p>';
|
455 |
-
}
|
456 |
-
}
|
457 |
-
} else {
|
458 |
-
WC()->cart->add_to_cart( $product_id, $quantity );
|
459 |
-
$cart_product_count++;
|
460 |
-
}
|
461 |
-
} else {
|
462 |
-
$wrong_product_notice = __( 'This product can\'t be purchased', 'cartflows' );
|
463 |
-
wc_add_notice( $wrong_product_notice );
|
464 |
-
/**
|
465 |
-
WC()->cart->add_to_cart( $product_id, $quantity );.
|
466 |
-
*/
|
467 |
-
}
|
468 |
-
}
|
469 |
-
}
|
470 |
-
|
471 |
-
/* Since 1.2.2 */
|
472 |
-
wcf_do_action_deprecated( 'cartflows_checkout_aftet_configure_cart', array( $checkout_id ), '1.2.2', 'cartflows_checkout_after_configure_cart' );
|
473 |
-
do_action( 'cartflows_checkout_after_configure_cart', $checkout_id );
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
/**
|
479 |
-
* Load shortcode data.
|
480 |
-
*
|
481 |
-
* @return void
|
482 |
-
*/
|
483 |
-
public function shortcode_load_data() {
|
484 |
-
|
485 |
-
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
486 |
-
|
487 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_scripts' ), 21 );
|
488 |
-
|
489 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'compatibility_scripts' ), 101 );
|
490 |
-
|
491 |
-
/* Show notices if cart has errors */
|
492 |
-
add_action( 'woocommerce_cart_has_errors', 'woocommerce_output_all_notices' );
|
493 |
-
|
494 |
-
add_action( 'woocommerce_checkout_after_customer_details', array( $this, 'order_wrap_div_start' ), 99 );
|
495 |
-
|
496 |
-
add_action( 'woocommerce_checkout_after_order_review', array( $this, 'order_wrap_div_end' ), 99 );
|
497 |
-
|
498 |
-
// Outputting the hidden field in checkout page.
|
499 |
-
add_action( 'woocommerce_after_order_notes', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
500 |
-
add_action( 'woocommerce_login_form_end', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
501 |
-
|
502 |
-
remove_all_actions( 'woocommerce_checkout_billing' );
|
503 |
-
remove_all_actions( 'woocommerce_checkout_shipping' );
|
504 |
-
|
505 |
-
// Hook in actions once.
|
506 |
-
add_action( 'woocommerce_checkout_billing', array( WC()->checkout, 'checkout_form_billing' ) );
|
507 |
-
add_action( 'woocommerce_checkout_shipping', array( WC()->checkout, 'checkout_form_shipping' ) );
|
508 |
-
|
509 |
-
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form' );
|
510 |
-
|
511 |
-
add_action( 'woocommerce_checkout_order_review', array( $this, 'display_custom_coupon_field' ) );
|
512 |
-
|
513 |
-
add_filter( 'woocommerce_checkout_fields', array( $this, 'add_three_column_layout_fields' ) );
|
514 |
-
|
515 |
-
add_filter( 'woocommerce_cart_totals_coupon_html', array( $this, 'remove_coupon_text' ) );
|
516 |
-
|
517 |
-
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
518 |
-
|
519 |
-
global $post;
|
520 |
-
|
521 |
-
if ( _is_wcf_checkout_type() ) {
|
522 |
-
$checkout_id = $post->ID;
|
523 |
-
} else {
|
524 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
525 |
-
}
|
526 |
-
|
527 |
-
do_action( 'cartflows_checkout_before_shortcode', $checkout_id );
|
528 |
-
}
|
529 |
-
}
|
530 |
-
|
531 |
-
/**
|
532 |
-
* Render checkout ID hidden field.
|
533 |
-
*
|
534 |
-
* @param array $checkout checkout session data.
|
535 |
-
* @return void
|
536 |
-
*/
|
537 |
-
public function checkout_shortcode_post_id( $checkout ) {
|
538 |
-
|
539 |
-
global $post;
|
540 |
-
|
541 |
-
if ( _is_wcf_checkout_type() ) {
|
542 |
-
$checkout_id = $post->ID;
|
543 |
-
} else {
|
544 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
545 |
-
}
|
546 |
-
|
547 |
-
$flow_id = get_post_meta( $checkout_id, 'wcf-flow-id', true );
|
548 |
-
|
549 |
-
echo '<input type="hidden" class="input-hidden _wcf_flow_id" name="_wcf_flow_id" value="' . intval( $flow_id ) . '">';
|
550 |
-
echo '<input type="hidden" class="input-hidden _wcf_checkout_id" name="_wcf_checkout_id" value="' . intval( $checkout_id ) . '">';
|
551 |
-
}
|
552 |
-
|
553 |
-
/**
|
554 |
-
* Load shortcode scripts.
|
555 |
-
*
|
556 |
-
* @return void
|
557 |
-
*/
|
558 |
-
public function shortcode_scripts() {
|
559 |
-
|
560 |
-
wp_enqueue_style( 'wcf-checkout-template', wcf()->utils->get_css_url( 'checkout-template' ), '', CARTFLOWS_VER );
|
561 |
-
|
562 |
-
wp_enqueue_script(
|
563 |
-
'wcf-checkout-template',
|
564 |
-
wcf()->utils->get_js_url( 'checkout-template' ),
|
565 |
-
array( 'jquery' ),
|
566 |
-
CARTFLOWS_VER,
|
567 |
-
true
|
568 |
-
);
|
569 |
-
|
570 |
-
do_action( 'cartflows_checkout_scripts' );
|
571 |
-
|
572 |
-
$style = $this->generate_style();
|
573 |
-
|
574 |
-
wp_add_inline_style( 'wcf-checkout-template', $style );
|
575 |
-
|
576 |
-
}
|
577 |
-
|
578 |
-
/**
|
579 |
-
* Load compatibility scripts.
|
580 |
-
*
|
581 |
-
* @return void
|
582 |
-
*/
|
583 |
-
public function compatibility_scripts() {
|
584 |
-
|
585 |
-
global $post;
|
586 |
-
|
587 |
-
if ( _is_wcf_checkout_type() ) {
|
588 |
-
$checkout_id = $post->ID;
|
589 |
-
} else {
|
590 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
591 |
-
}
|
592 |
-
|
593 |
-
// Add DIVI Compatibility css if DIVI theme is enabled.
|
594 |
-
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
595 |
-
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id )
|
596 |
-
) {
|
597 |
-
wp_enqueue_style( 'wcf-checkout-template-divi', wcf()->utils->get_css_url( 'checkout-template-divi' ), '', CARTFLOWS_VER );
|
598 |
-
}
|
599 |
-
|
600 |
-
// Add Flatsome Compatibility css if Flatsome theme is enabled.
|
601 |
-
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
602 |
-
wp_enqueue_style( 'wcf-checkout-template-flatsome', wcf()->utils->get_css_url( 'checkout-template-flatsome' ), '', CARTFLOWS_VER );
|
603 |
-
}
|
604 |
-
|
605 |
-
// Add The7 Compatibility css if The7 theme is enabled.
|
606 |
-
if ( Cartflows_Compatibility::get_instance()->is_the_seven_enabled() ) {
|
607 |
-
wp_enqueue_style( 'wcf-checkout-template-the-seven', wcf()->utils->get_css_url( 'checkout-template-the-seven' ), '', CARTFLOWS_VER );
|
608 |
-
}
|
609 |
-
}
|
610 |
-
|
611 |
-
/**
|
612 |
-
* Generate styles.
|
613 |
-
*
|
614 |
-
* @return string
|
615 |
-
*/
|
616 |
-
public function generate_style() {
|
617 |
-
|
618 |
-
global $post;
|
619 |
-
|
620 |
-
if ( _is_wcf_checkout_type() ) {
|
621 |
-
$checkout_id = $post->ID;
|
622 |
-
} else {
|
623 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
624 |
-
}
|
625 |
-
|
626 |
-
/*Output css variable */
|
627 |
-
$output = '';
|
628 |
-
|
629 |
-
CartFlows_Font_Families::render_fonts( $checkout_id );
|
630 |
-
|
631 |
-
$primary_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-primary-color' );
|
632 |
-
|
633 |
-
$base_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-family' );
|
634 |
-
|
635 |
-
$header_logo_width = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-width' );
|
636 |
-
|
637 |
-
/**
|
638 |
-
$base_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-weight' );*/
|
639 |
-
$r = '';
|
640 |
-
$g = '';
|
641 |
-
$b = '';
|
642 |
-
|
643 |
-
$field_tb_padding = '';
|
644 |
-
$field_lr_padding = '';
|
645 |
-
|
646 |
-
$field_heading_color = '';
|
647 |
-
$field_color = '';
|
648 |
-
$field_bg_color = '';
|
649 |
-
$field_border_color = '';
|
650 |
-
$field_label_color = '';
|
651 |
-
$submit_tb_padding = '';
|
652 |
-
$submit_lr_padding = '';
|
653 |
-
$hl_bg_color = '';
|
654 |
-
$field_input_size = '';
|
655 |
-
$box_border_color = '';
|
656 |
-
$section_bg_color = '';
|
657 |
-
$submit_button_height = '';
|
658 |
-
$submit_color = '';
|
659 |
-
$submit_bg_color = $primary_color;
|
660 |
-
$submit_border_color = $primary_color;
|
661 |
-
|
662 |
-
$submit_hover_color = '';
|
663 |
-
$submit_bg_hover_color = $primary_color;
|
664 |
-
$submit_border_hover_color = $primary_color;
|
665 |
-
|
666 |
-
$section_heading_color = '';
|
667 |
-
|
668 |
-
$is_advance_option = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-advance-options-fields' );
|
669 |
-
|
670 |
-
$button_font_family = '';
|
671 |
-
$button_font_weight = '';
|
672 |
-
$input_font_family = '';
|
673 |
-
$input_font_weight = '';
|
674 |
-
$heading_font_family = '';
|
675 |
-
$heading_font_weight = '';
|
676 |
-
$base_font_family = $base_font_family;
|
677 |
-
/**
|
678 |
-
$base_font_weight = $base_font_weight;*/
|
679 |
-
|
680 |
-
if ( 'yes' == $is_advance_option ) {
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Get Font Family and Font Weight weight values
|
684 |
-
*/
|
685 |
-
$section_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-section-bg-color' );
|
686 |
-
|
687 |
-
$heading_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-family' );
|
688 |
-
$heading_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-weight' );
|
689 |
-
$section_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-color' );
|
690 |
-
$button_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-family' );
|
691 |
-
$button_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-weight' );
|
692 |
-
$input_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-family' );
|
693 |
-
$input_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-weight' );
|
694 |
-
$field_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-tb-padding' );
|
695 |
-
$field_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-lr-padding' );
|
696 |
-
$field_input_size = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-field-size' );
|
697 |
-
|
698 |
-
$field_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-heading-color' );
|
699 |
-
|
700 |
-
$field_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-color' );
|
701 |
-
|
702 |
-
$field_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-bg-color' );
|
703 |
-
|
704 |
-
$field_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-border-color' );
|
705 |
-
|
706 |
-
$field_label_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-label-color' );
|
707 |
-
|
708 |
-
$submit_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-tb-padding' );
|
709 |
-
|
710 |
-
$submit_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-lr-padding' );
|
711 |
-
|
712 |
-
$submit_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-color' );
|
713 |
-
|
714 |
-
$submit_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-color', $primary_color );
|
715 |
-
|
716 |
-
$submit_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-color', $primary_color );
|
717 |
-
|
718 |
-
$submit_border_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-hover-color', $primary_color );
|
719 |
-
|
720 |
-
$submit_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-hover-color' );
|
721 |
-
|
722 |
-
$submit_bg_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-hover-color', $primary_color );
|
723 |
-
|
724 |
-
$hl_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-hl-bg-color' );
|
725 |
-
|
726 |
-
$box_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-box-border-color' );
|
727 |
-
|
728 |
-
$submit_button_height = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-button-size' );
|
729 |
-
|
730 |
-
/**
|
731 |
-
* Get font values
|
732 |
-
*/
|
733 |
-
|
734 |
-
if ( 'custom' == $submit_button_height ) {
|
735 |
-
$submit_button_height = '38px';
|
736 |
-
}
|
737 |
-
|
738 |
-
if ( 'custom' == $field_input_size ) {
|
739 |
-
$field_input_size = '38px';
|
740 |
-
}
|
741 |
-
}
|
742 |
-
if ( isset( $primary_color ) ) {
|
743 |
-
|
744 |
-
list($r, $g, $b) = sscanf( $primary_color, '#%02x%02x%02x' );
|
745 |
-
}
|
746 |
-
|
747 |
-
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
748 |
-
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id ) ) {
|
749 |
-
|
750 |
-
include CARTFLOWS_CHECKOUT_DIR . 'includes/checkout-dynamic-divi-css.php';
|
751 |
-
|
752 |
-
} else {
|
753 |
-
include CARTFLOWS_CHECKOUT_DIR . 'includes/checkout-dynamic-css.php';
|
754 |
-
}
|
755 |
-
|
756 |
-
return $output;
|
757 |
-
}
|
758 |
-
|
759 |
-
/**
|
760 |
-
* Get ajax end points.
|
761 |
-
*
|
762 |
-
* @param string $endpoint_url end point URL.
|
763 |
-
* @param string $request end point request.
|
764 |
-
* @return string
|
765 |
-
*/
|
766 |
-
public function get_ajax_endpoint( $endpoint_url, $request ) {
|
767 |
-
|
768 |
-
global $post;
|
769 |
-
|
770 |
-
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
771 |
-
|
772 |
-
if ( _is_wcf_checkout_type() ) {
|
773 |
-
|
774 |
-
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
775 |
-
|
776 |
-
if ( '' === $request ) {
|
777 |
-
$query_args = array(
|
778 |
-
'wc-ajax' => '%%endpoint%%',
|
779 |
-
);
|
780 |
-
} else {
|
781 |
-
$query_args = array(
|
782 |
-
'wc-ajax' => $request,
|
783 |
-
);
|
784 |
-
}
|
785 |
-
|
786 |
-
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
787 |
-
$uri = $uri[0];
|
788 |
-
|
789 |
-
$endpoint_url = esc_url( add_query_arg( $query_args, $uri ) );
|
790 |
-
}
|
791 |
-
}
|
792 |
-
}
|
793 |
-
|
794 |
-
return $endpoint_url;
|
795 |
-
}
|
796 |
-
|
797 |
-
|
798 |
-
/**
|
799 |
-
* Save checkout fields.
|
800 |
-
*
|
801 |
-
* @param int $order_id order id.
|
802 |
-
* @param array $posted posted data.
|
803 |
-
* @return void
|
804 |
-
*/
|
805 |
-
public function save_checkout_fields( $order_id, $posted ) {
|
806 |
-
|
807 |
-
if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
|
808 |
-
|
809 |
-
$checkout_id = wc_clean( intval( $_POST['_wcf_checkout_id'] ) ); //phpcs:ignore
|
810 |
-
|
811 |
-
update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
|
812 |
-
|
813 |
-
if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
|
814 |
-
|
815 |
-
$flow_id = wc_clean( intval( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
|
816 |
-
|
817 |
-
update_post_meta( $order_id, '_wcf_flow_id', $flow_id );
|
818 |
-
}
|
819 |
-
}
|
820 |
-
|
821 |
-
}
|
822 |
-
|
823 |
-
/**
|
824 |
-
* Enable Logo In Header Of Checkout Page
|
825 |
-
*
|
826 |
-
* @return void
|
827 |
-
*/
|
828 |
-
public function enable_logo_in_header() {
|
829 |
-
global $post;
|
830 |
-
|
831 |
-
if ( _is_wcf_checkout_type() ) {
|
832 |
-
$checkout_id = $post->ID;
|
833 |
-
} else {
|
834 |
-
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
835 |
-
}
|
836 |
-
|
837 |
-
$header_logo_image = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-image' );
|
838 |
-
$add_image_markup = '';
|
839 |
-
|
840 |
-
if ( isset( $header_logo_image ) && ! empty( $header_logo_image ) ) {
|
841 |
-
$add_image_markup = '<div class="wcf-checkout-header-image">';
|
842 |
-
$add_image_markup .= '<img src="' . $header_logo_image . '" />';
|
843 |
-
$add_image_markup .= '</div>';
|
844 |
-
}
|
845 |
-
|
846 |
-
echo $add_image_markup;
|
847 |
-
}
|
848 |
-
|
849 |
-
/**
|
850 |
-
* Add text to the bootom of the checkout page.
|
851 |
-
*
|
852 |
-
* @return void
|
853 |
-
*/
|
854 |
-
public function show_cartflows_copyright_message() {
|
855 |
-
$output_string = '';
|
856 |
-
|
857 |
-
$output_string .= '<div class="wcf-footer-primary">';
|
858 |
-
$output_string .= '<div class="wcf-footer-content">';
|
859 |
-
$output_string .= '<p class="wcf-footer-message">';
|
860 |
-
$output_string .= 'Checkout powered by CartFlows';
|
861 |
-
$output_string .= '</p>';
|
862 |
-
$output_string .= '</div>';
|
863 |
-
$output_string .= '</div>';
|
864 |
-
|
865 |
-
echo $output_string;
|
866 |
-
}
|
867 |
-
|
868 |
-
/**
|
869 |
-
* Redirect users to our checkout if hidden param
|
870 |
-
*
|
871 |
-
* @param string $redirect redirect url.
|
872 |
-
* @param object $user user.
|
873 |
-
* @return string
|
874 |
-
*/
|
875 |
-
public function after_login_redirect( $redirect, $user ) {
|
876 |
-
|
877 |
-
if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
|
878 |
-
|
879 |
-
$checkout_id = intval( $_POST['_wcf_checkout_id'] ); //phpcs:ignore
|
880 |
-
|
881 |
-
$redirect = get_permalink( $checkout_id );
|
882 |
-
}
|
883 |
-
|
884 |
-
return $redirect;
|
885 |
-
}
|
886 |
-
|
887 |
-
/**
|
888 |
-
* Display coupon code field after review order fields.
|
889 |
-
*/
|
890 |
-
public function display_custom_coupon_field() {
|
891 |
-
|
892 |
-
$coupon_enabled = apply_filters( 'woocommerce_coupons_enabled', true );
|
893 |
-
$show_coupon = apply_filters( 'cartflows_show_coupon_field', true );
|
894 |
-
|
895 |
-
if ( ! ( $coupon_enabled && $show_coupon ) ) {
|
896 |
-
return;
|
897 |
-
|
898 |
-
}
|
899 |
-
|
900 |
-
$coupon_field = array(
|
901 |
-
'field_text' => __( 'Coupon Code', 'cartflows' ),
|
902 |
-
'button_text' => __( 'Apply', 'cartflows' ),
|
903 |
-
'class' => '',
|
904 |
-
);
|
905 |
-
|
906 |
-
$coupon_field = apply_filters( 'cartflows_coupon_field_options', $coupon_field );
|
907 |
-
|
908 |
-
ob_start();
|
909 |
-
?>
|
910 |
-
<div class="wcf-custom-coupon-field <?php echo $coupon_field['class']; ?>" id="wcf_custom_coupon_field">
|
911 |
-
<div class="wcf-coupon-col-1">
|
912 |
-
<span>
|
913 |
-
<input type="text" name="coupon_code" class="input-text wcf-coupon-code-input" placeholder="<?php echo $coupon_field['field_text']; ?>" id="coupon_code" value="">
|
914 |
-
</span>
|
915 |
-
</div>
|
916 |
-
<div class="wcf-coupon-col-2">
|
917 |
-
<span>
|
918 |
-
<button type="button" class="button wcf-submit-coupon wcf-btn-small" name="apply_coupon" value="Apply"><?php echo $coupon_field['button_text']; ?></button>
|
919 |
-
</span>
|
920 |
-
</div>
|
921 |
-
</div>
|
922 |
-
<?php
|
923 |
-
echo ob_get_clean();
|
924 |
-
}
|
925 |
-
|
926 |
-
/**
|
927 |
-
* Apply filter to change class of remove coupon field.
|
928 |
-
*
|
929 |
-
* @param string $coupon coupon.
|
930 |
-
* @return string
|
931 |
-
*/
|
932 |
-
public function remove_coupon_text( $coupon ) {
|
933 |
-
|
934 |
-
$coupon = str_replace( 'woocommerce-remove-coupon', 'wcf-remove-coupon', $coupon );
|
935 |
-
return $coupon;
|
936 |
-
|
937 |
-
}
|
938 |
-
/**
|
939 |
-
* Apply filter to change the placeholder text of coupon field.
|
940 |
-
*
|
941 |
-
* @return string
|
942 |
-
*/
|
943 |
-
public function coupon_field_placeholder() {
|
944 |
-
return apply_filters( 'cartflows_coupon_field_placeholder', __( 'Coupon Code', 'cartflows' ) );
|
945 |
-
}
|
946 |
-
|
947 |
-
/**
|
948 |
-
* Apply filter to change the button text of coupon field.
|
949 |
-
*
|
950 |
-
* @return string
|
951 |
-
*/
|
952 |
-
public function coupon_button_text() {
|
953 |
-
return apply_filters( 'cartflows_coupon_button_text', __( 'Apply', 'cartflows' ) );
|
954 |
-
}
|
955 |
-
|
956 |
-
/**
|
957 |
-
* Apply coupon on submit of custom coupon form.
|
958 |
-
*/
|
959 |
-
public function apply_coupon() {
|
960 |
-
|
961 |
-
$response = '';
|
962 |
-
|
963 |
-
check_ajax_referer( 'wcf-apply-coupon', 'security' );
|
964 |
-
if ( ! empty( $_POST['coupon_code'] ) ) {
|
965 |
-
$result = WC()->cart->add_discount( sanitize_text_field( wp_unslash( $_POST['coupon_code'] ) ) );
|
966 |
-
} else {
|
967 |
-
wc_add_notice( WC_Coupon::get_generic_coupon_error( WC_Coupon::E_WC_COUPON_PLEASE_ENTER ), 'error' );
|
968 |
-
}
|
969 |
-
|
970 |
-
$response = array(
|
971 |
-
'status' => $result,
|
972 |
-
'msg' => wc_print_notices( true ),
|
973 |
-
);
|
974 |
-
|
975 |
-
echo wp_json_encode( $response );
|
976 |
-
|
977 |
-
die();
|
978 |
-
}
|
979 |
-
|
980 |
-
|
981 |
-
/**
|
982 |
-
* Added ajax nonce to localize variable.
|
983 |
-
*
|
984 |
-
* @param array $vars localize variables.
|
985 |
-
*/
|
986 |
-
public function add_localize_vars( $vars ) {
|
987 |
-
|
988 |
-
$vars['wcf_validate_coupon_nonce'] = wp_create_nonce( 'wcf-apply-coupon' );
|
989 |
-
|
990 |
-
$vars['wcf_validate_remove_coupon_nonce'] = wp_create_nonce( 'wcf-remove-coupon' );
|
991 |
-
|
992 |
-
$vars['wcf_validate_remove_cart_product_nonce'] = wp_create_nonce( 'wcf-remove-cart-product' );
|
993 |
-
|
994 |
-
$vars['allow_persistance'] = apply_filters( 'cartflows_allow_persistace', 'yes' );
|
995 |
-
|
996 |
-
return $vars;
|
997 |
-
}
|
998 |
-
|
999 |
-
/**
|
1000 |
-
* Add custom class to the fields to change the UI to three column.
|
1001 |
-
*
|
1002 |
-
* @param array $fields fields.
|
1003 |
-
*/
|
1004 |
-
public function add_three_column_layout_fields( $fields ) {
|
1005 |
-
|
1006 |
-
if ( empty( $fields['billing']['billing_address_2'] ) ) {
|
1007 |
-
|
1008 |
-
if ( isset( $fields['billing']['billing_address_1'] ) && is_array( $fields['billing']['billing_address_1'] ) ) {
|
1009 |
-
$fields['billing']['billing_address_1']['class'][] = 'form-row-full';
|
1010 |
-
}
|
1011 |
-
}
|
1012 |
-
|
1013 |
-
if ( ! empty( $fields['billing']['billing_company'] ) ) {
|
1014 |
-
|
1015 |
-
if ( isset( $fields['billing']['billing_company'] ) && is_array( $fields['billing']['billing_company'] ) ) {
|
1016 |
-
$fields['billing']['billing_company']['class'][] = 'form-row-full';
|
1017 |
-
}
|
1018 |
-
}
|
1019 |
-
|
1020 |
-
if ( ! empty( $fields['shipping']['shipping_company'] ) ) {
|
1021 |
-
|
1022 |
-
if ( isset( $fields['shipping']['shipping_company'] ) && is_array( $fields['shipping']['shipping_company'] ) ) {
|
1023 |
-
$fields['shipping']['shipping_company']['class'][] = 'form-row-full';
|
1024 |
-
}
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
if ( ! empty( $fields['billing']['billing_country'] ) ) {
|
1028 |
-
|
1029 |
-
if ( isset( $fields['billing']['billing_country'] ) && is_array( $fields['billing']['billing_country'] ) ) {
|
1030 |
-
$fields['billing']['billing_country']['class'][] = 'form-row-full';
|
1031 |
-
}
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
if ( ! empty( $fields['shipping']['shipping_country'] ) ) {
|
1035 |
-
|
1036 |
-
if ( isset( $fields['shipping']['shipping_country'] ) && is_array( $fields['shipping']['shipping_country'] ) ) {
|
1037 |
-
$fields['shipping']['shipping_country']['class'][] = 'form-row-full';
|
1038 |
-
}
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
if ( ! empty( $fields['billing']['billing_phone'] ) ) {
|
1042 |
-
|
1043 |
-
if ( isset( $fields['billing']['billing_phone'] ) && is_array( $fields['billing']['billing_phone'] ) ) {
|
1044 |
-
$fields['billing']['billing_phone']['class'][] = 'form-row-full';
|
1045 |
-
}
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
if ( ! empty( $fields['billing']['billing_email'] ) ) {
|
1049 |
-
|
1050 |
-
if ( isset( $fields['billing']['billing_email'] ) && is_array( $fields['billing']['billing_email'] ) ) {
|
1051 |
-
$fields['billing']['billing_email']['class'][] = 'form-row-full';
|
1052 |
-
}
|
1053 |
-
}
|
1054 |
-
|
1055 |
-
if ( empty( $fields['shipping']['shipping_address_2'] ) ) {
|
1056 |
-
|
1057 |
-
if ( isset( $fields['shipping']['shipping_address_1'] ) && is_array( $fields['shipping']['shipping_address_1'] ) ) {
|
1058 |
-
$fields['shipping']['shipping_address_1']['class'][] = 'form-row-full';
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
if ( isset( $fields['billing']['billing_city'] ) &&
|
1063 |
-
isset( $fields['billing']['billing_state'] ) && isset( $fields['billing']['billing_postcode'] ) ) {
|
1064 |
-
|
1065 |
-
$fields['billing']['billing_city']['class'][] = 'wcf-column-33';
|
1066 |
-
$fields['billing']['billing_state']['class'][] = 'wcf-column-33';
|
1067 |
-
$fields['billing']['billing_postcode']['class'][] = 'wcf-column-33';
|
1068 |
-
}
|
1069 |
-
|
1070 |
-
if ( isset( $fields['shipping']['shipping_city'] ) &&
|
1071 |
-
isset( $fields['shipping']['shipping_state'] ) && isset( $fields['shipping']['shipping_postcode'] ) ) {
|
1072 |
-
|
1073 |
-
$fields['shipping']['shipping_city']['class'][] = 'wcf-column-33';
|
1074 |
-
$fields['shipping']['shipping_state']['class'][] = 'wcf-column-33';
|
1075 |
-
$fields['shipping']['shipping_postcode']['class'][] = 'wcf-column-33';
|
1076 |
-
}
|
1077 |
-
|
1078 |
-
return $fields;
|
1079 |
-
}
|
1080 |
-
|
1081 |
-
/**
|
1082 |
-
* Add opening dev
|
1083 |
-
*
|
1084 |
-
* @since 1.0.0
|
1085 |
-
*/
|
1086 |
-
public function order_wrap_div_start() {
|
1087 |
-
|
1088 |
-
echo "<div class='wcf-order-wrap'> ";
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
/**
|
1092 |
-
* Add closing dev
|
1093 |
-
*
|
1094 |
-
* @since 1.0.0
|
1095 |
-
*/
|
1096 |
-
public function order_wrap_div_end() {
|
1097 |
-
|
1098 |
-
echo '</div> ';
|
1099 |
-
}
|
1100 |
-
/**
|
1101 |
-
* Remove coupon.
|
1102 |
-
*/
|
1103 |
-
public function remove_coupon() {
|
1104 |
-
|
1105 |
-
check_ajax_referer( 'wcf-remove-coupon', 'security' );
|
1106 |
-
$coupon = isset( $_POST['coupon_code'] ) ? wc_clean( wp_unslash( $_POST['coupon_code'] ) ) : false; //phpcs:ignore
|
1107 |
-
|
1108 |
-
if ( empty( $coupon ) ) {
|
1109 |
-
echo "<div class='woocommerce-error'>" . esc_html__( 'Sorry there was a problem removing this coupon.', 'cartflows' );
|
1110 |
-
} else {
|
1111 |
-
WC()->cart->remove_coupon( $coupon );
|
1112 |
-
echo "<div class='woocommerce-error'>" . esc_html__( 'Coupon has been removed.', 'cartflows' ) . '</div>';
|
1113 |
-
}
|
1114 |
-
wc_print_notices();
|
1115 |
-
wp_die();
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
/**
|
1119 |
-
* Remove cart item.
|
1120 |
-
*/
|
1121 |
-
public function wcf_woo_remove_cart_product() {
|
1122 |
-
|
1123 |
-
check_ajax_referer( 'wcf-remove-cart-product', 'security' );
|
1124 |
-
$product_key = isset( $_POST['p_key'] ) ? wc_clean( wp_unslash( $_POST['p_key'] ) ) : false; //phpcs:ignore
|
1125 |
-
$product_id = isset( $_POST['p_id'] ) ? wc_clean( wp_unslash( $_POST['p_id'] ) ) : ''; //phpcs:ignore
|
1126 |
-
$product_title = get_the_title( $product_id );
|
1127 |
-
|
1128 |
-
$needs_shipping = false;
|
1129 |
-
|
1130 |
-
if ( empty( $product_key ) ) {
|
1131 |
-
$msg = "<div class='woocommerce-message'>" . __( 'Sorry there was a problem removing ', 'cartflows' ) . $product_title;
|
1132 |
-
} else {
|
1133 |
-
WC()->cart->remove_cart_item( $product_key );
|
1134 |
-
$msg = "<div class='woocommerce-message'>" . $product_title . __( ' has been removed.', 'cartflows' ) . '</div>';
|
1135 |
-
}
|
1136 |
-
|
1137 |
-
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
|
1138 |
-
if ( $values['data']->needs_shipping() ) {
|
1139 |
-
$needs_shipping = true;
|
1140 |
-
break;
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
$response = array(
|
1145 |
-
'need_shipping' => $needs_shipping,
|
1146 |
-
'msg' => $msg,
|
1147 |
-
);
|
1148 |
-
|
1149 |
-
echo wp_json_encode( $response );
|
1150 |
-
wp_die();
|
1151 |
-
}
|
1152 |
-
|
1153 |
-
}
|
1154 |
-
|
1155 |
-
/**
|
1156 |
-
* Kicking this off by calling 'get_instance()' method
|
1157 |
-
*/
|
1158 |
-
Cartflows_Checkout_Markup::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checkout markup.
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Checkout Markup
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Checkout_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 |
+
/* Set is checkout flag */
|
38 |
+
add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
|
39 |
+
|
40 |
+
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_checkout_fields' ), 10, 2 );
|
41 |
+
|
42 |
+
/* Show notice if cart is empty */
|
43 |
+
add_action( 'cartflows_checkout_cart_empty', array( $this, 'display_woo_notices' ) );
|
44 |
+
|
45 |
+
/* Checkout Shortcode */
|
46 |
+
add_shortcode( 'cartflows_checkout', array( $this, 'checkout_shortcode_markup' ) );
|
47 |
+
|
48 |
+
/* Preconfigured cart data */
|
49 |
+
add_action( 'wp', array( $this, 'preconfigured_cart_data' ), 1 );
|
50 |
+
|
51 |
+
/* Embed Checkout */
|
52 |
+
add_action( 'wp', array( $this, 'shortcode_load_data' ), 999 );
|
53 |
+
|
54 |
+
/* Ajax Endpoint */
|
55 |
+
add_filter( 'woocommerce_ajax_get_endpoint', array( $this, 'get_ajax_endpoint' ), 10, 2 );
|
56 |
+
|
57 |
+
add_filter( 'cartflows_add_before_main_section', array( $this, 'enable_logo_in_header' ) );
|
58 |
+
|
59 |
+
add_filter( 'cartflows_primary_container_bottom', array( $this, 'show_cartflows_copyright_message' ) );
|
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 |
+
add_action( 'wp_ajax_wcf_woo_remove_cart_product', array( $this, 'wcf_woo_remove_cart_product' ) );
|
75 |
+
add_action( 'wp_ajax_nopriv_wcf_woo_remove_cart_product', array( $this, 'wcf_woo_remove_cart_product' ) );
|
76 |
+
|
77 |
+
add_filter( 'woocommerce_paypal_args', array( $this, 'modify_paypal_args' ), 10, 2 );
|
78 |
+
|
79 |
+
add_filter( 'woocommerce_cart_item_name', array( $this, 'wcf_add_remove_label' ), 10, 3 );
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Modify WooCommerce paypal arguments.
|
84 |
+
*
|
85 |
+
* @param array $args argumenets for payment.
|
86 |
+
* @param WC_Order $order order data.
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function modify_paypal_args( $args, $order ) {
|
90 |
+
|
91 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
92 |
+
|
93 |
+
if ( ! $checkout_id ) {
|
94 |
+
return $args;
|
95 |
+
}
|
96 |
+
|
97 |
+
// Set cancel return URL.
|
98 |
+
$args['cancel_return'] = esc_url_raw( $order->get_cancel_order_url_raw( get_permalink( $checkout_id ) ) );
|
99 |
+
|
100 |
+
return $args;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Modify WooCommerce paypal arguments.
|
105 |
+
*
|
106 |
+
* @param string $product_name product name.
|
107 |
+
* @param object $cart_item cart item.
|
108 |
+
* @param string $cart_item_key cart item key.
|
109 |
+
* @return string
|
110 |
+
*/
|
111 |
+
public function wcf_add_remove_label( $product_name, $cart_item, $cart_item_key ) {
|
112 |
+
|
113 |
+
$checkout_id = get_the_ID();
|
114 |
+
if ( ! $checkout_id ) {
|
115 |
+
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? wp_unslash( $_POST['option']['checkout_id'] ) : '';//phpcs:ignore
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( ! empty( $checkout_id ) ) {
|
119 |
+
$is_remove_product_option = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-remove-product-field' );
|
120 |
+
if ( 'checkout' === get_post_meta( $checkout_id, 'wcf-step-type', true ) && ( 'yes' === $is_remove_product_option ) ) {
|
121 |
+
$remove_label = apply_filters(
|
122 |
+
'woocommerce_cart_item_remove_link',
|
123 |
+
sprintf(
|
124 |
+
'<a href="#" rel="nofollow" class="remove cartflows-icon-close" data-id="%s" data-item-key="%s" ></a>',
|
125 |
+
esc_attr( $cart_item['product_id'] ),
|
126 |
+
$cart_item_key
|
127 |
+
),
|
128 |
+
$cart_item_key
|
129 |
+
);
|
130 |
+
|
131 |
+
$product_name = $remove_label . $product_name;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
return $product_name;
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Change order button text .
|
141 |
+
*
|
142 |
+
* @param string $woo_button_text place order.
|
143 |
+
* @return string
|
144 |
+
*/
|
145 |
+
public function place_order_button_text( $woo_button_text ) {
|
146 |
+
|
147 |
+
$checkout_id = get_the_ID();
|
148 |
+
if ( ! $checkout_id ) {
|
149 |
+
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? intval( $_POST['option']['checkout_id'] ) : 0; //phpcs:ignore
|
150 |
+
}
|
151 |
+
|
152 |
+
$wcf_order_button_text = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-place-order-button-text' );
|
153 |
+
|
154 |
+
if ( ! empty( $wcf_order_button_text ) ) {
|
155 |
+
$woo_button_text = $wcf_order_button_text;
|
156 |
+
}
|
157 |
+
|
158 |
+
return $woo_button_text;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Display all WooCommerce notices.
|
163 |
+
*
|
164 |
+
* @since 1.1.5
|
165 |
+
*/
|
166 |
+
public function display_woo_notices() {
|
167 |
+
|
168 |
+
if ( null != WC()->session && function_exists( 'woocommerce_output_all_notices' ) ) {
|
169 |
+
woocommerce_output_all_notices();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Redirect from default to the global checkout page
|
176 |
+
*
|
177 |
+
* @since 1.0.0
|
178 |
+
*/
|
179 |
+
public function global_checkout_template_redirect() {
|
180 |
+
|
181 |
+
if ( ! is_checkout() ) {
|
182 |
+
return;
|
183 |
+
}
|
184 |
+
|
185 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
// Return if the key OR Order paramater is found in the URL for certain Payment gateways.
|
190 |
+
if ( isset( $_GET['key'] ) || isset( $_GET['order'] ) ) { //phpcs:ignore
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
|
194 |
+
// redirect only for cartflows checkout pages.
|
195 |
+
$order_pay_endpoint = get_option( 'woocommerce_checkout_pay_endpoint', 'order-pay' );
|
196 |
+
$order_received_endpoint = get_option( 'woocommerce_checkout_order_received_endpoint', 'order-received' );
|
197 |
+
|
198 |
+
$common = Cartflows_Helper::get_common_settings();
|
199 |
+
|
200 |
+
$global_checkout = $common['global_checkout'];
|
201 |
+
|
202 |
+
if (
|
203 |
+
isset( $_SERVER['REQUEST_URI'] ) &&
|
204 |
+
// ignore on order-pay.
|
205 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_pay_endpoint . '/' ) &&
|
206 |
+
// ignore on TY page.
|
207 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_received_endpoint . '/' ) &&
|
208 |
+
// ignore if order-pay in query param.
|
209 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), $order_pay_endpoint . '=' )
|
210 |
+
) {
|
211 |
+
|
212 |
+
if ( '' !== $global_checkout ) {
|
213 |
+
|
214 |
+
$link = apply_filters( 'cartflows_global_checkout_url', get_permalink( $global_checkout ) );
|
215 |
+
|
216 |
+
if ( ! empty( $link ) ) {
|
217 |
+
|
218 |
+
wp_safe_redirect( $link );
|
219 |
+
die();
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Check for checkout flag
|
227 |
+
*
|
228 |
+
* @param bool $is_checkout is checkout.
|
229 |
+
*
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
public function woo_checkout_flag( $is_checkout ) {
|
233 |
+
|
234 |
+
if ( ! is_admin() ) {
|
235 |
+
|
236 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
237 |
+
|
238 |
+
$is_checkout = true;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
+
return $is_checkout;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Render checkout shortcode markup.
|
247 |
+
*
|
248 |
+
* @param array $atts attributes.
|
249 |
+
* @return string
|
250 |
+
*/
|
251 |
+
public function checkout_shortcode_markup( $atts ) {
|
252 |
+
|
253 |
+
if ( ! function_exists( 'wc_print_notices' ) ) {
|
254 |
+
$notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
|
255 |
+
$notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
|
256 |
+
|
257 |
+
return $notice_out;
|
258 |
+
}
|
259 |
+
|
260 |
+
$atts = shortcode_atts(
|
261 |
+
array(
|
262 |
+
'id' => 0,
|
263 |
+
),
|
264 |
+
$atts
|
265 |
+
);
|
266 |
+
|
267 |
+
$checkout_id = intval( $atts['id'] );
|
268 |
+
|
269 |
+
if ( empty( $checkout_id ) ) {
|
270 |
+
|
271 |
+
if ( ! _is_wcf_checkout_type() ) {
|
272 |
+
|
273 |
+
return '<h4>' . __( 'Checkout ID not found', 'cartflows' ) . '</h4>';
|
274 |
+
}
|
275 |
+
|
276 |
+
global $post;
|
277 |
+
|
278 |
+
$checkout_id = intval( $post->ID );
|
279 |
+
}
|
280 |
+
|
281 |
+
$output = '';
|
282 |
+
|
283 |
+
ob_start();
|
284 |
+
|
285 |
+
do_action( 'cartflows_checkout_form_before', $checkout_id );
|
286 |
+
|
287 |
+
$checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
|
288 |
+
|
289 |
+
$template_default = CARTFLOWS_CHECKOUT_DIR . 'templates/embed/checkout-template-simple.php';
|
290 |
+
|
291 |
+
$template_layout = apply_filters( 'cartflows_checkout_layout_template', $checkout_layout );
|
292 |
+
|
293 |
+
if ( file_exists( $template_layout ) ) {
|
294 |
+
include $template_layout;
|
295 |
+
} else {
|
296 |
+
include $template_default;
|
297 |
+
}
|
298 |
+
|
299 |
+
$output .= ob_get_clean();
|
300 |
+
|
301 |
+
return $output;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Configure Cart Data.
|
306 |
+
*
|
307 |
+
* @since 1.0.0
|
308 |
+
*
|
309 |
+
* @return void
|
310 |
+
*/
|
311 |
+
public function preconfigured_cart_data() {
|
312 |
+
|
313 |
+
if ( is_admin() ) {
|
314 |
+
return;
|
315 |
+
}
|
316 |
+
|
317 |
+
global $post;
|
318 |
+
|
319 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
320 |
+
|
321 |
+
if ( wp_doing_ajax() ) {
|
322 |
+
return;
|
323 |
+
} else {
|
324 |
+
|
325 |
+
if ( _is_wcf_checkout_type() ) {
|
326 |
+
$checkout_id = $post->ID;
|
327 |
+
} else {
|
328 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
329 |
+
}
|
330 |
+
|
331 |
+
$global_checkout = intval( Cartflows_Helper::get_common_setting( 'global_checkout' ) );
|
332 |
+
|
333 |
+
if ( ! empty( $global_checkout ) && $checkout_id === $global_checkout ) {
|
334 |
+
|
335 |
+
if ( WC()->cart->is_empty() ) {
|
336 |
+
wc_add_notice( __( 'Your cart is currently empty.', 'cartflows' ), 'error' );
|
337 |
+
}
|
338 |
+
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
if ( apply_filters( 'cartflows_skip_configure_cart', false, $checkout_id ) ) {
|
343 |
+
return;
|
344 |
+
}
|
345 |
+
|
346 |
+
do_action( 'cartflows_checkout_before_configure_cart', $checkout_id );
|
347 |
+
|
348 |
+
$flow_id = wcf()->utils->get_flow_id_from_step_id( $checkout_id );
|
349 |
+
|
350 |
+
if ( wcf()->flow->is_flow_testmode( $flow_id ) ) {
|
351 |
+
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products', 'dummy' );
|
352 |
+
} else {
|
353 |
+
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products' );
|
354 |
+
}
|
355 |
+
|
356 |
+
if ( ! is_array( $products ) ) {
|
357 |
+
|
358 |
+
if ( 'dummy' === $products ) {
|
359 |
+
|
360 |
+
$args = array(
|
361 |
+
'posts_per_page' => 1,
|
362 |
+
'orderby' => 'rand',
|
363 |
+
'post_type' => 'product',
|
364 |
+
'meta_query' => array( //phpcs:ignore
|
365 |
+
// Exclude out of stock products.
|
366 |
+
array(
|
367 |
+
'key' => '_stock_status',
|
368 |
+
'value' => 'outofstock',
|
369 |
+
'compare' => 'NOT IN',
|
370 |
+
),
|
371 |
+
),
|
372 |
+
'tax_query' => array( //phpcs:ignore
|
373 |
+
array(
|
374 |
+
'taxonomy' => 'product_type',
|
375 |
+
'field' => 'slug',
|
376 |
+
'terms' => 'simple',
|
377 |
+
),
|
378 |
+
),
|
379 |
+
);
|
380 |
+
|
381 |
+
$random_product = get_posts( $args );
|
382 |
+
|
383 |
+
if ( isset( $random_product[0]->ID ) ) {
|
384 |
+
$products = array(
|
385 |
+
array(
|
386 |
+
'product' => $random_product[0]->ID,
|
387 |
+
),
|
388 |
+
);
|
389 |
+
} else {
|
390 |
+
return;
|
391 |
+
}
|
392 |
+
} else {
|
393 |
+
return;
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
/* Empty the current cart */
|
398 |
+
WC()->cart->empty_cart();
|
399 |
+
|
400 |
+
if ( is_array( $products ) && count( $products ) < 1 ) {
|
401 |
+
wc_add_notice( __( 'No product is selected. Please select products from the checkout meta settings to continue.', 'cartflows' ), 'error' );
|
402 |
+
return;
|
403 |
+
}
|
404 |
+
|
405 |
+
/* Set customer session if not set */
|
406 |
+
if ( ! is_user_logged_in() && WC()->cart->is_empty() ) {
|
407 |
+
WC()->session->set_customer_session_cookie( true );
|
408 |
+
}
|
409 |
+
|
410 |
+
$cart_product_count = 0;
|
411 |
+
|
412 |
+
foreach ( $products as $index => $data ) {
|
413 |
+
|
414 |
+
if ( ! isset( $data['product'] ) ) {
|
415 |
+
return;
|
416 |
+
}
|
417 |
+
|
418 |
+
if ( apply_filters( 'cartflows_skip_other_products', false, $cart_product_count ) ) {
|
419 |
+
break;
|
420 |
+
}
|
421 |
+
|
422 |
+
$product_id = $data['product'];
|
423 |
+
$_product = wc_get_product( $product_id );
|
424 |
+
|
425 |
+
if ( ! empty( $_product ) ) {
|
426 |
+
|
427 |
+
$quantity = 1;
|
428 |
+
|
429 |
+
if ( ! $_product->is_type( 'grouped' ) && ! $_product->is_type( 'external' ) ) {
|
430 |
+
|
431 |
+
if ( $_product->is_type( 'variable' ) ) {
|
432 |
+
|
433 |
+
$default_attributes = $_product->get_default_attributes();
|
434 |
+
|
435 |
+
if ( ! empty( $default_attributes ) ) {
|
436 |
+
|
437 |
+
foreach ( $_product->get_children() as $variation_id ) {
|
438 |
+
|
439 |
+
$single_variation = new WC_Product_Variation( $variation_id );
|
440 |
+
|
441 |
+
if ( $default_attributes == $single_variation->get_attributes() ) {
|
442 |
+
WC()->cart->add_to_cart( $variation_id, $quantity );
|
443 |
+
$cart_product_count++;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
} else {
|
447 |
+
|
448 |
+
$product_childrens = $_product->get_children();
|
449 |
+
|
450 |
+
if ( isset( $product_childrens[0] ) ) {
|
451 |
+
WC()->cart->add_to_cart( $product_childrens[0], $quantity );
|
452 |
+
$cart_product_count++;
|
453 |
+
} else {
|
454 |
+
echo '<p>' . esc_html__( 'Variations Not set', 'cartflows' ) . '</p>';
|
455 |
+
}
|
456 |
+
}
|
457 |
+
} else {
|
458 |
+
WC()->cart->add_to_cart( $product_id, $quantity );
|
459 |
+
$cart_product_count++;
|
460 |
+
}
|
461 |
+
} else {
|
462 |
+
$wrong_product_notice = __( 'This product can\'t be purchased', 'cartflows' );
|
463 |
+
wc_add_notice( $wrong_product_notice );
|
464 |
+
/**
|
465 |
+
WC()->cart->add_to_cart( $product_id, $quantity );.
|
466 |
+
*/
|
467 |
+
}
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
/* Since 1.2.2 */
|
472 |
+
wcf_do_action_deprecated( 'cartflows_checkout_aftet_configure_cart', array( $checkout_id ), '1.2.2', 'cartflows_checkout_after_configure_cart' );
|
473 |
+
do_action( 'cartflows_checkout_after_configure_cart', $checkout_id );
|
474 |
+
}
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Load shortcode data.
|
480 |
+
*
|
481 |
+
* @return void
|
482 |
+
*/
|
483 |
+
public function shortcode_load_data() {
|
484 |
+
|
485 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
486 |
+
|
487 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_scripts' ), 21 );
|
488 |
+
|
489 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'compatibility_scripts' ), 101 );
|
490 |
+
|
491 |
+
/* Show notices if cart has errors */
|
492 |
+
add_action( 'woocommerce_cart_has_errors', 'woocommerce_output_all_notices' );
|
493 |
+
|
494 |
+
add_action( 'woocommerce_checkout_after_customer_details', array( $this, 'order_wrap_div_start' ), 99 );
|
495 |
+
|
496 |
+
add_action( 'woocommerce_checkout_after_order_review', array( $this, 'order_wrap_div_end' ), 99 );
|
497 |
+
|
498 |
+
// Outputting the hidden field in checkout page.
|
499 |
+
add_action( 'woocommerce_after_order_notes', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
500 |
+
add_action( 'woocommerce_login_form_end', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
501 |
+
|
502 |
+
remove_all_actions( 'woocommerce_checkout_billing' );
|
503 |
+
remove_all_actions( 'woocommerce_checkout_shipping' );
|
504 |
+
|
505 |
+
// Hook in actions once.
|
506 |
+
add_action( 'woocommerce_checkout_billing', array( WC()->checkout, 'checkout_form_billing' ) );
|
507 |
+
add_action( 'woocommerce_checkout_shipping', array( WC()->checkout, 'checkout_form_shipping' ) );
|
508 |
+
|
509 |
+
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form' );
|
510 |
+
|
511 |
+
add_action( 'woocommerce_checkout_order_review', array( $this, 'display_custom_coupon_field' ) );
|
512 |
+
|
513 |
+
add_filter( 'woocommerce_checkout_fields', array( $this, 'add_three_column_layout_fields' ) );
|
514 |
+
|
515 |
+
add_filter( 'woocommerce_cart_totals_coupon_html', array( $this, 'remove_coupon_text' ) );
|
516 |
+
|
517 |
+
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
518 |
+
|
519 |
+
global $post;
|
520 |
+
|
521 |
+
if ( _is_wcf_checkout_type() ) {
|
522 |
+
$checkout_id = $post->ID;
|
523 |
+
} else {
|
524 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
525 |
+
}
|
526 |
+
|
527 |
+
do_action( 'cartflows_checkout_before_shortcode', $checkout_id );
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* Render checkout ID hidden field.
|
533 |
+
*
|
534 |
+
* @param array $checkout checkout session data.
|
535 |
+
* @return void
|
536 |
+
*/
|
537 |
+
public function checkout_shortcode_post_id( $checkout ) {
|
538 |
+
|
539 |
+
global $post;
|
540 |
+
|
541 |
+
if ( _is_wcf_checkout_type() ) {
|
542 |
+
$checkout_id = $post->ID;
|
543 |
+
} else {
|
544 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
545 |
+
}
|
546 |
+
|
547 |
+
$flow_id = get_post_meta( $checkout_id, 'wcf-flow-id', true );
|
548 |
+
|
549 |
+
echo '<input type="hidden" class="input-hidden _wcf_flow_id" name="_wcf_flow_id" value="' . intval( $flow_id ) . '">';
|
550 |
+
echo '<input type="hidden" class="input-hidden _wcf_checkout_id" name="_wcf_checkout_id" value="' . intval( $checkout_id ) . '">';
|
551 |
+
}
|
552 |
+
|
553 |
+
/**
|
554 |
+
* Load shortcode scripts.
|
555 |
+
*
|
556 |
+
* @return void
|
557 |
+
*/
|
558 |
+
public function shortcode_scripts() {
|
559 |
+
|
560 |
+
wp_enqueue_style( 'wcf-checkout-template', wcf()->utils->get_css_url( 'checkout-template' ), '', CARTFLOWS_VER );
|
561 |
+
|
562 |
+
wp_enqueue_script(
|
563 |
+
'wcf-checkout-template',
|
564 |
+
wcf()->utils->get_js_url( 'checkout-template' ),
|
565 |
+
array( 'jquery' ),
|
566 |
+
CARTFLOWS_VER,
|
567 |
+
true
|
568 |
+
);
|
569 |
+
|
570 |
+
do_action( 'cartflows_checkout_scripts' );
|
571 |
+
|
572 |
+
$style = $this->generate_style();
|
573 |
+
|
574 |
+
wp_add_inline_style( 'wcf-checkout-template', $style );
|
575 |
+
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Load compatibility scripts.
|
580 |
+
*
|
581 |
+
* @return void
|
582 |
+
*/
|
583 |
+
public function compatibility_scripts() {
|
584 |
+
|
585 |
+
global $post;
|
586 |
+
|
587 |
+
if ( _is_wcf_checkout_type() ) {
|
588 |
+
$checkout_id = $post->ID;
|
589 |
+
} else {
|
590 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
591 |
+
}
|
592 |
+
|
593 |
+
// Add DIVI Compatibility css if DIVI theme is enabled.
|
594 |
+
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
595 |
+
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id )
|
596 |
+
) {
|
597 |
+
wp_enqueue_style( 'wcf-checkout-template-divi', wcf()->utils->get_css_url( 'checkout-template-divi' ), '', CARTFLOWS_VER );
|
598 |
+
}
|
599 |
+
|
600 |
+
// Add Flatsome Compatibility css if Flatsome theme is enabled.
|
601 |
+
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
602 |
+
wp_enqueue_style( 'wcf-checkout-template-flatsome', wcf()->utils->get_css_url( 'checkout-template-flatsome' ), '', CARTFLOWS_VER );
|
603 |
+
}
|
604 |
+
|
605 |
+
// Add The7 Compatibility css if The7 theme is enabled.
|
606 |
+
if ( Cartflows_Compatibility::get_instance()->is_the_seven_enabled() ) {
|
607 |
+
wp_enqueue_style( 'wcf-checkout-template-the-seven', wcf()->utils->get_css_url( 'checkout-template-the-seven' ), '', CARTFLOWS_VER );
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Generate styles.
|
613 |
+
*
|
614 |
+
* @return string
|
615 |
+
*/
|
616 |
+
public function generate_style() {
|
617 |
+
|
618 |
+
global $post;
|
619 |
+
|
620 |
+
if ( _is_wcf_checkout_type() ) {
|
621 |
+
$checkout_id = $post->ID;
|
622 |
+
} else {
|
623 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
624 |
+
}
|
625 |
+
|
626 |
+
/*Output css variable */
|
627 |
+
$output = '';
|
628 |
+
|
629 |
+
CartFlows_Font_Families::render_fonts( $checkout_id );
|
630 |
+
|
631 |
+
$primary_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-primary-color' );
|
632 |
+
|
633 |
+
$base_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-family' );
|
634 |
+
|
635 |
+
$header_logo_width = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-width' );
|
636 |
+
|
637 |
+
/**
|
638 |
+
$base_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-weight' );*/
|
639 |
+
$r = '';
|
640 |
+
$g = '';
|
641 |
+
$b = '';
|
642 |
+
|
643 |
+
$field_tb_padding = '';
|
644 |
+
$field_lr_padding = '';
|
645 |
+
|
646 |
+
$field_heading_color = '';
|
647 |
+
$field_color = '';
|
648 |
+
$field_bg_color = '';
|
649 |
+
$field_border_color = '';
|
650 |
+
$field_label_color = '';
|
651 |
+
$submit_tb_padding = '';
|
652 |
+
$submit_lr_padding = '';
|
653 |
+
$hl_bg_color = '';
|
654 |
+
$field_input_size = '';
|
655 |
+
$box_border_color = '';
|
656 |
+
$section_bg_color = '';
|
657 |
+
$submit_button_height = '';
|
658 |
+
$submit_color = '';
|
659 |
+
$submit_bg_color = $primary_color;
|
660 |
+
$submit_border_color = $primary_color;
|
661 |
+
|
662 |
+
$submit_hover_color = '';
|
663 |
+
$submit_bg_hover_color = $primary_color;
|
664 |
+
$submit_border_hover_color = $primary_color;
|
665 |
+
|
666 |
+
$section_heading_color = '';
|
667 |
+
|
668 |
+
$is_advance_option = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-advance-options-fields' );
|
669 |
+
|
670 |
+
$button_font_family = '';
|
671 |
+
$button_font_weight = '';
|
672 |
+
$input_font_family = '';
|
673 |
+
$input_font_weight = '';
|
674 |
+
$heading_font_family = '';
|
675 |
+
$heading_font_weight = '';
|
676 |
+
$base_font_family = $base_font_family;
|
677 |
+
/**
|
678 |
+
$base_font_weight = $base_font_weight;*/
|
679 |
+
|
680 |
+
if ( 'yes' == $is_advance_option ) {
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Get Font Family and Font Weight weight values
|
684 |
+
*/
|
685 |
+
$section_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-section-bg-color' );
|
686 |
+
|
687 |
+
$heading_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-family' );
|
688 |
+
$heading_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-weight' );
|
689 |
+
$section_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-color' );
|
690 |
+
$button_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-family' );
|
691 |
+
$button_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-weight' );
|
692 |
+
$input_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-family' );
|
693 |
+
$input_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-weight' );
|
694 |
+
$field_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-tb-padding' );
|
695 |
+
$field_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-lr-padding' );
|
696 |
+
$field_input_size = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-field-size' );
|
697 |
+
|
698 |
+
$field_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-heading-color' );
|
699 |
+
|
700 |
+
$field_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-color' );
|
701 |
+
|
702 |
+
$field_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-bg-color' );
|
703 |
+
|
704 |
+
$field_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-border-color' );
|
705 |
+
|
706 |
+
$field_label_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-label-color' );
|
707 |
+
|
708 |
+
$submit_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-tb-padding' );
|
709 |
+
|
710 |
+
$submit_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-lr-padding' );
|
711 |
+
|
712 |
+
$submit_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-color' );
|
713 |
+
|
714 |
+
$submit_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-color', $primary_color );
|
715 |
+
|
716 |
+
$submit_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-color', $primary_color );
|
717 |
+
|
718 |
+
$submit_border_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-hover-color', $primary_color );
|
719 |
+
|
720 |
+
$submit_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-hover-color' );
|
721 |
+
|
722 |
+
$submit_bg_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-hover-color', $primary_color );
|
723 |
+
|
724 |
+
$hl_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-hl-bg-color' );
|
725 |
+
|
726 |
+
$box_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-box-border-color' );
|
727 |
+
|
728 |
+
$submit_button_height = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-button-size' );
|
729 |
+
|
730 |
+
/**
|
731 |
+
* Get font values
|
732 |
+
*/
|
733 |
+
|
734 |
+
if ( 'custom' == $submit_button_height ) {
|
735 |
+
$submit_button_height = '38px';
|
736 |
+
}
|
737 |
+
|
738 |
+
if ( 'custom' == $field_input_size ) {
|
739 |
+
$field_input_size = '38px';
|
740 |
+
}
|
741 |
+
}
|
742 |
+
if ( isset( $primary_color ) ) {
|
743 |
+
|
744 |
+
list($r, $g, $b) = sscanf( $primary_color, '#%02x%02x%02x' );
|
745 |
+
}
|
746 |
+
|
747 |
+
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
748 |
+
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id ) ) {
|
749 |
+
|
750 |
+
include CARTFLOWS_CHECKOUT_DIR . 'includes/checkout-dynamic-divi-css.php';
|
751 |
+
|
752 |
+
} else {
|
753 |
+
include CARTFLOWS_CHECKOUT_DIR . 'includes/checkout-dynamic-css.php';
|
754 |
+
}
|
755 |
+
|
756 |
+
return $output;
|
757 |
+
}
|
758 |
+
|
759 |
+
/**
|
760 |
+
* Get ajax end points.
|
761 |
+
*
|
762 |
+
* @param string $endpoint_url end point URL.
|
763 |
+
* @param string $request end point request.
|
764 |
+
* @return string
|
765 |
+
*/
|
766 |
+
public function get_ajax_endpoint( $endpoint_url, $request ) {
|
767 |
+
|
768 |
+
global $post;
|
769 |
+
|
770 |
+
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
771 |
+
|
772 |
+
if ( _is_wcf_checkout_type() ) {
|
773 |
+
|
774 |
+
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
775 |
+
|
776 |
+
if ( '' === $request ) {
|
777 |
+
$query_args = array(
|
778 |
+
'wc-ajax' => '%%endpoint%%',
|
779 |
+
);
|
780 |
+
} else {
|
781 |
+
$query_args = array(
|
782 |
+
'wc-ajax' => $request,
|
783 |
+
);
|
784 |
+
}
|
785 |
+
|
786 |
+
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
787 |
+
$uri = $uri[0];
|
788 |
+
|
789 |
+
$endpoint_url = esc_url( add_query_arg( $query_args, $uri ) );
|
790 |
+
}
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
+
return $endpoint_url;
|
795 |
+
}
|
796 |
+
|
797 |
+
|
798 |
+
/**
|
799 |
+
* Save checkout fields.
|
800 |
+
*
|
801 |
+
* @param int $order_id order id.
|
802 |
+
* @param array $posted posted data.
|
803 |
+
* @return void
|
804 |
+
*/
|
805 |
+
public function save_checkout_fields( $order_id, $posted ) {
|
806 |
+
|
807 |
+
if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
|
808 |
+
|
809 |
+
$checkout_id = wc_clean( intval( $_POST['_wcf_checkout_id'] ) ); //phpcs:ignore
|
810 |
+
|
811 |
+
update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
|
812 |
+
|
813 |
+
if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
|
814 |
+
|
815 |
+
$flow_id = wc_clean( intval( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
|
816 |
+
|
817 |
+
update_post_meta( $order_id, '_wcf_flow_id', $flow_id );
|
818 |
+
}
|
819 |
+
}
|
820 |
+
|
821 |
+
}
|
822 |
+
|
823 |
+
/**
|
824 |
+
* Enable Logo In Header Of Checkout Page
|
825 |
+
*
|
826 |
+
* @return void
|
827 |
+
*/
|
828 |
+
public function enable_logo_in_header() {
|
829 |
+
global $post;
|
830 |
+
|
831 |
+
if ( _is_wcf_checkout_type() ) {
|
832 |
+
$checkout_id = $post->ID;
|
833 |
+
} else {
|
834 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
835 |
+
}
|
836 |
+
|
837 |
+
$header_logo_image = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-image' );
|
838 |
+
$add_image_markup = '';
|
839 |
+
|
840 |
+
if ( isset( $header_logo_image ) && ! empty( $header_logo_image ) ) {
|
841 |
+
$add_image_markup = '<div class="wcf-checkout-header-image">';
|
842 |
+
$add_image_markup .= '<img src="' . $header_logo_image . '" />';
|
843 |
+
$add_image_markup .= '</div>';
|
844 |
+
}
|
845 |
+
|
846 |
+
echo $add_image_markup;
|
847 |
+
}
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Add text to the bootom of the checkout page.
|
851 |
+
*
|
852 |
+
* @return void
|
853 |
+
*/
|
854 |
+
public function show_cartflows_copyright_message() {
|
855 |
+
$output_string = '';
|
856 |
+
|
857 |
+
$output_string .= '<div class="wcf-footer-primary">';
|
858 |
+
$output_string .= '<div class="wcf-footer-content">';
|
859 |
+
$output_string .= '<p class="wcf-footer-message">';
|
860 |
+
$output_string .= 'Checkout powered by CartFlows';
|
861 |
+
$output_string .= '</p>';
|
862 |
+
$output_string .= '</div>';
|
863 |
+
$output_string .= '</div>';
|
864 |
+
|
865 |
+
echo $output_string;
|
866 |
+
}
|
867 |
+
|
868 |
+
/**
|
869 |
+
* Redirect users to our checkout if hidden param
|
870 |
+
*
|
871 |
+
* @param string $redirect redirect url.
|
872 |
+
* @param object $user user.
|
873 |
+
* @return string
|
874 |
+
*/
|
875 |
+
public function after_login_redirect( $redirect, $user ) {
|
876 |
+
|
877 |
+
if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
|
878 |
+
|
879 |
+
$checkout_id = intval( $_POST['_wcf_checkout_id'] ); //phpcs:ignore
|
880 |
+
|
881 |
+
$redirect = get_permalink( $checkout_id );
|
882 |
+
}
|
883 |
+
|
884 |
+
return $redirect;
|
885 |
+
}
|
886 |
+
|
887 |
+
/**
|
888 |
+
* Display coupon code field after review order fields.
|
889 |
+
*/
|
890 |
+
public function display_custom_coupon_field() {
|
891 |
+
|
892 |
+
$coupon_enabled = apply_filters( 'woocommerce_coupons_enabled', true );
|
893 |
+
$show_coupon = apply_filters( 'cartflows_show_coupon_field', true );
|
894 |
+
|
895 |
+
if ( ! ( $coupon_enabled && $show_coupon ) ) {
|
896 |
+
return;
|
897 |
+
|
898 |
+
}
|
899 |
+
|
900 |
+
$coupon_field = array(
|
901 |
+
'field_text' => __( 'Coupon Code', 'cartflows' ),
|
902 |
+
'button_text' => __( 'Apply', 'cartflows' ),
|
903 |
+
'class' => '',
|
904 |
+
);
|
905 |
+
|
906 |
+
$coupon_field = apply_filters( 'cartflows_coupon_field_options', $coupon_field );
|
907 |
+
|
908 |
+
ob_start();
|
909 |
+
?>
|
910 |
+
<div class="wcf-custom-coupon-field <?php echo $coupon_field['class']; ?>" id="wcf_custom_coupon_field">
|
911 |
+
<div class="wcf-coupon-col-1">
|
912 |
+
<span>
|
913 |
+
<input type="text" name="coupon_code" class="input-text wcf-coupon-code-input" placeholder="<?php echo $coupon_field['field_text']; ?>" id="coupon_code" value="">
|
914 |
+
</span>
|
915 |
+
</div>
|
916 |
+
<div class="wcf-coupon-col-2">
|
917 |
+
<span>
|
918 |
+
<button type="button" class="button wcf-submit-coupon wcf-btn-small" name="apply_coupon" value="Apply"><?php echo $coupon_field['button_text']; ?></button>
|
919 |
+
</span>
|
920 |
+
</div>
|
921 |
+
</div>
|
922 |
+
<?php
|
923 |
+
echo ob_get_clean();
|
924 |
+
}
|
925 |
+
|
926 |
+
/**
|
927 |
+
* Apply filter to change class of remove coupon field.
|
928 |
+
*
|
929 |
+
* @param string $coupon coupon.
|
930 |
+
* @return string
|
931 |
+
*/
|
932 |
+
public function remove_coupon_text( $coupon ) {
|
933 |
+
|
934 |
+
$coupon = str_replace( 'woocommerce-remove-coupon', 'wcf-remove-coupon', $coupon );
|
935 |
+
return $coupon;
|
936 |
+
|
937 |
+
}
|
938 |
+
/**
|
939 |
+
* Apply filter to change the placeholder text of coupon field.
|
940 |
+
*
|
941 |
+
* @return string
|
942 |
+
*/
|
943 |
+
public function coupon_field_placeholder() {
|
944 |
+
return apply_filters( 'cartflows_coupon_field_placeholder', __( 'Coupon Code', 'cartflows' ) );
|
945 |
+
}
|
946 |
+
|
947 |
+
/**
|
948 |
+
* Apply filter to change the button text of coupon field.
|
949 |
+
*
|
950 |
+
* @return string
|
951 |
+
*/
|
952 |
+
public function coupon_button_text() {
|
953 |
+
return apply_filters( 'cartflows_coupon_button_text', __( 'Apply', 'cartflows' ) );
|
954 |
+
}
|
955 |
+
|
956 |
+
/**
|
957 |
+
* Apply coupon on submit of custom coupon form.
|
958 |
+
*/
|
959 |
+
public function apply_coupon() {
|
960 |
+
|
961 |
+
$response = '';
|
962 |
+
|
963 |
+
check_ajax_referer( 'wcf-apply-coupon', 'security' );
|
964 |
+
if ( ! empty( $_POST['coupon_code'] ) ) {
|
965 |
+
$result = WC()->cart->add_discount( sanitize_text_field( wp_unslash( $_POST['coupon_code'] ) ) );
|
966 |
+
} else {
|
967 |
+
wc_add_notice( WC_Coupon::get_generic_coupon_error( WC_Coupon::E_WC_COUPON_PLEASE_ENTER ), 'error' );
|
968 |
+
}
|
969 |
+
|
970 |
+
$response = array(
|
971 |
+
'status' => $result,
|
972 |
+
'msg' => wc_print_notices( true ),
|
973 |
+
);
|
974 |
+
|
975 |
+
echo wp_json_encode( $response );
|
976 |
+
|
977 |
+
die();
|
978 |
+
}
|
979 |
+
|
980 |
+
|
981 |
+
/**
|
982 |
+
* Added ajax nonce to localize variable.
|
983 |
+
*
|
984 |
+
* @param array $vars localize variables.
|
985 |
+
*/
|
986 |
+
public function add_localize_vars( $vars ) {
|
987 |
+
|
988 |
+
$vars['wcf_validate_coupon_nonce'] = wp_create_nonce( 'wcf-apply-coupon' );
|
989 |
+
|
990 |
+
$vars['wcf_validate_remove_coupon_nonce'] = wp_create_nonce( 'wcf-remove-coupon' );
|
991 |
+
|
992 |
+
$vars['wcf_validate_remove_cart_product_nonce'] = wp_create_nonce( 'wcf-remove-cart-product' );
|
993 |
+
|
994 |
+
$vars['allow_persistance'] = apply_filters( 'cartflows_allow_persistace', 'yes' );
|
995 |
+
|
996 |
+
return $vars;
|
997 |
+
}
|
998 |
+
|
999 |
+
/**
|
1000 |
+
* Add custom class to the fields to change the UI to three column.
|
1001 |
+
*
|
1002 |
+
* @param array $fields fields.
|
1003 |
+
*/
|
1004 |
+
public function add_three_column_layout_fields( $fields ) {
|
1005 |
+
|
1006 |
+
if ( empty( $fields['billing']['billing_address_2'] ) ) {
|
1007 |
+
|
1008 |
+
if ( isset( $fields['billing']['billing_address_1'] ) && is_array( $fields['billing']['billing_address_1'] ) ) {
|
1009 |
+
$fields['billing']['billing_address_1']['class'][] = 'form-row-full';
|
1010 |
+
}
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
if ( ! empty( $fields['billing']['billing_company'] ) ) {
|
1014 |
+
|
1015 |
+
if ( isset( $fields['billing']['billing_company'] ) && is_array( $fields['billing']['billing_company'] ) ) {
|
1016 |
+
$fields['billing']['billing_company']['class'][] = 'form-row-full';
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
|
1020 |
+
if ( ! empty( $fields['shipping']['shipping_company'] ) ) {
|
1021 |
+
|
1022 |
+
if ( isset( $fields['shipping']['shipping_company'] ) && is_array( $fields['shipping']['shipping_company'] ) ) {
|
1023 |
+
$fields['shipping']['shipping_company']['class'][] = 'form-row-full';
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
if ( ! empty( $fields['billing']['billing_country'] ) ) {
|
1028 |
+
|
1029 |
+
if ( isset( $fields['billing']['billing_country'] ) && is_array( $fields['billing']['billing_country'] ) ) {
|
1030 |
+
$fields['billing']['billing_country']['class'][] = 'form-row-full';
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
if ( ! empty( $fields['shipping']['shipping_country'] ) ) {
|
1035 |
+
|
1036 |
+
if ( isset( $fields['shipping']['shipping_country'] ) && is_array( $fields['shipping']['shipping_country'] ) ) {
|
1037 |
+
$fields['shipping']['shipping_country']['class'][] = 'form-row-full';
|
1038 |
+
}
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
if ( ! empty( $fields['billing']['billing_phone'] ) ) {
|
1042 |
+
|
1043 |
+
if ( isset( $fields['billing']['billing_phone'] ) && is_array( $fields['billing']['billing_phone'] ) ) {
|
1044 |
+
$fields['billing']['billing_phone']['class'][] = 'form-row-full';
|
1045 |
+
}
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
if ( ! empty( $fields['billing']['billing_email'] ) ) {
|
1049 |
+
|
1050 |
+
if ( isset( $fields['billing']['billing_email'] ) && is_array( $fields['billing']['billing_email'] ) ) {
|
1051 |
+
$fields['billing']['billing_email']['class'][] = 'form-row-full';
|
1052 |
+
}
|
1053 |
+
}
|
1054 |
+
|
1055 |
+
if ( empty( $fields['shipping']['shipping_address_2'] ) ) {
|
1056 |
+
|
1057 |
+
if ( isset( $fields['shipping']['shipping_address_1'] ) && is_array( $fields['shipping']['shipping_address_1'] ) ) {
|
1058 |
+
$fields['shipping']['shipping_address_1']['class'][] = 'form-row-full';
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
if ( isset( $fields['billing']['billing_city'] ) &&
|
1063 |
+
isset( $fields['billing']['billing_state'] ) && isset( $fields['billing']['billing_postcode'] ) ) {
|
1064 |
+
|
1065 |
+
$fields['billing']['billing_city']['class'][] = 'wcf-column-33';
|
1066 |
+
$fields['billing']['billing_state']['class'][] = 'wcf-column-33';
|
1067 |
+
$fields['billing']['billing_postcode']['class'][] = 'wcf-column-33';
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
if ( isset( $fields['shipping']['shipping_city'] ) &&
|
1071 |
+
isset( $fields['shipping']['shipping_state'] ) && isset( $fields['shipping']['shipping_postcode'] ) ) {
|
1072 |
+
|
1073 |
+
$fields['shipping']['shipping_city']['class'][] = 'wcf-column-33';
|
1074 |
+
$fields['shipping']['shipping_state']['class'][] = 'wcf-column-33';
|
1075 |
+
$fields['shipping']['shipping_postcode']['class'][] = 'wcf-column-33';
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
return $fields;
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
/**
|
1082 |
+
* Add opening dev
|
1083 |
+
*
|
1084 |
+
* @since 1.0.0
|
1085 |
+
*/
|
1086 |
+
public function order_wrap_div_start() {
|
1087 |
+
|
1088 |
+
echo "<div class='wcf-order-wrap'> ";
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* Add closing dev
|
1093 |
+
*
|
1094 |
+
* @since 1.0.0
|
1095 |
+
*/
|
1096 |
+
public function order_wrap_div_end() {
|
1097 |
+
|
1098 |
+
echo '</div> ';
|
1099 |
+
}
|
1100 |
+
/**
|
1101 |
+
* Remove coupon.
|
1102 |
+
*/
|
1103 |
+
public function remove_coupon() {
|
1104 |
+
|
1105 |
+
check_ajax_referer( 'wcf-remove-coupon', 'security' );
|
1106 |
+
$coupon = isset( $_POST['coupon_code'] ) ? wc_clean( wp_unslash( $_POST['coupon_code'] ) ) : false; //phpcs:ignore
|
1107 |
+
|
1108 |
+
if ( empty( $coupon ) ) {
|
1109 |
+
echo "<div class='woocommerce-error'>" . esc_html__( 'Sorry there was a problem removing this coupon.', 'cartflows' );
|
1110 |
+
} else {
|
1111 |
+
WC()->cart->remove_coupon( $coupon );
|
1112 |
+
echo "<div class='woocommerce-error'>" . esc_html__( 'Coupon has been removed.', 'cartflows' ) . '</div>';
|
1113 |
+
}
|
1114 |
+
wc_print_notices();
|
1115 |
+
wp_die();
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
/**
|
1119 |
+
* Remove cart item.
|
1120 |
+
*/
|
1121 |
+
public function wcf_woo_remove_cart_product() {
|
1122 |
+
|
1123 |
+
check_ajax_referer( 'wcf-remove-cart-product', 'security' );
|
1124 |
+
$product_key = isset( $_POST['p_key'] ) ? wc_clean( wp_unslash( $_POST['p_key'] ) ) : false; //phpcs:ignore
|
1125 |
+
$product_id = isset( $_POST['p_id'] ) ? wc_clean( wp_unslash( $_POST['p_id'] ) ) : ''; //phpcs:ignore
|
1126 |
+
$product_title = get_the_title( $product_id );
|
1127 |
+
|
1128 |
+
$needs_shipping = false;
|
1129 |
+
|
1130 |
+
if ( empty( $product_key ) ) {
|
1131 |
+
$msg = "<div class='woocommerce-message'>" . __( 'Sorry there was a problem removing ', 'cartflows' ) . $product_title;
|
1132 |
+
} else {
|
1133 |
+
WC()->cart->remove_cart_item( $product_key );
|
1134 |
+
$msg = "<div class='woocommerce-message'>" . $product_title . __( ' has been removed.', 'cartflows' ) . '</div>';
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
|
1138 |
+
if ( $values['data']->needs_shipping() ) {
|
1139 |
+
$needs_shipping = true;
|
1140 |
+
break;
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
$response = array(
|
1145 |
+
'need_shipping' => $needs_shipping,
|
1146 |
+
'msg' => $msg,
|
1147 |
+
);
|
1148 |
+
|
1149 |
+
echo wp_json_encode( $response );
|
1150 |
+
wp_die();
|
1151 |
+
}
|
1152 |
+
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
/**
|
1156 |
+
* Kicking this off by calling 'get_instance()' method
|
1157 |
+
*/
|
1158 |
+
Cartflows_Checkout_Markup::get_instance();
|
modules/checkout/includes/checkout-dynamic-css.php
CHANGED
@@ -1,162 +1,162 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dynamic checkout css
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$output = "
|
9 |
-
.wcf-embed-checkout-form .woocommerce .woocommerce-checkout .product-name .remove:hover{
|
10 |
-
color:$primary_color !important;
|
11 |
-
border:1px solid $primary_color !important;
|
12 |
-
}
|
13 |
-
.wcf-embed-checkout-form .wcf-checkout-header-image img{
|
14 |
-
width: {$header_logo_width}px;
|
15 |
-
}
|
16 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
|
17 |
-
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
18 |
-
color: {$primary_color};
|
19 |
-
}
|
20 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
|
21 |
-
background-color: {$primary_color};
|
22 |
-
}
|
23 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,
|
24 |
-
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
25 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:focus,
|
26 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
27 |
-
border-color: {$primary_color};
|
28 |
-
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
29 |
-
}
|
30 |
-
.wcf-embed-checkout-form .woocommerce-checkout label{
|
31 |
-
color: {$field_label_color};
|
32 |
-
}
|
33 |
-
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{
|
34 |
-
background-color: {$hl_bg_color};
|
35 |
-
font-family: {$input_font_family};
|
36 |
-
font-weight: {$input_font_weight};
|
37 |
-
}
|
38 |
-
|
39 |
-
.wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,
|
40 |
-
.wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,
|
41 |
-
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before
|
42 |
-
{
|
43 |
-
border-bottom-color: {$hl_bg_color};
|
44 |
-
border-right-color: transparent;
|
45 |
-
border-left-color: transparent;
|
46 |
-
border-top-color: transparent;
|
47 |
-
position: absolute;
|
48 |
-
}
|
49 |
-
|
50 |
-
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:checked + label,
|
51 |
-
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:not(:checked) + label{
|
52 |
-
font-family: {$input_font_family};
|
53 |
-
font-weight: {$input_font_weight};
|
54 |
-
}
|
55 |
-
|
56 |
-
.wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type='text'],
|
57 |
-
.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,
|
58 |
-
.wcf-embed-checkout-form .woocommerce form .form-row textarea,
|
59 |
-
.wcf-embed-checkout-form .select2-container--default .select2-selection--single,
|
60 |
-
.wcf-embed-checkout-form .woocommerce form .form-row select.select {
|
61 |
-
color: {$field_color};
|
62 |
-
background: {$field_bg_color};
|
63 |
-
border-color: {$field_border_color};
|
64 |
-
padding-top: {$field_tb_padding}px;
|
65 |
-
padding-bottom: {$field_tb_padding}px;
|
66 |
-
padding-left: {$field_lr_padding}px;
|
67 |
-
padding-right: {$field_lr_padding}px;
|
68 |
-
min-height: {$field_input_size};
|
69 |
-
font-family: {$input_font_family};
|
70 |
-
font-weight: {$input_font_weight};
|
71 |
-
}
|
72 |
-
|
73 |
-
.wcf-embed-checkout-form .woocommerce .col2-set .col-1,
|
74 |
-
.wcf-embed-checkout-form .woocommerce .col2-set .col-2,
|
75 |
-
.wcf-embed-checkout-form .woocommerce-checkout .shop_table,
|
76 |
-
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading,
|
77 |
-
.wcf-embed-checkout-form .woocommerce-checkout #payment,
|
78 |
-
.wcf-embed-checkout-form .woocommerce form.checkout_coupon
|
79 |
-
{
|
80 |
-
background-color: {$section_bg_color};
|
81 |
-
border-color: {$box_border_color};
|
82 |
-
font-family: {$input_font_family};
|
83 |
-
font-weight: {$input_font_weight};
|
84 |
-
}
|
85 |
-
|
86 |
-
.woocommerce table.shop_table th{
|
87 |
-
color: {$field_label_color};
|
88 |
-
}
|
89 |
-
/*.wcf-embed-checkout-form .woocommerce .woocommerce-info,
|
90 |
-
.wcf-embed-checkout-form .woocommerce-message{
|
91 |
-
border-top-color: {$primary_color};
|
92 |
-
background-color: {$hl_bg_color};
|
93 |
-
}*/
|
94 |
-
.wcf-embed-checkout-form .woocommerce a{
|
95 |
-
color: {$primary_color};
|
96 |
-
}
|
97 |
-
.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
98 |
-
color: {$field_color};
|
99 |
-
}
|
100 |
-
.wcf-embed-checkout-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
101 |
-
color: {$field_color};
|
102 |
-
}
|
103 |
-
.wcf-embed-checkout-form ::-moz-placeholder { /* Firefox 19+ */
|
104 |
-
color: {$field_color};
|
105 |
-
}
|
106 |
-
.wcf-embed-checkout-form :-ms-input-placeholder { /* IE 10+ */
|
107 |
-
color: {$field_color};
|
108 |
-
}
|
109 |
-
.wcf-embed-checkout-form :-moz-placeholder { /* Firefox 18- */
|
110 |
-
color: {$field_color};
|
111 |
-
}
|
112 |
-
.wcf-embed-checkout-form .woocommerce form p.form-row label {
|
113 |
-
color: {$field_label_color};
|
114 |
-
font-family: {$input_font_family};
|
115 |
-
font-weight: {$input_font_weight};
|
116 |
-
}
|
117 |
-
.wcf-embed-checkout-form .woocommerce #order_review button,
|
118 |
-
.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,
|
119 |
-
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small {
|
120 |
-
color: {$submit_color};
|
121 |
-
background: {$submit_bg_color};
|
122 |
-
padding-top: {$submit_tb_padding}px;
|
123 |
-
padding-bottom: {$submit_tb_padding}px;
|
124 |
-
padding-left: {$submit_lr_padding}px;
|
125 |
-
padding-right: {$submit_lr_padding}px;
|
126 |
-
border-color: {$submit_border_color};
|
127 |
-
min-height: {$submit_button_height};
|
128 |
-
font-family: {$button_font_family};
|
129 |
-
font-weight: {$button_font_weight};
|
130 |
-
}
|
131 |
-
.wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button,
|
132 |
-
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button{
|
133 |
-
background: {$submit_bg_color};
|
134 |
-
border: 1px {$submit_border_color} solid;
|
135 |
-
color: {$submit_color};
|
136 |
-
min-height: {$submit_button_height};
|
137 |
-
font-family: {$button_font_family};
|
138 |
-
font-weight: {$button_font_weight};
|
139 |
-
}
|
140 |
-
.wcf-embed-checkout-form .woocommerce-checkout form.login .button:hover,
|
141 |
-
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
142 |
-
.wcf-embed-checkout-form .woocommerce #payment #place_order:hover,
|
143 |
-
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{
|
144 |
-
color: {$submit_hover_color};
|
145 |
-
background-color: {$submit_bg_hover_color};
|
146 |
-
border-color: {$submit_border_hover_color};
|
147 |
-
}
|
148 |
-
.wcf-embed-checkout-form .woocommerce h3,
|
149 |
-
.wcf-embed-checkout-form .woocommerce h3 span,
|
150 |
-
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
|
151 |
-
color: {$section_heading_color};
|
152 |
-
font-family: {$heading_font_family};
|
153 |
-
font-weight: {$heading_font_weight};
|
154 |
-
}
|
155 |
-
.wcf-embed-checkout-form .woocommerce-info::before,
|
156 |
-
.wcf-embed-checkout-form .woocommerce-message::before{
|
157 |
-
color: {$primary_color};
|
158 |
-
}
|
159 |
-
.wcf-embed-checkout-form{
|
160 |
-
font-family: {$base_font_family};
|
161 |
-
}
|
162 |
-
img.emoji, img.wp-smiley {}";
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic checkout css
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$output = "
|
9 |
+
.wcf-embed-checkout-form .woocommerce .woocommerce-checkout .product-name .remove:hover{
|
10 |
+
color:$primary_color !important;
|
11 |
+
border:1px solid $primary_color !important;
|
12 |
+
}
|
13 |
+
.wcf-embed-checkout-form .wcf-checkout-header-image img{
|
14 |
+
width: {$header_logo_width}px;
|
15 |
+
}
|
16 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
|
17 |
+
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
18 |
+
color: {$primary_color};
|
19 |
+
}
|
20 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
|
21 |
+
background-color: {$primary_color};
|
22 |
+
}
|
23 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,
|
24 |
+
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
25 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:focus,
|
26 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
27 |
+
border-color: {$primary_color};
|
28 |
+
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
29 |
+
}
|
30 |
+
.wcf-embed-checkout-form .woocommerce-checkout label{
|
31 |
+
color: {$field_label_color};
|
32 |
+
}
|
33 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{
|
34 |
+
background-color: {$hl_bg_color};
|
35 |
+
font-family: {$input_font_family};
|
36 |
+
font-weight: {$input_font_weight};
|
37 |
+
}
|
38 |
+
|
39 |
+
.wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,
|
40 |
+
.wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,
|
41 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before
|
42 |
+
{
|
43 |
+
border-bottom-color: {$hl_bg_color};
|
44 |
+
border-right-color: transparent;
|
45 |
+
border-left-color: transparent;
|
46 |
+
border-top-color: transparent;
|
47 |
+
position: absolute;
|
48 |
+
}
|
49 |
+
|
50 |
+
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:checked + label,
|
51 |
+
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:not(:checked) + label{
|
52 |
+
font-family: {$input_font_family};
|
53 |
+
font-weight: {$input_font_weight};
|
54 |
+
}
|
55 |
+
|
56 |
+
.wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type='text'],
|
57 |
+
.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,
|
58 |
+
.wcf-embed-checkout-form .woocommerce form .form-row textarea,
|
59 |
+
.wcf-embed-checkout-form .select2-container--default .select2-selection--single,
|
60 |
+
.wcf-embed-checkout-form .woocommerce form .form-row select.select {
|
61 |
+
color: {$field_color};
|
62 |
+
background: {$field_bg_color};
|
63 |
+
border-color: {$field_border_color};
|
64 |
+
padding-top: {$field_tb_padding}px;
|
65 |
+
padding-bottom: {$field_tb_padding}px;
|
66 |
+
padding-left: {$field_lr_padding}px;
|
67 |
+
padding-right: {$field_lr_padding}px;
|
68 |
+
min-height: {$field_input_size};
|
69 |
+
font-family: {$input_font_family};
|
70 |
+
font-weight: {$input_font_weight};
|
71 |
+
}
|
72 |
+
|
73 |
+
.wcf-embed-checkout-form .woocommerce .col2-set .col-1,
|
74 |
+
.wcf-embed-checkout-form .woocommerce .col2-set .col-2,
|
75 |
+
.wcf-embed-checkout-form .woocommerce-checkout .shop_table,
|
76 |
+
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading,
|
77 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment,
|
78 |
+
.wcf-embed-checkout-form .woocommerce form.checkout_coupon
|
79 |
+
{
|
80 |
+
background-color: {$section_bg_color};
|
81 |
+
border-color: {$box_border_color};
|
82 |
+
font-family: {$input_font_family};
|
83 |
+
font-weight: {$input_font_weight};
|
84 |
+
}
|
85 |
+
|
86 |
+
.woocommerce table.shop_table th{
|
87 |
+
color: {$field_label_color};
|
88 |
+
}
|
89 |
+
/*.wcf-embed-checkout-form .woocommerce .woocommerce-info,
|
90 |
+
.wcf-embed-checkout-form .woocommerce-message{
|
91 |
+
border-top-color: {$primary_color};
|
92 |
+
background-color: {$hl_bg_color};
|
93 |
+
}*/
|
94 |
+
.wcf-embed-checkout-form .woocommerce a{
|
95 |
+
color: {$primary_color};
|
96 |
+
}
|
97 |
+
.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
98 |
+
color: {$field_color};
|
99 |
+
}
|
100 |
+
.wcf-embed-checkout-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
101 |
+
color: {$field_color};
|
102 |
+
}
|
103 |
+
.wcf-embed-checkout-form ::-moz-placeholder { /* Firefox 19+ */
|
104 |
+
color: {$field_color};
|
105 |
+
}
|
106 |
+
.wcf-embed-checkout-form :-ms-input-placeholder { /* IE 10+ */
|
107 |
+
color: {$field_color};
|
108 |
+
}
|
109 |
+
.wcf-embed-checkout-form :-moz-placeholder { /* Firefox 18- */
|
110 |
+
color: {$field_color};
|
111 |
+
}
|
112 |
+
.wcf-embed-checkout-form .woocommerce form p.form-row label {
|
113 |
+
color: {$field_label_color};
|
114 |
+
font-family: {$input_font_family};
|
115 |
+
font-weight: {$input_font_weight};
|
116 |
+
}
|
117 |
+
.wcf-embed-checkout-form .woocommerce #order_review button,
|
118 |
+
.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,
|
119 |
+
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small {
|
120 |
+
color: {$submit_color};
|
121 |
+
background: {$submit_bg_color};
|
122 |
+
padding-top: {$submit_tb_padding}px;
|
123 |
+
padding-bottom: {$submit_tb_padding}px;
|
124 |
+
padding-left: {$submit_lr_padding}px;
|
125 |
+
padding-right: {$submit_lr_padding}px;
|
126 |
+
border-color: {$submit_border_color};
|
127 |
+
min-height: {$submit_button_height};
|
128 |
+
font-family: {$button_font_family};
|
129 |
+
font-weight: {$button_font_weight};
|
130 |
+
}
|
131 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button,
|
132 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button{
|
133 |
+
background: {$submit_bg_color};
|
134 |
+
border: 1px {$submit_border_color} solid;
|
135 |
+
color: {$submit_color};
|
136 |
+
min-height: {$submit_button_height};
|
137 |
+
font-family: {$button_font_family};
|
138 |
+
font-weight: {$button_font_weight};
|
139 |
+
}
|
140 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.login .button:hover,
|
141 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
142 |
+
.wcf-embed-checkout-form .woocommerce #payment #place_order:hover,
|
143 |
+
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{
|
144 |
+
color: {$submit_hover_color};
|
145 |
+
background-color: {$submit_bg_hover_color};
|
146 |
+
border-color: {$submit_border_hover_color};
|
147 |
+
}
|
148 |
+
.wcf-embed-checkout-form .woocommerce h3,
|
149 |
+
.wcf-embed-checkout-form .woocommerce h3 span,
|
150 |
+
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
|
151 |
+
color: {$section_heading_color};
|
152 |
+
font-family: {$heading_font_family};
|
153 |
+
font-weight: {$heading_font_weight};
|
154 |
+
}
|
155 |
+
.wcf-embed-checkout-form .woocommerce-info::before,
|
156 |
+
.wcf-embed-checkout-form .woocommerce-message::before{
|
157 |
+
color: {$primary_color};
|
158 |
+
}
|
159 |
+
.wcf-embed-checkout-form{
|
160 |
+
font-family: {$base_font_family};
|
161 |
+
}
|
162 |
+
img.emoji, img.wp-smiley {}";
|
modules/checkout/includes/checkout-dynamic-divi-css.php
CHANGED
@@ -1,169 +1,169 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dynamic checkout divi css
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$output = "
|
9 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-checkout .product-name .remove:hover{
|
10 |
-
color:$primary_color !important;
|
11 |
-
border:1px solid $primary_color !important;
|
12 |
-
}
|
13 |
-
.et_pb_module #wcf-embed-checkout-form .wcf-checkout-header-image img{
|
14 |
-
width: {$header_logo_width}px;
|
15 |
-
}
|
16 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
|
17 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
18 |
-
color: {$primary_color} !important;
|
19 |
-
}
|
20 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
|
21 |
-
background-color: {$primary_color};
|
22 |
-
}
|
23 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,
|
24 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
25 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:focus,
|
26 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
27 |
-
border-color: {$primary_color} !important;
|
28 |
-
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8) !important;
|
29 |
-
}
|
30 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout label{
|
31 |
-
color: {$field_label_color};
|
32 |
-
}
|
33 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{
|
34 |
-
background-color: {$hl_bg_color};
|
35 |
-
font-family: {$input_font_family};
|
36 |
-
font-weight: {$input_font_weight};
|
37 |
-
}
|
38 |
-
|
39 |
-
.et_pb_module #wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,
|
40 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,
|
41 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before
|
42 |
-
{
|
43 |
-
border-bottom-color: {$hl_bg_color};
|
44 |
-
border-right-color: transparent;
|
45 |
-
border-left-color: transparent;
|
46 |
-
border-top-color: transparent;
|
47 |
-
position: absolute;
|
48 |
-
}
|
49 |
-
|
50 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment [type='radio']:checked + label,
|
51 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment [type='radio']:not(:checked) + label{
|
52 |
-
font-family: {$input_font_family};
|
53 |
-
font-weight: {$input_font_weight};
|
54 |
-
}
|
55 |
-
|
56 |
-
.et_pb_module #wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type='text'],
|
57 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,
|
58 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea,
|
59 |
-
.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single {
|
60 |
-
color: {$field_color} !important;
|
61 |
-
background-color: {$field_bg_color} !important;
|
62 |
-
border-color: {$field_border_color} !important;
|
63 |
-
padding-top: {$field_tb_padding}px;
|
64 |
-
padding-bottom: {$field_tb_padding}px;
|
65 |
-
padding-left: {$field_lr_padding}px;
|
66 |
-
padding-right: {$field_lr_padding}px;
|
67 |
-
min-height: {$field_input_size} !important;
|
68 |
-
font-family: {$input_font_family};
|
69 |
-
font-weight: {$input_font_weight};
|
70 |
-
}
|
71 |
-
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='text'],
|
72 |
-
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='email'],
|
73 |
-
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='password'],
|
74 |
-
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='tel'],
|
75 |
-
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .select2-container--default .select2-selection--single{
|
76 |
-
padding:{$field_tb_padding}px {$field_lr_padding}px !important;
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce .col2-set .col-1,
|
81 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce .col2-set .col-2,
|
82 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .shop_table,
|
83 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading,
|
84 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment,
|
85 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce form.checkout_coupon
|
86 |
-
{
|
87 |
-
background-color: {$section_bg_color};
|
88 |
-
border-color: {$box_border_color};
|
89 |
-
font-family: {$input_font_family};
|
90 |
-
font-weight: {$input_font_weight};
|
91 |
-
}
|
92 |
-
|
93 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce table.shop_table th{
|
94 |
-
color: {$field_label_color};
|
95 |
-
}
|
96 |
-
/*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,
|
97 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-message{
|
98 |
-
border-top-color: {$primary_color};
|
99 |
-
background-color: {$hl_bg_color};
|
100 |
-
}*/
|
101 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce a:not(.wcf-next-button){
|
102 |
-
color: {$primary_color} !important;
|
103 |
-
}
|
104 |
-
.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
105 |
-
color: {$field_color};
|
106 |
-
}
|
107 |
-
.et_pb_module #wcf-embed-checkout-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
108 |
-
color: {$field_color};
|
109 |
-
}
|
110 |
-
.et_pb_module #wcf-embed-checkout-form ::-moz-placeholder { /* Firefox 19+ */
|
111 |
-
color: {$field_color};
|
112 |
-
}
|
113 |
-
.et_pb_module #wcf-embed-checkout-form :-ms-input-placeholder { /* IE 10+ */
|
114 |
-
color: {$field_color};
|
115 |
-
}
|
116 |
-
.et_pb_module #wcf-embed-checkout-form :-moz-placeholder { /* Firefox 18- */
|
117 |
-
color: {$field_color};
|
118 |
-
}
|
119 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce form p.form-row label {
|
120 |
-
color: {$field_label_color};
|
121 |
-
font-family: {$input_font_family};
|
122 |
-
font-weight: {$input_font_weight};
|
123 |
-
}
|
124 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button,
|
125 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,
|
126 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small {
|
127 |
-
color: {$submit_color};
|
128 |
-
background: {$submit_bg_color};
|
129 |
-
padding-top: {$submit_tb_padding}px;
|
130 |
-
padding-bottom: {$submit_tb_padding}px;
|
131 |
-
padding-left: {$submit_lr_padding}px;
|
132 |
-
padding-right: {$submit_lr_padding}px;
|
133 |
-
border-color: {$submit_border_color};
|
134 |
-
min-height: {$submit_button_height};
|
135 |
-
font-family: {$button_font_family};
|
136 |
-
font-weight: {$button_font_weight};
|
137 |
-
}
|
138 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button,
|
139 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button{
|
140 |
-
background: {$submit_bg_color};
|
141 |
-
border: 1px {$submit_border_color} solid;
|
142 |
-
color: {$submit_color};
|
143 |
-
min-height: {$submit_button_height};
|
144 |
-
font-family: {$button_font_family};
|
145 |
-
font-weight: {$button_font_weight};
|
146 |
-
}
|
147 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.login .button:hover,
|
148 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
149 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment #place_order:hover,
|
150 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{
|
151 |
-
color: {$submit_hover_color};
|
152 |
-
background-color: {$submit_bg_hover_color};
|
153 |
-
border-color: {$submit_border_hover_color};
|
154 |
-
}
|
155 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce h3,
|
156 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce h3 span,
|
157 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
|
158 |
-
color: {$section_heading_color};
|
159 |
-
font-family: {$heading_font_family};
|
160 |
-
font-weight: {$heading_font_weight};
|
161 |
-
}
|
162 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-info::before,
|
163 |
-
.et_pb_module #wcf-embed-checkout-form .woocommerce-message::before{
|
164 |
-
color: {$primary_color};
|
165 |
-
}
|
166 |
-
.et_pb_module #wcf-embed-checkout-form {
|
167 |
-
font-family: {$base_font_family};
|
168 |
-
}
|
169 |
-
img.emoji, img.wp-smiley {}";
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic checkout divi css
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$output = "
|
9 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-checkout .product-name .remove:hover{
|
10 |
+
color:$primary_color !important;
|
11 |
+
border:1px solid $primary_color !important;
|
12 |
+
}
|
13 |
+
.et_pb_module #wcf-embed-checkout-form .wcf-checkout-header-image img{
|
14 |
+
width: {$header_logo_width}px;
|
15 |
+
}
|
16 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
|
17 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
18 |
+
color: {$primary_color} !important;
|
19 |
+
}
|
20 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
|
21 |
+
background-color: {$primary_color};
|
22 |
+
}
|
23 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,
|
24 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
25 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:focus,
|
26 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
27 |
+
border-color: {$primary_color} !important;
|
28 |
+
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8) !important;
|
29 |
+
}
|
30 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout label{
|
31 |
+
color: {$field_label_color};
|
32 |
+
}
|
33 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{
|
34 |
+
background-color: {$hl_bg_color};
|
35 |
+
font-family: {$input_font_family};
|
36 |
+
font-weight: {$input_font_weight};
|
37 |
+
}
|
38 |
+
|
39 |
+
.et_pb_module #wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,
|
40 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,
|
41 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before
|
42 |
+
{
|
43 |
+
border-bottom-color: {$hl_bg_color};
|
44 |
+
border-right-color: transparent;
|
45 |
+
border-left-color: transparent;
|
46 |
+
border-top-color: transparent;
|
47 |
+
position: absolute;
|
48 |
+
}
|
49 |
+
|
50 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment [type='radio']:checked + label,
|
51 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment [type='radio']:not(:checked) + label{
|
52 |
+
font-family: {$input_font_family};
|
53 |
+
font-weight: {$input_font_weight};
|
54 |
+
}
|
55 |
+
|
56 |
+
.et_pb_module #wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type='text'],
|
57 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row input.input-text,
|
58 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce form .form-row textarea,
|
59 |
+
.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single {
|
60 |
+
color: {$field_color} !important;
|
61 |
+
background-color: {$field_bg_color} !important;
|
62 |
+
border-color: {$field_border_color} !important;
|
63 |
+
padding-top: {$field_tb_padding}px;
|
64 |
+
padding-bottom: {$field_tb_padding}px;
|
65 |
+
padding-left: {$field_lr_padding}px;
|
66 |
+
padding-right: {$field_lr_padding}px;
|
67 |
+
min-height: {$field_input_size} !important;
|
68 |
+
font-family: {$input_font_family};
|
69 |
+
font-weight: {$input_font_weight};
|
70 |
+
}
|
71 |
+
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='text'],
|
72 |
+
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='email'],
|
73 |
+
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='password'],
|
74 |
+
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .woocommerce .form-row input[type='tel'],
|
75 |
+
.et_pb_module #wcf-embed-checkout-form.wcf-field-style-one .select2-container--default .select2-selection--single{
|
76 |
+
padding:{$field_tb_padding}px {$field_lr_padding}px !important;
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce .col2-set .col-1,
|
81 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce .col2-set .col-2,
|
82 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout .shop_table,
|
83 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading,
|
84 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #payment,
|
85 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce form.checkout_coupon
|
86 |
+
{
|
87 |
+
background-color: {$section_bg_color};
|
88 |
+
border-color: {$box_border_color};
|
89 |
+
font-family: {$input_font_family};
|
90 |
+
font-weight: {$input_font_weight};
|
91 |
+
}
|
92 |
+
|
93 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce table.shop_table th{
|
94 |
+
color: {$field_label_color};
|
95 |
+
}
|
96 |
+
/*.et_pb_module #wcf-embed-checkout-form .woocommerce .woocommerce-info,
|
97 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-message{
|
98 |
+
border-top-color: {$primary_color};
|
99 |
+
background-color: {$hl_bg_color};
|
100 |
+
}*/
|
101 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce a:not(.wcf-next-button){
|
102 |
+
color: {$primary_color} !important;
|
103 |
+
}
|
104 |
+
.et_pb_module #wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
105 |
+
color: {$field_color};
|
106 |
+
}
|
107 |
+
.et_pb_module #wcf-embed-checkout-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
108 |
+
color: {$field_color};
|
109 |
+
}
|
110 |
+
.et_pb_module #wcf-embed-checkout-form ::-moz-placeholder { /* Firefox 19+ */
|
111 |
+
color: {$field_color};
|
112 |
+
}
|
113 |
+
.et_pb_module #wcf-embed-checkout-form :-ms-input-placeholder { /* IE 10+ */
|
114 |
+
color: {$field_color};
|
115 |
+
}
|
116 |
+
.et_pb_module #wcf-embed-checkout-form :-moz-placeholder { /* Firefox 18- */
|
117 |
+
color: {$field_color};
|
118 |
+
}
|
119 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce form p.form-row label {
|
120 |
+
color: {$field_label_color};
|
121 |
+
font-family: {$input_font_family};
|
122 |
+
font-weight: {$input_font_weight};
|
123 |
+
}
|
124 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button,
|
125 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,
|
126 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small {
|
127 |
+
color: {$submit_color};
|
128 |
+
background: {$submit_bg_color};
|
129 |
+
padding-top: {$submit_tb_padding}px;
|
130 |
+
padding-bottom: {$submit_tb_padding}px;
|
131 |
+
padding-left: {$submit_lr_padding}px;
|
132 |
+
padding-right: {$submit_lr_padding}px;
|
133 |
+
border-color: {$submit_border_color};
|
134 |
+
min-height: {$submit_button_height};
|
135 |
+
font-family: {$button_font_family};
|
136 |
+
font-weight: {$button_font_weight};
|
137 |
+
}
|
138 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button,
|
139 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button{
|
140 |
+
background: {$submit_bg_color};
|
141 |
+
border: 1px {$submit_border_color} solid;
|
142 |
+
color: {$submit_color};
|
143 |
+
min-height: {$submit_button_height};
|
144 |
+
font-family: {$button_font_family};
|
145 |
+
font-weight: {$button_font_weight};
|
146 |
+
}
|
147 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.login .button:hover,
|
148 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
149 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #payment #place_order:hover,
|
150 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{
|
151 |
+
color: {$submit_hover_color};
|
152 |
+
background-color: {$submit_bg_hover_color};
|
153 |
+
border-color: {$submit_border_hover_color};
|
154 |
+
}
|
155 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce h3,
|
156 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce h3 span,
|
157 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
|
158 |
+
color: {$section_heading_color};
|
159 |
+
font-family: {$heading_font_family};
|
160 |
+
font-weight: {$heading_font_weight};
|
161 |
+
}
|
162 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-info::before,
|
163 |
+
.et_pb_module #wcf-embed-checkout-form .woocommerce-message::before{
|
164 |
+
color: {$primary_color};
|
165 |
+
}
|
166 |
+
.et_pb_module #wcf-embed-checkout-form {
|
167 |
+
font-family: {$base_font_family};
|
168 |
+
}
|
169 |
+
img.emoji, img.wp-smiley {}";
|
modules/flow/classes/class-cartflows-flow-meta.php
CHANGED
@@ -1,780 +1,700 @@
|
|
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( '
|
56 |
-
add_action( '
|
57 |
-
|
58 |
-
add_action( '
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
*
|
67 |
-
*
|
68 |
-
* @
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
*
|
94 |
-
*
|
95 |
-
* @
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
add_action( '
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
*
|
107 |
-
*
|
108 |
-
*
|
109 |
-
* @
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
$steps
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
*
|
137 |
-
*
|
138 |
-
*
|
139 |
-
* @
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
$steps
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
*
|
161 |
-
*
|
162 |
-
*
|
163 |
-
* @
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
$steps
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
*
|
186 |
-
* @
|
187 |
-
*
|
188 |
-
*
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
'
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
$
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
}
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
$
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
'
|
333 |
-
|
334 |
-
|
335 |
-
);
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
'
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
*
|
376 |
-
*
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
);
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
$
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
'
|
448 |
-
);
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
$
|
510 |
-
|
511 |
-
$
|
512 |
-
}
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
*
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
*
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
}
|
593 |
-
|
594 |
-
/**
|
595 |
-
*
|
596 |
-
*
|
597 |
-
* @param
|
598 |
-
* @return
|
599 |
-
*/
|
600 |
-
public function
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
*
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
$default_meta = self::get_meta_option( $post_id );
|
703 |
-
|
704 |
-
// Set stored and override defaults.
|
705 |
-
foreach ( $stored as $key => $value ) {
|
706 |
-
if ( array_key_exists( $key, $default_meta ) ) {
|
707 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
708 |
-
} else {
|
709 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
710 |
-
}
|
711 |
-
}
|
712 |
-
|
713 |
-
return self::get_meta_option( $post_id );
|
714 |
-
}
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Metabox Save
|
718 |
-
*
|
719 |
-
* @param number $post_id Post ID.
|
720 |
-
* @return void
|
721 |
-
*/
|
722 |
-
public function save_meta_box( $post_id ) {
|
723 |
-
|
724 |
-
// Checks save status.
|
725 |
-
$is_autosave = wp_is_post_autosave( $post_id );
|
726 |
-
$is_revision = wp_is_post_revision( $post_id );
|
727 |
-
|
728 |
-
$is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-flow-meta'] ) ), 'save-nonce-flow-meta' ) ) ? true : false;
|
729 |
-
|
730 |
-
// Exits script depending on save status.
|
731 |
-
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
732 |
-
return;
|
733 |
-
}
|
734 |
-
|
735 |
-
wcf()->options->save_flow_fields( $post_id );
|
736 |
-
}
|
737 |
-
|
738 |
-
/**
|
739 |
-
* Localize variables in admin
|
740 |
-
*
|
741 |
-
* @param array $vars variables.
|
742 |
-
*/
|
743 |
-
public function localize_vars( $vars ) {
|
744 |
-
|
745 |
-
$ajax_actions = array(
|
746 |
-
'wcf_setup_default_steps',
|
747 |
-
'wcf_add_flow_step',
|
748 |
-
'wcf_delete_flow_step',
|
749 |
-
'wcf_reorder_flow_steps',
|
750 |
-
);
|
751 |
-
|
752 |
-
foreach ( $ajax_actions as $action ) {
|
753 |
-
|
754 |
-
$vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
|
755 |
-
}
|
756 |
-
|
757 |
-
return $vars;
|
758 |
-
}
|
759 |
-
|
760 |
-
/**
|
761 |
-
* Add New Step Button
|
762 |
-
*
|
763 |
-
* @return string
|
764 |
-
*/
|
765 |
-
public function add_add_new_step_button() {
|
766 |
-
$add_new_btn_markup = '<style>.wrap{ position:relative;}</style>';
|
767 |
-
$add_new_btn_markup .= "<div class='wcf-button-wrap'>";
|
768 |
-
$add_new_btn_markup .= "<button class='wcf-trigger-popup page-title-action'>";
|
769 |
-
$add_new_btn_markup .= esc_html__( 'Add New Step', 'cartflows' );
|
770 |
-
$add_new_btn_markup .= '</button>';
|
771 |
-
$add_new_btn_markup .= '</div>';
|
772 |
-
|
773 |
-
return $add_new_btn_markup;
|
774 |
-
}
|
775 |
-
}
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Kicking this off by calling 'get_instance()' method
|
779 |
-
*/
|
780 |
-
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_delete_flow_step', array( $this, 'cartflows_delete_flow_step' ) );
|
56 |
+
add_action( 'wp_ajax_cartflows_reorder_flow_steps', array( $this, 'cartflows_reorder_flow_steps' ) );
|
57 |
+
|
58 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
59 |
+
|
60 |
+
add_filter( 'cartflows_admin_js_localize', array( $this, 'localize_vars' ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Display admin notices.
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
*
|
68 |
+
* @return void
|
69 |
+
*/
|
70 |
+
public function admin_notices() {
|
71 |
+
|
72 |
+
if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type() ) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
$flow_id = get_post_meta( get_the_id(), 'wcf-flow-id', true );
|
77 |
+
if ( $flow_id ) { ?>
|
78 |
+
<div class="wcf-notice-back-edit-flow">
|
79 |
+
<p>
|
80 |
+
<a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button button-primary button-hero" style="text-decoration: none;">
|
81 |
+
<i class="dashicons dashicons-arrow-left-alt"></i>
|
82 |
+
<?php esc_html_e( 'Back to edit Flow', 'cartflows' ); ?>
|
83 |
+
</a>
|
84 |
+
</p>
|
85 |
+
</div>
|
86 |
+
<?php
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Initialize admin actions.
|
92 |
+
*
|
93 |
+
* @since 1.0.0
|
94 |
+
*
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
public function admin_init_actions() {
|
98 |
+
add_action( 'before_delete_post', array( $this, 'step_post_sync' ) );
|
99 |
+
add_action( 'wp_trash_post', array( $this, 'step_post_trash_sync' ) );
|
100 |
+
add_action( 'untrashed_post', array( $this, 'step_post_untrash_sync' ) );
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Delete term data and steps data after deleting flow.
|
105 |
+
*
|
106 |
+
* @since 1.0.0
|
107 |
+
* @param int $pid post id.
|
108 |
+
*
|
109 |
+
* @return void
|
110 |
+
*/
|
111 |
+
public function step_post_sync( $pid ) {
|
112 |
+
|
113 |
+
global $post_type;
|
114 |
+
|
115 |
+
if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
|
116 |
+
|
117 |
+
$steps = get_post_meta( $pid, 'wcf-steps', true );
|
118 |
+
|
119 |
+
if ( $steps && is_array( $steps ) ) {
|
120 |
+
foreach ( $steps as $i => $step ) {
|
121 |
+
wp_delete_post( $step['id'], true );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
$term_data = term_exists( 'flow-' . $pid, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
126 |
+
|
127 |
+
if ( is_array( $term_data ) ) {
|
128 |
+
wp_delete_term( $term_data['term_id'], CARTFLOWS_TAXONOMY_STEP_FLOW );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Trash steps data after trashing flow.
|
135 |
+
*
|
136 |
+
* @since 1.0.0
|
137 |
+
* @param int $pid post id.
|
138 |
+
*
|
139 |
+
* @return void
|
140 |
+
*/
|
141 |
+
public function step_post_trash_sync( $pid ) {
|
142 |
+
|
143 |
+
global $post_type;
|
144 |
+
|
145 |
+
if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
|
146 |
+
|
147 |
+
$steps = get_post_meta( $pid, 'wcf-steps', true );
|
148 |
+
|
149 |
+
if ( $steps && is_array( $steps ) ) {
|
150 |
+
foreach ( $steps as $i => $step ) {
|
151 |
+
wp_trash_post( $step['id'] );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Untrash steps data after restoring flow.
|
159 |
+
*
|
160 |
+
* @since 1.0.0
|
161 |
+
* @param int $pid post id.
|
162 |
+
*
|
163 |
+
* @return void
|
164 |
+
*/
|
165 |
+
public function step_post_untrash_sync( $pid ) {
|
166 |
+
|
167 |
+
global $post_type;
|
168 |
+
|
169 |
+
if ( CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
|
170 |
+
|
171 |
+
$steps = get_post_meta( $pid, 'wcf-steps', true );
|
172 |
+
|
173 |
+
if ( $steps && is_array( $steps ) ) {
|
174 |
+
foreach ( $steps as $i => $step ) {
|
175 |
+
wp_untrash_post( $step['id'] );
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Create step for given flow.
|
183 |
+
*
|
184 |
+
* @param int $flow_id flow ID.
|
185 |
+
* @param int $step_type step type.
|
186 |
+
* @param int $step_title step title.
|
187 |
+
* @since 1.0.0
|
188 |
+
*
|
189 |
+
* @return int
|
190 |
+
*/
|
191 |
+
public function create_step( $flow_id, $step_type, $step_title ) {
|
192 |
+
|
193 |
+
$new_step_id = wp_insert_post(
|
194 |
+
array(
|
195 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
196 |
+
'post_title' => $step_title,
|
197 |
+
'post_status' => 'publish',
|
198 |
+
)
|
199 |
+
);
|
200 |
+
|
201 |
+
if ( $new_step_id ) {
|
202 |
+
|
203 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
204 |
+
|
205 |
+
if ( ! is_array( $flow_steps ) ) {
|
206 |
+
$flow_steps = array();
|
207 |
+
}
|
208 |
+
|
209 |
+
$flow_steps[] = array(
|
210 |
+
'id' => $new_step_id,
|
211 |
+
'title' => $step_title,
|
212 |
+
'type' => $step_type,
|
213 |
+
);
|
214 |
+
|
215 |
+
// insert post meta.
|
216 |
+
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
217 |
+
update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
|
218 |
+
|
219 |
+
wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
|
220 |
+
wp_set_object_terms( $new_step_id, 'flow-' . $flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
|
221 |
+
}
|
222 |
+
|
223 |
+
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
|
224 |
+
|
225 |
+
return $new_step_id;
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Delete step for flow
|
230 |
+
*
|
231 |
+
* @since 1.0.0
|
232 |
+
*
|
233 |
+
* @return void
|
234 |
+
*/
|
235 |
+
public function cartflows_delete_flow_step() {
|
236 |
+
|
237 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
238 |
+
return;
|
239 |
+
}
|
240 |
+
|
241 |
+
check_ajax_referer( 'wcf-delete-flow-step', 'security' );
|
242 |
+
|
243 |
+
if ( isset( $_POST['post_id'] ) && isset( $_POST['step_id'] ) ) {
|
244 |
+
$flow_id = intval( $_POST['post_id'] );
|
245 |
+
$step_id = intval( $_POST['step_id'] );
|
246 |
+
}
|
247 |
+
$result = array(
|
248 |
+
'status' => false,
|
249 |
+
/* translators: %s flow id */
|
250 |
+
'text' => sprintf( __( 'Step not deleted for flow - %s', 'cartflows' ), $flow_id ),
|
251 |
+
);
|
252 |
+
|
253 |
+
if ( ! $flow_id || ! $step_id ) {
|
254 |
+
wp_send_json( $result );
|
255 |
+
}
|
256 |
+
|
257 |
+
wp_delete_post( $step_id, true );
|
258 |
+
|
259 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
260 |
+
|
261 |
+
if ( ! is_array( $flow_steps ) ) {
|
262 |
+
wp_send_json( $result );
|
263 |
+
}
|
264 |
+
|
265 |
+
foreach ( $flow_steps as $index => $data ) {
|
266 |
+
|
267 |
+
if ( intval( $data['id'] ) === $step_id ) {
|
268 |
+
unset( $flow_steps[ $index ] );
|
269 |
+
break;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
/* Set index order properly */
|
274 |
+
$flow_steps = array_merge( $flow_steps );
|
275 |
+
|
276 |
+
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
|
277 |
+
|
278 |
+
$result = array(
|
279 |
+
'status' => true,
|
280 |
+
/* translators: %s flow id */
|
281 |
+
'text' => sprintf( __( 'Step deleted for flow - %s', 'cartflows' ), $flow_id ),
|
282 |
+
);
|
283 |
+
|
284 |
+
wp_send_json( $result );
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Reorder step flow
|
289 |
+
*
|
290 |
+
* @since 1.0.0
|
291 |
+
*
|
292 |
+
* @return void
|
293 |
+
*/
|
294 |
+
public function cartflows_reorder_flow_steps() {
|
295 |
+
|
296 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
297 |
+
return;
|
298 |
+
}
|
299 |
+
|
300 |
+
check_ajax_referer( 'wcf-reorder-flow-steps', 'security' );
|
301 |
+
|
302 |
+
if ( isset( $_POST['post_id'] ) && isset( $_POST['step_ids'] ) ) {
|
303 |
+
$flow_id = intval( $_POST['post_id'] );
|
304 |
+
$step_ids = array_map( 'intval', $_POST['step_ids'] );
|
305 |
+
}
|
306 |
+
$result = array(
|
307 |
+
'status' => false,
|
308 |
+
/* translators: %s flow id */
|
309 |
+
'text' => sprintf( __( 'Steps not sorted for flow - %s', 'cartflows' ), $flow_id ),
|
310 |
+
);
|
311 |
+
|
312 |
+
if ( ! $flow_id || ! is_array( $step_ids ) ) {
|
313 |
+
wp_send_json( $result );
|
314 |
+
}
|
315 |
+
|
316 |
+
$new_flow_steps = array();
|
317 |
+
|
318 |
+
foreach ( $step_ids as $index => $step_id ) {
|
319 |
+
|
320 |
+
$new_flow_steps[] = array(
|
321 |
+
'id' => intval( $step_id ),
|
322 |
+
'title' => get_the_title( $step_id ),
|
323 |
+
'type' => get_post_meta( $step_id, 'wcf-step-type', true ),
|
324 |
+
);
|
325 |
+
}
|
326 |
+
|
327 |
+
update_post_meta( $flow_id, 'wcf-steps', $new_flow_steps );
|
328 |
+
|
329 |
+
$result = array(
|
330 |
+
'status' => true,
|
331 |
+
/* translators: %s flow id */
|
332 |
+
'text' => sprintf( __( 'Steps sorted for flow - %s', 'cartflows' ), $flow_id ),
|
333 |
+
);
|
334 |
+
|
335 |
+
wp_send_json( $result );
|
336 |
+
}
|
337 |
+
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Load admin scripts
|
341 |
+
*
|
342 |
+
* @since 1.0.0
|
343 |
+
*
|
344 |
+
* @return void
|
345 |
+
*/
|
346 |
+
public function admin_scripts() {
|
347 |
+
|
348 |
+
global $pagenow;
|
349 |
+
global $post;
|
350 |
+
|
351 |
+
$screen = get_current_screen();
|
352 |
+
|
353 |
+
if ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && CARTFLOWS_FLOW_POST_TYPE == $screen->post_type ) {
|
354 |
+
|
355 |
+
wp_enqueue_script(
|
356 |
+
'wcf-flow-meta',
|
357 |
+
CARTFLOWS_URL . 'admin/assets/js/flow-admin-edit.js',
|
358 |
+
array( 'jquery', 'jquery-ui-sortable' ),
|
359 |
+
CARTFLOWS_VER,
|
360 |
+
true
|
361 |
+
);
|
362 |
+
|
363 |
+
wp_enqueue_style( 'wcf-flow-meta', CARTFLOWS_URL . 'admin/assets/css/flow-admin-edit.css', '', CARTFLOWS_VER );
|
364 |
+
wp_style_add_data( 'wcf-flow-meta', 'rtl', 'replace' );
|
365 |
+
|
366 |
+
$localize = array(
|
367 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
368 |
+
);
|
369 |
+
|
370 |
+
wp_localize_script( 'jquery', 'cartflows', apply_filters( 'wcf_js_localize', $localize ) );
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Initialize meta box
|
376 |
+
*
|
377 |
+
* @since 1.0.0
|
378 |
+
*
|
379 |
+
* @return void
|
380 |
+
*/
|
381 |
+
public function init_metabox() {
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Fires after the title field.
|
385 |
+
*
|
386 |
+
* @param WP_Post $post Post object.
|
387 |
+
*/
|
388 |
+
add_action( 'add_meta_boxes', array( $this, 'settings_meta_box' ) );
|
389 |
+
add_action( 'edit_form_after_title', array( $this, 'setup_meta_box' ) );
|
390 |
+
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Is first time import?
|
395 |
+
*
|
396 |
+
* @param integer $post_id post ID.
|
397 |
+
* @return bool
|
398 |
+
*/
|
399 |
+
public function is_flow_imported( $post_id = 0 ) {
|
400 |
+
|
401 |
+
if ( 0 === $post_id ) {
|
402 |
+
$post_id = get_the_ID();
|
403 |
+
}
|
404 |
+
|
405 |
+
$steps = get_post_meta( $post_id, 'wcf-steps', true );
|
406 |
+
$choice = get_post_meta( $post_id, 'wcf-flow-choise', true );
|
407 |
+
|
408 |
+
if ( empty( $steps ) && 'import' === $choice ) {
|
409 |
+
return true;
|
410 |
+
}
|
411 |
+
|
412 |
+
return false;
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Setup meta box.
|
417 |
+
*
|
418 |
+
* @return void
|
419 |
+
*/
|
420 |
+
public function setup_meta_box() {
|
421 |
+
if ( ! Cartflows_Admin::is_flow_edit_admin() ) {
|
422 |
+
return;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* Adding Add new step button to the top*/
|
427 |
+
echo $this->add_add_new_step_button();
|
428 |
+
|
429 |
+
$this->markup_meta_box();
|
430 |
+
|
431 |
+
$this->add_upgrade_to_pro_metabox();
|
432 |
+
}
|
433 |
+
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Add metabox when cartflows pro is not enabled.
|
437 |
+
*/
|
438 |
+
public function add_upgrade_to_pro_metabox() {
|
439 |
+
|
440 |
+
if ( ! _is_cartflows_pro() ) {
|
441 |
+
add_meta_box(
|
442 |
+
'wcf-upgrade-pro',
|
443 |
+
__( 'Analytics', 'cartflows' ),
|
444 |
+
array( $this, 'upgrade_to_pro' ),
|
445 |
+
CARTFLOWS_FLOW_POST_TYPE,
|
446 |
+
'side',
|
447 |
+
'high'
|
448 |
+
);
|
449 |
+
}
|
450 |
+
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Show Upgrade To Pro markup.
|
455 |
+
*/
|
456 |
+
public function upgrade_to_pro() {
|
457 |
+
|
458 |
+
echo '<div>';
|
459 |
+
/* translators: %s: link */
|
460 |
+
echo '<p><i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Analytics feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i></p>';
|
461 |
+
echo '<p><a target="_blank" href="https://cartflows.com/" class="button button-primary">' . esc_html__( 'Get Pro', 'cartflows' ) . '</a></p>';
|
462 |
+
echo '</div>';
|
463 |
+
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Settings meta box.
|
468 |
+
*
|
469 |
+
* @return void
|
470 |
+
*/
|
471 |
+
public function settings_meta_box() {
|
472 |
+
|
473 |
+
if ( CARTFLOWS_FLOW_POST_TYPE === get_post_type() ) {
|
474 |
+
|
475 |
+
/* No need of sandbox will delete it later */
|
476 |
+
add_meta_box(
|
477 |
+
'wcf-sandbox-settings', // Id.
|
478 |
+
__( 'Flow Settings', 'cartflows' ), // Title.
|
479 |
+
array( $this, 'sandbox_meta_box' ), // Callback.
|
480 |
+
CARTFLOWS_FLOW_POST_TYPE, // Post_type.
|
481 |
+
'side', // Context.
|
482 |
+
'high' // Priority.
|
483 |
+
);
|
484 |
+
|
485 |
+
do_action( 'cartflows_add_flow_metabox' );
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Metabox Markup
|
491 |
+
*
|
492 |
+
* @return void
|
493 |
+
*/
|
494 |
+
public function markup_meta_box() {
|
495 |
+
global $post;
|
496 |
+
|
497 |
+
wp_nonce_field( 'save-nonce-flow-meta', 'nonce-flow-meta' );
|
498 |
+
|
499 |
+
// Get defaults.
|
500 |
+
$meta = self::get_current_post_meta( $post->ID );
|
501 |
+
|
502 |
+
/**
|
503 |
+
* Get options
|
504 |
+
*/
|
505 |
+
$updated_data = array(
|
506 |
+
'steps' => $meta['wcf-steps']['default'],
|
507 |
+
);
|
508 |
+
|
509 |
+
do_action( 'wcf_flow_settings_markup_before', $meta );
|
510 |
+
$this->page_header_tab( $updated_data );
|
511 |
+
do_action( 'wcf_flow_settings_markup_after', $meta );
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Metabox Markup
|
516 |
+
*
|
517 |
+
* @param object $post Post object.
|
518 |
+
* @return void
|
519 |
+
*/
|
520 |
+
public function sandbox_meta_box( $post ) {
|
521 |
+
|
522 |
+
// Get defaults.
|
523 |
+
$meta = self::get_current_post_meta( $post->ID );
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Get options
|
527 |
+
*/
|
528 |
+
foreach ( $meta as $key => $value ) {
|
529 |
+
$updated_data[ $key ] = $meta[ $key ]['default'];
|
530 |
+
}
|
531 |
+
|
532 |
+
do_action( 'wcf_flow_sandbox_markup_before', $meta );
|
533 |
+
$this->sandbox_markup( $updated_data );
|
534 |
+
do_action( 'wcf_flow_sandbox_markup_after', $meta );
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* Page Header Tabs
|
539 |
+
*
|
540 |
+
* @param array $options Post meta.
|
541 |
+
* @return void
|
542 |
+
*/
|
543 |
+
public function page_header_tab( $options ) {
|
544 |
+
|
545 |
+
include_once CARTFLOWS_FLOW_DIR . 'view/meta-flow-steps.php';
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Sandbox Markup
|
550 |
+
*
|
551 |
+
* @param array $options Post meta.
|
552 |
+
* @return void
|
553 |
+
*/
|
554 |
+
public function sandbox_markup( $options ) {
|
555 |
+
?>
|
556 |
+
<div class="wcf-flow-sandbox-table wcf-general-metabox-wrap widefat">
|
557 |
+
<div class="wcf-flow-sandbox-table-container">
|
558 |
+
<?php
|
559 |
+
echo wcf()->meta->get_checkbox_field(
|
560 |
+
array(
|
561 |
+
'name' => 'wcf-testing',
|
562 |
+
'value' => $options['wcf-testing'],
|
563 |
+
'after' => esc_html__( 'Enable Test Mode', 'cartflows' ),
|
564 |
+
)
|
565 |
+
);
|
566 |
+
|
567 |
+
echo wcf()->meta->get_description_field(
|
568 |
+
array(
|
569 |
+
'name' => 'wcf-testing-note',
|
570 |
+
'content' => esc_html__( 'If you are using WooCommerce plugin then test mode will add random products in your flow, so you can preview it easily while testing.', 'cartflows' ),
|
571 |
+
)
|
572 |
+
);
|
573 |
+
|
574 |
+
?>
|
575 |
+
</div>
|
576 |
+
</div>
|
577 |
+
<?php
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Keep the menu open when editing the flows.
|
582 |
+
* Highlights the wanted admin (sub-) menu items for the CPT.
|
583 |
+
*
|
584 |
+
* @since 1.0.0
|
585 |
+
*/
|
586 |
+
public function menu_highlight() {
|
587 |
+
global $parent_file, $submenu_file, $post_type;
|
588 |
+
if ( CARTFLOWS_FLOW_POST_TYPE == $post_type ) :
|
589 |
+
$parent_file = CARTFLOWS_SLUG;//phpcs:ignore
|
590 |
+
$submenu_file = 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE;//phpcs:ignore
|
591 |
+
endif;
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Get metabox options
|
596 |
+
*
|
597 |
+
* @param int $post_id post id.
|
598 |
+
* @return array
|
599 |
+
*/
|
600 |
+
public static function get_meta_option( $post_id ) {
|
601 |
+
|
602 |
+
if ( null === self::$meta_option ) {
|
603 |
+
/**
|
604 |
+
* Set metabox options
|
605 |
+
*/
|
606 |
+
self::$meta_option = wcf()->options->get_flow_fields( $post_id );
|
607 |
+
}
|
608 |
+
|
609 |
+
return self::$meta_option;
|
610 |
+
}
|
611 |
+
|
612 |
+
/**
|
613 |
+
* Get metabox options
|
614 |
+
*
|
615 |
+
* @param int $post_id post ID.
|
616 |
+
* @return array
|
617 |
+
*/
|
618 |
+
public static function get_current_post_meta( $post_id ) {
|
619 |
+
|
620 |
+
$stored = get_post_meta( $post_id );
|
621 |
+
|
622 |
+
$default_meta = self::get_meta_option( $post_id );
|
623 |
+
|
624 |
+
// Set stored and override defaults.
|
625 |
+
foreach ( $stored as $key => $value ) {
|
626 |
+
if ( array_key_exists( $key, $default_meta ) ) {
|
627 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
628 |
+
} else {
|
629 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
630 |
+
}
|
631 |
+
}
|
632 |
+
|
633 |
+
return self::get_meta_option( $post_id );
|
634 |
+
}
|
635 |
+
|
636 |
+
/**
|
637 |
+
* Metabox Save
|
638 |
+
*
|
639 |
+
* @param number $post_id Post ID.
|
640 |
+
* @return void
|
641 |
+
*/
|
642 |
+
public function save_meta_box( $post_id ) {
|
643 |
+
|
644 |
+
// Checks save status.
|
645 |
+
$is_autosave = wp_is_post_autosave( $post_id );
|
646 |
+
$is_revision = wp_is_post_revision( $post_id );
|
647 |
+
|
648 |
+
$is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-flow-meta'] ) ), 'save-nonce-flow-meta' ) ) ? true : false;
|
649 |
+
|
650 |
+
// Exits script depending on save status.
|
651 |
+
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
652 |
+
return;
|
653 |
+
}
|
654 |
+
|
655 |
+
wcf()->options->save_flow_fields( $post_id );
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Localize variables in admin
|
660 |
+
*
|
661 |
+
* @param array $vars variables.
|
662 |
+
*/
|
663 |
+
public function localize_vars( $vars ) {
|
664 |
+
|
665 |
+
$ajax_actions = array(
|
666 |
+
'wcf_setup_default_steps',
|
667 |
+
'wcf_add_flow_step',
|
668 |
+
'wcf_delete_flow_step',
|
669 |
+
'wcf_reorder_flow_steps',
|
670 |
+
);
|
671 |
+
|
672 |
+
foreach ( $ajax_actions as $action ) {
|
673 |
+
|
674 |
+
$vars[ $action . '_nonce' ] = wp_create_nonce( str_replace( '_', '-', $action ) );
|
675 |
+
}
|
676 |
+
|
677 |
+
return $vars;
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Add New Step Button
|
682 |
+
*
|
683 |
+
* @return string
|
684 |
+
*/
|
685 |
+
public function add_add_new_step_button() {
|
686 |
+
$add_new_btn_markup = '<style>.wrap{ position:relative;}</style>';
|
687 |
+
$add_new_btn_markup .= "<div class='wcf-button-wrap'>";
|
688 |
+
$add_new_btn_markup .= "<button class='wcf-trigger-popup page-title-action'>";
|
689 |
+
$add_new_btn_markup .= esc_html__( 'Add New Step', 'cartflows' );
|
690 |
+
$add_new_btn_markup .= '</button>';
|
691 |
+
$add_new_btn_markup .= '</div>';
|
692 |
+
|
693 |
+
return $add_new_btn_markup;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Kicking this off by calling 'get_instance()' method
|
699 |
+
*/
|
700 |
+
Cartflows_Flow_Meta::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/optin/classes/class-cartflows-optin-markup.php
CHANGED
@@ -1,712 +1,712 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Checkout markup.
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Checkout Markup
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Optin_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 |
-
/* Set is checkout flag */
|
38 |
-
add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
|
39 |
-
|
40 |
-
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_optin_fields' ), 10, 2 );
|
41 |
-
|
42 |
-
/* Optin Shortcode */
|
43 |
-
add_shortcode( 'cartflows_optin', array( $this, 'optin_shortcode_markup' ) );
|
44 |
-
|
45 |
-
/* Preconfigured cart data */
|
46 |
-
add_action( 'wp', array( $this, 'preconfigured_cart_data' ), 1 );
|
47 |
-
|
48 |
-
/* Optin shortcode data */
|
49 |
-
add_action( 'wp', array( $this, 'shortcode_load_data' ), 1000 );
|
50 |
-
|
51 |
-
/* Ajax Endpoint */
|
52 |
-
add_filter( 'woocommerce_ajax_get_endpoint', array( $this, 'get_ajax_endpoint' ), 10, 2 );
|
53 |
-
add_filter( 'woocommerce_login_redirect', array( $this, 'after_login_redirect' ), 10, 2 );
|
54 |
-
|
55 |
-
/* Optin Fields */
|
56 |
-
add_filter( 'woocommerce_default_address_fields', array( $this, 'set_optin_default_fields' ), 1000 );
|
57 |
-
/**
|
58 |
-
* It may required later
|
59 |
-
* add_filter( 'woocommerce_checkout_fields', array( $this, 'set_optin_fields' ) );
|
60 |
-
*/
|
61 |
-
add_filter( 'woocommerce_billing_fields', array( $this, 'billing_optin_fields' ), 1000, 2 );
|
62 |
-
|
63 |
-
add_filter( 'woocommerce_checkout_required_field_notice', array( $this, 'change_field_label_in_required_notice' ), 100, 2 );
|
64 |
-
|
65 |
-
$this->elementor_editor_compatibility();
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Elementor editor compatibility.
|
70 |
-
*/
|
71 |
-
public function elementor_editor_compatibility() {
|
72 |
-
|
73 |
-
if ( ! empty( $_REQUEST['action'] ) && 'elementor' === $_REQUEST['action'] && is_admin() ) { //phpcs:ignore
|
74 |
-
|
75 |
-
if ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) { //phpcs:ignore
|
76 |
-
|
77 |
-
if ( _wcf_check_is_optin_by_id( intval( $_GET['post'] ) ) ) { //phpcs:ignore
|
78 |
-
|
79 |
-
/* Submit Button */
|
80 |
-
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Change order button text .
|
88 |
-
*
|
89 |
-
* @param string $woo_button_text place order.
|
90 |
-
* @return string
|
91 |
-
*/
|
92 |
-
public function place_order_button_text( $woo_button_text ) {
|
93 |
-
|
94 |
-
$optin_id = get_the_ID();
|
95 |
-
|
96 |
-
$wcf_order_button_text = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-text' );
|
97 |
-
|
98 |
-
if ( ! empty( $wcf_order_button_text ) ) {
|
99 |
-
$woo_button_text = $wcf_order_button_text;
|
100 |
-
}
|
101 |
-
|
102 |
-
return $woo_button_text;
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Display all WooCommerce notices.
|
107 |
-
*
|
108 |
-
* @since 1.1.5
|
109 |
-
*/
|
110 |
-
public function display_woo_notices() {
|
111 |
-
|
112 |
-
if ( null != WC()->session && function_exists( 'woocommerce_output_all_notices' ) ) {
|
113 |
-
woocommerce_output_all_notices();
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Check for checkout flag
|
119 |
-
*
|
120 |
-
* @param bool $is_checkout is checkout.
|
121 |
-
*
|
122 |
-
* @return bool
|
123 |
-
*/
|
124 |
-
public function woo_checkout_flag( $is_checkout ) {
|
125 |
-
|
126 |
-
if ( ! is_admin() ) {
|
127 |
-
|
128 |
-
if ( _is_wcf_optin_type() ) {
|
129 |
-
|
130 |
-
$is_checkout = true;
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
return $is_checkout;
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Render checkout shortcode markup.
|
139 |
-
*
|
140 |
-
* @param array $atts attributes.
|
141 |
-
* @return string
|
142 |
-
*/
|
143 |
-
public function optin_shortcode_markup( $atts ) {
|
144 |
-
|
145 |
-
if ( ! function_exists( 'wc_print_notices' ) ) {
|
146 |
-
$notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
|
147 |
-
$notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
|
148 |
-
|
149 |
-
return $notice_out;
|
150 |
-
}
|
151 |
-
|
152 |
-
$atts = shortcode_atts(
|
153 |
-
array(
|
154 |
-
'id' => 0,
|
155 |
-
),
|
156 |
-
$atts
|
157 |
-
);
|
158 |
-
|
159 |
-
$optin_id = intval( $atts['id'] );
|
160 |
-
|
161 |
-
if ( empty( $optin_id ) ) {
|
162 |
-
|
163 |
-
if ( ! _is_wcf_optin_type() ) {
|
164 |
-
|
165 |
-
return '<h4>' . __( 'Please place shortcode on Optin step-type only.', 'cartflows' ) . '</h4>';
|
166 |
-
}
|
167 |
-
|
168 |
-
global $post;
|
169 |
-
|
170 |
-
$optin_id = intval( $post->ID );
|
171 |
-
}
|
172 |
-
|
173 |
-
$output = '';
|
174 |
-
|
175 |
-
ob_start();
|
176 |
-
|
177 |
-
do_action( 'cartflows_optin_form_before', $optin_id );
|
178 |
-
|
179 |
-
$optin_layout = 'default';
|
180 |
-
|
181 |
-
$template_default = CARTFLOWS_OPTIN_DIR . 'templates/optin-template-simple.php';
|
182 |
-
|
183 |
-
include $template_default;
|
184 |
-
|
185 |
-
$output .= ob_get_clean();
|
186 |
-
|
187 |
-
return $output;
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Configure Cart Data.
|
192 |
-
*
|
193 |
-
* @since 1.0.0
|
194 |
-
*
|
195 |
-
* @return void
|
196 |
-
*/
|
197 |
-
public function preconfigured_cart_data() {
|
198 |
-
|
199 |
-
if ( is_admin() ) {
|
200 |
-
return;
|
201 |
-
}
|
202 |
-
|
203 |
-
global $post;
|
204 |
-
|
205 |
-
if ( _is_wcf_optin_type() ) {
|
206 |
-
|
207 |
-
if ( wp_doing_ajax() ) {
|
208 |
-
return;
|
209 |
-
} else {
|
210 |
-
|
211 |
-
$optin_id = $post->ID;
|
212 |
-
|
213 |
-
do_action( 'cartflows_optin_before_configure_cart', $optin_id );
|
214 |
-
|
215 |
-
$products = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-product' );
|
216 |
-
|
217 |
-
if ( ! is_array( $products ) ) {
|
218 |
-
return;
|
219 |
-
}
|
220 |
-
|
221 |
-
/* Empty the current cart */
|
222 |
-
WC()->cart->empty_cart();
|
223 |
-
|
224 |
-
if ( is_array( $products ) && count( $products ) < 1 ) {
|
225 |
-
wc_add_notice( __( 'No product is selected. Please select a Simple, Virtual and Free product from the meta settings.', 'cartflows' ), 'error' );
|
226 |
-
return;
|
227 |
-
}
|
228 |
-
|
229 |
-
/* Set customer session if not set */
|
230 |
-
if ( ! is_user_logged_in() && WC()->cart->is_empty() ) {
|
231 |
-
WC()->session->set_customer_session_cookie( true );
|
232 |
-
}
|
233 |
-
|
234 |
-
$product_id = reset( $products );
|
235 |
-
$_product = wc_get_product( $product_id );
|
236 |
-
|
237 |
-
if ( ! empty( $_product ) ) {
|
238 |
-
|
239 |
-
if ( $_product->is_type( 'simple' ) && $_product->is_virtual() ) {
|
240 |
-
|
241 |
-
if ( $_product->get_price() > 0 ) {
|
242 |
-
wc_add_notice( __( 'Please update the selected product\'s price to zero (0).', 'cartflows' ), 'error' );
|
243 |
-
} else {
|
244 |
-
|
245 |
-
$quantity = 1;
|
246 |
-
|
247 |
-
WC()->cart->add_to_cart( $product_id, $quantity );
|
248 |
-
}
|
249 |
-
} else {
|
250 |
-
|
251 |
-
wc_add_notice( __( 'Please select a Simple, Virtual and Free product.', 'cartflows' ), 'error' );
|
252 |
-
}
|
253 |
-
} else {
|
254 |
-
|
255 |
-
wc_add_notice( __( 'Please select a Simple, Virtual and Free product.', 'cartflows' ), 'error' );
|
256 |
-
}
|
257 |
-
|
258 |
-
do_action( 'cartflows_optin_after_configure_cart', $optin_id );
|
259 |
-
}
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Load shortcode data.
|
265 |
-
*
|
266 |
-
* @return void
|
267 |
-
*/
|
268 |
-
public function shortcode_load_data() {
|
269 |
-
|
270 |
-
if ( _is_wcf_optin_type() ) {
|
271 |
-
|
272 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_scripts' ), 21 );
|
273 |
-
|
274 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'compatibility_scripts' ), 101 );
|
275 |
-
|
276 |
-
/* Show notices if cart has errors */
|
277 |
-
add_action( 'woocommerce_cart_has_errors', 'woocommerce_output_all_notices' );
|
278 |
-
|
279 |
-
// Outputting the hidden field in checkout page.
|
280 |
-
add_action( 'woocommerce_after_order_notes', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
281 |
-
add_action( 'woocommerce_login_form_end', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
282 |
-
|
283 |
-
/* Remove unnecessary option */
|
284 |
-
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
|
285 |
-
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false' );
|
286 |
-
|
287 |
-
remove_all_actions( 'woocommerce_before_checkout_form' );
|
288 |
-
remove_all_actions( 'woocommerce_checkout_billing' );
|
289 |
-
remove_all_actions( 'woocommerce_checkout_shipping' );
|
290 |
-
remove_all_actions( 'woocommerce_checkout_before_order_review' );
|
291 |
-
remove_all_actions( 'woocommerce_checkout_order_review' );
|
292 |
-
remove_all_actions( 'woocommerce_checkout_after_order_review' );
|
293 |
-
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
|
294 |
-
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'disable_payment_gateways' ) );
|
295 |
-
|
296 |
-
/* Paypal Expresss remove */
|
297 |
-
|
298 |
-
if ( function_exists( 'wc_gateway_ppec' ) ) {
|
299 |
-
remove_action( 'wp_enqueue_scripts', array( wc_gateway_ppec()->cart, 'enqueue_scripts' ) );
|
300 |
-
}
|
301 |
-
|
302 |
-
// Hook in actions once.
|
303 |
-
add_action( 'woocommerce_before_checkout_form', 'woocommerce_output_all_notices', 10 );
|
304 |
-
add_action( 'woocommerce_checkout_billing', array( WC()->checkout, 'checkout_form_billing' ) );
|
305 |
-
add_action( 'woocommerce_checkout_shipping', array( WC()->checkout, 'checkout_form_shipping' ) );
|
306 |
-
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
|
307 |
-
|
308 |
-
/* Submit Button */
|
309 |
-
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
310 |
-
|
311 |
-
add_filter( 'woocommerce_get_terms_and_conditions_checkbox_text', '__return_false' );
|
312 |
-
|
313 |
-
global $post;
|
314 |
-
|
315 |
-
$optin_id = $post->ID;
|
316 |
-
|
317 |
-
do_action( 'cartflows_optin_before_shortcode', $optin_id );
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Disable payment gateways.
|
323 |
-
*
|
324 |
-
* @param array $available_gateways gateways.
|
325 |
-
* @return array
|
326 |
-
*/
|
327 |
-
public function disable_payment_gateways( $available_gateways ) {
|
328 |
-
|
329 |
-
if ( ! is_admin() ) {
|
330 |
-
|
331 |
-
$available_gateways = array();
|
332 |
-
}
|
333 |
-
|
334 |
-
return $available_gateways;
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Render checkout ID hidden field.
|
339 |
-
*
|
340 |
-
* @param array $checkout checkout session data.
|
341 |
-
* @return void
|
342 |
-
*/
|
343 |
-
public function checkout_shortcode_post_id( $checkout ) {
|
344 |
-
|
345 |
-
if ( ! _is_wcf_optin_type() ) {
|
346 |
-
return;
|
347 |
-
}
|
348 |
-
|
349 |
-
global $post;
|
350 |
-
|
351 |
-
$optin_id = $post->ID;
|
352 |
-
|
353 |
-
$flow_id = get_post_meta( $optin_id, 'wcf-flow-id', true );
|
354 |
-
|
355 |
-
echo '<input type="hidden" class="input-hidden _wcf_flow_id" name="_wcf_flow_id" value="' . intval( $flow_id ) . '">';
|
356 |
-
echo '<input type="hidden" class="input-hidden _wcf_optin_id" name="_wcf_optin_id" value="' . intval( $optin_id ) . '">';
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Load shortcode scripts.
|
361 |
-
*
|
362 |
-
* @return void
|
363 |
-
*/
|
364 |
-
public function shortcode_scripts() {
|
365 |
-
|
366 |
-
wp_enqueue_style( 'wcf-optin-template', wcf()->utils->get_css_url( 'optin-template' ), '', CARTFLOWS_VER );
|
367 |
-
|
368 |
-
wp_enqueue_script(
|
369 |
-
'wcf-optin-template',
|
370 |
-
wcf()->utils->get_js_url( 'optin-template' ),
|
371 |
-
array( 'jquery' ),
|
372 |
-
CARTFLOWS_VER,
|
373 |
-
true
|
374 |
-
);
|
375 |
-
|
376 |
-
do_action( 'cartflows_optin_scripts' );
|
377 |
-
|
378 |
-
$style = $this->generate_style();
|
379 |
-
|
380 |
-
wp_add_inline_style( 'wcf-optin-template', $style );
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Load compatibility scripts.
|
385 |
-
*
|
386 |
-
* @return void
|
387 |
-
*/
|
388 |
-
public function compatibility_scripts() {
|
389 |
-
|
390 |
-
global $post;
|
391 |
-
|
392 |
-
$optin_id = $post->ID;
|
393 |
-
|
394 |
-
// Add DIVI Compatibility css if DIVI theme is enabled.
|
395 |
-
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
396 |
-
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $optin_id )
|
397 |
-
) {
|
398 |
-
wp_enqueue_style( 'wcf-optin-template-divi', wcf()->utils->get_css_url( 'optin-template-divi' ), '', CARTFLOWS_VER );
|
399 |
-
}
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Generate styles.
|
404 |
-
*
|
405 |
-
* @return string
|
406 |
-
*/
|
407 |
-
public function generate_style() {
|
408 |
-
|
409 |
-
global $post;
|
410 |
-
|
411 |
-
$optin_id = $post->ID;
|
412 |
-
|
413 |
-
/* Load all fonts */
|
414 |
-
CartFlows_Font_Families::render_fonts( $optin_id );
|
415 |
-
|
416 |
-
$r = '';
|
417 |
-
$g = '';
|
418 |
-
$b = '';
|
419 |
-
$output = '';
|
420 |
-
|
421 |
-
/* Global */
|
422 |
-
$primary_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-primary-color' );
|
423 |
-
$base_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-base-font-family' );
|
424 |
-
|
425 |
-
/* Input Fields */
|
426 |
-
$input_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-font-family' );
|
427 |
-
$input_font_weight = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-font-weight' );
|
428 |
-
$field_input_size = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-field-size' );
|
429 |
-
$field_tb_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-tb-padding' );
|
430 |
-
$field_lr_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-lr-padding' );
|
431 |
-
$field_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-color' );
|
432 |
-
$field_bg_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-bg-color' );
|
433 |
-
$field_border_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-border-color' );
|
434 |
-
$field_label_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-label-color' );
|
435 |
-
|
436 |
-
if ( 'custom' == $field_input_size ) {
|
437 |
-
$field_input_size = '38px';
|
438 |
-
}
|
439 |
-
|
440 |
-
/* Submit Button */
|
441 |
-
$submit_button_width = '100%';
|
442 |
-
$optin_button_position = '';
|
443 |
-
$button_font_size = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-font-size' );
|
444 |
-
$button_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-button-font-family' );
|
445 |
-
$button_font_weight = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-button-font-weight' );
|
446 |
-
$submit_button_height = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-size' );
|
447 |
-
$submit_tb_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-tb-padding' );
|
448 |
-
$submit_lr_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-lr-padding' );
|
449 |
-
$submit_button_position = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-position' );
|
450 |
-
$submit_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-color' );
|
451 |
-
$submit_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-hover-color' );
|
452 |
-
$submit_bg_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-bg-color', $primary_color );
|
453 |
-
$submit_bg_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-bg-hover-color', $primary_color );
|
454 |
-
$submit_border_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-border-color', $primary_color );
|
455 |
-
$submit_border_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-border-hover-color', $primary_color );
|
456 |
-
|
457 |
-
if ( 'custom' == $submit_button_height ) {
|
458 |
-
$submit_button_height = '38px';
|
459 |
-
$submit_button_width = 'auto';
|
460 |
-
|
461 |
-
switch ( $submit_button_position ) {
|
462 |
-
case 'left':
|
463 |
-
$optin_button_position = '0 auto 0 0';
|
464 |
-
break;
|
465 |
-
case 'center':
|
466 |
-
$optin_button_position = '0 auto';
|
467 |
-
break;
|
468 |
-
case 'right':
|
469 |
-
$optin_button_position = '0 0 0 auto';
|
470 |
-
break;
|
471 |
-
|
472 |
-
default:
|
473 |
-
$optin_button_position = '0 auto';
|
474 |
-
break;
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
479 |
-
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $optin_id ) ) {
|
480 |
-
|
481 |
-
include CARTFLOWS_OPTIN_DIR . 'includes/optin-dynamic-divi-css.php';
|
482 |
-
|
483 |
-
} else {
|
484 |
-
include CARTFLOWS_OPTIN_DIR . 'includes/optin-dynamic-css.php';
|
485 |
-
}
|
486 |
-
|
487 |
-
return $output;
|
488 |
-
}
|
489 |
-
|
490 |
-
/**
|
491 |
-
* Get ajax end points.
|
492 |
-
*
|
493 |
-
* @param string $endpoint_url end point URL.
|
494 |
-
* @param string $request end point request.
|
495 |
-
* @return string
|
496 |
-
*/
|
497 |
-
public function get_ajax_endpoint( $endpoint_url, $request ) {
|
498 |
-
|
499 |
-
global $post;
|
500 |
-
|
501 |
-
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
502 |
-
|
503 |
-
if ( _is_wcf_optin_type() ) {
|
504 |
-
|
505 |
-
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
506 |
-
|
507 |
-
if ( '' === $request ) {
|
508 |
-
$query_args = array(
|
509 |
-
'wc-ajax' => '%%endpoint%%',
|
510 |
-
);
|
511 |
-
} else {
|
512 |
-
$query_args = array(
|
513 |
-
'wc-ajax' => $request,
|
514 |
-
);
|
515 |
-
}
|
516 |
-
|
517 |
-
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
518 |
-
$uri = $uri[0];
|
519 |
-
|
520 |
-
$endpoint_url = esc_url( add_query_arg( $query_args, $uri ) );
|
521 |
-
}
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
return $endpoint_url;
|
526 |
-
}
|
527 |
-
|
528 |
-
|
529 |
-
/**
|
530 |
-
* Save checkout fields.
|
531 |
-
*
|
532 |
-
* @param int $order_id order id.
|
533 |
-
* @param array $posted posted data.
|
534 |
-
* @return void
|
535 |
-
*/
|
536 |
-
public function save_optin_fields( $order_id, $posted ) {
|
537 |
-
|
538 |
-
if ( isset( $_POST['_wcf_optin_id'] ) ) { //phpcs:ignore
|
539 |
-
|
540 |
-
$optin_id = wc_clean( wp_unslash( $_POST['_wcf_optin_id'] ) ); //phpcs:ignore
|
541 |
-
|
542 |
-
update_post_meta( $order_id, '_wcf_optin_id', $optin_id );
|
543 |
-
|
544 |
-
if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
|
545 |
-
|
546 |
-
$flow_id = wc_clean( wp_unslash( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
|
547 |
-
|
548 |
-
update_post_meta( $order_id, '_wcf_flow_id', $flow_id );
|
549 |
-
}
|
550 |
-
}
|
551 |
-
|
552 |
-
}
|
553 |
-
|
554 |
-
/**
|
555 |
-
* Redirect users to our checkout if hidden param
|
556 |
-
*
|
557 |
-
* @param string $redirect redirect url.
|
558 |
-
* @param object $user user.
|
559 |
-
* @return string
|
560 |
-
*/
|
561 |
-
public function after_login_redirect( $redirect, $user ) {
|
562 |
-
|
563 |
-
if ( isset( $_POST['_wcf_optin_id'] ) ) { //phpcs:ignore
|
564 |
-
|
565 |
-
$optin_id = intval( $_POST['_wcf_optin_id'] ); //phpcs:ignore
|
566 |
-
|
567 |
-
$redirect = get_permalink( $optin_id );
|
568 |
-
}
|
569 |
-
|
570 |
-
return $redirect;
|
571 |
-
}
|
572 |
-
|
573 |
-
|
574 |
-
/**
|
575 |
-
* Add custom class to the fields to change the UI to three column.
|
576 |
-
*
|
577 |
-
* @param array $fields fields.
|
578 |
-
*/
|
579 |
-
public function set_optin_default_fields( $fields ) {
|
580 |
-
|
581 |
-
if ( _is_wcf_optin_type() ) {
|
582 |
-
|
583 |
-
global $post;
|
584 |
-
|
585 |
-
$optin_id = $post->ID;
|
586 |
-
} else {
|
587 |
-
|
588 |
-
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
589 |
-
|
590 |
-
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
591 |
-
} else {
|
592 |
-
return $fields;
|
593 |
-
}
|
594 |
-
}
|
595 |
-
|
596 |
-
$first_name = $fields['first_name'];
|
597 |
-
$last_name = $fields['last_name'];
|
598 |
-
|
599 |
-
/* Make fields required */
|
600 |
-
$first_name['required'] = true;
|
601 |
-
$last_name['required'] = true;
|
602 |
-
|
603 |
-
$fields = array(
|
604 |
-
'first_name' => $first_name,
|
605 |
-
'last_name' => $last_name,
|
606 |
-
);
|
607 |
-
|
608 |
-
return apply_filters( 'cartflows_optin_default_fields', $fields, $optin_id );
|
609 |
-
}
|
610 |
-
|
611 |
-
/**
|
612 |
-
* Add custom class to the fields to change the UI to three column.
|
613 |
-
*
|
614 |
-
* @param array $fields fields.
|
615 |
-
*/
|
616 |
-
public function set_optin_fields( $fields ) {
|
617 |
-
|
618 |
-
if ( _is_wcf_optin_type() ) {
|
619 |
-
|
620 |
-
global $post;
|
621 |
-
|
622 |
-
$optin_id = $post->ID;
|
623 |
-
} else {
|
624 |
-
|
625 |
-
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
626 |
-
|
627 |
-
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
628 |
-
} else {
|
629 |
-
return $fields;
|
630 |
-
}
|
631 |
-
}
|
632 |
-
|
633 |
-
$billing_first_name = $fields['billing']['billing_first_name'];
|
634 |
-
$billing_last_name = $fields['billing']['billing_last_name'];
|
635 |
-
$billing_email = $fields['billing']['billing_email'];
|
636 |
-
|
637 |
-
$fields['billing'] = array(
|
638 |
-
'billing_first_name' => $billing_first_name,
|
639 |
-
'billing_last_name' => $billing_last_name,
|
640 |
-
'billing_email' => $billing_email,
|
641 |
-
);
|
642 |
-
|
643 |
-
return apply_filters( 'cartflows_optin_fields', $fields, $optin_id );
|
644 |
-
}
|
645 |
-
|
646 |
-
/**
|
647 |
-
* Billing field customization.
|
648 |
-
*
|
649 |
-
* @param array $fields fields data.
|
650 |
-
* @param string $country country name.
|
651 |
-
* @return array
|
652 |
-
*/
|
653 |
-
public function billing_optin_fields( $fields, $country ) {
|
654 |
-
|
655 |
-
if ( _is_wcf_optin_type() ) {
|
656 |
-
|
657 |
-
global $post;
|
658 |
-
|
659 |
-
$optin_id = $post->ID;
|
660 |
-
} else {
|
661 |
-
|
662 |
-
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
663 |
-
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
664 |
-
} else {
|
665 |
-
return $fields;
|
666 |
-
}
|
667 |
-
}
|
668 |
-
|
669 |
-
if ( is_wc_endpoint_url( 'edit-address' ) ) {
|
670 |
-
return $fields;
|
671 |
-
}
|
672 |
-
|
673 |
-
$billing_first_name = $fields['billing_first_name'];
|
674 |
-
$billing_last_name = $fields['billing_last_name'];
|
675 |
-
$billing_email = $fields['billing_email'];
|
676 |
-
|
677 |
-
/* Make fields required */
|
678 |
-
$billing_first_name['required'] = true;
|
679 |
-
$billing_last_name['required'] = true;
|
680 |
-
|
681 |
-
$fields = array(
|
682 |
-
'billing_first_name' => $billing_first_name,
|
683 |
-
'billing_last_name' => $billing_last_name,
|
684 |
-
'billing_email' => $billing_email,
|
685 |
-
);
|
686 |
-
|
687 |
-
return apply_filters( 'cartflows_billing_optin_fields', $fields, $country, $optin_id );
|
688 |
-
}
|
689 |
-
|
690 |
-
|
691 |
-
/**
|
692 |
-
* Replace billing label.
|
693 |
-
*
|
694 |
-
* @param string $notice Notice.
|
695 |
-
* @param string $field_label Field name.
|
696 |
-
* @return string
|
697 |
-
*/
|
698 |
-
public function change_field_label_in_required_notice( $notice, $field_label ) {
|
699 |
-
|
700 |
-
if ( _is_wcf_doing_optin_ajax() ) {
|
701 |
-
|
702 |
-
$notice = str_replace( 'Billing ', '', $notice );
|
703 |
-
}
|
704 |
-
|
705 |
-
return $notice;
|
706 |
-
}
|
707 |
-
}
|
708 |
-
|
709 |
-
/**
|
710 |
-
* Kicking this off by calling 'get_instance()' method
|
711 |
-
*/
|
712 |
-
Cartflows_Optin_Markup::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checkout markup.
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Checkout Markup
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Optin_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 |
+
/* Set is checkout flag */
|
38 |
+
add_filter( 'woocommerce_is_checkout', array( $this, 'woo_checkout_flag' ), 9999 );
|
39 |
+
|
40 |
+
add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'save_optin_fields' ), 10, 2 );
|
41 |
+
|
42 |
+
/* Optin Shortcode */
|
43 |
+
add_shortcode( 'cartflows_optin', array( $this, 'optin_shortcode_markup' ) );
|
44 |
+
|
45 |
+
/* Preconfigured cart data */
|
46 |
+
add_action( 'wp', array( $this, 'preconfigured_cart_data' ), 1 );
|
47 |
+
|
48 |
+
/* Optin shortcode data */
|
49 |
+
add_action( 'wp', array( $this, 'shortcode_load_data' ), 1000 );
|
50 |
+
|
51 |
+
/* Ajax Endpoint */
|
52 |
+
add_filter( 'woocommerce_ajax_get_endpoint', array( $this, 'get_ajax_endpoint' ), 10, 2 );
|
53 |
+
add_filter( 'woocommerce_login_redirect', array( $this, 'after_login_redirect' ), 10, 2 );
|
54 |
+
|
55 |
+
/* Optin Fields */
|
56 |
+
add_filter( 'woocommerce_default_address_fields', array( $this, 'set_optin_default_fields' ), 1000 );
|
57 |
+
/**
|
58 |
+
* It may required later
|
59 |
+
* add_filter( 'woocommerce_checkout_fields', array( $this, 'set_optin_fields' ) );
|
60 |
+
*/
|
61 |
+
add_filter( 'woocommerce_billing_fields', array( $this, 'billing_optin_fields' ), 1000, 2 );
|
62 |
+
|
63 |
+
add_filter( 'woocommerce_checkout_required_field_notice', array( $this, 'change_field_label_in_required_notice' ), 100, 2 );
|
64 |
+
|
65 |
+
$this->elementor_editor_compatibility();
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Elementor editor compatibility.
|
70 |
+
*/
|
71 |
+
public function elementor_editor_compatibility() {
|
72 |
+
|
73 |
+
if ( ! empty( $_REQUEST['action'] ) && 'elementor' === $_REQUEST['action'] && is_admin() ) { //phpcs:ignore
|
74 |
+
|
75 |
+
if ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) { //phpcs:ignore
|
76 |
+
|
77 |
+
if ( _wcf_check_is_optin_by_id( intval( $_GET['post'] ) ) ) { //phpcs:ignore
|
78 |
+
|
79 |
+
/* Submit Button */
|
80 |
+
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Change order button text .
|
88 |
+
*
|
89 |
+
* @param string $woo_button_text place order.
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
public function place_order_button_text( $woo_button_text ) {
|
93 |
+
|
94 |
+
$optin_id = get_the_ID();
|
95 |
+
|
96 |
+
$wcf_order_button_text = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-text' );
|
97 |
+
|
98 |
+
if ( ! empty( $wcf_order_button_text ) ) {
|
99 |
+
$woo_button_text = $wcf_order_button_text;
|
100 |
+
}
|
101 |
+
|
102 |
+
return $woo_button_text;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Display all WooCommerce notices.
|
107 |
+
*
|
108 |
+
* @since 1.1.5
|
109 |
+
*/
|
110 |
+
public function display_woo_notices() {
|
111 |
+
|
112 |
+
if ( null != WC()->session && function_exists( 'woocommerce_output_all_notices' ) ) {
|
113 |
+
woocommerce_output_all_notices();
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Check for checkout flag
|
119 |
+
*
|
120 |
+
* @param bool $is_checkout is checkout.
|
121 |
+
*
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
public function woo_checkout_flag( $is_checkout ) {
|
125 |
+
|
126 |
+
if ( ! is_admin() ) {
|
127 |
+
|
128 |
+
if ( _is_wcf_optin_type() ) {
|
129 |
+
|
130 |
+
$is_checkout = true;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
return $is_checkout;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Render checkout shortcode markup.
|
139 |
+
*
|
140 |
+
* @param array $atts attributes.
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
public function optin_shortcode_markup( $atts ) {
|
144 |
+
|
145 |
+
if ( ! function_exists( 'wc_print_notices' ) ) {
|
146 |
+
$notice_out = '<p class="woocommerce-notice">' . __( 'WooCommerce functions do not exist. If you are in an IFrame, please reload it.', 'cartflows' ) . '</p>';
|
147 |
+
$notice_out .= '<button onClick="location.reload()">' . __( 'Click Here to Reload', 'cartflows' ) . '</button>';
|
148 |
+
|
149 |
+
return $notice_out;
|
150 |
+
}
|
151 |
+
|
152 |
+
$atts = shortcode_atts(
|
153 |
+
array(
|
154 |
+
'id' => 0,
|
155 |
+
),
|
156 |
+
$atts
|
157 |
+
);
|
158 |
+
|
159 |
+
$optin_id = intval( $atts['id'] );
|
160 |
+
|
161 |
+
if ( empty( $optin_id ) ) {
|
162 |
+
|
163 |
+
if ( ! _is_wcf_optin_type() ) {
|
164 |
+
|
165 |
+
return '<h4>' . __( 'Please place shortcode on Optin step-type only.', 'cartflows' ) . '</h4>';
|
166 |
+
}
|
167 |
+
|
168 |
+
global $post;
|
169 |
+
|
170 |
+
$optin_id = intval( $post->ID );
|
171 |
+
}
|
172 |
+
|
173 |
+
$output = '';
|
174 |
+
|
175 |
+
ob_start();
|
176 |
+
|
177 |
+
do_action( 'cartflows_optin_form_before', $optin_id );
|
178 |
+
|
179 |
+
$optin_layout = 'default';
|
180 |
+
|
181 |
+
$template_default = CARTFLOWS_OPTIN_DIR . 'templates/optin-template-simple.php';
|
182 |
+
|
183 |
+
include $template_default;
|
184 |
+
|
185 |
+
$output .= ob_get_clean();
|
186 |
+
|
187 |
+
return $output;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Configure Cart Data.
|
192 |
+
*
|
193 |
+
* @since 1.0.0
|
194 |
+
*
|
195 |
+
* @return void
|
196 |
+
*/
|
197 |
+
public function preconfigured_cart_data() {
|
198 |
+
|
199 |
+
if ( is_admin() ) {
|
200 |
+
return;
|
201 |
+
}
|
202 |
+
|
203 |
+
global $post;
|
204 |
+
|
205 |
+
if ( _is_wcf_optin_type() ) {
|
206 |
+
|
207 |
+
if ( wp_doing_ajax() ) {
|
208 |
+
return;
|
209 |
+
} else {
|
210 |
+
|
211 |
+
$optin_id = $post->ID;
|
212 |
+
|
213 |
+
do_action( 'cartflows_optin_before_configure_cart', $optin_id );
|
214 |
+
|
215 |
+
$products = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-product' );
|
216 |
+
|
217 |
+
if ( ! is_array( $products ) ) {
|
218 |
+
return;
|
219 |
+
}
|
220 |
+
|
221 |
+
/* Empty the current cart */
|
222 |
+
WC()->cart->empty_cart();
|
223 |
+
|
224 |
+
if ( is_array( $products ) && count( $products ) < 1 ) {
|
225 |
+
wc_add_notice( __( 'No product is selected. Please select a Simple, Virtual and Free product from the meta settings.', 'cartflows' ), 'error' );
|
226 |
+
return;
|
227 |
+
}
|
228 |
+
|
229 |
+
/* Set customer session if not set */
|
230 |
+
if ( ! is_user_logged_in() && WC()->cart->is_empty() ) {
|
231 |
+
WC()->session->set_customer_session_cookie( true );
|
232 |
+
}
|
233 |
+
|
234 |
+
$product_id = reset( $products );
|
235 |
+
$_product = wc_get_product( $product_id );
|
236 |
+
|
237 |
+
if ( ! empty( $_product ) ) {
|
238 |
+
|
239 |
+
if ( $_product->is_type( 'simple' ) && $_product->is_virtual() ) {
|
240 |
+
|
241 |
+
if ( $_product->get_price() > 0 ) {
|
242 |
+
wc_add_notice( __( 'Please update the selected product\'s price to zero (0).', 'cartflows' ), 'error' );
|
243 |
+
} else {
|
244 |
+
|
245 |
+
$quantity = 1;
|
246 |
+
|
247 |
+
WC()->cart->add_to_cart( $product_id, $quantity );
|
248 |
+
}
|
249 |
+
} else {
|
250 |
+
|
251 |
+
wc_add_notice( __( 'Please select a Simple, Virtual and Free product.', 'cartflows' ), 'error' );
|
252 |
+
}
|
253 |
+
} else {
|
254 |
+
|
255 |
+
wc_add_notice( __( 'Please select a Simple, Virtual and Free product.', 'cartflows' ), 'error' );
|
256 |
+
}
|
257 |
+
|
258 |
+
do_action( 'cartflows_optin_after_configure_cart', $optin_id );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Load shortcode data.
|
265 |
+
*
|
266 |
+
* @return void
|
267 |
+
*/
|
268 |
+
public function shortcode_load_data() {
|
269 |
+
|
270 |
+
if ( _is_wcf_optin_type() ) {
|
271 |
+
|
272 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_scripts' ), 21 );
|
273 |
+
|
274 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'compatibility_scripts' ), 101 );
|
275 |
+
|
276 |
+
/* Show notices if cart has errors */
|
277 |
+
add_action( 'woocommerce_cart_has_errors', 'woocommerce_output_all_notices' );
|
278 |
+
|
279 |
+
// Outputting the hidden field in checkout page.
|
280 |
+
add_action( 'woocommerce_after_order_notes', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
281 |
+
add_action( 'woocommerce_login_form_end', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
282 |
+
|
283 |
+
/* Remove unnecessary option */
|
284 |
+
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
|
285 |
+
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false' );
|
286 |
+
|
287 |
+
remove_all_actions( 'woocommerce_before_checkout_form' );
|
288 |
+
remove_all_actions( 'woocommerce_checkout_billing' );
|
289 |
+
remove_all_actions( 'woocommerce_checkout_shipping' );
|
290 |
+
remove_all_actions( 'woocommerce_checkout_before_order_review' );
|
291 |
+
remove_all_actions( 'woocommerce_checkout_order_review' );
|
292 |
+
remove_all_actions( 'woocommerce_checkout_after_order_review' );
|
293 |
+
add_filter( 'woocommerce_cart_needs_payment', '__return_false' );
|
294 |
+
add_filter( 'woocommerce_available_payment_gateways', array( $this, 'disable_payment_gateways' ) );
|
295 |
+
|
296 |
+
/* Paypal Expresss remove */
|
297 |
+
|
298 |
+
if ( function_exists( 'wc_gateway_ppec' ) ) {
|
299 |
+
remove_action( 'wp_enqueue_scripts', array( wc_gateway_ppec()->cart, 'enqueue_scripts' ) );
|
300 |
+
}
|
301 |
+
|
302 |
+
// Hook in actions once.
|
303 |
+
add_action( 'woocommerce_before_checkout_form', 'woocommerce_output_all_notices', 10 );
|
304 |
+
add_action( 'woocommerce_checkout_billing', array( WC()->checkout, 'checkout_form_billing' ) );
|
305 |
+
add_action( 'woocommerce_checkout_shipping', array( WC()->checkout, 'checkout_form_shipping' ) );
|
306 |
+
add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 );
|
307 |
+
|
308 |
+
/* Submit Button */
|
309 |
+
add_filter( 'woocommerce_order_button_text', array( $this, 'place_order_button_text' ), 10, 1 );
|
310 |
+
|
311 |
+
add_filter( 'woocommerce_get_terms_and_conditions_checkbox_text', '__return_false' );
|
312 |
+
|
313 |
+
global $post;
|
314 |
+
|
315 |
+
$optin_id = $post->ID;
|
316 |
+
|
317 |
+
do_action( 'cartflows_optin_before_shortcode', $optin_id );
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Disable payment gateways.
|
323 |
+
*
|
324 |
+
* @param array $available_gateways gateways.
|
325 |
+
* @return array
|
326 |
+
*/
|
327 |
+
public function disable_payment_gateways( $available_gateways ) {
|
328 |
+
|
329 |
+
if ( ! is_admin() ) {
|
330 |
+
|
331 |
+
$available_gateways = array();
|
332 |
+
}
|
333 |
+
|
334 |
+
return $available_gateways;
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Render checkout ID hidden field.
|
339 |
+
*
|
340 |
+
* @param array $checkout checkout session data.
|
341 |
+
* @return void
|
342 |
+
*/
|
343 |
+
public function checkout_shortcode_post_id( $checkout ) {
|
344 |
+
|
345 |
+
if ( ! _is_wcf_optin_type() ) {
|
346 |
+
return;
|
347 |
+
}
|
348 |
+
|
349 |
+
global $post;
|
350 |
+
|
351 |
+
$optin_id = $post->ID;
|
352 |
+
|
353 |
+
$flow_id = get_post_meta( $optin_id, 'wcf-flow-id', true );
|
354 |
+
|
355 |
+
echo '<input type="hidden" class="input-hidden _wcf_flow_id" name="_wcf_flow_id" value="' . intval( $flow_id ) . '">';
|
356 |
+
echo '<input type="hidden" class="input-hidden _wcf_optin_id" name="_wcf_optin_id" value="' . intval( $optin_id ) . '">';
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Load shortcode scripts.
|
361 |
+
*
|
362 |
+
* @return void
|
363 |
+
*/
|
364 |
+
public function shortcode_scripts() {
|
365 |
+
|
366 |
+
wp_enqueue_style( 'wcf-optin-template', wcf()->utils->get_css_url( 'optin-template' ), '', CARTFLOWS_VER );
|
367 |
+
|
368 |
+
wp_enqueue_script(
|
369 |
+
'wcf-optin-template',
|
370 |
+
wcf()->utils->get_js_url( 'optin-template' ),
|
371 |
+
array( 'jquery' ),
|
372 |
+
CARTFLOWS_VER,
|
373 |
+
true
|
374 |
+
);
|
375 |
+
|
376 |
+
do_action( 'cartflows_optin_scripts' );
|
377 |
+
|
378 |
+
$style = $this->generate_style();
|
379 |
+
|
380 |
+
wp_add_inline_style( 'wcf-optin-template', $style );
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Load compatibility scripts.
|
385 |
+
*
|
386 |
+
* @return void
|
387 |
+
*/
|
388 |
+
public function compatibility_scripts() {
|
389 |
+
|
390 |
+
global $post;
|
391 |
+
|
392 |
+
$optin_id = $post->ID;
|
393 |
+
|
394 |
+
// Add DIVI Compatibility css if DIVI theme is enabled.
|
395 |
+
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
396 |
+
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $optin_id )
|
397 |
+
) {
|
398 |
+
wp_enqueue_style( 'wcf-optin-template-divi', wcf()->utils->get_css_url( 'optin-template-divi' ), '', CARTFLOWS_VER );
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Generate styles.
|
404 |
+
*
|
405 |
+
* @return string
|
406 |
+
*/
|
407 |
+
public function generate_style() {
|
408 |
+
|
409 |
+
global $post;
|
410 |
+
|
411 |
+
$optin_id = $post->ID;
|
412 |
+
|
413 |
+
/* Load all fonts */
|
414 |
+
CartFlows_Font_Families::render_fonts( $optin_id );
|
415 |
+
|
416 |
+
$r = '';
|
417 |
+
$g = '';
|
418 |
+
$b = '';
|
419 |
+
$output = '';
|
420 |
+
|
421 |
+
/* Global */
|
422 |
+
$primary_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-primary-color' );
|
423 |
+
$base_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-base-font-family' );
|
424 |
+
|
425 |
+
/* Input Fields */
|
426 |
+
$input_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-font-family' );
|
427 |
+
$input_font_weight = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-font-weight' );
|
428 |
+
$field_input_size = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-input-field-size' );
|
429 |
+
$field_tb_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-tb-padding' );
|
430 |
+
$field_lr_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-lr-padding' );
|
431 |
+
$field_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-color' );
|
432 |
+
$field_bg_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-bg-color' );
|
433 |
+
$field_border_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-border-color' );
|
434 |
+
$field_label_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-field-label-color' );
|
435 |
+
|
436 |
+
if ( 'custom' == $field_input_size ) {
|
437 |
+
$field_input_size = '38px';
|
438 |
+
}
|
439 |
+
|
440 |
+
/* Submit Button */
|
441 |
+
$submit_button_width = '100%';
|
442 |
+
$optin_button_position = '';
|
443 |
+
$button_font_size = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-font-size' );
|
444 |
+
$button_font_family = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-button-font-family' );
|
445 |
+
$button_font_weight = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-button-font-weight' );
|
446 |
+
$submit_button_height = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-size' );
|
447 |
+
$submit_tb_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-tb-padding' );
|
448 |
+
$submit_lr_padding = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-lr-padding' );
|
449 |
+
$submit_button_position = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-button-position' );
|
450 |
+
$submit_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-color' );
|
451 |
+
$submit_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-hover-color' );
|
452 |
+
$submit_bg_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-bg-color', $primary_color );
|
453 |
+
$submit_bg_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-bg-hover-color', $primary_color );
|
454 |
+
$submit_border_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-border-color', $primary_color );
|
455 |
+
$submit_border_hover_color = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-submit-border-hover-color', $primary_color );
|
456 |
+
|
457 |
+
if ( 'custom' == $submit_button_height ) {
|
458 |
+
$submit_button_height = '38px';
|
459 |
+
$submit_button_width = 'auto';
|
460 |
+
|
461 |
+
switch ( $submit_button_position ) {
|
462 |
+
case 'left':
|
463 |
+
$optin_button_position = '0 auto 0 0';
|
464 |
+
break;
|
465 |
+
case 'center':
|
466 |
+
$optin_button_position = '0 auto';
|
467 |
+
break;
|
468 |
+
case 'right':
|
469 |
+
$optin_button_position = '0 0 0 auto';
|
470 |
+
break;
|
471 |
+
|
472 |
+
default:
|
473 |
+
$optin_button_position = '0 auto';
|
474 |
+
break;
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
479 |
+
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $optin_id ) ) {
|
480 |
+
|
481 |
+
include CARTFLOWS_OPTIN_DIR . 'includes/optin-dynamic-divi-css.php';
|
482 |
+
|
483 |
+
} else {
|
484 |
+
include CARTFLOWS_OPTIN_DIR . 'includes/optin-dynamic-css.php';
|
485 |
+
}
|
486 |
+
|
487 |
+
return $output;
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Get ajax end points.
|
492 |
+
*
|
493 |
+
* @param string $endpoint_url end point URL.
|
494 |
+
* @param string $request end point request.
|
495 |
+
* @return string
|
496 |
+
*/
|
497 |
+
public function get_ajax_endpoint( $endpoint_url, $request ) {
|
498 |
+
|
499 |
+
global $post;
|
500 |
+
|
501 |
+
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
502 |
+
|
503 |
+
if ( _is_wcf_optin_type() ) {
|
504 |
+
|
505 |
+
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
506 |
+
|
507 |
+
if ( '' === $request ) {
|
508 |
+
$query_args = array(
|
509 |
+
'wc-ajax' => '%%endpoint%%',
|
510 |
+
);
|
511 |
+
} else {
|
512 |
+
$query_args = array(
|
513 |
+
'wc-ajax' => $request,
|
514 |
+
);
|
515 |
+
}
|
516 |
+
|
517 |
+
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
518 |
+
$uri = $uri[0];
|
519 |
+
|
520 |
+
$endpoint_url = esc_url( add_query_arg( $query_args, $uri ) );
|
521 |
+
}
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
return $endpoint_url;
|
526 |
+
}
|
527 |
+
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Save checkout fields.
|
531 |
+
*
|
532 |
+
* @param int $order_id order id.
|
533 |
+
* @param array $posted posted data.
|
534 |
+
* @return void
|
535 |
+
*/
|
536 |
+
public function save_optin_fields( $order_id, $posted ) {
|
537 |
+
|
538 |
+
if ( isset( $_POST['_wcf_optin_id'] ) ) { //phpcs:ignore
|
539 |
+
|
540 |
+
$optin_id = wc_clean( wp_unslash( $_POST['_wcf_optin_id'] ) ); //phpcs:ignore
|
541 |
+
|
542 |
+
update_post_meta( $order_id, '_wcf_optin_id', $optin_id );
|
543 |
+
|
544 |
+
if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
|
545 |
+
|
546 |
+
$flow_id = wc_clean( wp_unslash( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
|
547 |
+
|
548 |
+
update_post_meta( $order_id, '_wcf_flow_id', $flow_id );
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Redirect users to our checkout if hidden param
|
556 |
+
*
|
557 |
+
* @param string $redirect redirect url.
|
558 |
+
* @param object $user user.
|
559 |
+
* @return string
|
560 |
+
*/
|
561 |
+
public function after_login_redirect( $redirect, $user ) {
|
562 |
+
|
563 |
+
if ( isset( $_POST['_wcf_optin_id'] ) ) { //phpcs:ignore
|
564 |
+
|
565 |
+
$optin_id = intval( $_POST['_wcf_optin_id'] ); //phpcs:ignore
|
566 |
+
|
567 |
+
$redirect = get_permalink( $optin_id );
|
568 |
+
}
|
569 |
+
|
570 |
+
return $redirect;
|
571 |
+
}
|
572 |
+
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Add custom class to the fields to change the UI to three column.
|
576 |
+
*
|
577 |
+
* @param array $fields fields.
|
578 |
+
*/
|
579 |
+
public function set_optin_default_fields( $fields ) {
|
580 |
+
|
581 |
+
if ( _is_wcf_optin_type() ) {
|
582 |
+
|
583 |
+
global $post;
|
584 |
+
|
585 |
+
$optin_id = $post->ID;
|
586 |
+
} else {
|
587 |
+
|
588 |
+
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
589 |
+
|
590 |
+
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
591 |
+
} else {
|
592 |
+
return $fields;
|
593 |
+
}
|
594 |
+
}
|
595 |
+
|
596 |
+
$first_name = $fields['first_name'];
|
597 |
+
$last_name = $fields['last_name'];
|
598 |
+
|
599 |
+
/* Make fields required */
|
600 |
+
$first_name['required'] = true;
|
601 |
+
$last_name['required'] = true;
|
602 |
+
|
603 |
+
$fields = array(
|
604 |
+
'first_name' => $first_name,
|
605 |
+
'last_name' => $last_name,
|
606 |
+
);
|
607 |
+
|
608 |
+
return apply_filters( 'cartflows_optin_default_fields', $fields, $optin_id );
|
609 |
+
}
|
610 |
+
|
611 |
+
/**
|
612 |
+
* Add custom class to the fields to change the UI to three column.
|
613 |
+
*
|
614 |
+
* @param array $fields fields.
|
615 |
+
*/
|
616 |
+
public function set_optin_fields( $fields ) {
|
617 |
+
|
618 |
+
if ( _is_wcf_optin_type() ) {
|
619 |
+
|
620 |
+
global $post;
|
621 |
+
|
622 |
+
$optin_id = $post->ID;
|
623 |
+
} else {
|
624 |
+
|
625 |
+
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
626 |
+
|
627 |
+
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
628 |
+
} else {
|
629 |
+
return $fields;
|
630 |
+
}
|
631 |
+
}
|
632 |
+
|
633 |
+
$billing_first_name = $fields['billing']['billing_first_name'];
|
634 |
+
$billing_last_name = $fields['billing']['billing_last_name'];
|
635 |
+
$billing_email = $fields['billing']['billing_email'];
|
636 |
+
|
637 |
+
$fields['billing'] = array(
|
638 |
+
'billing_first_name' => $billing_first_name,
|
639 |
+
'billing_last_name' => $billing_last_name,
|
640 |
+
'billing_email' => $billing_email,
|
641 |
+
);
|
642 |
+
|
643 |
+
return apply_filters( 'cartflows_optin_fields', $fields, $optin_id );
|
644 |
+
}
|
645 |
+
|
646 |
+
/**
|
647 |
+
* Billing field customization.
|
648 |
+
*
|
649 |
+
* @param array $fields fields data.
|
650 |
+
* @param string $country country name.
|
651 |
+
* @return array
|
652 |
+
*/
|
653 |
+
public function billing_optin_fields( $fields, $country ) {
|
654 |
+
|
655 |
+
if ( _is_wcf_optin_type() ) {
|
656 |
+
|
657 |
+
global $post;
|
658 |
+
|
659 |
+
$optin_id = $post->ID;
|
660 |
+
} else {
|
661 |
+
|
662 |
+
if ( _is_wcf_doing_optin_ajax() && wcf()->utils->get_optin_id_from_post_data() ) {
|
663 |
+
$optin_id = wcf()->utils->get_optin_id_from_post_data();
|
664 |
+
} else {
|
665 |
+
return $fields;
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
if ( is_wc_endpoint_url( 'edit-address' ) ) {
|
670 |
+
return $fields;
|
671 |
+
}
|
672 |
+
|
673 |
+
$billing_first_name = $fields['billing_first_name'];
|
674 |
+
$billing_last_name = $fields['billing_last_name'];
|
675 |
+
$billing_email = $fields['billing_email'];
|
676 |
+
|
677 |
+
/* Make fields required */
|
678 |
+
$billing_first_name['required'] = true;
|
679 |
+
$billing_last_name['required'] = true;
|
680 |
+
|
681 |
+
$fields = array(
|
682 |
+
'billing_first_name' => $billing_first_name,
|
683 |
+
'billing_last_name' => $billing_last_name,
|
684 |
+
'billing_email' => $billing_email,
|
685 |
+
);
|
686 |
+
|
687 |
+
return apply_filters( 'cartflows_billing_optin_fields', $fields, $country, $optin_id );
|
688 |
+
}
|
689 |
+
|
690 |
+
|
691 |
+
/**
|
692 |
+
* Replace billing label.
|
693 |
+
*
|
694 |
+
* @param string $notice Notice.
|
695 |
+
* @param string $field_label Field name.
|
696 |
+
* @return string
|
697 |
+
*/
|
698 |
+
public function change_field_label_in_required_notice( $notice, $field_label ) {
|
699 |
+
|
700 |
+
if ( _is_wcf_doing_optin_ajax() ) {
|
701 |
+
|
702 |
+
$notice = str_replace( 'Billing ', '', $notice );
|
703 |
+
}
|
704 |
+
|
705 |
+
return $notice;
|
706 |
+
}
|
707 |
+
}
|
708 |
+
|
709 |
+
/**
|
710 |
+
* Kicking this off by calling 'get_instance()' method
|
711 |
+
*/
|
712 |
+
Cartflows_Optin_Markup::get_instance();
|
modules/optin/includes/optin-dynamic-css.php
CHANGED
@@ -1,130 +1,130 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dynamic checkout css
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$output .= "
|
9 |
-
.wcf-optin-form .woocommerce #payment input[type=checkbox]:checked:before,
|
10 |
-
.wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
11 |
-
color: {$primary_color};
|
12 |
-
}
|
13 |
-
.wcf-optin-form .woocommerce #payment input[type=radio]:checked:before{
|
14 |
-
background-color: {$primary_color};
|
15 |
-
}
|
16 |
-
.wcf-optin-form .woocommerce #payment input[type=checkbox]:focus,
|
17 |
-
.wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
18 |
-
.wcf-optin-form .woocommerce #payment input[type=radio]:checked:focus,
|
19 |
-
.wcf-optin-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
20 |
-
border-color: {$primary_color};
|
21 |
-
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
22 |
-
}
|
23 |
-
.wcf-optin-form .woocommerce-checkout label{
|
24 |
-
color: {$field_label_color};
|
25 |
-
}
|
26 |
-
|
27 |
-
.wcf-optin-form #order_review .wcf-custom-coupon-field input[type='text'],
|
28 |
-
.wcf-optin-form .woocommerce form .form-row input.input-text,
|
29 |
-
.wcf-optin-form .woocommerce form .form-row textarea,
|
30 |
-
.wcf-optin-form .select2-container--default .select2-selection--single {
|
31 |
-
color: {$field_color};
|
32 |
-
background: {$field_bg_color};
|
33 |
-
border-color: {$field_border_color};
|
34 |
-
padding-top: {$field_tb_padding}px;
|
35 |
-
padding-bottom: {$field_tb_padding}px;
|
36 |
-
padding-left: {$field_lr_padding}px;
|
37 |
-
padding-right: {$field_lr_padding}px;
|
38 |
-
min-height: {$field_input_size};
|
39 |
-
font-family: {$input_font_family};
|
40 |
-
font-weight: {$input_font_weight};
|
41 |
-
}
|
42 |
-
|
43 |
-
.wcf-optin-form .woocommerce .col2-set .col-1,
|
44 |
-
.wcf-optin-form .woocommerce .col2-set .col-2,
|
45 |
-
.wcf-optin-form .woocommerce-checkout .shop_table,
|
46 |
-
.wcf-optin-form .woocommerce-checkout #order_review_heading,
|
47 |
-
.wcf-optin-form .woocommerce-checkout #payment,
|
48 |
-
.wcf-optin-form .woocommerce form.checkout_coupon {
|
49 |
-
font-family: {$input_font_family};
|
50 |
-
font-weight: {$input_font_weight};
|
51 |
-
}
|
52 |
-
|
53 |
-
.woocommerce table.shop_table th{
|
54 |
-
color: {$field_label_color};
|
55 |
-
}
|
56 |
-
|
57 |
-
.wcf-optin-form .woocommerce a{
|
58 |
-
color: {$primary_color};
|
59 |
-
}
|
60 |
-
.wcf-optin-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
61 |
-
color: {$field_color};
|
62 |
-
}
|
63 |
-
.wcf-optin-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
64 |
-
color: {$field_color};
|
65 |
-
}
|
66 |
-
.wcf-optin-form ::-moz-placeholder { /* Firefox 19+ */
|
67 |
-
color: {$field_color};
|
68 |
-
}
|
69 |
-
.wcf-optin-form :-ms-input-placeholder { /* IE 10+ */
|
70 |
-
color: {$field_color};
|
71 |
-
}
|
72 |
-
.wcf-optin-form :-moz-placeholder { /* Firefox 18- */
|
73 |
-
color: {$field_color};
|
74 |
-
}
|
75 |
-
.wcf-optin-form .woocommerce form p.form-row label {
|
76 |
-
color: {$field_label_color};
|
77 |
-
font-family: {$input_font_family};
|
78 |
-
font-weight: {$input_font_weight};
|
79 |
-
}
|
80 |
-
.wcf-optin-form .woocommerce #order_review button,
|
81 |
-
.wcf-optin-form .woocommerce form.woocommerce-form-login .form-row button,
|
82 |
-
.wcf-optin-form .woocommerce #order_review button.wcf-btn-small {
|
83 |
-
color: {$submit_color};
|
84 |
-
background: {$submit_bg_color};
|
85 |
-
padding-top: {$submit_tb_padding}px;
|
86 |
-
padding-bottom: {$submit_tb_padding}px;
|
87 |
-
padding-left: {$submit_lr_padding}px;
|
88 |
-
padding-right: {$submit_lr_padding}px;
|
89 |
-
border-color: {$submit_border_color};
|
90 |
-
min-height: {$submit_button_height};
|
91 |
-
font-size: {$button_font_size}px;
|
92 |
-
font-family: {$button_font_family};
|
93 |
-
font-weight: {$button_font_weight};
|
94 |
-
width: {$submit_button_width};
|
95 |
-
|
96 |
-
}
|
97 |
-
|
98 |
-
.wcf-optin-form .woocommerce-checkout form.woocommerce-form-login .button,
|
99 |
-
.wcf-optin-form .woocommerce-checkout form.checkout_coupon .button{
|
100 |
-
background: {$submit_bg_color};
|
101 |
-
border: 1px {$submit_border_color} solid;
|
102 |
-
color: {$submit_color};
|
103 |
-
min-height: {$submit_button_height};
|
104 |
-
font-family: {$button_font_family};
|
105 |
-
font-weight: {$button_font_weight};
|
106 |
-
}
|
107 |
-
.wcf-optin-form .woocommerce-checkout form.login .button:hover,
|
108 |
-
.wcf-optin-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
109 |
-
.wcf-optin-form .woocommerce #payment #place_order:hover,
|
110 |
-
.wcf-optin-form .woocommerce #order_review button.wcf-btn-small:hover{
|
111 |
-
color: {$submit_hover_color};
|
112 |
-
background-color: {$submit_bg_hover_color};
|
113 |
-
border-color: {$submit_border_hover_color};
|
114 |
-
}
|
115 |
-
.wcf-optin-form .woocommerce-info::before,
|
116 |
-
.wcf-optin-form .woocommerce-message::before{
|
117 |
-
color: {$primary_color};
|
118 |
-
}
|
119 |
-
.wcf-optin-form{
|
120 |
-
font-family: {$base_font_family};
|
121 |
-
}
|
122 |
-
img.emoji, img.wp-smiley {}";
|
123 |
-
|
124 |
-
if ( 'custom' == $submit_button_height ) {
|
125 |
-
$output .= "
|
126 |
-
.wcf-optin-form .woocommerce #order_review #payment button{
|
127 |
-
margin: {$optin_button_position};
|
128 |
-
}
|
129 |
-
";
|
130 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic checkout css
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$output .= "
|
9 |
+
.wcf-optin-form .woocommerce #payment input[type=checkbox]:checked:before,
|
10 |
+
.wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
11 |
+
color: {$primary_color};
|
12 |
+
}
|
13 |
+
.wcf-optin-form .woocommerce #payment input[type=radio]:checked:before{
|
14 |
+
background-color: {$primary_color};
|
15 |
+
}
|
16 |
+
.wcf-optin-form .woocommerce #payment input[type=checkbox]:focus,
|
17 |
+
.wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
18 |
+
.wcf-optin-form .woocommerce #payment input[type=radio]:checked:focus,
|
19 |
+
.wcf-optin-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
20 |
+
border-color: {$primary_color};
|
21 |
+
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
22 |
+
}
|
23 |
+
.wcf-optin-form .woocommerce-checkout label{
|
24 |
+
color: {$field_label_color};
|
25 |
+
}
|
26 |
+
|
27 |
+
.wcf-optin-form #order_review .wcf-custom-coupon-field input[type='text'],
|
28 |
+
.wcf-optin-form .woocommerce form .form-row input.input-text,
|
29 |
+
.wcf-optin-form .woocommerce form .form-row textarea,
|
30 |
+
.wcf-optin-form .select2-container--default .select2-selection--single {
|
31 |
+
color: {$field_color};
|
32 |
+
background: {$field_bg_color};
|
33 |
+
border-color: {$field_border_color};
|
34 |
+
padding-top: {$field_tb_padding}px;
|
35 |
+
padding-bottom: {$field_tb_padding}px;
|
36 |
+
padding-left: {$field_lr_padding}px;
|
37 |
+
padding-right: {$field_lr_padding}px;
|
38 |
+
min-height: {$field_input_size};
|
39 |
+
font-family: {$input_font_family};
|
40 |
+
font-weight: {$input_font_weight};
|
41 |
+
}
|
42 |
+
|
43 |
+
.wcf-optin-form .woocommerce .col2-set .col-1,
|
44 |
+
.wcf-optin-form .woocommerce .col2-set .col-2,
|
45 |
+
.wcf-optin-form .woocommerce-checkout .shop_table,
|
46 |
+
.wcf-optin-form .woocommerce-checkout #order_review_heading,
|
47 |
+
.wcf-optin-form .woocommerce-checkout #payment,
|
48 |
+
.wcf-optin-form .woocommerce form.checkout_coupon {
|
49 |
+
font-family: {$input_font_family};
|
50 |
+
font-weight: {$input_font_weight};
|
51 |
+
}
|
52 |
+
|
53 |
+
.woocommerce table.shop_table th{
|
54 |
+
color: {$field_label_color};
|
55 |
+
}
|
56 |
+
|
57 |
+
.wcf-optin-form .woocommerce a{
|
58 |
+
color: {$primary_color};
|
59 |
+
}
|
60 |
+
.wcf-optin-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
61 |
+
color: {$field_color};
|
62 |
+
}
|
63 |
+
.wcf-optin-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
64 |
+
color: {$field_color};
|
65 |
+
}
|
66 |
+
.wcf-optin-form ::-moz-placeholder { /* Firefox 19+ */
|
67 |
+
color: {$field_color};
|
68 |
+
}
|
69 |
+
.wcf-optin-form :-ms-input-placeholder { /* IE 10+ */
|
70 |
+
color: {$field_color};
|
71 |
+
}
|
72 |
+
.wcf-optin-form :-moz-placeholder { /* Firefox 18- */
|
73 |
+
color: {$field_color};
|
74 |
+
}
|
75 |
+
.wcf-optin-form .woocommerce form p.form-row label {
|
76 |
+
color: {$field_label_color};
|
77 |
+
font-family: {$input_font_family};
|
78 |
+
font-weight: {$input_font_weight};
|
79 |
+
}
|
80 |
+
.wcf-optin-form .woocommerce #order_review button,
|
81 |
+
.wcf-optin-form .woocommerce form.woocommerce-form-login .form-row button,
|
82 |
+
.wcf-optin-form .woocommerce #order_review button.wcf-btn-small {
|
83 |
+
color: {$submit_color};
|
84 |
+
background: {$submit_bg_color};
|
85 |
+
padding-top: {$submit_tb_padding}px;
|
86 |
+
padding-bottom: {$submit_tb_padding}px;
|
87 |
+
padding-left: {$submit_lr_padding}px;
|
88 |
+
padding-right: {$submit_lr_padding}px;
|
89 |
+
border-color: {$submit_border_color};
|
90 |
+
min-height: {$submit_button_height};
|
91 |
+
font-size: {$button_font_size}px;
|
92 |
+
font-family: {$button_font_family};
|
93 |
+
font-weight: {$button_font_weight};
|
94 |
+
width: {$submit_button_width};
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
.wcf-optin-form .woocommerce-checkout form.woocommerce-form-login .button,
|
99 |
+
.wcf-optin-form .woocommerce-checkout form.checkout_coupon .button{
|
100 |
+
background: {$submit_bg_color};
|
101 |
+
border: 1px {$submit_border_color} solid;
|
102 |
+
color: {$submit_color};
|
103 |
+
min-height: {$submit_button_height};
|
104 |
+
font-family: {$button_font_family};
|
105 |
+
font-weight: {$button_font_weight};
|
106 |
+
}
|
107 |
+
.wcf-optin-form .woocommerce-checkout form.login .button:hover,
|
108 |
+
.wcf-optin-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
109 |
+
.wcf-optin-form .woocommerce #payment #place_order:hover,
|
110 |
+
.wcf-optin-form .woocommerce #order_review button.wcf-btn-small:hover{
|
111 |
+
color: {$submit_hover_color};
|
112 |
+
background-color: {$submit_bg_hover_color};
|
113 |
+
border-color: {$submit_border_hover_color};
|
114 |
+
}
|
115 |
+
.wcf-optin-form .woocommerce-info::before,
|
116 |
+
.wcf-optin-form .woocommerce-message::before{
|
117 |
+
color: {$primary_color};
|
118 |
+
}
|
119 |
+
.wcf-optin-form{
|
120 |
+
font-family: {$base_font_family};
|
121 |
+
}
|
122 |
+
img.emoji, img.wp-smiley {}";
|
123 |
+
|
124 |
+
if ( 'custom' == $submit_button_height ) {
|
125 |
+
$output .= "
|
126 |
+
.wcf-optin-form .woocommerce #order_review #payment button{
|
127 |
+
margin: {$optin_button_position};
|
128 |
+
}
|
129 |
+
";
|
130 |
+
}
|
modules/optin/includes/optin-dynamic-divi-css.php
CHANGED
@@ -1,135 +1,135 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dynamic checkout css
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$output .= "
|
9 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=checkbox]:checked:before,
|
10 |
-
.et_pb_module #wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
11 |
-
color: {$primary_color};
|
12 |
-
}
|
13 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:checked:before{
|
14 |
-
background-color: {$primary_color};
|
15 |
-
}
|
16 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=checkbox]:focus,
|
17 |
-
.et_pb_module #wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
18 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:checked:focus,
|
19 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
20 |
-
border-color: {$primary_color};
|
21 |
-
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
22 |
-
}
|
23 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout label{
|
24 |
-
color: {$field_label_color};
|
25 |
-
}
|
26 |
-
|
27 |
-
.et_pb_module #wcf-optin-form .woocommerce form .form-row input.input-text,
|
28 |
-
.et_pb_module #wcf-optin-form .woocommerce form .form-row textarea,
|
29 |
-
.et_pb_module #wcf-optin-form .woocommerce form .form-row select,
|
30 |
-
.et_pb_module #wcf-optin-form .woocommerce #order_review .input-text,
|
31 |
-
.et_pb_module #wcf-optin-form #order_review .wcf-custom-coupon-field input[type='text'],
|
32 |
-
.et_pb_module #wcf-optin-form .woocommerce form .form-row input.input-text,
|
33 |
-
.et_pb_module #wcf-optin-form .woocommerce form .form-row textarea,
|
34 |
-
.et_pb_module #wcf-optin-form .select2-container--default .select2-selection--single {
|
35 |
-
color: {$field_color} !important;
|
36 |
-
background-color: {$field_bg_color}!important;
|
37 |
-
border-color: {$field_border_color}!important;
|
38 |
-
padding-top: {$field_tb_padding}px;
|
39 |
-
padding-bottom: {$field_tb_padding}px;
|
40 |
-
padding-left: {$field_lr_padding}px;
|
41 |
-
padding-right: {$field_lr_padding}px;
|
42 |
-
min-height: {$field_input_size}!important;
|
43 |
-
font-family: {$input_font_family};
|
44 |
-
font-weight: {$input_font_weight};
|
45 |
-
}
|
46 |
-
|
47 |
-
.et_pb_module #wcf-optin-form .woocommerce .col2-set .col-1,
|
48 |
-
.et_pb_module #wcf-optin-form .woocommerce .col2-set .col-2,
|
49 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout .shop_table,
|
50 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout #order_review_heading,
|
51 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout #payment,
|
52 |
-
.et_pb_module #wcf-optin-form .woocommerce form.checkout_coupon {
|
53 |
-
font-family: {$input_font_family};
|
54 |
-
font-weight: {$input_font_weight};
|
55 |
-
}
|
56 |
-
|
57 |
-
.et_pb_module #wcf-optin-form .woocommerce table.shop_table th{
|
58 |
-
color: {$field_label_color};
|
59 |
-
}
|
60 |
-
|
61 |
-
.et_pb_module #wcf-optin-form .woocommerce a{
|
62 |
-
color: {$primary_color};
|
63 |
-
}
|
64 |
-
.et_pb_module #wcf-optin-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
65 |
-
color: {$field_color};
|
66 |
-
}
|
67 |
-
.et_pb_module #wcf-optin-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
68 |
-
color: {$field_color};
|
69 |
-
}
|
70 |
-
.et_pb_module #wcf-optin-form ::-moz-placeholder { /* Firefox 19+ */
|
71 |
-
color: {$field_color};
|
72 |
-
}
|
73 |
-
.et_pb_module #wcf-optin-form :-ms-input-placeholder { /* IE 10+ */
|
74 |
-
color: {$field_color};
|
75 |
-
}
|
76 |
-
.et_pb_module #wcf-optin-form :-moz-placeholder { /* Firefox 18- */
|
77 |
-
color: {$field_color};
|
78 |
-
}
|
79 |
-
.et_pb_module #wcf-optin-form .woocommerce form p.form-row label {
|
80 |
-
color: {$field_label_color};
|
81 |
-
font-family: {$input_font_family};
|
82 |
-
font-weight: {$input_font_weight};
|
83 |
-
}
|
84 |
-
.et_pb_module #wcf-optin-form .woocommerce #order_review button,
|
85 |
-
.et_pb_module #wcf-optin-form .woocommerce form.woocommerce-form-login .form-row button,
|
86 |
-
.et_pb_module #wcf-optin-form .woocommerce #order_review button.wcf-btn-small {
|
87 |
-
color: {$submit_color} !important;
|
88 |
-
background-color: {$submit_bg_color}!important;
|
89 |
-
padding-top: {$submit_tb_padding}px;
|
90 |
-
padding-bottom: {$submit_tb_padding}px;
|
91 |
-
padding-left: {$submit_lr_padding}px;
|
92 |
-
padding-right: {$submit_lr_padding}px;
|
93 |
-
border-color: {$submit_border_color}!important;
|
94 |
-
min-height: {$submit_button_height};
|
95 |
-
font-size: {$button_font_size}px;
|
96 |
-
font-family: {$button_font_family};
|
97 |
-
font-weight: {$button_font_weight};
|
98 |
-
width: {$submit_button_width};
|
99 |
-
|
100 |
-
}
|
101 |
-
|
102 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout form.woocommerce-form-login .button,
|
103 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout form.checkout_coupon .button{
|
104 |
-
background: {$submit_bg_color};
|
105 |
-
border: 1px {$submit_border_color} solid;
|
106 |
-
color: {$submit_color};
|
107 |
-
min-height: {$submit_button_height};
|
108 |
-
font-family: {$button_font_family};
|
109 |
-
font-weight: {$button_font_weight};
|
110 |
-
}
|
111 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout form.login .button:hover,
|
112 |
-
.et_pb_module #wcf-optin-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
113 |
-
.et_pb_module #wcf-optin-form .woocommerce #payment #place_order:hover,
|
114 |
-
.et_pb_module #wcf-optin-form .woocommerce #order_review button.wcf-btn-small:hover{
|
115 |
-
color: {$submit_hover_color} !important;
|
116 |
-
background-color: {$submit_bg_hover_color} !important;
|
117 |
-
border-color: {$submit_border_hover_color} !important;
|
118 |
-
}
|
119 |
-
.et_pb_module #wcf-optin-form .woocommerce-info::before,
|
120 |
-
.et_pb_module #wcf-optin-form .woocommerce-message::before{
|
121 |
-
color: {$primary_color};
|
122 |
-
}
|
123 |
-
.et_pb_module #wcf-optin-form {
|
124 |
-
font-family: {$base_font_family};
|
125 |
-
}
|
126 |
-
img.emoji, img.wp-smiley {}
|
127 |
-
";
|
128 |
-
|
129 |
-
if ( 'custom' == $submit_button_height ) {
|
130 |
-
$output .= "
|
131 |
-
.et_pb_module #wcf-optin-form .woocommerce #order_review #payment button{
|
132 |
-
margin: {$optin_button_position};
|
133 |
-
}
|
134 |
-
";
|
135 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic checkout css
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$output .= "
|
9 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=checkbox]:checked:before,
|
10 |
+
.et_pb_module #wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
11 |
+
color: {$primary_color};
|
12 |
+
}
|
13 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:checked:before{
|
14 |
+
background-color: {$primary_color};
|
15 |
+
}
|
16 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=checkbox]:focus,
|
17 |
+
.et_pb_module #wcf-optin-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
18 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:checked:focus,
|
19 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
20 |
+
border-color: {$primary_color};
|
21 |
+
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
22 |
+
}
|
23 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout label{
|
24 |
+
color: {$field_label_color};
|
25 |
+
}
|
26 |
+
|
27 |
+
.et_pb_module #wcf-optin-form .woocommerce form .form-row input.input-text,
|
28 |
+
.et_pb_module #wcf-optin-form .woocommerce form .form-row textarea,
|
29 |
+
.et_pb_module #wcf-optin-form .woocommerce form .form-row select,
|
30 |
+
.et_pb_module #wcf-optin-form .woocommerce #order_review .input-text,
|
31 |
+
.et_pb_module #wcf-optin-form #order_review .wcf-custom-coupon-field input[type='text'],
|
32 |
+
.et_pb_module #wcf-optin-form .woocommerce form .form-row input.input-text,
|
33 |
+
.et_pb_module #wcf-optin-form .woocommerce form .form-row textarea,
|
34 |
+
.et_pb_module #wcf-optin-form .select2-container--default .select2-selection--single {
|
35 |
+
color: {$field_color} !important;
|
36 |
+
background-color: {$field_bg_color}!important;
|
37 |
+
border-color: {$field_border_color}!important;
|
38 |
+
padding-top: {$field_tb_padding}px;
|
39 |
+
padding-bottom: {$field_tb_padding}px;
|
40 |
+
padding-left: {$field_lr_padding}px;
|
41 |
+
padding-right: {$field_lr_padding}px;
|
42 |
+
min-height: {$field_input_size}!important;
|
43 |
+
font-family: {$input_font_family};
|
44 |
+
font-weight: {$input_font_weight};
|
45 |
+
}
|
46 |
+
|
47 |
+
.et_pb_module #wcf-optin-form .woocommerce .col2-set .col-1,
|
48 |
+
.et_pb_module #wcf-optin-form .woocommerce .col2-set .col-2,
|
49 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout .shop_table,
|
50 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout #order_review_heading,
|
51 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout #payment,
|
52 |
+
.et_pb_module #wcf-optin-form .woocommerce form.checkout_coupon {
|
53 |
+
font-family: {$input_font_family};
|
54 |
+
font-weight: {$input_font_weight};
|
55 |
+
}
|
56 |
+
|
57 |
+
.et_pb_module #wcf-optin-form .woocommerce table.shop_table th{
|
58 |
+
color: {$field_label_color};
|
59 |
+
}
|
60 |
+
|
61 |
+
.et_pb_module #wcf-optin-form .woocommerce a{
|
62 |
+
color: {$primary_color};
|
63 |
+
}
|
64 |
+
.et_pb_module #wcf-optin-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
65 |
+
color: {$field_color};
|
66 |
+
}
|
67 |
+
.et_pb_module #wcf-optin-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
68 |
+
color: {$field_color};
|
69 |
+
}
|
70 |
+
.et_pb_module #wcf-optin-form ::-moz-placeholder { /* Firefox 19+ */
|
71 |
+
color: {$field_color};
|
72 |
+
}
|
73 |
+
.et_pb_module #wcf-optin-form :-ms-input-placeholder { /* IE 10+ */
|
74 |
+
color: {$field_color};
|
75 |
+
}
|
76 |
+
.et_pb_module #wcf-optin-form :-moz-placeholder { /* Firefox 18- */
|
77 |
+
color: {$field_color};
|
78 |
+
}
|
79 |
+
.et_pb_module #wcf-optin-form .woocommerce form p.form-row label {
|
80 |
+
color: {$field_label_color};
|
81 |
+
font-family: {$input_font_family};
|
82 |
+
font-weight: {$input_font_weight};
|
83 |
+
}
|
84 |
+
.et_pb_module #wcf-optin-form .woocommerce #order_review button,
|
85 |
+
.et_pb_module #wcf-optin-form .woocommerce form.woocommerce-form-login .form-row button,
|
86 |
+
.et_pb_module #wcf-optin-form .woocommerce #order_review button.wcf-btn-small {
|
87 |
+
color: {$submit_color} !important;
|
88 |
+
background-color: {$submit_bg_color}!important;
|
89 |
+
padding-top: {$submit_tb_padding}px;
|
90 |
+
padding-bottom: {$submit_tb_padding}px;
|
91 |
+
padding-left: {$submit_lr_padding}px;
|
92 |
+
padding-right: {$submit_lr_padding}px;
|
93 |
+
border-color: {$submit_border_color}!important;
|
94 |
+
min-height: {$submit_button_height};
|
95 |
+
font-size: {$button_font_size}px;
|
96 |
+
font-family: {$button_font_family};
|
97 |
+
font-weight: {$button_font_weight};
|
98 |
+
width: {$submit_button_width};
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout form.woocommerce-form-login .button,
|
103 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout form.checkout_coupon .button{
|
104 |
+
background: {$submit_bg_color};
|
105 |
+
border: 1px {$submit_border_color} solid;
|
106 |
+
color: {$submit_color};
|
107 |
+
min-height: {$submit_button_height};
|
108 |
+
font-family: {$button_font_family};
|
109 |
+
font-weight: {$button_font_weight};
|
110 |
+
}
|
111 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout form.login .button:hover,
|
112 |
+
.et_pb_module #wcf-optin-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
113 |
+
.et_pb_module #wcf-optin-form .woocommerce #payment #place_order:hover,
|
114 |
+
.et_pb_module #wcf-optin-form .woocommerce #order_review button.wcf-btn-small:hover{
|
115 |
+
color: {$submit_hover_color} !important;
|
116 |
+
background-color: {$submit_bg_hover_color} !important;
|
117 |
+
border-color: {$submit_border_hover_color} !important;
|
118 |
+
}
|
119 |
+
.et_pb_module #wcf-optin-form .woocommerce-info::before,
|
120 |
+
.et_pb_module #wcf-optin-form .woocommerce-message::before{
|
121 |
+
color: {$primary_color};
|
122 |
+
}
|
123 |
+
.et_pb_module #wcf-optin-form {
|
124 |
+
font-family: {$base_font_family};
|
125 |
+
}
|
126 |
+
img.emoji, img.wp-smiley {}
|
127 |
+
";
|
128 |
+
|
129 |
+
if ( 'custom' == $submit_button_height ) {
|
130 |
+
$output .= "
|
131 |
+
.et_pb_module #wcf-optin-form .woocommerce #order_review #payment button{
|
132 |
+
margin: {$optin_button_position};
|
133 |
+
}
|
134 |
+
";
|
135 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
|
|
4 |
Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.4
|
7 |
-
Stable tag: 1.5.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -125,6 +125,10 @@ Glad you asked! CartFlows Pro is an optional add-on to CartFlows that adds addit
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
128 |
= Version 1.5.3 - Wednesday, 1st April 2020 =
|
129 |
* Improvement: Divi CSS support added for the Optin step type.
|
130 |
* Fix: FB Pixel conflict with Beaver Builder & PHP notice issue.
|
4 |
Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.4
|
7 |
+
Stable tag: 1.5.4
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
125 |
|
126 |
== Changelog ==
|
127 |
|
128 |
+
= Version 1.5.4 - Tuesday, 7th April 2020 =
|
129 |
+
* Improvement: Hardened the security of the plugin.
|
130 |
+
* Fix: Older flows were not displaying in the library.
|
131 |
+
|
132 |
= Version 1.5.3 - Wednesday, 1st April 2020 =
|
133 |
* Improvement: Divi CSS support added for the Optin step type.
|
134 |
* Fix: FB Pixel conflict with Beaver Builder & PHP notice issue.
|