Version Description
Download this release
Release Info
Developer | sandesh055 |
Plugin | Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress |
Version | 1.1.8 |
Comparing to | |
See all releases |
Code changes from version 1.1.7 to 1.1.8
- admin/assets/css/global-admin-rtl.css +2 -2
- admin/assets/css/global-admin.css +2 -2
- assets/css/checkout-template-rtl.css +2 -0
- assets/css/checkout-template.css +2 -0
- cartflows.php +1 -1
- changelog.txt +5 -0
- classes/batch-process/class-cartflows-batch-process.php +5 -3
- classes/batch-process/class-cartflows-importer-divi-batch-reset-data.php +0 -59
- classes/batch-process/class-cartflows-importer-divi-batch.php +63 -63
- classes/batch-process/class-cartflows-importer-divi.php +65 -81
- classes/class-cartflows-api.php +1 -6
- classes/class-cartflows-compatibility.php +388 -388
- classes/class-cartflows-default-meta.php +90 -1
- classes/class-cartflows-frontend.php +430 -402
- classes/class-cartflows-helper.php +458 -458
- classes/class-cartflows-importer-core.php +272 -272
- classes/class-cartflows-importer.php +29 -24
- classes/class-cartflows-loader.php +1 -1
- classes/class-cartflows-meta.php +75 -51
- includes/admin/cartflows-general.php +143 -143
- languages/cartflows.pot +136 -121
- modules/checkout/classes/class-cartflows-checkout-markup.php +1111 -1109
- modules/checkout/classes/class-cartflows-checkout-meta.php +11 -5
- modules/flow/classes/class-cartflows-step-post-type.php +465 -465
- modules/landing/classes/class-cartflows-landing-meta.php +236 -266
- modules/thankyou/classes/class-cartflows-thankyou-meta.php +371 -405
- readme.txt +12 -4
admin/assets/css/global-admin-rtl.css
CHANGED
@@ -631,7 +631,7 @@ input[type="text"].error:focus{
|
|
631 |
}
|
632 |
|
633 |
.wcf-table-container .wcf-column-right .wcf-field-row-heading .dashicons {
|
634 |
-
line-height: 1
|
635 |
margin-right: 5px;
|
636 |
}
|
637 |
|
@@ -731,7 +731,7 @@ input[type="text"].error:focus{
|
|
731 |
border-left: none;
|
732 |
border-top: none;
|
733 |
border-bottom: none;
|
734 |
-
min-height:
|
735 |
overflow: hidden;
|
736 |
padding: 10px 0px;
|
737 |
}
|
631 |
}
|
632 |
|
633 |
.wcf-table-container .wcf-column-right .wcf-field-row-heading .dashicons {
|
634 |
+
line-height: 1;
|
635 |
margin-right: 5px;
|
636 |
}
|
637 |
|
731 |
border-left: none;
|
732 |
border-top: none;
|
733 |
border-bottom: none;
|
734 |
+
min-height: 190px;
|
735 |
overflow: hidden;
|
736 |
padding: 10px 0px;
|
737 |
}
|
admin/assets/css/global-admin.css
CHANGED
@@ -631,7 +631,7 @@ input[type="text"].error:focus{
|
|
631 |
}
|
632 |
|
633 |
.wcf-table-container .wcf-column-right .wcf-field-row-heading .dashicons {
|
634 |
-
line-height: 1
|
635 |
margin-left: 5px;
|
636 |
}
|
637 |
|
@@ -731,7 +731,7 @@ input[type="text"].error:focus{
|
|
731 |
border-right: none;
|
732 |
border-top: none;
|
733 |
border-bottom: none;
|
734 |
-
min-height:
|
735 |
overflow: hidden;
|
736 |
padding: 10px 0px;
|
737 |
}
|
631 |
}
|
632 |
|
633 |
.wcf-table-container .wcf-column-right .wcf-field-row-heading .dashicons {
|
634 |
+
line-height: 1;
|
635 |
margin-left: 5px;
|
636 |
}
|
637 |
|
731 |
border-right: none;
|
732 |
border-top: none;
|
733 |
border-bottom: none;
|
734 |
+
min-height: 190px;
|
735 |
overflow: hidden;
|
736 |
padding: 10px 0px;
|
737 |
}
|
assets/css/checkout-template-rtl.css
CHANGED
@@ -229,6 +229,7 @@
|
|
229 |
.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2 {
|
230 |
float: none;
|
231 |
width: 100%;
|
|
|
232 |
padding: 0px;
|
233 |
-webkit-border-radius: 0px;
|
234 |
border-radius: 0px;
|
@@ -553,6 +554,7 @@
|
|
553 |
}*/
|
554 |
|
555 |
.wcf-embed-checkout-form .woocommerce form .form-row{
|
|
|
556 |
margin-bottom: 1.1em;
|
557 |
padding: 3px 7px;
|
558 |
}
|
229 |
.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2 {
|
230 |
float: none;
|
231 |
width: 100%;
|
232 |
+
max-width: 100%;
|
233 |
padding: 0px;
|
234 |
-webkit-border-radius: 0px;
|
235 |
border-radius: 0px;
|
554 |
}*/
|
555 |
|
556 |
.wcf-embed-checkout-form .woocommerce form .form-row{
|
557 |
+
display: block;
|
558 |
margin-bottom: 1.1em;
|
559 |
padding: 3px 7px;
|
560 |
}
|
assets/css/checkout-template.css
CHANGED
@@ -229,6 +229,7 @@
|
|
229 |
.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2 {
|
230 |
float: none;
|
231 |
width: 100%;
|
|
|
232 |
padding: 0px;
|
233 |
-webkit-border-radius: 0px;
|
234 |
border-radius: 0px;
|
@@ -553,6 +554,7 @@
|
|
553 |
}*/
|
554 |
|
555 |
.wcf-embed-checkout-form .woocommerce form .form-row{
|
|
|
556 |
margin-bottom: 1.1em;
|
557 |
padding: 3px 7px;
|
558 |
}
|
229 |
.wcf-embed-checkout-form .woocommerce-page .col2-set .col-2 {
|
230 |
float: none;
|
231 |
width: 100%;
|
232 |
+
max-width: 100%;
|
233 |
padding: 0px;
|
234 |
-webkit-border-radius: 0px;
|
235 |
border-radius: 0px;
|
554 |
}*/
|
555 |
|
556 |
.wcf-embed-checkout-form .woocommerce form .form-row{
|
557 |
+
display: block;
|
558 |
margin-bottom: 1.1em;
|
559 |
padding: 3px 7px;
|
560 |
}
|
cartflows.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
-
* Version: 1.1.
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
+
* Version: 1.1.8
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Version 1.1.7 - Monday, 25th February 2019
|
2 |
- New: DIVI templates.
|
3 |
- Fix: Shipping fields label issue.
|
1 |
+
Version 1.1.8 - Wednesday, 27th February 2019
|
2 |
+
- New: Custom script support added for Landing, Checkout and Thank You page type.
|
3 |
+
- Fix: Added compatibility for pre-applied coupon field fix.
|
4 |
+
- Fix: Divi flow importer style tag issue.
|
5 |
+
|
6 |
Version 1.1.7 - Monday, 25th February 2019
|
7 |
- New: DIVI templates.
|
8 |
- Fix: Shipping fields label issue.
|
classes/batch-process/class-cartflows-batch-process.php
CHANGED
@@ -85,8 +85,10 @@ if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
|
|
85 |
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
|
86 |
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
|
87 |
|
|
|
|
|
88 |
// Elementor.
|
89 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
90 |
// Add "elementor" in import [queue].
|
91 |
// @todo Remove required `allow_url_fopen` support.
|
92 |
if ( ini_get( 'allow_url_fopen' ) ) {
|
@@ -97,14 +99,14 @@ if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
|
|
97 |
}
|
98 |
|
99 |
// Beaver Builder.
|
100 |
-
if ( class_exists( 'FLBuilder' ) ) {
|
101 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
|
102 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
|
103 |
self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
|
104 |
}
|
105 |
|
106 |
// Divi.
|
107 |
-
if ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
108 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
|
109 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
|
110 |
self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
|
85 |
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
|
86 |
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
|
87 |
|
88 |
+
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
89 |
+
|
90 |
// Elementor.
|
91 |
+
if ( ( 'elementor' === $default_page_builder ) && class_exists( '\Elementor\Plugin' ) ) {
|
92 |
// Add "elementor" in import [queue].
|
93 |
// @todo Remove required `allow_url_fopen` support.
|
94 |
if ( ini_get( 'allow_url_fopen' ) ) {
|
99 |
}
|
100 |
|
101 |
// Beaver Builder.
|
102 |
+
if ( ( 'beaver-builder' === $default_page_builder ) && class_exists( 'FLBuilder' ) ) {
|
103 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
|
104 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
|
105 |
self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
|
106 |
}
|
107 |
|
108 |
// Divi.
|
109 |
+
if ( ( 'divi' === $default_page_builder ) && ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) ) {
|
110 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
|
111 |
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
|
112 |
self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
|
classes/batch-process/class-cartflows-importer-divi-batch-reset-data.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Divi Batch Process
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.1.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'Cartflows_Importer_Divi_Batch_Reset_Data' ) && class_exists( 'WP_Background_Process' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Image Background Process
|
13 |
-
*
|
14 |
-
* @since 1.1.1
|
15 |
-
*/
|
16 |
-
class Cartflows_Importer_Divi_Batch_Reset_Data extends WP_Background_Process {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Image Process
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
protected $action = 'cartflows_divi_image_process_reset_data';
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Task
|
27 |
-
*
|
28 |
-
* Override this method to perform any actions required on each
|
29 |
-
* queue item. Return the modified item for further processing
|
30 |
-
* in the next pass through. Or, return false to remove the
|
31 |
-
* item from the queue.
|
32 |
-
*
|
33 |
-
* @since 1.1.1
|
34 |
-
*
|
35 |
-
* @param integer $post_id Post Id.
|
36 |
-
* @return mixed
|
37 |
-
*/
|
38 |
-
protected function task( $post_id ) {
|
39 |
-
|
40 |
-
CartFlows_Importer_Divi::get_instance()->reset_data( $post_id );
|
41 |
-
|
42 |
-
return false;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Complete
|
47 |
-
*
|
48 |
-
* Override if applicable, but ensure that the below actions are
|
49 |
-
* performed, or, call parent::complete().
|
50 |
-
*
|
51 |
-
* @since 1.1.1
|
52 |
-
*/
|
53 |
-
protected function complete() {
|
54 |
-
parent::complete();
|
55 |
-
}
|
56 |
-
|
57 |
-
}
|
58 |
-
|
59 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/batch-process/class-cartflows-importer-divi-batch.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Divi Batch Process
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.1.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'Cartflows_Importer_Divi_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Image Background Process
|
13 |
-
*
|
14 |
-
* @since 1.1.1
|
15 |
-
*/
|
16 |
-
class Cartflows_Importer_Divi_Batch extends WP_Background_Process {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Image Process
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
protected $action = 'cartflows_divi_image_process';
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Task
|
27 |
-
*
|
28 |
-
* Override this method to perform any actions required on each
|
29 |
-
* queue item. Return the modified item for further processing
|
30 |
-
* in the next pass through. Or, return false to remove the
|
31 |
-
* item from the queue.
|
32 |
-
*
|
33 |
-
* @since 1.1.1
|
34 |
-
*
|
35 |
-
* @param integer $post_id Post Id.
|
36 |
-
* @return mixed
|
37 |
-
*/
|
38 |
-
protected function task( $post_id ) {
|
39 |
-
|
40 |
-
CartFlows_Importer_Divi::get_instance()->import_single_post( $post_id );
|
41 |
-
|
42 |
-
return false;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Complete
|
47 |
-
*
|
48 |
-
* Override if applicable, but ensure that the below actions are
|
49 |
-
* performed, or, call parent::complete().
|
50 |
-
*
|
51 |
-
* @since 1.1.1
|
52 |
-
*/
|
53 |
-
protected function complete() {
|
54 |
-
|
55 |
-
parent::complete();
|
56 |
-
|
57 |
-
do_action( 'cartflows_import_complete' );
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Divi Batch Process
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.1.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'Cartflows_Importer_Divi_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Image Background Process
|
13 |
+
*
|
14 |
+
* @since 1.1.1
|
15 |
+
*/
|
16 |
+
class Cartflows_Importer_Divi_Batch extends WP_Background_Process {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Image Process
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $action = 'cartflows_divi_image_process';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Task
|
27 |
+
*
|
28 |
+
* Override this method to perform any actions required on each
|
29 |
+
* queue item. Return the modified item for further processing
|
30 |
+
* in the next pass through. Or, return false to remove the
|
31 |
+
* item from the queue.
|
32 |
+
*
|
33 |
+
* @since 1.1.1
|
34 |
+
*
|
35 |
+
* @param integer $post_id Post Id.
|
36 |
+
* @return mixed
|
37 |
+
*/
|
38 |
+
protected function task( $post_id ) {
|
39 |
+
|
40 |
+
CartFlows_Importer_Divi::get_instance()->import_single_post( $post_id );
|
41 |
+
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Complete
|
47 |
+
*
|
48 |
+
* Override if applicable, but ensure that the below actions are
|
49 |
+
* performed, or, call parent::complete().
|
50 |
+
*
|
51 |
+
* @since 1.1.1
|
52 |
+
*/
|
53 |
+
protected function complete() {
|
54 |
+
|
55 |
+
parent::complete();
|
56 |
+
|
57 |
+
do_action( 'cartflows_import_complete' );
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
endif;
|
classes/batch-process/class-cartflows-importer-divi.php
CHANGED
@@ -24,15 +24,6 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
24 |
*/
|
25 |
private static $instance;
|
26 |
|
27 |
-
/**
|
28 |
-
* Instance
|
29 |
-
*
|
30 |
-
* @since 1.1.1
|
31 |
-
* @access private
|
32 |
-
* @var object Class object.
|
33 |
-
*/
|
34 |
-
private $batch_instance_divi_reset_data;
|
35 |
-
|
36 |
/**
|
37 |
* Initiator
|
38 |
*
|
@@ -53,12 +44,8 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
53 |
* @since 1.1.1
|
54 |
*/
|
55 |
public function __construct() {
|
56 |
-
|
57 |
-
add_action( 'admin_head', array( $this, '
|
58 |
-
|
59 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch-reset-data.php';
|
60 |
-
|
61 |
-
$this->batch_instance_divi_reset_data = new Cartflows_Importer_Divi_Batch_Reset_Data();
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -69,18 +56,12 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
69 |
*/
|
70 |
function reset_data( $post_id ) {
|
71 |
|
72 |
-
// wcf()->logger->import_log( ' Reprocessing step - ' . $post_id );.
|
73 |
-
// $content = get_post_meta( $post_id, 'divi_content', true );.
|
74 |
-
// wcf()->logger->import_log( 'Unprocessed' );.
|
75 |
-
// wcf()->logger->import_log( $content );.
|
76 |
$content = get_post_meta( $post_id, 'divi_content_processed', true );
|
77 |
|
78 |
if ( ! empty( $content ) ) {
|
79 |
-
|
80 |
-
// wcf()->logger->import_log( $content );.
|
81 |
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
82 |
-
|
83 |
-
// wcf()->logger->import_log( $content );.
|
84 |
// Update post content.
|
85 |
wp_update_post(
|
86 |
array(
|
@@ -91,52 +72,76 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
91 |
}
|
92 |
}
|
93 |
|
94 |
-
/**
|
95 |
-
* Re process data for flow and step.
|
96 |
-
*/
|
97 |
-
function all_re_process_data() {
|
98 |
-
$this->re_process_data();
|
99 |
-
$this->re_process_data_step();
|
100 |
-
}
|
101 |
-
|
102 |
/**
|
103 |
* Re process data.
|
104 |
*/
|
105 |
-
function
|
106 |
-
|
107 |
wcf()->logger->import_log( ' Without batch started.. ' );
|
108 |
|
109 |
if ( CARTFLOWS_FLOW_POST_TYPE !== get_post_type() ) {
|
110 |
return;
|
111 |
}
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
$post_id = get_the_ID();
|
114 |
|
|
|
|
|
|
|
|
|
|
|
115 |
// wcf()->logger->import_log( ' Reprocessing Divi Data.. ' . $post_id );.
|
116 |
-
$
|
|
|
|
|
117 |
|
118 |
-
|
|
|
|
|
119 |
|
120 |
-
$steps = get_post_meta( $post_id, 'wcf-steps', true );
|
121 |
foreach ( $steps as $key => $step ) {
|
122 |
|
123 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
-
|
|
|
|
|
|
|
|
|
131 |
} else {
|
132 |
wcf()->logger->import_log( ' Already processed.. ' );
|
133 |
}
|
134 |
|
135 |
wcf()->logger->import_log( ' Without batch end.. ' );
|
136 |
|
137 |
-
// // Dispatch Queue.
|
138 |
-
// $this->batch_instance_divi_reset_data->save()->dispatch();
|
139 |
-
// wcf()->logger->import_log( '(✓) "Divi Reset Data" Request..' );
|
140 |
}
|
141 |
|
142 |
/**
|
@@ -146,35 +151,32 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
146 |
|
147 |
wcf()->logger->import_log( ' Without batch started.. ' );
|
148 |
|
149 |
-
if (
|
150 |
return;
|
151 |
}
|
152 |
|
153 |
-
|
|
|
|
|
|
|
154 |
return;
|
155 |
}
|
156 |
|
157 |
-
$
|
158 |
|
159 |
-
|
160 |
-
$processed = get_post_meta( $post_id, 'wcf_divi_data_processed', true );
|
161 |
|
162 |
-
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
} else {
|
170 |
-
wcf()->logger->import_log( ' Already processed.. ' );
|
171 |
}
|
172 |
-
|
173 |
-
wcf()->logger->import_log( ' Without batch end.. ' );
|
174 |
-
|
175 |
-
// // Dispatch Queue.
|
176 |
-
// $this->batch_instance_divi_reset_data->save()->dispatch();
|
177 |
-
// wcf()->logger->import_log( '(✓) "Divi Reset Data" Request..' );
|
178 |
}
|
179 |
|
180 |
/**
|
@@ -194,31 +196,13 @@ if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
|
194 |
|
195 |
wcf()->logger->import_log( '(✓) Processing Request..' );
|
196 |
|
197 |
-
wcf()->logger->import_log( '------------------------ BEFORE ------------------------' );
|
198 |
-
wcf()->logger->import_log( $content );
|
199 |
-
// $content = wp_slash( base64_decode( $content ) );
|
200 |
-
// wcf()->logger->import_log( '------------------------ AFTER ------------------------' );
|
201 |
-
// wcf()->logger->import_log( $content );
|
202 |
-
// wcf()->logger->import_log( 'Step link - http://localhost/m.sharkz.in/?p=' . $post_id );
|
203 |
// Update hotlink images.
|
204 |
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
205 |
|
206 |
-
//
|
207 |
update_post_meta( $post_id, 'divi_content_processed', $content );
|
208 |
|
209 |
-
// $content = get_post_meta( $post_id, 'divi_content_processed', true );
|
210 |
-
// Update post content.
|
211 |
-
wp_update_post(
|
212 |
-
array(
|
213 |
-
'ID' => $post_id,
|
214 |
-
'post_content' => $content,
|
215 |
-
)
|
216 |
-
);
|
217 |
-
|
218 |
-
do_action( 'wcf_divi_single_post_process_complete', $post_id );
|
219 |
-
|
220 |
// Delete temporary meta key.
|
221 |
-
// delete_post_meta( $post_id, 'divi_content' );.
|
222 |
wcf()->logger->import_log( '(✓) Process Complete' );
|
223 |
}
|
224 |
}
|
24 |
*/
|
25 |
private static $instance;
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* Initiator
|
29 |
*
|
44 |
* @since 1.1.1
|
45 |
*/
|
46 |
public function __construct() {
|
47 |
+
add_action( 'admin_head', array( $this, 're_process_data_flow' ) );
|
48 |
+
add_action( 'admin_head', array( $this, 're_process_data_step' ) );
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
56 |
*/
|
57 |
function reset_data( $post_id ) {
|
58 |
|
|
|
|
|
|
|
|
|
59 |
$content = get_post_meta( $post_id, 'divi_content_processed', true );
|
60 |
|
61 |
if ( ! empty( $content ) ) {
|
62 |
+
|
|
|
63 |
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
64 |
+
|
|
|
65 |
// Update post content.
|
66 |
wp_update_post(
|
67 |
array(
|
72 |
}
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* Re process data.
|
77 |
*/
|
78 |
+
function re_process_data_flow() {
|
|
|
79 |
wcf()->logger->import_log( ' Without batch started.. ' );
|
80 |
|
81 |
if ( CARTFLOWS_FLOW_POST_TYPE !== get_post_type() ) {
|
82 |
return;
|
83 |
}
|
84 |
|
85 |
+
global $pagenow;
|
86 |
+
|
87 |
+
if ( 'post.php' !== $pagenow ) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
|
91 |
+
// Is Highlight step then return!
|
92 |
+
// Because, It process only for the first flow import.
|
93 |
+
if ( isset( $_GET['highlight-step-id'] ) ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
$post_id = get_the_ID();
|
98 |
|
99 |
+
/* If Imported Flow */
|
100 |
+
if ( 'yes' !== get_post_meta( $post_id, 'cartflows_imported_flow', true ) ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
// wcf()->logger->import_log( ' Reprocessing Divi Data.. ' . $post_id );.
|
105 |
+
$flow_processed = get_post_meta( $post_id, 'wcf_divi_flow_data_processed', true );
|
106 |
+
|
107 |
+
if ( ! $flow_processed ) {
|
108 |
|
109 |
+
$steps = get_post_meta( $post_id, 'wcf-steps', true );
|
110 |
+
$steps_count = count( $steps );
|
111 |
+
$steps_remaing = $steps_count;
|
112 |
|
|
|
113 |
foreach ( $steps as $key => $step ) {
|
114 |
|
115 |
+
$step_processed = get_post_meta( $step['id'], 'wcf_divi_step_data_processed', true );
|
116 |
+
|
117 |
+
if ( ! $step_processed ) {
|
118 |
+
|
119 |
+
$content = get_post_meta( $step['id'], 'divi_content_processed', true );
|
120 |
+
// It means that batch is not complete yet.
|
121 |
+
if ( ! empty( $content ) ) {
|
122 |
+
$this->reset_data( $step['id'] );
|
123 |
|
124 |
+
wcf()->logger->import_log( ' Processing without batch.. ' . $step['id'] );
|
125 |
+
|
126 |
+
// Step processed!
|
127 |
+
update_post_meta( $step['id'], 'wcf_divi_step_data_processed', true );
|
128 |
+
|
129 |
+
$steps_remaing--;
|
130 |
+
}
|
131 |
+
}
|
132 |
}
|
133 |
|
134 |
+
// All step data processed.
|
135 |
+
if ( 0 === $steps_remaing ) {
|
136 |
+
wcf()->logger->import_log( ' ----------- FLOW COMPLETE ----------------- ' . $post_id );
|
137 |
+
update_post_meta( $post_id, 'wcf_divi_flow_data_processed', true );
|
138 |
+
}
|
139 |
} else {
|
140 |
wcf()->logger->import_log( ' Already processed.. ' );
|
141 |
}
|
142 |
|
143 |
wcf()->logger->import_log( ' Without batch end.. ' );
|
144 |
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
/**
|
151 |
|
152 |
wcf()->logger->import_log( ' Without batch started.. ' );
|
153 |
|
154 |
+
if ( CARTFLOWS_STEP_POST_TYPE !== get_post_type() ) {
|
155 |
return;
|
156 |
}
|
157 |
|
158 |
+
$post_id = get_the_ID();
|
159 |
+
|
160 |
+
/* If Imported Step */
|
161 |
+
if ( 'yes' !== get_post_meta( $post_id, 'cartflows_imported_step', true ) ) {
|
162 |
return;
|
163 |
}
|
164 |
|
165 |
+
$step_processed = get_post_meta( $post_id, 'wcf_divi_step_data_processed', true );
|
166 |
|
167 |
+
if ( ! $step_processed ) {
|
|
|
168 |
|
169 |
+
$content = get_post_meta( $post_id, 'divi_content_processed', true );
|
170 |
+
// It means that batch is not complete yet.
|
171 |
+
if ( ! empty( $content ) ) {
|
172 |
+
$this->reset_data( $post_id );
|
173 |
|
174 |
+
wcf()->logger->import_log( ' Processing without batch.. ' . $post_id );
|
175 |
|
176 |
+
// Step processed!
|
177 |
+
update_post_meta( $post_id, 'wcf_divi_step_data_processed', true );
|
178 |
+
}
|
|
|
|
|
179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
|
182 |
/**
|
196 |
|
197 |
wcf()->logger->import_log( '(✓) Processing Request..' );
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
// Update hotlink images.
|
200 |
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
201 |
|
202 |
+
// Save processed data.
|
203 |
update_post_meta( $post_id, 'divi_content_processed', $content );
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
// Delete temporary meta key.
|
|
|
206 |
wcf()->logger->import_log( '(✓) Process Complete' );
|
207 |
}
|
208 |
}
|
classes/class-cartflows-api.php
CHANGED
@@ -122,12 +122,7 @@ if ( ! class_exists( 'CartFlows_API' ) ) :
|
|
122 |
);
|
123 |
|
124 |
$response = self::remote_get( $url, $api_args );
|
125 |
-
|
126 |
-
// vl( 'Here' );.
|
127 |
-
// vl( $api_args );.
|
128 |
-
// vl( $response['data']['divi_content'] );.
|
129 |
-
// vl( 'Here too..' );.
|
130 |
-
// wp_die();.
|
131 |
if ( $response['success'] ) {
|
132 |
$template = $response['data'];
|
133 |
return array(
|
122 |
);
|
123 |
|
124 |
$response = self::remote_get( $url, $api_args );
|
125 |
+
|
|
|
|
|
|
|
|
|
|
|
126 |
if ( $response['success'] ) {
|
127 |
$template = $response['data'];
|
128 |
return array(
|
classes/class-cartflows-compatibility.php
CHANGED
@@ -1,388 +1,388 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Page builder compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class for page builder compatibility
|
12 |
-
*/
|
13 |
-
class Cartflows_Compatibility {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Member Variable
|
17 |
-
*
|
18 |
-
* @var object instance
|
19 |
-
*/
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Initiator
|
24 |
-
*/
|
25 |
-
public static function get_instance() {
|
26 |
-
if ( ! isset( self::$instance ) ) {
|
27 |
-
self::$instance = new self;
|
28 |
-
}
|
29 |
-
return self::$instance;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Constructor
|
34 |
-
*/
|
35 |
-
public function __construct() {
|
36 |
-
|
37 |
-
$this->load_files();
|
38 |
-
|
39 |
-
// Override post meta.
|
40 |
-
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
-
|
42 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Load page builder compatibility files
|
47 |
-
*/
|
48 |
-
public function load_files() {
|
49 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
-
}
|
52 |
-
|
53 |
-
if ( $this->is_divi_enabled() ) {
|
54 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
-
}
|
56 |
-
|
57 |
-
if ( $this->is_bb_enabled() ) {
|
58 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Check if it is beaver builder enabled.
|
68 |
-
*
|
69 |
-
* @since 1.1.4
|
70 |
-
*/
|
71 |
-
public function is_bb_enabled() {
|
72 |
-
|
73 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Check if elementor preview mode is on.
|
82 |
-
*/
|
83 |
-
public function is_elementor_preview_mode() {
|
84 |
-
|
85 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
86 |
-
|
87 |
-
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
88 |
-
return true;
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
return false;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Get Current Theme.
|
97 |
-
*/
|
98 |
-
public function get_current_theme() {
|
99 |
-
|
100 |
-
$theme_name = '';
|
101 |
-
$theme = wp_get_theme();
|
102 |
-
|
103 |
-
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
104 |
-
$theme_name = $theme->parent_theme;
|
105 |
-
} else {
|
106 |
-
$theme_name = $theme->name;
|
107 |
-
}
|
108 |
-
|
109 |
-
return $theme_name;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Check if it is beaver builder preview mode
|
114 |
-
*/
|
115 |
-
public function is_bb_preview_mode() {
|
116 |
-
|
117 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
118 |
-
if ( FLBuilderModel::is_builder_active() ) {
|
119 |
-
return true;
|
120 |
-
} else {
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
return false;
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Check for page builder preview mode.
|
130 |
-
*/
|
131 |
-
public function is_page_builder_preview() {
|
132 |
-
|
133 |
-
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() ) {
|
134 |
-
return true;
|
135 |
-
}
|
136 |
-
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Check if divi builder enabled for post id.
|
142 |
-
*
|
143 |
-
* @param int $post_id post id.
|
144 |
-
*/
|
145 |
-
public function is_divi_builder_enabled( $post_id ) {
|
146 |
-
|
147 |
-
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
148 |
-
return true;
|
149 |
-
}
|
150 |
-
|
151 |
-
return false;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Check if compatibility theme enabled.
|
156 |
-
*/
|
157 |
-
function is_compatibility_theme_enabled() {
|
158 |
-
|
159 |
-
$theme = wp_get_theme();
|
160 |
-
|
161 |
-
$is_compatibility = false;
|
162 |
-
|
163 |
-
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
|
164 |
-
|
165 |
-
$is_compatibility = true;
|
166 |
-
}
|
167 |
-
|
168 |
-
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Check if divi builder enabled for post id.
|
173 |
-
*
|
174 |
-
* @param object $theme theme data.
|
175 |
-
* @return boolean
|
176 |
-
*/
|
177 |
-
function is_divi_enabled( $theme = false ) {
|
178 |
-
|
179 |
-
if ( ! $theme ) {
|
180 |
-
$theme = wp_get_theme();
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
|
184 |
-
return true;
|
185 |
-
}
|
186 |
-
|
187 |
-
return false;
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Check if Divi theme is install status.
|
192 |
-
*
|
193 |
-
* @return boolean
|
194 |
-
*/
|
195 |
-
function is_divi_theme_installed() {
|
196 |
-
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
197 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
|
198 |
-
return true;
|
199 |
-
}
|
200 |
-
}
|
201 |
-
return false;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Check if Flatsome enabled for post id.
|
206 |
-
*
|
207 |
-
* @param object $theme theme data.
|
208 |
-
* @return boolean
|
209 |
-
*/
|
210 |
-
function is_flatsome_enabled( $theme = false ) {
|
211 |
-
|
212 |
-
if ( ! $theme ) {
|
213 |
-
$theme = wp_get_theme();
|
214 |
-
}
|
215 |
-
|
216 |
-
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
217 |
-
return true;
|
218 |
-
}
|
219 |
-
|
220 |
-
return false;
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Check if The7 enabled for post id.
|
225 |
-
*
|
226 |
-
* @param object $theme theme data.
|
227 |
-
* @return boolean
|
228 |
-
*/
|
229 |
-
function is_the_seven_enabled( $theme = false ) {
|
230 |
-
|
231 |
-
if ( ! $theme ) {
|
232 |
-
$theme = wp_get_theme();
|
233 |
-
}
|
234 |
-
|
235 |
-
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
236 |
-
return true;
|
237 |
-
}
|
238 |
-
|
239 |
-
return false;
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Check if OceanWp enabled for post id.
|
244 |
-
*
|
245 |
-
* @param object $theme theme data.
|
246 |
-
* @return boolean
|
247 |
-
*/
|
248 |
-
function is_oceanwp_enabled( $theme = false ) {
|
249 |
-
|
250 |
-
if ( ! $theme ) {
|
251 |
-
$theme = wp_get_theme();
|
252 |
-
}
|
253 |
-
|
254 |
-
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
255 |
-
return true;
|
256 |
-
}
|
257 |
-
|
258 |
-
return false;
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Check for thrive architect edit page.
|
263 |
-
*
|
264 |
-
* @param int $post_id post id.
|
265 |
-
*/
|
266 |
-
public function is_thrive_edit_page( $post_id ) {
|
267 |
-
|
268 |
-
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
269 |
-
return true;
|
270 |
-
} else {
|
271 |
-
return false;
|
272 |
-
}
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Check if the page being rendered is the main ID on the editor page.
|
277 |
-
*
|
278 |
-
* @since 1.0.0
|
279 |
-
* @param String $post_id Post ID which is to be rendered.
|
280 |
-
* @return boolean True if current if is being rendered is not being edited.
|
281 |
-
*/
|
282 |
-
private function is_thrive_builder_page( $post_id ) {
|
283 |
-
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
|
284 |
-
$post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
|
285 |
-
|
286 |
-
return ( true == $tve && $post_id !== $post );
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Overwrite meta for page
|
291 |
-
*/
|
292 |
-
public function override_meta() {
|
293 |
-
|
294 |
-
// don't override meta for `elementor_library` post type.
|
295 |
-
if ( 'elementor_library' == get_post_type() ) {
|
296 |
-
return;
|
297 |
-
}
|
298 |
-
|
299 |
-
if ( ! is_singular() ) {
|
300 |
-
return;
|
301 |
-
}
|
302 |
-
|
303 |
-
global $post;
|
304 |
-
$post_id = $post->ID;
|
305 |
-
$post_type = get_post_type();
|
306 |
-
|
307 |
-
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
308 |
-
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
309 |
-
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
310 |
-
|
311 |
-
if ( '' == $post->post_content ) {
|
312 |
-
|
313 |
-
$this->overwrite_template( $post_id );
|
314 |
-
}
|
315 |
-
}
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Assign cartflow canvas template to page.
|
320 |
-
*
|
321 |
-
* @param int $post_id post ID.
|
322 |
-
*/
|
323 |
-
public function overwrite_template( $post_id ) {
|
324 |
-
|
325 |
-
$template = 'cartflows-canvas';
|
326 |
-
$key = '_wp_page_template';
|
327 |
-
|
328 |
-
$record_exists = get_post_meta( $post_id, $key, true );
|
329 |
-
|
330 |
-
if ( 'cartflows-canvas' == $record_exists ) {
|
331 |
-
return;
|
332 |
-
}
|
333 |
-
|
334 |
-
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
335 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
336 |
-
|
337 |
-
global $wpdb;
|
338 |
-
|
339 |
-
if ( '' == $record_exists || ! $record_exists ) {
|
340 |
-
|
341 |
-
$wpdb->insert(
|
342 |
-
$wpdb->prefix . 'postmeta',
|
343 |
-
array(
|
344 |
-
'post_id' => $post_id,
|
345 |
-
'meta_key' => $key,
|
346 |
-
'meta_value' => $template, // ... and so on
|
347 |
-
)
|
348 |
-
);
|
349 |
-
} else {
|
350 |
-
|
351 |
-
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
|
352 |
-
}
|
353 |
-
} else {
|
354 |
-
|
355 |
-
update_post_meta( $post_id, $key, $template );
|
356 |
-
}
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Load font awesome style from oceanwp on checkout page.
|
361 |
-
*/
|
362 |
-
public function load_fontawesome() {
|
363 |
-
|
364 |
-
$theme = get_template();
|
365 |
-
|
366 |
-
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
367 |
-
|
368 |
-
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
369 |
-
|
370 |
-
if ( $load_fa ) {
|
371 |
-
|
372 |
-
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
|
373 |
-
}
|
374 |
-
|
375 |
-
$custom_css = '
|
376 |
-
#oceanwp-cart-sidebar-wrap,
|
377 |
-
#owp-qv-wrap{
|
378 |
-
display: none;
|
379 |
-
}';
|
380 |
-
|
381 |
-
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
382 |
-
}
|
383 |
-
}
|
384 |
-
}
|
385 |
-
}
|
386 |
-
|
387 |
-
Cartflows_Compatibility::get_instance();
|
388 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Page builder compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class for page builder compatibility
|
12 |
+
*/
|
13 |
+
class Cartflows_Compatibility {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Member Variable
|
17 |
+
*
|
18 |
+
* @var object instance
|
19 |
+
*/
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initiator
|
24 |
+
*/
|
25 |
+
public static function get_instance() {
|
26 |
+
if ( ! isset( self::$instance ) ) {
|
27 |
+
self::$instance = new self;
|
28 |
+
}
|
29 |
+
return self::$instance;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Constructor
|
34 |
+
*/
|
35 |
+
public function __construct() {
|
36 |
+
|
37 |
+
$this->load_files();
|
38 |
+
|
39 |
+
// Override post meta.
|
40 |
+
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
+
|
42 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Load page builder compatibility files
|
47 |
+
*/
|
48 |
+
public function load_files() {
|
49 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( $this->is_divi_enabled() ) {
|
54 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( $this->is_bb_enabled() ) {
|
58 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check if it is beaver builder enabled.
|
68 |
+
*
|
69 |
+
* @since 1.1.4
|
70 |
+
*/
|
71 |
+
public function is_bb_enabled() {
|
72 |
+
|
73 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Check if elementor preview mode is on.
|
82 |
+
*/
|
83 |
+
public function is_elementor_preview_mode() {
|
84 |
+
|
85 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
86 |
+
|
87 |
+
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get Current Theme.
|
97 |
+
*/
|
98 |
+
public function get_current_theme() {
|
99 |
+
|
100 |
+
$theme_name = '';
|
101 |
+
$theme = wp_get_theme();
|
102 |
+
|
103 |
+
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
104 |
+
$theme_name = $theme->parent_theme;
|
105 |
+
} else {
|
106 |
+
$theme_name = $theme->name;
|
107 |
+
}
|
108 |
+
|
109 |
+
return $theme_name;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check if it is beaver builder preview mode
|
114 |
+
*/
|
115 |
+
public function is_bb_preview_mode() {
|
116 |
+
|
117 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
118 |
+
if ( FLBuilderModel::is_builder_active() ) {
|
119 |
+
return true;
|
120 |
+
} else {
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
return false;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Check for page builder preview mode.
|
130 |
+
*/
|
131 |
+
public function is_page_builder_preview() {
|
132 |
+
|
133 |
+
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() ) {
|
134 |
+
return true;
|
135 |
+
}
|
136 |
+
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Check if divi builder enabled for post id.
|
142 |
+
*
|
143 |
+
* @param int $post_id post id.
|
144 |
+
*/
|
145 |
+
public function is_divi_builder_enabled( $post_id ) {
|
146 |
+
|
147 |
+
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
148 |
+
return true;
|
149 |
+
}
|
150 |
+
|
151 |
+
return false;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Check if compatibility theme enabled.
|
156 |
+
*/
|
157 |
+
function is_compatibility_theme_enabled() {
|
158 |
+
|
159 |
+
$theme = wp_get_theme();
|
160 |
+
|
161 |
+
$is_compatibility = false;
|
162 |
+
|
163 |
+
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
|
164 |
+
|
165 |
+
$is_compatibility = true;
|
166 |
+
}
|
167 |
+
|
168 |
+
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Check if divi builder enabled for post id.
|
173 |
+
*
|
174 |
+
* @param object $theme theme data.
|
175 |
+
* @return boolean
|
176 |
+
*/
|
177 |
+
function is_divi_enabled( $theme = false ) {
|
178 |
+
|
179 |
+
if ( ! $theme ) {
|
180 |
+
$theme = wp_get_theme();
|
181 |
+
}
|
182 |
+
|
183 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
|
184 |
+
return true;
|
185 |
+
}
|
186 |
+
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Check if Divi theme is install status.
|
192 |
+
*
|
193 |
+
* @return boolean
|
194 |
+
*/
|
195 |
+
function is_divi_theme_installed() {
|
196 |
+
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
197 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
|
198 |
+
return true;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
return false;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Check if Flatsome enabled for post id.
|
206 |
+
*
|
207 |
+
* @param object $theme theme data.
|
208 |
+
* @return boolean
|
209 |
+
*/
|
210 |
+
function is_flatsome_enabled( $theme = false ) {
|
211 |
+
|
212 |
+
if ( ! $theme ) {
|
213 |
+
$theme = wp_get_theme();
|
214 |
+
}
|
215 |
+
|
216 |
+
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
217 |
+
return true;
|
218 |
+
}
|
219 |
+
|
220 |
+
return false;
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Check if The7 enabled for post id.
|
225 |
+
*
|
226 |
+
* @param object $theme theme data.
|
227 |
+
* @return boolean
|
228 |
+
*/
|
229 |
+
function is_the_seven_enabled( $theme = false ) {
|
230 |
+
|
231 |
+
if ( ! $theme ) {
|
232 |
+
$theme = wp_get_theme();
|
233 |
+
}
|
234 |
+
|
235 |
+
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
236 |
+
return true;
|
237 |
+
}
|
238 |
+
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Check if OceanWp enabled for post id.
|
244 |
+
*
|
245 |
+
* @param object $theme theme data.
|
246 |
+
* @return boolean
|
247 |
+
*/
|
248 |
+
function is_oceanwp_enabled( $theme = false ) {
|
249 |
+
|
250 |
+
if ( ! $theme ) {
|
251 |
+
$theme = wp_get_theme();
|
252 |
+
}
|
253 |
+
|
254 |
+
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
255 |
+
return true;
|
256 |
+
}
|
257 |
+
|
258 |
+
return false;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Check for thrive architect edit page.
|
263 |
+
*
|
264 |
+
* @param int $post_id post id.
|
265 |
+
*/
|
266 |
+
public function is_thrive_edit_page( $post_id ) {
|
267 |
+
|
268 |
+
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
269 |
+
return true;
|
270 |
+
} else {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Check if the page being rendered is the main ID on the editor page.
|
277 |
+
*
|
278 |
+
* @since 1.0.0
|
279 |
+
* @param String $post_id Post ID which is to be rendered.
|
280 |
+
* @return boolean True if current if is being rendered is not being edited.
|
281 |
+
*/
|
282 |
+
private function is_thrive_builder_page( $post_id ) {
|
283 |
+
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
|
284 |
+
$post = isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : false;
|
285 |
+
|
286 |
+
return ( true == $tve && $post_id !== $post );
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Overwrite meta for page
|
291 |
+
*/
|
292 |
+
public function override_meta() {
|
293 |
+
|
294 |
+
// don't override meta for `elementor_library` post type.
|
295 |
+
if ( 'elementor_library' == get_post_type() ) {
|
296 |
+
return;
|
297 |
+
}
|
298 |
+
|
299 |
+
if ( ! is_singular() ) {
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
|
303 |
+
global $post;
|
304 |
+
$post_id = $post->ID;
|
305 |
+
$post_type = get_post_type();
|
306 |
+
|
307 |
+
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
308 |
+
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
309 |
+
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
310 |
+
|
311 |
+
if ( '' == $post->post_content ) {
|
312 |
+
|
313 |
+
$this->overwrite_template( $post_id );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Assign cartflow canvas template to page.
|
320 |
+
*
|
321 |
+
* @param int $post_id post ID.
|
322 |
+
*/
|
323 |
+
public function overwrite_template( $post_id ) {
|
324 |
+
|
325 |
+
$template = 'cartflows-canvas';
|
326 |
+
$key = '_wp_page_template';
|
327 |
+
|
328 |
+
$record_exists = get_post_meta( $post_id, $key, true );
|
329 |
+
|
330 |
+
if ( 'cartflows-canvas' == $record_exists ) {
|
331 |
+
return;
|
332 |
+
}
|
333 |
+
|
334 |
+
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
335 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
336 |
+
|
337 |
+
global $wpdb;
|
338 |
+
|
339 |
+
if ( '' == $record_exists || ! $record_exists ) {
|
340 |
+
|
341 |
+
$wpdb->insert(
|
342 |
+
$wpdb->prefix . 'postmeta',
|
343 |
+
array(
|
344 |
+
'post_id' => $post_id,
|
345 |
+
'meta_key' => $key,
|
346 |
+
'meta_value' => $template, // ... and so on
|
347 |
+
)
|
348 |
+
);
|
349 |
+
} else {
|
350 |
+
|
351 |
+
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) );
|
352 |
+
}
|
353 |
+
} else {
|
354 |
+
|
355 |
+
update_post_meta( $post_id, $key, $template );
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Load font awesome style from oceanwp on checkout page.
|
361 |
+
*/
|
362 |
+
public function load_fontawesome() {
|
363 |
+
|
364 |
+
$theme = get_template();
|
365 |
+
|
366 |
+
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
367 |
+
|
368 |
+
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
369 |
+
|
370 |
+
if ( $load_fa ) {
|
371 |
+
|
372 |
+
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );
|
373 |
+
}
|
374 |
+
|
375 |
+
$custom_css = '
|
376 |
+
#oceanwp-cart-sidebar-wrap,
|
377 |
+
#owp-qv-wrap{
|
378 |
+
display: none;
|
379 |
+
}';
|
380 |
+
|
381 |
+
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
Cartflows_Compatibility::get_instance();
|
388 |
+
|
classes/class-cartflows-default-meta.php
CHANGED
@@ -34,7 +34,6 @@ class Cartflows_Default_Meta {
|
|
34 |
*/
|
35 |
private static $thankyou_fields = null;
|
36 |
|
37 |
-
|
38 |
/**
|
39 |
* Member Variable
|
40 |
*
|
@@ -42,6 +41,13 @@ class Cartflows_Default_Meta {
|
|
42 |
*/
|
43 |
private static $flow_fields = null;
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* Initiator
|
47 |
*/
|
@@ -218,6 +224,10 @@ class Cartflows_Default_Meta {
|
|
218 |
'default' => '',
|
219 |
'sanitize' => 'FILTER_DEFAULT',
|
220 |
),
|
|
|
|
|
|
|
|
|
221 |
);
|
222 |
|
223 |
self::$checkout_fields = apply_filters( 'cartflows_checkout_meta_options', self::$checkout_fields, $post_id );
|
@@ -239,6 +249,32 @@ class Cartflows_Default_Meta {
|
|
239 |
$this->save_meta_fields( $post_id, $post_meta );
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
/**
|
243 |
* Flow Default fields.
|
244 |
*
|
@@ -792,6 +828,10 @@ class Cartflows_Default_Meta {
|
|
792 |
'default' => 'yes',
|
793 |
'sanitize' => 'FILTER_DEFAULT',
|
794 |
),
|
|
|
|
|
|
|
|
|
795 |
);
|
796 |
|
797 |
}
|
@@ -829,6 +869,55 @@ class Cartflows_Default_Meta {
|
|
829 |
|
830 |
return $value;
|
831 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
832 |
}
|
833 |
|
834 |
/**
|
34 |
*/
|
35 |
private static $thankyou_fields = null;
|
36 |
|
|
|
37 |
/**
|
38 |
* Member Variable
|
39 |
*
|
41 |
*/
|
42 |
private static $flow_fields = null;
|
43 |
|
44 |
+
/**
|
45 |
+
* Member Variable
|
46 |
+
*
|
47 |
+
* @var landing_fields
|
48 |
+
*/
|
49 |
+
private static $landing_fields = null;
|
50 |
+
|
51 |
/**
|
52 |
* Initiator
|
53 |
*/
|
224 |
'default' => '',
|
225 |
'sanitize' => 'FILTER_DEFAULT',
|
226 |
),
|
227 |
+
'wcf-custom-script' => array(
|
228 |
+
'default' => '',
|
229 |
+
'sanitize' => 'FILTER_DEFAULT',
|
230 |
+
),
|
231 |
);
|
232 |
|
233 |
self::$checkout_fields = apply_filters( 'cartflows_checkout_meta_options', self::$checkout_fields, $post_id );
|
249 |
$this->save_meta_fields( $post_id, $post_meta );
|
250 |
}
|
251 |
|
252 |
+
/**
|
253 |
+
* Save Landing Meta fields.
|
254 |
+
*
|
255 |
+
* @param int $post_id post id.
|
256 |
+
* @return void
|
257 |
+
*/
|
258 |
+
function save_landing_fields( $post_id ) {
|
259 |
+
|
260 |
+
$post_meta = $this->get_landing_fields( $post_id );
|
261 |
+
|
262 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Save ThankYou Meta fields.
|
267 |
+
*
|
268 |
+
* @param int $post_id post id.
|
269 |
+
* @return void
|
270 |
+
*/
|
271 |
+
function save_thankyou_fields( $post_id ) {
|
272 |
+
|
273 |
+
$post_meta = $this->get_thankyou_fields( $post_id );
|
274 |
+
|
275 |
+
$this->save_meta_fields( $post_id, $post_meta );
|
276 |
+
}
|
277 |
+
|
278 |
/**
|
279 |
* Flow Default fields.
|
280 |
*
|
828 |
'default' => 'yes',
|
829 |
'sanitize' => 'FILTER_DEFAULT',
|
830 |
),
|
831 |
+
'wcf-custom-script' => array(
|
832 |
+
'default' => '',
|
833 |
+
'sanitize' => 'FILTER_DEFAULT',
|
834 |
+
),
|
835 |
);
|
836 |
|
837 |
}
|
869 |
|
870 |
return $value;
|
871 |
}
|
872 |
+
|
873 |
+
/**
|
874 |
+
* Get Landing section meta.
|
875 |
+
*
|
876 |
+
* @param int $post_id post id.
|
877 |
+
* @param string $key options key.
|
878 |
+
* @param mix $default options default value.
|
879 |
+
* @return string
|
880 |
+
*/
|
881 |
+
function get_landing_meta_value( $post_id, $key, $default = false ) {
|
882 |
+
|
883 |
+
$value = $this->get_save_meta( $post_id, $key );
|
884 |
+
if ( ! $value ) {
|
885 |
+
|
886 |
+
if ( $default ) {
|
887 |
+
|
888 |
+
$value = $default;
|
889 |
+
} else {
|
890 |
+
|
891 |
+
$fields = $this->get_landing_fields( $post_id );
|
892 |
+
|
893 |
+
if ( isset( $fields[ $key ]['default'] ) ) {
|
894 |
+
$value = $fields[ $key ]['default'];
|
895 |
+
}
|
896 |
+
}
|
897 |
+
}
|
898 |
+
|
899 |
+
return $value;
|
900 |
+
}
|
901 |
+
|
902 |
+
/**
|
903 |
+
* Thank You Default fields.
|
904 |
+
*
|
905 |
+
* @param int $post_id post id.
|
906 |
+
* @return array
|
907 |
+
*/
|
908 |
+
function get_landing_fields( $post_id ) {
|
909 |
+
|
910 |
+
if ( null === self::$landing_fields ) {
|
911 |
+
|
912 |
+
self::$landing_fields = array(
|
913 |
+
'wcf-custom-script' => array(
|
914 |
+
'default' => '',
|
915 |
+
'sanitize' => 'FILTER_DEFAULT',
|
916 |
+
),
|
917 |
+
);
|
918 |
+
}
|
919 |
+
return apply_filters( 'cartflows_landing_meta_options', self::$landing_fields, $post_id );
|
920 |
+
}
|
921 |
}
|
922 |
|
923 |
/**
|
classes/class-cartflows-frontend.php
CHANGED
@@ -1,402 +1,430 @@
|
|
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 |
-
/* Enqueue global required scripts */
|
39 |
-
add_action( 'wp', array( $this, 'wp_actions' ), 55 );
|
40 |
-
|
41 |
-
/* Modify the checkout order received url to go thank you page in our flow */
|
42 |
-
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
*
|
48 |
-
*
|
49 |
-
* @param
|
50 |
-
* @
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
wcf()->logger->log( '
|
57 |
-
|
58 |
-
|
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 |
-
'wcf-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
*
|
100 |
-
*
|
101 |
-
* @
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
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 |
-
global $
|
145 |
-
|
146 |
-
|
147 |
-
$
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
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 |
-
add_action( 'wp_enqueue_scripts', array( $this, '
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/* Enqueue global required scripts */
|
39 |
+
add_action( 'wp', array( $this, 'wp_actions' ), 55 );
|
40 |
+
|
41 |
+
/* Modify the checkout order received url to go thank you page in our flow */
|
42 |
+
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Redirect to thank page if upsell not exists
|
48 |
+
*
|
49 |
+
* @param string $order_recieve_url url.
|
50 |
+
* @param object $order order object.
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
function redirect_to_thankyou_page( $order_recieve_url, $order ) {
|
54 |
+
|
55 |
+
/* Only for thank you page */
|
56 |
+
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
|
57 |
+
wcf()->logger->log( 'Only for thank you page' );
|
58 |
+
|
59 |
+
if ( wcf()->flow->is_thankyou_page_exists( $order ) ) {
|
60 |
+
|
61 |
+
if ( _is_wcf_doing_checkout_ajax() ) {
|
62 |
+
|
63 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
64 |
+
|
65 |
+
if ( ! $checkout_id ) {
|
66 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
67 |
+
}
|
68 |
+
} else {
|
69 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
70 |
+
}
|
71 |
+
|
72 |
+
wcf()->logger->log( 'Checkout ID : ' . $checkout_id );
|
73 |
+
|
74 |
+
if ( $checkout_id ) {
|
75 |
+
|
76 |
+
$thankyou_step_id = wcf()->flow->get_thankyou_page_id( $order );
|
77 |
+
|
78 |
+
if ( $thankyou_step_id ) {
|
79 |
+
|
80 |
+
$order_recieve_url = get_permalink( $thankyou_step_id );
|
81 |
+
|
82 |
+
$order_recieve_url = add_query_arg(
|
83 |
+
array(
|
84 |
+
'wcf-order' => $order->get_id(),
|
85 |
+
'wcf-key' => $order->get_order_key(),
|
86 |
+
),
|
87 |
+
$order_recieve_url
|
88 |
+
);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
|
94 |
+
|
95 |
+
return $order_recieve_url;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Cancel and redirect to checkout
|
100 |
+
*
|
101 |
+
* @param string $return_url url.
|
102 |
+
* @since 1.0.0
|
103 |
+
*/
|
104 |
+
function redirect_to_checkout_on_cancel( $return_url ) {
|
105 |
+
|
106 |
+
if ( _is_wcf_doing_checkout_ajax() ) {
|
107 |
+
|
108 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
|
109 |
+
|
110 |
+
if ( ! $checkout_id ) {
|
111 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( $checkout_id ) {
|
118 |
+
|
119 |
+
$return_url = add_query_arg(
|
120 |
+
array(
|
121 |
+
'cancel_order' => 'true',
|
122 |
+
'_wpnonce' => wp_create_nonce( 'woocommerce-cancel_order' ),
|
123 |
+
),
|
124 |
+
get_permalink( $checkout_id )
|
125 |
+
);
|
126 |
+
}
|
127 |
+
|
128 |
+
return $return_url;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Remove theme styles.
|
134 |
+
*
|
135 |
+
* @since 1.0.0
|
136 |
+
*/
|
137 |
+
function remove_theme_styles() {
|
138 |
+
|
139 |
+
if ( Cartflows_Compatibility::get_instance()->is_compatibility_theme_enabled() ) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
+
// get all styles data.
|
144 |
+
global $wp_styles;
|
145 |
+
global $wp_scripts;
|
146 |
+
|
147 |
+
$get_stylesheet = 'themes/' . get_stylesheet() . '/';
|
148 |
+
$get_template = 'themes/' . get_template() . '/';
|
149 |
+
|
150 |
+
$remove_styles = apply_filters( 'cartflows_remove_theme_styles', true );
|
151 |
+
|
152 |
+
if ( $remove_styles ) {
|
153 |
+
|
154 |
+
// loop over all of the registered scripts..
|
155 |
+
foreach ( $wp_styles->registered as $handle => $data ) {
|
156 |
+
|
157 |
+
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
|
158 |
+
|
159 |
+
// remove it.
|
160 |
+
wp_deregister_style( $handle );
|
161 |
+
wp_dequeue_style( $handle );
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
$remove_scripts = apply_filters( 'cartflows_remove_theme_scripts', true );
|
167 |
+
|
168 |
+
if ( $remove_scripts ) {
|
169 |
+
|
170 |
+
// loop over all of the registered scripts.
|
171 |
+
foreach ( $wp_scripts->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_script( $handle );
|
177 |
+
wp_dequeue_script( $handle );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Update main order data in transient.
|
186 |
+
*
|
187 |
+
* @param array $woo_styles new styles array.
|
188 |
+
* @since 1.0.0
|
189 |
+
* @return array.
|
190 |
+
*/
|
191 |
+
function woo_default_css( $woo_styles ) {
|
192 |
+
|
193 |
+
$woo_styles = array(
|
194 |
+
'woocommerce-layout' => array(
|
195 |
+
'src' => plugins_url( 'assets/css/woocommerce-layout.css', WC_PLUGIN_FILE ),
|
196 |
+
'deps' => '',
|
197 |
+
'version' => WC_VERSION,
|
198 |
+
'media' => 'all',
|
199 |
+
'has_rtl' => true,
|
200 |
+
),
|
201 |
+
'woocommerce-smallscreen' => array(
|
202 |
+
'src' => plugins_url( 'assets/css/woocommerce-smallscreen.css', WC_PLUGIN_FILE ),
|
203 |
+
'deps' => 'woocommerce-layout',
|
204 |
+
'version' => WC_VERSION,
|
205 |
+
'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', '768px' ) . ')',
|
206 |
+
'has_rtl' => true,
|
207 |
+
),
|
208 |
+
'woocommerce-general' => array(
|
209 |
+
'src' => plugins_url( 'assets/css/woocommerce.css', WC_PLUGIN_FILE ),
|
210 |
+
'deps' => '',
|
211 |
+
'version' => WC_VERSION,
|
212 |
+
'media' => 'all',
|
213 |
+
'has_rtl' => true,
|
214 |
+
),
|
215 |
+
);
|
216 |
+
|
217 |
+
return $woo_styles;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Init Actions.
|
222 |
+
*
|
223 |
+
* @since 1.0.0
|
224 |
+
*/
|
225 |
+
function init_actions() {
|
226 |
+
|
227 |
+
$this->set_flow_session();
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Set flow session.
|
232 |
+
*
|
233 |
+
* @since 1.0.0
|
234 |
+
*/
|
235 |
+
function set_flow_session() {
|
236 |
+
|
237 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
238 |
+
|
239 |
+
add_action( 'wp_head', array( $this, 'noindex_flow' ) );
|
240 |
+
|
241 |
+
wcf()->utils->do_not_cache();
|
242 |
+
|
243 |
+
/* Set key to support pixel */
|
244 |
+
if ( isset( $_GET['wcf-key'] ) ) {
|
245 |
+
$_GET['key'] = $_GET['wcf-key'];
|
246 |
+
$_REQUEST['key'] = $_GET['wcf-key'];
|
247 |
+
}
|
248 |
+
|
249 |
+
if ( isset( $_GET['wcf-order'] ) ) {
|
250 |
+
$_GET['order'] = $_GET['wcf-order'];
|
251 |
+
$_REQUEST['order'] = $_GET['wcf-order'];
|
252 |
+
$_GET['order-received'] = $_GET['wcf-order'];
|
253 |
+
$_REQUEST['order-received'] = $_GET['wcf-order'];
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Add noindex, nofollow.
|
260 |
+
*
|
261 |
+
* @since 1.0.0
|
262 |
+
*/
|
263 |
+
function noindex_flow() {
|
264 |
+
|
265 |
+
$common = Cartflows_Helper::get_common_settings();
|
266 |
+
|
267 |
+
if ( 'enable' === $common['disallow_indexing'] ) {
|
268 |
+
echo '<meta name="robots" content="noindex,nofollow">';
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* WP Actions.
|
274 |
+
*
|
275 |
+
* @since 1.0.0
|
276 |
+
*/
|
277 |
+
function wp_actions() {
|
278 |
+
|
279 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
280 |
+
|
281 |
+
/* CSS Compatibility for All theme */
|
282 |
+
add_filter( 'woocommerce_enqueue_styles', array( $this, 'woo_default_css' ), 9999 );
|
283 |
+
|
284 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'remove_theme_styles' ), 9999 );
|
285 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'global_flow_scripts' ), 20 );
|
286 |
+
|
287 |
+
/* Load woo templates from plugin */
|
288 |
+
add_filter( 'woocommerce_locate_template', array( $this, 'override_woo_template' ), 20, 3 );
|
289 |
+
|
290 |
+
/* Add version class to body in frontend. */
|
291 |
+
add_filter( 'body_class', array( $this, 'add_cartflows_lite_version_to_body' ) );
|
292 |
+
|
293 |
+
/* Remove the action applied by the Flatsome theme */
|
294 |
+
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
295 |
+
$this->remove_flatsome_action();
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Global flow scripts.
|
302 |
+
*
|
303 |
+
* @since 1.0.0
|
304 |
+
*/
|
305 |
+
function global_flow_scripts() {
|
306 |
+
|
307 |
+
global $post;
|
308 |
+
|
309 |
+
$flow = get_post_meta( $post->ID, 'wcf-flow-id', true );
|
310 |
+
$current_step = $post->ID;
|
311 |
+
$next_step_link = '';
|
312 |
+
$compatibility = Cartflows_Compatibility::get_instance();
|
313 |
+
|
314 |
+
if ( _is_wcf_landing_type() ) {
|
315 |
+
|
316 |
+
$next_step_id = wcf()->utils->get_next_step_id( $flow, $current_step );
|
317 |
+
$next_step_link = get_permalink( $next_step_id );
|
318 |
+
}
|
319 |
+
|
320 |
+
$localize = array(
|
321 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
322 |
+
'is_pb_preview' => $compatibility->is_page_builder_preview(),
|
323 |
+
'current_theme' => $compatibility->get_current_theme(),
|
324 |
+
'current_flow' => $flow,
|
325 |
+
'current_step' => $current_step,
|
326 |
+
'next_step' => $next_step_link,
|
327 |
+
);
|
328 |
+
|
329 |
+
wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
|
330 |
+
|
331 |
+
wp_enqueue_style( 'wcf-frontend-global', CARTFLOWS_URL . 'assets/css/frontend.css', array(), CARTFLOWS_VER );
|
332 |
+
wp_style_add_data( 'wcf-frontend-global', 'rtl', 'replace' );
|
333 |
+
|
334 |
+
wp_enqueue_script(
|
335 |
+
'wcf-frontend-global',
|
336 |
+
CARTFLOWS_URL . 'assets/js/frontend.js',
|
337 |
+
array( 'jquery' ),
|
338 |
+
CARTFLOWS_VER,
|
339 |
+
true
|
340 |
+
);
|
341 |
+
|
342 |
+
/* Add custom script to header in frontend. */
|
343 |
+
$script = $this->get_custom_script();
|
344 |
+
|
345 |
+
if ( '' !== $script ) {
|
346 |
+
|
347 |
+
$script = str_replace( '<script>', '', $script );
|
348 |
+
$script = str_replace( '</script>', '', $script );
|
349 |
+
|
350 |
+
wp_register_script( 'wcf-custom-script-head', '' );
|
351 |
+
wp_enqueue_script( 'wcf-custom-script-head' );
|
352 |
+
wp_add_inline_script( 'wcf-custom-script-head', $script );
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Override woo templates.
|
358 |
+
*
|
359 |
+
* @param string $template new Template full path.
|
360 |
+
* @param string $template_name Template name.
|
361 |
+
* @param string $template_path Template Path.
|
362 |
+
* @since 1.1.5
|
363 |
+
* @return string.
|
364 |
+
*/
|
365 |
+
function override_woo_template( $template, $template_name, $template_path ) {
|
366 |
+
|
367 |
+
global $woocommerce;
|
368 |
+
|
369 |
+
$_template = $template;
|
370 |
+
|
371 |
+
$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
|
372 |
+
|
373 |
+
if ( file_exists( $plugin_path . $template_name ) ) {
|
374 |
+
$template = $plugin_path . $template_name;
|
375 |
+
}
|
376 |
+
|
377 |
+
if ( ! $template ) {
|
378 |
+
$template = $_template;
|
379 |
+
}
|
380 |
+
|
381 |
+
return $template;
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Remove the action applied by the Flatsome theme.
|
386 |
+
*
|
387 |
+
* @since 1.1.5
|
388 |
+
* @return void.
|
389 |
+
*/
|
390 |
+
function remove_flatsome_action() {
|
391 |
+
|
392 |
+
// Remove action where flatsome dequeued the woocommerce's default styles.
|
393 |
+
remove_action( 'wp_enqueue_scripts', 'flatsome_woocommerce_scripts_styles', 98 );
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Add version class to body in frontend.
|
398 |
+
*
|
399 |
+
* @since 1.1.5
|
400 |
+
* @param array $classes classes.
|
401 |
+
* @return array $classes classes.
|
402 |
+
*/
|
403 |
+
function add_cartflows_lite_version_to_body( $classes ) {
|
404 |
+
|
405 |
+
$classes[] = 'cartflows-' . CARTFLOWS_VER;
|
406 |
+
|
407 |
+
return $classes;
|
408 |
+
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Get custom script data.
|
413 |
+
*
|
414 |
+
* @since 1.0.0
|
415 |
+
*/
|
416 |
+
function get_custom_script() {
|
417 |
+
|
418 |
+
global $post;
|
419 |
+
|
420 |
+
$script = get_post_meta( $post->ID, 'wcf-custom-script', true );
|
421 |
+
|
422 |
+
return $script;
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Prepare if class 'Cartflows_Frontend' exist.
|
428 |
+
* Kicking this off by calling 'get_instance()' method
|
429 |
+
*/
|
430 |
+
Cartflows_Frontend::get_instance();
|
classes/class-cartflows-helper.php
CHANGED
@@ -1,458 +1,458 @@
|
|
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 |
-
* Installed Plugins
|
26 |
-
*
|
27 |
-
* @since 1.1.4
|
28 |
-
*
|
29 |
-
* @access private
|
30 |
-
* @var array Installed plugins list.
|
31 |
-
*/
|
32 |
-
private static $installed_plugins = null;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Checkout Fields
|
36 |
-
*
|
37 |
-
* @var checkout_fields
|
38 |
-
*/
|
39 |
-
private static $checkout_fields = null;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Returns an option from the database for
|
43 |
-
* the admin settings page.
|
44 |
-
*
|
45 |
-
* @param string $key The option key.
|
46 |
-
* @param mixed $default Option default value if option is not available.
|
47 |
-
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
48 |
-
* @return string Return the option value
|
49 |
-
*/
|
50 |
-
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
51 |
-
|
52 |
-
// Get the site-wide option if we're in the network admin.
|
53 |
-
if ( $network_override && is_multisite() ) {
|
54 |
-
$value = get_site_option( $key, $default );
|
55 |
-
} else {
|
56 |
-
$value = get_option( $key, $default );
|
57 |
-
}
|
58 |
-
|
59 |
-
return $value;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Updates an option from the admin settings page.
|
64 |
-
*
|
65 |
-
* @param string $key The option key.
|
66 |
-
* @param mixed $value The value to update.
|
67 |
-
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
68 |
-
* @return mixed
|
69 |
-
*/
|
70 |
-
static public function update_admin_settings_option( $key, $value, $network = false ) {
|
71 |
-
|
72 |
-
// Update the site-wide option since we're in the network admin.
|
73 |
-
if ( $network && is_multisite() ) {
|
74 |
-
update_site_option( $key, $value );
|
75 |
-
} else {
|
76 |
-
update_option( $key, $value );
|
77 |
-
}
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Get single setting
|
83 |
-
*
|
84 |
-
* @since 1.1.4
|
85 |
-
*
|
86 |
-
* @param string $key Option key.
|
87 |
-
* @param string $default Option default value if not exist.
|
88 |
-
* @return mixed
|
89 |
-
*/
|
90 |
-
static public function get_common_setting( $key = '', $default = '' ) {
|
91 |
-
$settings = self::get_common_settings();
|
92 |
-
|
93 |
-
if ( $settings && array_key_exists( $key, $settings ) ) {
|
94 |
-
return $settings[ $key ];
|
95 |
-
}
|
96 |
-
|
97 |
-
return $default;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get required plugins for page builder
|
102 |
-
*
|
103 |
-
* @since 1.1.4
|
104 |
-
*
|
105 |
-
* @param string $page_builder_slug Page builder slug.
|
106 |
-
* @param string $default Default page builder.
|
107 |
-
* @return array selected page builder required plugins list.
|
108 |
-
*/
|
109 |
-
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
110 |
-
$plugins = self::get_plugins_groupby_page_builders();
|
111 |
-
|
112 |
-
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
113 |
-
return $plugins[ $page_builder_slug ];
|
114 |
-
}
|
115 |
-
|
116 |
-
return $plugins[ $default ];
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Get Plugins list by page builder.
|
121 |
-
*
|
122 |
-
* @since 1.1.4
|
123 |
-
*
|
124 |
-
* @return array Required Plugins list.
|
125 |
-
*/
|
126 |
-
public static function get_plugins_groupby_page_builders() {
|
127 |
-
|
128 |
-
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
129 |
-
$theme_status = 'not-installed';
|
130 |
-
if ( $divi_status ) {
|
131 |
-
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
132 |
-
$theme_status = 'installed';
|
133 |
-
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
134 |
-
$theme_status = 'deactivate';
|
135 |
-
$divi_status = 'activate';
|
136 |
-
} else {
|
137 |
-
$divi_status = '';
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
$plugins = array(
|
143 |
-
'elementor' => array(
|
144 |
-
'title' => 'Elementor',
|
145 |
-
'plugins' => array(
|
146 |
-
array(
|
147 |
-
'slug' => 'elementor', // For download from wp.org.
|
148 |
-
'init' => 'elementor/elementor.php',
|
149 |
-
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
150 |
-
),
|
151 |
-
),
|
152 |
-
),
|
153 |
-
'divi' => array(
|
154 |
-
'title' => 'Divi',
|
155 |
-
'theme-status' => $theme_status,
|
156 |
-
'plugin-status' => $divi_status,
|
157 |
-
'plugins' => array(
|
158 |
-
array(
|
159 |
-
'slug' => 'divi-builder', // For download from wp.org.
|
160 |
-
'init' => 'divi-builder/divi-builder.php',
|
161 |
-
'status' => $divi_status,
|
162 |
-
),
|
163 |
-
),
|
164 |
-
),
|
165 |
-
);
|
166 |
-
|
167 |
-
$plugins['beaver-builder'] = array(
|
168 |
-
'title' => 'Beaver Builder',
|
169 |
-
'plugins' => array(),
|
170 |
-
);
|
171 |
-
|
172 |
-
// Check Pro Exist.
|
173 |
-
if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
174 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
175 |
-
'slug' => 'bb-plugin',
|
176 |
-
'init' => 'bb-plugin/fl-builder.php',
|
177 |
-
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
178 |
-
);
|
179 |
-
} else {
|
180 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
181 |
-
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
182 |
-
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
183 |
-
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
184 |
-
);
|
185 |
-
}
|
186 |
-
|
187 |
-
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' ) ) {
|
188 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
189 |
-
'slug' => 'bb-ultimate-addon',
|
190 |
-
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
191 |
-
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
192 |
-
);
|
193 |
-
} else {
|
194 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
195 |
-
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
196 |
-
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
197 |
-
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
198 |
-
);
|
199 |
-
}
|
200 |
-
|
201 |
-
return $plugins;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Get plugin status
|
206 |
-
*
|
207 |
-
* @since 1.1.4
|
208 |
-
*
|
209 |
-
* @param string $plugin_init_file Plguin init file.
|
210 |
-
* @return mixed
|
211 |
-
*/
|
212 |
-
public static function get_plugin_status( $plugin_init_file ) {
|
213 |
-
|
214 |
-
if ( null == self::$installed_plugins ) {
|
215 |
-
self::$installed_plugins = get_plugins();
|
216 |
-
}
|
217 |
-
|
218 |
-
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
219 |
-
return 'install';
|
220 |
-
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
221 |
-
return 'activate';
|
222 |
-
}
|
223 |
-
|
224 |
-
return;
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Get zapier settings.
|
229 |
-
*
|
230 |
-
* @return array.
|
231 |
-
*/
|
232 |
-
static public function get_common_settings() {
|
233 |
-
|
234 |
-
if ( null === self::$common ) {
|
235 |
-
|
236 |
-
$common_default = apply_filters(
|
237 |
-
'cartflows_common_settings_default',
|
238 |
-
array(
|
239 |
-
'disallow_indexing' => 'disable',
|
240 |
-
'global_checkout' => '',
|
241 |
-
'default_page_builder' => 'elementor',
|
242 |
-
)
|
243 |
-
);
|
244 |
-
|
245 |
-
$common = Cartflows_Helper::get_admin_settings_option( '_cartflows_common', false, true );
|
246 |
-
|
247 |
-
self::$common = wp_parse_args( $common, $common_default );
|
248 |
-
}
|
249 |
-
|
250 |
-
return self::$common;
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Get Checkout field.
|
255 |
-
*
|
256 |
-
* @param string $key Field key.
|
257 |
-
* @param int $post_id Post id.
|
258 |
-
* @return array.
|
259 |
-
*/
|
260 |
-
static public function get_checkout_fields( $key, $post_id ) {
|
261 |
-
|
262 |
-
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
263 |
-
|
264 |
-
if ( ! $saved_fields ) {
|
265 |
-
$saved_fields = array();
|
266 |
-
}
|
267 |
-
|
268 |
-
$fields = array_filter( $saved_fields );
|
269 |
-
|
270 |
-
if ( empty( $fields ) ) {
|
271 |
-
if ( 'billing' === $key || 'shipping' === $key ) {
|
272 |
-
|
273 |
-
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
274 |
-
|
275 |
-
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
return $fields;
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Add Checkout field.
|
284 |
-
*
|
285 |
-
* @param string $type Field type.
|
286 |
-
* @param string $field_key Field key.
|
287 |
-
* @param array $field_data Field data.
|
288 |
-
* @param int $post_id Post id.
|
289 |
-
* @return boolean.
|
290 |
-
*/
|
291 |
-
static public function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
292 |
-
|
293 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
294 |
-
|
295 |
-
$fields[ $field_key ] = $field_data;
|
296 |
-
|
297 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
298 |
-
|
299 |
-
return true;
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Get checkout fields settings.
|
304 |
-
*
|
305 |
-
* @param string $type Field type.
|
306 |
-
* @param string $field_key Field key.
|
307 |
-
* @param int $post_id Post id.
|
308 |
-
* @return array.
|
309 |
-
*/
|
310 |
-
static public function delete_checkout_field( $type, $field_key, $post_id ) {
|
311 |
-
|
312 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
313 |
-
|
314 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
315 |
-
unset( $fields[ $field_key ] );
|
316 |
-
}
|
317 |
-
|
318 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
319 |
-
|
320 |
-
return true;
|
321 |
-
}
|
322 |
-
|
323 |
-
/**
|
324 |
-
* Get checkout fields settings.
|
325 |
-
*
|
326 |
-
* @return array.
|
327 |
-
*/
|
328 |
-
static public function get_checkout_fields_settings() {
|
329 |
-
|
330 |
-
if ( null === self::$checkout_fields ) {
|
331 |
-
$checkout_fields_default = array(
|
332 |
-
'enable_customization' => 'disable',
|
333 |
-
'enable_billing_fields' => 'disable',
|
334 |
-
);
|
335 |
-
|
336 |
-
$billing_fields = self::get_checkout_fields( 'billing' );
|
337 |
-
|
338 |
-
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
339 |
-
|
340 |
-
foreach ( $billing_fields as $key => $value ) {
|
341 |
-
|
342 |
-
$checkout_fields_default[ $key ] = 'enable';
|
343 |
-
}
|
344 |
-
}
|
345 |
-
|
346 |
-
$checkout_fields = Cartflows_Helper::get_admin_settings_option( '_wcf_checkout_fields', false, true );
|
347 |
-
|
348 |
-
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
349 |
-
}
|
350 |
-
|
351 |
-
return self::$checkout_fields;
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* Get meta options
|
356 |
-
*
|
357 |
-
* @since 1.0.0
|
358 |
-
* @param int $post_id Product ID.
|
359 |
-
* @param string $key Meta Key.
|
360 |
-
* @param string $default Default value.
|
361 |
-
* @return string Meta Value.
|
362 |
-
*/
|
363 |
-
static public function get_meta_option( $post_id, $key, $default = '' ) {
|
364 |
-
|
365 |
-
$value = get_post_meta( $post_id, $key, true );
|
366 |
-
|
367 |
-
if ( ! $value ) {
|
368 |
-
$value = $default;
|
369 |
-
}
|
370 |
-
|
371 |
-
return $value;
|
372 |
-
}
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Save meta option
|
376 |
-
*
|
377 |
-
* @since 1.0.0
|
378 |
-
* @param int $post_id Product ID.
|
379 |
-
* @param array $args Arguments array.
|
380 |
-
*/
|
381 |
-
static public function save_meta_option( $post_id, $args = array() ) {
|
382 |
-
|
383 |
-
if ( is_array( $args ) && ! empty( $args ) ) {
|
384 |
-
|
385 |
-
foreach ( $args as $key => $value ) {
|
386 |
-
|
387 |
-
update_post_meta( $post_id, $key, $value );
|
388 |
-
}
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Check if Elementor page builder is installed
|
394 |
-
*
|
395 |
-
* @since 1.0.0
|
396 |
-
*
|
397 |
-
* @access public
|
398 |
-
*/
|
399 |
-
static public function _is_elementor_installed() {
|
400 |
-
$path = 'elementor/elementor.php';
|
401 |
-
$plugins = get_plugins();
|
402 |
-
|
403 |
-
return isset( $plugins[ $path ] );
|
404 |
-
}
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Check if Step has product assigned.
|
408 |
-
*
|
409 |
-
* @since 1.0.0
|
410 |
-
* @param int $step_id step ID.
|
411 |
-
*
|
412 |
-
* @access public
|
413 |
-
*/
|
414 |
-
static public function has_product_assigned( $step_id ) {
|
415 |
-
|
416 |
-
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
417 |
-
|
418 |
-
if ( 'checkout' == $step_type ) {
|
419 |
-
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
420 |
-
} else {
|
421 |
-
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
422 |
-
}
|
423 |
-
|
424 |
-
if ( ! empty( $product ) ) {
|
425 |
-
return true;
|
426 |
-
}
|
427 |
-
return false;
|
428 |
-
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Get attributes for cartflows wrap.
|
433 |
-
*
|
434 |
-
* @since 1.1.4
|
435 |
-
*
|
436 |
-
* @access public
|
437 |
-
*/
|
438 |
-
static public function get_cartflows_container_atts() {
|
439 |
-
|
440 |
-
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
441 |
-
$atts_string = '';
|
442 |
-
|
443 |
-
foreach ( $attributes as $key => $value ) {
|
444 |
-
|
445 |
-
if ( ! $value ) {
|
446 |
-
continue;
|
447 |
-
}
|
448 |
-
|
449 |
-
if ( true === $value ) {
|
450 |
-
$atts_string .= esc_html( $key ) . ' ';
|
451 |
-
} else {
|
452 |
-
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
453 |
-
}
|
454 |
-
}
|
455 |
-
|
456 |
-
return $atts_string;
|
457 |
-
}
|
458 |
-
}
|
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 |
+
* Installed Plugins
|
26 |
+
*
|
27 |
+
* @since 1.1.4
|
28 |
+
*
|
29 |
+
* @access private
|
30 |
+
* @var array Installed plugins list.
|
31 |
+
*/
|
32 |
+
private static $installed_plugins = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Checkout Fields
|
36 |
+
*
|
37 |
+
* @var checkout_fields
|
38 |
+
*/
|
39 |
+
private static $checkout_fields = null;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Returns an option from the database for
|
43 |
+
* the admin settings page.
|
44 |
+
*
|
45 |
+
* @param string $key The option key.
|
46 |
+
* @param mixed $default Option default value if option is not available.
|
47 |
+
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
48 |
+
* @return string Return the option value
|
49 |
+
*/
|
50 |
+
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
51 |
+
|
52 |
+
// Get the site-wide option if we're in the network admin.
|
53 |
+
if ( $network_override && is_multisite() ) {
|
54 |
+
$value = get_site_option( $key, $default );
|
55 |
+
} else {
|
56 |
+
$value = get_option( $key, $default );
|
57 |
+
}
|
58 |
+
|
59 |
+
return $value;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Updates an option from the admin settings page.
|
64 |
+
*
|
65 |
+
* @param string $key The option key.
|
66 |
+
* @param mixed $value The value to update.
|
67 |
+
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
68 |
+
* @return mixed
|
69 |
+
*/
|
70 |
+
static public function update_admin_settings_option( $key, $value, $network = false ) {
|
71 |
+
|
72 |
+
// Update the site-wide option since we're in the network admin.
|
73 |
+
if ( $network && is_multisite() ) {
|
74 |
+
update_site_option( $key, $value );
|
75 |
+
} else {
|
76 |
+
update_option( $key, $value );
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Get single setting
|
83 |
+
*
|
84 |
+
* @since 1.1.4
|
85 |
+
*
|
86 |
+
* @param string $key Option key.
|
87 |
+
* @param string $default Option default value if not exist.
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
static public function get_common_setting( $key = '', $default = '' ) {
|
91 |
+
$settings = self::get_common_settings();
|
92 |
+
|
93 |
+
if ( $settings && array_key_exists( $key, $settings ) ) {
|
94 |
+
return $settings[ $key ];
|
95 |
+
}
|
96 |
+
|
97 |
+
return $default;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get required plugins for page builder
|
102 |
+
*
|
103 |
+
* @since 1.1.4
|
104 |
+
*
|
105 |
+
* @param string $page_builder_slug Page builder slug.
|
106 |
+
* @param string $default Default page builder.
|
107 |
+
* @return array selected page builder required plugins list.
|
108 |
+
*/
|
109 |
+
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
110 |
+
$plugins = self::get_plugins_groupby_page_builders();
|
111 |
+
|
112 |
+
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
113 |
+
return $plugins[ $page_builder_slug ];
|
114 |
+
}
|
115 |
+
|
116 |
+
return $plugins[ $default ];
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get Plugins list by page builder.
|
121 |
+
*
|
122 |
+
* @since 1.1.4
|
123 |
+
*
|
124 |
+
* @return array Required Plugins list.
|
125 |
+
*/
|
126 |
+
public static function get_plugins_groupby_page_builders() {
|
127 |
+
|
128 |
+
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
129 |
+
$theme_status = 'not-installed';
|
130 |
+
if ( $divi_status ) {
|
131 |
+
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
132 |
+
$theme_status = 'installed';
|
133 |
+
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
134 |
+
$theme_status = 'deactivate';
|
135 |
+
$divi_status = 'activate';
|
136 |
+
} else {
|
137 |
+
$divi_status = '';
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
$plugins = array(
|
143 |
+
'elementor' => array(
|
144 |
+
'title' => 'Elementor',
|
145 |
+
'plugins' => array(
|
146 |
+
array(
|
147 |
+
'slug' => 'elementor', // For download from wp.org.
|
148 |
+
'init' => 'elementor/elementor.php',
|
149 |
+
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
150 |
+
),
|
151 |
+
),
|
152 |
+
),
|
153 |
+
'divi' => array(
|
154 |
+
'title' => 'Divi',
|
155 |
+
'theme-status' => $theme_status,
|
156 |
+
'plugin-status' => $divi_status,
|
157 |
+
'plugins' => array(
|
158 |
+
array(
|
159 |
+
'slug' => 'divi-builder', // For download from wp.org.
|
160 |
+
'init' => 'divi-builder/divi-builder.php',
|
161 |
+
'status' => $divi_status,
|
162 |
+
),
|
163 |
+
),
|
164 |
+
),
|
165 |
+
);
|
166 |
+
|
167 |
+
$plugins['beaver-builder'] = array(
|
168 |
+
'title' => 'Beaver Builder',
|
169 |
+
'plugins' => array(),
|
170 |
+
);
|
171 |
+
|
172 |
+
// Check Pro Exist.
|
173 |
+
if ( file_exists( WP_PLUGIN_DIR . '/' . 'bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
174 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
175 |
+
'slug' => 'bb-plugin',
|
176 |
+
'init' => 'bb-plugin/fl-builder.php',
|
177 |
+
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
178 |
+
);
|
179 |
+
} else {
|
180 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
181 |
+
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
182 |
+
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
183 |
+
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
184 |
+
);
|
185 |
+
}
|
186 |
+
|
187 |
+
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' ) ) {
|
188 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
189 |
+
'slug' => 'bb-ultimate-addon',
|
190 |
+
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
191 |
+
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
192 |
+
);
|
193 |
+
} else {
|
194 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
195 |
+
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
196 |
+
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
197 |
+
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
198 |
+
);
|
199 |
+
}
|
200 |
+
|
201 |
+
return $plugins;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Get plugin status
|
206 |
+
*
|
207 |
+
* @since 1.1.4
|
208 |
+
*
|
209 |
+
* @param string $plugin_init_file Plguin init file.
|
210 |
+
* @return mixed
|
211 |
+
*/
|
212 |
+
public static function get_plugin_status( $plugin_init_file ) {
|
213 |
+
|
214 |
+
if ( null == self::$installed_plugins ) {
|
215 |
+
self::$installed_plugins = get_plugins();
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
219 |
+
return 'install';
|
220 |
+
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
221 |
+
return 'activate';
|
222 |
+
}
|
223 |
+
|
224 |
+
return;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Get zapier settings.
|
229 |
+
*
|
230 |
+
* @return array.
|
231 |
+
*/
|
232 |
+
static public function get_common_settings() {
|
233 |
+
|
234 |
+
if ( null === self::$common ) {
|
235 |
+
|
236 |
+
$common_default = apply_filters(
|
237 |
+
'cartflows_common_settings_default',
|
238 |
+
array(
|
239 |
+
'disallow_indexing' => 'disable',
|
240 |
+
'global_checkout' => '',
|
241 |
+
'default_page_builder' => 'elementor',
|
242 |
+
)
|
243 |
+
);
|
244 |
+
|
245 |
+
$common = Cartflows_Helper::get_admin_settings_option( '_cartflows_common', false, true );
|
246 |
+
|
247 |
+
self::$common = wp_parse_args( $common, $common_default );
|
248 |
+
}
|
249 |
+
|
250 |
+
return self::$common;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Get Checkout field.
|
255 |
+
*
|
256 |
+
* @param string $key Field key.
|
257 |
+
* @param int $post_id Post id.
|
258 |
+
* @return array.
|
259 |
+
*/
|
260 |
+
static public function get_checkout_fields( $key, $post_id ) {
|
261 |
+
|
262 |
+
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
263 |
+
|
264 |
+
if ( ! $saved_fields ) {
|
265 |
+
$saved_fields = array();
|
266 |
+
}
|
267 |
+
|
268 |
+
$fields = array_filter( $saved_fields );
|
269 |
+
|
270 |
+
if ( empty( $fields ) ) {
|
271 |
+
if ( 'billing' === $key || 'shipping' === $key ) {
|
272 |
+
|
273 |
+
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
274 |
+
|
275 |
+
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
return $fields;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Add Checkout field.
|
284 |
+
*
|
285 |
+
* @param string $type Field type.
|
286 |
+
* @param string $field_key Field key.
|
287 |
+
* @param array $field_data Field data.
|
288 |
+
* @param int $post_id Post id.
|
289 |
+
* @return boolean.
|
290 |
+
*/
|
291 |
+
static public function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
292 |
+
|
293 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
294 |
+
|
295 |
+
$fields[ $field_key ] = $field_data;
|
296 |
+
|
297 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
298 |
+
|
299 |
+
return true;
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Get checkout fields settings.
|
304 |
+
*
|
305 |
+
* @param string $type Field type.
|
306 |
+
* @param string $field_key Field key.
|
307 |
+
* @param int $post_id Post id.
|
308 |
+
* @return array.
|
309 |
+
*/
|
310 |
+
static public function delete_checkout_field( $type, $field_key, $post_id ) {
|
311 |
+
|
312 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
313 |
+
|
314 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
315 |
+
unset( $fields[ $field_key ] );
|
316 |
+
}
|
317 |
+
|
318 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
319 |
+
|
320 |
+
return true;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Get checkout fields settings.
|
325 |
+
*
|
326 |
+
* @return array.
|
327 |
+
*/
|
328 |
+
static public function get_checkout_fields_settings() {
|
329 |
+
|
330 |
+
if ( null === self::$checkout_fields ) {
|
331 |
+
$checkout_fields_default = array(
|
332 |
+
'enable_customization' => 'disable',
|
333 |
+
'enable_billing_fields' => 'disable',
|
334 |
+
);
|
335 |
+
|
336 |
+
$billing_fields = self::get_checkout_fields( 'billing' );
|
337 |
+
|
338 |
+
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
339 |
+
|
340 |
+
foreach ( $billing_fields as $key => $value ) {
|
341 |
+
|
342 |
+
$checkout_fields_default[ $key ] = 'enable';
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
$checkout_fields = Cartflows_Helper::get_admin_settings_option( '_wcf_checkout_fields', false, true );
|
347 |
+
|
348 |
+
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
349 |
+
}
|
350 |
+
|
351 |
+
return self::$checkout_fields;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Get meta options
|
356 |
+
*
|
357 |
+
* @since 1.0.0
|
358 |
+
* @param int $post_id Product ID.
|
359 |
+
* @param string $key Meta Key.
|
360 |
+
* @param string $default Default value.
|
361 |
+
* @return string Meta Value.
|
362 |
+
*/
|
363 |
+
static public function get_meta_option( $post_id, $key, $default = '' ) {
|
364 |
+
|
365 |
+
$value = get_post_meta( $post_id, $key, true );
|
366 |
+
|
367 |
+
if ( ! $value ) {
|
368 |
+
$value = $default;
|
369 |
+
}
|
370 |
+
|
371 |
+
return $value;
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Save meta option
|
376 |
+
*
|
377 |
+
* @since 1.0.0
|
378 |
+
* @param int $post_id Product ID.
|
379 |
+
* @param array $args Arguments array.
|
380 |
+
*/
|
381 |
+
static public function save_meta_option( $post_id, $args = array() ) {
|
382 |
+
|
383 |
+
if ( is_array( $args ) && ! empty( $args ) ) {
|
384 |
+
|
385 |
+
foreach ( $args as $key => $value ) {
|
386 |
+
|
387 |
+
update_post_meta( $post_id, $key, $value );
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Check if Elementor page builder is installed
|
394 |
+
*
|
395 |
+
* @since 1.0.0
|
396 |
+
*
|
397 |
+
* @access public
|
398 |
+
*/
|
399 |
+
static public function _is_elementor_installed() {
|
400 |
+
$path = 'elementor/elementor.php';
|
401 |
+
$plugins = get_plugins();
|
402 |
+
|
403 |
+
return isset( $plugins[ $path ] );
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Check if Step has product assigned.
|
408 |
+
*
|
409 |
+
* @since 1.0.0
|
410 |
+
* @param int $step_id step ID.
|
411 |
+
*
|
412 |
+
* @access public
|
413 |
+
*/
|
414 |
+
static public function has_product_assigned( $step_id ) {
|
415 |
+
|
416 |
+
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
417 |
+
|
418 |
+
if ( 'checkout' == $step_type ) {
|
419 |
+
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
420 |
+
} else {
|
421 |
+
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
422 |
+
}
|
423 |
+
|
424 |
+
if ( ! empty( $product ) ) {
|
425 |
+
return true;
|
426 |
+
}
|
427 |
+
return false;
|
428 |
+
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Get attributes for cartflows wrap.
|
433 |
+
*
|
434 |
+
* @since 1.1.4
|
435 |
+
*
|
436 |
+
* @access public
|
437 |
+
*/
|
438 |
+
static public function get_cartflows_container_atts() {
|
439 |
+
|
440 |
+
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
441 |
+
$atts_string = '';
|
442 |
+
|
443 |
+
foreach ( $attributes as $key => $value ) {
|
444 |
+
|
445 |
+
if ( ! $value ) {
|
446 |
+
continue;
|
447 |
+
}
|
448 |
+
|
449 |
+
if ( true === $value ) {
|
450 |
+
$atts_string .= esc_html( $key ) . ' ';
|
451 |
+
} else {
|
452 |
+
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
453 |
+
}
|
454 |
+
}
|
455 |
+
|
456 |
+
return $atts_string;
|
457 |
+
}
|
458 |
+
}
|
classes/class-cartflows-importer-core.php
CHANGED
@@ -1,272 +1,272 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Image Importer
|
4 |
-
*
|
5 |
-
* => How to use?
|
6 |
-
*
|
7 |
-
* $image = array(
|
8 |
-
* 'url' => '<image-url>',
|
9 |
-
* 'id' => '<image-id>',
|
10 |
-
* );
|
11 |
-
*
|
12 |
-
* $downloaded_image = CartFlows_Importer_Core::get_instance()->import( $image );
|
13 |
-
*
|
14 |
-
* @package CartFlows
|
15 |
-
* @since 1.0.0
|
16 |
-
*/
|
17 |
-
|
18 |
-
if ( ! class_exists( 'CartFlows_Importer_Core' ) ) :
|
19 |
-
|
20 |
-
/**
|
21 |
-
* CartFlows Importer
|
22 |
-
*
|
23 |
-
* @since 1.0.0
|
24 |
-
*/
|
25 |
-
class CartFlows_Importer_Core {
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Instance
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @var object Class object.
|
32 |
-
* @access private
|
33 |
-
*/
|
34 |
-
private static $instance;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Images IDs
|
38 |
-
*
|
39 |
-
* @var array The Array of already image IDs.
|
40 |
-
* @since 1.0.0
|
41 |
-
*/
|
42 |
-
private $already_imported_ids = array();
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Initiator
|
46 |
-
*
|
47 |
-
* @since 1.0.0
|
48 |
-
* @return object initialized object of class.
|
49 |
-
*/
|
50 |
-
public static function get_instance() {
|
51 |
-
if ( ! isset( self::$instance ) ) {
|
52 |
-
self::$instance = new self;
|
53 |
-
}
|
54 |
-
return self::$instance;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Constructor
|
59 |
-
*
|
60 |
-
* @since 1.0.0
|
61 |
-
*/
|
62 |
-
public function __construct() {
|
63 |
-
|
64 |
-
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
65 |
-
require_once ABSPATH . 'wp-admin/includes/file.php';
|
66 |
-
}
|
67 |
-
|
68 |
-
WP_Filesystem();
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Process Image Download
|
73 |
-
*
|
74 |
-
* @since 1.0.0
|
75 |
-
* @param array $attachments Attachment array.
|
76 |
-
* @return array Attachment array.
|
77 |
-
*/
|
78 |
-
public function process( $attachments ) {
|
79 |
-
|
80 |
-
$downloaded_images = array();
|
81 |
-
|
82 |
-
foreach ( $attachments as $key => $attachment ) {
|
83 |
-
$downloaded_images[] = $this->import( $attachment );
|
84 |
-
}
|
85 |
-
|
86 |
-
return $downloaded_images;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Get Hash Image.
|
91 |
-
*
|
92 |
-
* @since 1.0.0
|
93 |
-
* @param string $attachment_url Attachment URL.
|
94 |
-
* @return string Hash string.
|
95 |
-
*/
|
96 |
-
private function get_hash_image( $attachment_url ) {
|
97 |
-
return sha1( $attachment_url );
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get Saved Image.
|
102 |
-
*
|
103 |
-
* @since 1.0.0
|
104 |
-
* @param string $attachment Attachment Data.
|
105 |
-
* @return string Hash string.
|
106 |
-
*/
|
107 |
-
private function get_saved_image( $attachment ) {
|
108 |
-
|
109 |
-
wcf()->logger->import_log( 'importer-core.php File' );
|
110 |
-
|
111 |
-
if ( apply_filters( 'cartflows_image_importer_skip_image', false, $attachment ) ) {
|
112 |
-
|
113 |
-
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
114 |
-
|
115 |
-
return $attachment;
|
116 |
-
}
|
117 |
-
|
118 |
-
global $wpdb;
|
119 |
-
|
120 |
-
// Already imported? Then return!
|
121 |
-
if ( isset( $this->already_imported_ids[ $attachment['id'] ] ) ) {
|
122 |
-
|
123 |
-
self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
|
124 |
-
|
125 |
-
return $this->already_imported_ids[ $attachment['id'] ];
|
126 |
-
}
|
127 |
-
|
128 |
-
// 1. Is already imported in Batch Import Process?
|
129 |
-
$post_id = $wpdb->get_var(
|
130 |
-
$wpdb->prepare(
|
131 |
-
'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
|
132 |
-
WHERE `meta_key` = \'_cartflows_image_hash\'
|
133 |
-
AND `meta_value` = %s
|
134 |
-
;',
|
135 |
-
$this->get_hash_image( $attachment['url'] )
|
136 |
-
)
|
137 |
-
);
|
138 |
-
|
139 |
-
// 2. Is image already imported though XML?
|
140 |
-
if ( empty( $post_id ) ) {
|
141 |
-
|
142 |
-
// Get file name without extension.
|
143 |
-
// To check it exist in attachment.
|
144 |
-
$filename = preg_replace( '/\\.[^.\\s]{3,4}$/', '', basename( $attachment['url'] ) );
|
145 |
-
|
146 |
-
$post_id = $wpdb->get_var(
|
147 |
-
$wpdb->prepare(
|
148 |
-
'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
|
149 |
-
WHERE `meta_key` = \'_wp_attached_file\'
|
150 |
-
AND `meta_value` LIKE %s
|
151 |
-
;',
|
152 |
-
'%' . $filename . '%'
|
153 |
-
)
|
154 |
-
);
|
155 |
-
|
156 |
-
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
157 |
-
}
|
158 |
-
|
159 |
-
if ( $post_id ) {
|
160 |
-
|
161 |
-
$new_imgage_url = wp_get_attachment_url( $post_id );
|
162 |
-
$new_attachment = array(
|
163 |
-
'id' => $post_id,
|
164 |
-
'url' => $new_imgage_url,
|
165 |
-
);
|
166 |
-
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
|
167 |
-
|
168 |
-
self::log( 'Download (✓) Replace (✓) - ' . $new_imgage_url );
|
169 |
-
return $new_attachment;
|
170 |
-
}
|
171 |
-
|
172 |
-
return false;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Import Image
|
177 |
-
*
|
178 |
-
* @since 1.0.0
|
179 |
-
* @param array $attachment Attachment array.
|
180 |
-
* @return array Attachment array.
|
181 |
-
*/
|
182 |
-
public function import( $attachment ) {
|
183 |
-
|
184 |
-
$saved_image = $this->get_saved_image( $attachment );
|
185 |
-
if ( $saved_image ) {
|
186 |
-
return $saved_image;
|
187 |
-
}
|
188 |
-
|
189 |
-
$args = array(
|
190 |
-
'timeout' => 300,
|
191 |
-
);
|
192 |
-
|
193 |
-
$file_content = wp_remote_retrieve_body( wp_safe_remote_get( $attachment['url'], $args ) );
|
194 |
-
|
195 |
-
// Empty file content?
|
196 |
-
if ( empty( $file_content ) ) {
|
197 |
-
|
198 |
-
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
199 |
-
self::log( 'Error: Failed wp_remote_retrieve_body().' );
|
200 |
-
|
201 |
-
return $attachment;
|
202 |
-
}
|
203 |
-
|
204 |
-
// Extract the file name and extension from the URL.
|
205 |
-
$filename = basename( $attachment['url'] );
|
206 |
-
|
207 |
-
$upload = wp_upload_bits(
|
208 |
-
$filename,
|
209 |
-
null,
|
210 |
-
$file_content
|
211 |
-
);
|
212 |
-
|
213 |
-
$post = array(
|
214 |
-
'post_title' => $filename,
|
215 |
-
'guid' => $upload['url'],
|
216 |
-
);
|
217 |
-
|
218 |
-
$info = wp_check_filetype( $upload['file'] );
|
219 |
-
if ( $info ) {
|
220 |
-
$post['post_mime_type'] = $info['type'];
|
221 |
-
} else {
|
222 |
-
// For now just return the origin attachment.
|
223 |
-
return $attachment;
|
224 |
-
}
|
225 |
-
|
226 |
-
$post_id = wp_insert_attachment( $post, $upload['file'] );
|
227 |
-
wp_update_attachment_metadata(
|
228 |
-
$post_id,
|
229 |
-
wp_generate_attachment_metadata( $post_id, $upload['file'] )
|
230 |
-
);
|
231 |
-
update_post_meta( $post_id, '_cartflows_image_hash', $this->get_hash_image( $attachment['url'] ) );
|
232 |
-
|
233 |
-
$new_attachment = array(
|
234 |
-
'id' => $post_id,
|
235 |
-
'url' => $upload['url'],
|
236 |
-
);
|
237 |
-
|
238 |
-
self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
|
239 |
-
|
240 |
-
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
|
241 |
-
|
242 |
-
return $new_attachment;
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Debugging Log.
|
247 |
-
*
|
248 |
-
* @since 1.0.0
|
249 |
-
* @param mixed $log Log data.
|
250 |
-
* @return void
|
251 |
-
*/
|
252 |
-
public static function log( $log ) {
|
253 |
-
|
254 |
-
if ( ! WP_DEBUG_LOG ) {
|
255 |
-
return;
|
256 |
-
}
|
257 |
-
|
258 |
-
if ( is_array( $log ) || is_object( $log ) ) {
|
259 |
-
wcf()->logger->import_log( print_r( $log, true ) );
|
260 |
-
} else {
|
261 |
-
wcf()->logger->import_log( $log );
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Initialize class object with 'get_instance()' method
|
269 |
-
*/
|
270 |
-
CartFlows_Importer_Core::get_instance();
|
271 |
-
|
272 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Image Importer
|
4 |
+
*
|
5 |
+
* => How to use?
|
6 |
+
*
|
7 |
+
* $image = array(
|
8 |
+
* 'url' => '<image-url>',
|
9 |
+
* 'id' => '<image-id>',
|
10 |
+
* );
|
11 |
+
*
|
12 |
+
* $downloaded_image = CartFlows_Importer_Core::get_instance()->import( $image );
|
13 |
+
*
|
14 |
+
* @package CartFlows
|
15 |
+
* @since 1.0.0
|
16 |
+
*/
|
17 |
+
|
18 |
+
if ( ! class_exists( 'CartFlows_Importer_Core' ) ) :
|
19 |
+
|
20 |
+
/**
|
21 |
+
* CartFlows Importer
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
class CartFlows_Importer_Core {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Instance
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @var object Class object.
|
32 |
+
* @access private
|
33 |
+
*/
|
34 |
+
private static $instance;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Images IDs
|
38 |
+
*
|
39 |
+
* @var array The Array of already image IDs.
|
40 |
+
* @since 1.0.0
|
41 |
+
*/
|
42 |
+
private $already_imported_ids = array();
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Initiator
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @return object initialized object of class.
|
49 |
+
*/
|
50 |
+
public static function get_instance() {
|
51 |
+
if ( ! isset( self::$instance ) ) {
|
52 |
+
self::$instance = new self;
|
53 |
+
}
|
54 |
+
return self::$instance;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Constructor
|
59 |
+
*
|
60 |
+
* @since 1.0.0
|
61 |
+
*/
|
62 |
+
public function __construct() {
|
63 |
+
|
64 |
+
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
65 |
+
require_once ABSPATH . 'wp-admin/includes/file.php';
|
66 |
+
}
|
67 |
+
|
68 |
+
WP_Filesystem();
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Process Image Download
|
73 |
+
*
|
74 |
+
* @since 1.0.0
|
75 |
+
* @param array $attachments Attachment array.
|
76 |
+
* @return array Attachment array.
|
77 |
+
*/
|
78 |
+
public function process( $attachments ) {
|
79 |
+
|
80 |
+
$downloaded_images = array();
|
81 |
+
|
82 |
+
foreach ( $attachments as $key => $attachment ) {
|
83 |
+
$downloaded_images[] = $this->import( $attachment );
|
84 |
+
}
|
85 |
+
|
86 |
+
return $downloaded_images;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Get Hash Image.
|
91 |
+
*
|
92 |
+
* @since 1.0.0
|
93 |
+
* @param string $attachment_url Attachment URL.
|
94 |
+
* @return string Hash string.
|
95 |
+
*/
|
96 |
+
private function get_hash_image( $attachment_url ) {
|
97 |
+
return sha1( $attachment_url );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get Saved Image.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
* @param string $attachment Attachment Data.
|
105 |
+
* @return string Hash string.
|
106 |
+
*/
|
107 |
+
private function get_saved_image( $attachment ) {
|
108 |
+
|
109 |
+
wcf()->logger->import_log( 'importer-core.php File' );
|
110 |
+
|
111 |
+
if ( apply_filters( 'cartflows_image_importer_skip_image', false, $attachment ) ) {
|
112 |
+
|
113 |
+
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
114 |
+
|
115 |
+
return $attachment;
|
116 |
+
}
|
117 |
+
|
118 |
+
global $wpdb;
|
119 |
+
|
120 |
+
// Already imported? Then return!
|
121 |
+
if ( isset( $this->already_imported_ids[ $attachment['id'] ] ) ) {
|
122 |
+
|
123 |
+
self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
|
124 |
+
|
125 |
+
return $this->already_imported_ids[ $attachment['id'] ];
|
126 |
+
}
|
127 |
+
|
128 |
+
// 1. Is already imported in Batch Import Process?
|
129 |
+
$post_id = $wpdb->get_var(
|
130 |
+
$wpdb->prepare(
|
131 |
+
'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
|
132 |
+
WHERE `meta_key` = \'_cartflows_image_hash\'
|
133 |
+
AND `meta_value` = %s
|
134 |
+
;',
|
135 |
+
$this->get_hash_image( $attachment['url'] )
|
136 |
+
)
|
137 |
+
);
|
138 |
+
|
139 |
+
// 2. Is image already imported though XML?
|
140 |
+
if ( empty( $post_id ) ) {
|
141 |
+
|
142 |
+
// Get file name without extension.
|
143 |
+
// To check it exist in attachment.
|
144 |
+
$filename = preg_replace( '/\\.[^.\\s]{3,4}$/', '', basename( $attachment['url'] ) );
|
145 |
+
|
146 |
+
$post_id = $wpdb->get_var(
|
147 |
+
$wpdb->prepare(
|
148 |
+
'SELECT `post_id` FROM `' . $wpdb->postmeta . '`
|
149 |
+
WHERE `meta_key` = \'_wp_attached_file\'
|
150 |
+
AND `meta_value` LIKE %s
|
151 |
+
;',
|
152 |
+
'%' . $filename . '%'
|
153 |
+
)
|
154 |
+
);
|
155 |
+
|
156 |
+
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( $post_id ) {
|
160 |
+
|
161 |
+
$new_imgage_url = wp_get_attachment_url( $post_id );
|
162 |
+
$new_attachment = array(
|
163 |
+
'id' => $post_id,
|
164 |
+
'url' => $new_imgage_url,
|
165 |
+
);
|
166 |
+
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
|
167 |
+
|
168 |
+
self::log( 'Download (✓) Replace (✓) - ' . $new_imgage_url );
|
169 |
+
return $new_attachment;
|
170 |
+
}
|
171 |
+
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Import Image
|
177 |
+
*
|
178 |
+
* @since 1.0.0
|
179 |
+
* @param array $attachment Attachment array.
|
180 |
+
* @return array Attachment array.
|
181 |
+
*/
|
182 |
+
public function import( $attachment ) {
|
183 |
+
|
184 |
+
$saved_image = $this->get_saved_image( $attachment );
|
185 |
+
if ( $saved_image ) {
|
186 |
+
return $saved_image;
|
187 |
+
}
|
188 |
+
|
189 |
+
$args = array(
|
190 |
+
'timeout' => 300,
|
191 |
+
);
|
192 |
+
|
193 |
+
$file_content = wp_remote_retrieve_body( wp_safe_remote_get( $attachment['url'], $args ) );
|
194 |
+
|
195 |
+
// Empty file content?
|
196 |
+
if ( empty( $file_content ) ) {
|
197 |
+
|
198 |
+
self::log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
|
199 |
+
self::log( 'Error: Failed wp_remote_retrieve_body().' );
|
200 |
+
|
201 |
+
return $attachment;
|
202 |
+
}
|
203 |
+
|
204 |
+
// Extract the file name and extension from the URL.
|
205 |
+
$filename = basename( $attachment['url'] );
|
206 |
+
|
207 |
+
$upload = wp_upload_bits(
|
208 |
+
$filename,
|
209 |
+
null,
|
210 |
+
$file_content
|
211 |
+
);
|
212 |
+
|
213 |
+
$post = array(
|
214 |
+
'post_title' => $filename,
|
215 |
+
'guid' => $upload['url'],
|
216 |
+
);
|
217 |
+
|
218 |
+
$info = wp_check_filetype( $upload['file'] );
|
219 |
+
if ( $info ) {
|
220 |
+
$post['post_mime_type'] = $info['type'];
|
221 |
+
} else {
|
222 |
+
// For now just return the origin attachment.
|
223 |
+
return $attachment;
|
224 |
+
}
|
225 |
+
|
226 |
+
$post_id = wp_insert_attachment( $post, $upload['file'] );
|
227 |
+
wp_update_attachment_metadata(
|
228 |
+
$post_id,
|
229 |
+
wp_generate_attachment_metadata( $post_id, $upload['file'] )
|
230 |
+
);
|
231 |
+
update_post_meta( $post_id, '_cartflows_image_hash', $this->get_hash_image( $attachment['url'] ) );
|
232 |
+
|
233 |
+
$new_attachment = array(
|
234 |
+
'id' => $post_id,
|
235 |
+
'url' => $upload['url'],
|
236 |
+
);
|
237 |
+
|
238 |
+
self::log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
|
239 |
+
|
240 |
+
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
|
241 |
+
|
242 |
+
return $new_attachment;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Debugging Log.
|
247 |
+
*
|
248 |
+
* @since 1.0.0
|
249 |
+
* @param mixed $log Log data.
|
250 |
+
* @return void
|
251 |
+
*/
|
252 |
+
public static function log( $log ) {
|
253 |
+
|
254 |
+
if ( ! WP_DEBUG_LOG ) {
|
255 |
+
return;
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( is_array( $log ) || is_object( $log ) ) {
|
259 |
+
wcf()->logger->import_log( print_r( $log, true ) );
|
260 |
+
} else {
|
261 |
+
wcf()->logger->import_log( $log );
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Initialize class object with 'get_instance()' method
|
269 |
+
*/
|
270 |
+
CartFlows_Importer_Core::get_instance();
|
271 |
+
|
272 |
+
endif;
|
classes/class-cartflows-importer.php
CHANGED
@@ -59,8 +59,8 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
59 |
add_action( 'wp_ajax_cartflows_activate_plugin', array( $this, 'activate_plugin' ) );
|
60 |
|
61 |
add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
|
62 |
-
add_action( 'admin_init', array( $this, '
|
63 |
-
add_action( 'admin_init', array( $this, '
|
64 |
add_filter( 'post_row_actions', array( $this, 'export_link' ), 10, 2 );
|
65 |
add_action( 'admin_action_cartflows_export_flow', array( $this, 'export_flow' ) );
|
66 |
}
|
@@ -146,7 +146,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
146 |
*
|
147 |
* @since 1.1.4
|
148 |
*/
|
149 |
-
function
|
150 |
if ( empty( $_POST['cartflows-action'] ) || 'export' != $_POST['cartflows-action'] ) {
|
151 |
return;
|
152 |
}
|
@@ -273,7 +273,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
273 |
*
|
274 |
* @since 1.1.4
|
275 |
*/
|
276 |
-
function
|
277 |
if ( empty( $_POST['cartflows-action'] ) || 'import' != $_POST['cartflows-action'] ) {
|
278 |
return;
|
279 |
}
|
@@ -419,23 +419,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
419 |
}
|
420 |
|
421 |
// Replace old image links with new image links.
|
422 |
-
// vl( $content );.
|
423 |
-
// $content = esc_html( $content );.
|
424 |
foreach ( $image_map as $old_url => $new_url ) {
|
425 |
$content = str_replace( $old_url, $new_url, $content );
|
426 |
}
|
427 |
-
// vl( $content );.
|
428 |
-
// exit();.
|
429 |
-
wcf()->logger->import_log( '------------------------------------------------' );
|
430 |
-
wcf()->logger->import_log( '(✓) DATA Before' );
|
431 |
-
wcf()->logger->import_log( '------------------------------------------------' );
|
432 |
-
wcf()->logger->import_log( $content );
|
433 |
-
|
434 |
-
// $content = html_entity_decode( $content );
|
435 |
-
wcf()->logger->import_log( '------------------------------------------------' );
|
436 |
-
wcf()->logger->import_log( '(✓) DATA After' );
|
437 |
-
wcf()->logger->import_log( '------------------------------------------------' );
|
438 |
-
wcf()->logger->import_log( $content );
|
439 |
|
440 |
return $content;
|
441 |
|
@@ -1012,8 +998,14 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
1012 |
wcf()->logger->import_log( '(✓) Creating new step from remote step [' . $template_id . '] for FLOW ' . get_the_title( $flow_id ) . ' [' . $flow_id . ']' );
|
1013 |
|
1014 |
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1015 |
-
|
1016 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1017 |
if ( false === $response['success'] ) {
|
1018 |
wcf()->logger->import_log( '(✕) Failed to fetch remote data.' );
|
1019 |
wp_send_json_error( $response );
|
@@ -1021,12 +1013,11 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
1021 |
|
1022 |
wcf()->logger->import_log( '(✓) Successfully getting remote step response ' . json_encode( $response ) );
|
1023 |
|
1024 |
-
$content = isset( $response['data']['content']->rendered ) ? $response['data']['content']->rendered : '';
|
1025 |
$new_step_id = wp_insert_post(
|
1026 |
array(
|
1027 |
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
1028 |
'post_title' => $response['title'],
|
1029 |
-
'post_content' => $
|
1030 |
'post_status' => 'publish',
|
1031 |
)
|
1032 |
);
|
@@ -1042,6 +1033,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
1042 |
}
|
1043 |
}
|
1044 |
|
|
|
|
|
|
|
1045 |
wcf()->logger->import_log( '(✓) Created new step ' . '"' . $response['title'] . '" id ' . $new_step_id );
|
1046 |
// insert post meta.
|
1047 |
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
@@ -1231,6 +1225,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
1231 |
wp_send_json_error( $flow_id->get_error_message() );
|
1232 |
}
|
1233 |
|
|
|
|
|
|
|
1234 |
wp_send_json_success( $flow_id );
|
1235 |
}
|
1236 |
|
@@ -1268,14 +1265,22 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
1268 |
|
1269 |
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1270 |
|
1271 |
-
// vl( $response );.
|
1272 |
-
// wp_die();.
|
1273 |
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1274 |
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1275 |
update_post_meta( $post_id, 'divi_content', $response['data']['divi_content'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
}
|
1277 |
}
|
1278 |
|
|
|
|
|
|
|
1279 |
// Import Post Meta.
|
1280 |
self::import_post_meta( $post_id, $response );
|
1281 |
|
59 |
add_action( 'wp_ajax_cartflows_activate_plugin', array( $this, 'activate_plugin' ) );
|
60 |
|
61 |
add_action( 'admin_menu', array( $this, 'add_to_menus' ) );
|
62 |
+
add_action( 'admin_init', array( $this, 'export_json' ) );
|
63 |
+
add_action( 'admin_init', array( $this, 'import_json' ) );
|
64 |
add_filter( 'post_row_actions', array( $this, 'export_link' ), 10, 2 );
|
65 |
add_action( 'admin_action_cartflows_export_flow', array( $this, 'export_flow' ) );
|
66 |
}
|
146 |
*
|
147 |
* @since 1.1.4
|
148 |
*/
|
149 |
+
function export_json() {
|
150 |
if ( empty( $_POST['cartflows-action'] ) || 'export' != $_POST['cartflows-action'] ) {
|
151 |
return;
|
152 |
}
|
273 |
*
|
274 |
* @since 1.1.4
|
275 |
*/
|
276 |
+
function import_json() {
|
277 |
if ( empty( $_POST['cartflows-action'] ) || 'import' != $_POST['cartflows-action'] ) {
|
278 |
return;
|
279 |
}
|
419 |
}
|
420 |
|
421 |
// Replace old image links with new image links.
|
|
|
|
|
422 |
foreach ( $image_map as $old_url => $new_url ) {
|
423 |
$content = str_replace( $old_url, $new_url, $content );
|
424 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
return $content;
|
427 |
|
998 |
wcf()->logger->import_log( '(✓) Creating new step from remote step [' . $template_id . '] for FLOW ' . get_the_title( $flow_id ) . ' [' . $flow_id . ']' );
|
999 |
|
1000 |
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1001 |
+
|
1002 |
+
$post_content = isset( $response['data']['content']->rendered ) ? $response['data']['content']->rendered : '';
|
1003 |
+
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1004 |
+
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1005 |
+
$post_content = $response['data']['divi_content'];
|
1006 |
+
}
|
1007 |
+
}
|
1008 |
+
|
1009 |
if ( false === $response['success'] ) {
|
1010 |
wcf()->logger->import_log( '(✕) Failed to fetch remote data.' );
|
1011 |
wp_send_json_error( $response );
|
1013 |
|
1014 |
wcf()->logger->import_log( '(✓) Successfully getting remote step response ' . json_encode( $response ) );
|
1015 |
|
|
|
1016 |
$new_step_id = wp_insert_post(
|
1017 |
array(
|
1018 |
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
1019 |
'post_title' => $response['title'],
|
1020 |
+
'post_content' => $post_content,
|
1021 |
'post_status' => 'publish',
|
1022 |
)
|
1023 |
);
|
1033 |
}
|
1034 |
}
|
1035 |
|
1036 |
+
/* Imported Step */
|
1037 |
+
update_post_meta( $new_step_id, 'cartflows_imported_step', 'yes' );
|
1038 |
+
|
1039 |
wcf()->logger->import_log( '(✓) Created new step ' . '"' . $response['title'] . '" id ' . $new_step_id );
|
1040 |
// insert post meta.
|
1041 |
update_post_meta( $new_step_id, 'wcf-flow-id', $flow_id );
|
1225 |
wp_send_json_error( $flow_id->get_error_message() );
|
1226 |
}
|
1227 |
|
1228 |
+
/* Imported Flow */
|
1229 |
+
update_post_meta( $flow_id, 'cartflows_imported_flow', 'yes' );
|
1230 |
+
|
1231 |
wp_send_json_success( $flow_id );
|
1232 |
}
|
1233 |
|
1265 |
|
1266 |
$response = CartFlows_API::get_instance()->get_template( $template_id );
|
1267 |
|
|
|
|
|
1268 |
if ( 'divi' === Cartflows_Helper::get_common_setting( 'default_page_builder' ) ) {
|
1269 |
if ( isset( $response['data']['divi_content'] ) && ! empty( $response['data']['divi_content'] ) ) {
|
1270 |
update_post_meta( $post_id, 'divi_content', $response['data']['divi_content'] );
|
1271 |
+
|
1272 |
+
wp_update_post(
|
1273 |
+
array(
|
1274 |
+
'ID' => $post_id,
|
1275 |
+
'post_content' => $response['data']['divi_content'],
|
1276 |
+
)
|
1277 |
+
);
|
1278 |
}
|
1279 |
}
|
1280 |
|
1281 |
+
/* Imported Step */
|
1282 |
+
update_post_meta( $post_id, 'cartflows_imported_step', 'yes' );
|
1283 |
+
|
1284 |
// Import Post Meta.
|
1285 |
self::import_post_meta( $post_id, $response );
|
1286 |
|
classes/class-cartflows-loader.php
CHANGED
@@ -115,7 +115,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
|
|
115 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
116 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
117 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
118 |
-
define( 'CARTFLOWS_VER', '1.1.
|
119 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
120 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
121 |
|
115 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
116 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
117 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
118 |
+
define( 'CARTFLOWS_VER', '1.1.8' );
|
119 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
120 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
121 |
|
classes/class-cartflows-meta.php
CHANGED
@@ -1,51 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CartFlows Meta
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'Cartflows_Meta' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* CartFlows_Meta
|
13 |
-
*
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
class Cartflows_Meta {
|
17 |
-
/**
|
18 |
-
* Constructor
|
19 |
-
*
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
public function __construct() {
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Flow & Step Actions
|
27 |
-
*
|
28 |
-
* @param array $options options.
|
29 |
-
* @param int $post_id post ID.
|
30 |
-
*/
|
31 |
-
function right_column_footer( $options, $post_id ) {
|
32 |
-
?>
|
33 |
-
<div class="wcf-column-right-footer">
|
34 |
-
<?php submit_button( __( 'Update', 'cartflows' ), 'primary', 'save', false ); ?>
|
35 |
-
|
36 |
-
<?php
|
37 |
-
$flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
|
38 |
-
if ( $flow_id ) {
|
39 |
-
?>
|
40 |
-
<a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button pull-right wcf-back-to-flow-edit">
|
41 |
-
<i class="dashicons dashicons-arrow-left-alt"></i>
|
42 |
-
<?php _e( 'Back to edit Flow', 'cartflows' ); ?>
|
43 |
-
</a>
|
44 |
-
<?php } ?>
|
45 |
-
|
46 |
-
</div>
|
47 |
-
<?php
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CartFlows Meta
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'Cartflows_Meta' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* CartFlows_Meta
|
13 |
+
*
|
14 |
+
* @since 1.0.0
|
15 |
+
*/
|
16 |
+
class Cartflows_Meta {
|
17 |
+
/**
|
18 |
+
* Constructor
|
19 |
+
*
|
20 |
+
* @since 1.0.0
|
21 |
+
*/
|
22 |
+
public function __construct() {
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Flow & Step Actions
|
27 |
+
*
|
28 |
+
* @param array $options options.
|
29 |
+
* @param int $post_id post ID.
|
30 |
+
*/
|
31 |
+
function right_column_footer( $options, $post_id ) {
|
32 |
+
?>
|
33 |
+
<div class="wcf-column-right-footer">
|
34 |
+
<?php submit_button( __( 'Update', 'cartflows' ), 'primary', 'save', false ); ?>
|
35 |
+
|
36 |
+
<?php
|
37 |
+
$flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
|
38 |
+
if ( $flow_id ) {
|
39 |
+
?>
|
40 |
+
<a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button pull-right wcf-back-to-flow-edit">
|
41 |
+
<i class="dashicons dashicons-arrow-left-alt"></i>
|
42 |
+
<?php _e( 'Back to edit Flow', 'cartflows' ); ?>
|
43 |
+
</a>
|
44 |
+
<?php } ?>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
<?php
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Script Header (Used for add script into header)
|
52 |
+
*
|
53 |
+
* @param array $options options.
|
54 |
+
* @param int $post_id post ID.
|
55 |
+
*/
|
56 |
+
function tab_custom_script( $options, $post_id ) {
|
57 |
+
?>
|
58 |
+
<div class="wcf-<?php echo wcf()->utils->get_step_type( $post_id ); ?>-custom-script-header wcf-tab-content widefat">
|
59 |
+
<?php
|
60 |
+
/* Script added onto the header */
|
61 |
+
echo wcf()->meta->get_area_field(
|
62 |
+
array(
|
63 |
+
'label' => __( 'Custom Script', 'cartflows' ),
|
64 |
+
'name' => 'wcf-custom-script',
|
65 |
+
'value' => htmlspecialchars( $options['wcf-custom-script'] ),
|
66 |
+
'help' => __( 'Custom script lets you add your own custom script on front end of this flow page.', 'cartflows' ),
|
67 |
+
)
|
68 |
+
);
|
69 |
+
?>
|
70 |
+
</div>
|
71 |
+
<?php
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
endif;
|
includes/admin/cartflows-general.php
CHANGED
@@ -1,143 +1,143 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* General settings
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$settings = Cartflows_Helper::get_common_settings();
|
9 |
-
|
10 |
-
?>
|
11 |
-
|
12 |
-
<form method="post" class="wrap wcf-clear" action="" >
|
13 |
-
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
14 |
-
<input type="hidden" name="action" value="wcf_save_common_settings">
|
15 |
-
<h1 class="screen-reader-text"><?php _e( 'General Settings', 'cartflows' ); ?></h1>
|
16 |
-
|
17 |
-
<div id="poststuff">
|
18 |
-
<div id="post-body" class="columns-2">
|
19 |
-
<div id="post-body-content">
|
20 |
-
<div class="postbox introduction">
|
21 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
22 |
-
<span><?php _e( 'Getting Started', 'cartflows' ); ?></span>
|
23 |
-
</h2>
|
24 |
-
<div class="inside">
|
25 |
-
<div class="iframe-wrap">
|
26 |
-
<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>
|
27 |
-
</div>
|
28 |
-
<p>
|
29 |
-
<?php
|
30 |
-
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
31 |
-
?>
|
32 |
-
</p>
|
33 |
-
</div>
|
34 |
-
</div>
|
35 |
-
|
36 |
-
<div class="general-settings-form postbox">
|
37 |
-
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
38 |
-
<span><?php _e( 'General Settings', 'cartflows' ); ?></span>
|
39 |
-
</h2>
|
40 |
-
<div class="inside">
|
41 |
-
<div class="form-wrap">
|
42 |
-
<?php
|
43 |
-
|
44 |
-
do_action( 'cartflows_before_settings_fields', $settings );
|
45 |
-
|
46 |
-
echo Cartflows_Admin_Fields::checkobox_field(
|
47 |
-
array(
|
48 |
-
'id' => 'wcf_disallow_indexing',
|
49 |
-
'name' => '_cartflows_common[disallow_indexing]',
|
50 |
-
'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
|
51 |
-
'value' => $settings['disallow_indexing'],
|
52 |
-
)
|
53 |
-
);
|
54 |
-
echo Cartflows_Admin_Fields::flow_checkout_selection_field(
|
55 |
-
array(
|
56 |
-
'id' => 'wcf_global_checkout',
|
57 |
-
'name' => '_cartflows_common[global_checkout]',
|
58 |
-
'title' => __( 'Global Checkout', 'cartflows' ),
|
59 |
-
'value' => $settings['global_checkout'],
|
60 |
-
)
|
61 |
-
);
|
62 |
-
|
63 |
-
echo Cartflows_Admin_Fields::select_field(
|
64 |
-
array(
|
65 |
-
'id' => 'wcf_default_page_builder',
|
66 |
-
'name' => '_cartflows_common[default_page_builder]',
|
67 |
-
'title' => __( 'Show Templates designed with', 'cartflows' ),
|
68 |
-
'description' => __( 'CartFlows offers flow templates that can be imported in one click. These templates are available in few different page builders. Please choose your preferred page builder from the list so you will only see templates that are made using that page builder..', 'cartflows' ),
|
69 |
-
'value' => $settings['default_page_builder'],
|
70 |
-
'options' => array(
|
71 |
-
'elementor' => __( 'Elementor', 'cartflows' ),
|
72 |
-
'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
|
73 |
-
'divi' => __( 'Divi', 'cartflows' ),
|
74 |
-
'other' => __( 'Other', 'cartflows' ),
|
75 |
-
),
|
76 |
-
)
|
77 |
-
);
|
78 |
-
|
79 |
-
do_action( 'cartflows_after_settings_fields', $settings );
|
80 |
-
|
81 |
-
?>
|
82 |
-
</div>
|
83 |
-
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
84 |
-
<?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
</div>
|
88 |
-
<div class="postbox-container" id="postbox-container-1">
|
89 |
-
<div id="side-sortables">
|
90 |
-
|
91 |
-
<div class="postbox">
|
92 |
-
<h2 class="hndle">
|
93 |
-
<span class="dashicons dashicons-book"></span>
|
94 |
-
<span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
|
95 |
-
</h2>
|
96 |
-
<div class="inside">
|
97 |
-
<p>
|
98 |
-
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
99 |
-
</p>
|
100 |
-
<p>
|
101 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php _e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
|
102 |
-
</p>
|
103 |
-
</div>
|
104 |
-
</div>
|
105 |
-
|
106 |
-
<div class="postbox">
|
107 |
-
<h2 class="hndle">
|
108 |
-
<span class="dashicons dashicons-groups"></span>
|
109 |
-
<span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
|
110 |
-
</h2>
|
111 |
-
<div class="inside">
|
112 |
-
<p>
|
113 |
-
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
114 |
-
</p>
|
115 |
-
<p>
|
116 |
-
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php _e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
|
117 |
-
</p>
|
118 |
-
</div>
|
119 |
-
</div>
|
120 |
-
|
121 |
-
<div class="postbox">
|
122 |
-
<h2 class="hndle">
|
123 |
-
<span class="dashicons dashicons-sos"></span>
|
124 |
-
<span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
|
125 |
-
</h2>
|
126 |
-
<div class="inside">
|
127 |
-
<p>
|
128 |
-
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
129 |
-
</p>
|
130 |
-
<p>
|
131 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php _e( 'Submit a Ticket »', 'cartflows' ); ?></a>
|
132 |
-
</p>
|
133 |
-
</div>
|
134 |
-
</div>
|
135 |
-
|
136 |
-
</div>
|
137 |
-
</div>
|
138 |
-
</div>
|
139 |
-
<!-- /post-body -->
|
140 |
-
<br class="clear">
|
141 |
-
</div>
|
142 |
-
</div>
|
143 |
-
</form>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* General settings
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$settings = Cartflows_Helper::get_common_settings();
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
<form method="post" class="wrap wcf-clear" action="" >
|
13 |
+
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
14 |
+
<input type="hidden" name="action" value="wcf_save_common_settings">
|
15 |
+
<h1 class="screen-reader-text"><?php _e( 'General Settings', 'cartflows' ); ?></h1>
|
16 |
+
|
17 |
+
<div id="poststuff">
|
18 |
+
<div id="post-body" class="columns-2">
|
19 |
+
<div id="post-body-content">
|
20 |
+
<div class="postbox introduction">
|
21 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
22 |
+
<span><?php _e( 'Getting Started', 'cartflows' ); ?></span>
|
23 |
+
</h2>
|
24 |
+
<div class="inside">
|
25 |
+
<div class="iframe-wrap">
|
26 |
+
<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>
|
27 |
+
</div>
|
28 |
+
<p>
|
29 |
+
<?php
|
30 |
+
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
31 |
+
?>
|
32 |
+
</p>
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
<div class="general-settings-form postbox">
|
37 |
+
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
38 |
+
<span><?php _e( 'General Settings', 'cartflows' ); ?></span>
|
39 |
+
</h2>
|
40 |
+
<div class="inside">
|
41 |
+
<div class="form-wrap">
|
42 |
+
<?php
|
43 |
+
|
44 |
+
do_action( 'cartflows_before_settings_fields', $settings );
|
45 |
+
|
46 |
+
echo Cartflows_Admin_Fields::checkobox_field(
|
47 |
+
array(
|
48 |
+
'id' => 'wcf_disallow_indexing',
|
49 |
+
'name' => '_cartflows_common[disallow_indexing]',
|
50 |
+
'title' => __( 'Disallow search engines from indexing flows', 'cartflows' ),
|
51 |
+
'value' => $settings['disallow_indexing'],
|
52 |
+
)
|
53 |
+
);
|
54 |
+
echo Cartflows_Admin_Fields::flow_checkout_selection_field(
|
55 |
+
array(
|
56 |
+
'id' => 'wcf_global_checkout',
|
57 |
+
'name' => '_cartflows_common[global_checkout]',
|
58 |
+
'title' => __( 'Global Checkout', 'cartflows' ),
|
59 |
+
'value' => $settings['global_checkout'],
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
echo Cartflows_Admin_Fields::select_field(
|
64 |
+
array(
|
65 |
+
'id' => 'wcf_default_page_builder',
|
66 |
+
'name' => '_cartflows_common[default_page_builder]',
|
67 |
+
'title' => __( 'Show Templates designed with', 'cartflows' ),
|
68 |
+
'description' => __( 'CartFlows offers flow templates that can be imported in one click. These templates are available in few different page builders. Please choose your preferred page builder from the list so you will only see templates that are made using that page builder..', 'cartflows' ),
|
69 |
+
'value' => $settings['default_page_builder'],
|
70 |
+
'options' => array(
|
71 |
+
'elementor' => __( 'Elementor', 'cartflows' ),
|
72 |
+
'beaver-builder' => __( 'Beaver Builder', 'cartflows' ),
|
73 |
+
'divi' => __( 'Divi', 'cartflows' ),
|
74 |
+
'other' => __( 'Other', 'cartflows' ),
|
75 |
+
),
|
76 |
+
)
|
77 |
+
);
|
78 |
+
|
79 |
+
do_action( 'cartflows_after_settings_fields', $settings );
|
80 |
+
|
81 |
+
?>
|
82 |
+
</div>
|
83 |
+
<?php submit_button( __( 'Save Changes', 'cartflows' ), 'cartflows-common-setting-save-btn button-primary button', 'submit', false ); ?>
|
84 |
+
<?php wp_nonce_field( 'cartflows-common-settings', 'cartflows-common-settings-nonce' ); ?>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
<div class="postbox-container" id="postbox-container-1">
|
89 |
+
<div id="side-sortables">
|
90 |
+
|
91 |
+
<div class="postbox">
|
92 |
+
<h2 class="hndle">
|
93 |
+
<span class="dashicons dashicons-book"></span>
|
94 |
+
<span><?php esc_html_e( 'Knowledge Base', 'cartflows' ); ?></span>
|
95 |
+
</h2>
|
96 |
+
<div class="inside">
|
97 |
+
<p>
|
98 |
+
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
99 |
+
</p>
|
100 |
+
<p>
|
101 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php _e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
|
102 |
+
</p>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<div class="postbox">
|
107 |
+
<h2 class="hndle">
|
108 |
+
<span class="dashicons dashicons-groups"></span>
|
109 |
+
<span><?php esc_html_e( 'Community', 'cartflows' ); ?></span>
|
110 |
+
</h2>
|
111 |
+
<div class="inside">
|
112 |
+
<p>
|
113 |
+
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
114 |
+
</p>
|
115 |
+
<p>
|
116 |
+
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php _e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
|
117 |
+
</p>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
|
121 |
+
<div class="postbox">
|
122 |
+
<h2 class="hndle">
|
123 |
+
<span class="dashicons dashicons-sos"></span>
|
124 |
+
<span><?php esc_html_e( 'Five Star Support', 'cartflows' ); ?></span>
|
125 |
+
</h2>
|
126 |
+
<div class="inside">
|
127 |
+
<p>
|
128 |
+
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
129 |
+
</p>
|
130 |
+
<p>
|
131 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php _e( 'Submit a Ticket »', 'cartflows' ); ?></a>
|
132 |
+
</p>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
</div>
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
<!-- /post-body -->
|
140 |
+
<br class="clear">
|
141 |
+
</div>
|
142 |
+
</div>
|
143 |
+
</form>
|
languages/cartflows.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the CartFlows package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: CartFlows 1.1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
-
"POT-Creation-Date: 2019-02-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -89,7 +89,7 @@ msgstr ""
|
|
89 |
msgid "Learn How"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: classes/class-cartflows-api.php:
|
93 |
msgid "Request successfully processed!"
|
94 |
msgstr ""
|
95 |
|
@@ -135,136 +135,136 @@ msgstr ""
|
|
135 |
msgid "Please upload a file to import"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: classes/class-cartflows-importer.php:
|
139 |
msgid "Successfully imported flows."
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: classes/class-cartflows-importer.php:
|
143 |
msgid "Loading Steps"
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: classes/class-cartflows-importer.php:
|
147 |
msgid "Getting steps from the cloud. Please wait for the moment."
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: classes/class-cartflows-importer.php:
|
151 |
msgid "Searching Template.."
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: classes/class-cartflows-importer.php:
|
155 |
msgid "Getting templates from the cloud. Please wait for the moment."
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: classes/class-cartflows-importer.php:
|
159 |
msgid "Importing.."
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: classes/class-cartflows-importer.php:
|
163 |
-
#: classes/class-cartflows-importer.php:
|
164 |
msgid "Imported"
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: classes/class-cartflows-importer.php:
|
168 |
-
#: classes/class-cartflows-importer.php:
|
169 |
msgid "Thanks for patience"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: classes/class-cartflows-importer.php:
|
173 |
-
#: classes/class-cartflows-importer.php:
|
174 |
msgid "Coming Soon!"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: classes/class-cartflows-importer.php:
|
178 |
msgid "Redirecting to the Elementor edit window."
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: classes/class-cartflows-importer.php:
|
182 |
-
#: classes/class-cartflows-importer.php:
|
183 |
msgid "Pro"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: classes/class-cartflows-importer.php:
|
187 |
-
#: classes/class-cartflows-importer.php:
|
188 |
msgid "Activate License"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: classes/class-cartflows-importer.php:
|
192 |
-
#: classes/class-cartflows-importer.php:
|
193 |
msgid "Get Pro"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: classes/class-cartflows-importer.php:
|
197 |
msgid "Create"
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: classes/class-cartflows-importer.php:
|
201 |
msgid "Under Maintenance.."
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: classes/class-cartflows-importer.php:
|
205 |
msgid ""
|
206 |
"If you are seeing this message, most likely our servers are under routine "
|
207 |
"maintenance and we will be back shortly."
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: classes/class-cartflows-importer.php:
|
211 |
msgid ""
|
212 |
"In rare case, it is possible your website is having trouble connecting with "
|
213 |
"ours. If you need help, please feel free to get in touch with us from our "
|
214 |
"website.."
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: classes/class-cartflows-importer.php:
|
218 |
#. translators: %s: Plugin string
|
219 |
msgid ""
|
220 |
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
221 |
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: classes/class-cartflows-importer.php:
|
225 |
msgid "All"
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: classes/class-cartflows-importer.php:
|
229 |
msgid "Select Step Type"
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: classes/class-cartflows-importer.php:
|
233 |
msgid "Import from Cloud"
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: classes/class-cartflows-importer.php:
|
237 |
#: modules/flow/classes/class-cartflows-flow-meta.php:224
|
238 |
msgid "Landing Page"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: classes/class-cartflows-importer.php:
|
242 |
#: modules/flow/classes/class-cartflows-flow-meta.php:225
|
243 |
msgid "Checkout Page"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: classes/class-cartflows-importer.php:
|
247 |
#: modules/flow/classes/class-cartflows-flow-meta.php:226
|
248 |
msgid "Thank You Page"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: classes/class-cartflows-importer.php:
|
252 |
#. translators: %s: template ID
|
253 |
msgid "Invalid template id %1$s or post id %2$s."
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: classes/class-cartflows-importer.php:
|
257 |
#. translators: %s: flow ID
|
258 |
msgid "Invalid flow id %1$s OR step type %2$s."
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: classes/class-cartflows-importer.php:
|
262 |
msgid ""
|
263 |
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
264 |
"to import the step."
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: classes/class-cartflows-importer.php:
|
268 |
msgid "Plugin Successfully Activated"
|
269 |
msgstr ""
|
270 |
|
@@ -351,7 +351,7 @@ msgstr ""
|
|
351 |
|
352 |
#: classes/class-cartflows-meta-fields.php:492
|
353 |
#: classes/class-cartflows-meta-fields.php:505
|
354 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
355 |
msgid "Default"
|
356 |
msgstr ""
|
357 |
|
@@ -397,6 +397,19 @@ msgstr ""
|
|
397 |
msgid "Back to edit Flow"
|
398 |
msgstr ""
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
#: classes/class-cartflows-wizard.php:45
|
401 |
msgid "Thanks for installing and using CartFlows!"
|
402 |
msgstr ""
|
@@ -603,30 +616,32 @@ msgstr ""
|
|
603 |
msgid "Import"
|
604 |
msgstr ""
|
605 |
|
606 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
607 |
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:62
|
608 |
msgid ""
|
609 |
"WooCommerce functions not exists. If you are in iframe, please reload the "
|
610 |
"iframe"
|
611 |
msgstr ""
|
612 |
|
613 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
614 |
msgid "Checkout ID not found"
|
615 |
msgstr ""
|
616 |
|
617 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
618 |
msgid "Variations Not set"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
622 |
msgid "This product can't be purcahsed"
|
623 |
msgstr ""
|
624 |
|
625 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
|
|
626 |
msgid "Coupon Code"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
|
|
630 |
msgid "Apply"
|
631 |
msgstr ""
|
632 |
|
@@ -635,206 +650,206 @@ msgid "Checkout Layout"
|
|
635 |
msgstr ""
|
636 |
|
637 |
#: modules/checkout/classes/class-cartflows-checkout-meta.php:153
|
638 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:
|
639 |
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:130
|
640 |
msgid "Shortcodes"
|
641 |
msgstr ""
|
642 |
|
643 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
644 |
msgid "Select Product"
|
645 |
msgstr ""
|
646 |
|
647 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
648 |
msgid "Order Bump"
|
649 |
msgstr ""
|
650 |
|
651 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
652 |
msgid "Checkout Design"
|
653 |
msgstr ""
|
654 |
|
655 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
656 |
msgid "Checkout Fields"
|
657 |
msgstr ""
|
658 |
|
659 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
660 |
msgid "Logo ( Optional )"
|
661 |
msgstr ""
|
662 |
|
663 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
664 |
msgid "Add this shortcode to your checkout page"
|
665 |
msgstr ""
|
666 |
|
667 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
668 |
#. translators: %s: link
|
669 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature"
|
670 |
msgstr ""
|
671 |
|
672 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
673 |
#. translators: %s: link
|
674 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature"
|
675 |
msgstr ""
|
676 |
|
677 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
678 |
msgid "One Column (Available in CartFlows Pro) "
|
679 |
msgstr ""
|
680 |
|
681 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
682 |
msgid "Checkout Skin"
|
683 |
msgstr ""
|
684 |
|
685 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
686 |
msgid "One Column"
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
690 |
msgid "Two Column"
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
694 |
msgid "Primary Color"
|
695 |
msgstr ""
|
696 |
|
697 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
698 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
699 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
700 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
701 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
702 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
703 |
msgid "Font Family"
|
704 |
msgstr ""
|
705 |
|
706 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
707 |
msgid "Advance Options"
|
708 |
msgstr ""
|
709 |
|
710 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
711 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
712 |
msgid "Heading"
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
716 |
msgid "Heading Color"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
720 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
721 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
722 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
723 |
msgid "Font Weight"
|
724 |
msgstr ""
|
725 |
|
726 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
727 |
msgid "Input Fields"
|
728 |
msgstr ""
|
729 |
|
730 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
731 |
msgid "Floating Labels (Available in CartFlows Pro)"
|
732 |
msgstr ""
|
733 |
|
734 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
735 |
msgid "Style"
|
736 |
msgstr ""
|
737 |
|
738 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
739 |
msgid "Floating Labels"
|
740 |
msgstr ""
|
741 |
|
742 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
743 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
744 |
msgid "Size"
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
748 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
749 |
msgid "Extra Small"
|
750 |
msgstr ""
|
751 |
|
752 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
753 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
754 |
msgid "Small"
|
755 |
msgstr ""
|
756 |
|
757 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
758 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
759 |
msgid "Medium"
|
760 |
msgstr ""
|
761 |
|
762 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
763 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
764 |
msgid "Large"
|
765 |
msgstr ""
|
766 |
|
767 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
768 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
769 |
msgid "Extra Large"
|
770 |
msgstr ""
|
771 |
|
772 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
773 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
774 |
msgid "Custom"
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
778 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
779 |
msgid "Top Bottom Spacing"
|
780 |
msgstr ""
|
781 |
|
782 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
783 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
784 |
msgid "Left Right Spacing"
|
785 |
msgstr ""
|
786 |
|
787 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
788 |
msgid "Text / Placeholder Color"
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
792 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
793 |
msgid "Background Color"
|
794 |
msgstr ""
|
795 |
|
796 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
797 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
798 |
msgid "Border Color"
|
799 |
msgstr ""
|
800 |
|
801 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
802 |
msgid "Label Color"
|
803 |
msgstr ""
|
804 |
|
805 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
806 |
msgid "Buttons"
|
807 |
msgstr ""
|
808 |
|
809 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
810 |
msgid "Text Color"
|
811 |
msgstr ""
|
812 |
|
813 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
814 |
msgid "Text Hover Color"
|
815 |
msgstr ""
|
816 |
|
817 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
818 |
msgid "Background Hover Color"
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
822 |
msgid "Border Hover Color"
|
823 |
msgstr ""
|
824 |
|
825 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
826 |
msgid "Sections"
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
830 |
msgid "Highlight Area Background Color"
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
834 |
msgid "Header Logo"
|
835 |
msgstr ""
|
836 |
|
837 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:
|
838 |
msgid "Logo Width (In px)"
|
839 |
msgstr ""
|
840 |
|
@@ -1096,7 +1111,7 @@ msgstr ""
|
|
1096 |
msgid "Landing Page Settings"
|
1097 |
msgstr ""
|
1098 |
|
1099 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:
|
1100 |
msgid "Next Step Link"
|
1101 |
msgstr ""
|
1102 |
|
@@ -1112,44 +1127,44 @@ msgstr ""
|
|
1112 |
msgid "Thank You Fields"
|
1113 |
msgstr ""
|
1114 |
|
1115 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1116 |
msgid "Order Details"
|
1117 |
msgstr ""
|
1118 |
|
1119 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1120 |
msgid "Text"
|
1121 |
msgstr ""
|
1122 |
|
1123 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1124 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1125 |
msgid "Color"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1129 |
msgid "Advanced Options"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1133 |
msgid "Container Width (In px)"
|
1134 |
msgstr ""
|
1135 |
|
1136 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1137 |
msgid "Section Background Color"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1141 |
msgid "Enable Order Overview "
|
1142 |
msgstr ""
|
1143 |
|
1144 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1145 |
msgid "Enable Order Details "
|
1146 |
msgstr ""
|
1147 |
|
1148 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1149 |
msgid "Enable Billing Details "
|
1150 |
msgstr ""
|
1151 |
|
1152 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:
|
1153 |
msgid "Enable Shipping Details "
|
1154 |
msgstr ""
|
1155 |
|
2 |
# This file is distributed under the same license as the CartFlows package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: CartFlows 1.1.8\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
+
"POT-Creation-Date: 2019-02-27 12:39:28+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
89 |
msgid "Learn How"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: classes/class-cartflows-api.php:368
|
93 |
msgid "Request successfully processed!"
|
94 |
msgstr ""
|
95 |
|
135 |
msgid "Please upload a file to import"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: classes/class-cartflows-importer.php:438
|
139 |
msgid "Successfully imported flows."
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: classes/class-cartflows-importer.php:470
|
143 |
msgid "Loading Steps"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: classes/class-cartflows-importer.php:472
|
147 |
msgid "Getting steps from the cloud. Please wait for the moment."
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: classes/class-cartflows-importer.php:483
|
151 |
msgid "Searching Template.."
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: classes/class-cartflows-importer.php:485
|
155 |
msgid "Getting templates from the cloud. Please wait for the moment."
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: classes/class-cartflows-importer.php:494
|
159 |
msgid "Importing.."
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: classes/class-cartflows-importer.php:503
|
163 |
+
#: classes/class-cartflows-importer.php:543
|
164 |
msgid "Imported"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: classes/class-cartflows-importer.php:504
|
168 |
+
#: classes/class-cartflows-importer.php:544
|
169 |
msgid "Thanks for patience"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/class-cartflows-importer.php:513
|
173 |
+
#: classes/class-cartflows-importer.php:525
|
174 |
msgid "Coming Soon!"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: classes/class-cartflows-importer.php:544
|
178 |
msgid "Redirecting to the Elementor edit window."
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: classes/class-cartflows-importer.php:591
|
182 |
+
#: classes/class-cartflows-importer.php:675
|
183 |
msgid "Pro"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: classes/class-cartflows-importer.php:614
|
187 |
+
#: classes/class-cartflows-importer.php:701
|
188 |
msgid "Activate License"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: classes/class-cartflows-importer.php:616
|
192 |
+
#: classes/class-cartflows-importer.php:703
|
193 |
msgid "Get Pro"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: classes/class-cartflows-importer.php:641
|
197 |
msgid "Create"
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: classes/class-cartflows-importer.php:720
|
201 |
msgid "Under Maintenance.."
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: classes/class-cartflows-importer.php:721
|
205 |
msgid ""
|
206 |
"If you are seeing this message, most likely our servers are under routine "
|
207 |
"maintenance and we will be back shortly."
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: classes/class-cartflows-importer.php:722
|
211 |
msgid ""
|
212 |
"In rare case, it is possible your website is having trouble connecting with "
|
213 |
"ours. If you need help, please feel free to get in touch with us from our "
|
214 |
"website.."
|
215 |
msgstr ""
|
216 |
|
217 |
+
#: classes/class-cartflows-importer.php:752
|
218 |
#. translators: %s: Plugin string
|
219 |
msgid ""
|
220 |
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
221 |
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: classes/class-cartflows-importer.php:767
|
225 |
msgid "All"
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: classes/class-cartflows-importer.php:770
|
229 |
msgid "Select Step Type"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: classes/class-cartflows-importer.php:847
|
233 |
msgid "Import from Cloud"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: classes/class-cartflows-importer.php:1149
|
237 |
#: modules/flow/classes/class-cartflows-flow-meta.php:224
|
238 |
msgid "Landing Page"
|
239 |
msgstr ""
|
240 |
|
241 |
+
#: classes/class-cartflows-importer.php:1150
|
242 |
#: modules/flow/classes/class-cartflows-flow-meta.php:225
|
243 |
msgid "Checkout Page"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: classes/class-cartflows-importer.php:1151
|
247 |
#: modules/flow/classes/class-cartflows-flow-meta.php:226
|
248 |
msgid "Thank You Page"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: classes/class-cartflows-importer.php:1259
|
252 |
#. translators: %s: template ID
|
253 |
msgid "Invalid template id %1$s or post id %2$s."
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: classes/class-cartflows-importer.php:1317
|
257 |
#. translators: %s: flow ID
|
258 |
msgid "Invalid flow id %1$s OR step type %2$s."
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: classes/class-cartflows-importer.php:1438
|
262 |
msgid ""
|
263 |
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
264 |
"to import the step."
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: classes/class-cartflows-importer.php:1556
|
268 |
msgid "Plugin Successfully Activated"
|
269 |
msgstr ""
|
270 |
|
351 |
|
352 |
#: classes/class-cartflows-meta-fields.php:492
|
353 |
#: classes/class-cartflows-meta-fields.php:505
|
354 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:452
|
355 |
msgid "Default"
|
356 |
msgstr ""
|
357 |
|
397 |
msgid "Back to edit Flow"
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: classes/class-cartflows-meta.php:63
|
401 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:189
|
402 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:136
|
403 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:148
|
404 |
+
msgid "Custom Script"
|
405 |
+
msgstr ""
|
406 |
+
|
407 |
+
#: classes/class-cartflows-meta.php:66
|
408 |
+
msgid ""
|
409 |
+
"Custom script lets you add your own custom script on front end of this flow "
|
410 |
+
"page."
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
#: classes/class-cartflows-wizard.php:45
|
414 |
msgid "Thanks for installing and using CartFlows!"
|
415 |
msgstr ""
|
616 |
msgid "Import"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:158
|
620 |
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:62
|
621 |
msgid ""
|
622 |
"WooCommerce functions not exists. If you are in iframe, please reload the "
|
623 |
"iframe"
|
624 |
msgstr ""
|
625 |
|
626 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:174
|
627 |
msgid "Checkout ID not found"
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:340
|
631 |
msgid "Variations Not set"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:349
|
635 |
msgid "This product can't be purcahsed"
|
636 |
msgstr ""
|
637 |
|
638 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:947
|
639 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:966
|
640 |
msgid "Coupon Code"
|
641 |
msgstr ""
|
642 |
|
643 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:952
|
644 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:975
|
645 |
msgid "Apply"
|
646 |
msgstr ""
|
647 |
|
650 |
msgstr ""
|
651 |
|
652 |
#: modules/checkout/classes/class-cartflows-checkout-meta.php:153
|
653 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:130
|
654 |
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:130
|
655 |
msgid "Shortcodes"
|
656 |
msgstr ""
|
657 |
|
658 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:159
|
659 |
msgid "Select Product"
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:165
|
663 |
msgid "Order Bump"
|
664 |
msgstr ""
|
665 |
|
666 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:171
|
667 |
msgid "Checkout Design"
|
668 |
msgstr ""
|
669 |
|
670 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:177
|
671 |
msgid "Checkout Fields"
|
672 |
msgstr ""
|
673 |
|
674 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:183
|
675 |
msgid "Logo ( Optional )"
|
676 |
msgstr ""
|
677 |
|
678 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:245
|
679 |
msgid "Add this shortcode to your checkout page"
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:297
|
683 |
#. translators: %s: link
|
684 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature"
|
685 |
msgstr ""
|
686 |
|
687 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:325
|
688 |
#. translators: %s: link
|
689 |
msgid "Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature"
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:353
|
693 |
msgid "One Column (Available in CartFlows Pro) "
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:359
|
697 |
msgid "Checkout Skin"
|
698 |
msgstr ""
|
699 |
|
700 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:363
|
701 |
msgid "One Column"
|
702 |
msgstr ""
|
703 |
|
704 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:364
|
705 |
msgid "Two Column"
|
706 |
msgstr ""
|
707 |
|
708 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:373
|
709 |
msgid "Primary Color"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:382
|
713 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:417
|
714 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:463
|
715 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:555
|
716 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:203
|
717 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:226
|
718 |
msgid "Font Family"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:390
|
722 |
msgid "Advance Options"
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:402
|
726 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:211
|
727 |
msgid "Heading"
|
728 |
msgstr ""
|
729 |
|
730 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:408
|
731 |
msgid "Heading Color"
|
732 |
msgstr ""
|
733 |
|
734 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:426
|
735 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:472
|
736 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:564
|
737 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:235
|
738 |
msgid "Font Weight"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:434
|
742 |
msgid "Input Fields"
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:442
|
746 |
msgid "Floating Labels (Available in CartFlows Pro)"
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:448
|
750 |
msgid "Style"
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:453
|
754 |
msgid "Floating Labels"
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:480
|
758 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:572
|
759 |
msgid "Size"
|
760 |
msgstr ""
|
761 |
|
762 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:484
|
763 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:576
|
764 |
msgid "Extra Small"
|
765 |
msgstr ""
|
766 |
|
767 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:485
|
768 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:577
|
769 |
msgid "Small"
|
770 |
msgstr ""
|
771 |
|
772 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:486
|
773 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:578
|
774 |
msgid "Medium"
|
775 |
msgstr ""
|
776 |
|
777 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:487
|
778 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:579
|
779 |
msgid "Large"
|
780 |
msgstr ""
|
781 |
|
782 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:488
|
783 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:580
|
784 |
msgid "Extra Large"
|
785 |
msgstr ""
|
786 |
|
787 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:489
|
788 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:581
|
789 |
msgid "Custom"
|
790 |
msgstr ""
|
791 |
|
792 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:496
|
793 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:588
|
794 |
msgid "Top Bottom Spacing"
|
795 |
msgstr ""
|
796 |
|
797 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:504
|
798 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:596
|
799 |
msgid "Left Right Spacing"
|
800 |
msgstr ""
|
801 |
|
802 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:512
|
803 |
msgid "Text / Placeholder Color"
|
804 |
msgstr ""
|
805 |
|
806 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:520
|
807 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:620
|
808 |
msgid "Background Color"
|
809 |
msgstr ""
|
810 |
|
811 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:528
|
812 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:636
|
813 |
msgid "Border Color"
|
814 |
msgstr ""
|
815 |
|
816 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:535
|
817 |
msgid "Label Color"
|
818 |
msgstr ""
|
819 |
|
820 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:548
|
821 |
msgid "Buttons"
|
822 |
msgstr ""
|
823 |
|
824 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:604
|
825 |
msgid "Text Color"
|
826 |
msgstr ""
|
827 |
|
828 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:612
|
829 |
msgid "Text Hover Color"
|
830 |
msgstr ""
|
831 |
|
832 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:628
|
833 |
msgid "Background Hover Color"
|
834 |
msgstr ""
|
835 |
|
836 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:644
|
837 |
msgid "Border Hover Color"
|
838 |
msgstr ""
|
839 |
|
840 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:657
|
841 |
msgid "Sections"
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:663
|
845 |
msgid "Highlight Area Background Color"
|
846 |
msgstr ""
|
847 |
|
848 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:702
|
849 |
msgid "Header Logo"
|
850 |
msgstr ""
|
851 |
|
852 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:710
|
853 |
msgid "Logo Width (In px)"
|
854 |
msgstr ""
|
855 |
|
1111 |
msgid "Landing Page Settings"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:169
|
1115 |
msgid "Next Step Link"
|
1116 |
msgstr ""
|
1117 |
|
1127 |
msgid "Thank You Fields"
|
1128 |
msgstr ""
|
1129 |
|
1130 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:176
|
1131 |
msgid "Order Details"
|
1132 |
msgstr ""
|
1133 |
|
1134 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:188
|
1135 |
msgid "Text"
|
1136 |
msgstr ""
|
1137 |
|
1138 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:194
|
1139 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:217
|
1140 |
msgid "Color"
|
1141 |
msgstr ""
|
1142 |
|
1143 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:243
|
1144 |
msgid "Advanced Options"
|
1145 |
msgstr ""
|
1146 |
|
1147 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:253
|
1148 |
msgid "Container Width (In px)"
|
1149 |
msgstr ""
|
1150 |
|
1151 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:261
|
1152 |
msgid "Section Background Color"
|
1153 |
msgstr ""
|
1154 |
|
1155 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:275
|
1156 |
msgid "Enable Order Overview "
|
1157 |
msgstr ""
|
1158 |
|
1159 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:283
|
1160 |
msgid "Enable Order Details "
|
1161 |
msgstr ""
|
1162 |
|
1163 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:291
|
1164 |
msgid "Enable Billing Details "
|
1165 |
msgstr ""
|
1166 |
|
1167 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:299
|
1168 |
msgid "Enable Shipping Details "
|
1169 |
msgstr ""
|
1170 |
|
modules/checkout/classes/class-cartflows-checkout-markup.php
CHANGED
@@ -1,1109 +1,1111 @@
|
|
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' ) );
|
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_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
|
64 |
-
add_action( 'wp_ajax_nopriv_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
|
65 |
-
|
66 |
-
add_filter( 'global_cartflows_js_localize', array( $this, 'add_localize_vars' ) );
|
67 |
-
|
68 |
-
/* Global Checkout */
|
69 |
-
add_action( 'template_redirect', array( $this, 'global_checkout_template_redirect' ), 1 );
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
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 |
-
|
101 |
-
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
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 |
-
|
150 |
-
*
|
151 |
-
*
|
152 |
-
* @
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
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 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
do_action( '
|
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 |
-
add_action( '
|
383 |
-
|
384 |
-
|
385 |
-
remove_all_actions( '
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
add_action( '
|
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 |
-
echo '<input type="hidden" class="input-hidden
|
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 |
-
if
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
if
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
if
|
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 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
.wcf-embed-checkout-form .woocommerce
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
.wcf-embed-checkout-form .woocommerce
|
636 |
-
.wcf-embed-checkout-form .woocommerce
|
637 |
-
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
.wcf-embed-checkout-form
|
652 |
-
.wcf-embed-checkout-form .woocommerce-
|
653 |
-
|
654 |
-
|
655 |
-
border-
|
656 |
-
border-
|
657 |
-
border-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
.wcf-embed-checkout-form
|
669 |
-
.wcf-embed-checkout-form .woocommerce form .form-row
|
670 |
-
.wcf-embed-checkout-form .
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
padding-
|
676 |
-
padding-
|
677 |
-
padding-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
.wcf-embed-checkout-form .woocommerce .col2-set .col-
|
685 |
-
.wcf-embed-checkout-form .woocommerce-
|
686 |
-
.wcf-embed-checkout-form .woocommerce-checkout
|
687 |
-
.wcf-embed-checkout-form .woocommerce-checkout #
|
688 |
-
.wcf-embed-checkout-form .woocommerce
|
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 |
-
padding-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
.wcf-embed-checkout-form .woocommerce
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
.wcf-embed-checkout-form{
|
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 |
-
|
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 |
-
|
830 |
-
|
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 |
-
$vars['
|
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 |
-
|
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 |
-
$fields['billing']['
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
$fields['shipping']['
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
*
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
*
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
|
|
|
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' ) );
|
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_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
|
64 |
+
add_action( 'wp_ajax_nopriv_cf_woo_apply_coupon', array( $this, 'apply_coupon' ) );
|
65 |
+
|
66 |
+
add_filter( 'global_cartflows_js_localize', array( $this, 'add_localize_vars' ) );
|
67 |
+
|
68 |
+
/* Global Checkout */
|
69 |
+
add_action( 'template_redirect', array( $this, 'global_checkout_template_redirect' ), 1 );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Display all WooCommerce notices.
|
75 |
+
*
|
76 |
+
* @since 1.1.5
|
77 |
+
*/
|
78 |
+
function display_woo_notices() {
|
79 |
+
|
80 |
+
if ( null != WC()->session && function_exists( 'woocommerce_output_all_notices' ) ) {
|
81 |
+
woocommerce_output_all_notices();
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Redirect from default to the global checkout page
|
88 |
+
*
|
89 |
+
* @since 1.0.0
|
90 |
+
*/
|
91 |
+
function global_checkout_template_redirect() {
|
92 |
+
|
93 |
+
if ( ! is_checkout() ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
// redirect only from any non HC checkout pages.
|
102 |
+
$order_pay_endpoint = get_option( 'woocommerce_checkout_pay_endpoint', 'order-pay' );
|
103 |
+
$order_received_endpoint = get_option( 'woocommerce_checkout_order_received_endpoint', 'order-received' );
|
104 |
+
|
105 |
+
$common = Cartflows_Helper::get_common_settings();
|
106 |
+
|
107 |
+
$global_checkout = $common['global_checkout'];
|
108 |
+
|
109 |
+
if (
|
110 |
+
// ignore on order-pay.
|
111 |
+
false === mb_strpos( $_SERVER['REQUEST_URI'], '/' . $order_pay_endpoint . '/' ) &&
|
112 |
+
// ignore on TY page.
|
113 |
+
false === mb_strpos( $_SERVER['REQUEST_URI'], '/' . $order_received_endpoint . '/' )
|
114 |
+
) {
|
115 |
+
|
116 |
+
if ( '' !== $global_checkout ) {
|
117 |
+
|
118 |
+
$link = get_permalink( $global_checkout );
|
119 |
+
|
120 |
+
if ( ! empty( $link ) ) {
|
121 |
+
|
122 |
+
wp_redirect( $link );
|
123 |
+
die();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Check for checkout flag
|
131 |
+
*
|
132 |
+
* @param bool $is_checkout is checkout.
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
function woo_checkout_flag( $is_checkout ) {
|
137 |
+
|
138 |
+
if ( ! is_admin() ) {
|
139 |
+
|
140 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
141 |
+
|
142 |
+
$is_checkout = true;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return $is_checkout;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Render checkout shortcode markup.
|
151 |
+
*
|
152 |
+
* @param array $atts attributes.
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
function checkout_shortcode_markup( $atts ) {
|
156 |
+
|
157 |
+
if ( ! function_exists( 'wc_print_notices' ) ) {
|
158 |
+
return '<p class="woocommerce-notice">' . __( 'WooCommerce functions not exists. If you are in iframe, please reload the iframe', 'cartflows' ) . '</p>';
|
159 |
+
}
|
160 |
+
|
161 |
+
$atts = shortcode_atts(
|
162 |
+
array(
|
163 |
+
'id' => 0,
|
164 |
+
),
|
165 |
+
$atts
|
166 |
+
);
|
167 |
+
|
168 |
+
$checkout_id = intval( $atts['id'] );
|
169 |
+
|
170 |
+
if ( empty( $checkout_id ) ) {
|
171 |
+
|
172 |
+
if ( ! _is_wcf_checkout_type() ) {
|
173 |
+
|
174 |
+
return '<h4>' . __( 'Checkout ID not found', 'cartflows' ) . '</h4>';
|
175 |
+
}
|
176 |
+
|
177 |
+
global $post;
|
178 |
+
|
179 |
+
$checkout_id = intval( $post->ID );
|
180 |
+
}
|
181 |
+
|
182 |
+
$output = '';
|
183 |
+
|
184 |
+
ob_start();
|
185 |
+
|
186 |
+
do_action( 'cartflows_checkout_form_before', $checkout_id );
|
187 |
+
|
188 |
+
$checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
|
189 |
+
|
190 |
+
$template_default = CARTFLOWS_CHECKOUT_DIR . 'templates/embed/checkout-template-simple.php';
|
191 |
+
|
192 |
+
$template_layout = apply_filters( 'cartflows_checkout_layout_template', $checkout_layout );
|
193 |
+
|
194 |
+
if ( file_exists( $template_layout ) ) {
|
195 |
+
include $template_layout;
|
196 |
+
} else {
|
197 |
+
include $template_default;
|
198 |
+
}
|
199 |
+
|
200 |
+
$output .= ob_get_clean();
|
201 |
+
|
202 |
+
return $output;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Configure Cart Data.
|
207 |
+
*
|
208 |
+
* @since 1.0.0
|
209 |
+
*
|
210 |
+
* @return void
|
211 |
+
*/
|
212 |
+
function preconfigured_cart_data() {
|
213 |
+
|
214 |
+
if ( is_admin() ) {
|
215 |
+
return;
|
216 |
+
}
|
217 |
+
|
218 |
+
global $post;
|
219 |
+
|
220 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
221 |
+
|
222 |
+
if ( wp_doing_ajax() ) {
|
223 |
+
|
224 |
+
return;
|
225 |
+
} else {
|
226 |
+
|
227 |
+
if ( _is_wcf_checkout_type() ) {
|
228 |
+
$checkout_id = $post->ID;
|
229 |
+
} else {
|
230 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
231 |
+
}
|
232 |
+
|
233 |
+
do_action( 'cartflows_checkout_before_configure_cart', $checkout_id );
|
234 |
+
|
235 |
+
$flow_id = wcf()->utils->get_flow_id_from_step_id( $checkout_id );
|
236 |
+
|
237 |
+
if ( wcf()->flow->is_flow_testmode( $flow_id ) ) {
|
238 |
+
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products', 'dummy' );
|
239 |
+
} else {
|
240 |
+
$products = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-products' );
|
241 |
+
}
|
242 |
+
|
243 |
+
if ( ! is_array( $products ) ) {
|
244 |
+
|
245 |
+
if ( 'dummy' === $products ) {
|
246 |
+
|
247 |
+
$args = array(
|
248 |
+
'posts_per_page' => 1,
|
249 |
+
'orderby' => 'rand',
|
250 |
+
'post_type' => 'product',
|
251 |
+
'meta_query' => array(
|
252 |
+
// Exclude out of stock products.
|
253 |
+
array(
|
254 |
+
'key' => '_stock_status',
|
255 |
+
'value' => 'outofstock',
|
256 |
+
'compare' => 'NOT IN',
|
257 |
+
),
|
258 |
+
),
|
259 |
+
'tax_query' => array(
|
260 |
+
array(
|
261 |
+
'taxonomy' => 'product_type',
|
262 |
+
'field' => 'slug',
|
263 |
+
'terms' => 'simple',
|
264 |
+
),
|
265 |
+
),
|
266 |
+
);
|
267 |
+
|
268 |
+
$random_product = get_posts( $args );
|
269 |
+
|
270 |
+
if ( isset( $random_product[0]->ID ) ) {
|
271 |
+
$products = array(
|
272 |
+
array(
|
273 |
+
'product' => $random_product[0]->ID,
|
274 |
+
),
|
275 |
+
);
|
276 |
+
} else {
|
277 |
+
return;
|
278 |
+
}
|
279 |
+
} else {
|
280 |
+
return;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
if ( is_array( $products ) && count( $products ) < 1 ) {
|
285 |
+
|
286 |
+
return;
|
287 |
+
}
|
288 |
+
/* Empty the current cart */
|
289 |
+
WC()->cart->empty_cart();
|
290 |
+
|
291 |
+
/* Set customer session if not set */
|
292 |
+
if ( ! is_user_logged_in() && WC()->cart->is_empty() ) {
|
293 |
+
WC()->session->set_customer_session_cookie( true );
|
294 |
+
}
|
295 |
+
|
296 |
+
$cart_product_count = 0;
|
297 |
+
|
298 |
+
foreach ( $products as $index => $data ) {
|
299 |
+
|
300 |
+
if ( ! isset( $data['product'] ) ) {
|
301 |
+
return;
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( apply_filters( 'cartflows_skip_other_products', false, $cart_product_count ) ) {
|
305 |
+
break;
|
306 |
+
}
|
307 |
+
|
308 |
+
$product_id = $data['product'];
|
309 |
+
$_product = wc_get_product( $product_id );
|
310 |
+
|
311 |
+
if ( ! empty( $_product ) ) {
|
312 |
+
|
313 |
+
$quantity = 1;
|
314 |
+
|
315 |
+
if ( ! $_product->is_type( 'grouped' ) && ! $_product->is_type( 'external' ) ) {
|
316 |
+
|
317 |
+
if ( $_product->is_type( 'variable' ) ) {
|
318 |
+
|
319 |
+
$default_attributes = $_product->get_default_attributes();
|
320 |
+
|
321 |
+
if ( ! empty( $default_attributes ) ) {
|
322 |
+
|
323 |
+
foreach ( $_product->get_children() as $variation_id ) {
|
324 |
+
|
325 |
+
$single_variation = new WC_Product_Variation( $variation_id );
|
326 |
+
|
327 |
+
if ( $default_attributes == $single_variation->get_attributes() ) {
|
328 |
+
WC()->cart->add_to_cart( $variation_id, $quantity );
|
329 |
+
$cart_product_count++;
|
330 |
+
}
|
331 |
+
}
|
332 |
+
} else {
|
333 |
+
|
334 |
+
$product_childrens = $_product->get_children();
|
335 |
+
|
336 |
+
if ( isset( $product_childrens[0] ) ) {
|
337 |
+
WC()->cart->add_to_cart( $product_childrens[0], $quantity );
|
338 |
+
$cart_product_count++;
|
339 |
+
} else {
|
340 |
+
echo '<p>' . __( 'Variations Not set', 'cartflows' ) . '</p>';
|
341 |
+
}
|
342 |
+
}
|
343 |
+
} else {
|
344 |
+
WC()->cart->add_to_cart( $product_id, $quantity );
|
345 |
+
$cart_product_count++;
|
346 |
+
}
|
347 |
+
} else {
|
348 |
+
|
349 |
+
echo '<p>' . __( 'This product can\'t be purcahsed', 'cartflows' ) . '</p>';
|
350 |
+
// WC()->cart->add_to_cart( $product_id, $quantity );.
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
do_action( 'cartflows_checkout_aftet_configure_cart', $checkout_id );
|
356 |
+
do_action( 'cartflows_checkout_after_configure_cart', $checkout_id );
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Load shortcode data.
|
363 |
+
*
|
364 |
+
* @return void
|
365 |
+
*/
|
366 |
+
function shortcode_load_data() {
|
367 |
+
|
368 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
369 |
+
|
370 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'shortcode_scripts' ), 21 );
|
371 |
+
|
372 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'compatibility_scripts' ), 101 );
|
373 |
+
|
374 |
+
/* Show notices if cart has errors */
|
375 |
+
add_action( 'woocommerce_cart_has_errors', 'woocommerce_output_all_notices' );
|
376 |
+
|
377 |
+
add_action( 'woocommerce_checkout_after_customer_details', array( $this, 'order_wrap_div_start' ), 99 );
|
378 |
+
|
379 |
+
add_action( 'woocommerce_checkout_after_order_review', array( $this, 'order_wrap_div_end' ), 99 );
|
380 |
+
|
381 |
+
// Outputting the hidden field in checkout page.
|
382 |
+
add_action( 'woocommerce_after_order_notes', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
383 |
+
add_action( 'woocommerce_login_form_end', array( $this, 'checkout_shortcode_post_id' ), 99 );
|
384 |
+
|
385 |
+
remove_all_actions( 'woocommerce_checkout_billing' );
|
386 |
+
remove_all_actions( 'woocommerce_checkout_shipping' );
|
387 |
+
|
388 |
+
// Hook in actions once.
|
389 |
+
add_action( 'woocommerce_checkout_billing', array( WC()->checkout, 'checkout_form_billing' ) );
|
390 |
+
add_action( 'woocommerce_checkout_shipping', array( WC()->checkout, 'checkout_form_shipping' ) );
|
391 |
+
|
392 |
+
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form' );
|
393 |
+
|
394 |
+
add_action( 'woocommerce_checkout_order_review', array( $this, 'display_custom_coupon_field' ) );
|
395 |
+
|
396 |
+
add_filter( 'woocommerce_checkout_fields', array( $this, 'add_three_column_layout_fields' ) );
|
397 |
+
|
398 |
+
global $post;
|
399 |
+
|
400 |
+
if ( _is_wcf_checkout_type() ) {
|
401 |
+
$checkout_id = $post->ID;
|
402 |
+
} else {
|
403 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
404 |
+
}
|
405 |
+
|
406 |
+
do_action( 'cartflows_checkout_before_shortcode', $checkout_id );
|
407 |
+
}
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Render checkout ID hidden field.
|
412 |
+
*
|
413 |
+
* @param array $checkout checkout session data.
|
414 |
+
* @return void
|
415 |
+
*/
|
416 |
+
function checkout_shortcode_post_id( $checkout ) {
|
417 |
+
|
418 |
+
global $post;
|
419 |
+
|
420 |
+
if ( _is_wcf_checkout_type() ) {
|
421 |
+
$checkout_id = $post->ID;
|
422 |
+
} else {
|
423 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
424 |
+
}
|
425 |
+
|
426 |
+
$flow_id = get_post_meta( $checkout_id, 'wcf-flow-id', true );
|
427 |
+
|
428 |
+
echo '<input type="hidden" class="input-hidden _wcf_flow_id" name="_wcf_flow_id" value="' . intval( $flow_id ) . '">';
|
429 |
+
echo '<input type="hidden" class="input-hidden _wcf_checkout_id" name="_wcf_checkout_id" value="' . intval( $checkout_id ) . '">';
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Load shortcode scripts.
|
434 |
+
*
|
435 |
+
* @return void
|
436 |
+
*/
|
437 |
+
function shortcode_scripts() {
|
438 |
+
|
439 |
+
wp_enqueue_style( 'wcf-checkout-template', CARTFLOWS_URL . 'assets/css/checkout-template.css', '', CARTFLOWS_VER );
|
440 |
+
wp_style_add_data( 'wcf-checkout-template', 'rtl', 'replace' );
|
441 |
+
|
442 |
+
wp_enqueue_script(
|
443 |
+
'wcf-checkout-template',
|
444 |
+
CARTFLOWS_URL . 'assets/js/checkout-template.js',
|
445 |
+
array( 'jquery' ),
|
446 |
+
CARTFLOWS_VER,
|
447 |
+
true
|
448 |
+
);
|
449 |
+
|
450 |
+
do_action( 'cartflows_checkout_scripts' );
|
451 |
+
|
452 |
+
$style = $this->generate_style();
|
453 |
+
|
454 |
+
wp_add_inline_style( 'wcf-checkout-template', $style );
|
455 |
+
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Load compatibility scripts.
|
460 |
+
*
|
461 |
+
* @return void
|
462 |
+
*/
|
463 |
+
function compatibility_scripts() {
|
464 |
+
|
465 |
+
global $post;
|
466 |
+
|
467 |
+
if ( _is_wcf_checkout_type() ) {
|
468 |
+
$checkout_id = $post->ID;
|
469 |
+
} else {
|
470 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
471 |
+
}
|
472 |
+
|
473 |
+
// Add DIVI Compatibility css if DIVI theme is enabled.
|
474 |
+
if ( Cartflows_Compatibility::get_instance()->is_divi_enabled() ||
|
475 |
+
Cartflows_Compatibility::get_instance()->is_divi_builder_enabled( $checkout_id )
|
476 |
+
) {
|
477 |
+
wp_enqueue_style( 'wcf-checkout-template-divi', CARTFLOWS_URL . 'assets/css/checkout-template-divi.css', '', CARTFLOWS_VER );
|
478 |
+
wp_style_add_data( 'wcf-checkout-template-divi', 'rtl', 'replace' );
|
479 |
+
}
|
480 |
+
|
481 |
+
// Add Flatsome Compatibility css if Flatsome theme is enabled.
|
482 |
+
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
|
483 |
+
wp_enqueue_style( 'wcf-checkout-template-flatsome', CARTFLOWS_URL . 'assets/css/checkout-template-flatsome.css', '', CARTFLOWS_VER );
|
484 |
+
wp_style_add_data( 'wcf-checkout-template-flatsome', 'rtl', 'replace' );
|
485 |
+
}
|
486 |
+
|
487 |
+
// Add The7 Compatibility css if The7 theme is enabled.
|
488 |
+
if ( Cartflows_Compatibility::get_instance()->is_the_seven_enabled() ) {
|
489 |
+
wp_enqueue_style( 'wcf-checkout-template-the-seven', CARTFLOWS_URL . 'assets/css/checkout-template-the-seven.css', '', CARTFLOWS_VER );
|
490 |
+
wp_style_add_data( 'wcf-checkout-template-the-seven', 'rtl', 'replace' );
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Generate styles.
|
496 |
+
*
|
497 |
+
* @return string
|
498 |
+
*/
|
499 |
+
function generate_style() {
|
500 |
+
|
501 |
+
global $post;
|
502 |
+
|
503 |
+
if ( _is_wcf_checkout_type() ) {
|
504 |
+
$checkout_id = $post->ID;
|
505 |
+
} else {
|
506 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
507 |
+
}
|
508 |
+
|
509 |
+
CartFlows_Font_Families::render_fonts( $checkout_id );
|
510 |
+
|
511 |
+
$primary_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-primary-color' );
|
512 |
+
|
513 |
+
$base_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-family' );
|
514 |
+
|
515 |
+
$header_logo_width = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-width' );
|
516 |
+
|
517 |
+
/*$base_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-base-font-weight' );*/
|
518 |
+
$r = '';
|
519 |
+
$g = '';
|
520 |
+
$b = '';
|
521 |
+
|
522 |
+
$field_tb_padding = '';
|
523 |
+
$field_lr_padding = '';
|
524 |
+
|
525 |
+
$field_heading_color = '';
|
526 |
+
$field_color = '';
|
527 |
+
$field_bg_color = '';
|
528 |
+
$field_border_color = '';
|
529 |
+
$field_label_color = '';
|
530 |
+
$submit_tb_padding = '';
|
531 |
+
$submit_lr_padding = '';
|
532 |
+
$hl_bg_color = '';
|
533 |
+
$field_input_size = '';
|
534 |
+
$box_border_color = '';
|
535 |
+
$section_bg_color = '';
|
536 |
+
$submit_button_height = '';
|
537 |
+
$submit_color = '';
|
538 |
+
$submit_bg_color = $primary_color;
|
539 |
+
$submit_border_color = $primary_color;
|
540 |
+
|
541 |
+
$submit_hover_color = '';
|
542 |
+
$submit_bg_hover_color = $primary_color;
|
543 |
+
$submit_border_hover_color = $primary_color;
|
544 |
+
|
545 |
+
$section_heading_color = '';
|
546 |
+
|
547 |
+
$is_advance_option = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-advance-options-fields' );
|
548 |
+
|
549 |
+
$button_font_family = '';
|
550 |
+
$button_font_weight = '';
|
551 |
+
$input_font_family = '';
|
552 |
+
$input_font_weight = '';
|
553 |
+
$heading_font_family = '';
|
554 |
+
$heading_font_weight = '';
|
555 |
+
$base_font_family = $base_font_family;
|
556 |
+
/*$base_font_weight = $base_font_weight;*/
|
557 |
+
|
558 |
+
if ( 'yes' == $is_advance_option ) {
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Get Font Family and Font Weight weight values
|
562 |
+
*/
|
563 |
+
$section_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-section-bg-color' );
|
564 |
+
|
565 |
+
$heading_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-family' );
|
566 |
+
$heading_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-font-weight' );
|
567 |
+
$section_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-heading-color' );
|
568 |
+
$button_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-family' );
|
569 |
+
$button_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-button-font-weight' );
|
570 |
+
$input_font_family = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-family' );
|
571 |
+
$input_font_weight = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-font-weight' );
|
572 |
+
$field_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-tb-padding' );
|
573 |
+
$field_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-lr-padding' );
|
574 |
+
$field_input_size = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-field-size' );
|
575 |
+
|
576 |
+
$field_heading_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-heading-color' );
|
577 |
+
|
578 |
+
$field_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-color' );
|
579 |
+
|
580 |
+
$field_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-bg-color' );
|
581 |
+
|
582 |
+
$field_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-border-color' );
|
583 |
+
|
584 |
+
$field_label_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-field-label-color' );
|
585 |
+
|
586 |
+
$submit_tb_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-tb-padding' );
|
587 |
+
|
588 |
+
$submit_lr_padding = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-lr-padding' );
|
589 |
+
|
590 |
+
$submit_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-color' );
|
591 |
+
|
592 |
+
$submit_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-color', $primary_color );
|
593 |
+
|
594 |
+
$submit_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-color', $primary_color );
|
595 |
+
|
596 |
+
$submit_border_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-border-hover-color', $primary_color );
|
597 |
+
|
598 |
+
$submit_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-hover-color' );
|
599 |
+
|
600 |
+
$submit_bg_hover_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-submit-bg-hover-color', $primary_color );
|
601 |
+
|
602 |
+
$hl_bg_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-hl-bg-color' );
|
603 |
+
|
604 |
+
$box_border_color = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-box-border-color' );
|
605 |
+
|
606 |
+
$submit_button_height = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-input-button-size' );
|
607 |
+
|
608 |
+
/**
|
609 |
+
* Get font values
|
610 |
+
*/
|
611 |
+
|
612 |
+
if ( 'custom' == $submit_button_height ) {
|
613 |
+
$submit_button_height = '38px';
|
614 |
+
}
|
615 |
+
|
616 |
+
if ( 'custom' == $field_input_size ) {
|
617 |
+
$field_input_size = '38px';
|
618 |
+
}
|
619 |
+
}
|
620 |
+
if ( isset( $primary_color ) ) {
|
621 |
+
|
622 |
+
list($r, $g, $b) = sscanf( $primary_color, '#%02x%02x%02x' );
|
623 |
+
}
|
624 |
+
$output = "
|
625 |
+
.wcf-embed-checkout-form .wcf-checkout-header-image img{
|
626 |
+
width: {$header_logo_width}px;
|
627 |
+
}
|
628 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:checked:before,
|
629 |
+
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:checked:before{
|
630 |
+
color: {$primary_color};
|
631 |
+
}
|
632 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:before{
|
633 |
+
background-color: {$primary_color};
|
634 |
+
}
|
635 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=checkbox]:focus,
|
636 |
+
.wcf-embed-checkout-form .woocommerce .woocommerce-shipping-fields [type='checkbox']:focus,
|
637 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:checked:focus,
|
638 |
+
.wcf-embed-checkout-form .woocommerce #payment input[type=radio]:not(:checked):focus{
|
639 |
+
border-color: {$primary_color};
|
640 |
+
box-shadow: 0 0 2px rgba( " . $r . ',' . $g . ',' . $b . ", .8);
|
641 |
+
}
|
642 |
+
.wcf-embed-checkout-form .woocommerce-checkout label{
|
643 |
+
color: {$field_label_color};
|
644 |
+
}
|
645 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box{
|
646 |
+
background-color: {$hl_bg_color};
|
647 |
+
font-family: {$input_font_family};
|
648 |
+
font-weight: {$input_font_weight};
|
649 |
+
}
|
650 |
+
|
651 |
+
.wcf-embed-checkout-form #add_payment_method #payment div.payment_box::before,
|
652 |
+
.wcf-embed-checkout-form .woocommerce-cart #payment div.payment_box::before,
|
653 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment div.payment_box::before
|
654 |
+
{
|
655 |
+
border-color: {$hl_bg_color};
|
656 |
+
border-right-color: transparent;
|
657 |
+
border-left-color: transparent;
|
658 |
+
border-top-color: transparent;
|
659 |
+
position: absolute;
|
660 |
+
}
|
661 |
+
|
662 |
+
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:checked + label,
|
663 |
+
.wcf-embed-checkout-form .woocommerce #payment [type='radio']:not(:checked) + label{
|
664 |
+
font-family: {$input_font_family};
|
665 |
+
font-weight: {$input_font_weight};
|
666 |
+
}
|
667 |
+
|
668 |
+
.wcf-embed-checkout-form #order_review .wcf-custom-coupon-field input[type='text'],
|
669 |
+
.wcf-embed-checkout-form .woocommerce form .form-row input.input-text,
|
670 |
+
.wcf-embed-checkout-form .woocommerce form .form-row textarea,
|
671 |
+
.wcf-embed-checkout-form .select2-container--default .select2-selection--single {
|
672 |
+
color: {$field_color};
|
673 |
+
background: {$field_bg_color};
|
674 |
+
border-color: {$field_border_color};
|
675 |
+
padding-top: {$field_tb_padding}px;
|
676 |
+
padding-bottom: {$field_tb_padding}px;
|
677 |
+
padding-left: {$field_lr_padding}px;
|
678 |
+
padding-right: {$field_lr_padding}px;
|
679 |
+
min-height: {$field_input_size};
|
680 |
+
font-family: {$input_font_family};
|
681 |
+
font-weight: {$input_font_weight};
|
682 |
+
}
|
683 |
+
|
684 |
+
.wcf-embed-checkout-form .woocommerce .col2-set .col-1,
|
685 |
+
.wcf-embed-checkout-form .woocommerce .col2-set .col-2,
|
686 |
+
.wcf-embed-checkout-form .woocommerce-checkout .shop_table,
|
687 |
+
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading,
|
688 |
+
.wcf-embed-checkout-form .woocommerce-checkout #payment,
|
689 |
+
.wcf-embed-checkout-form .woocommerce form.checkout_coupon
|
690 |
+
{
|
691 |
+
background-color: {$section_bg_color};
|
692 |
+
border-color: {$box_border_color};
|
693 |
+
font-family: {$input_font_family};
|
694 |
+
font-weight: {$input_font_weight};
|
695 |
+
}
|
696 |
+
|
697 |
+
.woocommerce table.shop_table th{
|
698 |
+
color: {$field_label_color};
|
699 |
+
}
|
700 |
+
/*.wcf-embed-checkout-form .woocommerce .woocommerce-info,
|
701 |
+
.wcf-embed-checkout-form .woocommerce-message{
|
702 |
+
border-top-color: {$primary_color};
|
703 |
+
background-color: {$hl_bg_color};
|
704 |
+
}*/
|
705 |
+
.wcf-embed-checkout-form .woocommerce a{
|
706 |
+
color: {$primary_color};
|
707 |
+
}
|
708 |
+
.wcf-embed-checkout-form .select2-container--default .select2-selection--single .select2-selection__rendered {
|
709 |
+
color: {$field_color};
|
710 |
+
}
|
711 |
+
.wcf-embed-checkout-form ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
|
712 |
+
color: {$field_color};
|
713 |
+
}
|
714 |
+
.wcf-embed-checkout-form ::-moz-placeholder { /* Firefox 19+ */
|
715 |
+
color: {$field_color};
|
716 |
+
}
|
717 |
+
.wcf-embed-checkout-form :-ms-input-placeholder { /* IE 10+ */
|
718 |
+
color: {$field_color};
|
719 |
+
}
|
720 |
+
.wcf-embed-checkout-form :-moz-placeholder { /* Firefox 18- */
|
721 |
+
color: {$field_color};
|
722 |
+
}
|
723 |
+
.wcf-embed-checkout-form .woocommerce form p.form-row label {
|
724 |
+
color: {$field_label_color};
|
725 |
+
font-family: {$input_font_family};
|
726 |
+
font-weight: {$input_font_weight};
|
727 |
+
}
|
728 |
+
.wcf-embed-checkout-form .woocommerce #order_review button,
|
729 |
+
.wcf-embed-checkout-form .woocommerce form.woocommerce-form-login .form-row button,
|
730 |
+
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small {
|
731 |
+
color: {$submit_color};
|
732 |
+
background: {$submit_bg_color};
|
733 |
+
padding-top: {$submit_tb_padding}px;
|
734 |
+
padding-bottom: {$submit_tb_padding}px;
|
735 |
+
padding-left: {$submit_lr_padding}px;
|
736 |
+
padding-right: {$submit_lr_padding}px;
|
737 |
+
border-color: {$submit_border_color};
|
738 |
+
min-height: {$submit_button_height};
|
739 |
+
font-family: {$button_font_family};
|
740 |
+
font-weight: {$button_font_weight};
|
741 |
+
}
|
742 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.woocommerce-form-login .button,
|
743 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button{
|
744 |
+
background: {$submit_bg_color};
|
745 |
+
border: 1px {$submit_border_color} solid;
|
746 |
+
color: {$submit_color};
|
747 |
+
min-height: {$submit_button_height};
|
748 |
+
font-family: {$button_font_family};
|
749 |
+
font-weight: {$button_font_weight};
|
750 |
+
}
|
751 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.login .button:hover,
|
752 |
+
.wcf-embed-checkout-form .woocommerce-checkout form.checkout_coupon .button:hover,
|
753 |
+
.wcf-embed-checkout-form .woocommerce #payment #place_order:hover,
|
754 |
+
.wcf-embed-checkout-form .woocommerce #order_review button.wcf-btn-small:hover{
|
755 |
+
color: {$submit_hover_color};
|
756 |
+
background-color: {$submit_bg_hover_color};
|
757 |
+
border-color: {$submit_border_hover_color};
|
758 |
+
}
|
759 |
+
.wcf-embed-checkout-form .woocommerce h3,
|
760 |
+
.wcf-embed-checkout-form .woocommerce h3 span,
|
761 |
+
.wcf-embed-checkout-form .woocommerce-checkout #order_review_heading{
|
762 |
+
color: {$section_heading_color};
|
763 |
+
font-family: {$heading_font_family};
|
764 |
+
font-weight: {$heading_font_weight};
|
765 |
+
}
|
766 |
+
.wcf-embed-checkout-form .woocommerce-info::before,
|
767 |
+
.wcf-embed-checkout-form .woocommerce-message::before{
|
768 |
+
color: {$primary_color};
|
769 |
+
}
|
770 |
+
.wcf-embed-checkout-form{
|
771 |
+
font-family: {$base_font_family};
|
772 |
+
}";
|
773 |
+
|
774 |
+
return $output;
|
775 |
+
}
|
776 |
+
|
777 |
+
/**
|
778 |
+
* Get ajax end points.
|
779 |
+
*
|
780 |
+
* @param string $endpoint_url end point URL.
|
781 |
+
* @return string
|
782 |
+
*/
|
783 |
+
function get_ajax_endpoint( $endpoint_url ) {
|
784 |
+
|
785 |
+
global $post;
|
786 |
+
|
787 |
+
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
788 |
+
|
789 |
+
if ( _is_wcf_checkout_type() || _is_wcf_checkout_shortcode() ) {
|
790 |
+
|
791 |
+
if ( mb_strpos( $endpoint_url, 'checkout' ) === false ) {
|
792 |
+
|
793 |
+
$query_args = array(
|
794 |
+
'wc-ajax' => '%%endpoint%%',
|
795 |
+
);
|
796 |
+
|
797 |
+
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 );
|
798 |
+
$uri = $uri[0];
|
799 |
+
|
800 |
+
$endpoint_url = esc_url( add_query_arg( $query_args, $uri ) );
|
801 |
+
}
|
802 |
+
}
|
803 |
+
}
|
804 |
+
|
805 |
+
return $endpoint_url;
|
806 |
+
}
|
807 |
+
|
808 |
+
|
809 |
+
/**
|
810 |
+
* Save checkout fields.
|
811 |
+
*
|
812 |
+
* @param int $order_id order id.
|
813 |
+
* @param array $posted posted data.
|
814 |
+
* @return void
|
815 |
+
*/
|
816 |
+
function save_checkout_fields( $order_id, $posted ) {
|
817 |
+
|
818 |
+
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
819 |
+
|
820 |
+
$checkout_id = wc_clean( $_POST['_wcf_checkout_id'] );
|
821 |
+
|
822 |
+
update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
|
823 |
+
|
824 |
+
/*
|
825 |
+
Custom Field To Do
|
826 |
+
$custom_fields = get_post_meta( $checkout_id, 'wcf-custom-checkout-fields', true );
|
827 |
+
|
828 |
+
if ( 'yes' === $custom_fields ) {
|
829 |
+
|
830 |
+
$billing_fields = get_post_meta( $checkout_id, 'wcf_fields_billing', true );
|
831 |
+
|
832 |
+
foreach ( $billing_fields as $field => $data ) {
|
833 |
+
|
834 |
+
if ( isset( $data['custom'] ) && $data['custom'] ) {
|
835 |
+
|
836 |
+
if ( isset( $_POST[ $field ] ) ) {
|
837 |
+
update_post_meta( $order_id, $field, wc_clean( $_POST[ $field ] ) );
|
838 |
+
}
|
839 |
+
}
|
840 |
+
}
|
841 |
+
|
842 |
+
$shipping_fields = get_post_meta( $checkout_id, 'wcf_fields_shipping', true );
|
843 |
+
|
844 |
+
foreach ( $shipping_fields as $field => $data ) {
|
845 |
+
|
846 |
+
if ( isset( $data['custom'] ) && $data['custom'] ) {
|
847 |
+
|
848 |
+
if ( isset( $_POST[ $field ] ) ) {
|
849 |
+
update_post_meta( $order_id, $field, wc_clean( $_POST[ $field ] ) );
|
850 |
+
}
|
851 |
+
}
|
852 |
+
}
|
853 |
+
}
|
854 |
+
*/
|
855 |
+
if ( isset( $_POST['_wcf_flow_id'] ) ) {
|
856 |
+
|
857 |
+
$checkout_id = wc_clean( $_POST['_wcf_flow_id'] );
|
858 |
+
|
859 |
+
update_post_meta( $order_id, '_wcf_flow_id', $checkout_id );
|
860 |
+
}
|
861 |
+
}
|
862 |
+
|
863 |
+
}
|
864 |
+
|
865 |
+
/**
|
866 |
+
* Enable Logo In Header Of Checkout Page
|
867 |
+
*
|
868 |
+
* @return void
|
869 |
+
*/
|
870 |
+
function enable_logo_in_header() {
|
871 |
+
global $post;
|
872 |
+
|
873 |
+
if ( _is_wcf_checkout_type() ) {
|
874 |
+
$checkout_id = $post->ID;
|
875 |
+
} else {
|
876 |
+
$checkout_id = _get_wcf_checkout_id_from_shortcode( $post->post_content );
|
877 |
+
}
|
878 |
+
|
879 |
+
$header_logo_image = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-header-logo-image' );
|
880 |
+
$add_image_markup = '';
|
881 |
+
|
882 |
+
if ( isset( $header_logo_image ) && ! empty( $header_logo_image ) ) {
|
883 |
+
$add_image_markup = '<div class="wcf-checkout-header-image">';
|
884 |
+
$add_image_markup .= '<img src="' . $header_logo_image . '" />';
|
885 |
+
$add_image_markup .= '</div>';
|
886 |
+
}
|
887 |
+
|
888 |
+
echo $add_image_markup;
|
889 |
+
}
|
890 |
+
|
891 |
+
/**
|
892 |
+
* Add text to the bootom of the checkout page.
|
893 |
+
*
|
894 |
+
* @return void
|
895 |
+
*/
|
896 |
+
function show_cartflows_copyright_message() {
|
897 |
+
$output_string = '';
|
898 |
+
|
899 |
+
$output_string .= '<div class="wcf-footer-primary">';
|
900 |
+
$output_string .= '<div class="wcf-footer-content">';
|
901 |
+
$output_string .= '<p class="wcf-footer-message">';
|
902 |
+
$output_string .= 'Checkout powered by CartFlows';
|
903 |
+
$output_string .= '</p>';
|
904 |
+
$output_string .= '</div>';
|
905 |
+
$output_string .= '</div>';
|
906 |
+
|
907 |
+
echo $output_string;
|
908 |
+
}
|
909 |
+
|
910 |
+
/**
|
911 |
+
* Redirect users to our checkout if hidden param
|
912 |
+
*
|
913 |
+
* @param string $redirect redirect url.
|
914 |
+
* @param object $user user.
|
915 |
+
* @return string
|
916 |
+
*/
|
917 |
+
function after_login_redirect( $redirect, $user ) {
|
918 |
+
|
919 |
+
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
920 |
+
|
921 |
+
$checkout_id = intval( $_POST['_wcf_checkout_id'] );
|
922 |
+
|
923 |
+
$redirect = get_permalink( $checkout_id );
|
924 |
+
}
|
925 |
+
|
926 |
+
return $redirect;
|
927 |
+
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* Display coupon code field after review order fields.
|
931 |
+
*/
|
932 |
+
function display_custom_coupon_field() {
|
933 |
+
|
934 |
+
$coupon_enabled = apply_filters( 'woocommerce_coupons_enabled', true );
|
935 |
+
$cf_show_coupon = apply_filters( 'cartflows_show_coupon_field', true );
|
936 |
+
|
937 |
+
if ( ! ( $coupon_enabled && $cf_show_coupon ) ) {
|
938 |
+
return;
|
939 |
+
|
940 |
+
}
|
941 |
+
|
942 |
+
ob_start();
|
943 |
+
?>
|
944 |
+
<div class="wcf-custom-coupon-field">
|
945 |
+
<div class="wcf-coupon-col-1">
|
946 |
+
<span>
|
947 |
+
<input type="text" name="coupon_code" class="input-text cf-coupon-code-input" placeholder="<?php _e( 'Coupon Code', 'cartflows' ); ?>" id="coupon_code" value="">
|
948 |
+
</span>
|
949 |
+
</div>
|
950 |
+
<div class="wcf-coupon-col-2">
|
951 |
+
<span>
|
952 |
+
<button type="button" class="button cf-submit-coupon wcf-btn-small" name="apply_coupon" value="Apply"><?php _e( 'Apply', 'cartflows' ); ?></button>
|
953 |
+
</span>
|
954 |
+
</div>
|
955 |
+
</div>
|
956 |
+
<?php
|
957 |
+
echo ob_get_clean();
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* Apply filter to change the placeholder text of coupon field.
|
962 |
+
*
|
963 |
+
* @return string
|
964 |
+
*/
|
965 |
+
function coupon_field_placeholder() {
|
966 |
+
return apply_filters( 'cartflows_coupon_field_placeholder', __( 'Coupon Code', 'cartflows' ) );
|
967 |
+
}
|
968 |
+
|
969 |
+
/**
|
970 |
+
* Apply filter to change the button text of coupon field.
|
971 |
+
*
|
972 |
+
* @return string
|
973 |
+
*/
|
974 |
+
function coupon_button_text() {
|
975 |
+
return apply_filters( 'cartflows_coupon_button_text', __( 'Apply', 'cartflows' ) );
|
976 |
+
}
|
977 |
+
|
978 |
+
/**
|
979 |
+
* Apply coupon on submit of custom coupon form.
|
980 |
+
*/
|
981 |
+
function apply_coupon() {
|
982 |
+
|
983 |
+
check_ajax_referer( 'cf-apply-coupon', 'security' );
|
984 |
+
|
985 |
+
$result = WC()->cart->add_discount( sanitize_text_field( wp_unslash( $_POST['coupon_code'] ) ) );
|
986 |
+
|
987 |
+
echo json_encode( $result );
|
988 |
+
die();
|
989 |
+
}
|
990 |
+
|
991 |
+
/**
|
992 |
+
* Added ajax nonce to localize variable.
|
993 |
+
*
|
994 |
+
* @param array $vars localize variables.
|
995 |
+
*/
|
996 |
+
function add_localize_vars( $vars ) {
|
997 |
+
|
998 |
+
$vars['cf_validate_coupon_nonce'] = wp_create_nonce( 'cf-apply-coupon' );
|
999 |
+
|
1000 |
+
$vars['allow_persistance'] = apply_filters( 'cartflows_allow_persistace', 'yes' );
|
1001 |
+
|
1002 |
+
return $vars;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
/**
|
1006 |
+
* Add custom class to the fields to change the UI to three column.
|
1007 |
+
*
|
1008 |
+
* @param array $fields fields.
|
1009 |
+
*/
|
1010 |
+
function add_three_column_layout_fields( $fields ) {
|
1011 |
+
|
1012 |
+
if ( empty( $fields['billing']['billing_address_2'] ) ) {
|
1013 |
+
|
1014 |
+
if ( isset( $fields['billing']['billing_address_1'] ) && is_array( $fields['billing']['billing_address_1'] ) ) {
|
1015 |
+
$fields['billing']['billing_address_1']['class'][] = 'form-row-full';
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
if ( ! empty( $fields['billing']['billing_company'] ) ) {
|
1020 |
+
|
1021 |
+
if ( isset( $fields['billing']['billing_company'] ) && is_array( $fields['billing']['billing_company'] ) ) {
|
1022 |
+
$fields['billing']['billing_company']['class'][] = 'form-row-full';
|
1023 |
+
}
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
if ( ! empty( $fields['shipping']['shipping_company'] ) ) {
|
1027 |
+
|
1028 |
+
if ( isset( $fields['shipping']['shipping_company'] ) && is_array( $fields['shipping']['shipping_company'] ) ) {
|
1029 |
+
$fields['shipping']['shipping_company']['class'][] = 'form-row-full';
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
if ( ! empty( $fields['billing']['billing_country'] ) ) {
|
1034 |
+
|
1035 |
+
if ( isset( $fields['billing']['billing_country'] ) && is_array( $fields['billing']['billing_country'] ) ) {
|
1036 |
+
$fields['billing']['billing_country']['class'][] = 'form-row-full';
|
1037 |
+
}
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
if ( ! empty( $fields['shipping']['shipping_country'] ) ) {
|
1041 |
+
|
1042 |
+
if ( isset( $fields['shipping']['shipping_country'] ) && is_array( $fields['shipping']['shipping_country'] ) ) {
|
1043 |
+
$fields['shipping']['shipping_country']['class'][] = 'form-row-full';
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
if ( ! empty( $fields['billing']['billing_phone'] ) ) {
|
1048 |
+
|
1049 |
+
if ( isset( $fields['billing']['billing_phone'] ) && is_array( $fields['billing']['billing_phone'] ) ) {
|
1050 |
+
$fields['billing']['billing_phone']['class'][] = 'form-row-full';
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
if ( ! empty( $fields['billing']['billing_email'] ) ) {
|
1055 |
+
|
1056 |
+
if ( isset( $fields['billing']['billing_email'] ) && is_array( $fields['billing']['billing_email'] ) ) {
|
1057 |
+
$fields['billing']['billing_email']['class'][] = 'form-row-full';
|
1058 |
+
}
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
if ( empty( $fields['shipping']['shipping_address_2'] ) ) {
|
1062 |
+
|
1063 |
+
if ( isset( $fields['shipping']['shipping_address_1'] ) && is_array( $fields['shipping']['shipping_address_1'] ) ) {
|
1064 |
+
$fields['shipping']['shipping_address_1']['class'][] = 'form-row-full';
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
if ( isset( $fields['billing']['billing_city'] ) &&
|
1069 |
+
isset( $fields['billing']['billing_state'] ) && isset( $fields['billing']['billing_postcode'] ) ) {
|
1070 |
+
|
1071 |
+
$fields['billing']['billing_city']['class'][] = 'wcf-column-33';
|
1072 |
+
$fields['billing']['billing_state']['class'][] = 'wcf-column-33';
|
1073 |
+
$fields['billing']['billing_postcode']['class'][] = 'wcf-column-33';
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
if ( isset( $fields['shipping']['shipping_city'] ) &&
|
1077 |
+
isset( $fields['shipping']['shipping_state'] ) && isset( $fields['shipping']['shipping_postcode'] ) ) {
|
1078 |
+
|
1079 |
+
$fields['shipping']['shipping_city']['class'][] = 'wcf-column-33';
|
1080 |
+
$fields['shipping']['shipping_state']['class'][] = 'wcf-column-33';
|
1081 |
+
$fields['shipping']['shipping_postcode']['class'][] = 'wcf-column-33';
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
return $fields;
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
/**
|
1088 |
+
* Add opening dev
|
1089 |
+
*
|
1090 |
+
* @since 1.0.0
|
1091 |
+
*/
|
1092 |
+
function order_wrap_div_start() {
|
1093 |
+
|
1094 |
+
echo "<div class='wcf-order-wrap'> ";
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
/**
|
1098 |
+
* Add closing dev
|
1099 |
+
*
|
1100 |
+
* @since 1.0.0
|
1101 |
+
*/
|
1102 |
+
function order_wrap_div_end() {
|
1103 |
+
|
1104 |
+
echo '</div> ';
|
1105 |
+
}
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
/**
|
1109 |
+
* Kicking this off by calling 'get_instance()' method
|
1110 |
+
*/
|
1111 |
+
Cartflows_Checkout_Markup::get_instance();
|
modules/checkout/classes/class-cartflows-checkout-meta.php
CHANGED
@@ -150,11 +150,10 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
150 |
|
151 |
$tabs = array(
|
152 |
array(
|
153 |
-
'title'
|
154 |
-
'id'
|
155 |
-
'class'
|
156 |
-
'icon'
|
157 |
-
'help_text' => 'Help Helpppp...',
|
158 |
),
|
159 |
array(
|
160 |
'title' => __( 'Select Product', 'cartflows' ),
|
@@ -186,6 +185,12 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
186 |
'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
187 |
'icon' => 'dashicons-format-image',
|
188 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
);
|
190 |
|
191 |
?>
|
@@ -211,6 +216,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
211 |
<?php $this->tab_product_bump( $options, $post_id ); ?>
|
212 |
<?php $this->tab_custom_fields( $options, $post_id ); ?>
|
213 |
<?php $this->tab_header_content( $options, $post_id ); ?>
|
|
|
214 |
<?php $this->right_column_footer( $options, $post_id ); ?>
|
215 |
</div>
|
216 |
</div>
|
150 |
|
151 |
$tabs = array(
|
152 |
array(
|
153 |
+
'title' => __( 'Shortcodes', 'cartflows' ),
|
154 |
+
'id' => 'wcf-checkout-shortcodes',
|
155 |
+
'class' => 'wcf-checkout-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
156 |
+
'icon' => 'dashicons-editor-code',
|
|
|
157 |
),
|
158 |
array(
|
159 |
'title' => __( 'Select Product', 'cartflows' ),
|
185 |
'class' => 'wcf-checkout-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
186 |
'icon' => 'dashicons-format-image',
|
187 |
),
|
188 |
+
array(
|
189 |
+
'title' => __( 'Custom Script', 'cartflows' ),
|
190 |
+
'id' => 'wcf-checkout-custom-script-header',
|
191 |
+
'class' => 'wcf-checkout-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
192 |
+
'icon' => 'dashicons-format-aside',
|
193 |
+
),
|
194 |
);
|
195 |
|
196 |
?>
|
216 |
<?php $this->tab_product_bump( $options, $post_id ); ?>
|
217 |
<?php $this->tab_custom_fields( $options, $post_id ); ?>
|
218 |
<?php $this->tab_header_content( $options, $post_id ); ?>
|
219 |
+
<?php $this->tab_custom_script( $options, $post_id ); ?>
|
220 |
<?php $this->right_column_footer( $options, $post_id ); ?>
|
221 |
</div>
|
222 |
</div>
|
modules/flow/classes/class-cartflows-step-post-type.php
CHANGED
@@ -1,465 +1,465 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Step post type.
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialization
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Step_Post_Type {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Member Variable
|
25 |
-
*
|
26 |
-
* @var body_classes
|
27 |
-
*/
|
28 |
-
private $body_classes = array();
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Initiator
|
32 |
-
*/
|
33 |
-
public static function get_instance() {
|
34 |
-
if ( ! isset( self::$instance ) ) {
|
35 |
-
self::$instance = new self;
|
36 |
-
}
|
37 |
-
return self::$instance;
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Constructor
|
42 |
-
*/
|
43 |
-
public function __construct() {
|
44 |
-
|
45 |
-
add_action( 'init', array( $this, 'step_post_type' ) );
|
46 |
-
add_action( 'init', array( $this, 'add_wp_templates_support' ) );
|
47 |
-
add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
|
48 |
-
add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
|
49 |
-
add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
|
50 |
-
add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
|
51 |
-
|
52 |
-
add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Trys to load page.php for a header, footer or part theme layout.
|
58 |
-
*
|
59 |
-
* @since 1.0.0
|
60 |
-
* @param string $template The current template to be loaded.
|
61 |
-
* @return string
|
62 |
-
*/
|
63 |
-
function load_page_template( $template ) {
|
64 |
-
|
65 |
-
global $post;
|
66 |
-
|
67 |
-
if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Remove Next/Prev Navigation
|
71 |
-
* add_filter('next_post_link', '__return_empty_string');
|
72 |
-
* add_filter('previous_post_link', '__return_empty_string');
|
73 |
-
*
|
74 |
-
* $page = locate_template( array( 'page.php' ) );
|
75 |
-
*
|
76 |
-
* if ( ! empty( $page ) ) {
|
77 |
-
* return $page;
|
78 |
-
* }
|
79 |
-
*/
|
80 |
-
|
81 |
-
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
82 |
-
|
83 |
-
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
84 |
-
|
85 |
-
$file = '';
|
86 |
-
|
87 |
-
switch ( $page_template ) {
|
88 |
-
|
89 |
-
case 'cartflows-default':
|
90 |
-
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
91 |
-
$this->body_classes[] = $page_template;
|
92 |
-
break;
|
93 |
-
case 'cartflows-canvas':
|
94 |
-
$file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
|
95 |
-
$this->body_classes[] = $page_template;
|
96 |
-
break;
|
97 |
-
default:
|
98 |
-
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
99 |
-
$this->body_classes[] = 'cartflows-default';
|
100 |
-
break;
|
101 |
-
}
|
102 |
-
|
103 |
-
// Just to be safe, we check if the file exist first.
|
104 |
-
if ( file_exists( $file ) ) {
|
105 |
-
|
106 |
-
/* Add Body Class */
|
107 |
-
add_filter( 'body_class', [ $this, 'body_class' ] );
|
108 |
-
|
109 |
-
return $file;
|
110 |
-
} else {
|
111 |
-
echo $file;
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
return $template;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Body classes.
|
120 |
-
*
|
121 |
-
* @since 1.0.0
|
122 |
-
* @param array $classes Body classes.
|
123 |
-
* @return array
|
124 |
-
*/
|
125 |
-
function body_class( $classes = [] ) {
|
126 |
-
|
127 |
-
$classes = array_merge( $classes, $this->body_classes );
|
128 |
-
|
129 |
-
return $classes;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Create custom post type
|
134 |
-
*/
|
135 |
-
function step_post_type() {
|
136 |
-
|
137 |
-
$labels = array(
|
138 |
-
'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
|
139 |
-
'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
|
140 |
-
'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
|
141 |
-
'all_items' => esc_html__( 'All Steps', 'cartflows' ),
|
142 |
-
'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
|
143 |
-
'view_item' => esc_html__( 'View Step', 'cartflows' ),
|
144 |
-
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
145 |
-
'update_item' => esc_html__( 'Update Step', 'cartflows' ),
|
146 |
-
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
147 |
-
'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
|
148 |
-
);
|
149 |
-
|
150 |
-
$args = array(
|
151 |
-
'labels' => $labels,
|
152 |
-
'public' => true,
|
153 |
-
'query_var' => true,
|
154 |
-
'can_export' => true,
|
155 |
-
'exclude_from_search' => true,
|
156 |
-
'show_ui' => true,
|
157 |
-
'show_in_menu' => false,
|
158 |
-
'show_in_admin_bar' => true,
|
159 |
-
'supports' => array( 'title', 'editor', 'elementor' ),
|
160 |
-
'capability_type' => 'post',
|
161 |
-
'capabilities' => array(
|
162 |
-
'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
|
163 |
-
),
|
164 |
-
'map_meta_cap' => true,
|
165 |
-
);
|
166 |
-
|
167 |
-
register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
|
168 |
-
|
169 |
-
$args = array(
|
170 |
-
'label' => __( 'Step Type', 'cartflows' ),
|
171 |
-
'public' => false,
|
172 |
-
'rewrite' => false,
|
173 |
-
'hierarchical' => false,
|
174 |
-
);
|
175 |
-
|
176 |
-
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
|
177 |
-
|
178 |
-
$args = array(
|
179 |
-
'label' => __( 'Step Flow', 'cartflows' ),
|
180 |
-
'public' => false,
|
181 |
-
'rewrite' => false,
|
182 |
-
'hierarchical' => false,
|
183 |
-
);
|
184 |
-
|
185 |
-
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Register 'Elementor' & 'Beaver Builder' site types.
|
189 |
-
*
|
190 |
-
* @see self::add_terms();
|
191 |
-
*/
|
192 |
-
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
193 |
-
|
194 |
-
$terms = array(
|
195 |
-
array(
|
196 |
-
'name' => __( 'Landing', 'cartflows' ),
|
197 |
-
'args' => array(
|
198 |
-
'slug' => 'landing',
|
199 |
-
),
|
200 |
-
),
|
201 |
-
array(
|
202 |
-
'name' => __( 'Checkout', 'cartflows' ),
|
203 |
-
'args' => array(
|
204 |
-
'slug' => 'checkout',
|
205 |
-
),
|
206 |
-
),
|
207 |
-
array(
|
208 |
-
'name' => __( 'Thank You', 'cartflows' ),
|
209 |
-
'args' => array(
|
210 |
-
'slug' => 'thankyou',
|
211 |
-
),
|
212 |
-
),
|
213 |
-
array(
|
214 |
-
'name' => __( 'Upsell', 'cartflows' ),
|
215 |
-
'args' => array(
|
216 |
-
'slug' => 'upsell',
|
217 |
-
),
|
218 |
-
),
|
219 |
-
array(
|
220 |
-
'name' => __( 'Downsell', 'cartflows' ),
|
221 |
-
'args' => array(
|
222 |
-
'slug' => 'downsell',
|
223 |
-
),
|
224 |
-
),
|
225 |
-
);
|
226 |
-
|
227 |
-
$this->add_terms( $taxonomy, $terms );
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Add WordPress templates.
|
232 |
-
*
|
233 |
-
* Adds Cartflows templates to steps
|
234 |
-
*
|
235 |
-
* @since 1.0.0
|
236 |
-
* @access public
|
237 |
-
*/
|
238 |
-
function add_wp_templates_support() {
|
239 |
-
add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Add page templates.
|
244 |
-
*
|
245 |
-
* @since 1.0.0
|
246 |
-
* @access public
|
247 |
-
*
|
248 |
-
* @param array $page_templates Array of page templates.
|
249 |
-
*
|
250 |
-
* @param object $wp_theme wp theme.
|
251 |
-
* @param object $post post.
|
252 |
-
*
|
253 |
-
* @return array Page templates.
|
254 |
-
*/
|
255 |
-
function add_page_templates( $page_templates, $wp_theme, $post ) {
|
256 |
-
|
257 |
-
$page_templates = array(
|
258 |
-
'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
|
259 |
-
);
|
260 |
-
|
261 |
-
return $page_templates;
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Have WordPress match postname to any of our public post types.
|
266 |
-
* All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
|
267 |
-
* By default, WordPress only accounts for posts and pages where the slug is /post-name/.
|
268 |
-
*
|
269 |
-
* @param string $query query statement.
|
270 |
-
*/
|
271 |
-
function add_cpt_post_names_to_main_query( $query ) {
|
272 |
-
|
273 |
-
// Bail if this is not the main query.
|
274 |
-
if ( ! $query->is_main_query() ) {
|
275 |
-
return;
|
276 |
-
}
|
277 |
-
|
278 |
-
// Bail if this query doesn't match our very specific rewrite rule.
|
279 |
-
if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
|
280 |
-
return;
|
281 |
-
}
|
282 |
-
|
283 |
-
// Bail if we're not querying based on the post name.
|
284 |
-
if ( empty( $query->query['name'] ) ) {
|
285 |
-
return;
|
286 |
-
}
|
287 |
-
|
288 |
-
// Add cartflows step post type to existing post type array.
|
289 |
-
if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
|
290 |
-
|
291 |
-
$post_types = $query->query_vars['post_type'];
|
292 |
-
|
293 |
-
$post_types[] = CARTFLOWS_STEP_POST_TYPE;
|
294 |
-
|
295 |
-
$query->set( 'post_type', $post_types );
|
296 |
-
|
297 |
-
} else {
|
298 |
-
|
299 |
-
// Add CPT to the list of post types WP will include when it queries based on the post name.
|
300 |
-
$query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
|
301 |
-
}
|
302 |
-
}
|
303 |
-
|
304 |
-
/**
|
305 |
-
* Modify permalink
|
306 |
-
*
|
307 |
-
* @param string $post_link post link.
|
308 |
-
* @param array $post post data.
|
309 |
-
* @param string $leavename leave name.
|
310 |
-
* @return string
|
311 |
-
*/
|
312 |
-
function post_type_permalinks( $post_link, $post, $leavename ) {
|
313 |
-
|
314 |
-
// If elementor page preview, return post link as it is.
|
315 |
-
if ( isset( $_REQUEST['elementor-preview'] ) ) {
|
316 |
-
return $post_link;
|
317 |
-
}
|
318 |
-
|
319 |
-
$structure = get_option( 'permalink_structure' );
|
320 |
-
|
321 |
-
if ( '/%postname%/' === $structure ) {
|
322 |
-
|
323 |
-
if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
|
324 |
-
|
325 |
-
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
return $post_link;
|
330 |
-
}
|
331 |
-
|
332 |
-
/**
|
333 |
-
* Prevent slug duplicated
|
334 |
-
*
|
335 |
-
* @param string $slug post slug.
|
336 |
-
* @param int $post_ID post id.
|
337 |
-
* @param string $post_status post status.
|
338 |
-
* @param string $post_type post type.
|
339 |
-
* @param int $post_parent post parent id.
|
340 |
-
* @param string $original_slug original slug.
|
341 |
-
* @return string
|
342 |
-
*/
|
343 |
-
function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
344 |
-
|
345 |
-
$check_post_types = array(
|
346 |
-
'post',
|
347 |
-
'page',
|
348 |
-
CARTFLOWS_STEP_POST_TYPE,
|
349 |
-
);
|
350 |
-
|
351 |
-
if ( ! in_array( $post_type, $check_post_types ) ) {
|
352 |
-
return $slug;
|
353 |
-
}
|
354 |
-
|
355 |
-
if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
|
356 |
-
// Saving a post, check for duplicates in POST or PAGE post types.
|
357 |
-
$post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
|
358 |
-
$page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
|
359 |
-
|
360 |
-
if ( $post_match || $page_match ) {
|
361 |
-
$slug .= '-2';
|
362 |
-
}
|
363 |
-
} else {
|
364 |
-
|
365 |
-
// Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
|
366 |
-
$custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
|
367 |
-
|
368 |
-
if ( $custom_post_type_match ) {
|
369 |
-
$slug .= '-2';
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
return $slug;
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Add Update messages for any custom post type
|
378 |
-
*
|
379 |
-
* @param array $messages Array of default messages.
|
380 |
-
*/
|
381 |
-
function post_update_messages( $messages ) {
|
382 |
-
|
383 |
-
$custom_post_type = get_post_type( get_the_ID() );
|
384 |
-
|
385 |
-
if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
|
386 |
-
|
387 |
-
$obj = get_post_type_object( $custom_post_type );
|
388 |
-
$singular_name = $obj->labels->singular_name;
|
389 |
-
$messages[ $custom_post_type ] = array(
|
390 |
-
0 => '', // Unused. Messages start at index 1.
|
391 |
-
/* translators: %s: singular custom post type name */
|
392 |
-
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
393 |
-
/* translators: %s: singular custom post type name */
|
394 |
-
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
395 |
-
/* translators: %s: singular custom post type name */
|
396 |
-
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
397 |
-
/* translators: %s: singular custom post type name */
|
398 |
-
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
399 |
-
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
400 |
-
5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
401 |
-
/* translators: %s: singular custom post type name */
|
402 |
-
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
403 |
-
/* translators: %s: singular custom post type name */
|
404 |
-
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
405 |
-
/* translators: %s: singular custom post type name */
|
406 |
-
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
407 |
-
/* translators: %s: singular custom post type name */
|
408 |
-
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
409 |
-
/* translators: %s: singular custom post type name */
|
410 |
-
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
411 |
-
);
|
412 |
-
}
|
413 |
-
|
414 |
-
return $messages;
|
415 |
-
}
|
416 |
-
|
417 |
-
/**
|
418 |
-
* Add Terms for Taxonomy.
|
419 |
-
*
|
420 |
-
* => Example.
|
421 |
-
*
|
422 |
-
* $taxonomy = '{taxonomy}';
|
423 |
-
* $terms = array(
|
424 |
-
* array(
|
425 |
-
* 'name' => 'Free',
|
426 |
-
* ),
|
427 |
-
* array(
|
428 |
-
* 'name' => 'Premium',
|
429 |
-
* ),
|
430 |
-
* );
|
431 |
-
*
|
432 |
-
* self::add_terms( $taxonomy, $terms );
|
433 |
-
*
|
434 |
-
* @since 1.0.0
|
435 |
-
* @param string $taxonomy Taxonomy Name.
|
436 |
-
* @param array $terms Terms list.
|
437 |
-
* @return void
|
438 |
-
*/
|
439 |
-
function add_terms( $taxonomy = '', $terms = array() ) {
|
440 |
-
|
441 |
-
foreach ( $terms as $key => $term ) {
|
442 |
-
|
443 |
-
$term_exist = term_exists( $term['name'], $taxonomy );
|
444 |
-
|
445 |
-
if ( empty( $term_exist ) ) {
|
446 |
-
|
447 |
-
/**
|
448 |
-
* Add additional args if passed from request.
|
449 |
-
*
|
450 |
-
* @see https://codex.wordpress.org/Function_Reference/wp_insert_term
|
451 |
-
*/
|
452 |
-
if ( array_key_exists( 'args', $term ) ) {
|
453 |
-
wp_insert_term( $term['name'], $taxonomy, $term['args'] );
|
454 |
-
} else {
|
455 |
-
wp_insert_term( $term['name'], $taxonomy );
|
456 |
-
}
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
}
|
461 |
-
|
462 |
-
/**
|
463 |
-
* Kicking this off by calling 'get_instance()' method
|
464 |
-
*/
|
465 |
-
Cartflows_Step_Post_Type::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Step post type.
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialization
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Step_Post_Type {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Member Variable
|
25 |
+
*
|
26 |
+
* @var body_classes
|
27 |
+
*/
|
28 |
+
private $body_classes = array();
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Initiator
|
32 |
+
*/
|
33 |
+
public static function get_instance() {
|
34 |
+
if ( ! isset( self::$instance ) ) {
|
35 |
+
self::$instance = new self;
|
36 |
+
}
|
37 |
+
return self::$instance;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Constructor
|
42 |
+
*/
|
43 |
+
public function __construct() {
|
44 |
+
|
45 |
+
add_action( 'init', array( $this, 'step_post_type' ) );
|
46 |
+
add_action( 'init', array( $this, 'add_wp_templates_support' ) );
|
47 |
+
add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
|
48 |
+
add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
|
49 |
+
add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
|
50 |
+
add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
|
51 |
+
|
52 |
+
add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Trys to load page.php for a header, footer or part theme layout.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @param string $template The current template to be loaded.
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
function load_page_template( $template ) {
|
64 |
+
|
65 |
+
global $post;
|
66 |
+
|
67 |
+
if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Remove Next/Prev Navigation
|
71 |
+
* add_filter('next_post_link', '__return_empty_string');
|
72 |
+
* add_filter('previous_post_link', '__return_empty_string');
|
73 |
+
*
|
74 |
+
* $page = locate_template( array( 'page.php' ) );
|
75 |
+
*
|
76 |
+
* if ( ! empty( $page ) ) {
|
77 |
+
* return $page;
|
78 |
+
* }
|
79 |
+
*/
|
80 |
+
|
81 |
+
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
82 |
+
|
83 |
+
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
84 |
+
|
85 |
+
$file = '';
|
86 |
+
|
87 |
+
switch ( $page_template ) {
|
88 |
+
|
89 |
+
case 'cartflows-default':
|
90 |
+
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
91 |
+
$this->body_classes[] = $page_template;
|
92 |
+
break;
|
93 |
+
case 'cartflows-canvas':
|
94 |
+
$file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
|
95 |
+
$this->body_classes[] = $page_template;
|
96 |
+
break;
|
97 |
+
default:
|
98 |
+
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
99 |
+
$this->body_classes[] = 'cartflows-default';
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
|
103 |
+
// Just to be safe, we check if the file exist first.
|
104 |
+
if ( file_exists( $file ) ) {
|
105 |
+
|
106 |
+
/* Add Body Class */
|
107 |
+
add_filter( 'body_class', [ $this, 'body_class' ] );
|
108 |
+
|
109 |
+
return $file;
|
110 |
+
} else {
|
111 |
+
echo $file;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
return $template;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Body classes.
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
* @param array $classes Body classes.
|
123 |
+
* @return array
|
124 |
+
*/
|
125 |
+
function body_class( $classes = [] ) {
|
126 |
+
|
127 |
+
$classes = array_merge( $classes, $this->body_classes );
|
128 |
+
|
129 |
+
return $classes;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Create custom post type
|
134 |
+
*/
|
135 |
+
function step_post_type() {
|
136 |
+
|
137 |
+
$labels = array(
|
138 |
+
'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
|
139 |
+
'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
|
140 |
+
'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
|
141 |
+
'all_items' => esc_html__( 'All Steps', 'cartflows' ),
|
142 |
+
'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
|
143 |
+
'view_item' => esc_html__( 'View Step', 'cartflows' ),
|
144 |
+
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
145 |
+
'update_item' => esc_html__( 'Update Step', 'cartflows' ),
|
146 |
+
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
147 |
+
'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
|
148 |
+
);
|
149 |
+
|
150 |
+
$args = array(
|
151 |
+
'labels' => $labels,
|
152 |
+
'public' => true,
|
153 |
+
'query_var' => true,
|
154 |
+
'can_export' => true,
|
155 |
+
'exclude_from_search' => true,
|
156 |
+
'show_ui' => true,
|
157 |
+
'show_in_menu' => false,
|
158 |
+
'show_in_admin_bar' => true,
|
159 |
+
'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
|
160 |
+
'capability_type' => 'post',
|
161 |
+
'capabilities' => array(
|
162 |
+
'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
|
163 |
+
),
|
164 |
+
'map_meta_cap' => true,
|
165 |
+
);
|
166 |
+
|
167 |
+
register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
|
168 |
+
|
169 |
+
$args = array(
|
170 |
+
'label' => __( 'Step Type', 'cartflows' ),
|
171 |
+
'public' => false,
|
172 |
+
'rewrite' => false,
|
173 |
+
'hierarchical' => false,
|
174 |
+
);
|
175 |
+
|
176 |
+
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
|
177 |
+
|
178 |
+
$args = array(
|
179 |
+
'label' => __( 'Step Flow', 'cartflows' ),
|
180 |
+
'public' => false,
|
181 |
+
'rewrite' => false,
|
182 |
+
'hierarchical' => false,
|
183 |
+
);
|
184 |
+
|
185 |
+
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Register 'Elementor' & 'Beaver Builder' site types.
|
189 |
+
*
|
190 |
+
* @see self::add_terms();
|
191 |
+
*/
|
192 |
+
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
193 |
+
|
194 |
+
$terms = array(
|
195 |
+
array(
|
196 |
+
'name' => __( 'Landing', 'cartflows' ),
|
197 |
+
'args' => array(
|
198 |
+
'slug' => 'landing',
|
199 |
+
),
|
200 |
+
),
|
201 |
+
array(
|
202 |
+
'name' => __( 'Checkout', 'cartflows' ),
|
203 |
+
'args' => array(
|
204 |
+
'slug' => 'checkout',
|
205 |
+
),
|
206 |
+
),
|
207 |
+
array(
|
208 |
+
'name' => __( 'Thank You', 'cartflows' ),
|
209 |
+
'args' => array(
|
210 |
+
'slug' => 'thankyou',
|
211 |
+
),
|
212 |
+
),
|
213 |
+
array(
|
214 |
+
'name' => __( 'Upsell', 'cartflows' ),
|
215 |
+
'args' => array(
|
216 |
+
'slug' => 'upsell',
|
217 |
+
),
|
218 |
+
),
|
219 |
+
array(
|
220 |
+
'name' => __( 'Downsell', 'cartflows' ),
|
221 |
+
'args' => array(
|
222 |
+
'slug' => 'downsell',
|
223 |
+
),
|
224 |
+
),
|
225 |
+
);
|
226 |
+
|
227 |
+
$this->add_terms( $taxonomy, $terms );
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Add WordPress templates.
|
232 |
+
*
|
233 |
+
* Adds Cartflows templates to steps
|
234 |
+
*
|
235 |
+
* @since 1.0.0
|
236 |
+
* @access public
|
237 |
+
*/
|
238 |
+
function add_wp_templates_support() {
|
239 |
+
add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Add page templates.
|
244 |
+
*
|
245 |
+
* @since 1.0.0
|
246 |
+
* @access public
|
247 |
+
*
|
248 |
+
* @param array $page_templates Array of page templates.
|
249 |
+
*
|
250 |
+
* @param object $wp_theme wp theme.
|
251 |
+
* @param object $post post.
|
252 |
+
*
|
253 |
+
* @return array Page templates.
|
254 |
+
*/
|
255 |
+
function add_page_templates( $page_templates, $wp_theme, $post ) {
|
256 |
+
|
257 |
+
$page_templates = array(
|
258 |
+
'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
|
259 |
+
);
|
260 |
+
|
261 |
+
return $page_templates;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Have WordPress match postname to any of our public post types.
|
266 |
+
* All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
|
267 |
+
* By default, WordPress only accounts for posts and pages where the slug is /post-name/.
|
268 |
+
*
|
269 |
+
* @param string $query query statement.
|
270 |
+
*/
|
271 |
+
function add_cpt_post_names_to_main_query( $query ) {
|
272 |
+
|
273 |
+
// Bail if this is not the main query.
|
274 |
+
if ( ! $query->is_main_query() ) {
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
// Bail if this query doesn't match our very specific rewrite rule.
|
279 |
+
if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
|
280 |
+
return;
|
281 |
+
}
|
282 |
+
|
283 |
+
// Bail if we're not querying based on the post name.
|
284 |
+
if ( empty( $query->query['name'] ) ) {
|
285 |
+
return;
|
286 |
+
}
|
287 |
+
|
288 |
+
// Add cartflows step post type to existing post type array.
|
289 |
+
if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
|
290 |
+
|
291 |
+
$post_types = $query->query_vars['post_type'];
|
292 |
+
|
293 |
+
$post_types[] = CARTFLOWS_STEP_POST_TYPE;
|
294 |
+
|
295 |
+
$query->set( 'post_type', $post_types );
|
296 |
+
|
297 |
+
} else {
|
298 |
+
|
299 |
+
// Add CPT to the list of post types WP will include when it queries based on the post name.
|
300 |
+
$query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Modify permalink
|
306 |
+
*
|
307 |
+
* @param string $post_link post link.
|
308 |
+
* @param array $post post data.
|
309 |
+
* @param string $leavename leave name.
|
310 |
+
* @return string
|
311 |
+
*/
|
312 |
+
function post_type_permalinks( $post_link, $post, $leavename ) {
|
313 |
+
|
314 |
+
// If elementor page preview, return post link as it is.
|
315 |
+
if ( isset( $_REQUEST['elementor-preview'] ) ) {
|
316 |
+
return $post_link;
|
317 |
+
}
|
318 |
+
|
319 |
+
$structure = get_option( 'permalink_structure' );
|
320 |
+
|
321 |
+
if ( '/%postname%/' === $structure ) {
|
322 |
+
|
323 |
+
if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
|
324 |
+
|
325 |
+
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
return $post_link;
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Prevent slug duplicated
|
334 |
+
*
|
335 |
+
* @param string $slug post slug.
|
336 |
+
* @param int $post_ID post id.
|
337 |
+
* @param string $post_status post status.
|
338 |
+
* @param string $post_type post type.
|
339 |
+
* @param int $post_parent post parent id.
|
340 |
+
* @param string $original_slug original slug.
|
341 |
+
* @return string
|
342 |
+
*/
|
343 |
+
function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
344 |
+
|
345 |
+
$check_post_types = array(
|
346 |
+
'post',
|
347 |
+
'page',
|
348 |
+
CARTFLOWS_STEP_POST_TYPE,
|
349 |
+
);
|
350 |
+
|
351 |
+
if ( ! in_array( $post_type, $check_post_types ) ) {
|
352 |
+
return $slug;
|
353 |
+
}
|
354 |
+
|
355 |
+
if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
|
356 |
+
// Saving a post, check for duplicates in POST or PAGE post types.
|
357 |
+
$post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
|
358 |
+
$page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
|
359 |
+
|
360 |
+
if ( $post_match || $page_match ) {
|
361 |
+
$slug .= '-2';
|
362 |
+
}
|
363 |
+
} else {
|
364 |
+
|
365 |
+
// Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
|
366 |
+
$custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
|
367 |
+
|
368 |
+
if ( $custom_post_type_match ) {
|
369 |
+
$slug .= '-2';
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
return $slug;
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Add Update messages for any custom post type
|
378 |
+
*
|
379 |
+
* @param array $messages Array of default messages.
|
380 |
+
*/
|
381 |
+
function post_update_messages( $messages ) {
|
382 |
+
|
383 |
+
$custom_post_type = get_post_type( get_the_ID() );
|
384 |
+
|
385 |
+
if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
|
386 |
+
|
387 |
+
$obj = get_post_type_object( $custom_post_type );
|
388 |
+
$singular_name = $obj->labels->singular_name;
|
389 |
+
$messages[ $custom_post_type ] = array(
|
390 |
+
0 => '', // Unused. Messages start at index 1.
|
391 |
+
/* translators: %s: singular custom post type name */
|
392 |
+
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
393 |
+
/* translators: %s: singular custom post type name */
|
394 |
+
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
395 |
+
/* translators: %s: singular custom post type name */
|
396 |
+
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
397 |
+
/* translators: %s: singular custom post type name */
|
398 |
+
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
399 |
+
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
400 |
+
5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
401 |
+
/* translators: %s: singular custom post type name */
|
402 |
+
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
403 |
+
/* translators: %s: singular custom post type name */
|
404 |
+
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
405 |
+
/* translators: %s: singular custom post type name */
|
406 |
+
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
407 |
+
/* translators: %s: singular custom post type name */
|
408 |
+
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
409 |
+
/* translators: %s: singular custom post type name */
|
410 |
+
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
411 |
+
);
|
412 |
+
}
|
413 |
+
|
414 |
+
return $messages;
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Add Terms for Taxonomy.
|
419 |
+
*
|
420 |
+
* => Example.
|
421 |
+
*
|
422 |
+
* $taxonomy = '{taxonomy}';
|
423 |
+
* $terms = array(
|
424 |
+
* array(
|
425 |
+
* 'name' => 'Free',
|
426 |
+
* ),
|
427 |
+
* array(
|
428 |
+
* 'name' => 'Premium',
|
429 |
+
* ),
|
430 |
+
* );
|
431 |
+
*
|
432 |
+
* self::add_terms( $taxonomy, $terms );
|
433 |
+
*
|
434 |
+
* @since 1.0.0
|
435 |
+
* @param string $taxonomy Taxonomy Name.
|
436 |
+
* @param array $terms Terms list.
|
437 |
+
* @return void
|
438 |
+
*/
|
439 |
+
function add_terms( $taxonomy = '', $terms = array() ) {
|
440 |
+
|
441 |
+
foreach ( $terms as $key => $term ) {
|
442 |
+
|
443 |
+
$term_exist = term_exists( $term['name'], $taxonomy );
|
444 |
+
|
445 |
+
if ( empty( $term_exist ) ) {
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Add additional args if passed from request.
|
449 |
+
*
|
450 |
+
* @see https://codex.wordpress.org/Function_Reference/wp_insert_term
|
451 |
+
*/
|
452 |
+
if ( array_key_exists( 'args', $term ) ) {
|
453 |
+
wp_insert_term( $term['name'], $taxonomy, $term['args'] );
|
454 |
+
} else {
|
455 |
+
wp_insert_term( $term['name'], $taxonomy );
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
+
/**
|
463 |
+
* Kicking this off by calling 'get_instance()' method
|
464 |
+
*/
|
465 |
+
Cartflows_Step_Post_Type::get_instance();
|
modules/landing/classes/class-cartflows-landing-meta.php
CHANGED
@@ -1,266 +1,236 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Landing post meta box
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Meta Boxes setup
|
10 |
-
*/
|
11 |
-
class Cartflows_Landing_Meta extends Cartflows_Meta {
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Instance
|
16 |
-
*
|
17 |
-
* @var $instance
|
18 |
-
*/
|
19 |
-
private static $instance;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Meta Option
|
23 |
-
*
|
24 |
-
* @var $meta_option
|
25 |
-
*/
|
26 |
-
private static $meta_option = null;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Initiator
|
30 |
-
*/
|
31 |
-
public static function get_instance() {
|
32 |
-
if ( ! isset( self::$instance ) ) {
|
33 |
-
self::$instance = new self;
|
34 |
-
}
|
35 |
-
|
36 |
-
return self::$instance;
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Constructor
|
41 |
-
*/
|
42 |
-
public function __construct() {
|
43 |
-
|
44 |
-
/* Init Metabox */
|
45 |
-
add_action( 'load-post.php', array( $this, 'init_metabox' ) );
|
46 |
-
add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Init Metabox
|
51 |
-
*/
|
52 |
-
public function init_metabox() {
|
53 |
-
|
54 |
-
add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
|
55 |
-
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Setup Metabox
|
60 |
-
*/
|
61 |
-
function setup_meta_box() {
|
62 |
-
|
63 |
-
if ( _is_wcf_landing_type() ) {
|
64 |
-
add_meta_box(
|
65 |
-
'wcf-ladning-settings', // Id.
|
66 |
-
__( 'Landing Page Settings', 'cartflows' ), // Title.
|
67 |
-
array( $this, '
|
68 |
-
wcf()->utils->get_step_post_type(), // Post_type.
|
69 |
-
'normal', // Context.
|
70 |
-
'high' // Priority.
|
71 |
-
);
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Metabox Markup
|
77 |
-
*
|
78 |
-
* @param object $post Post object.
|
79 |
-
* @return void
|
80 |
-
*/
|
81 |
-
function
|
82 |
-
|
83 |
-
wp_nonce_field( 'save-nonce-landing-step-meta', 'nonce-landing-step-meta' );
|
84 |
-
$stored = get_post_meta( $post->ID );
|
85 |
-
|
86 |
-
$checkout_meta = self::get_meta_option( $post->ID );
|
87 |
-
|
88 |
-
// Set stored and override defaults.
|
89 |
-
foreach ( $stored as $key => $value ) {
|
90 |
-
if ( array_key_exists( $key, $checkout_meta ) ) {
|
91 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
92 |
-
} else {
|
93 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
// Get defaults.
|
98 |
-
$meta = self::get_meta_option( $post->ID );
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Get options
|
102 |
-
*/
|
103 |
-
$
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
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 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
);
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
)
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
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 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_STRING );
|
238 |
-
break;
|
239 |
-
|
240 |
-
case 'FILTER_SANITIZE_URL':
|
241 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_URL );
|
242 |
-
break;
|
243 |
-
|
244 |
-
case 'FILTER_SANITIZE_NUMBER_INT':
|
245 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_NUMBER_INT );
|
246 |
-
break;
|
247 |
-
|
248 |
-
default:
|
249 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
250 |
-
break;
|
251 |
-
}
|
252 |
-
}
|
253 |
-
|
254 |
-
if ( $meta_value ) {
|
255 |
-
update_post_meta( $post_id, $key, $meta_value );
|
256 |
-
} else {
|
257 |
-
delete_post_meta( $post_id, $key );
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Kicking this off by calling 'get_instance()' method
|
265 |
-
*/
|
266 |
-
Cartflows_Landing_Meta::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Landing post meta box
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Meta Boxes setup
|
10 |
+
*/
|
11 |
+
class Cartflows_Landing_Meta extends Cartflows_Meta {
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Instance
|
16 |
+
*
|
17 |
+
* @var $instance
|
18 |
+
*/
|
19 |
+
private static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Meta Option
|
23 |
+
*
|
24 |
+
* @var $meta_option
|
25 |
+
*/
|
26 |
+
private static $meta_option = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Initiator
|
30 |
+
*/
|
31 |
+
public static function get_instance() {
|
32 |
+
if ( ! isset( self::$instance ) ) {
|
33 |
+
self::$instance = new self;
|
34 |
+
}
|
35 |
+
|
36 |
+
return self::$instance;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Constructor
|
41 |
+
*/
|
42 |
+
public function __construct() {
|
43 |
+
|
44 |
+
/* Init Metabox */
|
45 |
+
add_action( 'load-post.php', array( $this, 'init_metabox' ) );
|
46 |
+
add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Init Metabox
|
51 |
+
*/
|
52 |
+
public function init_metabox() {
|
53 |
+
|
54 |
+
add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
|
55 |
+
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Setup Metabox
|
60 |
+
*/
|
61 |
+
function setup_meta_box() {
|
62 |
+
|
63 |
+
if ( _is_wcf_landing_type() ) {
|
64 |
+
add_meta_box(
|
65 |
+
'wcf-ladning-settings', // Id.
|
66 |
+
__( 'Landing Page Settings', 'cartflows' ), // Title.
|
67 |
+
array( $this, 'landing_meta_box' ), // Callback.
|
68 |
+
wcf()->utils->get_step_post_type(), // Post_type.
|
69 |
+
'normal', // Context.
|
70 |
+
'high' // Priority.
|
71 |
+
);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Landing Metabox Markup
|
77 |
+
*
|
78 |
+
* @param object $post Post object.
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
function landing_meta_box( $post ) {
|
82 |
+
|
83 |
+
wp_nonce_field( 'save-nonce-landing-step-meta', 'nonce-landing-step-meta' );
|
84 |
+
$stored = get_post_meta( $post->ID );
|
85 |
+
|
86 |
+
$checkout_meta = self::get_meta_option( $post->ID );
|
87 |
+
|
88 |
+
// Set stored and override defaults.
|
89 |
+
foreach ( $stored as $key => $value ) {
|
90 |
+
if ( array_key_exists( $key, $checkout_meta ) ) {
|
91 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
92 |
+
} else {
|
93 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
// Get defaults.
|
98 |
+
$meta = self::get_meta_option( $post->ID );
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Get options
|
102 |
+
*/
|
103 |
+
$landing_data = array();
|
104 |
+
foreach ( $meta as $key => $value ) {
|
105 |
+
|
106 |
+
$landing_data[ $key ] = $meta[ $key ]['default'];
|
107 |
+
}
|
108 |
+
|
109 |
+
do_action( 'wcf_landing_settings_markup_before', $meta );
|
110 |
+
$this->page_header_tab( $landing_data, $post->ID );
|
111 |
+
do_action( 'wcf_landing_settings_markup_after', $meta );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Page Header Tabs
|
116 |
+
*
|
117 |
+
* @param array $options Post meta.
|
118 |
+
* @param int $post_id Post ID.
|
119 |
+
*/
|
120 |
+
function page_header_tab( $options, $post_id ) {
|
121 |
+
|
122 |
+
$active_tab = get_post_meta( $post_id, 'wcf_active_tab', true );
|
123 |
+
|
124 |
+
if ( empty( $active_tab ) ) {
|
125 |
+
$active_tab = 'wcf-thankyou-shortcodes';
|
126 |
+
}
|
127 |
+
|
128 |
+
$tabs = array(
|
129 |
+
array(
|
130 |
+
'title' => __( 'Shortcodes', 'cartflows' ),
|
131 |
+
'id' => 'wcf-thankyou-shortcodes',
|
132 |
+
'class' => 'wcf-thankyou-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
133 |
+
'icon' => 'dashicons-info',
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
'title' => __( 'Custom Script', 'cartflows' ),
|
137 |
+
'id' => 'wcf-landing-custom-script-header',
|
138 |
+
'class' => 'wcf-landing-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
139 |
+
'icon' => 'dashicons-format-aside',
|
140 |
+
),
|
141 |
+
);
|
142 |
+
|
143 |
+
?>
|
144 |
+
<div class="wcf-thankyou-table wcf-metabox-wrap widefat">
|
145 |
+
<div class="wcf-table-container">
|
146 |
+
<div class="wcf-column-left">
|
147 |
+
<div class="wcf-tab-wrapper">
|
148 |
+
|
149 |
+
<?php foreach ( $tabs as $key => $tab ) { ?>
|
150 |
+
<div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
|
151 |
+
<span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
|
152 |
+
<span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
|
153 |
+
</div>
|
154 |
+
<?php } ?>
|
155 |
+
<input type="hidden" id="wcf_active_tab" name="wcf_active_tab" value="<?php echo esc_attr( $active_tab ); ?>" />
|
156 |
+
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
<div class="wcf-column-right">
|
160 |
+
<div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
|
161 |
+
<?php
|
162 |
+
|
163 |
+
$next_step_link = wcf()->utils->get_linking_url(
|
164 |
+
array( 'class' => 'wcf-next-step' )
|
165 |
+
);
|
166 |
+
|
167 |
+
echo wcf()->meta->get_shortcode_field(
|
168 |
+
array(
|
169 |
+
'label' => __( 'Next Step Link', 'cartflows' ),
|
170 |
+
'name' => 'wcf-next-step-link',
|
171 |
+
'content' => $next_step_link,
|
172 |
+
)
|
173 |
+
);
|
174 |
+
|
175 |
+
?>
|
176 |
+
</div>
|
177 |
+
|
178 |
+
<?php $this->tab_custom_script( $options, $post_id ); ?>
|
179 |
+
|
180 |
+
<?php $this->right_column_footer( $options, $post_id ); ?>
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
</div>
|
184 |
+
|
185 |
+
<?php
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get metabox options
|
191 |
+
*
|
192 |
+
* @param int $post_id post ID.
|
193 |
+
* @return array
|
194 |
+
*/
|
195 |
+
public static function get_meta_option( $post_id ) {
|
196 |
+
|
197 |
+
if ( null === self::$meta_option ) {
|
198 |
+
/**
|
199 |
+
* Set metabox options
|
200 |
+
*
|
201 |
+
* @see http://php.net/manual/en/filter.filters.sanitize.php
|
202 |
+
*/
|
203 |
+
// self::$meta_option = array(); .
|
204 |
+
self::$meta_option = wcf()->options->get_landing_fields( $post_id );
|
205 |
+
}
|
206 |
+
|
207 |
+
return self::$meta_option;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Metabox Save
|
212 |
+
*
|
213 |
+
* @param number $post_id Post ID.
|
214 |
+
* @return void
|
215 |
+
*/
|
216 |
+
function save_meta_box( $post_id ) {
|
217 |
+
|
218 |
+
// Checks save status.
|
219 |
+
$is_autosave = wp_is_post_autosave( $post_id );
|
220 |
+
$is_revision = wp_is_post_revision( $post_id );
|
221 |
+
|
222 |
+
$is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( $_POST['nonce-landing-step-meta'], 'save-nonce-landing-step-meta' ) ) ? true : false;
|
223 |
+
|
224 |
+
// Exits script depending on save status.
|
225 |
+
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
226 |
+
return;
|
227 |
+
}
|
228 |
+
|
229 |
+
wcf()->options->save_landing_fields( $post_id );
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Kicking this off by calling 'get_instance()' method
|
235 |
+
*/
|
236 |
+
Cartflows_Landing_Meta::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/thankyou/classes/class-cartflows-thankyou-meta.php
CHANGED
@@ -1,405 +1,371 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Checkout post meta box
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Meta Boxes setup
|
10 |
-
*/
|
11 |
-
class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Instance
|
15 |
-
*
|
16 |
-
* @var $instance
|
17 |
-
*/
|
18 |
-
private static $instance;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Meta Option
|
22 |
-
*
|
23 |
-
* @var $meta_option
|
24 |
-
*/
|
25 |
-
private static $meta_option = null;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Initiator
|
29 |
-
*/
|
30 |
-
public static function get_instance() {
|
31 |
-
if ( ! isset( self::$instance ) ) {
|
32 |
-
self::$instance = new self;
|
33 |
-
}
|
34 |
-
|
35 |
-
return self::$instance;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Constructor
|
40 |
-
*/
|
41 |
-
public function __construct() {
|
42 |
-
|
43 |
-
/* Init Metabox */
|
44 |
-
add_action( 'load-post.php', array( $this, 'init_metabox' ) );
|
45 |
-
add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Init Metabox
|
50 |
-
*/
|
51 |
-
public function init_metabox() {
|
52 |
-
|
53 |
-
add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
|
54 |
-
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Setup Metabox
|
59 |
-
*/
|
60 |
-
function setup_meta_box() {
|
61 |
-
|
62 |
-
if ( _is_wcf_thankyou_type() ) {
|
63 |
-
add_meta_box(
|
64 |
-
'wcf-thankyou-settings', // Id.
|
65 |
-
__( 'Thank You Page Settings', 'cartflows' ), // Title.
|
66 |
-
array( $this, 'markup_meta_box' ), // Callback.
|
67 |
-
wcf()->utils->get_step_post_type(), // Post_type.
|
68 |
-
'normal', // Context.
|
69 |
-
'high' // Priority.
|
70 |
-
);
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Metabox Markup
|
76 |
-
*
|
77 |
-
* @param object $post Post object.
|
78 |
-
* @return void
|
79 |
-
*/
|
80 |
-
function markup_meta_box( $post ) {
|
81 |
-
|
82 |
-
wp_nonce_field( 'save-nonce-thankyou-step-meta', 'nonce-thankyou-step-meta' );
|
83 |
-
$stored = get_post_meta( $post->ID );
|
84 |
-
|
85 |
-
$checkout_meta = self::get_meta_option( $post->ID );
|
86 |
-
|
87 |
-
// Set stored and override defaults.
|
88 |
-
foreach ( $stored as $key => $value ) {
|
89 |
-
if ( array_key_exists( $key, $checkout_meta ) ) {
|
90 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
91 |
-
} else {
|
92 |
-
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
// Get defaults.
|
97 |
-
$meta = self::get_meta_option( $post->ID );
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Get options
|
101 |
-
*/
|
102 |
-
$thankyou_data = array();
|
103 |
-
|
104 |
-
foreach ( $meta as $key => $value ) {
|
105 |
-
|
106 |
-
$thankyou_data[ $key ] = $meta[ $key ]['default'];
|
107 |
-
}
|
108 |
-
|
109 |
-
do_action( 'wcf_thankyou_settings_markup_before', $meta );
|
110 |
-
$this->page_header_tab( $thankyou_data, $post->ID );
|
111 |
-
do_action( 'wcf_thankyou_settings_markup_after', $meta );
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Page Header Tabs
|
116 |
-
*
|
117 |
-
* @param array $options Post meta.
|
118 |
-
* @param int $post_id Post ID.
|
119 |
-
*/
|
120 |
-
function page_header_tab( $options, $post_id ) {
|
121 |
-
|
122 |
-
$active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
|
123 |
-
|
124 |
-
if ( empty( $active_tab ) ) {
|
125 |
-
$active_tab = 'wcf-thankyou-shortcodes';
|
126 |
-
}
|
127 |
-
|
128 |
-
$tabs = array(
|
129 |
-
array(
|
130 |
-
'title' => __( 'Shortcodes', 'cartflows' ),
|
131 |
-
'id' => 'wcf-thankyou-shortcodes',
|
132 |
-
'class' => 'wcf-thankyou-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
133 |
-
'icon' => 'dashicons-editor-code',
|
134 |
-
),
|
135 |
-
array(
|
136 |
-
'title' => __( 'Thank You Design', 'cartflows' ),
|
137 |
-
'id' => 'wcf-thankyou-design',
|
138 |
-
'class' => 'wcf-thankyou-design' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
139 |
-
'icon' => 'dashicons-admin-customizer',
|
140 |
-
),
|
141 |
-
array(
|
142 |
-
'title' => __( 'Thank You Fields', 'cartflows' ),
|
143 |
-
'id' => 'wcf-thankyou-fields',
|
144 |
-
'class' => 'wcf-thankyou-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
145 |
-
'icon' => 'dashicons-welcome-widgets-menus',
|
146 |
-
),
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
<?php
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
)
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
echo wcf()->meta->
|
187 |
-
array(
|
188 |
-
'label' => __( '
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
)
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
'
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
'
|
206 |
-
)
|
207 |
-
);
|
208 |
-
|
209 |
-
echo wcf()->meta->
|
210 |
-
array(
|
211 |
-
'label' => __( '
|
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 |
-
switch ( $sanitize_filter ) {
|
374 |
-
|
375 |
-
case 'FILTER_SANITIZE_STRING':
|
376 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_STRING );
|
377 |
-
break;
|
378 |
-
|
379 |
-
case 'FILTER_SANITIZE_URL':
|
380 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_URL );
|
381 |
-
break;
|
382 |
-
|
383 |
-
case 'FILTER_SANITIZE_NUMBER_INT':
|
384 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_SANITIZE_NUMBER_INT );
|
385 |
-
break;
|
386 |
-
|
387 |
-
default:
|
388 |
-
$meta_value = filter_input( INPUT_POST, $key, FILTER_DEFAULT );
|
389 |
-
break;
|
390 |
-
}
|
391 |
-
}
|
392 |
-
|
393 |
-
if ( $meta_value ) {
|
394 |
-
update_post_meta( $post_id, $key, $meta_value );
|
395 |
-
} else {
|
396 |
-
delete_post_meta( $post_id, $key );
|
397 |
-
}
|
398 |
-
}
|
399 |
-
}
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Kicking this off by calling 'get_instance()' method
|
404 |
-
*/
|
405 |
-
Cartflows_Thankyou_Meta::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checkout post meta box
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Meta Boxes setup
|
10 |
+
*/
|
11 |
+
class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Instance
|
15 |
+
*
|
16 |
+
* @var $instance
|
17 |
+
*/
|
18 |
+
private static $instance;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Meta Option
|
22 |
+
*
|
23 |
+
* @var $meta_option
|
24 |
+
*/
|
25 |
+
private static $meta_option = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Initiator
|
29 |
+
*/
|
30 |
+
public static function get_instance() {
|
31 |
+
if ( ! isset( self::$instance ) ) {
|
32 |
+
self::$instance = new self;
|
33 |
+
}
|
34 |
+
|
35 |
+
return self::$instance;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constructor
|
40 |
+
*/
|
41 |
+
public function __construct() {
|
42 |
+
|
43 |
+
/* Init Metabox */
|
44 |
+
add_action( 'load-post.php', array( $this, 'init_metabox' ) );
|
45 |
+
add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Init Metabox
|
50 |
+
*/
|
51 |
+
public function init_metabox() {
|
52 |
+
|
53 |
+
add_action( 'add_meta_boxes', array( $this, 'setup_meta_box' ) );
|
54 |
+
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Setup Metabox
|
59 |
+
*/
|
60 |
+
function setup_meta_box() {
|
61 |
+
|
62 |
+
if ( _is_wcf_thankyou_type() ) {
|
63 |
+
add_meta_box(
|
64 |
+
'wcf-thankyou-settings', // Id.
|
65 |
+
__( 'Thank You Page Settings', 'cartflows' ), // Title.
|
66 |
+
array( $this, 'markup_meta_box' ), // Callback.
|
67 |
+
wcf()->utils->get_step_post_type(), // Post_type.
|
68 |
+
'normal', // Context.
|
69 |
+
'high' // Priority.
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Metabox Markup
|
76 |
+
*
|
77 |
+
* @param object $post Post object.
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
function markup_meta_box( $post ) {
|
81 |
+
|
82 |
+
wp_nonce_field( 'save-nonce-thankyou-step-meta', 'nonce-thankyou-step-meta' );
|
83 |
+
$stored = get_post_meta( $post->ID );
|
84 |
+
|
85 |
+
$checkout_meta = self::get_meta_option( $post->ID );
|
86 |
+
|
87 |
+
// Set stored and override defaults.
|
88 |
+
foreach ( $stored as $key => $value ) {
|
89 |
+
if ( array_key_exists( $key, $checkout_meta ) ) {
|
90 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
|
91 |
+
} else {
|
92 |
+
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
// Get defaults.
|
97 |
+
$meta = self::get_meta_option( $post->ID );
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get options
|
101 |
+
*/
|
102 |
+
$thankyou_data = array();
|
103 |
+
|
104 |
+
foreach ( $meta as $key => $value ) {
|
105 |
+
|
106 |
+
$thankyou_data[ $key ] = $meta[ $key ]['default'];
|
107 |
+
}
|
108 |
+
|
109 |
+
do_action( 'wcf_thankyou_settings_markup_before', $meta );
|
110 |
+
$this->page_header_tab( $thankyou_data, $post->ID );
|
111 |
+
do_action( 'wcf_thankyou_settings_markup_after', $meta );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Page Header Tabs
|
116 |
+
*
|
117 |
+
* @param array $options Post meta.
|
118 |
+
* @param int $post_id Post ID.
|
119 |
+
*/
|
120 |
+
function page_header_tab( $options, $post_id ) {
|
121 |
+
|
122 |
+
$active_tab = get_post_meta( $post_id, 'wcf-active-tab', true );
|
123 |
+
|
124 |
+
if ( empty( $active_tab ) ) {
|
125 |
+
$active_tab = 'wcf-thankyou-shortcodes';
|
126 |
+
}
|
127 |
+
|
128 |
+
$tabs = array(
|
129 |
+
array(
|
130 |
+
'title' => __( 'Shortcodes', 'cartflows' ),
|
131 |
+
'id' => 'wcf-thankyou-shortcodes',
|
132 |
+
'class' => 'wcf-thankyou-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
133 |
+
'icon' => 'dashicons-editor-code',
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
'title' => __( 'Thank You Design', 'cartflows' ),
|
137 |
+
'id' => 'wcf-thankyou-design',
|
138 |
+
'class' => 'wcf-thankyou-design' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
139 |
+
'icon' => 'dashicons-admin-customizer',
|
140 |
+
),
|
141 |
+
array(
|
142 |
+
'title' => __( 'Thank You Fields', 'cartflows' ),
|
143 |
+
'id' => 'wcf-thankyou-fields',
|
144 |
+
'class' => 'wcf-thankyou-fields' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
145 |
+
'icon' => 'dashicons-welcome-widgets-menus',
|
146 |
+
),
|
147 |
+
array(
|
148 |
+
'title' => __( 'Custom Script', 'cartflows' ),
|
149 |
+
'id' => 'wcf-thankyou-custom-script-header',
|
150 |
+
'class' => 'wcf-thankyou-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
|
151 |
+
'icon' => 'dashicons-format-aside',
|
152 |
+
),
|
153 |
+
);
|
154 |
+
|
155 |
+
?>
|
156 |
+
<div class="wcf-thankyou-table wcf-metabox-wrap widefat">
|
157 |
+
<div class="wcf-table-container">
|
158 |
+
<div class="wcf-column-left">
|
159 |
+
<div class="wcf-tab-wrapper">
|
160 |
+
|
161 |
+
<?php foreach ( $tabs as $key => $tab ) { ?>
|
162 |
+
<div class="<?php echo esc_attr( $tab['class'] ); ?>" data-tab="<?php echo esc_attr( $tab['id'] ); ?>">
|
163 |
+
<span class="dashicons <?php echo esc_attr( $tab['icon'] ); ?>"></span>
|
164 |
+
<span class="wcf-tab-title"><?php echo esc_html( $tab['title'] ); ?></span>
|
165 |
+
</div>
|
166 |
+
<?php } ?>
|
167 |
+
<input type="hidden" id="wcf-active-tab" name="wcf-active-tab" value="<?php echo esc_attr( $active_tab ); ?>" />
|
168 |
+
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
<div class="wcf-column-right">
|
172 |
+
<div class="wcf-thankyou-shortcodes wcf-tab-content active widefat">
|
173 |
+
<?php
|
174 |
+
echo wcf()->meta->get_shortcode_field(
|
175 |
+
array(
|
176 |
+
'label' => __( 'Order Details', 'cartflows' ),
|
177 |
+
'name' => 'wcf-order-details',
|
178 |
+
'content' => esc_html( '[cartflows_order_details]' ),
|
179 |
+
)
|
180 |
+
);
|
181 |
+
?>
|
182 |
+
</div>
|
183 |
+
<div class="wcf-thankyou-design wcf-tab-content widefat">
|
184 |
+
<?php
|
185 |
+
|
186 |
+
echo wcf()->meta->get_section(
|
187 |
+
array(
|
188 |
+
'label' => __( 'Text', 'cartflows' ),
|
189 |
+
)
|
190 |
+
);
|
191 |
+
|
192 |
+
echo wcf()->meta->get_color_picker_field(
|
193 |
+
array(
|
194 |
+
'label' => __( 'Color', 'cartflows' ),
|
195 |
+
'name' => 'wcf-tq-text-color',
|
196 |
+
'value' => $options['wcf-tq-text-color'],
|
197 |
+
)
|
198 |
+
);
|
199 |
+
|
200 |
+
echo wcf()->meta->get_font_family_field(
|
201 |
+
array(
|
202 |
+
'for' => 'wcf-tq-font-family',
|
203 |
+
'label' => __( 'Font Family', 'cartflows' ),
|
204 |
+
'name' => 'wcf-tq-font-family',
|
205 |
+
'value' => $options['wcf-tq-font-family'],
|
206 |
+
)
|
207 |
+
);
|
208 |
+
|
209 |
+
echo wcf()->meta->get_section(
|
210 |
+
array(
|
211 |
+
'label' => __( 'Heading', 'cartflows' ),
|
212 |
+
)
|
213 |
+
);
|
214 |
+
|
215 |
+
echo wcf()->meta->get_color_picker_field(
|
216 |
+
array(
|
217 |
+
'label' => __( 'Color', 'cartflows' ),
|
218 |
+
'name' => 'wcf-tq-heading-color',
|
219 |
+
'value' => $options['wcf-tq-heading-color'],
|
220 |
+
)
|
221 |
+
);
|
222 |
+
|
223 |
+
echo wcf()->meta->get_font_family_field(
|
224 |
+
array(
|
225 |
+
'for' => 'wcf-tq-heading-font-family',
|
226 |
+
'label' => __( 'Font Family', 'cartflows' ),
|
227 |
+
'name' => 'wcf-tq-heading-font-family',
|
228 |
+
'value' => $options['wcf-tq-heading-font-family'],
|
229 |
+
)
|
230 |
+
);
|
231 |
+
|
232 |
+
echo wcf()->meta->get_font_weight_field(
|
233 |
+
array(
|
234 |
+
'for' => 'wcf-tq-heading-font-family',
|
235 |
+
'label' => __( 'Font Weight', 'cartflows' ),
|
236 |
+
'name' => 'wcf-tq-heading-font-wt',
|
237 |
+
'value' => $options['wcf-tq-heading-font-wt'],
|
238 |
+
)
|
239 |
+
);
|
240 |
+
|
241 |
+
echo wcf()->meta->get_checkbox_field(
|
242 |
+
array(
|
243 |
+
'label' => __( 'Advanced Options', 'cartflows' ),
|
244 |
+
'name' => 'wcf-tq-advance-options-fields',
|
245 |
+
'value' => $options['wcf-tq-advance-options-fields'],
|
246 |
+
'after' => 'Enable',
|
247 |
+
)
|
248 |
+
);
|
249 |
+
|
250 |
+
echo wcf()->meta->get_number_field(
|
251 |
+
array(
|
252 |
+
'for' => 'wcf-heading',
|
253 |
+
'label' => __( 'Container Width (In px)', 'cartflows' ),
|
254 |
+
'name' => 'wcf-tq-container-width',
|
255 |
+
'value' => $options['wcf-tq-container-width'],
|
256 |
+
)
|
257 |
+
);
|
258 |
+
|
259 |
+
echo wcf()->meta->get_color_picker_field(
|
260 |
+
array(
|
261 |
+
'label' => __( 'Section Background Color', 'cartflows' ),
|
262 |
+
'name' => 'wcf-tq-section-bg-color',
|
263 |
+
'value' => $options['wcf-tq-section-bg-color'],
|
264 |
+
)
|
265 |
+
);
|
266 |
+
|
267 |
+
?>
|
268 |
+
</div>
|
269 |
+
<div class="wcf-thankyou-fields wcf-tab-content widefat">
|
270 |
+
<?php
|
271 |
+
echo wcf()->meta->get_checkbox_field(
|
272 |
+
array(
|
273 |
+
'name' => 'wcf-show-overview-section',
|
274 |
+
'value' => $options['wcf-show-overview-section'],
|
275 |
+
'after' => __( 'Enable Order Overview ', 'cartflows' ),
|
276 |
+
)
|
277 |
+
);
|
278 |
+
|
279 |
+
echo wcf()->meta->get_checkbox_field(
|
280 |
+
array(
|
281 |
+
'name' => 'wcf-show-details-section',
|
282 |
+
'value' => $options['wcf-show-details-section'],
|
283 |
+
'after' => __( 'Enable Order Details ', 'cartflows' ),
|
284 |
+
)
|
285 |
+
);
|
286 |
+
|
287 |
+
echo wcf()->meta->get_checkbox_field(
|
288 |
+
array(
|
289 |
+
'name' => 'wcf-show-billing-section',
|
290 |
+
'value' => $options['wcf-show-billing-section'],
|
291 |
+
'after' => __( 'Enable Billing Details ', 'cartflows' ),
|
292 |
+
)
|
293 |
+
);
|
294 |
+
|
295 |
+
echo wcf()->meta->get_checkbox_field(
|
296 |
+
array(
|
297 |
+
'name' => 'wcf-show-shipping-section',
|
298 |
+
'value' => $options['wcf-show-shipping-section'],
|
299 |
+
'after' => __( 'Enable Shipping Details ', 'cartflows' ),
|
300 |
+
)
|
301 |
+
);
|
302 |
+
|
303 |
+
echo wcf()->meta->get_hidden_field(
|
304 |
+
array(
|
305 |
+
'name' => 'wcf-field-google-font-url',
|
306 |
+
'value' => $options['wcf-field-google-font-url'],
|
307 |
+
)
|
308 |
+
);
|
309 |
+
?>
|
310 |
+
</div>
|
311 |
+
|
312 |
+
<?php $this->tab_custom_script( $options, $post_id ); ?>
|
313 |
+
|
314 |
+
<?php $this->right_column_footer( $options, $post_id ); ?>
|
315 |
+
</div>
|
316 |
+
</div>
|
317 |
+
</div>
|
318 |
+
|
319 |
+
<?php
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Get metabox options
|
325 |
+
*
|
326 |
+
* @param int $post_id post ID.
|
327 |
+
* @return array
|
328 |
+
*/
|
329 |
+
public static function get_meta_option( $post_id ) {
|
330 |
+
|
331 |
+
if ( null === self::$meta_option ) {
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Set metabox options
|
335 |
+
*
|
336 |
+
* @see http://php.net/manual/en/filter.filters.sanitize.php
|
337 |
+
*/
|
338 |
+
self::$meta_option = wcf()->options->get_thankyou_fields( $post_id );
|
339 |
+
}
|
340 |
+
|
341 |
+
return self::$meta_option;
|
342 |
+
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* Metabox Save
|
347 |
+
*
|
348 |
+
* @param number $post_id Post ID.
|
349 |
+
* @return void
|
350 |
+
*/
|
351 |
+
function save_meta_box( $post_id ) {
|
352 |
+
|
353 |
+
// Checks save status.
|
354 |
+
$is_autosave = wp_is_post_autosave( $post_id );
|
355 |
+
$is_revision = wp_is_post_revision( $post_id );
|
356 |
+
|
357 |
+
$is_valid_nonce = ( isset( $_POST['nonce-thankyou-step-meta'] ) && wp_verify_nonce( $_POST['nonce-thankyou-step-meta'], 'save-nonce-thankyou-step-meta' ) ) ? true : false;
|
358 |
+
|
359 |
+
// Exits script depending on save status.
|
360 |
+
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
361 |
+
return;
|
362 |
+
}
|
363 |
+
|
364 |
+
wcf()->options->save_thankyou_fields( $post_id );
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Kicking this off by calling 'get_instance()' method
|
370 |
+
*/
|
371 |
+
Cartflows_Thankyou_Meta::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
=== CartFlows ===
|
2 |
Contributors: brainstormforce, wpcrafter
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: woocommerce, cart
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.6
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 1.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -94,8 +94,16 @@ Say goodby to using the same ridgid checkout page that everyone else is using. C
|
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
= Version 1.1.7 - Monday, 25th February 2019 =
|
98 |
-
* New:
|
99 |
* Fix: Shipping fields label issue.
|
100 |
|
101 |
= Version 1.1.6 - Thursday, 07th February 2019 =
|
1 |
+
=== CartFlows ===
|
2 |
Contributors: brainstormforce, wpcrafter
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: woocommerce, cart
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.6
|
7 |
+
Tested up to: 5.1
|
8 |
+
Stable tag: 1.1.8
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
94 |
|
95 |
== Changelog ==
|
96 |
|
97 |
+
= Version 1.1.8 - Wednesday, 27th February 2019 =
|
98 |
+
* New: Custom script support added for Landing, Checkout and Thank You page type.
|
99 |
+
* Fix: Added compatibility for pre-applied coupon field fix.
|
100 |
+
* Fix: Divi flow importer style tag issue.
|
101 |
+
|
102 |
+
= Version 1.1.7.1 - Tuesday, 26th February 2019 =
|
103 |
+
* Fix: Divi importer issue.
|
104 |
+
|
105 |
= Version 1.1.7 - Monday, 25th February 2019 =
|
106 |
+
* New: Divi templates.
|
107 |
* Fix: Shipping fields label issue.
|
108 |
|
109 |
= Version 1.1.6 - Thursday, 07th February 2019 =
|