Version Description
Download this release
Release Info
Developer | sandesh055 |
Plugin | Funnel Builder by CartFlows – Create High Converting Sales Funnels For WordPress |
Version | 1.3.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.2 to 1.3.3
- cartflows.php +1 -1
- changelog.txt +5 -0
- classes/batch-process/class-cartflows-batch-process.php +270 -270
- classes/batch-process/class-cartflows-change-template-batch.php +61 -61
- classes/batch-process/class-cartflows-importer-divi.php +116 -116
- classes/class-cartflows-admin-fields.php +267 -267
- classes/class-cartflows-admin.php +19 -19
- classes/class-cartflows-api.php +381 -381
- classes/class-cartflows-bb-compatibility.php +76 -76
- classes/class-cartflows-cloning.php +2 -2
- classes/class-cartflows-compatibility.php +410 -410
- classes/class-cartflows-default-meta.php +1 -1
- classes/class-cartflows-flow-frontend.php +206 -206
- classes/class-cartflows-frontend.php +6 -6
- classes/class-cartflows-functions.php +447 -447
- classes/class-cartflows-helper.php +694 -694
- classes/class-cartflows-importer-core.php +272 -272
- classes/class-cartflows-importer.php +33 -33
- classes/class-cartflows-learndash-compatibility.php +133 -133
- classes/class-cartflows-loader.php +1 -1
- classes/class-cartflows-logger.php +1 -1
- classes/class-cartflows-meta.php +2 -2
- classes/class-cartflows-metabox.php +97 -97
- classes/class-cartflows-session.php +9 -9
- classes/class-cartflows-thrive-compatibility.php +77 -77
- classes/class-cartflows-update.php +146 -146
- classes/class-cartflows-utils.php +425 -425
- classes/class-cartflows-wizard.php +34 -34
- classes/fields/typography/class-cartflows-font-families.php +315 -315
- classes/logger/class-cartflows-log-handler-file.php +442 -442
- classes/logger/class-cartflows-log-handler.php +57 -57
- classes/logger/class-cartflows-wc-logger.php +301 -301
- includes/admin/cartflows-admin.php +35 -35
- includes/admin/cartflows-error-log.php +71 -71
- includes/admin/cartflows-general-bck.php +47 -47
- includes/admin/cartflows-general.php +8 -8
- includes/exporter.php +23 -23
- includes/importer.php +26 -26
- languages/cartflows.pot +1797 -1797
- modules/checkout/classes/class-cartflows-checkout-markup.php +26 -19
- modules/checkout/classes/class-cartflows-checkout-meta.php +35 -35
- modules/checkout/templates/embed/checkout-template-simple.php +33 -33
- modules/checkout/templates/wcf-template.php +3 -3
- modules/flow/classes/class-cartflows-flow-loader.php +59 -59
- modules/flow/classes/class-cartflows-flow-meta.php +6 -6
- modules/flow/classes/class-cartflows-flow-post-type.php +334 -334
- modules/flow/classes/class-cartflows-flow-shortcodes.php +173 -173
- modules/flow/classes/class-cartflows-permalink.php +1 -1
- modules/flow/classes/class-cartflows-step-post-type.php +468 -468
- modules/flow/view/meta-flow-steps.php +199 -199
- modules/landing/classes/class-cartflows-landing-markup.php +139 -139
- modules/landing/classes/class-cartflows-landing-meta.php +1 -1
- modules/thankyou/classes/class-cartflows-thankyou-markup.php +1 -1
- modules/thankyou/classes/class-cartflows-thankyou-meta.php +9 -9
- modules/widgets/class-cartflows-next-step.php +3 -3
- modules/widgets/class-cartflows-widgets.php +58 -58
- readme.txt +6 -1
cartflows.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
3 |
* Plugin Name: CartFlows
|
4 |
* Plugin URI: https://cartflows.com/
|
5 |
* Description: Create beautiful checkout pages & sales flows for WooCommerce.
|
6 |
+
* Version: 1.3.3
|
7 |
* Author: CartFlows Inc
|
8 |
* Author URI: https://cartflows.com/
|
9 |
* Text Domain: cartflows
|
changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
Version 1.3.2 - Wednesday, 11th December 2019
|
2 |
- New: Option added to remove products on the checkout page.
|
3 |
- Fix: Checkout page's login form text was not able to translate.
|
1 |
+
Version 1.3.3 - Thursday, 26th December 2019
|
2 |
+
- Improvement: Added filter `cartflows_global_checkout_url` for global checkout.
|
3 |
+
- Fix: Thrive's split test option was not displaying in some cases.
|
4 |
+
- Fix: Klarna's payment fields were not displaying due to the wc-ajax endpoint.
|
5 |
+
|
6 |
Version 1.3.2 - Wednesday, 11th December 2019
|
7 |
- New: Option added to remove products on the checkout page.
|
8 |
- Fix: Checkout page's login form text was not able to translate.
|
classes/batch-process/class-cartflows-batch-process.php
CHANGED
@@ -1,270 +1,270 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Batch Processing
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* CartFlows_Batch_Process
|
13 |
-
*
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
class CartFlows_Batch_Process {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Instance
|
20 |
-
*
|
21 |
-
* @since 1.0.0
|
22 |
-
* @var object Class object.
|
23 |
-
* @access private
|
24 |
-
*/
|
25 |
-
private static $instance;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Elementor Batch Instance
|
29 |
-
*
|
30 |
-
* @since 1.1.1 Updated instance name with elementor specific.
|
31 |
-
*
|
32 |
-
* @since 1.0.0
|
33 |
-
* @var object Class object.
|
34 |
-
* @access public
|
35 |
-
*/
|
36 |
-
public static $batch_instance_elementor;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Beaver Builder Batch Instance
|
40 |
-
*
|
41 |
-
* @since 1.1.1
|
42 |
-
* @var object Class object.
|
43 |
-
* @access public
|
44 |
-
*/
|
45 |
-
public static $batch_instance_bb;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Divi Batch Instance
|
49 |
-
*
|
50 |
-
* @since 1.1.1
|
51 |
-
* @var object Class object.
|
52 |
-
* @access public
|
53 |
-
*/
|
54 |
-
public static $batch_instance_divi;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Initiator
|
58 |
-
*
|
59 |
-
* @since 1.0.0
|
60 |
-
* @return object initialized object of class.
|
61 |
-
*/
|
62 |
-
public static function get_instance() {
|
63 |
-
if ( ! isset( self::$instance ) ) {
|
64 |
-
self::$instance = new self();
|
65 |
-
}
|
66 |
-
return self::$instance;
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Constructor
|
71 |
-
*
|
72 |
-
* @since 1.0.0
|
73 |
-
*/
|
74 |
-
public function __construct() {
|
75 |
-
|
76 |
-
// Not BB or Elementor then avoid importer.
|
77 |
-
// if ( ! class_exists( '\Elementor\Plugin' ) && ! class_exists( 'FLBuilder' ) ) {
|
78 |
-
// return;
|
79 |
-
// }
|
80 |
-
// Core Helpers - Image.
|
81 |
-
require_once ABSPATH . 'wp-admin/includes/image.php';
|
82 |
-
|
83 |
-
// Core Helpers - Batch Processing.
|
84 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-cartflows-importer-image.php';
|
85 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
|
86 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
|
87 |
-
|
88 |
-
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
89 |
-
|
90 |
-
// Elementor.
|
91 |
-
if ( ( 'elementor' === $default_page_builder ) && class_exists( '\Elementor\Plugin' ) ) {
|
92 |
-
// Add "elementor" in import [queue].
|
93 |
-
// @todo Remove required `allow_url_fopen` support.
|
94 |
-
if ( ini_get( 'allow_url_fopen' ) ) {
|
95 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
|
96 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor-batch.php';
|
97 |
-
self::$batch_instance_elementor = new Cartflows_Importer_Elementor_Batch();
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
// Beaver Builder.
|
102 |
-
if ( ( 'beaver-builder' === $default_page_builder ) && class_exists( 'FLBuilder' ) ) {
|
103 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
|
104 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
|
105 |
-
self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
|
106 |
-
}
|
107 |
-
|
108 |
-
// Divi.
|
109 |
-
if ( ( 'divi' === $default_page_builder ) && ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) ) {
|
110 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
|
111 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
|
112 |
-
self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
|
113 |
-
}
|
114 |
-
|
115 |
-
// Start image importing after site import complete.
|
116 |
-
add_action( 'cartflows_after_template_import', array( $this, 'start_batch_process' ) );
|
117 |
-
add_action( 'cartflows_import_complete', array( $this, 'complete_batch_import' ) );
|
118 |
-
add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
|
119 |
-
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Added .svg files as supported format in the uploader.
|
124 |
-
*
|
125 |
-
* @since 1.1.4
|
126 |
-
*
|
127 |
-
* @param array $mimes Already supported mime types.
|
128 |
-
*/
|
129 |
-
public function custom_upload_mimes( $mimes ) {
|
130 |
-
|
131 |
-
// Allow SVG files.
|
132 |
-
$mimes['svg'] = 'image/svg+xml';
|
133 |
-
$mimes['svgz'] = 'image/svg+xml';
|
134 |
-
|
135 |
-
// Allow XML files.
|
136 |
-
$mimes['xml'] = 'text/xml';
|
137 |
-
|
138 |
-
return $mimes;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Add SVG image support
|
143 |
-
*
|
144 |
-
* @since 1.1.4
|
145 |
-
*
|
146 |
-
* @param array $response Attachment response.
|
147 |
-
* @param object $attachment Attachment object.
|
148 |
-
* @param array $meta Attachment meta data.
|
149 |
-
*/
|
150 |
-
public function add_svg_image_support( $response, $attachment, $meta ) {
|
151 |
-
if ( ! function_exists( 'simplexml_load_file' ) ) {
|
152 |
-
return $response;
|
153 |
-
}
|
154 |
-
|
155 |
-
if ( ! empty( $response['sizes'] ) ) {
|
156 |
-
return $response;
|
157 |
-
}
|
158 |
-
|
159 |
-
if ( 'image/svg+xml' !== $response['mime'] ) {
|
160 |
-
return $response;
|
161 |
-
}
|
162 |
-
|
163 |
-
$svg_path = get_attached_file( $attachment->ID );
|
164 |
-
|
165 |
-
$dimensions = self::get_svg_dimensions( $svg_path );
|
166 |
-
|
167 |
-
$response['sizes'] = array(
|
168 |
-
'full' => array(
|
169 |
-
'url' => $response['url'],
|
170 |
-
'width' => $dimensions->width,
|
171 |
-
'height' => $dimensions->height,
|
172 |
-
'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
|
173 |
-
),
|
174 |
-
);
|
175 |
-
|
176 |
-
return $response;
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Get SVG Dimensions
|
181 |
-
*
|
182 |
-
* @since 1.1.4.
|
183 |
-
*
|
184 |
-
* @param string $svg SVG file path.
|
185 |
-
* @return array Return SVG file height & width for valid SVG file.
|
186 |
-
*/
|
187 |
-
public static function get_svg_dimensions( $svg ) {
|
188 |
-
|
189 |
-
$svg = simplexml_load_file( $svg );
|
190 |
-
|
191 |
-
if ( false === $svg ) {
|
192 |
-
$width = '0';
|
193 |
-
$height = '0';
|
194 |
-
} else {
|
195 |
-
$attributes = $svg->attributes();
|
196 |
-
$width = (string) $attributes->width;
|
197 |
-
$height = (string) $attributes->height;
|
198 |
-
}
|
199 |
-
|
200 |
-
return (object) array(
|
201 |
-
'width' => $width,
|
202 |
-
'height' => $height,
|
203 |
-
);
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Batch Process Complete.
|
208 |
-
*
|
209 |
-
* @return void
|
210 |
-
*/
|
211 |
-
public function complete_batch_import() {
|
212 |
-
wcf()->logger->import_log( '(✓) BATCH Process Complete!' );
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Start Image Import
|
217 |
-
*
|
218 |
-
* @param integer $post_id Post Id.
|
219 |
-
*
|
220 |
-
* @return void
|
221 |
-
*/
|
222 |
-
public function start_batch_process( $post_id = '' ) {
|
223 |
-
|
224 |
-
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
225 |
-
|
226 |
-
wcf()->logger->import_log( '(✓) BATCH Started!' );
|
227 |
-
wcf()->logger->import_log( '(✓) Step ID ' . $post_id );
|
228 |
-
|
229 |
-
// Add "elementor" in import [queue].
|
230 |
-
if ( 'beaver-builder' === $default_page_builder && self::$batch_instance_bb ) {
|
231 |
-
|
232 |
-
// Add to queue.
|
233 |
-
self::$batch_instance_bb->push_to_queue( $post_id );
|
234 |
-
|
235 |
-
// Dispatch Queue.
|
236 |
-
self::$batch_instance_bb->save()->dispatch();
|
237 |
-
|
238 |
-
wcf()->logger->import_log( '(✓) Dispatch "Beaver Builder" Request..' );
|
239 |
-
|
240 |
-
} elseif ( 'elementor' === $default_page_builder && self::$batch_instance_elementor ) {
|
241 |
-
|
242 |
-
// Add to queue.
|
243 |
-
self::$batch_instance_elementor->push_to_queue( $post_id );
|
244 |
-
|
245 |
-
// Dispatch Queue.
|
246 |
-
self::$batch_instance_elementor->save()->dispatch();
|
247 |
-
|
248 |
-
wcf()->logger->import_log( '(✓) Dispatch "Elementor" Request..' );
|
249 |
-
} elseif ( 'divi' === $default_page_builder && self::$batch_instance_divi ) {
|
250 |
-
|
251 |
-
// Add to queue.
|
252 |
-
self::$batch_instance_divi->push_to_queue( $post_id );
|
253 |
-
|
254 |
-
// Dispatch Queue.
|
255 |
-
self::$batch_instance_divi->save()->dispatch();
|
256 |
-
|
257 |
-
wcf()->logger->import_log( '(✓) Dispatch "Divi" Request..' );
|
258 |
-
} else {
|
259 |
-
wcf()->logger->import_log( '(✕) Could not import image due to allow_url_fopen() is disabled!' );
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Kicking this off by calling 'get_instance()' method
|
267 |
-
*/
|
268 |
-
CartFlows_Batch_Process::get_instance();
|
269 |
-
|
270 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Batch Processing
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CartFlows_Batch_Process' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* CartFlows_Batch_Process
|
13 |
+
*
|
14 |
+
* @since 1.0.0
|
15 |
+
*/
|
16 |
+
class CartFlows_Batch_Process {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
* @var object Class object.
|
23 |
+
* @access private
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Elementor Batch Instance
|
29 |
+
*
|
30 |
+
* @since 1.1.1 Updated instance name with elementor specific.
|
31 |
+
*
|
32 |
+
* @since 1.0.0
|
33 |
+
* @var object Class object.
|
34 |
+
* @access public
|
35 |
+
*/
|
36 |
+
public static $batch_instance_elementor;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Beaver Builder Batch Instance
|
40 |
+
*
|
41 |
+
* @since 1.1.1
|
42 |
+
* @var object Class object.
|
43 |
+
* @access public
|
44 |
+
*/
|
45 |
+
public static $batch_instance_bb;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Divi Batch Instance
|
49 |
+
*
|
50 |
+
* @since 1.1.1
|
51 |
+
* @var object Class object.
|
52 |
+
* @access public
|
53 |
+
*/
|
54 |
+
public static $batch_instance_divi;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Initiator
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
* @return object initialized object of class.
|
61 |
+
*/
|
62 |
+
public static function get_instance() {
|
63 |
+
if ( ! isset( self::$instance ) ) {
|
64 |
+
self::$instance = new self();
|
65 |
+
}
|
66 |
+
return self::$instance;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Constructor
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
*/
|
74 |
+
public function __construct() {
|
75 |
+
|
76 |
+
// Not BB or Elementor then avoid importer.
|
77 |
+
// if ( ! class_exists( '\Elementor\Plugin' ) && ! class_exists( 'FLBuilder' ) ) {
|
78 |
+
// return;
|
79 |
+
// }
|
80 |
+
// Core Helpers - Image.
|
81 |
+
require_once ABSPATH . 'wp-admin/includes/image.php';
|
82 |
+
|
83 |
+
// Core Helpers - Batch Processing.
|
84 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-cartflows-importer-image.php';
|
85 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-async-request.php';
|
86 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/helpers/class-wp-background-process.php';
|
87 |
+
|
88 |
+
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
89 |
+
|
90 |
+
// Elementor.
|
91 |
+
if ( ( 'elementor' === $default_page_builder ) && class_exists( '\Elementor\Plugin' ) ) {
|
92 |
+
// Add "elementor" in import [queue].
|
93 |
+
// @todo Remove required `allow_url_fopen` support.
|
94 |
+
if ( ini_get( 'allow_url_fopen' ) ) {
|
95 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor.php';
|
96 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-elementor-batch.php';
|
97 |
+
self::$batch_instance_elementor = new Cartflows_Importer_Elementor_Batch();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
// Beaver Builder.
|
102 |
+
if ( ( 'beaver-builder' === $default_page_builder ) && class_exists( 'FLBuilder' ) ) {
|
103 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder.php';
|
104 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-beaver-builder-batch.php';
|
105 |
+
self::$batch_instance_bb = new Cartflows_Importer_Beaver_Builder_Batch();
|
106 |
+
}
|
107 |
+
|
108 |
+
// Divi.
|
109 |
+
if ( ( 'divi' === $default_page_builder ) && ( class_exists( 'ET_Builder_Plugin' ) || Cartflows_Compatibility::get_instance()->is_divi_enabled() ) ) {
|
110 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
|
111 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
|
112 |
+
self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
|
113 |
+
}
|
114 |
+
|
115 |
+
// Start image importing after site import complete.
|
116 |
+
add_action( 'cartflows_after_template_import', array( $this, 'start_batch_process' ) );
|
117 |
+
add_action( 'cartflows_import_complete', array( $this, 'complete_batch_import' ) );
|
118 |
+
add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
|
119 |
+
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Added .svg files as supported format in the uploader.
|
124 |
+
*
|
125 |
+
* @since 1.1.4
|
126 |
+
*
|
127 |
+
* @param array $mimes Already supported mime types.
|
128 |
+
*/
|
129 |
+
public function custom_upload_mimes( $mimes ) {
|
130 |
+
|
131 |
+
// Allow SVG files.
|
132 |
+
$mimes['svg'] = 'image/svg+xml';
|
133 |
+
$mimes['svgz'] = 'image/svg+xml';
|
134 |
+
|
135 |
+
// Allow XML files.
|
136 |
+
$mimes['xml'] = 'text/xml';
|
137 |
+
|
138 |
+
return $mimes;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Add SVG image support
|
143 |
+
*
|
144 |
+
* @since 1.1.4
|
145 |
+
*
|
146 |
+
* @param array $response Attachment response.
|
147 |
+
* @param object $attachment Attachment object.
|
148 |
+
* @param array $meta Attachment meta data.
|
149 |
+
*/
|
150 |
+
public function add_svg_image_support( $response, $attachment, $meta ) {
|
151 |
+
if ( ! function_exists( 'simplexml_load_file' ) ) {
|
152 |
+
return $response;
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( ! empty( $response['sizes'] ) ) {
|
156 |
+
return $response;
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( 'image/svg+xml' !== $response['mime'] ) {
|
160 |
+
return $response;
|
161 |
+
}
|
162 |
+
|
163 |
+
$svg_path = get_attached_file( $attachment->ID );
|
164 |
+
|
165 |
+
$dimensions = self::get_svg_dimensions( $svg_path );
|
166 |
+
|
167 |
+
$response['sizes'] = array(
|
168 |
+
'full' => array(
|
169 |
+
'url' => $response['url'],
|
170 |
+
'width' => $dimensions->width,
|
171 |
+
'height' => $dimensions->height,
|
172 |
+
'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
|
173 |
+
),
|
174 |
+
);
|
175 |
+
|
176 |
+
return $response;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Get SVG Dimensions
|
181 |
+
*
|
182 |
+
* @since 1.1.4.
|
183 |
+
*
|
184 |
+
* @param string $svg SVG file path.
|
185 |
+
* @return array Return SVG file height & width for valid SVG file.
|
186 |
+
*/
|
187 |
+
public static function get_svg_dimensions( $svg ) {
|
188 |
+
|
189 |
+
$svg = simplexml_load_file( $svg );
|
190 |
+
|
191 |
+
if ( false === $svg ) {
|
192 |
+
$width = '0';
|
193 |
+
$height = '0';
|
194 |
+
} else {
|
195 |
+
$attributes = $svg->attributes();
|
196 |
+
$width = (string) $attributes->width;
|
197 |
+
$height = (string) $attributes->height;
|
198 |
+
}
|
199 |
+
|
200 |
+
return (object) array(
|
201 |
+
'width' => $width,
|
202 |
+
'height' => $height,
|
203 |
+
);
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Batch Process Complete.
|
208 |
+
*
|
209 |
+
* @return void
|
210 |
+
*/
|
211 |
+
public function complete_batch_import() {
|
212 |
+
wcf()->logger->import_log( '(✓) BATCH Process Complete!' );
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Start Image Import
|
217 |
+
*
|
218 |
+
* @param integer $post_id Post Id.
|
219 |
+
*
|
220 |
+
* @return void
|
221 |
+
*/
|
222 |
+
public function start_batch_process( $post_id = '' ) {
|
223 |
+
|
224 |
+
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
225 |
+
|
226 |
+
wcf()->logger->import_log( '(✓) BATCH Started!' );
|
227 |
+
wcf()->logger->import_log( '(✓) Step ID ' . $post_id );
|
228 |
+
|
229 |
+
// Add "elementor" in import [queue].
|
230 |
+
if ( 'beaver-builder' === $default_page_builder && self::$batch_instance_bb ) {
|
231 |
+
|
232 |
+
// Add to queue.
|
233 |
+
self::$batch_instance_bb->push_to_queue( $post_id );
|
234 |
+
|
235 |
+
// Dispatch Queue.
|
236 |
+
self::$batch_instance_bb->save()->dispatch();
|
237 |
+
|
238 |
+
wcf()->logger->import_log( '(✓) Dispatch "Beaver Builder" Request..' );
|
239 |
+
|
240 |
+
} elseif ( 'elementor' === $default_page_builder && self::$batch_instance_elementor ) {
|
241 |
+
|
242 |
+
// Add to queue.
|
243 |
+
self::$batch_instance_elementor->push_to_queue( $post_id );
|
244 |
+
|
245 |
+
// Dispatch Queue.
|
246 |
+
self::$batch_instance_elementor->save()->dispatch();
|
247 |
+
|
248 |
+
wcf()->logger->import_log( '(✓) Dispatch "Elementor" Request..' );
|
249 |
+
} elseif ( 'divi' === $default_page_builder && self::$batch_instance_divi ) {
|
250 |
+
|
251 |
+
// Add to queue.
|
252 |
+
self::$batch_instance_divi->push_to_queue( $post_id );
|
253 |
+
|
254 |
+
// Dispatch Queue.
|
255 |
+
self::$batch_instance_divi->save()->dispatch();
|
256 |
+
|
257 |
+
wcf()->logger->import_log( '(✓) Dispatch "Divi" Request..' );
|
258 |
+
} else {
|
259 |
+
wcf()->logger->import_log( '(✕) Could not import image due to allow_url_fopen() is disabled!' );
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Kicking this off by calling 'get_instance()' method
|
267 |
+
*/
|
268 |
+
CartFlows_Batch_Process::get_instance();
|
269 |
+
|
270 |
+
endif;
|
classes/batch-process/class-cartflows-change-template-batch.php
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Change Template Process
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.2.2
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'Cartflows_Change_Template_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Change Template Process
|
13 |
-
*
|
14 |
-
* @since 1.2.2
|
15 |
-
*/
|
16 |
-
class Cartflows_Change_Template_Batch extends WP_Background_Process {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Template Process
|
20 |
-
*
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
protected $action = 'cartflows_change_template_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 |
-
* @param mixed $post_id Queue item to iterate over.
|
34 |
-
*
|
35 |
-
* @return mixed
|
36 |
-
*/
|
37 |
-
protected function task( $post_id ) {
|
38 |
-
|
39 |
-
wcf()->logger->log( '(✓) Step ID ' . $post_id );
|
40 |
-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
41 |
-
error_log( 'Processed:' . $post_id ); //phpcs:ignore
|
42 |
-
}
|
43 |
-
update_post_meta( $post_id, '_wp_page_template', 'cartflows-default' );
|
44 |
-
return false;
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Complete
|
49 |
-
*
|
50 |
-
* Override if applicable, but ensure that the below actions are
|
51 |
-
* performed, or, call parent::complete().
|
52 |
-
*/
|
53 |
-
protected function complete() {
|
54 |
-
parent::complete();
|
55 |
-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
56 |
-
error_log( 'Process Complete' );//phpcs:ignore
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Change Template Process
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.2.2
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'Cartflows_Change_Template_Batch' ) && class_exists( 'WP_Background_Process' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Change Template Process
|
13 |
+
*
|
14 |
+
* @since 1.2.2
|
15 |
+
*/
|
16 |
+
class Cartflows_Change_Template_Batch extends WP_Background_Process {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Template Process
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $action = 'cartflows_change_template_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 |
+
* @param mixed $post_id Queue item to iterate over.
|
34 |
+
*
|
35 |
+
* @return mixed
|
36 |
+
*/
|
37 |
+
protected function task( $post_id ) {
|
38 |
+
|
39 |
+
wcf()->logger->log( '(✓) Step ID ' . $post_id );
|
40 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
41 |
+
error_log( 'Processed:' . $post_id ); //phpcs:ignore
|
42 |
+
}
|
43 |
+
update_post_meta( $post_id, '_wp_page_template', 'cartflows-default' );
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Complete
|
49 |
+
*
|
50 |
+
* Override if applicable, but ensure that the below actions are
|
51 |
+
* performed, or, call parent::complete().
|
52 |
+
*/
|
53 |
+
protected function complete() {
|
54 |
+
parent::complete();
|
55 |
+
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
56 |
+
error_log( 'Process Complete' );//phpcs:ignore
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
endif;
|
classes/batch-process/class-cartflows-importer-divi.php
CHANGED
@@ -1,116 +1,116 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Divi Importer
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.1.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* CartFlows Import Divi
|
13 |
-
*
|
14 |
-
* @since 1.1.1
|
15 |
-
*/
|
16 |
-
class CartFlows_Importer_Divi {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Instance
|
20 |
-
*
|
21 |
-
* @since 1.1.1
|
22 |
-
* @access private
|
23 |
-
* @var object Class object.
|
24 |
-
*/
|
25 |
-
private static $instance;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Initiator
|
29 |
-
*
|
30 |
-
* @since 1.1.1
|
31 |
-
* @return object initialized object of class.
|
32 |
-
*/
|
33 |
-
public static function get_instance() {
|
34 |
-
|
35 |
-
if ( ! isset( self::$instance ) ) {
|
36 |
-
self::$instance = new self();
|
37 |
-
}
|
38 |
-
return self::$instance;
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Constructor
|
43 |
-
*
|
44 |
-
* @since 1.1.1
|
45 |
-
*/
|
46 |
-
public function __construct() {}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Allowed tags for the batch update process
|
50 |
-
*
|
51 |
-
* @since x.x.x
|
52 |
-
*
|
53 |
-
* @param array $allowedposttags Array of default allowable HTML tags.
|
54 |
-
* @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
|
55 |
-
* 'strip', 'data', 'entities', or the name of a field filter such as
|
56 |
-
* 'pre_user_description'.
|
57 |
-
* @return array Array of allowed HTML tags and their allowed attributes.
|
58 |
-
*/
|
59 |
-
public function allowed_tags_and_attributes( $allowedposttags, $context ) {
|
60 |
-
|
61 |
-
// Keep only for 'post' contenxt.
|
62 |
-
if ( 'post' === $context ) {
|
63 |
-
|
64 |
-
// <style> tag and attributes.
|
65 |
-
$allowedposttags['style'] = array();
|
66 |
-
}
|
67 |
-
|
68 |
-
return $allowedposttags;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Update post meta.
|
73 |
-
*
|
74 |
-
* @param integer $post_id Post ID.
|
75 |
-
* @return void
|
76 |
-
*/
|
77 |
-
public function import_single_post( $post_id = 0 ) {
|
78 |
-
|
79 |
-
// Allow the SVG tags in batch update process.
|
80 |
-
add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_tags_and_attributes' ), 10, 2 );
|
81 |
-
|
82 |
-
// Download and replace images.
|
83 |
-
$content = get_post_meta( $post_id, 'divi_content', true );
|
84 |
-
|
85 |
-
if ( empty( $content ) ) {
|
86 |
-
wcf()->logger->import_log( '(✕) Not have "Divi" Data. Post content is empty!' );
|
87 |
-
} else {
|
88 |
-
|
89 |
-
wcf()->logger->import_log( '(✓) Processing Request..' );
|
90 |
-
|
91 |
-
// Update hotlink images.
|
92 |
-
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
93 |
-
|
94 |
-
// Update post content.
|
95 |
-
wp_update_post(
|
96 |
-
array(
|
97 |
-
'ID' => $post_id,
|
98 |
-
'post_content' => $content,
|
99 |
-
)
|
100 |
-
);
|
101 |
-
|
102 |
-
// Delete temporary meta key.
|
103 |
-
delete_post_meta( $post_id, 'divi_content' );
|
104 |
-
|
105 |
-
wcf()->logger->import_log( '(✓) Process Complete' );
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Initialize class object with 'get_instance()' method
|
113 |
-
*/
|
114 |
-
CartFlows_Importer_Divi::get_instance();
|
115 |
-
|
116 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Divi Importer
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.1.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CartFlows_Importer_Divi' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* CartFlows Import Divi
|
13 |
+
*
|
14 |
+
* @since 1.1.1
|
15 |
+
*/
|
16 |
+
class CartFlows_Importer_Divi {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @since 1.1.1
|
22 |
+
* @access private
|
23 |
+
* @var object Class object.
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Initiator
|
29 |
+
*
|
30 |
+
* @since 1.1.1
|
31 |
+
* @return object initialized object of class.
|
32 |
+
*/
|
33 |
+
public static function get_instance() {
|
34 |
+
|
35 |
+
if ( ! isset( self::$instance ) ) {
|
36 |
+
self::$instance = new self();
|
37 |
+
}
|
38 |
+
return self::$instance;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Constructor
|
43 |
+
*
|
44 |
+
* @since 1.1.1
|
45 |
+
*/
|
46 |
+
public function __construct() {}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Allowed tags for the batch update process
|
50 |
+
*
|
51 |
+
* @since x.x.x
|
52 |
+
*
|
53 |
+
* @param array $allowedposttags Array of default allowable HTML tags.
|
54 |
+
* @param string|array $context The context for which to retrieve tags. Allowed values are 'post',
|
55 |
+
* 'strip', 'data', 'entities', or the name of a field filter such as
|
56 |
+
* 'pre_user_description'.
|
57 |
+
* @return array Array of allowed HTML tags and their allowed attributes.
|
58 |
+
*/
|
59 |
+
public function allowed_tags_and_attributes( $allowedposttags, $context ) {
|
60 |
+
|
61 |
+
// Keep only for 'post' contenxt.
|
62 |
+
if ( 'post' === $context ) {
|
63 |
+
|
64 |
+
// <style> tag and attributes.
|
65 |
+
$allowedposttags['style'] = array();
|
66 |
+
}
|
67 |
+
|
68 |
+
return $allowedposttags;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Update post meta.
|
73 |
+
*
|
74 |
+
* @param integer $post_id Post ID.
|
75 |
+
* @return void
|
76 |
+
*/
|
77 |
+
public function import_single_post( $post_id = 0 ) {
|
78 |
+
|
79 |
+
// Allow the SVG tags in batch update process.
|
80 |
+
add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_tags_and_attributes' ), 10, 2 );
|
81 |
+
|
82 |
+
// Download and replace images.
|
83 |
+
$content = get_post_meta( $post_id, 'divi_content', true );
|
84 |
+
|
85 |
+
if ( empty( $content ) ) {
|
86 |
+
wcf()->logger->import_log( '(✕) Not have "Divi" Data. Post content is empty!' );
|
87 |
+
} else {
|
88 |
+
|
89 |
+
wcf()->logger->import_log( '(✓) Processing Request..' );
|
90 |
+
|
91 |
+
// Update hotlink images.
|
92 |
+
$content = CartFlows_Importer::get_instance()->get_content( $content );
|
93 |
+
|
94 |
+
// Update post content.
|
95 |
+
wp_update_post(
|
96 |
+
array(
|
97 |
+
'ID' => $post_id,
|
98 |
+
'post_content' => $content,
|
99 |
+
)
|
100 |
+
);
|
101 |
+
|
102 |
+
// Delete temporary meta key.
|
103 |
+
delete_post_meta( $post_id, 'divi_content' );
|
104 |
+
|
105 |
+
wcf()->logger->import_log( '(✓) Process Complete' );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Initialize class object with 'get_instance()' method
|
113 |
+
*/
|
114 |
+
CartFlows_Importer_Divi::get_instance();
|
115 |
+
|
116 |
+
endif;
|
classes/class-cartflows-admin-fields.php
CHANGED
@@ -1,267 +1,267 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CARTFLOWS Admin Fields.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class Cartflows_Admin_Fields.
|
10 |
-
*/
|
11 |
-
class Cartflows_Admin_Fields {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Title Field
|
15 |
-
*
|
16 |
-
* @param array $args Args.
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
public static function title_field( $args ) {
|
20 |
-
|
21 |
-
$title = $args['title'];
|
22 |
-
$description = isset( $args['description'] ) ? $args['description'] : '';
|
23 |
-
|
24 |
-
$output = '<h4 class="form-field wcf-title-field">';
|
25 |
-
$output .= '<span>' . $title . '</span>';
|
26 |
-
$output .= '</h4>';
|
27 |
-
|
28 |
-
if ( ! empty( $description ) ) {
|
29 |
-
$output .= '<div class="form-field-desc">';
|
30 |
-
$output .= '<p>' . $description . '</p>';
|
31 |
-
$output .= '</div>';
|
32 |
-
}
|
33 |
-
|
34 |
-
return $output;
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Text Field
|
39 |
-
*
|
40 |
-
* @param array $args Args.
|
41 |
-
* @return string
|
42 |
-
*/
|
43 |
-
public static function text_field( $args ) {
|
44 |
-
|
45 |
-
$id = $args['id'];
|
46 |
-
$name = $args['name'];
|
47 |
-
$title = $args['title'];
|
48 |
-
$value = $args['value'];
|
49 |
-
$description = isset( $args['description'] ) ? $args['description'] : '';
|
50 |
-
$placeholder = isset( $args['placeholder'] ) ? $args['placeholder'] : '';
|
51 |
-
|
52 |
-
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
53 |
-
$output .= '<label for="' . $id . '">' . $title . '</label>';
|
54 |
-
$output .= '<input placeholder="' . $placeholder . '" type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_attr( $value ) . '">';
|
55 |
-
$output .= '</div>';
|
56 |
-
|
57 |
-
if ( ! empty( $description ) ) {
|
58 |
-
$output .= '<div class="form-field-desc">';
|
59 |
-
$output .= '<p>';
|
60 |
-
$output .= $description;
|
61 |
-
$output .= '</p>';
|
62 |
-
$output .= '</div>';
|
63 |
-
}
|
64 |
-
|
65 |
-
return $output;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* URL Field
|
70 |
-
*
|
71 |
-
* @param array $args Args.
|
72 |
-
* @return string
|
73 |
-
*/
|
74 |
-
public static function url_field( $args ) {
|
75 |
-
|
76 |
-
$id = $args['id'];
|
77 |
-
$name = $args['name'];
|
78 |
-
$title = $args['title'];
|
79 |
-
$value = $args['value'];
|
80 |
-
|
81 |
-
$output = '<div class="form-field">';
|
82 |
-
$output .= '<label for="' . $id . '">' . $title . '</label>';
|
83 |
-
$output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_url( $value ) . '">';
|
84 |
-
$output .= '</div>';
|
85 |
-
|
86 |
-
return $output;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Checkbox Field
|
91 |
-
*
|
92 |
-
* @param array $args Args.
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
public static function checkobox_field( $args ) {
|
96 |
-
|
97 |
-
$id = $args['id'];
|
98 |
-
$name = $args['name'];
|
99 |
-
$title = $args['title'];
|
100 |
-
$value = $args['value'];
|
101 |
-
|
102 |
-
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
103 |
-
$output .= '<label for="' . $id . '">';
|
104 |
-
$output .= '<input type="hidden" id="wcf_hid_' . $id . '" name="' . $name . '" value="disable">';
|
105 |
-
$output .= '<input type="checkbox" id="wcf_' . $id . '" name="' . $name . '" value="enable" ' . checked( $value, 'enable', false ) . '>';
|
106 |
-
$output .= $title;
|
107 |
-
$output .= '</label>';
|
108 |
-
$output .= '</div>';
|
109 |
-
|
110 |
-
return $output;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Radio Field
|
115 |
-
*
|
116 |
-
* @param array $args Args.
|
117 |
-
* @return string
|
118 |
-
*/
|
119 |
-
public static function radio_field( $args ) {
|
120 |
-
|
121 |
-
$name = $args['name'];
|
122 |
-
$id = $args['id'];
|
123 |
-
$options = $args['options'];
|
124 |
-
$value = $args['value'];
|
125 |
-
|
126 |
-
$output = '';
|
127 |
-
foreach ( $options as $type => $data ) {
|
128 |
-
|
129 |
-
$output .= '<div class="form-field">';
|
130 |
-
$output .= '<label for="' . $id . '">';
|
131 |
-
$output .= '<input type="radio" class="wcf_permalink_structure" name="' . $name . '" value="' . $type . '" ' . checked( $value, $type, false ) . '>' . $data['label'] . '</label>';
|
132 |
-
$output .= '<div class="form-field-desc">';
|
133 |
-
$output .= '<p>';
|
134 |
-
if ( empty( $type ) ) {
|
135 |
-
$output .= $data['description'];
|
136 |
-
} else {
|
137 |
-
$output .= get_site_url() . $data['description'];
|
138 |
-
}
|
139 |
-
|
140 |
-
$output .= '</p>';
|
141 |
-
$output .= '</div>';
|
142 |
-
$output .= '</div>';
|
143 |
-
}
|
144 |
-
|
145 |
-
return $output;
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Select Field
|
150 |
-
*
|
151 |
-
* @since 1.1.4
|
152 |
-
*
|
153 |
-
* @param array $args Args.
|
154 |
-
* @return string
|
155 |
-
*/
|
156 |
-
public static function select_field( $args ) {
|
157 |
-
|
158 |
-
$id = $args['id'];
|
159 |
-
$name = $args['name'];
|
160 |
-
$title = $args['title'];
|
161 |
-
$description = $args['description'];
|
162 |
-
$value = $args['value'];
|
163 |
-
$options = $args['options'];
|
164 |
-
|
165 |
-
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
166 |
-
|
167 |
-
$output .= '<div class="form-field-label">';
|
168 |
-
$output .= $title;
|
169 |
-
$output .= '</div>';
|
170 |
-
|
171 |
-
$output .= '<div class="form-field-data">';
|
172 |
-
$output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
|
173 |
-
foreach ( $options as $option_value => $option_title ) {
|
174 |
-
$output .= '<option value="' . $option_value . '" ' . selected( $value, $option_value, false ) . '>' . $option_title . '</option>';
|
175 |
-
}
|
176 |
-
$output .= '</select>';
|
177 |
-
$output .= '</div>';
|
178 |
-
|
179 |
-
$output .= '<div class="form-field-desc">';
|
180 |
-
$output .= '<p>';
|
181 |
-
$output .= $description;
|
182 |
-
$output .= '</p>';
|
183 |
-
$output .= '</div>';
|
184 |
-
$output .= '</div>';
|
185 |
-
|
186 |
-
return $output;
|
187 |
-
}
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Checkout Selection Field
|
191 |
-
*
|
192 |
-
* @param array $args Args.
|
193 |
-
* @return string
|
194 |
-
*/
|
195 |
-
public static function flow_checkout_selection_field( $args ) {
|
196 |
-
|
197 |
-
$id = $args['id'];
|
198 |
-
$name = $args['name'];
|
199 |
-
$title = $args['title'];
|
200 |
-
$value = $args['value'];
|
201 |
-
|
202 |
-
$checkout_steps = get_posts(
|
203 |
-
array(
|
204 |
-
'posts_per_page' => -1,
|
205 |
-
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
206 |
-
'post_status' => 'publish',
|
207 |
-
'orderby' => 'ID',
|
208 |
-
'order' => 'ASC',
|
209 |
-
'tax_query' => array( //phpcs:ignore
|
210 |
-
array(
|
211 |
-
'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
|
212 |
-
'field' => 'slug',
|
213 |
-
'terms' => 'checkout',
|
214 |
-
),
|
215 |
-
),
|
216 |
-
)
|
217 |
-
);
|
218 |
-
|
219 |
-
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
220 |
-
|
221 |
-
$output .= '<div class="form-field-label">';
|
222 |
-
$output .= '<label for="' . $id . '">';
|
223 |
-
$output .= $title;
|
224 |
-
$output .= '</label>';
|
225 |
-
$output .= '</div>';
|
226 |
-
|
227 |
-
$output .= '<div class="form-field-data">';
|
228 |
-
$output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
|
229 |
-
|
230 |
-
if ( ! empty( $checkout_steps ) ) {
|
231 |
-
$output .= '<option value="">' . __( 'Select', 'cartflows' ) . '</option>';
|
232 |
-
} else {
|
233 |
-
|
234 |
-
$output .= '<option value="">' . __( 'No Checkout Steps', 'cartflows' ) . '</option>';
|
235 |
-
}
|
236 |
-
|
237 |
-
foreach ( $checkout_steps as $index => $step_data ) {
|
238 |
-
|
239 |
-
$output .= '<option value="' . $step_data->ID . '" ' . selected( $value, $step_data->ID, false ) . '>' . $step_data->post_title . ' (#' . $step_data->ID . ') </option>';
|
240 |
-
}
|
241 |
-
|
242 |
-
$output .= '</select>';
|
243 |
-
$output .= '</div>';
|
244 |
-
|
245 |
-
if ( '' !== $value ) {
|
246 |
-
$output .= '<div class="form-field-actions">';
|
247 |
-
$output .= '<a href="' . get_edit_post_link( $value ) . '" target="_blank" class="" title="Edit">';
|
248 |
-
$output .= '<span class="dashicons dashicons-edit"></span>';
|
249 |
-
$output .= '<span class="">Edit</span>';
|
250 |
-
$output .= '</a>';
|
251 |
-
$output .= '<a href="' . get_permalink( $value ) . '" target="_blank" class="" title="View">';
|
252 |
-
$output .= '<span class="dashicons dashicons-visibility"></span>';
|
253 |
-
$output .= '<span class="">View</span>';
|
254 |
-
$output .= '</a>';
|
255 |
-
$output .= '</div>';
|
256 |
-
}
|
257 |
-
|
258 |
-
$output .= '<div class="form-field-desc">';
|
259 |
-
/* translators: %s: link */
|
260 |
-
$output .= '<p>' . sprintf( __( 'Be sure not to add any product in above selected Global Checkout step. Please read information about how to set up Global Checkout %1$shere%2$s.', 'cartflows' ), '<a href="https://cartflows.com/docs/global-checkout/" target="_blank">', '</a>' ) . '</p>';
|
261 |
-
$output .= '</div>';
|
262 |
-
|
263 |
-
$output .= '</div>';
|
264 |
-
|
265 |
-
return $output;
|
266 |
-
}
|
267 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CARTFLOWS Admin Fields.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class Cartflows_Admin_Fields.
|
10 |
+
*/
|
11 |
+
class Cartflows_Admin_Fields {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Title Field
|
15 |
+
*
|
16 |
+
* @param array $args Args.
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public static function title_field( $args ) {
|
20 |
+
|
21 |
+
$title = $args['title'];
|
22 |
+
$description = isset( $args['description'] ) ? $args['description'] : '';
|
23 |
+
|
24 |
+
$output = '<h4 class="form-field wcf-title-field">';
|
25 |
+
$output .= '<span>' . $title . '</span>';
|
26 |
+
$output .= '</h4>';
|
27 |
+
|
28 |
+
if ( ! empty( $description ) ) {
|
29 |
+
$output .= '<div class="form-field-desc">';
|
30 |
+
$output .= '<p>' . $description . '</p>';
|
31 |
+
$output .= '</div>';
|
32 |
+
}
|
33 |
+
|
34 |
+
return $output;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Text Field
|
39 |
+
*
|
40 |
+
* @param array $args Args.
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public static function text_field( $args ) {
|
44 |
+
|
45 |
+
$id = $args['id'];
|
46 |
+
$name = $args['name'];
|
47 |
+
$title = $args['title'];
|
48 |
+
$value = $args['value'];
|
49 |
+
$description = isset( $args['description'] ) ? $args['description'] : '';
|
50 |
+
$placeholder = isset( $args['placeholder'] ) ? $args['placeholder'] : '';
|
51 |
+
|
52 |
+
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
53 |
+
$output .= '<label for="' . $id . '">' . $title . '</label>';
|
54 |
+
$output .= '<input placeholder="' . $placeholder . '" type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_attr( $value ) . '">';
|
55 |
+
$output .= '</div>';
|
56 |
+
|
57 |
+
if ( ! empty( $description ) ) {
|
58 |
+
$output .= '<div class="form-field-desc">';
|
59 |
+
$output .= '<p>';
|
60 |
+
$output .= $description;
|
61 |
+
$output .= '</p>';
|
62 |
+
$output .= '</div>';
|
63 |
+
}
|
64 |
+
|
65 |
+
return $output;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* URL Field
|
70 |
+
*
|
71 |
+
* @param array $args Args.
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public static function url_field( $args ) {
|
75 |
+
|
76 |
+
$id = $args['id'];
|
77 |
+
$name = $args['name'];
|
78 |
+
$title = $args['title'];
|
79 |
+
$value = $args['value'];
|
80 |
+
|
81 |
+
$output = '<div class="form-field">';
|
82 |
+
$output .= '<label for="' . $id . '">' . $title . '</label>';
|
83 |
+
$output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_url( $value ) . '">';
|
84 |
+
$output .= '</div>';
|
85 |
+
|
86 |
+
return $output;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Checkbox Field
|
91 |
+
*
|
92 |
+
* @param array $args Args.
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
public static function checkobox_field( $args ) {
|
96 |
+
|
97 |
+
$id = $args['id'];
|
98 |
+
$name = $args['name'];
|
99 |
+
$title = $args['title'];
|
100 |
+
$value = $args['value'];
|
101 |
+
|
102 |
+
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
103 |
+
$output .= '<label for="' . $id . '">';
|
104 |
+
$output .= '<input type="hidden" id="wcf_hid_' . $id . '" name="' . $name . '" value="disable">';
|
105 |
+
$output .= '<input type="checkbox" id="wcf_' . $id . '" name="' . $name . '" value="enable" ' . checked( $value, 'enable', false ) . '>';
|
106 |
+
$output .= $title;
|
107 |
+
$output .= '</label>';
|
108 |
+
$output .= '</div>';
|
109 |
+
|
110 |
+
return $output;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Radio Field
|
115 |
+
*
|
116 |
+
* @param array $args Args.
|
117 |
+
* @return string
|
118 |
+
*/
|
119 |
+
public static function radio_field( $args ) {
|
120 |
+
|
121 |
+
$name = $args['name'];
|
122 |
+
$id = $args['id'];
|
123 |
+
$options = $args['options'];
|
124 |
+
$value = $args['value'];
|
125 |
+
|
126 |
+
$output = '';
|
127 |
+
foreach ( $options as $type => $data ) {
|
128 |
+
|
129 |
+
$output .= '<div class="form-field">';
|
130 |
+
$output .= '<label for="' . $id . '">';
|
131 |
+
$output .= '<input type="radio" class="wcf_permalink_structure" name="' . $name . '" value="' . $type . '" ' . checked( $value, $type, false ) . '>' . $data['label'] . '</label>';
|
132 |
+
$output .= '<div class="form-field-desc">';
|
133 |
+
$output .= '<p>';
|
134 |
+
if ( empty( $type ) ) {
|
135 |
+
$output .= $data['description'];
|
136 |
+
} else {
|
137 |
+
$output .= get_site_url() . $data['description'];
|
138 |
+
}
|
139 |
+
|
140 |
+
$output .= '</p>';
|
141 |
+
$output .= '</div>';
|
142 |
+
$output .= '</div>';
|
143 |
+
}
|
144 |
+
|
145 |
+
return $output;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Select Field
|
150 |
+
*
|
151 |
+
* @since 1.1.4
|
152 |
+
*
|
153 |
+
* @param array $args Args.
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public static function select_field( $args ) {
|
157 |
+
|
158 |
+
$id = $args['id'];
|
159 |
+
$name = $args['name'];
|
160 |
+
$title = $args['title'];
|
161 |
+
$description = $args['description'];
|
162 |
+
$value = $args['value'];
|
163 |
+
$options = $args['options'];
|
164 |
+
|
165 |
+
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
166 |
+
|
167 |
+
$output .= '<div class="form-field-label">';
|
168 |
+
$output .= $title;
|
169 |
+
$output .= '</div>';
|
170 |
+
|
171 |
+
$output .= '<div class="form-field-data">';
|
172 |
+
$output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
|
173 |
+
foreach ( $options as $option_value => $option_title ) {
|
174 |
+
$output .= '<option value="' . $option_value . '" ' . selected( $value, $option_value, false ) . '>' . $option_title . '</option>';
|
175 |
+
}
|
176 |
+
$output .= '</select>';
|
177 |
+
$output .= '</div>';
|
178 |
+
|
179 |
+
$output .= '<div class="form-field-desc">';
|
180 |
+
$output .= '<p>';
|
181 |
+
$output .= $description;
|
182 |
+
$output .= '</p>';
|
183 |
+
$output .= '</div>';
|
184 |
+
$output .= '</div>';
|
185 |
+
|
186 |
+
return $output;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Checkout Selection Field
|
191 |
+
*
|
192 |
+
* @param array $args Args.
|
193 |
+
* @return string
|
194 |
+
*/
|
195 |
+
public static function flow_checkout_selection_field( $args ) {
|
196 |
+
|
197 |
+
$id = $args['id'];
|
198 |
+
$name = $args['name'];
|
199 |
+
$title = $args['title'];
|
200 |
+
$value = $args['value'];
|
201 |
+
|
202 |
+
$checkout_steps = get_posts(
|
203 |
+
array(
|
204 |
+
'posts_per_page' => -1,
|
205 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
206 |
+
'post_status' => 'publish',
|
207 |
+
'orderby' => 'ID',
|
208 |
+
'order' => 'ASC',
|
209 |
+
'tax_query' => array( //phpcs:ignore
|
210 |
+
array(
|
211 |
+
'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
|
212 |
+
'field' => 'slug',
|
213 |
+
'terms' => 'checkout',
|
214 |
+
),
|
215 |
+
),
|
216 |
+
)
|
217 |
+
);
|
218 |
+
|
219 |
+
$output = '<div class="form-field" id="form-field-' . $id . '">';
|
220 |
+
|
221 |
+
$output .= '<div class="form-field-label">';
|
222 |
+
$output .= '<label for="' . $id . '">';
|
223 |
+
$output .= $title;
|
224 |
+
$output .= '</label>';
|
225 |
+
$output .= '</div>';
|
226 |
+
|
227 |
+
$output .= '<div class="form-field-data">';
|
228 |
+
$output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
|
229 |
+
|
230 |
+
if ( ! empty( $checkout_steps ) ) {
|
231 |
+
$output .= '<option value="">' . __( 'Select', 'cartflows' ) . '</option>';
|
232 |
+
} else {
|
233 |
+
|
234 |
+
$output .= '<option value="">' . __( 'No Checkout Steps', 'cartflows' ) . '</option>';
|
235 |
+
}
|
236 |
+
|
237 |
+
foreach ( $checkout_steps as $index => $step_data ) {
|
238 |
+
|
239 |
+
$output .= '<option value="' . $step_data->ID . '" ' . selected( $value, $step_data->ID, false ) . '>' . $step_data->post_title . ' (#' . $step_data->ID . ') </option>';
|
240 |
+
}
|
241 |
+
|
242 |
+
$output .= '</select>';
|
243 |
+
$output .= '</div>';
|
244 |
+
|
245 |
+
if ( '' !== $value ) {
|
246 |
+
$output .= '<div class="form-field-actions">';
|
247 |
+
$output .= '<a href="' . get_edit_post_link( $value ) . '" target="_blank" class="" title="Edit">';
|
248 |
+
$output .= '<span class="dashicons dashicons-edit"></span>';
|
249 |
+
$output .= '<span class="">Edit</span>';
|
250 |
+
$output .= '</a>';
|
251 |
+
$output .= '<a href="' . get_permalink( $value ) . '" target="_blank" class="" title="View">';
|
252 |
+
$output .= '<span class="dashicons dashicons-visibility"></span>';
|
253 |
+
$output .= '<span class="">View</span>';
|
254 |
+
$output .= '</a>';
|
255 |
+
$output .= '</div>';
|
256 |
+
}
|
257 |
+
|
258 |
+
$output .= '<div class="form-field-desc">';
|
259 |
+
/* translators: %s: link */
|
260 |
+
$output .= '<p>' . sprintf( __( 'Be sure not to add any product in above selected Global Checkout step. Please read information about how to set up Global Checkout %1$shere%2$s.', 'cartflows' ), '<a href="https://cartflows.com/docs/global-checkout/" target="_blank">', '</a>' ) . '</p>';
|
261 |
+
$output .= '</div>';
|
262 |
+
|
263 |
+
$output .= '</div>';
|
264 |
+
|
265 |
+
return $output;
|
266 |
+
}
|
267 |
+
}
|
classes/class-cartflows-admin.php
CHANGED
@@ -208,14 +208,14 @@ class Cartflows_Admin {
|
|
208 |
*/
|
209 |
public static function save_common_settings() {
|
210 |
|
211 |
-
if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['cartflows-common-settings-nonce'] ), 'cartflows-common-settings' ) ) {
|
212 |
|
213 |
-
$url = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
|
214 |
$new_settings = array();
|
215 |
|
216 |
if ( isset( $_POST['_cartflows_common'] ) ) {
|
217 |
// Loop through the input and sanitize each of the values.
|
218 |
-
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_common'] ) );
|
219 |
}
|
220 |
|
221 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, false );
|
@@ -238,13 +238,13 @@ class Cartflows_Admin {
|
|
238 |
*/
|
239 |
public static function save_debug_settings() {
|
240 |
|
241 |
-
if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['cartflows-debug-settings-nonce'] ), 'cartflows-debug-settings' ) ) {
|
242 |
|
243 |
-
$url = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
|
244 |
$new_settings = array();
|
245 |
|
246 |
if ( isset( $_POST['_cartflows_debug_data'] ) ) {
|
247 |
-
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_debug_data'] ) );
|
248 |
}
|
249 |
|
250 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, false );
|
@@ -269,9 +269,9 @@ class Cartflows_Admin {
|
|
269 |
*/
|
270 |
public static function save_permalink_settings() {
|
271 |
|
272 |
-
if ( isset( $_POST['cartflows-permalink-settings-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['cartflows-permalink-settings-nonce'] ), 'cartflows-permalink-settings' ) ) {
|
273 |
|
274 |
-
$url = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
|
275 |
$new_settings = array();
|
276 |
|
277 |
if ( isset( $_POST['reset'] ) ) {
|
@@ -284,7 +284,7 @@ class Cartflows_Admin {
|
|
284 |
}
|
285 |
|
286 |
if ( isset( $_POST['_cartflows_permalink'] ) ) {
|
287 |
-
$cartflows_permalink_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_permalink'] ) );
|
288 |
|
289 |
if ( empty( $cartflows_permalink_settings['permalink'] ) ) {
|
290 |
$new_settings['permalink'] = CARTFLOWS_STEP_POST_TYPE;
|
@@ -457,17 +457,17 @@ class Cartflows_Admin {
|
|
457 |
<span class="wcf-cartflows-logo-img">
|
458 |
<span class="cartflows-logo-icon"></span>
|
459 |
</span>
|
460 |
-
<span class="wcf-cartflows-title"><?php
|
461 |
</div>
|
462 |
<div class="wcf-tab-wrapper">
|
463 |
<?php if ( 'other' !== $default_page_builder ) { ?>
|
464 |
<div id="wcf-get-started-steps">
|
465 |
<ul class="filter-links ">
|
466 |
<li>
|
467 |
-
<a href="#" class="current" data-slug="ready-templates" data-title="<?php
|
468 |
</li>
|
469 |
<li>
|
470 |
-
<a href="#" data-slug="canvas" data-title="<?php
|
471 |
</li>
|
472 |
</ul>
|
473 |
</div>
|
@@ -478,8 +478,8 @@ class Cartflows_Admin {
|
|
478 |
</div>
|
479 |
</div>
|
480 |
<!-- <div class="wcf-search-form">
|
481 |
-
<label class="screen-reader-text" for="wp-filter-search-input"><?php
|
482 |
-
<input placeholder="<?php
|
483 |
</div> -->
|
484 |
|
485 |
<div id="wcf-remote-content">
|
@@ -496,8 +496,8 @@ class Cartflows_Admin {
|
|
496 |
<?php } ?>
|
497 |
<div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
|
498 |
<div class="inner">
|
499 |
-
<a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php
|
500 |
-
<p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php
|
501 |
</div>
|
502 |
</div>
|
503 |
</div>
|
@@ -596,13 +596,13 @@ class Cartflows_Admin {
|
|
596 |
*/
|
597 |
public static function save_facebook_settings() {
|
598 |
|
599 |
-
if ( isset( $_POST['cartflows-facebook-settings-nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['cartflows-facebook-settings-nonce'] ), 'cartflows-facebook-settings' ) ) {
|
600 |
|
601 |
-
$url = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
|
602 |
$new_settings = array();
|
603 |
|
604 |
if ( isset( $_POST['_cartflows_facebook'] ) ) {
|
605 |
-
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_facebook'] ) );
|
606 |
}
|
607 |
|
608 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_facebook', $new_settings, false );
|
208 |
*/
|
209 |
public static function save_common_settings() {
|
210 |
|
211 |
+
if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-common-settings-nonce'] ) ), 'cartflows-common-settings' ) ) {
|
212 |
|
213 |
+
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
214 |
$new_settings = array();
|
215 |
|
216 |
if ( isset( $_POST['_cartflows_common'] ) ) {
|
217 |
// Loop through the input and sanitize each of the values.
|
218 |
+
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_common'] ) ); //phpcs:ignore
|
219 |
}
|
220 |
|
221 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, false );
|
238 |
*/
|
239 |
public static function save_debug_settings() {
|
240 |
|
241 |
+
if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-debug-settings-nonce'] ) ), 'cartflows-debug-settings' ) ) {
|
242 |
|
243 |
+
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
244 |
$new_settings = array();
|
245 |
|
246 |
if ( isset( $_POST['_cartflows_debug_data'] ) ) {
|
247 |
+
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_debug_data'] ) ); //phpcs:ignore
|
248 |
}
|
249 |
|
250 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, false );
|
269 |
*/
|
270 |
public static function save_permalink_settings() {
|
271 |
|
272 |
+
if ( isset( $_POST['cartflows-permalink-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-permalink-settings-nonce'] ) ), 'cartflows-permalink-settings' ) ) {
|
273 |
|
274 |
+
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
275 |
$new_settings = array();
|
276 |
|
277 |
if ( isset( $_POST['reset'] ) ) {
|
284 |
}
|
285 |
|
286 |
if ( isset( $_POST['_cartflows_permalink'] ) ) {
|
287 |
+
$cartflows_permalink_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_permalink'] ) ); //phpcs:ignore
|
288 |
|
289 |
if ( empty( $cartflows_permalink_settings['permalink'] ) ) {
|
290 |
$new_settings['permalink'] = CARTFLOWS_STEP_POST_TYPE;
|
457 |
<span class="wcf-cartflows-logo-img">
|
458 |
<span class="cartflows-logo-icon"></span>
|
459 |
</span>
|
460 |
+
<span class="wcf-cartflows-title"><?php esc_html_e( 'Flows Library', 'cartflows' ); ?></span>
|
461 |
</div>
|
462 |
<div class="wcf-tab-wrapper">
|
463 |
<?php if ( 'other' !== $default_page_builder ) { ?>
|
464 |
<div id="wcf-get-started-steps">
|
465 |
<ul class="filter-links ">
|
466 |
<li>
|
467 |
+
<a href="#" class="current" data-slug="ready-templates" data-title="<?php esc_html_e( 'Ready Templates', 'cartflows' ); ?>"><?php esc_html_e( 'Ready Templates', 'cartflows' ); ?></a>
|
468 |
</li>
|
469 |
<li>
|
470 |
+
<a href="#" data-slug="canvas" data-title="<?php esc_html_e( 'Create Your Own', 'cartflows' ); ?>"><?php esc_html_e( 'Create Your Own', 'cartflows' ); ?></a>
|
471 |
</li>
|
472 |
</ul>
|
473 |
</div>
|
478 |
</div>
|
479 |
</div>
|
480 |
<!-- <div class="wcf-search-form">
|
481 |
+
<label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'cartflows' ); ?> </label>
|
482 |
+
<input placeholder="<?php esc_html_e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
|
483 |
</div> -->
|
484 |
|
485 |
<div id="wcf-remote-content">
|
496 |
<?php } ?>
|
497 |
<div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
|
498 |
<div class="inner">
|
499 |
+
<a href="#" class="button button-hero button-primary cartflows-flow-import-blank"><?php esc_html_e( 'Design Your Flow', 'cartflows' ); ?></a>
|
500 |
+
<p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php esc_html_e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
|
501 |
</div>
|
502 |
</div>
|
503 |
</div>
|
596 |
*/
|
597 |
public static function save_facebook_settings() {
|
598 |
|
599 |
+
if ( isset( $_POST['cartflows-facebook-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-facebook-settings-nonce'] ) ), 'cartflows-facebook-settings' ) ) {
|
600 |
|
601 |
+
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
602 |
$new_settings = array();
|
603 |
|
604 |
if ( isset( $_POST['_cartflows_facebook'] ) ) {
|
605 |
+
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_facebook'] ) ); //phpcs:ignore
|
606 |
}
|
607 |
|
608 |
Cartflows_Helper::update_admin_settings_option( '_cartflows_facebook', $new_settings, false );
|
classes/class-cartflows-api.php
CHANGED
@@ -1,381 +1,381 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CartFlows API
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'CartFlows_API' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* CartFlows API
|
13 |
-
*
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
class CartFlows_API {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Instance
|
20 |
-
*
|
21 |
-
* @access private
|
22 |
-
* @var object Class object.
|
23 |
-
* @since 1.0.0
|
24 |
-
*/
|
25 |
-
private static $instance;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Initiator
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @return object initialized object of class.
|
32 |
-
*/
|
33 |
-
public static function get_instance() {
|
34 |
-
if ( ! isset( self::$instance ) ) {
|
35 |
-
self::$instance = new self();
|
36 |
-
}
|
37 |
-
return self::$instance;
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Constructor
|
42 |
-
*
|
43 |
-
* @since 1.0.0
|
44 |
-
*/
|
45 |
-
public function __construct() {
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Get site URL.
|
50 |
-
*
|
51 |
-
* @since 1.0.0
|
52 |
-
*
|
53 |
-
* @return string Site URL.
|
54 |
-
*/
|
55 |
-
public static function get_site_url() {
|
56 |
-
return apply_filters( 'cartflows_templates_url', CARTFLOWS_TEMPLATES_URL );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Get Client Site Templates Rest API URL.
|
61 |
-
*
|
62 |
-
* @since 1.0.0
|
63 |
-
*
|
64 |
-
* @return string API site URL.
|
65 |
-
*/
|
66 |
-
public static function get_step_endpoint_url() {
|
67 |
-
return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_STEP_POST_TYPE . '/';
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Get Client Site Category Rest API URL.
|
72 |
-
*
|
73 |
-
* @since 1.0.0
|
74 |
-
*
|
75 |
-
* @return string API site URL.
|
76 |
-
*/
|
77 |
-
public static function get_category_endpoint_url() {
|
78 |
-
return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER . '/';
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Get API request URL.
|
83 |
-
*
|
84 |
-
* @since 1.0.0
|
85 |
-
*
|
86 |
-
* @param string $api_base base of api request.
|
87 |
-
* @return string API site URL.
|
88 |
-
*/
|
89 |
-
public static function get_request_api_url( $api_base = '' ) {
|
90 |
-
return self::get_site_url() . 'wp-json/' . CARTFLOWS_STEP_POST_TYPE . '/v1/' . $api_base;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* License Args.
|
95 |
-
*
|
96 |
-
* @return array License arguments.
|
97 |
-
*/
|
98 |
-
public static function get_licence_args() {
|
99 |
-
return apply_filters( 'cartflows_licence_args', array() );
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Get single demo.
|
104 |
-
*
|
105 |
-
* @since 1.0.0
|
106 |
-
*
|
107 |
-
* @param string $site_id Template ID of the site.
|
108 |
-
* @return array Template data.
|
109 |
-
*/
|
110 |
-
public static function get_template( $site_id ) {
|
111 |
-
// @codingStandardsIgnoreStart
|
112 |
-
$request_params = array(
|
113 |
-
'licence_args' => self::get_licence_args(),
|
114 |
-
'_fields' => 'id,slug,status,type,link,title,featured_media,template,cartflows_step_page_builder,cartflows_step_type,cartflows_step_flow,featured_image_url,licence_status,flow_type,step_type,page_builder,divi_content,post_meta',
|
115 |
-
);
|
116 |
-
// @codingStandardsIgnoreEnd
|
117 |
-
|
118 |
-
$url = add_query_arg( $request_params, self::get_step_endpoint_url() . $site_id );
|
119 |
-
|
120 |
-
$api_args = array(
|
121 |
-
'timeout' => 15,
|
122 |
-
);
|
123 |
-
|
124 |
-
$response = self::remote_get( $url, $api_args );
|
125 |
-
|
126 |
-
if ( $response['success'] ) {
|
127 |
-
$template = $response['data'];
|
128 |
-
return array(
|
129 |
-
'title' => ( isset( $template['title']->rendered ) ) ? $template['title']->rendered : '',
|
130 |
-
'post_meta' => ( isset( $template['post_meta'] ) ) ? $template['post_meta'] : '',
|
131 |
-
'data' => $template,
|
132 |
-
'divi_content' => isset( $response['data']['divi_content'] ) ? $response['data']['divi_content'] : '',
|
133 |
-
'message' => $response['message'], // Your API Key is not valid. Please add valid API Key.
|
134 |
-
'success' => $response['success'],
|
135 |
-
);
|
136 |
-
}
|
137 |
-
|
138 |
-
return array(
|
139 |
-
'title' => '',
|
140 |
-
'post_meta' => array(),
|
141 |
-
'message' => $response['message'],
|
142 |
-
'data' => $response['data'],
|
143 |
-
'divi_content' => '',
|
144 |
-
'success' => $response['success'],
|
145 |
-
);
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Get Cloud Templates
|
150 |
-
*
|
151 |
-
* @since 1.0.0
|
152 |
-
*
|
153 |
-
* @param array $args For selecting the demos (Search terms, pagination etc).
|
154 |
-
* @return array CartFlows list.
|
155 |
-
*/
|
156 |
-
public static function get_templates( $args = array() ) {
|
157 |
-
|
158 |
-
$request_params = wp_parse_args(
|
159 |
-
$args,
|
160 |
-
array(
|
161 |
-
'page' => '1',
|
162 |
-
'per_page' => '15',
|
163 |
-
)
|
164 |
-
);
|
165 |
-
|
166 |
-
$url = add_query_arg( $request_params, self::get_step_endpoint_url() );
|
167 |
-
|
168 |
-
$api_args = array(
|
169 |
-
'timeout' => 15,
|
170 |
-
);
|
171 |
-
|
172 |
-
$response = self::remote_get( $url, $api_args );
|
173 |
-
|
174 |
-
if ( $response['success'] ) {
|
175 |
-
$templates_data = $response['data'];
|
176 |
-
$templates = array();
|
177 |
-
foreach ( $templates_data as $key => $template ) {
|
178 |
-
|
179 |
-
if ( ! isset( $template->id ) ) {
|
180 |
-
continue;
|
181 |
-
}
|
182 |
-
|
183 |
-
$templates[ $key ]['id'] = isset( $template->id ) ? esc_attr( $template->id ) : '';
|
184 |
-
$templates[ $key ]['slug'] = isset( $template->slug ) ? esc_attr( $template->slug ) : '';
|
185 |
-
$templates[ $key ]['link'] = isset( $template->link ) ? esc_url( $template->link ) : '';
|
186 |
-
$templates[ $key ]['date'] = isset( $template->date ) ? esc_attr( $template->date ) : '';
|
187 |
-
$templates[ $key ]['title'] = isset( $template->title->rendered ) ? esc_attr( $template->title->rendered ) : '';
|
188 |
-
$templates[ $key ]['featured_image_url'] = isset( $template->featured_image_url ) ? esc_url( $template->featured_image_url ) : '';
|
189 |
-
$templates[ $key ]['content'] = isset( $template->content->rendered ) ? $template->content->rendered : '';
|
190 |
-
$templates[ $key ]['divi_content'] = isset( $template->divi_content ) ? $template->divi_content : '';
|
191 |
-
$templates[ $key ]['post_meta'] = isset( $template->post_meta ) ? $template->post_meta : '';
|
192 |
-
}
|
193 |
-
|
194 |
-
return array(
|
195 |
-
'templates' => $templates,
|
196 |
-
'templates_count' => $response['count'],
|
197 |
-
'data' => $response,
|
198 |
-
);
|
199 |
-
}
|
200 |
-
|
201 |
-
return array(
|
202 |
-
'templates' => array(),
|
203 |
-
'templates_count' => 0,
|
204 |
-
'data' => $response,
|
205 |
-
);
|
206 |
-
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Get categories.
|
211 |
-
*
|
212 |
-
* @since 1.0.0
|
213 |
-
* @param array $args Arguments.
|
214 |
-
* @return array Category data.
|
215 |
-
*/
|
216 |
-
public static function get_categories( $args = array() ) {
|
217 |
-
|
218 |
-
$request_params = apply_filters(
|
219 |
-
'cartflows_categories_api_params',
|
220 |
-
wp_parse_args(
|
221 |
-
$args,
|
222 |
-
array(
|
223 |
-
'page' => '1',
|
224 |
-
'per_page' => '15',
|
225 |
-
)
|
226 |
-
)
|
227 |
-
);
|
228 |
-
|
229 |
-
$url = add_query_arg( $request_params, self::get_category_endpoint_url() );
|
230 |
-
|
231 |
-
$api_args = apply_filters(
|
232 |
-
'cartflows_api_args',
|
233 |
-
array(
|
234 |
-
'timeout' => 15,
|
235 |
-
)
|
236 |
-
);
|
237 |
-
|
238 |
-
$response = self::remote_get( $url, $api_args );
|
239 |
-
|
240 |
-
if ( $response['success'] ) {
|
241 |
-
$categories_data = $response['data'];
|
242 |
-
$categories = array();
|
243 |
-
|
244 |
-
foreach ( $categories_data as $key => $category ) {
|
245 |
-
if ( isset( $category->count ) && ! empty( $category->count ) ) {
|
246 |
-
$categories[] = array(
|
247 |
-
'id' => isset( $category->id ) ? absint( $category->id ) : 0,
|
248 |
-
'count' => isset( $category->count ) ? absint( $category->count ) : 0,
|
249 |
-
'description' => isset( $category->description ) ? $category->description : '',
|
250 |
-
'link' => isset( $category->link ) ? esc_url( $category->link ) : '',
|
251 |
-
'name' => isset( $category->name ) ? $category->name : '',
|
252 |
-
'slug' => isset( $category->slug ) ? sanitize_text_field( $category->slug ) : '',
|
253 |
-
'taxonomy' => isset( $category->taxonomy ) ? $category->taxonomy : '',
|
254 |
-
'parent' => isset( $category->parent ) ? $category->parent : '',
|
255 |
-
);
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
return array(
|
260 |
-
'categories' => $categories,
|
261 |
-
'categories_count' => $response['count'],
|
262 |
-
'data' => $response,
|
263 |
-
);
|
264 |
-
}
|
265 |
-
|
266 |
-
return array(
|
267 |
-
'categories' => array(),
|
268 |
-
'categories_count' => 0,
|
269 |
-
'data' => $response,
|
270 |
-
);
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Remote GET API Request
|
275 |
-
*
|
276 |
-
* @since 1.0.0
|
277 |
-
*
|
278 |
-
* @param string $url Target server API URL.
|
279 |
-
* @param array $args Array of arguments for the API request.
|
280 |
-
* @return mixed Return the API request result.
|
281 |
-
*/
|
282 |
-
public static function remote_get( $url = '', $args = array() ) {
|
283 |
-
$request = wp_remote_get( $url, $args );
|
284 |
-
return self::request( $request );
|
285 |
-
}
|
286 |
-
|
287 |
-
/**
|
288 |
-
* Remote POST API Request
|
289 |
-
*
|
290 |
-
* @since 1.0.0
|
291 |
-
*
|
292 |
-
* @param string $url Target server API URL.
|
293 |
-
* @param array $args Array of arguments for the API request.
|
294 |
-
* @return mixed Return the API request result.
|
295 |
-
*/
|
296 |
-
public static function remote_post( $url = '', $args = array() ) {
|
297 |
-
$request = wp_remote_post( $url, $args );
|
298 |
-
|
299 |
-
return self::request( $request );
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Site API Request
|
304 |
-
*
|
305 |
-
* @since 1.0.0
|
306 |
-
*
|
307 |
-
* @param boolean $api_base Target server API URL.
|
308 |
-
* @param array $args Array of arguments for the API request.
|
309 |
-
* @return mixed Return the API request result.
|
310 |
-
*/
|
311 |
-
public static function site_request( $api_base = '', $args = array() ) {
|
312 |
-
|
313 |
-
$api_url = self::get_request_api_url( $api_base );
|
314 |
-
|
315 |
-
return self::remote_post( $api_url, $args );
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* API Request
|
320 |
-
*
|
321 |
-
* Handle the API request and return the result.
|
322 |
-
*
|
323 |
-
* @since 1.0.0
|
324 |
-
*
|
325 |
-
* @param array $request Array of arguments for the API request.
|
326 |
-
* @return mixed Return the API request result.
|
327 |
-
*/
|
328 |
-
public static function request( $request ) {
|
329 |
-
|
330 |
-
// Is WP Error?
|
331 |
-
if ( is_wp_error( $request ) ) {
|
332 |
-
return array(
|
333 |
-
'success' => false,
|
334 |
-
'message' => $request->get_error_message(),
|
335 |
-
'data' => $request,
|
336 |
-
'count' => 0,
|
337 |
-
);
|
338 |
-
}
|
339 |
-
|
340 |
-
// Invalid response code.
|
341 |
-
if ( wp_remote_retrieve_response_code( $request ) != 200 ) {
|
342 |
-
return array(
|
343 |
-
'success' => false,
|
344 |
-
'message' => $request['response'],
|
345 |
-
'data' => $request,
|
346 |
-
'count' => 0,
|
347 |
-
);
|
348 |
-
}
|
349 |
-
|
350 |
-
// Get body data.
|
351 |
-
$body = wp_remote_retrieve_body( $request );
|
352 |
-
|
353 |
-
// Is WP Error?
|
354 |
-
if ( is_wp_error( $body ) ) {
|
355 |
-
return array(
|
356 |
-
'success' => false,
|
357 |
-
'message' => $body->get_error_message(),
|
358 |
-
'data' => $request,
|
359 |
-
'count' => 0,
|
360 |
-
);
|
361 |
-
}
|
362 |
-
|
363 |
-
// Decode body content.
|
364 |
-
$body_decoded = json_decode( $body );
|
365 |
-
|
366 |
-
return array(
|
367 |
-
'success' => true,
|
368 |
-
'message' => __( 'Request successfully processed!', 'cartflows' ),
|
369 |
-
'data' => (array) $body_decoded,
|
370 |
-
'count' => wp_remote_retrieve_header( $request, 'x-wp-total' ),
|
371 |
-
);
|
372 |
-
}
|
373 |
-
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Initialize class object with 'get_instance()' method
|
378 |
-
*/
|
379 |
-
CartFlows_API::get_instance();
|
380 |
-
|
381 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CartFlows API
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CartFlows_API' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* CartFlows API
|
13 |
+
*
|
14 |
+
* @since 1.0.0
|
15 |
+
*/
|
16 |
+
class CartFlows_API {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @access private
|
22 |
+
* @var object Class object.
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Initiator
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @return object initialized object of class.
|
32 |
+
*/
|
33 |
+
public static function get_instance() {
|
34 |
+
if ( ! isset( self::$instance ) ) {
|
35 |
+
self::$instance = new self();
|
36 |
+
}
|
37 |
+
return self::$instance;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Constructor
|
42 |
+
*
|
43 |
+
* @since 1.0.0
|
44 |
+
*/
|
45 |
+
public function __construct() {
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get site URL.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*
|
53 |
+
* @return string Site URL.
|
54 |
+
*/
|
55 |
+
public static function get_site_url() {
|
56 |
+
return apply_filters( 'cartflows_templates_url', CARTFLOWS_TEMPLATES_URL );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get Client Site Templates Rest API URL.
|
61 |
+
*
|
62 |
+
* @since 1.0.0
|
63 |
+
*
|
64 |
+
* @return string API site URL.
|
65 |
+
*/
|
66 |
+
public static function get_step_endpoint_url() {
|
67 |
+
return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_STEP_POST_TYPE . '/';
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get Client Site Category Rest API URL.
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
*
|
75 |
+
* @return string API site URL.
|
76 |
+
*/
|
77 |
+
public static function get_category_endpoint_url() {
|
78 |
+
return self::get_site_url() . 'wp-json/wp/v2/' . CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER . '/';
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Get API request URL.
|
83 |
+
*
|
84 |
+
* @since 1.0.0
|
85 |
+
*
|
86 |
+
* @param string $api_base base of api request.
|
87 |
+
* @return string API site URL.
|
88 |
+
*/
|
89 |
+
public static function get_request_api_url( $api_base = '' ) {
|
90 |
+
return self::get_site_url() . 'wp-json/' . CARTFLOWS_STEP_POST_TYPE . '/v1/' . $api_base;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* License Args.
|
95 |
+
*
|
96 |
+
* @return array License arguments.
|
97 |
+
*/
|
98 |
+
public static function get_licence_args() {
|
99 |
+
return apply_filters( 'cartflows_licence_args', array() );
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get single demo.
|
104 |
+
*
|
105 |
+
* @since 1.0.0
|
106 |
+
*
|
107 |
+
* @param string $site_id Template ID of the site.
|
108 |
+
* @return array Template data.
|
109 |
+
*/
|
110 |
+
public static function get_template( $site_id ) {
|
111 |
+
// @codingStandardsIgnoreStart
|
112 |
+
$request_params = array(
|
113 |
+
'licence_args' => self::get_licence_args(),
|
114 |
+
'_fields' => 'id,slug,status,type,link,title,featured_media,template,cartflows_step_page_builder,cartflows_step_type,cartflows_step_flow,featured_image_url,licence_status,flow_type,step_type,page_builder,divi_content,post_meta',
|
115 |
+
);
|
116 |
+
// @codingStandardsIgnoreEnd
|
117 |
+
|
118 |
+
$url = add_query_arg( $request_params, self::get_step_endpoint_url() . $site_id );
|
119 |
+
|
120 |
+
$api_args = array(
|
121 |
+
'timeout' => 15,
|
122 |
+
);
|
123 |
+
|
124 |
+
$response = self::remote_get( $url, $api_args );
|
125 |
+
|
126 |
+
if ( $response['success'] ) {
|
127 |
+
$template = $response['data'];
|
128 |
+
return array(
|
129 |
+
'title' => ( isset( $template['title']->rendered ) ) ? $template['title']->rendered : '',
|
130 |
+
'post_meta' => ( isset( $template['post_meta'] ) ) ? $template['post_meta'] : '',
|
131 |
+
'data' => $template,
|
132 |
+
'divi_content' => isset( $response['data']['divi_content'] ) ? $response['data']['divi_content'] : '',
|
133 |
+
'message' => $response['message'], // Your API Key is not valid. Please add valid API Key.
|
134 |
+
'success' => $response['success'],
|
135 |
+
);
|
136 |
+
}
|
137 |
+
|
138 |
+
return array(
|
139 |
+
'title' => '',
|
140 |
+
'post_meta' => array(),
|
141 |
+
'message' => $response['message'],
|
142 |
+
'data' => $response['data'],
|
143 |
+
'divi_content' => '',
|
144 |
+
'success' => $response['success'],
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Get Cloud Templates
|
150 |
+
*
|
151 |
+
* @since 1.0.0
|
152 |
+
*
|
153 |
+
* @param array $args For selecting the demos (Search terms, pagination etc).
|
154 |
+
* @return array CartFlows list.
|
155 |
+
*/
|
156 |
+
public static function get_templates( $args = array() ) {
|
157 |
+
|
158 |
+
$request_params = wp_parse_args(
|
159 |
+
$args,
|
160 |
+
array(
|
161 |
+
'page' => '1',
|
162 |
+
'per_page' => '15',
|
163 |
+
)
|
164 |
+
);
|
165 |
+
|
166 |
+
$url = add_query_arg( $request_params, self::get_step_endpoint_url() );
|
167 |
+
|
168 |
+
$api_args = array(
|
169 |
+
'timeout' => 15,
|
170 |
+
);
|
171 |
+
|
172 |
+
$response = self::remote_get( $url, $api_args );
|
173 |
+
|
174 |
+
if ( $response['success'] ) {
|
175 |
+
$templates_data = $response['data'];
|
176 |
+
$templates = array();
|
177 |
+
foreach ( $templates_data as $key => $template ) {
|
178 |
+
|
179 |
+
if ( ! isset( $template->id ) ) {
|
180 |
+
continue;
|
181 |
+
}
|
182 |
+
|
183 |
+
$templates[ $key ]['id'] = isset( $template->id ) ? esc_attr( $template->id ) : '';
|
184 |
+
$templates[ $key ]['slug'] = isset( $template->slug ) ? esc_attr( $template->slug ) : '';
|
185 |
+
$templates[ $key ]['link'] = isset( $template->link ) ? esc_url( $template->link ) : '';
|
186 |
+
$templates[ $key ]['date'] = isset( $template->date ) ? esc_attr( $template->date ) : '';
|
187 |
+
$templates[ $key ]['title'] = isset( $template->title->rendered ) ? esc_attr( $template->title->rendered ) : '';
|
188 |
+
$templates[ $key ]['featured_image_url'] = isset( $template->featured_image_url ) ? esc_url( $template->featured_image_url ) : '';
|
189 |
+
$templates[ $key ]['content'] = isset( $template->content->rendered ) ? $template->content->rendered : '';
|
190 |
+
$templates[ $key ]['divi_content'] = isset( $template->divi_content ) ? $template->divi_content : '';
|
191 |
+
$templates[ $key ]['post_meta'] = isset( $template->post_meta ) ? $template->post_meta : '';
|
192 |
+
}
|
193 |
+
|
194 |
+
return array(
|
195 |
+
'templates' => $templates,
|
196 |
+
'templates_count' => $response['count'],
|
197 |
+
'data' => $response,
|
198 |
+
);
|
199 |
+
}
|
200 |
+
|
201 |
+
return array(
|
202 |
+
'templates' => array(),
|
203 |
+
'templates_count' => 0,
|
204 |
+
'data' => $response,
|
205 |
+
);
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Get categories.
|
211 |
+
*
|
212 |
+
* @since 1.0.0
|
213 |
+
* @param array $args Arguments.
|
214 |
+
* @return array Category data.
|
215 |
+
*/
|
216 |
+
public static function get_categories( $args = array() ) {
|
217 |
+
|
218 |
+
$request_params = apply_filters(
|
219 |
+
'cartflows_categories_api_params',
|
220 |
+
wp_parse_args(
|
221 |
+
$args,
|
222 |
+
array(
|
223 |
+
'page' => '1',
|
224 |
+
'per_page' => '15',
|
225 |
+
)
|
226 |
+
)
|
227 |
+
);
|
228 |
+
|
229 |
+
$url = add_query_arg( $request_params, self::get_category_endpoint_url() );
|
230 |
+
|
231 |
+
$api_args = apply_filters(
|
232 |
+
'cartflows_api_args',
|
233 |
+
array(
|
234 |
+
'timeout' => 15,
|
235 |
+
)
|
236 |
+
);
|
237 |
+
|
238 |
+
$response = self::remote_get( $url, $api_args );
|
239 |
+
|
240 |
+
if ( $response['success'] ) {
|
241 |
+
$categories_data = $response['data'];
|
242 |
+
$categories = array();
|
243 |
+
|
244 |
+
foreach ( $categories_data as $key => $category ) {
|
245 |
+
if ( isset( $category->count ) && ! empty( $category->count ) ) {
|
246 |
+
$categories[] = array(
|
247 |
+
'id' => isset( $category->id ) ? absint( $category->id ) : 0,
|
248 |
+
'count' => isset( $category->count ) ? absint( $category->count ) : 0,
|
249 |
+
'description' => isset( $category->description ) ? $category->description : '',
|
250 |
+
'link' => isset( $category->link ) ? esc_url( $category->link ) : '',
|
251 |
+
'name' => isset( $category->name ) ? $category->name : '',
|
252 |
+
'slug' => isset( $category->slug ) ? sanitize_text_field( $category->slug ) : '',
|
253 |
+
'taxonomy' => isset( $category->taxonomy ) ? $category->taxonomy : '',
|
254 |
+
'parent' => isset( $category->parent ) ? $category->parent : '',
|
255 |
+
);
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
return array(
|
260 |
+
'categories' => $categories,
|
261 |
+
'categories_count' => $response['count'],
|
262 |
+
'data' => $response,
|
263 |
+
);
|
264 |
+
}
|
265 |
+
|
266 |
+
return array(
|
267 |
+
'categories' => array(),
|
268 |
+
'categories_count' => 0,
|
269 |
+
'data' => $response,
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Remote GET API Request
|
275 |
+
*
|
276 |
+
* @since 1.0.0
|
277 |
+
*
|
278 |
+
* @param string $url Target server API URL.
|
279 |
+
* @param array $args Array of arguments for the API request.
|
280 |
+
* @return mixed Return the API request result.
|
281 |
+
*/
|
282 |
+
public static function remote_get( $url = '', $args = array() ) {
|
283 |
+
$request = wp_remote_get( $url, $args );
|
284 |
+
return self::request( $request );
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Remote POST API Request
|
289 |
+
*
|
290 |
+
* @since 1.0.0
|
291 |
+
*
|
292 |
+
* @param string $url Target server API URL.
|
293 |
+
* @param array $args Array of arguments for the API request.
|
294 |
+
* @return mixed Return the API request result.
|
295 |
+
*/
|
296 |
+
public static function remote_post( $url = '', $args = array() ) {
|
297 |
+
$request = wp_remote_post( $url, $args );
|
298 |
+
|
299 |
+
return self::request( $request );
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Site API Request
|
304 |
+
*
|
305 |
+
* @since 1.0.0
|
306 |
+
*
|
307 |
+
* @param boolean $api_base Target server API URL.
|
308 |
+
* @param array $args Array of arguments for the API request.
|
309 |
+
* @return mixed Return the API request result.
|
310 |
+
*/
|
311 |
+
public static function site_request( $api_base = '', $args = array() ) {
|
312 |
+
|
313 |
+
$api_url = self::get_request_api_url( $api_base );
|
314 |
+
|
315 |
+
return self::remote_post( $api_url, $args );
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* API Request
|
320 |
+
*
|
321 |
+
* Handle the API request and return the result.
|
322 |
+
*
|
323 |
+
* @since 1.0.0
|
324 |
+
*
|
325 |
+
* @param array $request Array of arguments for the API request.
|
326 |
+
* @return mixed Return the API request result.
|
327 |
+
*/
|
328 |
+
public static function request( $request ) {
|
329 |
+
|
330 |
+
// Is WP Error?
|
331 |
+
if ( is_wp_error( $request ) ) {
|
332 |
+
return array(
|
333 |
+
'success' => false,
|
334 |
+
'message' => $request->get_error_message(),
|
335 |
+
'data' => $request,
|
336 |
+
'count' => 0,
|
337 |
+
);
|
338 |
+
}
|
339 |
+
|
340 |
+
// Invalid response code.
|
341 |
+
if ( wp_remote_retrieve_response_code( $request ) != 200 ) {
|
342 |
+
return array(
|
343 |
+
'success' => false,
|
344 |
+
'message' => $request['response'],
|
345 |
+
'data' => $request,
|
346 |
+
'count' => 0,
|
347 |
+
);
|
348 |
+
}
|
349 |
+
|
350 |
+
// Get body data.
|
351 |
+
$body = wp_remote_retrieve_body( $request );
|
352 |
+
|
353 |
+
// Is WP Error?
|
354 |
+
if ( is_wp_error( $body ) ) {
|
355 |
+
return array(
|
356 |
+
'success' => false,
|
357 |
+
'message' => $body->get_error_message(),
|
358 |
+
'data' => $request,
|
359 |
+
'count' => 0,
|
360 |
+
);
|
361 |
+
}
|
362 |
+
|
363 |
+
// Decode body content.
|
364 |
+
$body_decoded = json_decode( $body );
|
365 |
+
|
366 |
+
return array(
|
367 |
+
'success' => true,
|
368 |
+
'message' => __( 'Request successfully processed!', 'cartflows' ),
|
369 |
+
'data' => (array) $body_decoded,
|
370 |
+
'count' => wp_remote_retrieve_header( $request, 'x-wp-total' ),
|
371 |
+
);
|
372 |
+
}
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Initialize class object with 'get_instance()' method
|
378 |
+
*/
|
379 |
+
CartFlows_API::get_instance();
|
380 |
+
|
381 |
+
endif;
|
classes/class-cartflows-bb-compatibility.php
CHANGED
@@ -1,76 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Beaver Builder page builder compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_BB_Compatibility' ) ) :
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class for Beaver Builder page builder compatibility
|
12 |
-
*/
|
13 |
-
class Cartflows_BB_Compatibility {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Member Variable
|
17 |
-
*
|
18 |
-
* @var instance
|
19 |
-
*/
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Initiator
|
24 |
-
*
|
25 |
-
* @since 1.1.4
|
26 |
-
*/
|
27 |
-
public static function get_instance() {
|
28 |
-
if ( ! isset( self::$instance ) ) {
|
29 |
-
self::$instance = new self();
|
30 |
-
}
|
31 |
-
return self::$instance;
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Constructor
|
36 |
-
*
|
37 |
-
* @since 1.1.4
|
38 |
-
*/
|
39 |
-
public function __construct() {
|
40 |
-
add_filter( 'fl_builder_post_types', array( $this, 'post_types' ) );
|
41 |
-
add_action( 'admin_init', array( $this, 'disable_rediraction' ), 99 );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Disable Beaver Builder Redirection after plugin install.
|
46 |
-
*
|
47 |
-
* @since 1.1.4
|
48 |
-
*
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
public function disable_rediraction() {
|
52 |
-
delete_transient( '_fl_builder_activation_admin_notice' );
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Add beaver builder support for step post type.
|
57 |
-
*
|
58 |
-
* @since 1.1.4
|
59 |
-
*
|
60 |
-
* @param array $post_types container Post types.
|
61 |
-
* @return array
|
62 |
-
*/
|
63 |
-
public function post_types( $post_types ) {
|
64 |
-
|
65 |
-
$post_types[] = 'cartflows_step';
|
66 |
-
|
67 |
-
return $post_types;
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Kicking this off by calling 'get_instance()' method
|
73 |
-
*/
|
74 |
-
Cartflows_BB_Compatibility::get_instance();
|
75 |
-
|
76 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Beaver Builder page builder compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_BB_Compatibility' ) ) :
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class for Beaver Builder page builder compatibility
|
12 |
+
*/
|
13 |
+
class Cartflows_BB_Compatibility {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Member Variable
|
17 |
+
*
|
18 |
+
* @var instance
|
19 |
+
*/
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initiator
|
24 |
+
*
|
25 |
+
* @since 1.1.4
|
26 |
+
*/
|
27 |
+
public static function get_instance() {
|
28 |
+
if ( ! isset( self::$instance ) ) {
|
29 |
+
self::$instance = new self();
|
30 |
+
}
|
31 |
+
return self::$instance;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor
|
36 |
+
*
|
37 |
+
* @since 1.1.4
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
add_filter( 'fl_builder_post_types', array( $this, 'post_types' ) );
|
41 |
+
add_action( 'admin_init', array( $this, 'disable_rediraction' ), 99 );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Disable Beaver Builder Redirection after plugin install.
|
46 |
+
*
|
47 |
+
* @since 1.1.4
|
48 |
+
*
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
public function disable_rediraction() {
|
52 |
+
delete_transient( '_fl_builder_activation_admin_notice' );
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Add beaver builder support for step post type.
|
57 |
+
*
|
58 |
+
* @since 1.1.4
|
59 |
+
*
|
60 |
+
* @param array $post_types container Post types.
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function post_types( $post_types ) {
|
64 |
+
|
65 |
+
$post_types[] = 'cartflows_step';
|
66 |
+
|
67 |
+
return $post_types;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Kicking this off by calling 'get_instance()' method
|
73 |
+
*/
|
74 |
+
Cartflows_BB_Compatibility::get_instance();
|
75 |
+
|
76 |
+
endif;
|
classes/class-cartflows-cloning.php
CHANGED
@@ -54,7 +54,7 @@ class Cartflows_Cloning {
|
|
54 |
/*
|
55 |
* Nonce verification
|
56 |
*/
|
57 |
-
if ( ! isset( $_GET['flow_clone_nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['flow_clone_nonce'] ), basename( __FILE__ ) ) ) {
|
58 |
return;
|
59 |
}
|
60 |
|
@@ -273,7 +273,7 @@ class Cartflows_Cloning {
|
|
273 |
/*
|
274 |
* Nonce verification
|
275 |
*/
|
276 |
-
if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['step_clone_nonce'] ), 'step_clone' ) ) {
|
277 |
return;
|
278 |
}
|
279 |
|
54 |
/*
|
55 |
* Nonce verification
|
56 |
*/
|
57 |
+
if ( ! isset( $_GET['flow_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['flow_clone_nonce'] ) ), basename( __FILE__ ) ) ) {
|
58 |
return;
|
59 |
}
|
60 |
|
273 |
/*
|
274 |
* Nonce verification
|
275 |
*/
|
276 |
+
if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['step_clone_nonce'] ) ), 'step_clone' ) ) {
|
277 |
return;
|
278 |
}
|
279 |
|
classes/class-cartflows-compatibility.php
CHANGED
@@ -1,410 +1,410 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Page builder compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class for page builder compatibility
|
12 |
-
*/
|
13 |
-
class Cartflows_Compatibility {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Member Variable
|
17 |
-
*
|
18 |
-
* @var object instance
|
19 |
-
*/
|
20 |
-
private static $instance;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Initiator
|
24 |
-
*/
|
25 |
-
public static function get_instance() {
|
26 |
-
if ( ! isset( self::$instance ) ) {
|
27 |
-
self::$instance = new self();
|
28 |
-
}
|
29 |
-
return self::$instance;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Constructor
|
34 |
-
*/
|
35 |
-
public function __construct() {
|
36 |
-
|
37 |
-
$this->load_files();
|
38 |
-
|
39 |
-
// Override post meta.
|
40 |
-
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
-
|
42 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Load page builder compatibility files
|
47 |
-
*/
|
48 |
-
public function load_files() {
|
49 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
-
}
|
52 |
-
|
53 |
-
if ( $this->is_divi_enabled() ) {
|
54 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
-
}
|
56 |
-
|
57 |
-
if ( $this->is_bb_enabled() ) {
|
58 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( defined( 'LEARNDASH_VERSION' ) ) {
|
66 |
-
require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Check if it is beaver builder enabled.
|
72 |
-
*
|
73 |
-
* @since 1.1.4
|
74 |
-
*/
|
75 |
-
public function is_bb_enabled() {
|
76 |
-
|
77 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Check if elementor preview mode is on.
|
86 |
-
*/
|
87 |
-
public function is_elementor_preview_mode() {
|
88 |
-
|
89 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
90 |
-
|
91 |
-
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
92 |
-
return true;
|
93 |
-
}
|
94 |
-
}
|
95 |
-
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Get Current Theme.
|
101 |
-
*/
|
102 |
-
public function get_current_theme() {
|
103 |
-
|
104 |
-
$theme_name = '';
|
105 |
-
$theme = wp_get_theme();
|
106 |
-
|
107 |
-
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
108 |
-
$theme_name = $theme->parent_theme;
|
109 |
-
} else {
|
110 |
-
$theme_name = $theme->name;
|
111 |
-
}
|
112 |
-
|
113 |
-
return $theme_name;
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Check if it is beaver builder preview mode
|
118 |
-
*/
|
119 |
-
public function is_bb_preview_mode() {
|
120 |
-
|
121 |
-
if ( class_exists( 'FLBuilderModel' ) ) {
|
122 |
-
if ( FLBuilderModel::is_builder_active() ) {
|
123 |
-
return true;
|
124 |
-
} else {
|
125 |
-
return false;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
return false;
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Check for page builder preview mode.
|
134 |
-
*/
|
135 |
-
public function is_page_builder_preview() {
|
136 |
-
|
137 |
-
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
|
141 |
-
return false;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Check if divi builder enabled for post id.
|
146 |
-
*/
|
147 |
-
public function is_divi_builder_preview() {
|
148 |
-
|
149 |
-
if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
|
150 |
-
return true;
|
151 |
-
}
|
152 |
-
|
153 |
-
return false;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Check if divi builder enabled for post id.
|
158 |
-
*
|
159 |
-
* @param int $post_id post id.
|
160 |
-
*/
|
161 |
-
public function is_divi_builder_enabled( $post_id ) {
|
162 |
-
|
163 |
-
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
164 |
-
return true;
|
165 |
-
}
|
166 |
-
|
167 |
-
return false;
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Check if compatibility theme enabled.
|
172 |
-
*/
|
173 |
-
public function is_compatibility_theme_enabled() {
|
174 |
-
|
175 |
-
$theme = wp_get_theme();
|
176 |
-
|
177 |
-
$is_compatibility = false;
|
178 |
-
|
179 |
-
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
|
180 |
-
|
181 |
-
$is_compatibility = true;
|
182 |
-
}
|
183 |
-
|
184 |
-
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Check if divi builder enabled for post id.
|
189 |
-
*
|
190 |
-
* @param object $theme theme data.
|
191 |
-
* @return boolean
|
192 |
-
*/
|
193 |
-
public function is_divi_enabled( $theme = false ) {
|
194 |
-
|
195 |
-
if ( ! $theme ) {
|
196 |
-
$theme = wp_get_theme();
|
197 |
-
}
|
198 |
-
|
199 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
200 |
-
return true;
|
201 |
-
}
|
202 |
-
|
203 |
-
return false;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Check if Divi theme is install status.
|
208 |
-
*
|
209 |
-
* @return boolean
|
210 |
-
*/
|
211 |
-
public function is_divi_theme_installed() {
|
212 |
-
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
213 |
-
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
214 |
-
return true;
|
215 |
-
}
|
216 |
-
}
|
217 |
-
return false;
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Check if Flatsome enabled for post id.
|
222 |
-
*
|
223 |
-
* @param object $theme theme data.
|
224 |
-
* @return boolean
|
225 |
-
*/
|
226 |
-
public function is_flatsome_enabled( $theme = false ) {
|
227 |
-
|
228 |
-
if ( ! $theme ) {
|
229 |
-
$theme = wp_get_theme();
|
230 |
-
}
|
231 |
-
|
232 |
-
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
233 |
-
return true;
|
234 |
-
}
|
235 |
-
|
236 |
-
return false;
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Check if The7 enabled for post id.
|
241 |
-
*
|
242 |
-
* @param object $theme theme data.
|
243 |
-
* @return boolean
|
244 |
-
*/
|
245 |
-
public function is_the_seven_enabled( $theme = false ) {
|
246 |
-
|
247 |
-
if ( ! $theme ) {
|
248 |
-
$theme = wp_get_theme();
|
249 |
-
}
|
250 |
-
|
251 |
-
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
252 |
-
return true;
|
253 |
-
}
|
254 |
-
|
255 |
-
return false;
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Check if OceanWp enabled for post id.
|
260 |
-
*
|
261 |
-
* @param object $theme theme data.
|
262 |
-
* @return boolean
|
263 |
-
*/
|
264 |
-
public function is_oceanwp_enabled( $theme = false ) {
|
265 |
-
|
266 |
-
if ( ! $theme ) {
|
267 |
-
$theme = wp_get_theme();
|
268 |
-
}
|
269 |
-
|
270 |
-
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
271 |
-
return true;
|
272 |
-
}
|
273 |
-
|
274 |
-
return false;
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Check for thrive architect edit page.
|
279 |
-
*
|
280 |
-
* @param int $post_id post id.
|
281 |
-
*/
|
282 |
-
public function is_thrive_edit_page( $post_id ) {
|
283 |
-
|
284 |
-
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
285 |
-
return true;
|
286 |
-
} else {
|
287 |
-
return false;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Check if the page being rendered is the main ID on the editor page.
|
293 |
-
*
|
294 |
-
* @since 1.0.0
|
295 |
-
* @param String $post_id Post ID which is to be rendered.
|
296 |
-
* @return boolean True if current if is being rendered is not being edited.
|
297 |
-
*/
|
298 |
-
private function is_thrive_builder_page( $post_id ) {
|
299 |
-
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
|
300 |
-
$post = isset( $_GET['post'] ) ? sanitize_text_field( wp_unslash( $_GET['post'] ) ) : false;
|
301 |
-
|
302 |
-
return ( true == $tve && $post_id !== $post );
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Overwrite meta for page
|
307 |
-
*/
|
308 |
-
public function override_meta() {
|
309 |
-
|
310 |
-
// don't override meta for `elementor_library` post type.
|
311 |
-
if ( 'elementor_library' == get_post_type() ) {
|
312 |
-
return;
|
313 |
-
}
|
314 |
-
|
315 |
-
if ( ! is_singular() ) {
|
316 |
-
return;
|
317 |
-
}
|
318 |
-
|
319 |
-
global $post;
|
320 |
-
$post_id = $post->ID;
|
321 |
-
$post_type = get_post_type();
|
322 |
-
|
323 |
-
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
324 |
-
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
325 |
-
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
326 |
-
|
327 |
-
if ( '' == $post->post_content ) {
|
328 |
-
|
329 |
-
$this->overwrite_template( $post_id );
|
330 |
-
}
|
331 |
-
}
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Assign cartflow canvas template to page.
|
336 |
-
*
|
337 |
-
* @param int $post_id post ID.
|
338 |
-
*/
|
339 |
-
public function overwrite_template( $post_id ) {
|
340 |
-
|
341 |
-
$template = 'cartflows-canvas';
|
342 |
-
$key = '_wp_page_template';
|
343 |
-
|
344 |
-
$record_exists = get_post_meta( $post_id, $key, true );
|
345 |
-
|
346 |
-
if ( 'cartflows-canvas' == $record_exists ) {
|
347 |
-
return;
|
348 |
-
}
|
349 |
-
|
350 |
-
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
351 |
-
if ( class_exists( '\Elementor\Plugin' ) ) {
|
352 |
-
|
353 |
-
global $wpdb;
|
354 |
-
|
355 |
-
if ( '' == $record_exists || ! $record_exists ) {
|
356 |
-
|
357 |
-
$wpdb->insert(
|
358 |
-
$wpdb->prefix . 'postmeta',
|
359 |
-
array(
|
360 |
-
'post_id' => $post_id,
|
361 |
-
'meta_key' => $key,//phpcs:ignore
|
362 |
-
'meta_value' => $template, //phpcs:ignore
|
363 |
-
)
|
364 |
-
);// db call ok;.
|
365 |
-
|
366 |
-
// alternative query to above query.
|
367 |
-
// $table = $wpdb->prefix . 'postmeta';
|
368 |
-
// $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
|
369 |
-
// VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
|
370 |
-
|
371 |
-
} else {
|
372 |
-
|
373 |
-
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
|
374 |
-
}
|
375 |
-
} else {
|
376 |
-
|
377 |
-
update_post_meta( $post_id, $key, $template );
|
378 |
-
}
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Load font awesome style from oceanwp on checkout page.
|
383 |
-
*/
|
384 |
-
public function load_fontawesome() {
|
385 |
-
|
386 |
-
$theme = get_template();
|
387 |
-
|
388 |
-
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
389 |
-
|
390 |
-
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
391 |
-
|
392 |
-
if ( $load_fa ) {
|
393 |
-
|
394 |
-
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
|
395 |
-
}
|
396 |
-
|
397 |
-
$custom_css = '
|
398 |
-
#oceanwp-cart-sidebar-wrap,
|
399 |
-
#owp-qv-wrap{
|
400 |
-
display: none;
|
401 |
-
}';
|
402 |
-
|
403 |
-
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}
|
407 |
-
}
|
408 |
-
|
409 |
-
Cartflows_Compatibility::get_instance();
|
410 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Page builder compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class for page builder compatibility
|
12 |
+
*/
|
13 |
+
class Cartflows_Compatibility {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Member Variable
|
17 |
+
*
|
18 |
+
* @var object instance
|
19 |
+
*/
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Initiator
|
24 |
+
*/
|
25 |
+
public static function get_instance() {
|
26 |
+
if ( ! isset( self::$instance ) ) {
|
27 |
+
self::$instance = new self();
|
28 |
+
}
|
29 |
+
return self::$instance;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Constructor
|
34 |
+
*/
|
35 |
+
public function __construct() {
|
36 |
+
|
37 |
+
$this->load_files();
|
38 |
+
|
39 |
+
// Override post meta.
|
40 |
+
add_action( 'wp', array( $this, 'override_meta' ), 0 );
|
41 |
+
|
42 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'load_fontawesome' ), 10000 );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Load page builder compatibility files
|
47 |
+
*/
|
48 |
+
public function load_files() {
|
49 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
50 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-elementor-compatibility.php';
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( $this->is_divi_enabled() ) {
|
54 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( $this->is_bb_enabled() ) {
|
58 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-bb-compatibility.php';
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( class_exists( 'TCB_Post' ) ) {
|
62 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
|
63 |
+
}
|
64 |
+
|
65 |
+
if ( defined( 'LEARNDASH_VERSION' ) ) {
|
66 |
+
require_once CARTFLOWS_DIR . 'classes/class-cartflows-learndash-compatibility.php';
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Check if it is beaver builder enabled.
|
72 |
+
*
|
73 |
+
* @since 1.1.4
|
74 |
+
*/
|
75 |
+
public function is_bb_enabled() {
|
76 |
+
|
77 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Check if elementor preview mode is on.
|
86 |
+
*/
|
87 |
+
public function is_elementor_preview_mode() {
|
88 |
+
|
89 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
90 |
+
|
91 |
+
if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
92 |
+
return true;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Get Current Theme.
|
101 |
+
*/
|
102 |
+
public function get_current_theme() {
|
103 |
+
|
104 |
+
$theme_name = '';
|
105 |
+
$theme = wp_get_theme();
|
106 |
+
|
107 |
+
if ( isset( $theme->parent_theme ) && '' != $theme->parent_theme || null != $theme->parent_theme ) {
|
108 |
+
$theme_name = $theme->parent_theme;
|
109 |
+
} else {
|
110 |
+
$theme_name = $theme->name;
|
111 |
+
}
|
112 |
+
|
113 |
+
return $theme_name;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Check if it is beaver builder preview mode
|
118 |
+
*/
|
119 |
+
public function is_bb_preview_mode() {
|
120 |
+
|
121 |
+
if ( class_exists( 'FLBuilderModel' ) ) {
|
122 |
+
if ( FLBuilderModel::is_builder_active() ) {
|
123 |
+
return true;
|
124 |
+
} else {
|
125 |
+
return false;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
return false;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Check for page builder preview mode.
|
134 |
+
*/
|
135 |
+
public function is_page_builder_preview() {
|
136 |
+
|
137 |
+
if ( $this->is_elementor_preview_mode() || $this->is_bb_preview_mode() || $this->is_divi_builder_preview() ) {
|
138 |
+
return true;
|
139 |
+
}
|
140 |
+
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Check if divi builder enabled for post id.
|
146 |
+
*/
|
147 |
+
public function is_divi_builder_preview() {
|
148 |
+
|
149 |
+
if ( isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] ) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Check if divi builder enabled for post id.
|
158 |
+
*
|
159 |
+
* @param int $post_id post id.
|
160 |
+
*/
|
161 |
+
public function is_divi_builder_enabled( $post_id ) {
|
162 |
+
|
163 |
+
if ( function_exists( 'et_pb_is_pagebuilder_used' ) && et_pb_is_pagebuilder_used( $post_id ) ) {
|
164 |
+
return true;
|
165 |
+
}
|
166 |
+
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Check if compatibility theme enabled.
|
172 |
+
*/
|
173 |
+
public function is_compatibility_theme_enabled() {
|
174 |
+
|
175 |
+
$theme = wp_get_theme();
|
176 |
+
|
177 |
+
$is_compatibility = false;
|
178 |
+
|
179 |
+
if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
|
180 |
+
|
181 |
+
$is_compatibility = true;
|
182 |
+
}
|
183 |
+
|
184 |
+
return apply_filters( 'cartflows_is_compatibility_theme', $is_compatibility );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Check if divi builder enabled for post id.
|
189 |
+
*
|
190 |
+
* @param object $theme theme data.
|
191 |
+
* @return boolean
|
192 |
+
*/
|
193 |
+
public function is_divi_enabled( $theme = false ) {
|
194 |
+
|
195 |
+
if ( ! $theme ) {
|
196 |
+
$theme = wp_get_theme();
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
200 |
+
return true;
|
201 |
+
}
|
202 |
+
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Check if Divi theme is install status.
|
208 |
+
*
|
209 |
+
* @return boolean
|
210 |
+
*/
|
211 |
+
public function is_divi_theme_installed() {
|
212 |
+
foreach ( (array) wp_get_themes() as $theme_dir => $theme ) {
|
213 |
+
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme || 'Extra' == $theme->name || 'Extra' == $theme->parent_theme ) {
|
214 |
+
return true;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return false;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Check if Flatsome enabled for post id.
|
222 |
+
*
|
223 |
+
* @param object $theme theme data.
|
224 |
+
* @return boolean
|
225 |
+
*/
|
226 |
+
public function is_flatsome_enabled( $theme = false ) {
|
227 |
+
|
228 |
+
if ( ! $theme ) {
|
229 |
+
$theme = wp_get_theme();
|
230 |
+
}
|
231 |
+
|
232 |
+
if ( 'Flatsome' == $theme->name || 'Flatsome' == $theme->parent_theme ) {
|
233 |
+
return true;
|
234 |
+
}
|
235 |
+
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Check if The7 enabled for post id.
|
241 |
+
*
|
242 |
+
* @param object $theme theme data.
|
243 |
+
* @return boolean
|
244 |
+
*/
|
245 |
+
public function is_the_seven_enabled( $theme = false ) {
|
246 |
+
|
247 |
+
if ( ! $theme ) {
|
248 |
+
$theme = wp_get_theme();
|
249 |
+
}
|
250 |
+
|
251 |
+
if ( 'The7' == $theme->name || 'The7' == $theme->parent_theme ) {
|
252 |
+
return true;
|
253 |
+
}
|
254 |
+
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Check if OceanWp enabled for post id.
|
260 |
+
*
|
261 |
+
* @param object $theme theme data.
|
262 |
+
* @return boolean
|
263 |
+
*/
|
264 |
+
public function is_oceanwp_enabled( $theme = false ) {
|
265 |
+
|
266 |
+
if ( ! $theme ) {
|
267 |
+
$theme = wp_get_theme();
|
268 |
+
}
|
269 |
+
|
270 |
+
if ( 'OceanWP' == $theme->name || 'OceanWP' == $theme->parent_theme ) {
|
271 |
+
return true;
|
272 |
+
}
|
273 |
+
|
274 |
+
return false;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Check for thrive architect edit page.
|
279 |
+
*
|
280 |
+
* @param int $post_id post id.
|
281 |
+
*/
|
282 |
+
public function is_thrive_edit_page( $post_id ) {
|
283 |
+
|
284 |
+
if ( true === $this->is_thrive_builder_page( $post_id ) ) {
|
285 |
+
return true;
|
286 |
+
} else {
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Check if the page being rendered is the main ID on the editor page.
|
293 |
+
*
|
294 |
+
* @since 1.0.0
|
295 |
+
* @param String $post_id Post ID which is to be rendered.
|
296 |
+
* @return boolean True if current if is being rendered is not being edited.
|
297 |
+
*/
|
298 |
+
private function is_thrive_builder_page( $post_id ) {
|
299 |
+
$tve = ( isset( $_GET['tve'] ) && 'true' == $_GET['tve'] ) ? true : false;
|
300 |
+
$post = isset( $_GET['post'] ) ? sanitize_text_field( wp_unslash( $_GET['post'] ) ) : false;
|
301 |
+
|
302 |
+
return ( true == $tve && $post_id !== $post );
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Overwrite meta for page
|
307 |
+
*/
|
308 |
+
public function override_meta() {
|
309 |
+
|
310 |
+
// don't override meta for `elementor_library` post type.
|
311 |
+
if ( 'elementor_library' == get_post_type() ) {
|
312 |
+
return;
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( ! is_singular() ) {
|
316 |
+
return;
|
317 |
+
}
|
318 |
+
|
319 |
+
global $post;
|
320 |
+
$post_id = $post->ID;
|
321 |
+
$post_type = get_post_type();
|
322 |
+
|
323 |
+
if ( 'cartflows_step' == $post_type && ( $this->is_elementor_preview_mode()
|
324 |
+
|| $this->is_bb_preview_mode() || $this->is_thrive_edit_page( $post_id )
|
325 |
+
|| $this->is_divi_builder_enabled( $post_id ) ) ) {
|
326 |
+
|
327 |
+
if ( '' == $post->post_content ) {
|
328 |
+
|
329 |
+
$this->overwrite_template( $post_id );
|
330 |
+
}
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Assign cartflow canvas template to page.
|
336 |
+
*
|
337 |
+
* @param int $post_id post ID.
|
338 |
+
*/
|
339 |
+
public function overwrite_template( $post_id ) {
|
340 |
+
|
341 |
+
$template = 'cartflows-canvas';
|
342 |
+
$key = '_wp_page_template';
|
343 |
+
|
344 |
+
$record_exists = get_post_meta( $post_id, $key, true );
|
345 |
+
|
346 |
+
if ( 'cartflows-canvas' == $record_exists ) {
|
347 |
+
return;
|
348 |
+
}
|
349 |
+
|
350 |
+
// As elementor doesn't allow update post meta using update_post_meta, run wpdb query to update post meta.
|
351 |
+
if ( class_exists( '\Elementor\Plugin' ) ) {
|
352 |
+
|
353 |
+
global $wpdb;
|
354 |
+
|
355 |
+
if ( '' == $record_exists || ! $record_exists ) {
|
356 |
+
|
357 |
+
$wpdb->insert(
|
358 |
+
$wpdb->prefix . 'postmeta',
|
359 |
+
array(
|
360 |
+
'post_id' => $post_id,
|
361 |
+
'meta_key' => $key,//phpcs:ignore
|
362 |
+
'meta_value' => $template, //phpcs:ignore
|
363 |
+
)
|
364 |
+
);// db call ok;.
|
365 |
+
|
366 |
+
// alternative query to above query.
|
367 |
+
// $table = $wpdb->prefix . 'postmeta';
|
368 |
+
// $wpdb->query($wpdb->prepare( "INSERT INTO { $table } ( `post_id`, `meta_key`, 'meta_value' )
|
369 |
+
// VALUES ( '$post_id', '$key', '$template' )" ) );// db call ok; no-cache ok.
|
370 |
+
|
371 |
+
} else {
|
372 |
+
|
373 |
+
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %s WHERE meta_key = %s AND post_id = %s;", $template, $key, $post_id ) ); // db call ok; no-cache ok.
|
374 |
+
}
|
375 |
+
} else {
|
376 |
+
|
377 |
+
update_post_meta( $post_id, $key, $template );
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Load font awesome style from oceanwp on checkout page.
|
383 |
+
*/
|
384 |
+
public function load_fontawesome() {
|
385 |
+
|
386 |
+
$theme = get_template();
|
387 |
+
|
388 |
+
if ( 'oceanwp' == strtolower( $theme ) && wcf()->utils->is_step_post_type() ) {
|
389 |
+
|
390 |
+
$load_fa = apply_filters( 'cartflows_maybe_load_font_awesome', true );
|
391 |
+
|
392 |
+
if ( $load_fa ) {
|
393 |
+
|
394 |
+
wp_enqueue_style( 'font-awesome', OCEANWP_CSS_DIR_URI . 'third/font-awesome.min.css', false );//phpcs:ignore
|
395 |
+
}
|
396 |
+
|
397 |
+
$custom_css = '
|
398 |
+
#oceanwp-cart-sidebar-wrap,
|
399 |
+
#owp-qv-wrap{
|
400 |
+
display: none;
|
401 |
+
}';
|
402 |
+
|
403 |
+
wp_add_inline_style( 'wcf-frontend-global', $custom_css );
|
404 |
+
}
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
Cartflows_Compatibility::get_instance();
|
410 |
+
|
classes/class-cartflows-default-meta.php
CHANGED
@@ -386,7 +386,7 @@ class Cartflows_Default_Meta {
|
|
386 |
$billing_fields = array();
|
387 |
|
388 |
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
|
389 |
-
$post_data = wp_unslash( $_POST[ $key ] );
|
390 |
|
391 |
if ( 'wcf_field_order_billing' == $key ) {
|
392 |
$billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post_id );
|
386 |
$billing_fields = array();
|
387 |
|
388 |
if ( isset( $_POST[ $key ] ) && is_array( $_POST[ $key ] ) ) {
|
389 |
+
$post_data = wp_unslash( $_POST[ $key ] ); //phpcs:ignore
|
390 |
|
391 |
if ( 'wcf_field_order_billing' == $key ) {
|
392 |
$billing_fields = Cartflows_Helper::get_checkout_fields( 'billing', $post_id );
|
classes/class-cartflows-flow-frontend.php
CHANGED
@@ -1,206 +1,206 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Frontend & Markup
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Flow Markup
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Flow_Frontend {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var object instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Initiator
|
25 |
-
*/
|
26 |
-
public static function get_instance() {
|
27 |
-
if ( ! isset( self::$instance ) ) {
|
28 |
-
self::$instance = new self();
|
29 |
-
}
|
30 |
-
return self::$instance;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*/
|
36 |
-
public function __construct() {
|
37 |
-
|
38 |
-
/* Analytics */
|
39 |
-
add_action( 'cartflows_wp_footer', array( $this, 'footer_markup' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Footer markup
|
44 |
-
*/
|
45 |
-
public function footer_markup() {
|
46 |
-
|
47 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
48 |
-
// @codingStandardsIgnoreStart
|
49 |
-
$flow_id = wcf()->utils->get_flow_id();
|
50 |
-
?>
|
51 |
-
<?php if( $this->is_flow_testmode( $flow_id ) ) { ?>
|
52 |
-
<div class="wcf-preview-mode">
|
53 |
-
<span><?php _e( 'Test mode is active — which displays random products for previewing. It can be deactivated from the flow settings in the admin dashboard.', 'cartflows' ); ?></span>
|
54 |
-
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
55 |
-
<?php
|
56 |
-
$flow_edit_link = add_query_arg( 'edit_test_mode', 'yes', get_edit_post_link( $flow_id ) );
|
57 |
-
?>
|
58 |
-
<a href="<?php echo $flow_edit_link; ?>"><?php _e( 'Click here to disable it', 'cartflows'); ?></a>
|
59 |
-
<?php } ?>
|
60 |
-
</div>
|
61 |
-
<?php } ?>
|
62 |
-
<?php
|
63 |
-
// @codingStandardsIgnoreEnd
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Check if flow test mode is enable.
|
69 |
-
*
|
70 |
-
* @since 1.0.0
|
71 |
-
* @param int $flow_id flow ID.
|
72 |
-
*
|
73 |
-
* @return boolean
|
74 |
-
*/
|
75 |
-
public function is_flow_testmode( $flow_id = '' ) {
|
76 |
-
|
77 |
-
if ( ! $flow_id ) {
|
78 |
-
$flow_id = wcf()->utils->get_flow_id();
|
79 |
-
}
|
80 |
-
|
81 |
-
$test_mode = wcf()->options->get_flow_meta_value( $flow_id, 'wcf-testing' );
|
82 |
-
|
83 |
-
if ( 'no' === $test_mode ) {
|
84 |
-
return false;
|
85 |
-
}
|
86 |
-
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Get steps data.
|
92 |
-
*
|
93 |
-
* @since 1.0.0
|
94 |
-
* @param int $flow_id flow ID.
|
95 |
-
*
|
96 |
-
* @return array
|
97 |
-
*/
|
98 |
-
public function get_steps( $flow_id ) {
|
99 |
-
|
100 |
-
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
101 |
-
|
102 |
-
if ( ! is_array( $steps ) ) {
|
103 |
-
|
104 |
-
$steps = array();
|
105 |
-
}
|
106 |
-
|
107 |
-
return $steps;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Check thank you page exists.
|
112 |
-
*
|
113 |
-
* @since 1.0.0
|
114 |
-
* @param array $order order data.
|
115 |
-
*
|
116 |
-
* @return bool
|
117 |
-
*/
|
118 |
-
public function is_thankyou_page_exists( $order ) {
|
119 |
-
|
120 |
-
$thankyou_step_exist = false;
|
121 |
-
|
122 |
-
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
|
123 |
-
|
124 |
-
if ( $flow_id ) {
|
125 |
-
|
126 |
-
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
127 |
-
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
128 |
-
|
129 |
-
if ( is_array( $flow_steps ) ) {
|
130 |
-
|
131 |
-
$current_step_found = false;
|
132 |
-
|
133 |
-
foreach ( $flow_steps as $index => $data ) {
|
134 |
-
|
135 |
-
if ( $current_step_found ) {
|
136 |
-
|
137 |
-
if ( 'thankyou' === $data['type'] ) {
|
138 |
-
|
139 |
-
$thankyou_step_exist = true;
|
140 |
-
break;
|
141 |
-
}
|
142 |
-
} else {
|
143 |
-
|
144 |
-
if ( intval( $data['id'] ) === $step_id ) {
|
145 |
-
|
146 |
-
$current_step_found = true;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
return $thankyou_step_exist;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Check thank you page exists.
|
158 |
-
*
|
159 |
-
* @since 1.0.0
|
160 |
-
* @param array $order order data.
|
161 |
-
*
|
162 |
-
* @return bool
|
163 |
-
*/
|
164 |
-
public function get_thankyou_page_id( $order ) {
|
165 |
-
|
166 |
-
$thankyou_step_id = false;
|
167 |
-
|
168 |
-
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
|
169 |
-
|
170 |
-
if ( $flow_id ) {
|
171 |
-
|
172 |
-
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
173 |
-
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
174 |
-
|
175 |
-
if ( is_array( $flow_steps ) ) {
|
176 |
-
|
177 |
-
$current_step_found = false;
|
178 |
-
|
179 |
-
foreach ( $flow_steps as $index => $data ) {
|
180 |
-
|
181 |
-
if ( $current_step_found ) {
|
182 |
-
|
183 |
-
if ( 'thankyou' === $data['type'] ) {
|
184 |
-
|
185 |
-
$thankyou_step_id = intval( $data['id'] );
|
186 |
-
break;
|
187 |
-
}
|
188 |
-
} else {
|
189 |
-
|
190 |
-
if ( intval( $data['id'] ) === $step_id ) {
|
191 |
-
|
192 |
-
$current_step_found = true;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
return $thankyou_step_id;
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Kicking this off by calling 'get_instance()' method
|
205 |
-
*/
|
206 |
-
Cartflows_Flow_Frontend::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Frontend & Markup
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Flow Markup
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Flow_Frontend {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var object instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initiator
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( ! isset( self::$instance ) ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*/
|
36 |
+
public function __construct() {
|
37 |
+
|
38 |
+
/* Analytics */
|
39 |
+
add_action( 'cartflows_wp_footer', array( $this, 'footer_markup' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Footer markup
|
44 |
+
*/
|
45 |
+
public function footer_markup() {
|
46 |
+
|
47 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
48 |
+
// @codingStandardsIgnoreStart
|
49 |
+
$flow_id = wcf()->utils->get_flow_id();
|
50 |
+
?>
|
51 |
+
<?php if( $this->is_flow_testmode( $flow_id ) ) { ?>
|
52 |
+
<div class="wcf-preview-mode">
|
53 |
+
<span><?php _e( 'Test mode is active — which displays random products for previewing. It can be deactivated from the flow settings in the admin dashboard.', 'cartflows' ); ?></span>
|
54 |
+
<?php if ( current_user_can( 'manage_options' ) ) { ?>
|
55 |
+
<?php
|
56 |
+
$flow_edit_link = add_query_arg( 'edit_test_mode', 'yes', get_edit_post_link( $flow_id ) );
|
57 |
+
?>
|
58 |
+
<a href="<?php echo $flow_edit_link; ?>"><?php _e( 'Click here to disable it', 'cartflows'); ?></a>
|
59 |
+
<?php } ?>
|
60 |
+
</div>
|
61 |
+
<?php } ?>
|
62 |
+
<?php
|
63 |
+
// @codingStandardsIgnoreEnd
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Check if flow test mode is enable.
|
69 |
+
*
|
70 |
+
* @since 1.0.0
|
71 |
+
* @param int $flow_id flow ID.
|
72 |
+
*
|
73 |
+
* @return boolean
|
74 |
+
*/
|
75 |
+
public function is_flow_testmode( $flow_id = '' ) {
|
76 |
+
|
77 |
+
if ( ! $flow_id ) {
|
78 |
+
$flow_id = wcf()->utils->get_flow_id();
|
79 |
+
}
|
80 |
+
|
81 |
+
$test_mode = wcf()->options->get_flow_meta_value( $flow_id, 'wcf-testing' );
|
82 |
+
|
83 |
+
if ( 'no' === $test_mode ) {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
return true;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get steps data.
|
92 |
+
*
|
93 |
+
* @since 1.0.0
|
94 |
+
* @param int $flow_id flow ID.
|
95 |
+
*
|
96 |
+
* @return array
|
97 |
+
*/
|
98 |
+
public function get_steps( $flow_id ) {
|
99 |
+
|
100 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
101 |
+
|
102 |
+
if ( ! is_array( $steps ) ) {
|
103 |
+
|
104 |
+
$steps = array();
|
105 |
+
}
|
106 |
+
|
107 |
+
return $steps;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Check thank you page exists.
|
112 |
+
*
|
113 |
+
* @since 1.0.0
|
114 |
+
* @param array $order order data.
|
115 |
+
*
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
public function is_thankyou_page_exists( $order ) {
|
119 |
+
|
120 |
+
$thankyou_step_exist = false;
|
121 |
+
|
122 |
+
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
|
123 |
+
|
124 |
+
if ( $flow_id ) {
|
125 |
+
|
126 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
127 |
+
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
128 |
+
|
129 |
+
if ( is_array( $flow_steps ) ) {
|
130 |
+
|
131 |
+
$current_step_found = false;
|
132 |
+
|
133 |
+
foreach ( $flow_steps as $index => $data ) {
|
134 |
+
|
135 |
+
if ( $current_step_found ) {
|
136 |
+
|
137 |
+
if ( 'thankyou' === $data['type'] ) {
|
138 |
+
|
139 |
+
$thankyou_step_exist = true;
|
140 |
+
break;
|
141 |
+
}
|
142 |
+
} else {
|
143 |
+
|
144 |
+
if ( intval( $data['id'] ) === $step_id ) {
|
145 |
+
|
146 |
+
$current_step_found = true;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
return $thankyou_step_exist;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Check thank you page exists.
|
158 |
+
*
|
159 |
+
* @since 1.0.0
|
160 |
+
* @param array $order order data.
|
161 |
+
*
|
162 |
+
* @return bool
|
163 |
+
*/
|
164 |
+
public function get_thankyou_page_id( $order ) {
|
165 |
+
|
166 |
+
$thankyou_step_id = false;
|
167 |
+
|
168 |
+
$flow_id = wcf()->utils->get_flow_id_from_order( $order->get_id() );
|
169 |
+
|
170 |
+
if ( $flow_id ) {
|
171 |
+
|
172 |
+
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
173 |
+
$step_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
|
174 |
+
|
175 |
+
if ( is_array( $flow_steps ) ) {
|
176 |
+
|
177 |
+
$current_step_found = false;
|
178 |
+
|
179 |
+
foreach ( $flow_steps as $index => $data ) {
|
180 |
+
|
181 |
+
if ( $current_step_found ) {
|
182 |
+
|
183 |
+
if ( 'thankyou' === $data['type'] ) {
|
184 |
+
|
185 |
+
$thankyou_step_id = intval( $data['id'] );
|
186 |
+
break;
|
187 |
+
}
|
188 |
+
} else {
|
189 |
+
|
190 |
+
if ( intval( $data['id'] ) === $step_id ) {
|
191 |
+
|
192 |
+
$current_step_found = true;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
return $thankyou_step_id;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Kicking this off by calling 'get_instance()' method
|
205 |
+
*/
|
206 |
+
Cartflows_Flow_Frontend::get_instance();
|
classes/class-cartflows-frontend.php
CHANGED
@@ -253,15 +253,15 @@ class Cartflows_Frontend {
|
|
253 |
|
254 |
/* Set key to support pixel */
|
255 |
if ( isset( $_GET['wcf-key'] ) ) {
|
256 |
-
$_GET['key'] = wp_unslash( $_GET['wcf-key'] );
|
257 |
-
$_REQUEST['key'] = wp_unslash( $_GET['wcf-key'] );
|
258 |
}
|
259 |
|
260 |
if ( isset( $_GET['wcf-order'] ) ) {
|
261 |
-
$_GET['order'] = wp_unslash( $_GET['wcf-order'] );
|
262 |
-
$_REQUEST['order'] = wp_unslash( $_GET['wcf-order'] );
|
263 |
-
$_GET['order-received'] = wp_unslash( $_GET['wcf-order'] );
|
264 |
-
$_REQUEST['order-received'] = wp_unslash( $_GET['wcf-order'] );
|
265 |
}
|
266 |
}
|
267 |
}
|
253 |
|
254 |
/* Set key to support pixel */
|
255 |
if ( isset( $_GET['wcf-key'] ) ) {
|
256 |
+
$_GET['key'] = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) );
|
257 |
+
$_REQUEST['key'] = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) );
|
258 |
}
|
259 |
|
260 |
if ( isset( $_GET['wcf-order'] ) ) {
|
261 |
+
$_GET['order'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
|
262 |
+
$_REQUEST['order'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
|
263 |
+
$_GET['order-received'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
|
264 |
+
$_REQUEST['order-received'] = sanitize_text_field( wp_unslash( $_GET['wcf-order'] ) );
|
265 |
}
|
266 |
}
|
267 |
}
|
classes/class-cartflows-functions.php
CHANGED
@@ -1,447 +1,447 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CartFlows Functions.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit; // Exit if accessed directly.
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Fatal error mb_strpos fallback.
|
14 |
-
*
|
15 |
-
* @param string $string string where to find.
|
16 |
-
* @param string $search string to search.
|
17 |
-
* @since 1.0.0
|
18 |
-
*/
|
19 |
-
function wcf_mb_strpos( $string, $search ) {
|
20 |
-
|
21 |
-
if ( function_exists( 'mb_strpos' ) ) {
|
22 |
-
return mb_strpos( $string, $search, 0, 'utf-8' );
|
23 |
-
} else {
|
24 |
-
return strpos( $string, $search );
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Check if cartflows pro activated.
|
30 |
-
*
|
31 |
-
* @since 1.0.0
|
32 |
-
*/
|
33 |
-
function _is_cartflows_pro() {
|
34 |
-
|
35 |
-
if ( defined( 'CARTFLOWS_PRO_FILE' ) ) {
|
36 |
-
return true;
|
37 |
-
}
|
38 |
-
|
39 |
-
return false;
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns pro version number.
|
45 |
-
*
|
46 |
-
* @param int $version version number.
|
47 |
-
* @since 1.0.0
|
48 |
-
*/
|
49 |
-
function _is_cartflows_pro_ver_less_than( $version ) {
|
50 |
-
|
51 |
-
if ( defined( 'CARTFLOWS_PRO_VER' ) && version_compare( CARTFLOWS_PRO_VER, $version, '<' ) ) {
|
52 |
-
return true;
|
53 |
-
}
|
54 |
-
|
55 |
-
return false;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Returns step id.
|
60 |
-
*
|
61 |
-
* @since 1.0.0
|
62 |
-
*/
|
63 |
-
function _get_wcf_post_id() {
|
64 |
-
|
65 |
-
global $post;
|
66 |
-
|
67 |
-
if ( isset( $post->ID ) ) {
|
68 |
-
return $post->ID;
|
69 |
-
}
|
70 |
-
|
71 |
-
return 0;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Returns step id.
|
76 |
-
*
|
77 |
-
* @since 1.0.0
|
78 |
-
*/
|
79 |
-
function _get_wcf_step_id() {
|
80 |
-
|
81 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
82 |
-
|
83 |
-
global $post;
|
84 |
-
|
85 |
-
return $post->ID;
|
86 |
-
}
|
87 |
-
|
88 |
-
return false;
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Check if it is a landing page?
|
93 |
-
*
|
94 |
-
* @since 1.0.0
|
95 |
-
*/
|
96 |
-
function _is_wcf_landing_type() {
|
97 |
-
|
98 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
99 |
-
|
100 |
-
global $post;
|
101 |
-
|
102 |
-
if ( 'landing' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
103 |
-
|
104 |
-
return true;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
return false;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Returns landing id.
|
113 |
-
*
|
114 |
-
* @since 1.0.0
|
115 |
-
*/
|
116 |
-
function _get_wcf_landing_id() {
|
117 |
-
|
118 |
-
if ( _is_wcf_landing_type() ) {
|
119 |
-
|
120 |
-
global $post;
|
121 |
-
|
122 |
-
return $post->ID;
|
123 |
-
}
|
124 |
-
|
125 |
-
return false;
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Is custom checkout?
|
130 |
-
*
|
131 |
-
* @param int $checkout_id checkout ID.
|
132 |
-
* @since 1.0.0
|
133 |
-
*/
|
134 |
-
function _is_wcf_meta_custom_checkout( $checkout_id ) {
|
135 |
-
|
136 |
-
$is_custom = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-custom-checkout-fields' );
|
137 |
-
|
138 |
-
if ( 'yes' === $is_custom ) {
|
139 |
-
|
140 |
-
return true;
|
141 |
-
}
|
142 |
-
|
143 |
-
return false;
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Check if page is cartflow checkout.
|
148 |
-
*
|
149 |
-
* @since 1.0.0
|
150 |
-
* @return bool
|
151 |
-
*/
|
152 |
-
function _is_wcf_checkout_type() {
|
153 |
-
|
154 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
155 |
-
|
156 |
-
global $post;
|
157 |
-
|
158 |
-
if ( 'checkout' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
159 |
-
|
160 |
-
return true;
|
161 |
-
}
|
162 |
-
}
|
163 |
-
|
164 |
-
return false;
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Check if AJAX call is in progress.
|
169 |
-
*
|
170 |
-
* @since 1.0.0
|
171 |
-
* @return bool
|
172 |
-
*/
|
173 |
-
function _is_wcf_doing_checkout_ajax() {
|
174 |
-
|
175 |
-
if ( wp_doing_ajax() ) {
|
176 |
-
|
177 |
-
if ( isset( $_GET['wc-ajax'] ) &&
|
178 |
-
'checkout' === $_GET['wc-ajax'] &&
|
179 |
-
isset( $_POST['_wcf_checkout_id'] )
|
180 |
-
) {
|
181 |
-
return true;
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
return false;
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Returns checkout ID.
|
191 |
-
*
|
192 |
-
* @since 1.0.0
|
193 |
-
* @return int/bool
|
194 |
-
*/
|
195 |
-
function _get_wcf_checkout_id() {
|
196 |
-
|
197 |
-
if ( _is_wcf_checkout_type() ) {
|
198 |
-
|
199 |
-
global $post;
|
200 |
-
|
201 |
-
return $post->ID;
|
202 |
-
}
|
203 |
-
|
204 |
-
return false;
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Check if it is checkout shortcode.
|
209 |
-
*
|
210 |
-
* @since 1.0.0
|
211 |
-
* @return bool
|
212 |
-
*/
|
213 |
-
function _is_wcf_checkout_shortcode() {
|
214 |
-
|
215 |
-
global $post;
|
216 |
-
|
217 |
-
if ( ! empty( $post ) && has_shortcode( $post->post_content, 'cartflows_checkout' ) ) {
|
218 |
-
|
219 |
-
return true;
|
220 |
-
}
|
221 |
-
|
222 |
-
return false;
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Check if it is checkout shortcode.
|
227 |
-
*
|
228 |
-
* @since 1.0.0
|
229 |
-
* @param string $content shortcode content.
|
230 |
-
* @return bool
|
231 |
-
*/
|
232 |
-
function _get_wcf_checkout_id_from_shortcode( $content = '' ) {
|
233 |
-
|
234 |
-
$checkout_id = 0;
|
235 |
-
|
236 |
-
if ( ! empty( $content ) ) {
|
237 |
-
|
238 |
-
$regex_pattern = get_shortcode_regex( array( 'cartflows_checkout' ) );
|
239 |
-
|
240 |
-
preg_match( '/' . $regex_pattern . '/s', $content, $regex_matches );
|
241 |
-
|
242 |
-
if ( ! empty( $regex_matches ) ) {
|
243 |
-
|
244 |
-
if ( 'cartflows_checkout' == $regex_matches[2] ) {
|
245 |
-
|
246 |
-
$attribure_str = str_replace( ' ', '&', trim( $regex_matches[3] ) );
|
247 |
-
$attribure_str = str_replace( '"', '', $attribure_str );
|
248 |
-
|
249 |
-
$attributes = wp_parse_args( $attribure_str );
|
250 |
-
|
251 |
-
if ( isset( $attributes['id'] ) ) {
|
252 |
-
$checkout_id = $attributes['id'];
|
253 |
-
}
|
254 |
-
}
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
return $checkout_id;
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Check if post type is upsell.
|
263 |
-
*
|
264 |
-
* @since 1.0.0
|
265 |
-
* @return bool
|
266 |
-
*/
|
267 |
-
function _is_wcf_upsell_type() {
|
268 |
-
|
269 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
270 |
-
|
271 |
-
global $post;
|
272 |
-
|
273 |
-
if ( 'upsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
274 |
-
|
275 |
-
return true;
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
return false;
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Returns upsell ID.
|
284 |
-
*
|
285 |
-
* @since 1.0.0
|
286 |
-
* @return int/bool
|
287 |
-
*/
|
288 |
-
function _get_wcf_upsell_id() {
|
289 |
-
|
290 |
-
if ( _is_wcf_upsell_type() ) {
|
291 |
-
|
292 |
-
global $post;
|
293 |
-
|
294 |
-
return $post->ID;
|
295 |
-
}
|
296 |
-
|
297 |
-
return false;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Check if post is of type downsell.
|
302 |
-
*
|
303 |
-
* @since 1.0.0
|
304 |
-
* @return int/bool
|
305 |
-
*/
|
306 |
-
function _is_wcf_downsell_type() {
|
307 |
-
|
308 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
309 |
-
|
310 |
-
global $post;
|
311 |
-
|
312 |
-
if ( 'downsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
313 |
-
|
314 |
-
return true;
|
315 |
-
}
|
316 |
-
}
|
317 |
-
|
318 |
-
return false;
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Get downsell page ID.
|
323 |
-
*
|
324 |
-
* @since 1.0.0
|
325 |
-
* @return int/bool
|
326 |
-
*/
|
327 |
-
function _get_wcf_downsell_id() {
|
328 |
-
|
329 |
-
if ( _is_wcf_downsell_type() ) {
|
330 |
-
|
331 |
-
global $post;
|
332 |
-
|
333 |
-
return $post->ID;
|
334 |
-
}
|
335 |
-
|
336 |
-
return false;
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Check if page is of thank you type.
|
341 |
-
*
|
342 |
-
* @since 1.0.0
|
343 |
-
* @return int/bool
|
344 |
-
*/
|
345 |
-
function _is_wcf_thankyou_type() {
|
346 |
-
|
347 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
348 |
-
|
349 |
-
global $post;
|
350 |
-
|
351 |
-
if ( 'thankyou' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
352 |
-
|
353 |
-
return true;
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
return false;
|
358 |
-
}
|
359 |
-
|
360 |
-
/**
|
361 |
-
* Get thank you page ID.
|
362 |
-
*
|
363 |
-
* @since 1.0.0
|
364 |
-
* @return int/bool
|
365 |
-
*/
|
366 |
-
function _get_wcf_thankyou_id() {
|
367 |
-
|
368 |
-
if ( _is_wcf_thankyou_type() ) {
|
369 |
-
|
370 |
-
global $post;
|
371 |
-
|
372 |
-
return $post->ID;
|
373 |
-
}
|
374 |
-
|
375 |
-
return false;
|
376 |
-
}
|
377 |
-
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Check if post type is upsell.
|
381 |
-
*
|
382 |
-
* @since 1.0.0
|
383 |
-
* @return bool
|
384 |
-
*/
|
385 |
-
function _is_wcf_base_offer_type() {
|
386 |
-
|
387 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
388 |
-
|
389 |
-
global $post;
|
390 |
-
|
391 |
-
$step_type = get_post_meta( $post->ID, 'wcf-step-type', true );
|
392 |
-
|
393 |
-
if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
|
394 |
-
|
395 |
-
return true;
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
return false;
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Returns upsell ID.
|
404 |
-
*
|
405 |
-
* @since 1.0.0
|
406 |
-
* @return int/bool
|
407 |
-
*/
|
408 |
-
function _get_wcf_base_offer_id() {
|
409 |
-
|
410 |
-
if ( _is_wcf_base_offer_type() ) {
|
411 |
-
|
412 |
-
global $post;
|
413 |
-
|
414 |
-
return $post->ID;
|
415 |
-
}
|
416 |
-
|
417 |
-
return false;
|
418 |
-
}
|
419 |
-
|
420 |
-
|
421 |
-
/**
|
422 |
-
* Define a constant if it is not already defined.
|
423 |
-
*
|
424 |
-
* @since 3.0.0
|
425 |
-
* @param string $name Constant name.
|
426 |
-
* @param mixed $value Value.
|
427 |
-
*/
|
428 |
-
function wcf_maybe_define_constant( $name, $value ) {
|
429 |
-
if ( ! defined( $name ) ) {
|
430 |
-
define( $name, $value );
|
431 |
-
}
|
432 |
-
}
|
433 |
-
|
434 |
-
|
435 |
-
if ( ! function_exists( 'wp_body_open' ) ) {
|
436 |
-
/**
|
437 |
-
* Fire the wp_body_open action.
|
438 |
-
*
|
439 |
-
* Added for backwards compatibility to support WordPress versions prior to 5.2.0.
|
440 |
-
*/
|
441 |
-
function wp_body_open() {
|
442 |
-
/**
|
443 |
-
* Triggered after the opening <body> tag.
|
444 |
-
*/
|
445 |
-
do_action( 'wp_body_open' );
|
446 |
-
}
|
447 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CartFlows Functions.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly.
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Fatal error mb_strpos fallback.
|
14 |
+
*
|
15 |
+
* @param string $string string where to find.
|
16 |
+
* @param string $search string to search.
|
17 |
+
* @since 1.0.0
|
18 |
+
*/
|
19 |
+
function wcf_mb_strpos( $string, $search ) {
|
20 |
+
|
21 |
+
if ( function_exists( 'mb_strpos' ) ) {
|
22 |
+
return mb_strpos( $string, $search, 0, 'utf-8' );
|
23 |
+
} else {
|
24 |
+
return strpos( $string, $search );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Check if cartflows pro activated.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
function _is_cartflows_pro() {
|
34 |
+
|
35 |
+
if ( defined( 'CARTFLOWS_PRO_FILE' ) ) {
|
36 |
+
return true;
|
37 |
+
}
|
38 |
+
|
39 |
+
return false;
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns pro version number.
|
45 |
+
*
|
46 |
+
* @param int $version version number.
|
47 |
+
* @since 1.0.0
|
48 |
+
*/
|
49 |
+
function _is_cartflows_pro_ver_less_than( $version ) {
|
50 |
+
|
51 |
+
if ( defined( 'CARTFLOWS_PRO_VER' ) && version_compare( CARTFLOWS_PRO_VER, $version, '<' ) ) {
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Returns step id.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
*/
|
63 |
+
function _get_wcf_post_id() {
|
64 |
+
|
65 |
+
global $post;
|
66 |
+
|
67 |
+
if ( isset( $post->ID ) ) {
|
68 |
+
return $post->ID;
|
69 |
+
}
|
70 |
+
|
71 |
+
return 0;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Returns step id.
|
76 |
+
*
|
77 |
+
* @since 1.0.0
|
78 |
+
*/
|
79 |
+
function _get_wcf_step_id() {
|
80 |
+
|
81 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
82 |
+
|
83 |
+
global $post;
|
84 |
+
|
85 |
+
return $post->ID;
|
86 |
+
}
|
87 |
+
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Check if it is a landing page?
|
93 |
+
*
|
94 |
+
* @since 1.0.0
|
95 |
+
*/
|
96 |
+
function _is_wcf_landing_type() {
|
97 |
+
|
98 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
99 |
+
|
100 |
+
global $post;
|
101 |
+
|
102 |
+
if ( 'landing' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
103 |
+
|
104 |
+
return true;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Returns landing id.
|
113 |
+
*
|
114 |
+
* @since 1.0.0
|
115 |
+
*/
|
116 |
+
function _get_wcf_landing_id() {
|
117 |
+
|
118 |
+
if ( _is_wcf_landing_type() ) {
|
119 |
+
|
120 |
+
global $post;
|
121 |
+
|
122 |
+
return $post->ID;
|
123 |
+
}
|
124 |
+
|
125 |
+
return false;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Is custom checkout?
|
130 |
+
*
|
131 |
+
* @param int $checkout_id checkout ID.
|
132 |
+
* @since 1.0.0
|
133 |
+
*/
|
134 |
+
function _is_wcf_meta_custom_checkout( $checkout_id ) {
|
135 |
+
|
136 |
+
$is_custom = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-custom-checkout-fields' );
|
137 |
+
|
138 |
+
if ( 'yes' === $is_custom ) {
|
139 |
+
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Check if page is cartflow checkout.
|
148 |
+
*
|
149 |
+
* @since 1.0.0
|
150 |
+
* @return bool
|
151 |
+
*/
|
152 |
+
function _is_wcf_checkout_type() {
|
153 |
+
|
154 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
155 |
+
|
156 |
+
global $post;
|
157 |
+
|
158 |
+
if ( 'checkout' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
159 |
+
|
160 |
+
return true;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Check if AJAX call is in progress.
|
169 |
+
*
|
170 |
+
* @since 1.0.0
|
171 |
+
* @return bool
|
172 |
+
*/
|
173 |
+
function _is_wcf_doing_checkout_ajax() {
|
174 |
+
|
175 |
+
if ( wp_doing_ajax() ) {
|
176 |
+
|
177 |
+
if ( isset( $_GET['wc-ajax'] ) &&
|
178 |
+
'checkout' === $_GET['wc-ajax'] &&
|
179 |
+
isset( $_POST['_wcf_checkout_id'] )
|
180 |
+
) {
|
181 |
+
return true;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Returns checkout ID.
|
191 |
+
*
|
192 |
+
* @since 1.0.0
|
193 |
+
* @return int/bool
|
194 |
+
*/
|
195 |
+
function _get_wcf_checkout_id() {
|
196 |
+
|
197 |
+
if ( _is_wcf_checkout_type() ) {
|
198 |
+
|
199 |
+
global $post;
|
200 |
+
|
201 |
+
return $post->ID;
|
202 |
+
}
|
203 |
+
|
204 |
+
return false;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Check if it is checkout shortcode.
|
209 |
+
*
|
210 |
+
* @since 1.0.0
|
211 |
+
* @return bool
|
212 |
+
*/
|
213 |
+
function _is_wcf_checkout_shortcode() {
|
214 |
+
|
215 |
+
global $post;
|
216 |
+
|
217 |
+
if ( ! empty( $post ) && has_shortcode( $post->post_content, 'cartflows_checkout' ) ) {
|
218 |
+
|
219 |
+
return true;
|
220 |
+
}
|
221 |
+
|
222 |
+
return false;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Check if it is checkout shortcode.
|
227 |
+
*
|
228 |
+
* @since 1.0.0
|
229 |
+
* @param string $content shortcode content.
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
function _get_wcf_checkout_id_from_shortcode( $content = '' ) {
|
233 |
+
|
234 |
+
$checkout_id = 0;
|
235 |
+
|
236 |
+
if ( ! empty( $content ) ) {
|
237 |
+
|
238 |
+
$regex_pattern = get_shortcode_regex( array( 'cartflows_checkout' ) );
|
239 |
+
|
240 |
+
preg_match( '/' . $regex_pattern . '/s', $content, $regex_matches );
|
241 |
+
|
242 |
+
if ( ! empty( $regex_matches ) ) {
|
243 |
+
|
244 |
+
if ( 'cartflows_checkout' == $regex_matches[2] ) {
|
245 |
+
|
246 |
+
$attribure_str = str_replace( ' ', '&', trim( $regex_matches[3] ) );
|
247 |
+
$attribure_str = str_replace( '"', '', $attribure_str );
|
248 |
+
|
249 |
+
$attributes = wp_parse_args( $attribure_str );
|
250 |
+
|
251 |
+
if ( isset( $attributes['id'] ) ) {
|
252 |
+
$checkout_id = $attributes['id'];
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
return $checkout_id;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Check if post type is upsell.
|
263 |
+
*
|
264 |
+
* @since 1.0.0
|
265 |
+
* @return bool
|
266 |
+
*/
|
267 |
+
function _is_wcf_upsell_type() {
|
268 |
+
|
269 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
270 |
+
|
271 |
+
global $post;
|
272 |
+
|
273 |
+
if ( 'upsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
274 |
+
|
275 |
+
return true;
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
return false;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Returns upsell ID.
|
284 |
+
*
|
285 |
+
* @since 1.0.0
|
286 |
+
* @return int/bool
|
287 |
+
*/
|
288 |
+
function _get_wcf_upsell_id() {
|
289 |
+
|
290 |
+
if ( _is_wcf_upsell_type() ) {
|
291 |
+
|
292 |
+
global $post;
|
293 |
+
|
294 |
+
return $post->ID;
|
295 |
+
}
|
296 |
+
|
297 |
+
return false;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Check if post is of type downsell.
|
302 |
+
*
|
303 |
+
* @since 1.0.0
|
304 |
+
* @return int/bool
|
305 |
+
*/
|
306 |
+
function _is_wcf_downsell_type() {
|
307 |
+
|
308 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
309 |
+
|
310 |
+
global $post;
|
311 |
+
|
312 |
+
if ( 'downsell' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
313 |
+
|
314 |
+
return true;
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Get downsell page ID.
|
323 |
+
*
|
324 |
+
* @since 1.0.0
|
325 |
+
* @return int/bool
|
326 |
+
*/
|
327 |
+
function _get_wcf_downsell_id() {
|
328 |
+
|
329 |
+
if ( _is_wcf_downsell_type() ) {
|
330 |
+
|
331 |
+
global $post;
|
332 |
+
|
333 |
+
return $post->ID;
|
334 |
+
}
|
335 |
+
|
336 |
+
return false;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Check if page is of thank you type.
|
341 |
+
*
|
342 |
+
* @since 1.0.0
|
343 |
+
* @return int/bool
|
344 |
+
*/
|
345 |
+
function _is_wcf_thankyou_type() {
|
346 |
+
|
347 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
348 |
+
|
349 |
+
global $post;
|
350 |
+
|
351 |
+
if ( 'thankyou' === get_post_meta( $post->ID, 'wcf-step-type', true ) ) {
|
352 |
+
|
353 |
+
return true;
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
return false;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Get thank you page ID.
|
362 |
+
*
|
363 |
+
* @since 1.0.0
|
364 |
+
* @return int/bool
|
365 |
+
*/
|
366 |
+
function _get_wcf_thankyou_id() {
|
367 |
+
|
368 |
+
if ( _is_wcf_thankyou_type() ) {
|
369 |
+
|
370 |
+
global $post;
|
371 |
+
|
372 |
+
return $post->ID;
|
373 |
+
}
|
374 |
+
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Check if post type is upsell.
|
381 |
+
*
|
382 |
+
* @since 1.0.0
|
383 |
+
* @return bool
|
384 |
+
*/
|
385 |
+
function _is_wcf_base_offer_type() {
|
386 |
+
|
387 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
388 |
+
|
389 |
+
global $post;
|
390 |
+
|
391 |
+
$step_type = get_post_meta( $post->ID, 'wcf-step-type', true );
|
392 |
+
|
393 |
+
if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
|
394 |
+
|
395 |
+
return true;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
return false;
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* Returns upsell ID.
|
404 |
+
*
|
405 |
+
* @since 1.0.0
|
406 |
+
* @return int/bool
|
407 |
+
*/
|
408 |
+
function _get_wcf_base_offer_id() {
|
409 |
+
|
410 |
+
if ( _is_wcf_base_offer_type() ) {
|
411 |
+
|
412 |
+
global $post;
|
413 |
+
|
414 |
+
return $post->ID;
|
415 |
+
}
|
416 |
+
|
417 |
+
return false;
|
418 |
+
}
|
419 |
+
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Define a constant if it is not already defined.
|
423 |
+
*
|
424 |
+
* @since 3.0.0
|
425 |
+
* @param string $name Constant name.
|
426 |
+
* @param mixed $value Value.
|
427 |
+
*/
|
428 |
+
function wcf_maybe_define_constant( $name, $value ) {
|
429 |
+
if ( ! defined( $name ) ) {
|
430 |
+
define( $name, $value );
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
|
435 |
+
if ( ! function_exists( 'wp_body_open' ) ) {
|
436 |
+
/**
|
437 |
+
* Fire the wp_body_open action.
|
438 |
+
*
|
439 |
+
* Added for backwards compatibility to support WordPress versions prior to 5.2.0.
|
440 |
+
*/
|
441 |
+
function wp_body_open() {
|
442 |
+
/**
|
443 |
+
* Triggered after the opening <body> tag.
|
444 |
+
*/
|
445 |
+
do_action( 'wp_body_open' );
|
446 |
+
}
|
447 |
+
}
|
classes/class-cartflows-helper.php
CHANGED
@@ -1,694 +1,694 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CARTFLOWS Helper.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit; // Exit if accessed directly.
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class Cartflows_Helper.
|
14 |
-
*/
|
15 |
-
class Cartflows_Helper {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Common global data
|
19 |
-
*
|
20 |
-
* @var zapier
|
21 |
-
*/
|
22 |
-
private static $common = null;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Common Debug data
|
26 |
-
*
|
27 |
-
* @var zapier
|
28 |
-
*/
|
29 |
-
private static $debug_data = null;
|
30 |
-
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Permalink settings
|
34 |
-
*
|
35 |
-
* @var permalink_setting
|
36 |
-
*/
|
37 |
-
private static $permalink_setting = null;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Installed Plugins
|
41 |
-
*
|
42 |
-
* @since 1.1.4
|
43 |
-
*
|
44 |
-
* @access private
|
45 |
-
* @var array Installed plugins list.
|
46 |
-
*/
|
47 |
-
private static $installed_plugins = null;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Checkout Fields
|
51 |
-
*
|
52 |
-
* @var checkout_fields
|
53 |
-
*/
|
54 |
-
private static $checkout_fields = null;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Facebook pixel global data
|
58 |
-
*
|
59 |
-
* @var faceboook
|
60 |
-
*/
|
61 |
-
private static $facebook = null;
|
62 |
-
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Returns an option from the database for
|
66 |
-
* the admin settings page.
|
67 |
-
*
|
68 |
-
* @param string $key The option key.
|
69 |
-
* @param mixed $default Option default value if option is not available.
|
70 |
-
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
71 |
-
* @return string Return the option value
|
72 |
-
*/
|
73 |
-
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
74 |
-
|
75 |
-
// Get the site-wide option if we're in the network admin.
|
76 |
-
if ( $network_override && is_multisite() ) {
|
77 |
-
$value = get_site_option( $key, $default );
|
78 |
-
} else {
|
79 |
-
$value = get_option( $key, $default );
|
80 |
-
}
|
81 |
-
|
82 |
-
return $value;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Updates an option from the admin settings page.
|
87 |
-
*
|
88 |
-
* @param string $key The option key.
|
89 |
-
* @param mixed $value The value to update.
|
90 |
-
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
91 |
-
* @return mixed
|
92 |
-
*/
|
93 |
-
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
94 |
-
|
95 |
-
// Update the site-wide option since we're in the network admin.
|
96 |
-
if ( $network && is_multisite() ) {
|
97 |
-
update_site_option( $key, $value );
|
98 |
-
} else {
|
99 |
-
update_option( $key, $value );
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Get single setting
|
106 |
-
*
|
107 |
-
* @since 1.1.4
|
108 |
-
*
|
109 |
-
* @param string $key Option key.
|
110 |
-
* @param string $default Option default value if not exist.
|
111 |
-
* @return mixed
|
112 |
-
*/
|
113 |
-
public static function get_common_setting( $key = '', $default = '' ) {
|
114 |
-
$settings = self::get_common_settings();
|
115 |
-
|
116 |
-
if ( $settings && array_key_exists( $key, $settings ) ) {
|
117 |
-
return $settings[ $key ];
|
118 |
-
}
|
119 |
-
|
120 |
-
return $default;
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Get single debug options
|
125 |
-
*
|
126 |
-
* @since 1.1.4
|
127 |
-
*
|
128 |
-
* @param string $key Option key.
|
129 |
-
* @param string $default Option default value if not exist.
|
130 |
-
* @return mixed
|
131 |
-
*/
|
132 |
-
public static function get_debug_setting( $key = '', $default = '' ) {
|
133 |
-
$debug_data = self::get_debug_settings();
|
134 |
-
|
135 |
-
if ( $debug_data && array_key_exists( $key, $debug_data ) ) {
|
136 |
-
return $debug_data[ $key ];
|
137 |
-
}
|
138 |
-
|
139 |
-
return $default;
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Get required plugins for page builder
|
144 |
-
*
|
145 |
-
* @since 1.1.4
|
146 |
-
*
|
147 |
-
* @param string $page_builder_slug Page builder slug.
|
148 |
-
* @param string $default Default page builder.
|
149 |
-
* @return array selected page builder required plugins list.
|
150 |
-
*/
|
151 |
-
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
152 |
-
$plugins = self::get_plugins_groupby_page_builders();
|
153 |
-
|
154 |
-
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
155 |
-
return $plugins[ $page_builder_slug ];
|
156 |
-
}
|
157 |
-
|
158 |
-
return $plugins[ $default ];
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Get Plugins list by page builder.
|
163 |
-
*
|
164 |
-
* @since 1.1.4
|
165 |
-
*
|
166 |
-
* @return array Required Plugins list.
|
167 |
-
*/
|
168 |
-
public static function get_plugins_groupby_page_builders() {
|
169 |
-
|
170 |
-
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
171 |
-
$theme_status = 'not-installed';
|
172 |
-
if ( $divi_status ) {
|
173 |
-
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
174 |
-
$theme_status = 'installed';
|
175 |
-
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
176 |
-
$theme_status = 'deactivate';
|
177 |
-
$divi_status = 'activate';
|
178 |
-
} else {
|
179 |
-
$divi_status = '';
|
180 |
-
}
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
$plugins = array(
|
185 |
-
'elementor' => array(
|
186 |
-
'title' => 'Elementor',
|
187 |
-
'plugins' => array(
|
188 |
-
array(
|
189 |
-
'slug' => 'elementor', // For download from wp.org.
|
190 |
-
'init' => 'elementor/elementor.php',
|
191 |
-
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
192 |
-
),
|
193 |
-
),
|
194 |
-
),
|
195 |
-
'divi' => array(
|
196 |
-
'title' => 'Divi',
|
197 |
-
'theme-status' => $theme_status,
|
198 |
-
'plugin-status' => $divi_status,
|
199 |
-
'plugins' => array(
|
200 |
-
array(
|
201 |
-
'slug' => 'divi-builder', // For download from wp.org.
|
202 |
-
'init' => 'divi-builder/divi-builder.php',
|
203 |
-
'status' => $divi_status,
|
204 |
-
),
|
205 |
-
),
|
206 |
-
),
|
207 |
-
);
|
208 |
-
|
209 |
-
$plugins['beaver-builder'] = array(
|
210 |
-
'title' => 'Beaver Builder',
|
211 |
-
'plugins' => array(),
|
212 |
-
);
|
213 |
-
|
214 |
-
// Check Pro Exist.
|
215 |
-
if ( file_exists( WP_PLUGIN_DIR . '/bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
216 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
217 |
-
'slug' => 'bb-plugin',
|
218 |
-
'init' => 'bb-plugin/fl-builder.php',
|
219 |
-
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
220 |
-
);
|
221 |
-
} else {
|
222 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
223 |
-
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
224 |
-
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
225 |
-
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
226 |
-
);
|
227 |
-
}
|
228 |
-
|
229 |
-
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' ) ) {
|
230 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
231 |
-
'slug' => 'bb-ultimate-addon',
|
232 |
-
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
233 |
-
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
234 |
-
);
|
235 |
-
} else {
|
236 |
-
$plugins['beaver-builder']['plugins'][] = array(
|
237 |
-
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
238 |
-
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
239 |
-
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
240 |
-
);
|
241 |
-
}
|
242 |
-
|
243 |
-
return $plugins;
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Get plugin status
|
248 |
-
*
|
249 |
-
* @since 1.1.4
|
250 |
-
*
|
251 |
-
* @param string $plugin_init_file Plguin init file.
|
252 |
-
* @return mixed
|
253 |
-
*/
|
254 |
-
public static function get_plugin_status( $plugin_init_file ) {
|
255 |
-
|
256 |
-
if ( null == self::$installed_plugins ) {
|
257 |
-
self::$installed_plugins = get_plugins();
|
258 |
-
}
|
259 |
-
|
260 |
-
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
261 |
-
return 'install';
|
262 |
-
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
263 |
-
return 'activate';
|
264 |
-
} else {
|
265 |
-
return;
|
266 |
-
}
|
267 |
-
}
|
268 |
-
|
269 |
-
/**
|
270 |
-
* Get zapier settings.
|
271 |
-
*
|
272 |
-
* @return array.
|
273 |
-
*/
|
274 |
-
public static function get_common_settings() {
|
275 |
-
|
276 |
-
if ( null === self::$common ) {
|
277 |
-
|
278 |
-
$common_default = apply_filters(
|
279 |
-
'cartflows_common_settings_default',
|
280 |
-
array(
|
281 |
-
'disallow_indexing' => 'disable',
|
282 |
-
'global_checkout' => '',
|
283 |
-
'default_page_builder' => 'elementor',
|
284 |
-
)
|
285 |
-
);
|
286 |
-
|
287 |
-
$common = self::get_admin_settings_option( '_cartflows_common', false, false );
|
288 |
-
|
289 |
-
$common = wp_parse_args( $common, $common_default );
|
290 |
-
|
291 |
-
if ( ! did_action( 'wp' ) ) {
|
292 |
-
return $common;
|
293 |
-
} else {
|
294 |
-
self::$common = $common;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
|
298 |
-
return self::$common;
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Get debug settings data.
|
303 |
-
*
|
304 |
-
* @return array.
|
305 |
-
*/
|
306 |
-
public static function get_debug_settings() {
|
307 |
-
|
308 |
-
if ( null === self::$debug_data ) {
|
309 |
-
|
310 |
-
$debug_data_default = apply_filters(
|
311 |
-
'cartflows_debug_settings_default',
|
312 |
-
array(
|
313 |
-
'allow_minified_files' => 'disable',
|
314 |
-
)
|
315 |
-
);
|
316 |
-
|
317 |
-
$debug_data = self::get_admin_settings_option( '_cartflows_debug_data', false, false );
|
318 |
-
|
319 |
-
$debug_data = wp_parse_args( $debug_data, $debug_data_default );
|
320 |
-
|
321 |
-
if ( ! did_action( 'wp' ) ) {
|
322 |
-
return $debug_data;
|
323 |
-
} else {
|
324 |
-
self::$debug_data = $debug_data;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
return self::$debug_data;
|
329 |
-
}
|
330 |
-
|
331 |
-
|
332 |
-
/**
|
333 |
-
* Get debug settings data.
|
334 |
-
*
|
335 |
-
* @return array.
|
336 |
-
*/
|
337 |
-
public static function get_permalink_settings() {
|
338 |
-
|
339 |
-
if ( null === self::$permalink_setting ) {
|
340 |
-
|
341 |
-
$permalink_default = apply_filters(
|
342 |
-
'cartflows_permalink_settings_default',
|
343 |
-
array(
|
344 |
-
'permalink' => CARTFLOWS_STEP_POST_TYPE,
|
345 |
-
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
|
346 |
-
'permalink_structure' => '',
|
347 |
-
|
348 |
-
)
|
349 |
-
);
|
350 |
-
|
351 |
-
$permalink_data = self::get_admin_settings_option( '_cartflows_permalink', false, false );
|
352 |
-
|
353 |
-
$permalink_data = wp_parse_args( $permalink_data, $permalink_default );
|
354 |
-
|
355 |
-
if ( ! did_action( 'wp' ) ) {
|
356 |
-
return $permalink_data;
|
357 |
-
} else {
|
358 |
-
self::$permalink_setting = $permalink_data;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
return self::$permalink_setting;
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Get Checkout field.
|
367 |
-
*
|
368 |
-
* @param string $key Field key.
|
369 |
-
* @param int $post_id Post id.
|
370 |
-
* @return array.
|
371 |
-
*/
|
372 |
-
public static function get_checkout_fields( $key, $post_id ) {
|
373 |
-
|
374 |
-
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
375 |
-
|
376 |
-
if ( ! $saved_fields ) {
|
377 |
-
$saved_fields = array();
|
378 |
-
}
|
379 |
-
|
380 |
-
$fields = array_filter( $saved_fields );
|
381 |
-
|
382 |
-
if ( empty( $fields ) ) {
|
383 |
-
if ( 'billing' === $key || 'shipping' === $key ) {
|
384 |
-
|
385 |
-
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
386 |
-
|
387 |
-
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
388 |
-
}
|
389 |
-
}
|
390 |
-
|
391 |
-
return $fields;
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Add Checkout field.
|
396 |
-
*
|
397 |
-
* @param string $type Field type.
|
398 |
-
* @param string $field_key Field key.
|
399 |
-
* @param array $field_data Field data.
|
400 |
-
* @param int $post_id Post id.
|
401 |
-
* @return boolean.
|
402 |
-
*/
|
403 |
-
public static function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
404 |
-
|
405 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
406 |
-
|
407 |
-
$fields[ $field_key ] = $field_data;
|
408 |
-
|
409 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
410 |
-
|
411 |
-
return true;
|
412 |
-
}
|
413 |
-
|
414 |
-
/**
|
415 |
-
* Get checkout fields settings.
|
416 |
-
*
|
417 |
-
* @param string $type Field type.
|
418 |
-
* @param string $field_key Field key.
|
419 |
-
* @param int $post_id Post id.
|
420 |
-
* @return array.
|
421 |
-
*/
|
422 |
-
public static function delete_checkout_field( $type, $field_key, $post_id ) {
|
423 |
-
|
424 |
-
$fields = self::get_checkout_fields( $type, $post_id );
|
425 |
-
|
426 |
-
if ( isset( $fields[ $field_key ] ) ) {
|
427 |
-
unset( $fields[ $field_key ] );
|
428 |
-
}
|
429 |
-
|
430 |
-
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
431 |
-
|
432 |
-
return true;
|
433 |
-
}
|
434 |
-
|
435 |
-
/**
|
436 |
-
* Get checkout fields settings.
|
437 |
-
*
|
438 |
-
* @return array.
|
439 |
-
*/
|
440 |
-
public static function get_checkout_fields_settings() {
|
441 |
-
|
442 |
-
if ( null === self::$checkout_fields ) {
|
443 |
-
$checkout_fields_default = array(
|
444 |
-
'enable_customization' => 'disable',
|
445 |
-
'enable_billing_fields' => 'disable',
|
446 |
-
);
|
447 |
-
|
448 |
-
$billing_fields = self::get_checkout_fields( 'billing' );
|
449 |
-
|
450 |
-
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
451 |
-
|
452 |
-
foreach ( $billing_fields as $key => $value ) {
|
453 |
-
|
454 |
-
$checkout_fields_default[ $key ] = 'enable';
|
455 |
-
}
|
456 |
-
}
|
457 |
-
|
458 |
-
$checkout_fields = self::get_admin_settings_option( '_wcf_checkout_fields', false, false );
|
459 |
-
|
460 |
-
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
461 |
-
}
|
462 |
-
|
463 |
-
return self::$checkout_fields;
|
464 |
-
}
|
465 |
-
|
466 |
-
/**
|
467 |
-
* Get meta options
|
468 |
-
*
|
469 |
-
* @since 1.0.0
|
470 |
-
* @param int $post_id Product ID.
|
471 |
-
* @param string $key Meta Key.
|
472 |
-
* @param string $default Default value.
|
473 |
-
* @return string Meta Value.
|
474 |
-
*/
|
475 |
-
public static function get_meta_option( $post_id, $key, $default = '' ) {
|
476 |
-
|
477 |
-
$value = get_post_meta( $post_id, $key, true );
|
478 |
-
|
479 |
-
if ( ! $value ) {
|
480 |
-
$value = $default;
|
481 |
-
}
|
482 |
-
|
483 |
-
return $value;
|
484 |
-
}
|
485 |
-
|
486 |
-
/**
|
487 |
-
* Save meta option
|
488 |
-
*
|
489 |
-
* @since 1.0.0
|
490 |
-
* @param int $post_id Product ID.
|
491 |
-
* @param array $args Arguments array.
|
492 |
-
*/
|
493 |
-
public static function save_meta_option( $post_id, $args = array() ) {
|
494 |
-
|
495 |
-
if ( is_array( $args ) && ! empty( $args ) ) {
|
496 |
-
|
497 |
-
foreach ( $args as $key => $value ) {
|
498 |
-
|
499 |
-
update_post_meta( $post_id, $key, $value );
|
500 |
-
}
|
501 |
-
}
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Check if Elementor page builder is installed
|
506 |
-
*
|
507 |
-
* @since 1.0.0
|
508 |
-
*
|
509 |
-
* @access public
|
510 |
-
*/
|
511 |
-
public static function is_elementor_installed() {
|
512 |
-
$path = 'elementor/elementor.php';
|
513 |
-
$plugins = get_plugins();
|
514 |
-
|
515 |
-
return isset( $plugins[ $path ] );
|
516 |
-
}
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Check if Step has product assigned.
|
520 |
-
*
|
521 |
-
* @since 1.0.0
|
522 |
-
* @param int $step_id step ID.
|
523 |
-
*
|
524 |
-
* @access public
|
525 |
-
*/
|
526 |
-
public static function has_product_assigned( $step_id ) {
|
527 |
-
|
528 |
-
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
529 |
-
|
530 |
-
if ( 'checkout' == $step_type ) {
|
531 |
-
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
532 |
-
} else {
|
533 |
-
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
534 |
-
}
|
535 |
-
|
536 |
-
if ( ! empty( $product ) ) {
|
537 |
-
return true;
|
538 |
-
}
|
539 |
-
return false;
|
540 |
-
|
541 |
-
}
|
542 |
-
|
543 |
-
/**
|
544 |
-
* Get attributes for cartflows wrap.
|
545 |
-
*
|
546 |
-
* @since 1.1.4
|
547 |
-
*
|
548 |
-
* @access public
|
549 |
-
*/
|
550 |
-
public static function get_cartflows_container_atts() {
|
551 |
-
|
552 |
-
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
553 |
-
$atts_string = '';
|
554 |
-
|
555 |
-
foreach ( $attributes as $key => $value ) {
|
556 |
-
|
557 |
-
if ( ! $value ) {
|
558 |
-
continue;
|
559 |
-
}
|
560 |
-
|
561 |
-
if ( true === $value ) {
|
562 |
-
$atts_string .= esc_html( $key ) . ' ';
|
563 |
-
} else {
|
564 |
-
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
565 |
-
}
|
566 |
-
}
|
567 |
-
|
568 |
-
return $atts_string;
|
569 |
-
}
|
570 |
-
|
571 |
-
/**
|
572 |
-
* Get facebook pixel settings.
|
573 |
-
*
|
574 |
-
* @return facebook array.
|
575 |
-
*/
|
576 |
-
public static function get_facebook_settings() {
|
577 |
-
|
578 |
-
if ( null === self::$facebook ) {
|
579 |
-
|
580 |
-
$facebook_default = array(
|
581 |
-
'facebook_pixel_id' => '',
|
582 |
-
'facebook_pixel_add_to_cart' => 'enable',
|
583 |
-
'facebook_pixel_initiate_checkout' => 'enable',
|
584 |
-
'facebook_pixel_add_payment_info' => 'enable',
|
585 |
-
'facebook_pixel_purchase_complete' => 'enable',
|
586 |
-
'facebook_pixel_tracking' => 'disable',
|
587 |
-
);
|
588 |
-
|
589 |
-
$facebook = self::get_admin_settings_option( '_cartflows_facebook', false, false );
|
590 |
-
|
591 |
-
$facebook = wp_parse_args( $facebook, $facebook_default );
|
592 |
-
|
593 |
-
self::$facebook = apply_filters( 'cartflows_facebook_settings_default', $facebook );
|
594 |
-
|
595 |
-
}
|
596 |
-
|
597 |
-
return self::$facebook;
|
598 |
-
}
|
599 |
-
|
600 |
-
|
601 |
-
/**
|
602 |
-
* Prepare response data for facebook.
|
603 |
-
*
|
604 |
-
* @param int $order_id order_id.
|
605 |
-
* @param array $offer_data offer data.
|
606 |
-
*/
|
607 |
-
public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) {
|
608 |
-
|
609 |
-
$fb_settings = self::get_facebook_settings();
|
610 |
-
if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) {
|
611 |
-
setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/' );
|
612 |
-
}
|
613 |
-
|
614 |
-
}
|
615 |
-
|
616 |
-
/**
|
617 |
-
* Prepare purchase response for facebook purcase event.
|
618 |
-
*
|
619 |
-
* @param integer $order_id order id.
|
620 |
-
* @param array $offer_data offer data.
|
621 |
-
* @return mixed
|
622 |
-
*/
|
623 |
-
public static function prepare_purchase_data_fb_response( $order_id, $offer_data = array() ) {
|
624 |
-
|
625 |
-
$thankyou['order_id'] = $order_id;
|
626 |
-
$thankyou['content_type'] = 'product';
|
627 |
-
$thankyou['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' );
|
628 |
-
$thankyou['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' );
|
629 |
-
$thankyou['plugin'] = 'CartFlows';
|
630 |
-
$order = wc_get_order( $order_id );
|
631 |
-
if ( empty( $offer_data ) ) {
|
632 |
-
// Iterating through each WC_Order_Item_Product objects.
|
633 |
-
foreach ( $order->get_items() as $item_key => $item ) {
|
634 |
-
$product = $item->get_product(); // Get the WC_Product object.
|
635 |
-
$thankyou['content_ids'][] = (string) $product->get_id();
|
636 |
-
}
|
637 |
-
$thankyou['value'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_total' );
|
638 |
-
} else {
|
639 |
-
$thankyou['content_ids'][] = (string) $offer_data['id'];
|
640 |
-
$thankyou['value'] = $offer_data['total'];
|
641 |
-
}
|
642 |
-
|
643 |
-
return $thankyou;
|
644 |
-
}
|
645 |
-
|
646 |
-
/**
|
647 |
-
* Prepare cart data for fb response.
|
648 |
-
*
|
649 |
-
* @return array
|
650 |
-
*/
|
651 |
-
public static function prepare_cart_data_fb_response() {
|
652 |
-
$params = array();
|
653 |
-
$cart_total = WC()->cart->get_cart_contents_total();
|
654 |
-
$cart_items_count = WC()->cart->get_cart_contents_count();
|
655 |
-
$items = WC()->cart->get_cart();
|
656 |
-
$product_names = '';
|
657 |
-
$category_names = '';
|
658 |
-
$cart_contents = array();
|
659 |
-
foreach ( $items as $item => $value ) {
|
660 |
-
|
661 |
-
$_product = wc_get_product( $value['product_id'] );
|
662 |
-
$params['content_ids'][] = (string) $_product->get_id();
|
663 |
-
$product_names = $product_names . ', ' . $_product->get_title();
|
664 |
-
$category_names = $category_names . ', ' . wp_strip_all_tags( wc_get_product_category_list( $_product->get_id() ) );
|
665 |
-
array_push(
|
666 |
-
$cart_contents,
|
667 |
-
array(
|
668 |
-
'id' => $_product->get_id(),
|
669 |
-
'name' => $_product->get_title(),
|
670 |
-
'quantity' => $value['quantity'],
|
671 |
-
'item_price' => $_product->get_price(),
|
672 |
-
)
|
673 |
-
);
|
674 |
-
}
|
675 |
-
|
676 |
-
$user = wp_get_current_user();
|
677 |
-
$roles = implode( ', ', $user->roles );
|
678 |
-
$params['content_name'] = substr( $product_names, 2 );
|
679 |
-
$params['categoey_name'] = substr( $category_names, 2 );
|
680 |
-
$params['user_roles'] = $roles;
|
681 |
-
$params['plugin'] = 'CartFlows';
|
682 |
-
$params['contents'] = wp_json_encode( $cart_contents );
|
683 |
-
$params['content_type'] = 'product';
|
684 |
-
$params['value'] = $cart_total;
|
685 |
-
$params['num_items'] = $cart_items_count;
|
686 |
-
$params['currency'] = get_woocommerce_currency();
|
687 |
-
$params['language'] = get_bloginfo( 'language' );
|
688 |
-
$params['userAgent'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); //phpcs:ignore
|
689 |
-
$params['product_catalog_id'] = '';
|
690 |
-
$params['domain'] = get_site_url();
|
691 |
-
return $params;
|
692 |
-
}
|
693 |
-
|
694 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CARTFLOWS Helper.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly.
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class Cartflows_Helper.
|
14 |
+
*/
|
15 |
+
class Cartflows_Helper {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Common global data
|
19 |
+
*
|
20 |
+
* @var zapier
|
21 |
+
*/
|
22 |
+
private static $common = null;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Common Debug data
|
26 |
+
*
|
27 |
+
* @var zapier
|
28 |
+
*/
|
29 |
+
private static $debug_data = null;
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Permalink settings
|
34 |
+
*
|
35 |
+
* @var permalink_setting
|
36 |
+
*/
|
37 |
+
private static $permalink_setting = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Installed Plugins
|
41 |
+
*
|
42 |
+
* @since 1.1.4
|
43 |
+
*
|
44 |
+
* @access private
|
45 |
+
* @var array Installed plugins list.
|
46 |
+
*/
|
47 |
+
private static $installed_plugins = null;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Checkout Fields
|
51 |
+
*
|
52 |
+
* @var checkout_fields
|
53 |
+
*/
|
54 |
+
private static $checkout_fields = null;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Facebook pixel global data
|
58 |
+
*
|
59 |
+
* @var faceboook
|
60 |
+
*/
|
61 |
+
private static $facebook = null;
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns an option from the database for
|
66 |
+
* the admin settings page.
|
67 |
+
*
|
68 |
+
* @param string $key The option key.
|
69 |
+
* @param mixed $default Option default value if option is not available.
|
70 |
+
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
71 |
+
* @return string Return the option value
|
72 |
+
*/
|
73 |
+
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
74 |
+
|
75 |
+
// Get the site-wide option if we're in the network admin.
|
76 |
+
if ( $network_override && is_multisite() ) {
|
77 |
+
$value = get_site_option( $key, $default );
|
78 |
+
} else {
|
79 |
+
$value = get_option( $key, $default );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $value;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Updates an option from the admin settings page.
|
87 |
+
*
|
88 |
+
* @param string $key The option key.
|
89 |
+
* @param mixed $value The value to update.
|
90 |
+
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
91 |
+
* @return mixed
|
92 |
+
*/
|
93 |
+
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
94 |
+
|
95 |
+
// Update the site-wide option since we're in the network admin.
|
96 |
+
if ( $network && is_multisite() ) {
|
97 |
+
update_site_option( $key, $value );
|
98 |
+
} else {
|
99 |
+
update_option( $key, $value );
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Get single setting
|
106 |
+
*
|
107 |
+
* @since 1.1.4
|
108 |
+
*
|
109 |
+
* @param string $key Option key.
|
110 |
+
* @param string $default Option default value if not exist.
|
111 |
+
* @return mixed
|
112 |
+
*/
|
113 |
+
public static function get_common_setting( $key = '', $default = '' ) {
|
114 |
+
$settings = self::get_common_settings();
|
115 |
+
|
116 |
+
if ( $settings && array_key_exists( $key, $settings ) ) {
|
117 |
+
return $settings[ $key ];
|
118 |
+
}
|
119 |
+
|
120 |
+
return $default;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Get single debug options
|
125 |
+
*
|
126 |
+
* @since 1.1.4
|
127 |
+
*
|
128 |
+
* @param string $key Option key.
|
129 |
+
* @param string $default Option default value if not exist.
|
130 |
+
* @return mixed
|
131 |
+
*/
|
132 |
+
public static function get_debug_setting( $key = '', $default = '' ) {
|
133 |
+
$debug_data = self::get_debug_settings();
|
134 |
+
|
135 |
+
if ( $debug_data && array_key_exists( $key, $debug_data ) ) {
|
136 |
+
return $debug_data[ $key ];
|
137 |
+
}
|
138 |
+
|
139 |
+
return $default;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get required plugins for page builder
|
144 |
+
*
|
145 |
+
* @since 1.1.4
|
146 |
+
*
|
147 |
+
* @param string $page_builder_slug Page builder slug.
|
148 |
+
* @param string $default Default page builder.
|
149 |
+
* @return array selected page builder required plugins list.
|
150 |
+
*/
|
151 |
+
public static function get_required_plugins_for_page_builder( $page_builder_slug = '', $default = 'elementor' ) {
|
152 |
+
$plugins = self::get_plugins_groupby_page_builders();
|
153 |
+
|
154 |
+
if ( array_key_exists( $page_builder_slug, $plugins ) ) {
|
155 |
+
return $plugins[ $page_builder_slug ];
|
156 |
+
}
|
157 |
+
|
158 |
+
return $plugins[ $default ];
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Get Plugins list by page builder.
|
163 |
+
*
|
164 |
+
* @since 1.1.4
|
165 |
+
*
|
166 |
+
* @return array Required Plugins list.
|
167 |
+
*/
|
168 |
+
public static function get_plugins_groupby_page_builders() {
|
169 |
+
|
170 |
+
$divi_status = self::get_plugin_status( 'divi-builder/divi-builder.php' );
|
171 |
+
$theme_status = 'not-installed';
|
172 |
+
if ( $divi_status ) {
|
173 |
+
if ( true === Cartflows_Compatibility::get_instance()->is_divi_theme_installed() ) {
|
174 |
+
$theme_status = 'installed';
|
175 |
+
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
|
176 |
+
$theme_status = 'deactivate';
|
177 |
+
$divi_status = 'activate';
|
178 |
+
} else {
|
179 |
+
$divi_status = '';
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
$plugins = array(
|
185 |
+
'elementor' => array(
|
186 |
+
'title' => 'Elementor',
|
187 |
+
'plugins' => array(
|
188 |
+
array(
|
189 |
+
'slug' => 'elementor', // For download from wp.org.
|
190 |
+
'init' => 'elementor/elementor.php',
|
191 |
+
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
|
192 |
+
),
|
193 |
+
),
|
194 |
+
),
|
195 |
+
'divi' => array(
|
196 |
+
'title' => 'Divi',
|
197 |
+
'theme-status' => $theme_status,
|
198 |
+
'plugin-status' => $divi_status,
|
199 |
+
'plugins' => array(
|
200 |
+
array(
|
201 |
+
'slug' => 'divi-builder', // For download from wp.org.
|
202 |
+
'init' => 'divi-builder/divi-builder.php',
|
203 |
+
'status' => $divi_status,
|
204 |
+
),
|
205 |
+
),
|
206 |
+
),
|
207 |
+
);
|
208 |
+
|
209 |
+
$plugins['beaver-builder'] = array(
|
210 |
+
'title' => 'Beaver Builder',
|
211 |
+
'plugins' => array(),
|
212 |
+
);
|
213 |
+
|
214 |
+
// Check Pro Exist.
|
215 |
+
if ( file_exists( WP_PLUGIN_DIR . '/bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
|
216 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
217 |
+
'slug' => 'bb-plugin',
|
218 |
+
'init' => 'bb-plugin/fl-builder.php',
|
219 |
+
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
|
220 |
+
);
|
221 |
+
} else {
|
222 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
223 |
+
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
|
224 |
+
'init' => 'beaver-builder-lite-version/fl-builder.php',
|
225 |
+
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
|
226 |
+
);
|
227 |
+
}
|
228 |
+
|
229 |
+
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' ) ) {
|
230 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
231 |
+
'slug' => 'bb-ultimate-addon',
|
232 |
+
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
|
233 |
+
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
|
234 |
+
);
|
235 |
+
} else {
|
236 |
+
$plugins['beaver-builder']['plugins'][] = array(
|
237 |
+
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
|
238 |
+
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
|
239 |
+
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
|
240 |
+
);
|
241 |
+
}
|
242 |
+
|
243 |
+
return $plugins;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Get plugin status
|
248 |
+
*
|
249 |
+
* @since 1.1.4
|
250 |
+
*
|
251 |
+
* @param string $plugin_init_file Plguin init file.
|
252 |
+
* @return mixed
|
253 |
+
*/
|
254 |
+
public static function get_plugin_status( $plugin_init_file ) {
|
255 |
+
|
256 |
+
if ( null == self::$installed_plugins ) {
|
257 |
+
self::$installed_plugins = get_plugins();
|
258 |
+
}
|
259 |
+
|
260 |
+
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
|
261 |
+
return 'install';
|
262 |
+
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
|
263 |
+
return 'activate';
|
264 |
+
} else {
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get zapier settings.
|
271 |
+
*
|
272 |
+
* @return array.
|
273 |
+
*/
|
274 |
+
public static function get_common_settings() {
|
275 |
+
|
276 |
+
if ( null === self::$common ) {
|
277 |
+
|
278 |
+
$common_default = apply_filters(
|
279 |
+
'cartflows_common_settings_default',
|
280 |
+
array(
|
281 |
+
'disallow_indexing' => 'disable',
|
282 |
+
'global_checkout' => '',
|
283 |
+
'default_page_builder' => 'elementor',
|
284 |
+
)
|
285 |
+
);
|
286 |
+
|
287 |
+
$common = self::get_admin_settings_option( '_cartflows_common', false, false );
|
288 |
+
|
289 |
+
$common = wp_parse_args( $common, $common_default );
|
290 |
+
|
291 |
+
if ( ! did_action( 'wp' ) ) {
|
292 |
+
return $common;
|
293 |
+
} else {
|
294 |
+
self::$common = $common;
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
return self::$common;
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Get debug settings data.
|
303 |
+
*
|
304 |
+
* @return array.
|
305 |
+
*/
|
306 |
+
public static function get_debug_settings() {
|
307 |
+
|
308 |
+
if ( null === self::$debug_data ) {
|
309 |
+
|
310 |
+
$debug_data_default = apply_filters(
|
311 |
+
'cartflows_debug_settings_default',
|
312 |
+
array(
|
313 |
+
'allow_minified_files' => 'disable',
|
314 |
+
)
|
315 |
+
);
|
316 |
+
|
317 |
+
$debug_data = self::get_admin_settings_option( '_cartflows_debug_data', false, false );
|
318 |
+
|
319 |
+
$debug_data = wp_parse_args( $debug_data, $debug_data_default );
|
320 |
+
|
321 |
+
if ( ! did_action( 'wp' ) ) {
|
322 |
+
return $debug_data;
|
323 |
+
} else {
|
324 |
+
self::$debug_data = $debug_data;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
return self::$debug_data;
|
329 |
+
}
|
330 |
+
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Get debug settings data.
|
334 |
+
*
|
335 |
+
* @return array.
|
336 |
+
*/
|
337 |
+
public static function get_permalink_settings() {
|
338 |
+
|
339 |
+
if ( null === self::$permalink_setting ) {
|
340 |
+
|
341 |
+
$permalink_default = apply_filters(
|
342 |
+
'cartflows_permalink_settings_default',
|
343 |
+
array(
|
344 |
+
'permalink' => CARTFLOWS_STEP_POST_TYPE,
|
345 |
+
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
|
346 |
+
'permalink_structure' => '',
|
347 |
+
|
348 |
+
)
|
349 |
+
);
|
350 |
+
|
351 |
+
$permalink_data = self::get_admin_settings_option( '_cartflows_permalink', false, false );
|
352 |
+
|
353 |
+
$permalink_data = wp_parse_args( $permalink_data, $permalink_default );
|
354 |
+
|
355 |
+
if ( ! did_action( 'wp' ) ) {
|
356 |
+
return $permalink_data;
|
357 |
+
} else {
|
358 |
+
self::$permalink_setting = $permalink_data;
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
return self::$permalink_setting;
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* Get Checkout field.
|
367 |
+
*
|
368 |
+
* @param string $key Field key.
|
369 |
+
* @param int $post_id Post id.
|
370 |
+
* @return array.
|
371 |
+
*/
|
372 |
+
public static function get_checkout_fields( $key, $post_id ) {
|
373 |
+
|
374 |
+
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
|
375 |
+
|
376 |
+
if ( ! $saved_fields ) {
|
377 |
+
$saved_fields = array();
|
378 |
+
}
|
379 |
+
|
380 |
+
$fields = array_filter( $saved_fields );
|
381 |
+
|
382 |
+
if ( empty( $fields ) ) {
|
383 |
+
if ( 'billing' === $key || 'shipping' === $key ) {
|
384 |
+
|
385 |
+
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
|
386 |
+
|
387 |
+
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
return $fields;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Add Checkout field.
|
396 |
+
*
|
397 |
+
* @param string $type Field type.
|
398 |
+
* @param string $field_key Field key.
|
399 |
+
* @param array $field_data Field data.
|
400 |
+
* @param int $post_id Post id.
|
401 |
+
* @return boolean.
|
402 |
+
*/
|
403 |
+
public static function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
|
404 |
+
|
405 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
406 |
+
|
407 |
+
$fields[ $field_key ] = $field_data;
|
408 |
+
|
409 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
410 |
+
|
411 |
+
return true;
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Get checkout fields settings.
|
416 |
+
*
|
417 |
+
* @param string $type Field type.
|
418 |
+
* @param string $field_key Field key.
|
419 |
+
* @param int $post_id Post id.
|
420 |
+
* @return array.
|
421 |
+
*/
|
422 |
+
public static function delete_checkout_field( $type, $field_key, $post_id ) {
|
423 |
+
|
424 |
+
$fields = self::get_checkout_fields( $type, $post_id );
|
425 |
+
|
426 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
427 |
+
unset( $fields[ $field_key ] );
|
428 |
+
}
|
429 |
+
|
430 |
+
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
|
431 |
+
|
432 |
+
return true;
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Get checkout fields settings.
|
437 |
+
*
|
438 |
+
* @return array.
|
439 |
+
*/
|
440 |
+
public static function get_checkout_fields_settings() {
|
441 |
+
|
442 |
+
if ( null === self::$checkout_fields ) {
|
443 |
+
$checkout_fields_default = array(
|
444 |
+
'enable_customization' => 'disable',
|
445 |
+
'enable_billing_fields' => 'disable',
|
446 |
+
);
|
447 |
+
|
448 |
+
$billing_fields = self::get_checkout_fields( 'billing' );
|
449 |
+
|
450 |
+
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
|
451 |
+
|
452 |
+
foreach ( $billing_fields as $key => $value ) {
|
453 |
+
|
454 |
+
$checkout_fields_default[ $key ] = 'enable';
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
$checkout_fields = self::get_admin_settings_option( '_wcf_checkout_fields', false, false );
|
459 |
+
|
460 |
+
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
|
461 |
+
}
|
462 |
+
|
463 |
+
return self::$checkout_fields;
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Get meta options
|
468 |
+
*
|
469 |
+
* @since 1.0.0
|
470 |
+
* @param int $post_id Product ID.
|
471 |
+
* @param string $key Meta Key.
|
472 |
+
* @param string $default Default value.
|
473 |
+
* @return string Meta Value.
|
474 |
+
*/
|
475 |
+
public static function get_meta_option( $post_id, $key, $default = '' ) {
|
476 |
+
|
477 |
+
$value = get_post_meta( $post_id, $key, true );
|
478 |
+
|
479 |
+
if ( ! $value ) {
|
480 |
+
$value = $default;
|
481 |
+
}
|
482 |
+
|
483 |
+
return $value;
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* Save meta option
|
488 |
+
*
|
489 |
+
* @since 1.0.0
|
490 |
+
* @param int $post_id Product ID.
|
491 |
+
* @param array $args Arguments array.
|
492 |
+
*/
|
493 |
+
public static function save_meta_option( $post_id, $args = array() ) {
|
494 |
+
|
495 |
+
if ( is_array( $args ) && ! empty( $args ) ) {
|
496 |
+
|
497 |
+
foreach ( $args as $key => $value ) {
|
498 |
+
|
499 |
+
update_post_meta( $post_id, $key, $value );
|
500 |
+
}
|
501 |
+
}
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Check if Elementor page builder is installed
|
506 |
+
*
|
507 |
+
* @since 1.0.0
|
508 |
+
*
|
509 |
+
* @access public
|
510 |
+
*/
|
511 |
+
public static function is_elementor_installed() {
|
512 |
+
$path = 'elementor/elementor.php';
|
513 |
+
$plugins = get_plugins();
|
514 |
+
|
515 |
+
return isset( $plugins[ $path ] );
|
516 |
+
}
|
517 |
+
|
518 |
+
/**
|
519 |
+
* Check if Step has product assigned.
|
520 |
+
*
|
521 |
+
* @since 1.0.0
|
522 |
+
* @param int $step_id step ID.
|
523 |
+
*
|
524 |
+
* @access public
|
525 |
+
*/
|
526 |
+
public static function has_product_assigned( $step_id ) {
|
527 |
+
|
528 |
+
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
|
529 |
+
|
530 |
+
if ( 'checkout' == $step_type ) {
|
531 |
+
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
|
532 |
+
} else {
|
533 |
+
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
|
534 |
+
}
|
535 |
+
|
536 |
+
if ( ! empty( $product ) ) {
|
537 |
+
return true;
|
538 |
+
}
|
539 |
+
return false;
|
540 |
+
|
541 |
+
}
|
542 |
+
|
543 |
+
/**
|
544 |
+
* Get attributes for cartflows wrap.
|
545 |
+
*
|
546 |
+
* @since 1.1.4
|
547 |
+
*
|
548 |
+
* @access public
|
549 |
+
*/
|
550 |
+
public static function get_cartflows_container_atts() {
|
551 |
+
|
552 |
+
$attributes = apply_filters( 'cartflows_container_atts', array() );
|
553 |
+
$atts_string = '';
|
554 |
+
|
555 |
+
foreach ( $attributes as $key => $value ) {
|
556 |
+
|
557 |
+
if ( ! $value ) {
|
558 |
+
continue;
|
559 |
+
}
|
560 |
+
|
561 |
+
if ( true === $value ) {
|
562 |
+
$atts_string .= esc_html( $key ) . ' ';
|
563 |
+
} else {
|
564 |
+
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
+
return $atts_string;
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Get facebook pixel settings.
|
573 |
+
*
|
574 |
+
* @return facebook array.
|
575 |
+
*/
|
576 |
+
public static function get_facebook_settings() {
|
577 |
+
|
578 |
+
if ( null === self::$facebook ) {
|
579 |
+
|
580 |
+
$facebook_default = array(
|
581 |
+
'facebook_pixel_id' => '',
|
582 |
+
'facebook_pixel_add_to_cart' => 'enable',
|
583 |
+
'facebook_pixel_initiate_checkout' => 'enable',
|
584 |
+
'facebook_pixel_add_payment_info' => 'enable',
|
585 |
+
'facebook_pixel_purchase_complete' => 'enable',
|
586 |
+
'facebook_pixel_tracking' => 'disable',
|
587 |
+
);
|
588 |
+
|
589 |
+
$facebook = self::get_admin_settings_option( '_cartflows_facebook', false, false );
|
590 |
+
|
591 |
+
$facebook = wp_parse_args( $facebook, $facebook_default );
|
592 |
+
|
593 |
+
self::$facebook = apply_filters( 'cartflows_facebook_settings_default', $facebook );
|
594 |
+
|
595 |
+
}
|
596 |
+
|
597 |
+
return self::$facebook;
|
598 |
+
}
|
599 |
+
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Prepare response data for facebook.
|
603 |
+
*
|
604 |
+
* @param int $order_id order_id.
|
605 |
+
* @param array $offer_data offer data.
|
606 |
+
*/
|
607 |
+
public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) {
|
608 |
+
|
609 |
+
$fb_settings = self::get_facebook_settings();
|
610 |
+
if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) {
|
611 |
+
setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/' );
|
612 |
+
}
|
613 |
+
|
614 |
+
}
|
615 |
+
|
616 |
+
/**
|
617 |
+
* Prepare purchase response for facebook purcase event.
|
618 |
+
*
|
619 |
+
* @param integer $order_id order id.
|
620 |
+
* @param array $offer_data offer data.
|
621 |
+
* @return mixed
|
622 |
+
*/
|
623 |
+
public static function prepare_purchase_data_fb_response( $order_id, $offer_data = array() ) {
|
624 |
+
|
625 |
+
$thankyou['order_id'] = $order_id;
|
626 |
+
$thankyou['content_type'] = 'product';
|
627 |
+
$thankyou['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' );
|
628 |
+
$thankyou['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' );
|
629 |
+
$thankyou['plugin'] = 'CartFlows';
|
630 |
+
$order = wc_get_order( $order_id );
|
631 |
+
if ( empty( $offer_data ) ) {
|
632 |
+
// Iterating through each WC_Order_Item_Product objects.
|
633 |
+
foreach ( $order->get_items() as $item_key => $item ) {
|
634 |
+
$product = $item->get_product(); // Get the WC_Product object.
|
635 |
+
$thankyou['content_ids'][] = (string) $product->get_id();
|
636 |
+
}
|
637 |
+
$thankyou['value'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_total' );
|
638 |
+
} else {
|
639 |
+
$thankyou['content_ids'][] = (string) $offer_data['id'];
|
640 |
+
$thankyou['value'] = $offer_data['total'];
|
641 |
+
}
|
642 |
+
|
643 |
+
return $thankyou;
|
644 |
+
}
|
645 |
+
|
646 |
+
/**
|
647 |
+
* Prepare cart data for fb response.
|
648 |
+
*
|
649 |
+
* @return array
|
650 |
+
*/
|
651 |
+
public static function prepare_cart_data_fb_response() {
|
652 |
+
$params = array();
|
653 |
+
$cart_total = WC()->cart->get_cart_contents_total();
|
654 |
+
$cart_items_count = WC()->cart->get_cart_contents_count();
|
655 |
+
$items = WC()->cart->get_cart();
|
656 |
+
$product_names = '';
|
657 |
+
$category_names = '';
|
658 |
+
$cart_contents = array();
|
659 |
+
foreach ( $items as $item => $value ) {
|
660 |
+
|
661 |
+
$_product = wc_get_product( $value['product_id'] );
|
662 |
+
$params['content_ids'][] = (string) $_product->get_id();
|
663 |
+
$product_names = $product_names . ', ' . $_product->get_title();
|
664 |
+
$category_names = $category_names . ', ' . wp_strip_all_tags( wc_get_product_category_list( $_product->get_id() ) );
|
665 |
+
array_push(
|
666 |
+
$cart_contents,
|
667 |
+
array(
|
668 |
+
'id' => $_product->get_id(),
|
669 |
+
'name' => $_product->get_title(),
|
670 |
+
'quantity' => $value['quantity'],
|
671 |
+
'item_price' => $_product->get_price(),
|
672 |
+
)
|
673 |
+
);
|
674 |
+
}
|
675 |
+
|
676 |
+
$user = wp_get_current_user();
|
677 |
+
$roles = implode( ', ', $user->roles );
|
678 |
+
$params['content_name'] = substr( $product_names, 2 );
|
679 |
+
$params['categoey_name'] = substr( $category_names, 2 );
|
680 |
+
$params['user_roles'] = $roles;
|
681 |
+
$params['plugin'] = 'CartFlows';
|
682 |
+
$params['contents'] = wp_json_encode( $cart_contents );
|
683 |
+
$params['content_type'] = 'product';
|
684 |
+
$params['value'] = $cart_total;
|
685 |
+
$params['num_items'] = $cart_items_count;
|
686 |
+
$params['currency'] = get_woocommerce_currency();
|
687 |
+
$params['language'] = get_bloginfo( 'language' );
|
688 |
+
$params['userAgent'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); //phpcs:ignore
|
689 |
+
$params['product_catalog_id'] = '';
|
690 |
+
$params['domain'] = get_site_url();
|
691 |
+
return $params;
|
692 |
+
}
|
693 |
+
|
694 |
+
}
|
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 |
-
); // db call ok; no-cache ok.
|
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 |
-
); // db call ok; no-cache ok.
|
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 ) );//phpcs:ignore
|
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 |
+
); // db call ok; no-cache ok.
|
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 |
+
); // db call ok; no-cache ok.
|
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 ) );//phpcs:ignore
|
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
@@ -100,10 +100,10 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
100 |
public function export_flow() {
|
101 |
|
102 |
if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_export_flow' == $_REQUEST['action'] ) ) ) {
|
103 |
-
wp_die(
|
104 |
}
|
105 |
|
106 |
-
if ( ! isset( $_GET['flow_export_nonce'] ) || ! wp_verify_nonce( wp_unslash( $_GET['flow_export_nonce'] ), basename( __FILE__ ) ) ) {
|
107 |
return;
|
108 |
}
|
109 |
|
@@ -151,7 +151,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
151 |
return;
|
152 |
}
|
153 |
|
154 |
-
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( wp_unslash( $_POST['cartflows-action-nonce'] ), 'cartflows-action-nonce' ) ) {
|
155 |
return;
|
156 |
}
|
157 |
|
@@ -278,7 +278,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
278 |
return;
|
279 |
}
|
280 |
|
281 |
-
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( wp_unslash( $_POST['cartflows-action-nonce'] ), 'cartflows-action-nonce' ) ) {
|
282 |
return;
|
283 |
}
|
284 |
|
@@ -291,13 +291,13 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
291 |
$extension = end( $file_info );
|
292 |
|
293 |
if ( 'json' != $extension ) {
|
294 |
-
wp_die(
|
295 |
}
|
296 |
|
297 |
$file = $_FILES['file']['tmp_name']; //phpcs:ignore
|
298 |
|
299 |
if ( empty( $file ) ) {
|
300 |
-
wp_die(
|
301 |
}
|
302 |
|
303 |
// Retrieve the settings from the file and convert the JSON object to an array.
|
@@ -474,7 +474,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
474 |
public function imported_successfully() {
|
475 |
?>
|
476 |
<div class="notice notice-success">
|
477 |
-
<p><?php
|
478 |
</div>
|
479 |
<?php
|
480 |
}
|
@@ -506,9 +506,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
506 |
<div class="template-message-block cartflows-step-loading">
|
507 |
<h2>
|
508 |
<span class="spinner"></span>
|
509 |
-
<?php
|
510 |
</h2>
|
511 |
-
<p class="description"><?php
|
512 |
</div>
|
513 |
</script>
|
514 |
|
@@ -519,9 +519,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
519 |
<div class="template-message-block cartflows-searching-templates">
|
520 |
<h2>
|
521 |
<span class="spinner"></span>
|
522 |
-
<?php
|
523 |
</h2>
|
524 |
-
<p class="description"><?php
|
525 |
</div>
|
526 |
</script>
|
527 |
|
@@ -530,7 +530,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
530 |
?>
|
531 |
<script type="text/template" id="tmpl-cartflows-step-importing">
|
532 |
<div class="template-message-block cartflows-step-importing">
|
533 |
-
<h2><span class="spinner"></span> <?php
|
534 |
</div>
|
535 |
</script>
|
536 |
|
@@ -539,8 +539,8 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
539 |
?>
|
540 |
<script type="text/template" id="tmpl-cartflows-step-imported">
|
541 |
<div class="template-message-block cartflows-step-imported">
|
542 |
-
<h2><span class="dashicons dashicons-yes"></span> <?php
|
543 |
-
<p class="description"><?php
|
544 |
</script>
|
545 |
|
546 |
<?php
|
@@ -549,7 +549,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
549 |
<script type="text/template" id="tmpl-cartflows-no-steps">
|
550 |
<div class="cartflows-no-steps">
|
551 |
<div class="template-message-block">
|
552 |
-
<h2><?php
|
553 |
<p class="description"></p>
|
554 |
</div>
|
555 |
</div>
|
@@ -561,7 +561,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
561 |
<script type="text/template" id="tmpl-cartflows-no-flows">
|
562 |
<div class="cartflows-no-flows">
|
563 |
<div class="template-message-block">
|
564 |
-
<h2><?php
|
565 |
<p class="description"></p>
|
566 |
</div>
|
567 |
</div>
|
@@ -579,8 +579,8 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
579 |
?>
|
580 |
<script type="text/template" id="tmpl-templator-redirect-to-elementor">
|
581 |
<div class="template-message-block templator-redirect-to-elementor">
|
582 |
-
<h2><span class="dashicons dashicons-yes"></span> <?php
|
583 |
-
<p class="description"><?php
|
584 |
</script>
|
585 |
|
586 |
<?php
|
@@ -626,14 +626,14 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
626 |
<# } #>
|
627 |
</div>
|
628 |
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
629 |
-
<span class="wcf-flow-type pro"><?php
|
630 |
<# } #>
|
631 |
<# if( data.items[ key ].woo_required ) { #>
|
632 |
<div class="notice notice-info" style="width: auto;">
|
633 |
<p class="wcf-learn-how">
|
634 |
Install/Activate WooCommerce to use this template.
|
635 |
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
636 |
-
<strong><?php
|
637 |
<i class="dashicons dashicons-external"></i>
|
638 |
</a>
|
639 |
</p>
|
@@ -667,9 +667,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
667 |
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
|
668 |
<# } #>
|
669 |
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
670 |
-
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php
|
671 |
<# } else { #>
|
672 |
-
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php
|
673 |
<# } #>
|
674 |
</div>
|
675 |
</div>
|
@@ -694,7 +694,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
694 |
<div class="template-id-container">
|
695 |
<h3 class="template-name"> Blank </h3>
|
696 |
<div class="template-actions">
|
697 |
-
<a href="#" class="button button-primary cartflows-step-import-blank"><?php
|
698 |
</div>
|
699 |
</div>
|
700 |
</div>
|
@@ -732,7 +732,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
732 |
<p class="wcf-learn-how">
|
733 |
Install/Activate WooCommerce to use this template.
|
734 |
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
735 |
-
<strong><?php
|
736 |
<i class="dashicons dashicons-external"></i>
|
737 |
</a>
|
738 |
</p>
|
@@ -742,7 +742,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
742 |
<# } #>
|
743 |
|
744 |
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
745 |
-
<span class="wcf-flow-type pro"><?php
|
746 |
<# } #>
|
747 |
</span>
|
748 |
<div class="template-id-container">
|
@@ -774,9 +774,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
774 |
<# } #>
|
775 |
|
776 |
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
777 |
-
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php
|
778 |
<# } else { #>
|
779 |
-
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php
|
780 |
<# } #>
|
781 |
</div>
|
782 |
</div>
|
@@ -793,9 +793,9 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
793 |
?>
|
794 |
<script type="text/template" id="tmpl-cartflows-website-unreachable">
|
795 |
<div class="postbox cartflows-website-unreachable">
|
796 |
-
<h2><?php
|
797 |
-
<p><?php
|
798 |
-
<p><?php
|
799 |
</div>
|
800 |
</script>
|
801 |
|
@@ -825,7 +825,7 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
825 |
}
|
826 |
?>
|
827 |
<div class="wcf-page-builder-message">
|
828 |
-
<p><?php /* translators: %s: Plugin string */ printf(
|
829 |
<p>If your preferred page builder is not available, feel free to <a href="#" data-slug="canvas" class="wcf-create-from-scratch-link">create your own</a> pages using page builder of your choice as CartFlows works with all major page builders.</p>
|
830 |
<p>We plan to add design templates made with more page builder shortly!</p>
|
831 |
</div>
|
@@ -840,10 +840,10 @@ if ( ! class_exists( 'CartFlows_Importer' ) ) :
|
|
840 |
<# if ( data ) { #>
|
841 |
<select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
|
842 |
<# if ( data.args.show_all ) { #>
|
843 |
-
<option value="all"> <?php
|
844 |
<# } #>
|
845 |
<# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
|
846 |
-
<option value=""> <?php
|
847 |
<# } #>
|
848 |
<# for ( key in data.items ) { #>
|
849 |
<option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
|
100 |
public function export_flow() {
|
101 |
|
102 |
if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_export_flow' == $_REQUEST['action'] ) ) ) {
|
103 |
+
wp_die( esc_html__( 'No post to export has been supplied!', 'cartflows' ) );
|
104 |
}
|
105 |
|
106 |
+
if ( ! isset( $_GET['flow_export_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['flow_export_nonce'] ) ), basename( __FILE__ ) ) ) {
|
107 |
return;
|
108 |
}
|
109 |
|
151 |
return;
|
152 |
}
|
153 |
|
154 |
+
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-action-nonce'] ) ), 'cartflows-action-nonce' ) ) {
|
155 |
return;
|
156 |
}
|
157 |
|
278 |
return;
|
279 |
}
|
280 |
|
281 |
+
if ( isset( $_POST['cartflows-action-nonce'] ) && ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-action-nonce'] ) ), 'cartflows-action-nonce' ) ) {
|
282 |
return;
|
283 |
}
|
284 |
|
291 |
$extension = end( $file_info );
|
292 |
|
293 |
if ( 'json' != $extension ) {
|
294 |
+
wp_die( esc_html__( 'Please upload a valid .json file', 'cartflows' ) );
|
295 |
}
|
296 |
|
297 |
$file = $_FILES['file']['tmp_name']; //phpcs:ignore
|
298 |
|
299 |
if ( empty( $file ) ) {
|
300 |
+
wp_die( esc_html__( 'Please upload a file to import', 'cartflows' ) );
|
301 |
}
|
302 |
|
303 |
// Retrieve the settings from the file and convert the JSON object to an array.
|
474 |
public function imported_successfully() {
|
475 |
?>
|
476 |
<div class="notice notice-success">
|
477 |
+
<p><?php esc_html_e( 'Successfully imported flows.', 'cartflows' ); ?></p>
|
478 |
</div>
|
479 |
<?php
|
480 |
}
|
506 |
<div class="template-message-block cartflows-step-loading">
|
507 |
<h2>
|
508 |
<span class="spinner"></span>
|
509 |
+
<?php esc_html_e( 'Loading Steps', 'cartflows' ); ?>
|
510 |
</h2>
|
511 |
+
<p class="description"><?php esc_html_e( 'Getting steps from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
|
512 |
</div>
|
513 |
</script>
|
514 |
|
519 |
<div class="template-message-block cartflows-searching-templates">
|
520 |
<h2>
|
521 |
<span class="spinner"></span>
|
522 |
+
<?php esc_html_e( 'Searching Template..', 'cartflows' ); ?>
|
523 |
</h2>
|
524 |
+
<p class="description"><?php esc_html_e( 'Getting templates from the cloud. Please wait for the moment.', 'cartflows' ); ?></p>
|
525 |
</div>
|
526 |
</script>
|
527 |
|
530 |
?>
|
531 |
<script type="text/template" id="tmpl-cartflows-step-importing">
|
532 |
<div class="template-message-block cartflows-step-importing">
|
533 |
+
<h2><span class="spinner"></span> <?php esc_html_e( 'Importing..', 'cartflows' ); ?></h2>
|
534 |
</div>
|
535 |
</script>
|
536 |
|
539 |
?>
|
540 |
<script type="text/template" id="tmpl-cartflows-step-imported">
|
541 |
<div class="template-message-block cartflows-step-imported">
|
542 |
+
<h2><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Imported', 'cartflows' ); ?></h2>
|
543 |
+
<p class="description"><?php esc_html_e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span></p></div>
|
544 |
</script>
|
545 |
|
546 |
<?php
|
549 |
<script type="text/template" id="tmpl-cartflows-no-steps">
|
550 |
<div class="cartflows-no-steps">
|
551 |
<div class="template-message-block">
|
552 |
+
<h2><?php esc_html_e( 'Coming Soon!', 'cartflows' ); ?></h2>
|
553 |
<p class="description"></p>
|
554 |
</div>
|
555 |
</div>
|
561 |
<script type="text/template" id="tmpl-cartflows-no-flows">
|
562 |
<div class="cartflows-no-flows">
|
563 |
<div class="template-message-block">
|
564 |
+
<h2><?php esc_html_e( 'Coming Soon!', 'cartflows' ); ?></h2>
|
565 |
<p class="description"></p>
|
566 |
</div>
|
567 |
</div>
|
579 |
?>
|
580 |
<script type="text/template" id="tmpl-templator-redirect-to-elementor">
|
581 |
<div class="template-message-block templator-redirect-to-elementor">
|
582 |
+
<h2><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Imported', 'cartflows' ); ?></h2>
|
583 |
+
<p class="description"><?php esc_html_e( 'Thanks for patience', 'cartflows' ); ?> <span class="dashicons dashicons-smiley"></span><br/><br/><?php esc_html_e( 'Redirecting to the Elementor edit window.', 'cartflows' ); ?> </p></div>
|
584 |
</script>
|
585 |
|
586 |
<?php
|
626 |
<# } #>
|
627 |
</div>
|
628 |
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
629 |
+
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
|
630 |
<# } #>
|
631 |
<# if( data.items[ key ].woo_required ) { #>
|
632 |
<div class="notice notice-info" style="width: auto;">
|
633 |
<p class="wcf-learn-how">
|
634 |
Install/Activate WooCommerce to use this template.
|
635 |
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
636 |
+
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
|
637 |
<i class="dashicons dashicons-external"></i>
|
638 |
</a>
|
639 |
</p>
|
667 |
<a href='#' class='wcf-activate-wc button-primary'>Install & activate Woo</a>
|
668 |
<# } #>
|
669 |
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
670 |
+
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate License', 'cartflows' ); ?></a>
|
671 |
<# } else { #>
|
672 |
+
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php esc_html_e( 'Get Pro', 'cartflows' ); ?></a>
|
673 |
<# } #>
|
674 |
</div>
|
675 |
</div>
|
694 |
<div class="template-id-container">
|
695 |
<h3 class="template-name"> Blank </h3>
|
696 |
<div class="template-actions">
|
697 |
+
<a href="#" class="button button-primary cartflows-step-import-blank"><?php esc_html_e( 'Create', 'cartflows' ); ?></a>
|
698 |
</div>
|
699 |
</div>
|
700 |
</div>
|
732 |
<p class="wcf-learn-how">
|
733 |
Install/Activate WooCommerce to use this template.
|
734 |
<a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank">
|
735 |
+
<strong><?php esc_html_e( 'Learn How', 'cartflows' ); ?></strong>
|
736 |
<i class="dashicons dashicons-external"></i>
|
737 |
</a>
|
738 |
</p>
|
742 |
<# } #>
|
743 |
|
744 |
<# if( data.items[ key ].flow_type && 'pro' === data.items[ key ].flow_type.slug ) { #>
|
745 |
+
<span class="wcf-flow-type pro"><?php esc_html_e( 'Pro', 'cartflows' ); ?></span>
|
746 |
<# } #>
|
747 |
</span>
|
748 |
<div class="template-id-container">
|
774 |
<# } #>
|
775 |
|
776 |
<# } else if( CartFlowsImportVars._is_pro_active ) { #>
|
777 |
+
<a target="_blank" href="<?php echo esc_url( admin_url( 'plugins.php?cartflows-license-popup' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Activate License', 'cartflows' ); ?></a>
|
778 |
<# } else { #>
|
779 |
+
<a target="_blank" href="<?php echo esc_url( CARTFLOWS_DOMAIN_URL ); ?>" class="button button-primary"><?php esc_html_e( 'Get Pro', 'cartflows' ); ?></a>
|
780 |
<# } #>
|
781 |
</div>
|
782 |
</div>
|
793 |
?>
|
794 |
<script type="text/template" id="tmpl-cartflows-website-unreachable">
|
795 |
<div class="postbox cartflows-website-unreachable">
|
796 |
+
<h2><?php esc_html_e( 'Under Maintenance..', 'cartflows' ); ?></h2>
|
797 |
+
<p><?php esc_html_e( 'If you are seeing this message, most likely our servers are under routine maintenance and we will be back shortly.', 'cartflows' ); ?></p>
|
798 |
+
<p><?php esc_html_e( 'In rare case, it is possible your website is having trouble connecting with ours. If you need help, please feel free to get in touch with us from our website..', 'cartflows' ); ?></p>
|
799 |
</div>
|
800 |
</script>
|
801 |
|
825 |
}
|
826 |
?>
|
827 |
<div class="wcf-page-builder-message">
|
828 |
+
<p><?php /* translators: %s: Plugin string */ printf( esc_html__( '%1$s to see CartFlows templates. If you prefer another page builder tool, you can <a href="%2$s" target="blank">select it here</a>.', 'cartflows' ), $plugin_string, admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS . '&action=common-settings#form-field-wcf_default_page_builder' ) ); ?></p>
|
829 |
<p>If your preferred page builder is not available, feel free to <a href="#" data-slug="canvas" class="wcf-create-from-scratch-link">create your own</a> pages using page builder of your choice as CartFlows works with all major page builders.</p>
|
830 |
<p>We plan to add design templates made with more page builder shortly!</p>
|
831 |
</div>
|
840 |
<# if ( data ) { #>
|
841 |
<select class="{{ data.args.wrapper_class }} {{ data.args.class }}">
|
842 |
<# if ( data.args.show_all ) { #>
|
843 |
+
<option value="all"> <?php esc_html_e( 'All', 'cartflows' ); ?> </option>
|
844 |
<# } #>
|
845 |
<# if ( CartFlowsImportVars.step_type === data.args.remote_slug ) { #>
|
846 |
+
<option value=""> <?php esc_html_e( 'Select Step Type', 'cartflows' ); ?> </option>
|
847 |
<# } #>
|
848 |
<# for ( key in data.items ) { #>
|
849 |
<option value='{{ data.items[ key ].id }}' data-group='{{ data.items[ key ].id }}' class="{{ data.items[ key ].name }}" data-slug="{{ data.items[ key ].slug }}" data-title="{{ data.items[ key ].name }}">{{ data.items[ key ].name }}</option>
|
classes/class-cartflows-learndash-compatibility.php
CHANGED
@@ -1,133 +1,133 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* LearnDash compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class for LearnDash compatibility
|
10 |
-
*/
|
11 |
-
class Cartflows_Learndash_Compatibility {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Member Variable
|
15 |
-
*
|
16 |
-
* @var instance
|
17 |
-
*/
|
18 |
-
private static $instance;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Initiator
|
22 |
-
*/
|
23 |
-
public static function get_instance() {
|
24 |
-
if ( ! isset( self::$instance ) ) {
|
25 |
-
self::$instance = new self();
|
26 |
-
}
|
27 |
-
return self::$instance;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Constructor
|
32 |
-
*/
|
33 |
-
public function __construct() {
|
34 |
-
add_filter( 'learndash_post_args', array( $this, 'cartflows_course_setting_fields' ) );
|
35 |
-
add_action( 'template_redirect', array( $this, 'cartflows_override_course_template' ) );
|
36 |
-
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Override course cartflows template.
|
41 |
-
*
|
42 |
-
* @return bool
|
43 |
-
*/
|
44 |
-
public function cartflows_override_course_template() {
|
45 |
-
|
46 |
-
// Don't run any code in admin area.
|
47 |
-
if ( is_admin() ) {
|
48 |
-
return false;
|
49 |
-
}
|
50 |
-
|
51 |
-
// Don't override the template if the post type is not `course`.
|
52 |
-
if ( ! is_singular( 'sfwd-courses' ) ) {
|
53 |
-
return false;
|
54 |
-
}
|
55 |
-
|
56 |
-
$course_id = learndash_get_course_id();
|
57 |
-
$user_id = get_current_user_id();
|
58 |
-
if ( is_user_logged_in() && sfwd_lms_has_access( $course_id, $user_id ) ) {
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
|
62 |
-
$template = get_course_meta_setting( get_the_id(), 'wcf_course_template' );
|
63 |
-
if ( 'none' !== $template && $template ) {
|
64 |
-
$link = get_permalink( $template );
|
65 |
-
wp_safe_redirect( $link );
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Add settings inside learndash settings.
|
71 |
-
*
|
72 |
-
* @param array $fields fields.
|
73 |
-
* @return mixed
|
74 |
-
*/
|
75 |
-
public function cartflows_course_setting_fields( $fields ) {
|
76 |
-
global $post;
|
77 |
-
|
78 |
-
$all_posts = array(
|
79 |
-
'none' => __( 'None', 'cartflows' ),
|
80 |
-
);
|
81 |
-
|
82 |
-
$landing_steps = get_posts(
|
83 |
-
array(
|
84 |
-
'posts_per_page' => -1,
|
85 |
-
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
86 |
-
'post_status' => 'publish',
|
87 |
-
'orderby' => 'ID',
|
88 |
-
'order' => 'DESC',
|
89 |
-
'meta_query' => array( //phpcs:ignore
|
90 |
-
array(
|
91 |
-
'key' => 'wcf-step-type',
|
92 |
-
'value' => array( 'landing', 'checkout' ),
|
93 |
-
'compare' => 'IN',
|
94 |
-
),
|
95 |
-
),
|
96 |
-
)
|
97 |
-
);
|
98 |
-
|
99 |
-
foreach ( $landing_steps as $landing_step ) {
|
100 |
-
$all_posts[ $landing_step->ID ] = get_the_title( $landing_step->ID ) . ' ( #' . $landing_step->ID . ')';
|
101 |
-
}
|
102 |
-
|
103 |
-
$selected = get_post_meta( get_the_ID(), 'wcf_course_template', true );
|
104 |
-
$description = sprintf(
|
105 |
-
/* translators: 1: anchor start, 2: anchor close */
|
106 |
-
__( 'Non-enrolled students will redirect to the selected CartFlows template. If you have not created any Flow already, add new Flow from %1$shere%2$s.', 'cartflows' ),
|
107 |
-
'<a href="' . esc_url( admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&add-new-flow' ) ) . '">',
|
108 |
-
'</a>'
|
109 |
-
);
|
110 |
-
|
111 |
-
$fields['sfwd-courses']['fields']['wcf_course_template'] = array(
|
112 |
-
'name' => __( 'Select CartFlows Template for this Course', 'cartflows' ),
|
113 |
-
'type' => 'select',
|
114 |
-
'initial_options' => $all_posts,
|
115 |
-
'default' => 'none',
|
116 |
-
'help_text' => $description,
|
117 |
-
'show_in_rest' => true,
|
118 |
-
'rest_args' => array(
|
119 |
-
'schema' => array(
|
120 |
-
'type' => 'string',
|
121 |
-
),
|
122 |
-
),
|
123 |
-
);
|
124 |
-
|
125 |
-
return $fields;
|
126 |
-
}
|
127 |
-
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Kicking this off by calling 'get_instance()' method
|
132 |
-
*/
|
133 |
-
Cartflows_Learndash_Compatibility::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* LearnDash compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class for LearnDash compatibility
|
10 |
+
*/
|
11 |
+
class Cartflows_Learndash_Compatibility {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Member Variable
|
15 |
+
*
|
16 |
+
* @var instance
|
17 |
+
*/
|
18 |
+
private static $instance;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Initiator
|
22 |
+
*/
|
23 |
+
public static function get_instance() {
|
24 |
+
if ( ! isset( self::$instance ) ) {
|
25 |
+
self::$instance = new self();
|
26 |
+
}
|
27 |
+
return self::$instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constructor
|
32 |
+
*/
|
33 |
+
public function __construct() {
|
34 |
+
add_filter( 'learndash_post_args', array( $this, 'cartflows_course_setting_fields' ) );
|
35 |
+
add_action( 'template_redirect', array( $this, 'cartflows_override_course_template' ) );
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Override course cartflows template.
|
41 |
+
*
|
42 |
+
* @return bool
|
43 |
+
*/
|
44 |
+
public function cartflows_override_course_template() {
|
45 |
+
|
46 |
+
// Don't run any code in admin area.
|
47 |
+
if ( is_admin() ) {
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
// Don't override the template if the post type is not `course`.
|
52 |
+
if ( ! is_singular( 'sfwd-courses' ) ) {
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
|
56 |
+
$course_id = learndash_get_course_id();
|
57 |
+
$user_id = get_current_user_id();
|
58 |
+
if ( is_user_logged_in() && sfwd_lms_has_access( $course_id, $user_id ) ) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
$template = get_course_meta_setting( get_the_id(), 'wcf_course_template' );
|
63 |
+
if ( 'none' !== $template && $template ) {
|
64 |
+
$link = get_permalink( $template );
|
65 |
+
wp_safe_redirect( $link );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Add settings inside learndash settings.
|
71 |
+
*
|
72 |
+
* @param array $fields fields.
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function cartflows_course_setting_fields( $fields ) {
|
76 |
+
global $post;
|
77 |
+
|
78 |
+
$all_posts = array(
|
79 |
+
'none' => __( 'None', 'cartflows' ),
|
80 |
+
);
|
81 |
+
|
82 |
+
$landing_steps = get_posts(
|
83 |
+
array(
|
84 |
+
'posts_per_page' => -1,
|
85 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
86 |
+
'post_status' => 'publish',
|
87 |
+
'orderby' => 'ID',
|
88 |
+
'order' => 'DESC',
|
89 |
+
'meta_query' => array( //phpcs:ignore
|
90 |
+
array(
|
91 |
+
'key' => 'wcf-step-type',
|
92 |
+
'value' => array( 'landing', 'checkout' ),
|
93 |
+
'compare' => 'IN',
|
94 |
+
),
|
95 |
+
),
|
96 |
+
)
|
97 |
+
);
|
98 |
+
|
99 |
+
foreach ( $landing_steps as $landing_step ) {
|
100 |
+
$all_posts[ $landing_step->ID ] = get_the_title( $landing_step->ID ) . ' ( #' . $landing_step->ID . ')';
|
101 |
+
}
|
102 |
+
|
103 |
+
$selected = get_post_meta( get_the_ID(), 'wcf_course_template', true );
|
104 |
+
$description = sprintf(
|
105 |
+
/* translators: 1: anchor start, 2: anchor close */
|
106 |
+
__( 'Non-enrolled students will redirect to the selected CartFlows template. If you have not created any Flow already, add new Flow from %1$shere%2$s.', 'cartflows' ),
|
107 |
+
'<a href="' . esc_url( admin_url( 'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE . '&add-new-flow' ) ) . '">',
|
108 |
+
'</a>'
|
109 |
+
);
|
110 |
+
|
111 |
+
$fields['sfwd-courses']['fields']['wcf_course_template'] = array(
|
112 |
+
'name' => __( 'Select CartFlows Template for this Course', 'cartflows' ),
|
113 |
+
'type' => 'select',
|
114 |
+
'initial_options' => $all_posts,
|
115 |
+
'default' => 'none',
|
116 |
+
'help_text' => $description,
|
117 |
+
'show_in_rest' => true,
|
118 |
+
'rest_args' => array(
|
119 |
+
'schema' => array(
|
120 |
+
'type' => 'string',
|
121 |
+
),
|
122 |
+
),
|
123 |
+
);
|
124 |
+
|
125 |
+
return $fields;
|
126 |
+
}
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Kicking this off by calling 'get_instance()' method
|
132 |
+
*/
|
133 |
+
Cartflows_Learndash_Compatibility::get_instance();
|
classes/class-cartflows-loader.php
CHANGED
@@ -126,7 +126,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
|
|
126 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
127 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
128 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
129 |
-
define( 'CARTFLOWS_VER', '1.3.
|
130 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
131 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
132 |
|
126 |
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
|
127 |
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
|
128 |
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
|
129 |
+
define( 'CARTFLOWS_VER', '1.3.3' );
|
130 |
define( 'CARTFLOWS_SLUG', 'cartflows' );
|
131 |
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
|
132 |
|
classes/class-cartflows-logger.php
CHANGED
@@ -157,7 +157,7 @@ class Cartflows_Logger {
|
|
157 |
|
158 |
if ( ! empty( $_REQUEST['handle'] ) ) {
|
159 |
|
160 |
-
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'remove_log' ) ) {
|
161 |
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'cartflows' ) );
|
162 |
}
|
163 |
wp_delete_file( CARTFLOWS_LOG_DIR . rtrim( $_REQUEST['handle'], '-log' ) . '.log' ); //phpcs:ignore
|
157 |
|
158 |
if ( ! empty( $_REQUEST['handle'] ) ) {
|
159 |
|
160 |
+
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'remove_log' ) ) {
|
161 |
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'cartflows' ) );
|
162 |
}
|
163 |
wp_delete_file( CARTFLOWS_LOG_DIR . rtrim( $_REQUEST['handle'], '-log' ) . '.log' ); //phpcs:ignore
|
classes/class-cartflows-meta.php
CHANGED
@@ -39,7 +39,7 @@ if ( ! class_exists( 'Cartflows_Meta' ) ) :
|
|
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
|
43 |
</a>
|
44 |
<?php } ?>
|
45 |
|
@@ -63,7 +63,7 @@ if ( ! class_exists( 'Cartflows_Meta' ) ) :
|
|
63 |
'label' => __( 'Custom Script', 'cartflows' ),
|
64 |
'name' => 'wcf-custom-script',
|
65 |
'value' => htmlspecialchars( $options['wcf-custom-script'], ENT_COMPAT, 'utf-8' ),
|
66 |
-
'help' =>
|
67 |
)
|
68 |
);
|
69 |
?>
|
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 esc_html_e( 'Back to edit Flow', 'cartflows' ); ?>
|
43 |
</a>
|
44 |
<?php } ?>
|
45 |
|
63 |
'label' => __( 'Custom Script', 'cartflows' ),
|
64 |
'name' => 'wcf-custom-script',
|
65 |
'value' => htmlspecialchars( $options['wcf-custom-script'], ENT_COMPAT, 'utf-8' ),
|
66 |
+
'help' => esc_html__( 'Custom script lets you add your own custom script on front end of this flow page.', 'cartflows' ),
|
67 |
)
|
68 |
);
|
69 |
?>
|
classes/class-cartflows-metabox.php
CHANGED
@@ -1,97 +1,97 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Update Compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_Metabox' ) ) :
|
9 |
-
|
10 |
-
/**
|
11 |
-
* CartFlows Update initial setup
|
12 |
-
*
|
13 |
-
* @since 1.0.0
|
14 |
-
*/
|
15 |
-
class Cartflows_Metabox {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Class instance.
|
19 |
-
*
|
20 |
-
* @access private
|
21 |
-
* @var $instance Class instance.
|
22 |
-
*/
|
23 |
-
private static $instance;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Initiator
|
27 |
-
*/
|
28 |
-
public static function get_instance() {
|
29 |
-
if ( ! isset( self::$instance ) ) {
|
30 |
-
self::$instance = new self();
|
31 |
-
}
|
32 |
-
return self::$instance;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Constructor
|
37 |
-
*/
|
38 |
-
public function __construct() {
|
39 |
-
add_action( 'admin_init', array( $this, 'add_wcf_order_metabox' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
*
|
44 |
-
* Add Analytics Metabox
|
45 |
-
*
|
46 |
-
* @return void
|
47 |
-
*/
|
48 |
-
public function add_wcf_order_metabox() {
|
49 |
-
|
50 |
-
if ( ! isset( $_GET['cartflows_debug'] ) ) {
|
51 |
-
return;
|
52 |
-
}
|
53 |
-
|
54 |
-
$debug = filter_input( INPUT_GET, 'cartflows_debug', FILTER_SANITIZE_STRING );
|
55 |
-
|
56 |
-
if ( $debug ) {
|
57 |
-
add_meta_box(
|
58 |
-
'wcf-order-details',
|
59 |
-
__( 'Flow Details', 'cartflows' ),
|
60 |
-
array( $this, 'flow_metabox_markup' ),
|
61 |
-
'shop_order',
|
62 |
-
'side',
|
63 |
-
'low'
|
64 |
-
);
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Flow metabox markup.
|
72 |
-
*/
|
73 |
-
public function flow_metabox_markup() {
|
74 |
-
global $post;
|
75 |
-
$flow_id = wcf()->utils->get_flow_id_from_order( $post->ID );
|
76 |
-
$checkout_id = wcf()->utils->get_checkout_id_from_order( $post->ID );
|
77 |
-
|
78 |
-
$html_data = "
|
79 |
-
<div>
|
80 |
-
<p> This is for debugging only. </p>
|
81 |
-
<p> <strong>Flow ID:</strong>: <a href='" . admin_url( 'post.php?post=' . $flow_id . '&action=edit' ) . "'> " . $flow_id . " </a> </p>
|
82 |
-
<p> <strong>Checkout ID:</strong> <a href='" . admin_url( 'post.php?post=' . $checkout_id . '&action=edit' ) . "'> " . $checkout_id . ' </a></p>
|
83 |
-
</div>
|
84 |
-
';
|
85 |
-
|
86 |
-
echo $html_data;
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Kicking this off by calling 'get_instance()' method
|
94 |
-
*/
|
95 |
-
Cartflows_Metabox::get_instance();
|
96 |
-
|
97 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Update Compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_Metabox' ) ) :
|
9 |
+
|
10 |
+
/**
|
11 |
+
* CartFlows Update initial setup
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
class Cartflows_Metabox {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class instance.
|
19 |
+
*
|
20 |
+
* @access private
|
21 |
+
* @var $instance Class instance.
|
22 |
+
*/
|
23 |
+
private static $instance;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Initiator
|
27 |
+
*/
|
28 |
+
public static function get_instance() {
|
29 |
+
if ( ! isset( self::$instance ) ) {
|
30 |
+
self::$instance = new self();
|
31 |
+
}
|
32 |
+
return self::$instance;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor
|
37 |
+
*/
|
38 |
+
public function __construct() {
|
39 |
+
add_action( 'admin_init', array( $this, 'add_wcf_order_metabox' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* Add Analytics Metabox
|
45 |
+
*
|
46 |
+
* @return void
|
47 |
+
*/
|
48 |
+
public function add_wcf_order_metabox() {
|
49 |
+
|
50 |
+
if ( ! isset( $_GET['cartflows_debug'] ) ) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
$debug = filter_input( INPUT_GET, 'cartflows_debug', FILTER_SANITIZE_STRING );
|
55 |
+
|
56 |
+
if ( $debug ) {
|
57 |
+
add_meta_box(
|
58 |
+
'wcf-order-details',
|
59 |
+
__( 'Flow Details', 'cartflows' ),
|
60 |
+
array( $this, 'flow_metabox_markup' ),
|
61 |
+
'shop_order',
|
62 |
+
'side',
|
63 |
+
'low'
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Flow metabox markup.
|
72 |
+
*/
|
73 |
+
public function flow_metabox_markup() {
|
74 |
+
global $post;
|
75 |
+
$flow_id = wcf()->utils->get_flow_id_from_order( $post->ID );
|
76 |
+
$checkout_id = wcf()->utils->get_checkout_id_from_order( $post->ID );
|
77 |
+
|
78 |
+
$html_data = "
|
79 |
+
<div>
|
80 |
+
<p> This is for debugging only. </p>
|
81 |
+
<p> <strong>Flow ID:</strong>: <a href='" . admin_url( 'post.php?post=' . $flow_id . '&action=edit' ) . "'> " . $flow_id . " </a> </p>
|
82 |
+
<p> <strong>Checkout ID:</strong> <a href='" . admin_url( 'post.php?post=' . $checkout_id . '&action=edit' ) . "'> " . $checkout_id . ' </a></p>
|
83 |
+
</div>
|
84 |
+
';
|
85 |
+
|
86 |
+
echo $html_data;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Kicking this off by calling 'get_instance()' method
|
94 |
+
*/
|
95 |
+
Cartflows_Metabox::get_instance();
|
96 |
+
|
97 |
+
endif;
|
classes/class-cartflows-session.php
CHANGED
@@ -46,7 +46,7 @@ class Cartflows_Session {
|
|
46 |
public function set_session( $flow_id, $data = array() ) {
|
47 |
|
48 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
49 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
50 |
} else {
|
51 |
$key = $flow_id . '_' . md5( time() . wp_rand() );
|
52 |
}
|
@@ -78,7 +78,7 @@ class Cartflows_Session {
|
|
78 |
$this->set_session( $flow_id, $data );
|
79 |
}
|
80 |
|
81 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
82 |
|
83 |
// Try to grab the transient from the database, if it exists.
|
84 |
$transient = get_transient( 'cartflows_data_' . $key );
|
@@ -101,7 +101,7 @@ class Cartflows_Session {
|
|
101 |
|
102 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
103 |
|
104 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
105 |
|
106 |
// Delete Transient.
|
107 |
delete_transient( 'cartflows_data_' . $key );
|
@@ -124,7 +124,7 @@ class Cartflows_Session {
|
|
124 |
|
125 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
126 |
|
127 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
128 |
|
129 |
$data = get_transient( 'cartflows_data_' . $key );
|
130 |
}
|
@@ -140,7 +140,7 @@ class Cartflows_Session {
|
|
140 |
|
141 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
142 |
|
143 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
144 |
|
145 |
// Try to grab the transient from the database, if it exists.
|
146 |
$transient = get_transient( 'cartflows_data_' . $key );
|
@@ -168,7 +168,7 @@ class Cartflows_Session {
|
|
168 |
|
169 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
170 |
|
171 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
172 |
|
173 |
// Try to grab the transient from the database, if it exists.
|
174 |
$transient = get_transient( 'cartflows_data_' . $key );
|
@@ -195,7 +195,7 @@ class Cartflows_Session {
|
|
195 |
if ( isset( $_GET['wcf-sk'] ) && isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
196 |
|
197 |
$sk = sanitize_text_field( wp_unslash( $_GET['wcf-sk'] ) );
|
198 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
199 |
|
200 |
if ( $sk === $key ) {
|
201 |
|
@@ -203,7 +203,7 @@ class Cartflows_Session {
|
|
203 |
|
204 |
// Get the order.
|
205 |
$order_id = empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] );
|
206 |
-
$order_key = empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) );
|
207 |
|
208 |
if ( $order_id > 0 ) {
|
209 |
|
@@ -230,7 +230,7 @@ class Cartflows_Session {
|
|
230 |
|
231 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
232 |
|
233 |
-
$key = (string) wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] );
|
234 |
|
235 |
return $key;
|
236 |
}
|
46 |
public function set_session( $flow_id, $data = array() ) {
|
47 |
|
48 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
49 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
50 |
} else {
|
51 |
$key = $flow_id . '_' . md5( time() . wp_rand() );
|
52 |
}
|
78 |
$this->set_session( $flow_id, $data );
|
79 |
}
|
80 |
|
81 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
82 |
|
83 |
// Try to grab the transient from the database, if it exists.
|
84 |
$transient = get_transient( 'cartflows_data_' . $key );
|
101 |
|
102 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
103 |
|
104 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
105 |
|
106 |
// Delete Transient.
|
107 |
delete_transient( 'cartflows_data_' . $key );
|
124 |
|
125 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
126 |
|
127 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
128 |
|
129 |
$data = get_transient( 'cartflows_data_' . $key );
|
130 |
}
|
140 |
|
141 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
142 |
|
143 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
144 |
|
145 |
// Try to grab the transient from the database, if it exists.
|
146 |
$transient = get_transient( 'cartflows_data_' . $key );
|
168 |
|
169 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
170 |
|
171 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
172 |
|
173 |
// Try to grab the transient from the database, if it exists.
|
174 |
$transient = get_transient( 'cartflows_data_' . $key );
|
195 |
if ( isset( $_GET['wcf-sk'] ) && isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
196 |
|
197 |
$sk = sanitize_text_field( wp_unslash( $_GET['wcf-sk'] ) );
|
198 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
199 |
|
200 |
if ( $sk === $key ) {
|
201 |
|
203 |
|
204 |
// Get the order.
|
205 |
$order_id = empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] );
|
206 |
+
$order_key = empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
|
207 |
|
208 |
if ( $order_id > 0 ) {
|
209 |
|
230 |
|
231 |
if ( isset( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) ) {
|
232 |
|
233 |
+
$key = (string) sanitize_text_field( wp_unslash( $_COOKIE[ 'cartflows_session_' . $flow_id ] ) );
|
234 |
|
235 |
return $key;
|
236 |
}
|
classes/class-cartflows-thrive-compatibility.php
CHANGED
@@ -1,77 +1,77 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Thrive Visual Editor Compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class for Thrive Visual Editor Compatibility
|
10 |
-
*/
|
11 |
-
class Cartflows_Thrive_Compatibility {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Member Variable
|
15 |
-
*
|
16 |
-
* @var instance
|
17 |
-
*/
|
18 |
-
private static $instance;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Initiator
|
22 |
-
*/
|
23 |
-
public static function get_instance() {
|
24 |
-
if ( ! isset( self::$instance ) ) {
|
25 |
-
self::$instance = new self();
|
26 |
-
}
|
27 |
-
return self::$instance;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Constructor
|
32 |
-
*/
|
33 |
-
public function __construct() {
|
34 |
-
|
35 |
-
// Add CartFlows post type in the thrive page editor.
|
36 |
-
// tve_landing_page_post_types.
|
37 |
-
add_filter( 'tve_post_type_can_use_landing_page', array( $this, 'send_post_type_to_thrive' ) );
|
38 |
-
|
39 |
-
add_filter( 'tcb_can_use_landing_pages', array( $this, 'display_change_template_option' ) );
|
40 |
-
|
41 |
-
add_filter( 'tcb_has_templates_tab', array( $this, 'display_change_template_option' ) );
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Return step post type for Thrive Architect.
|
46 |
-
*
|
47 |
-
* @since 1.0.0
|
48 |
-
* @param array $post_type_pt the current step post type.
|
49 |
-
* @return array $post_type_pt current step post type.
|
50 |
-
*/
|
51 |
-
public function send_post_type_to_thrive( $post_type_pt ) {
|
52 |
-
|
53 |
-
$post_type_pt[] = CARTFLOWS_STEP_POST_TYPE;
|
54 |
-
|
55 |
-
return $post_type_pt;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Return true/false to show change template option.
|
60 |
-
*
|
61 |
-
* @since 1.0.0
|
62 |
-
* @param array $bool true/false.
|
63 |
-
* @return array $bool true/false.
|
64 |
-
*/
|
65 |
-
public function display_change_template_option( $bool ) {
|
66 |
-
|
67 |
-
if ( wcf()->utils->is_step_post_type() ) {
|
68 |
-
$bool = true;
|
69 |
-
}
|
70 |
-
return $bool;
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Kicking this off by calling 'get_instance()' method
|
76 |
-
*/
|
77 |
-
Cartflows_Thrive_Compatibility::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Thrive Visual Editor Compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class for Thrive Visual Editor Compatibility
|
10 |
+
*/
|
11 |
+
class Cartflows_Thrive_Compatibility {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Member Variable
|
15 |
+
*
|
16 |
+
* @var instance
|
17 |
+
*/
|
18 |
+
private static $instance;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Initiator
|
22 |
+
*/
|
23 |
+
public static function get_instance() {
|
24 |
+
if ( ! isset( self::$instance ) ) {
|
25 |
+
self::$instance = new self();
|
26 |
+
}
|
27 |
+
return self::$instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Constructor
|
32 |
+
*/
|
33 |
+
public function __construct() {
|
34 |
+
|
35 |
+
// Add CartFlows post type in the thrive page editor.
|
36 |
+
// tve_landing_page_post_types.
|
37 |
+
add_filter( 'tve_post_type_can_use_landing_page', array( $this, 'send_post_type_to_thrive' ) );
|
38 |
+
|
39 |
+
add_filter( 'tcb_can_use_landing_pages', array( $this, 'display_change_template_option' ) );
|
40 |
+
|
41 |
+
add_filter( 'tcb_has_templates_tab', array( $this, 'display_change_template_option' ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Return step post type for Thrive Architect.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
* @param array $post_type_pt the current step post type.
|
49 |
+
* @return array $post_type_pt current step post type.
|
50 |
+
*/
|
51 |
+
public function send_post_type_to_thrive( $post_type_pt ) {
|
52 |
+
|
53 |
+
$post_type_pt[] = CARTFLOWS_STEP_POST_TYPE;
|
54 |
+
|
55 |
+
return $post_type_pt;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return true/false to show change template option.
|
60 |
+
*
|
61 |
+
* @since 1.0.0
|
62 |
+
* @param array $bool true/false.
|
63 |
+
* @return array $bool true/false.
|
64 |
+
*/
|
65 |
+
public function display_change_template_option( $bool ) {
|
66 |
+
|
67 |
+
if ( wcf()->utils->is_step_post_type() ) {
|
68 |
+
$bool = true;
|
69 |
+
}
|
70 |
+
return $bool;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Kicking this off by calling 'get_instance()' method
|
76 |
+
*/
|
77 |
+
Cartflows_Thrive_Compatibility::get_instance();
|
classes/class-cartflows-update.php
CHANGED
@@ -1,146 +1,146 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Update Compatibility
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Cartflows_Update' ) ) :
|
9 |
-
|
10 |
-
/**
|
11 |
-
* CartFlows Update initial setup
|
12 |
-
*
|
13 |
-
* @since 1.0.0
|
14 |
-
*/
|
15 |
-
class Cartflows_Update {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Class instance.
|
19 |
-
*
|
20 |
-
* @access private
|
21 |
-
* @var $instance Class instance.
|
22 |
-
*/
|
23 |
-
private static $instance;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Initiator
|
27 |
-
*/
|
28 |
-
public static function get_instance() {
|
29 |
-
if ( ! isset( self::$instance ) ) {
|
30 |
-
self::$instance = new self();
|
31 |
-
}
|
32 |
-
return self::$instance;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Constructor
|
37 |
-
*/
|
38 |
-
public function __construct() {
|
39 |
-
add_action( 'admin_init', array( $this, 'init' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Init
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
* @return void
|
47 |
-
*/
|
48 |
-
public function init() {
|
49 |
-
|
50 |
-
do_action( 'cartflows_update_before' );
|
51 |
-
|
52 |
-
// Get auto saved version number.
|
53 |
-
$saved_version = get_option( 'cartflows-version', false );
|
54 |
-
|
55 |
-
// Update auto saved version number.
|
56 |
-
if ( ! $saved_version ) {
|
57 |
-
update_option( 'cartflows-version', CARTFLOWS_VER );
|
58 |
-
return;
|
59 |
-
}
|
60 |
-
|
61 |
-
// If equals then return.
|
62 |
-
if ( version_compare( $saved_version, CARTFLOWS_VER, '=' ) ) {
|
63 |
-
return;
|
64 |
-
}
|
65 |
-
|
66 |
-
$this->logger_files();
|
67 |
-
|
68 |
-
if ( version_compare( $saved_version, '1.1.22', '<' ) ) {
|
69 |
-
update_option( 'wcf_setup_skipped', true );
|
70 |
-
}
|
71 |
-
|
72 |
-
if ( version_compare( $saved_version, '1.2.0', '<' ) ) {
|
73 |
-
|
74 |
-
$this->changed_wp_templates();
|
75 |
-
}
|
76 |
-
|
77 |
-
// Update auto saved version number.
|
78 |
-
update_option( 'cartflows-version', CARTFLOWS_VER );
|
79 |
-
|
80 |
-
do_action( 'cartflows_update_after' );
|
81 |
-
}
|
82 |
-
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Loading logger files.
|
86 |
-
*
|
87 |
-
* @since 1.0.0
|
88 |
-
* @return void
|
89 |
-
*/
|
90 |
-
public function logger_files() {
|
91 |
-
|
92 |
-
if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
|
93 |
-
|
94 |
-
$upload_dir = wp_upload_dir( null, false );
|
95 |
-
|
96 |
-
define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
|
97 |
-
}
|
98 |
-
|
99 |
-
wcf()->create_files();
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Init
|
104 |
-
*
|
105 |
-
* @since 1.0.0
|
106 |
-
* @return void
|
107 |
-
*/
|
108 |
-
public function changed_wp_templates() {
|
109 |
-
|
110 |
-
global $wpdb;
|
111 |
-
|
112 |
-
$query_results = $wpdb->get_results(
|
113 |
-
$wpdb->prepare(
|
114 |
-
"SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )
|
115 |
-
where {$wpdb->posts}.post_type = %s AND {$wpdb->postmeta}.meta_key = %s AND {$wpdb->postmeta}.meta_value != %s AND {$wpdb->postmeta}.meta_value != %s",
|
116 |
-
'cartflows_step',
|
117 |
-
'_wp_page_template',
|
118 |
-
'cartflows-canvas',
|
119 |
-
'cartflows-default'
|
120 |
-
)
|
121 |
-
); // db call ok; no-cache ok.
|
122 |
-
|
123 |
-
if ( is_array( $query_results ) && ! empty( $query_results ) ) {
|
124 |
-
|
125 |
-
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-change-template-batch.php';
|
126 |
-
|
127 |
-
wcf()->logger->log( '(✓) Update Templates BATCH Started!' );
|
128 |
-
|
129 |
-
$change_template_batch = new Cartflows_Change_Template_Batch();
|
130 |
-
|
131 |
-
foreach ( $query_results as $query_result ) {
|
132 |
-
|
133 |
-
wcf()->logger->log( '(✓) POST ID ' . $query_result->ID );
|
134 |
-
$change_template_batch->push_to_queue( $query_result->ID );
|
135 |
-
}
|
136 |
-
|
137 |
-
$change_template_batch->save()->dispatch();
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
/**
|
142 |
-
* Kicking this off by calling 'get_instance()' method
|
143 |
-
*/
|
144 |
-
Cartflows_Update::get_instance();
|
145 |
-
|
146 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Update Compatibility
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! class_exists( 'Cartflows_Update' ) ) :
|
9 |
+
|
10 |
+
/**
|
11 |
+
* CartFlows Update initial setup
|
12 |
+
*
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
class Cartflows_Update {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class instance.
|
19 |
+
*
|
20 |
+
* @access private
|
21 |
+
* @var $instance Class instance.
|
22 |
+
*/
|
23 |
+
private static $instance;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Initiator
|
27 |
+
*/
|
28 |
+
public static function get_instance() {
|
29 |
+
if ( ! isset( self::$instance ) ) {
|
30 |
+
self::$instance = new self();
|
31 |
+
}
|
32 |
+
return self::$instance;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructor
|
37 |
+
*/
|
38 |
+
public function __construct() {
|
39 |
+
add_action( 'admin_init', array( $this, 'init' ) );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Init
|
44 |
+
*
|
45 |
+
* @since 1.0.0
|
46 |
+
* @return void
|
47 |
+
*/
|
48 |
+
public function init() {
|
49 |
+
|
50 |
+
do_action( 'cartflows_update_before' );
|
51 |
+
|
52 |
+
// Get auto saved version number.
|
53 |
+
$saved_version = get_option( 'cartflows-version', false );
|
54 |
+
|
55 |
+
// Update auto saved version number.
|
56 |
+
if ( ! $saved_version ) {
|
57 |
+
update_option( 'cartflows-version', CARTFLOWS_VER );
|
58 |
+
return;
|
59 |
+
}
|
60 |
+
|
61 |
+
// If equals then return.
|
62 |
+
if ( version_compare( $saved_version, CARTFLOWS_VER, '=' ) ) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->logger_files();
|
67 |
+
|
68 |
+
if ( version_compare( $saved_version, '1.1.22', '<' ) ) {
|
69 |
+
update_option( 'wcf_setup_skipped', true );
|
70 |
+
}
|
71 |
+
|
72 |
+
if ( version_compare( $saved_version, '1.2.0', '<' ) ) {
|
73 |
+
|
74 |
+
$this->changed_wp_templates();
|
75 |
+
}
|
76 |
+
|
77 |
+
// Update auto saved version number.
|
78 |
+
update_option( 'cartflows-version', CARTFLOWS_VER );
|
79 |
+
|
80 |
+
do_action( 'cartflows_update_after' );
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Loading logger files.
|
86 |
+
*
|
87 |
+
* @since 1.0.0
|
88 |
+
* @return void
|
89 |
+
*/
|
90 |
+
public function logger_files() {
|
91 |
+
|
92 |
+
if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
|
93 |
+
|
94 |
+
$upload_dir = wp_upload_dir( null, false );
|
95 |
+
|
96 |
+
define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
|
97 |
+
}
|
98 |
+
|
99 |
+
wcf()->create_files();
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Init
|
104 |
+
*
|
105 |
+
* @since 1.0.0
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
public function changed_wp_templates() {
|
109 |
+
|
110 |
+
global $wpdb;
|
111 |
+
|
112 |
+
$query_results = $wpdb->get_results(
|
113 |
+
$wpdb->prepare(
|
114 |
+
"SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )
|
115 |
+
where {$wpdb->posts}.post_type = %s AND {$wpdb->postmeta}.meta_key = %s AND {$wpdb->postmeta}.meta_value != %s AND {$wpdb->postmeta}.meta_value != %s",
|
116 |
+
'cartflows_step',
|
117 |
+
'_wp_page_template',
|
118 |
+
'cartflows-canvas',
|
119 |
+
'cartflows-default'
|
120 |
+
)
|
121 |
+
); // db call ok; no-cache ok.
|
122 |
+
|
123 |
+
if ( is_array( $query_results ) && ! empty( $query_results ) ) {
|
124 |
+
|
125 |
+
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-change-template-batch.php';
|
126 |
+
|
127 |
+
wcf()->logger->log( '(✓) Update Templates BATCH Started!' );
|
128 |
+
|
129 |
+
$change_template_batch = new Cartflows_Change_Template_Batch();
|
130 |
+
|
131 |
+
foreach ( $query_results as $query_result ) {
|
132 |
+
|
133 |
+
wcf()->logger->log( '(✓) POST ID ' . $query_result->ID );
|
134 |
+
$change_template_batch->push_to_queue( $query_result->ID );
|
135 |
+
}
|
136 |
+
|
137 |
+
$change_template_batch->save()->dispatch();
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
/**
|
142 |
+
* Kicking this off by calling 'get_instance()' method
|
143 |
+
*/
|
144 |
+
Cartflows_Update::get_instance();
|
145 |
+
|
146 |
+
endif;
|
classes/class-cartflows-utils.php
CHANGED
@@ -1,425 +1,425 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Utils.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit; // Exit if accessed directly.
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class Cartflows_Utils.
|
14 |
-
*/
|
15 |
-
class Cartflows_Utils {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Member Variable
|
19 |
-
*
|
20 |
-
* @var instance
|
21 |
-
*/
|
22 |
-
private static $instance;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Initiator
|
26 |
-
*/
|
27 |
-
public static function get_instance() {
|
28 |
-
if ( ! isset( self::$instance ) ) {
|
29 |
-
self::$instance = new self();
|
30 |
-
}
|
31 |
-
return self::$instance;
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Constructor
|
36 |
-
*/
|
37 |
-
public function __construct() {
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Get current post type
|
42 |
-
*
|
43 |
-
* @param string $post_type post type.
|
44 |
-
* @return string
|
45 |
-
*/
|
46 |
-
public function current_post_type( $post_type = '' ) {
|
47 |
-
|
48 |
-
if ( '' === $post_type ) {
|
49 |
-
$post_type = get_post_type();
|
50 |
-
}
|
51 |
-
|
52 |
-
return $post_type;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Check if post type is of step.
|
57 |
-
*
|
58 |
-
* @param string $post_type post type.
|
59 |
-
* @return bool
|
60 |
-
*/
|
61 |
-
public function is_step_post_type( $post_type = '' ) {
|
62 |
-
|
63 |
-
if ( $this->get_step_post_type() === $this->current_post_type( $post_type ) ) {
|
64 |
-
|
65 |
-
return true;
|
66 |
-
}
|
67 |
-
|
68 |
-
return false;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Check if post type is of flow.
|
73 |
-
*
|
74 |
-
* @param string $post_type post type.
|
75 |
-
* @return bool
|
76 |
-
*/
|
77 |
-
public function is_flow_post_type( $post_type = '' ) {
|
78 |
-
|
79 |
-
if ( $this->get_flow_post_type() === $this->current_post_type( $post_type ) ) {
|
80 |
-
|
81 |
-
return true;
|
82 |
-
}
|
83 |
-
|
84 |
-
return false;
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Get post type of step.
|
89 |
-
*
|
90 |
-
* @return string
|
91 |
-
*/
|
92 |
-
public function get_step_post_type() {
|
93 |
-
|
94 |
-
return CARTFLOWS_STEP_POST_TYPE;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Get post type of flow.
|
99 |
-
*
|
100 |
-
* @return string
|
101 |
-
*/
|
102 |
-
public function get_flow_post_type() {
|
103 |
-
|
104 |
-
return CARTFLOWS_FLOW_POST_TYPE;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Get flow id
|
109 |
-
*
|
110 |
-
* @return int
|
111 |
-
*/
|
112 |
-
public function get_flow_id() {
|
113 |
-
|
114 |
-
global $post;
|
115 |
-
|
116 |
-
return get_post_meta( $post->ID, 'wcf-flow-id', true );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Get flow id by step
|
121 |
-
*
|
122 |
-
* @param int $step_id step ID.
|
123 |
-
* @return int
|
124 |
-
*/
|
125 |
-
public function get_flow_id_from_step_id( $step_id ) {
|
126 |
-
|
127 |
-
return get_post_meta( $step_id, 'wcf-flow-id', true );
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Get flow steps by id
|
132 |
-
*
|
133 |
-
* @param int $flow_id flow ID.
|
134 |
-
* @return int
|
135 |
-
*/
|
136 |
-
public function get_flow_steps( $flow_id ) {
|
137 |
-
|
138 |
-
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
139 |
-
|
140 |
-
if ( is_array( $steps ) && ! empty( $steps ) ) {
|
141 |
-
return $steps;
|
142 |
-
}
|
143 |
-
|
144 |
-
return false;
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Get template type of step
|
149 |
-
*
|
150 |
-
* @param int $step_id step ID.
|
151 |
-
* @return int
|
152 |
-
*/
|
153 |
-
public function get_step_type( $step_id ) {
|
154 |
-
|
155 |
-
return get_post_meta( $step_id, 'wcf-step-type', true );
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Get next id for step
|
160 |
-
*
|
161 |
-
* @param int $flow_id flow ID.
|
162 |
-
* @param int $step_id step ID.
|
163 |
-
* @return bool
|
164 |
-
*/
|
165 |
-
public function get_next_step_id( $flow_id, $step_id ) {
|
166 |
-
|
167 |
-
$steps = $this->get_flow_steps( $flow_id );
|
168 |
-
$step_id = intval( $step_id );
|
169 |
-
|
170 |
-
if ( ! $steps ) {
|
171 |
-
return false;
|
172 |
-
}
|
173 |
-
|
174 |
-
foreach ( $steps as $i => $step ) {
|
175 |
-
|
176 |
-
if ( intval( $step['id'] ) === $step_id ) {
|
177 |
-
|
178 |
-
$next_i = $i + 1;
|
179 |
-
|
180 |
-
if ( isset( $steps[ $next_i ] ) ) {
|
181 |
-
|
182 |
-
$navigation = $steps[ $next_i ];
|
183 |
-
|
184 |
-
return intval( $navigation['id'] );
|
185 |
-
}
|
186 |
-
|
187 |
-
break;
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
return false;
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Get next id for step
|
196 |
-
*
|
197 |
-
* @param int $order_id order ID.
|
198 |
-
* @return int
|
199 |
-
*/
|
200 |
-
public function get_flow_id_from_order( $order_id ) {
|
201 |
-
|
202 |
-
$flow_id = get_post_meta( $order_id, '_wcf_flow_id', true );
|
203 |
-
|
204 |
-
return intval( $flow_id );
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Get checkout id for order
|
209 |
-
*
|
210 |
-
* @param int $order_id order ID.
|
211 |
-
* @return int
|
212 |
-
*/
|
213 |
-
public function get_checkout_id_from_order( $order_id ) {
|
214 |
-
|
215 |
-
$checkout_id = get_post_meta( $order_id, '_wcf_checkout_id', true );
|
216 |
-
|
217 |
-
return intval( $checkout_id );
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* We are using this function mostly in ajax on checkout page
|
222 |
-
*
|
223 |
-
* @return bool
|
224 |
-
*/
|
225 |
-
public function get_checkout_id_from_post_data() {
|
226 |
-
|
227 |
-
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
228 |
-
|
229 |
-
$checkout_id = filter_var( wp_unslash( $_POST['_wcf_checkout_id'] ), FILTER_SANITIZE_NUMBER_INT );
|
230 |
-
|
231 |
-
return intval( $checkout_id );
|
232 |
-
}
|
233 |
-
|
234 |
-
return false;
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* We are using this function mostly in ajax on checkout page
|
239 |
-
*
|
240 |
-
* @return bool
|
241 |
-
*/
|
242 |
-
public function get_flow_id_from_post_data() {
|
243 |
-
|
244 |
-
if ( isset( $_POST['_wcf_flow_id'] ) ) {
|
245 |
-
|
246 |
-
$flow_id = filter_var( wp_unslash( $_POST['_wcf_flow_id'] ), FILTER_SANITIZE_NUMBER_INT );
|
247 |
-
|
248 |
-
return intval( $flow_id );
|
249 |
-
}
|
250 |
-
|
251 |
-
return false;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Check for thank you page
|
256 |
-
*
|
257 |
-
* @param int $step_id step ID.
|
258 |
-
* @return bool
|
259 |
-
*/
|
260 |
-
public function check_is_thankyou_page( $step_id ) {
|
261 |
-
|
262 |
-
$step_type = $this->get_step_type( $step_id );
|
263 |
-
|
264 |
-
if ( 'thankyou' === $step_type ) {
|
265 |
-
|
266 |
-
return true;
|
267 |
-
}
|
268 |
-
|
269 |
-
return false;
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Check for offer page
|
274 |
-
*
|
275 |
-
* @param int $step_id step ID.
|
276 |
-
* @return bool
|
277 |
-
*/
|
278 |
-
public function check_is_offer_page( $step_id ) {
|
279 |
-
|
280 |
-
$step_type = $this->get_step_type( $step_id );
|
281 |
-
|
282 |
-
if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
|
283 |
-
|
284 |
-
return true;
|
285 |
-
}
|
286 |
-
|
287 |
-
return false;
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Check if loaded page requires woo.
|
292 |
-
*
|
293 |
-
* @return bool
|
294 |
-
*/
|
295 |
-
public function check_is_woo_required_page() {
|
296 |
-
|
297 |
-
global $post;
|
298 |
-
$step_id = $post->ID;
|
299 |
-
$woo_not_required_type = array( 'landing' );
|
300 |
-
$step_type = $this->get_step_type( $step_id );
|
301 |
-
return ( ! in_array( $step_type, $woo_not_required_type, true ) );
|
302 |
-
}
|
303 |
-
|
304 |
-
/**
|
305 |
-
* Define constant for cache
|
306 |
-
*
|
307 |
-
* @return void
|
308 |
-
*/
|
309 |
-
public function do_not_cache() {
|
310 |
-
|
311 |
-
wcf_maybe_define_constant( 'DONOTCACHEPAGE', true );
|
312 |
-
wcf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
|
313 |
-
wcf_maybe_define_constant( 'DONOTCACHEDB', true );
|
314 |
-
|
315 |
-
nocache_headers();
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Get linking url
|
320 |
-
*
|
321 |
-
* @param array $args query args.
|
322 |
-
* @return string
|
323 |
-
*/
|
324 |
-
public function get_linking_url( $args = array() ) {
|
325 |
-
|
326 |
-
$url = get_home_url();
|
327 |
-
|
328 |
-
$url = add_query_arg( $args, $url );
|
329 |
-
|
330 |
-
return $url;
|
331 |
-
}
|
332 |
-
|
333 |
-
/**
|
334 |
-
* Get assets urls
|
335 |
-
*
|
336 |
-
* @return array
|
337 |
-
* @since 1.1.6
|
338 |
-
*/
|
339 |
-
public function get_assets_path() {
|
340 |
-
|
341 |
-
$rtl = '';
|
342 |
-
|
343 |
-
if ( is_rtl() ) {
|
344 |
-
$rtl = '-rtl';
|
345 |
-
}
|
346 |
-
|
347 |
-
$file_prefix = '';
|
348 |
-
$dir_name = '';
|
349 |
-
|
350 |
-
$is_min = apply_filters( 'cartflows_load_min_assets', false );
|
351 |
-
|
352 |
-
if ( $is_min ) {
|
353 |
-
$file_prefix = '.min';
|
354 |
-
$dir_name = 'min-';
|
355 |
-
}
|
356 |
-
|
357 |
-
$js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
|
358 |
-
$css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
|
359 |
-
|
360 |
-
return array(
|
361 |
-
'css' => $css_gen_path,
|
362 |
-
'js' => $js_gen_path,
|
363 |
-
'file_prefix' => $file_prefix,
|
364 |
-
'rtl' => $rtl,
|
365 |
-
);
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Get assets css url
|
370 |
-
*
|
371 |
-
* @param string $file file name.
|
372 |
-
* @return string
|
373 |
-
* @since 1.1.6
|
374 |
-
*/
|
375 |
-
public function get_css_url( $file ) {
|
376 |
-
|
377 |
-
$assets_vars = wcf()->assets_vars;
|
378 |
-
|
379 |
-
$url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
|
380 |
-
|
381 |
-
return $url;
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Get assets js url
|
386 |
-
*
|
387 |
-
* @param string $file file name.
|
388 |
-
* @return string
|
389 |
-
* @since 1.1.6
|
390 |
-
*/
|
391 |
-
public function get_js_url( $file ) {
|
392 |
-
|
393 |
-
$assets_vars = wcf()->assets_vars;
|
394 |
-
|
395 |
-
$url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
|
396 |
-
|
397 |
-
return $url;
|
398 |
-
}
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* Get a specific property of an array without needing to check if that property exists.
|
403 |
-
*
|
404 |
-
* Provide a default value if you want to return a specific value if the property is not set.
|
405 |
-
*
|
406 |
-
* @param array $array Array from which the property's value should be retrieved.
|
407 |
-
* @param string $prop Name of the property to be retrieved.
|
408 |
-
* @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
|
409 |
-
*
|
410 |
-
* @return null|string|mixed The value
|
411 |
-
*/
|
412 |
-
function wcf_get_prop( $array, $prop, $default = null ) {
|
413 |
-
|
414 |
-
if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
|
415 |
-
return $default;
|
416 |
-
}
|
417 |
-
|
418 |
-
if ( isset( $array[ $prop ] ) ) {
|
419 |
-
$value = $array[ $prop ];
|
420 |
-
} else {
|
421 |
-
$value = '';
|
422 |
-
}
|
423 |
-
|
424 |
-
return empty( $value ) && null !== $default ? $default : $value;
|
425 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Utils.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly.
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class Cartflows_Utils.
|
14 |
+
*/
|
15 |
+
class Cartflows_Utils {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Member Variable
|
19 |
+
*
|
20 |
+
* @var instance
|
21 |
+
*/
|
22 |
+
private static $instance;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Initiator
|
26 |
+
*/
|
27 |
+
public static function get_instance() {
|
28 |
+
if ( ! isset( self::$instance ) ) {
|
29 |
+
self::$instance = new self();
|
30 |
+
}
|
31 |
+
return self::$instance;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get current post type
|
42 |
+
*
|
43 |
+
* @param string $post_type post type.
|
44 |
+
* @return string
|
45 |
+
*/
|
46 |
+
public function current_post_type( $post_type = '' ) {
|
47 |
+
|
48 |
+
if ( '' === $post_type ) {
|
49 |
+
$post_type = get_post_type();
|
50 |
+
}
|
51 |
+
|
52 |
+
return $post_type;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Check if post type is of step.
|
57 |
+
*
|
58 |
+
* @param string $post_type post type.
|
59 |
+
* @return bool
|
60 |
+
*/
|
61 |
+
public function is_step_post_type( $post_type = '' ) {
|
62 |
+
|
63 |
+
if ( $this->get_step_post_type() === $this->current_post_type( $post_type ) ) {
|
64 |
+
|
65 |
+
return true;
|
66 |
+
}
|
67 |
+
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Check if post type is of flow.
|
73 |
+
*
|
74 |
+
* @param string $post_type post type.
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
public function is_flow_post_type( $post_type = '' ) {
|
78 |
+
|
79 |
+
if ( $this->get_flow_post_type() === $this->current_post_type( $post_type ) ) {
|
80 |
+
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get post type of step.
|
89 |
+
*
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
public function get_step_post_type() {
|
93 |
+
|
94 |
+
return CARTFLOWS_STEP_POST_TYPE;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Get post type of flow.
|
99 |
+
*
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function get_flow_post_type() {
|
103 |
+
|
104 |
+
return CARTFLOWS_FLOW_POST_TYPE;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Get flow id
|
109 |
+
*
|
110 |
+
* @return int
|
111 |
+
*/
|
112 |
+
public function get_flow_id() {
|
113 |
+
|
114 |
+
global $post;
|
115 |
+
|
116 |
+
return get_post_meta( $post->ID, 'wcf-flow-id', true );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get flow id by step
|
121 |
+
*
|
122 |
+
* @param int $step_id step ID.
|
123 |
+
* @return int
|
124 |
+
*/
|
125 |
+
public function get_flow_id_from_step_id( $step_id ) {
|
126 |
+
|
127 |
+
return get_post_meta( $step_id, 'wcf-flow-id', true );
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Get flow steps by id
|
132 |
+
*
|
133 |
+
* @param int $flow_id flow ID.
|
134 |
+
* @return int
|
135 |
+
*/
|
136 |
+
public function get_flow_steps( $flow_id ) {
|
137 |
+
|
138 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
139 |
+
|
140 |
+
if ( is_array( $steps ) && ! empty( $steps ) ) {
|
141 |
+
return $steps;
|
142 |
+
}
|
143 |
+
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Get template type of step
|
149 |
+
*
|
150 |
+
* @param int $step_id step ID.
|
151 |
+
* @return int
|
152 |
+
*/
|
153 |
+
public function get_step_type( $step_id ) {
|
154 |
+
|
155 |
+
return get_post_meta( $step_id, 'wcf-step-type', true );
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Get next id for step
|
160 |
+
*
|
161 |
+
* @param int $flow_id flow ID.
|
162 |
+
* @param int $step_id step ID.
|
163 |
+
* @return bool
|
164 |
+
*/
|
165 |
+
public function get_next_step_id( $flow_id, $step_id ) {
|
166 |
+
|
167 |
+
$steps = $this->get_flow_steps( $flow_id );
|
168 |
+
$step_id = intval( $step_id );
|
169 |
+
|
170 |
+
if ( ! $steps ) {
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
|
174 |
+
foreach ( $steps as $i => $step ) {
|
175 |
+
|
176 |
+
if ( intval( $step['id'] ) === $step_id ) {
|
177 |
+
|
178 |
+
$next_i = $i + 1;
|
179 |
+
|
180 |
+
if ( isset( $steps[ $next_i ] ) ) {
|
181 |
+
|
182 |
+
$navigation = $steps[ $next_i ];
|
183 |
+
|
184 |
+
return intval( $navigation['id'] );
|
185 |
+
}
|
186 |
+
|
187 |
+
break;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Get next id for step
|
196 |
+
*
|
197 |
+
* @param int $order_id order ID.
|
198 |
+
* @return int
|
199 |
+
*/
|
200 |
+
public function get_flow_id_from_order( $order_id ) {
|
201 |
+
|
202 |
+
$flow_id = get_post_meta( $order_id, '_wcf_flow_id', true );
|
203 |
+
|
204 |
+
return intval( $flow_id );
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Get checkout id for order
|
209 |
+
*
|
210 |
+
* @param int $order_id order ID.
|
211 |
+
* @return int
|
212 |
+
*/
|
213 |
+
public function get_checkout_id_from_order( $order_id ) {
|
214 |
+
|
215 |
+
$checkout_id = get_post_meta( $order_id, '_wcf_checkout_id', true );
|
216 |
+
|
217 |
+
return intval( $checkout_id );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* We are using this function mostly in ajax on checkout page
|
222 |
+
*
|
223 |
+
* @return bool
|
224 |
+
*/
|
225 |
+
public function get_checkout_id_from_post_data() {
|
226 |
+
|
227 |
+
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
228 |
+
|
229 |
+
$checkout_id = filter_var( wp_unslash( $_POST['_wcf_checkout_id'] ), FILTER_SANITIZE_NUMBER_INT );
|
230 |
+
|
231 |
+
return intval( $checkout_id );
|
232 |
+
}
|
233 |
+
|
234 |
+
return false;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* We are using this function mostly in ajax on checkout page
|
239 |
+
*
|
240 |
+
* @return bool
|
241 |
+
*/
|
242 |
+
public function get_flow_id_from_post_data() {
|
243 |
+
|
244 |
+
if ( isset( $_POST['_wcf_flow_id'] ) ) {
|
245 |
+
|
246 |
+
$flow_id = filter_var( wp_unslash( $_POST['_wcf_flow_id'] ), FILTER_SANITIZE_NUMBER_INT );
|
247 |
+
|
248 |
+
return intval( $flow_id );
|
249 |
+
}
|
250 |
+
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Check for thank you page
|
256 |
+
*
|
257 |
+
* @param int $step_id step ID.
|
258 |
+
* @return bool
|
259 |
+
*/
|
260 |
+
public function check_is_thankyou_page( $step_id ) {
|
261 |
+
|
262 |
+
$step_type = $this->get_step_type( $step_id );
|
263 |
+
|
264 |
+
if ( 'thankyou' === $step_type ) {
|
265 |
+
|
266 |
+
return true;
|
267 |
+
}
|
268 |
+
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Check for offer page
|
274 |
+
*
|
275 |
+
* @param int $step_id step ID.
|
276 |
+
* @return bool
|
277 |
+
*/
|
278 |
+
public function check_is_offer_page( $step_id ) {
|
279 |
+
|
280 |
+
$step_type = $this->get_step_type( $step_id );
|
281 |
+
|
282 |
+
if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
|
283 |
+
|
284 |
+
return true;
|
285 |
+
}
|
286 |
+
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Check if loaded page requires woo.
|
292 |
+
*
|
293 |
+
* @return bool
|
294 |
+
*/
|
295 |
+
public function check_is_woo_required_page() {
|
296 |
+
|
297 |
+
global $post;
|
298 |
+
$step_id = $post->ID;
|
299 |
+
$woo_not_required_type = array( 'landing' );
|
300 |
+
$step_type = $this->get_step_type( $step_id );
|
301 |
+
return ( ! in_array( $step_type, $woo_not_required_type, true ) );
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Define constant for cache
|
306 |
+
*
|
307 |
+
* @return void
|
308 |
+
*/
|
309 |
+
public function do_not_cache() {
|
310 |
+
|
311 |
+
wcf_maybe_define_constant( 'DONOTCACHEPAGE', true );
|
312 |
+
wcf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
|
313 |
+
wcf_maybe_define_constant( 'DONOTCACHEDB', true );
|
314 |
+
|
315 |
+
nocache_headers();
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Get linking url
|
320 |
+
*
|
321 |
+
* @param array $args query args.
|
322 |
+
* @return string
|
323 |
+
*/
|
324 |
+
public function get_linking_url( $args = array() ) {
|
325 |
+
|
326 |
+
$url = get_home_url();
|
327 |
+
|
328 |
+
$url = add_query_arg( $args, $url );
|
329 |
+
|
330 |
+
return $url;
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Get assets urls
|
335 |
+
*
|
336 |
+
* @return array
|
337 |
+
* @since 1.1.6
|
338 |
+
*/
|
339 |
+
public function get_assets_path() {
|
340 |
+
|
341 |
+
$rtl = '';
|
342 |
+
|
343 |
+
if ( is_rtl() ) {
|
344 |
+
$rtl = '-rtl';
|
345 |
+
}
|
346 |
+
|
347 |
+
$file_prefix = '';
|
348 |
+
$dir_name = '';
|
349 |
+
|
350 |
+
$is_min = apply_filters( 'cartflows_load_min_assets', false );
|
351 |
+
|
352 |
+
if ( $is_min ) {
|
353 |
+
$file_prefix = '.min';
|
354 |
+
$dir_name = 'min-';
|
355 |
+
}
|
356 |
+
|
357 |
+
$js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
|
358 |
+
$css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
|
359 |
+
|
360 |
+
return array(
|
361 |
+
'css' => $css_gen_path,
|
362 |
+
'js' => $js_gen_path,
|
363 |
+
'file_prefix' => $file_prefix,
|
364 |
+
'rtl' => $rtl,
|
365 |
+
);
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Get assets css url
|
370 |
+
*
|
371 |
+
* @param string $file file name.
|
372 |
+
* @return string
|
373 |
+
* @since 1.1.6
|
374 |
+
*/
|
375 |
+
public function get_css_url( $file ) {
|
376 |
+
|
377 |
+
$assets_vars = wcf()->assets_vars;
|
378 |
+
|
379 |
+
$url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
|
380 |
+
|
381 |
+
return $url;
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Get assets js url
|
386 |
+
*
|
387 |
+
* @param string $file file name.
|
388 |
+
* @return string
|
389 |
+
* @since 1.1.6
|
390 |
+
*/
|
391 |
+
public function get_js_url( $file ) {
|
392 |
+
|
393 |
+
$assets_vars = wcf()->assets_vars;
|
394 |
+
|
395 |
+
$url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
|
396 |
+
|
397 |
+
return $url;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Get a specific property of an array without needing to check if that property exists.
|
403 |
+
*
|
404 |
+
* Provide a default value if you want to return a specific value if the property is not set.
|
405 |
+
*
|
406 |
+
* @param array $array Array from which the property's value should be retrieved.
|
407 |
+
* @param string $prop Name of the property to be retrieved.
|
408 |
+
* @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
|
409 |
+
*
|
410 |
+
* @return null|string|mixed The value
|
411 |
+
*/
|
412 |
+
function wcf_get_prop( $array, $prop, $default = null ) {
|
413 |
+
|
414 |
+
if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
|
415 |
+
return $default;
|
416 |
+
}
|
417 |
+
|
418 |
+
if ( isset( $array[ $prop ] ) ) {
|
419 |
+
$value = $array[ $prop ];
|
420 |
+
} else {
|
421 |
+
$value = '';
|
422 |
+
}
|
423 |
+
|
424 |
+
return empty( $value ) && null !== $default ? $default : $value;
|
425 |
+
}
|
classes/class-cartflows-wizard.php
CHANGED
@@ -80,11 +80,11 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
80 |
|
81 |
if ( false === $status && ! $skip_setup ) { ?>
|
82 |
<div class="notice notice-info">
|
83 |
-
<p><b><?php
|
84 |
-
<p><?php
|
85 |
<p>
|
86 |
-
<a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php
|
87 |
-
<a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php
|
88 |
</p>
|
89 |
</div>
|
90 |
<?php
|
@@ -205,7 +205,7 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
205 |
<head>
|
206 |
<meta name="viewport" content="width=device-width" />
|
207 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
208 |
-
<title><?php
|
209 |
|
210 |
<script type="text/javascript">
|
211 |
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
@@ -231,7 +231,7 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
231 |
$admin_url = admin_url( 'admin.php?page=cartflows_settings' );
|
232 |
?>
|
233 |
<div class="close-button-wrapper">
|
234 |
-
<a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php
|
235 |
</div>
|
236 |
</body>
|
237 |
</html>
|
@@ -284,14 +284,14 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
284 |
*/
|
285 |
public function welcome_step() {
|
286 |
?>
|
287 |
-
<h1><?php
|
288 |
-
<p><?php
|
289 |
<form method="post">
|
290 |
<div class="cartflows-setup-actions step">
|
291 |
<div class="button-prev-wrap">
|
292 |
</div>
|
293 |
<div class="button-next-wrap">
|
294 |
-
<input type="submit" class="uct-activate button-primary button button-large " value="<?php
|
295 |
</div>
|
296 |
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
297 |
</div>
|
@@ -318,8 +318,8 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
318 |
public function page_builder_step() {
|
319 |
?>
|
320 |
|
321 |
-
<h1><?php
|
322 |
-
<p class="description"><?php
|
323 |
<form method="post">
|
324 |
<table class="cartflows-table widefat">
|
325 |
<tr class="cartflows-row">
|
@@ -383,14 +383,14 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
383 |
</td>
|
384 |
</tr>
|
385 |
</table>
|
386 |
-
<p><?php
|
387 |
<div class="cartflows-setup-actions step">
|
388 |
<div class="button-prev-wrap">
|
389 |
-
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php
|
390 |
</div>
|
391 |
<div class="button-next-wrap">
|
392 |
-
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next" ><?php
|
393 |
-
<a href="#" class="button button-primary wcf-install-plugins"><?php
|
394 |
</div>
|
395 |
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
396 |
</div>
|
@@ -409,21 +409,21 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
409 |
$is_active = class_exists( 'WooCommerce' ) ? 'yes' : 'no';
|
410 |
$is_wcf_ca_active = class_exists( 'CARTFLOWS_CA_Loader' ) ? 'yes' : 'no';
|
411 |
?>
|
412 |
-
<h1><?php
|
413 |
<div class="cartflows-setup-message">
|
414 |
<p>
|
415 |
-
<?php
|
416 |
</p>
|
417 |
-
<h4 class="cartflows-setup-message-title"><?php
|
418 |
<span><input data-wcf-ca-active="<?php echo esc_attr( $is_wcf_ca_active ); ?>" data-wcf-ca-install="<?php echo esc_attr( $is_wcf_ca_installed ); ?>" data-woo-active="<?php echo esc_attr( $is_active ); ?>" data-woo-install="<?php echo esc_attr( $is_wc_installed ); ?>" type="hidden" class="wcf-install-wc-input" name="installl-woocommerce" value="" checked></span>
|
419 |
</div>
|
420 |
|
421 |
<div class="cartflows-setup-extra-notice">
|
422 |
|
423 |
<span>
|
424 |
-
<?php
|
425 |
-
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php
|
426 |
-
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php
|
427 |
|
428 |
</span>
|
429 |
|
@@ -431,11 +431,11 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
431 |
|
432 |
<div class="cartflows-setup-actions step">
|
433 |
<div class="button-prev-wrap">
|
434 |
-
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php
|
435 |
</div>
|
436 |
<div class="button-next-wrap">
|
437 |
-
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php
|
438 |
-
<a class="wcf-install-wc button-primary button button-large" name="save_step" > <?php
|
439 |
</div>
|
440 |
</div>
|
441 |
|
@@ -546,14 +546,14 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
546 |
// Set setup wizard status to complete.
|
547 |
update_option( 'wcf_setup_complete', true );
|
548 |
?>
|
549 |
-
<h1><?php
|
550 |
|
551 |
<div class="cartflows-setup-next-steps">
|
552 |
<div class="cartflows-setup-next-steps-last">
|
553 |
|
554 |
<p class="success">
|
555 |
<?php
|
556 |
-
|
557 |
?>
|
558 |
</p>
|
559 |
|
@@ -567,7 +567,7 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
567 |
</div>
|
568 |
<div class="wcf-wizard-next-step-action">
|
569 |
<p class="wc-setup-actions step">
|
570 |
-
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=cartflows_flow&add-new-flow' ) ); ?>" type="button" class="button button-primary button-hero" ><?php
|
571 |
</p>
|
572 |
</div>
|
573 |
</li>
|
@@ -584,7 +584,7 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
584 |
public function training_step() {
|
585 |
$current_user = wp_get_current_user();
|
586 |
?>
|
587 |
-
<h1><?php
|
588 |
|
589 |
<div id="mauticform_wrapper_cartflowsonboarding" class="mauticform_wrapper">
|
590 |
<form autocomplete="false" role="form" method="post" action="https://go.cartflows.com/form/submit?formId=2" id="mauticform_cartflowsonboarding" data-mautic-form="cartflowsonboarding" enctype="multipart/form-data">
|
@@ -595,10 +595,10 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
595 |
<div id="mauticform_cartflowsonboarding_enter_your_email" class="mauticform-row mauticform-email mauticform-field-1">
|
596 |
<div class="cartflows-setup-message">
|
597 |
<p>
|
598 |
-
<?php
|
599 |
-
<?php
|
600 |
</p>
|
601 |
-
<input id="mauticform_input_cartflowsonboarding_enter_your_email" name="mauticform[enter_your_email]" placeholder="<?php
|
602 |
</div>
|
603 |
<span class="mauticform-errormsg" style="display: none;"></span>
|
604 |
</div>
|
@@ -610,11 +610,11 @@ if ( ! class_exists( 'CartFlows_Wizard' ) ) :
|
|
610 |
<input type="hidden" name="mauticform[formName]" id="mauticform_cartflowsonboarding_name" value="cartflowsonboarding">
|
611 |
<div class="cartflows-setup-actions step">
|
612 |
<div class="button-prev-wrap">
|
613 |
-
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php
|
614 |
</div>
|
615 |
<div class="button-next-wrap">
|
616 |
-
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php
|
617 |
-
<button type="submit" name="mauticform[submit]" id="mauticform_input_cartflowsonboarding_submit" value="<?php
|
618 |
</div>
|
619 |
</div>
|
620 |
</form>
|
80 |
|
81 |
if ( false === $status && ! $skip_setup ) { ?>
|
82 |
<div class="notice notice-info">
|
83 |
+
<p><b><?php esc_html_e( 'Thanks for installing and using CartFlows!', 'cartflows' ); ?></b></p>
|
84 |
+
<p><?php esc_html_e( 'It is easy to use the CartFlows. Please use the setup wizard to quick start setup.', 'cartflows' ); ?></p>
|
85 |
<p>
|
86 |
+
<a href="<?php echo esc_url( admin_url( 'index.php?page=cartflow-setup' ) ); ?>" class="button button-primary"> <?php esc_html_e( 'Start Wizard', 'cartflows' ); ?></a>
|
87 |
+
<a class="button-secondary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wcf-hide-notice', 'install' ), 'wcf_hide_notices_nonce', '_wcf_notice_nonce' ) ); ?>"><?php esc_html_e( 'Skip Setup', 'cartflows' ); ?></a>
|
88 |
</p>
|
89 |
</div>
|
90 |
<?php
|
205 |
<head>
|
206 |
<meta name="viewport" content="width=device-width" />
|
207 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
208 |
+
<title><?php esc_html_e( 'CartFlows Setup', 'cartflows' ); ?></title>
|
209 |
|
210 |
<script type="text/javascript">
|
211 |
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
231 |
$admin_url = admin_url( 'admin.php?page=cartflows_settings' );
|
232 |
?>
|
233 |
<div class="close-button-wrapper">
|
234 |
+
<a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'cartflows' ); ?></a>
|
235 |
</div>
|
236 |
</body>
|
237 |
</html>
|
284 |
*/
|
285 |
public function welcome_step() {
|
286 |
?>
|
287 |
+
<h1><?php esc_html_e( 'Welcome to CartFlows!', 'cartflows' ); ?></h1>
|
288 |
+
<p><?php esc_html_e( 'Thank you for choosing CartFlows to get more leads, increase conversions, & maximize profits. This short setup wizard will guide you though configuring CartFlows and creating your first funnel.', 'cartflows' ); ?></p>
|
289 |
<form method="post">
|
290 |
<div class="cartflows-setup-actions step">
|
291 |
<div class="button-prev-wrap">
|
292 |
</div>
|
293 |
<div class="button-next-wrap">
|
294 |
+
<input type="submit" class="uct-activate button-primary button button-large " value="<?php esc_html_e( 'Lets Go »', 'cartflows' ); ?>" name="save_step" />
|
295 |
</div>
|
296 |
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
297 |
</div>
|
318 |
public function page_builder_step() {
|
319 |
?>
|
320 |
|
321 |
+
<h1><?php esc_html_e( 'Page Builder Setup', 'cartflows' ); ?></h1>
|
322 |
+
<p class="description"><?php esc_html_e( 'Please select a page builder you would like to use with CartFlows.', 'cartflows' ); ?></p>
|
323 |
<form method="post">
|
324 |
<table class="cartflows-table widefat">
|
325 |
<tr class="cartflows-row">
|
383 |
</td>
|
384 |
</tr>
|
385 |
</table>
|
386 |
+
<p><?php esc_html_e( 'While CartFlows Should work with most page builders, we offer templates for the above page builders.', 'cartflows' ); ?></p>
|
387 |
<div class="cartflows-setup-actions step">
|
388 |
<div class="button-prev-wrap">
|
389 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
390 |
</div>
|
391 |
<div class="button-next-wrap">
|
392 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next" ><?php esc_html_e( 'Skip this step', 'cartflows' ); ?></a>
|
393 |
+
<a href="#" class="button button-primary wcf-install-plugins"><?php esc_html_e( 'Next »', 'cartflows' ); ?></a>
|
394 |
</div>
|
395 |
<?php wp_nonce_field( 'cartflow-setup' ); ?>
|
396 |
</div>
|
409 |
$is_active = class_exists( 'WooCommerce' ) ? 'yes' : 'no';
|
410 |
$is_wcf_ca_active = class_exists( 'CARTFLOWS_CA_Loader' ) ? 'yes' : 'no';
|
411 |
?>
|
412 |
+
<h1><?php esc_html_e( 'Choose a checkout', 'cartflows' ); ?></h1>
|
413 |
<div class="cartflows-setup-message">
|
414 |
<p>
|
415 |
+
<?php esc_html_e( 'While CartFlows is designed to use WooCommerce sell digital and physical products, not all funnels need a checkout system.', 'cartflows' ); ?>
|
416 |
</p>
|
417 |
+
<h4 class="cartflows-setup-message-title"><?php esc_html_e( 'Would you like to install WooCommerce to sell digital and physical products in your funnels?', 'cartflows' ); ?></h4>
|
418 |
<span><input data-wcf-ca-active="<?php echo esc_attr( $is_wcf_ca_active ); ?>" data-wcf-ca-install="<?php echo esc_attr( $is_wcf_ca_installed ); ?>" data-woo-active="<?php echo esc_attr( $is_active ); ?>" data-woo-install="<?php echo esc_attr( $is_wc_installed ); ?>" type="hidden" class="wcf-install-wc-input" name="installl-woocommerce" value="" checked></span>
|
419 |
</div>
|
420 |
|
421 |
<div class="cartflows-setup-extra-notice">
|
422 |
|
423 |
<span>
|
424 |
+
<?php esc_html_e( 'The following plugin will be installed and activated for you:', 'cartflows' ); ?>
|
425 |
+
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce', 'cartflows' ); ?></a>,
|
426 |
+
<a target="_blank" href="https://wordpress.org/plugins/woo-cart-abandonment-recovery/"> <?php esc_html_e( 'WooCommerce Cart Abandonment Recovery', 'cartflows' ); ?></a>
|
427 |
|
428 |
</span>
|
429 |
|
431 |
|
432 |
<div class="cartflows-setup-actions step">
|
433 |
<div class="button-prev-wrap">
|
434 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
435 |
</div>
|
436 |
<div class="button-next-wrap">
|
437 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
|
438 |
+
<a class="wcf-install-wc button-primary button button-large" name="save_step" > <?php esc_html_e( 'Yes', 'cartflows' ); ?> </a>
|
439 |
</div>
|
440 |
</div>
|
441 |
|
546 |
// Set setup wizard status to complete.
|
547 |
update_option( 'wcf_setup_complete', true );
|
548 |
?>
|
549 |
+
<h1><?php esc_html_e( 'Congratulations, You Did It!', 'cartflows' ); ?></h1>
|
550 |
|
551 |
<div class="cartflows-setup-next-steps">
|
552 |
<div class="cartflows-setup-next-steps-last">
|
553 |
|
554 |
<p class="success">
|
555 |
<?php
|
556 |
+
esc_html_e( 'CartFlows is ready to use on your website. You\'ve successfully completed the setup process and all that is left for you to do is create your first flow.', 'cartflows' )
|
557 |
?>
|
558 |
</p>
|
559 |
|
567 |
</div>
|
568 |
<div class="wcf-wizard-next-step-action">
|
569 |
<p class="wc-setup-actions step">
|
570 |
+
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=cartflows_flow&add-new-flow' ) ); ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Create a flow', 'cartflows' ); ?></a>
|
571 |
</p>
|
572 |
</div>
|
573 |
</li>
|
584 |
public function training_step() {
|
585 |
$current_user = wp_get_current_user();
|
586 |
?>
|
587 |
+
<h1><?php esc_html_e( 'Exclusive CartFlows Training Course Offer', 'cartflows' ); ?></h1>
|
588 |
|
589 |
<div id="mauticform_wrapper_cartflowsonboarding" class="mauticform_wrapper">
|
590 |
<form autocomplete="false" role="form" method="post" action="https://go.cartflows.com/form/submit?formId=2" id="mauticform_cartflowsonboarding" data-mautic-form="cartflowsonboarding" enctype="multipart/form-data">
|
595 |
<div id="mauticform_cartflowsonboarding_enter_your_email" class="mauticform-row mauticform-email mauticform-field-1">
|
596 |
<div class="cartflows-setup-message">
|
597 |
<p>
|
598 |
+
<?php esc_html_e( 'We want you to get off to a great start using CartFlows, so we would like to give access to our exclusive training course.', 'cartflows' ); ?>
|
599 |
+
<?php esc_html_e( 'Get access to this couse, for free, by entering your email below.', 'cartflows' ); ?>
|
600 |
</p>
|
601 |
+
<input id="mauticform_input_cartflowsonboarding_enter_your_email" name="mauticform[enter_your_email]" placeholder="<?php esc_html_e( 'Enter Email address', 'cartflows' ); ?>" value="<?php echo $current_user->user_email; ?>" class="mauticform-input" type="email">
|
602 |
</div>
|
603 |
<span class="mauticform-errormsg" style="display: none;"></span>
|
604 |
</div>
|
610 |
<input type="hidden" name="mauticform[formName]" id="mauticform_cartflowsonboarding_name" value="cartflowsonboarding">
|
611 |
<div class="cartflows-setup-actions step">
|
612 |
<div class="button-prev-wrap">
|
613 |
+
<a href="<?php echo esc_url( $this->get_prev_step_link() ); ?>" class="button-primary button button-large button-prev" ><?php esc_html_e( '« Previous', 'cartflows' ); ?></a>
|
614 |
</div>
|
615 |
<div class="button-next-wrap">
|
616 |
+
<a href="<?php echo esc_url_raw( $this->get_next_step_plain_link() ); ?>" class="button button-large button-next"><?php esc_html_e( 'No thanks', 'cartflows' ); ?></a>
|
617 |
+
<button type="submit" name="mauticform[submit]" id="mauticform_input_cartflowsonboarding_submit" value="<?php esc_html_e( 'Allow', 'cartflows' ); ?>" class="mautic-form-submit btn btn-default button-primary button button-large button-next" name="save_step"><?php esc_html_e( 'Allow', 'cartflows' ); ?></button>
|
618 |
</div>
|
619 |
</div>
|
620 |
</form>
|
classes/fields/typography/class-cartflows-font-families.php
CHANGED
@@ -1,315 +1,315 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Helper class for font settings.
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
* @author CartFlows
|
7 |
-
* @copyright Copyright (c) 2018, CartFlows
|
8 |
-
* @link https://cartflows.com/
|
9 |
-
* @since 1.0.0
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly.
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Font info class for System and Google fonts.
|
19 |
-
*/
|
20 |
-
if ( ! class_exists( 'CartFlows_Font_Families' ) ) :
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Font info class for System and Google fonts.
|
24 |
-
*/
|
25 |
-
final class CartFlows_Font_Families {
|
26 |
-
|
27 |
-
/**
|
28 |
-
* System Fonts
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @var array
|
32 |
-
*/
|
33 |
-
public static $system_fonts = array();
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Google Fonts
|
37 |
-
*
|
38 |
-
* @since 1.0.0
|
39 |
-
* @var array
|
40 |
-
*/
|
41 |
-
public static $google_fonts = array();
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Get System Fonts
|
45 |
-
*
|
46 |
-
* @since 1.0.0
|
47 |
-
*
|
48 |
-
* @return Array All the system fonts in CartFlows
|
49 |
-
*/
|
50 |
-
public static function get_system_fonts() {
|
51 |
-
if ( empty( self::$system_fonts ) ) {
|
52 |
-
self::$system_fonts = array(
|
53 |
-
'Helvetica' => array(
|
54 |
-
'fallback' => 'Verdana, Arial, sans-serif',
|
55 |
-
'variants' => array(
|
56 |
-
'300',
|
57 |
-
'400',
|
58 |
-
'700',
|
59 |
-
),
|
60 |
-
),
|
61 |
-
'Verdana' => array(
|
62 |
-
'fallback' => 'Helvetica, Arial, sans-serif',
|
63 |
-
'variants' => array(
|
64 |
-
'300',
|
65 |
-
'400',
|
66 |
-
'700',
|
67 |
-
),
|
68 |
-
),
|
69 |
-
'Arial' => array(
|
70 |
-
'fallback' => 'Helvetica, Verdana, sans-serif',
|
71 |
-
'variants' => array(
|
72 |
-
'300',
|
73 |
-
'400',
|
74 |
-
'700',
|
75 |
-
),
|
76 |
-
),
|
77 |
-
'Times' => array(
|
78 |
-
'fallback' => 'Georgia, serif',
|
79 |
-
'variants' => array(
|
80 |
-
'300',
|
81 |
-
'400',
|
82 |
-
'700',
|
83 |
-
),
|
84 |
-
),
|
85 |
-
'Georgia' => array(
|
86 |
-
'fallback' => 'Times, serif',
|
87 |
-
'variants' => array(
|
88 |
-
'300',
|
89 |
-
'400',
|
90 |
-
'700',
|
91 |
-
),
|
92 |
-
),
|
93 |
-
'Courier' => array(
|
94 |
-
'fallback' => 'monospace',
|
95 |
-
'variants' => array(
|
96 |
-
'300',
|
97 |
-
'400',
|
98 |
-
'700',
|
99 |
-
),
|
100 |
-
),
|
101 |
-
);
|
102 |
-
}
|
103 |
-
|
104 |
-
return apply_filters( 'cartflows_system_fonts', self::$system_fonts );
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Custom Fonts
|
109 |
-
*
|
110 |
-
* @since 1.0.0
|
111 |
-
*
|
112 |
-
* @return Array All the custom fonts in CartFlows
|
113 |
-
*/
|
114 |
-
public static function get_custom_fonts() {
|
115 |
-
$custom_fonts = array();
|
116 |
-
|
117 |
-
return apply_filters( 'cartflows_custom_fonts', $custom_fonts );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Google Fonts used in CartFlows.
|
122 |
-
* Array is generated from the google-fonts.json file.
|
123 |
-
*
|
124 |
-
* @since 1.0.0
|
125 |
-
*
|
126 |
-
* @return Array Array of Google Fonts.
|
127 |
-
*/
|
128 |
-
public static function get_google_fonts() {
|
129 |
-
|
130 |
-
if ( empty( self::$google_fonts ) ) {
|
131 |
-
|
132 |
-
$google_fonts_file = CARTFLOWS_DIR . 'classes/fields/typography/google-fonts.json';
|
133 |
-
|
134 |
-
if ( ! file_exists( $google_fonts_file ) ) {
|
135 |
-
return array();
|
136 |
-
}
|
137 |
-
|
138 |
-
global $wp_filesystem;
|
139 |
-
if ( empty( $wp_filesystem ) ) {
|
140 |
-
require_once ABSPATH . '/wp-admin/includes/file.php';
|
141 |
-
WP_Filesystem();
|
142 |
-
}
|
143 |
-
|
144 |
-
$file_contants = $wp_filesystem->get_contents( $google_fonts_file );
|
145 |
-
$google_fonts_json = json_decode( $file_contants, 1 );
|
146 |
-
|
147 |
-
if ( is_array( $google_fonts_json ) || is_object( $google_fonts_json ) ) {
|
148 |
-
|
149 |
-
foreach ( $google_fonts_json as $key => $font ) {
|
150 |
-
$name = key( $font );
|
151 |
-
foreach ( $font[ $name ] as $font_key => $single_font ) {
|
152 |
-
|
153 |
-
if ( 'variants' === $font_key ) {
|
154 |
-
|
155 |
-
foreach ( $single_font as $variant_key => $variant ) {
|
156 |
-
|
157 |
-
if ( 'regular' == $variant ) {
|
158 |
-
$font[ $name ][ $font_key ][ $variant_key ] = '400';
|
159 |
-
}
|
160 |
-
}
|
161 |
-
}
|
162 |
-
|
163 |
-
self::$google_fonts[ $name ] = array_values( $font[ $name ] );
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
return apply_filters( 'cartflows_google_fonts', self::$google_fonts );
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Render Fonts
|
174 |
-
*
|
175 |
-
* @param array $post_id post ID.
|
176 |
-
* @return void
|
177 |
-
*/
|
178 |
-
public static function render_fonts( $post_id ) {
|
179 |
-
|
180 |
-
$google_font_url = get_post_meta( $post_id, 'wcf-field-google-font-url', true );
|
181 |
-
|
182 |
-
// @todo Avoid the URL generator from the JS and remove the below static URL check condition.
|
183 |
-
if ( empty( $google_font_url ) || '//fonts.googleapis.com/css?family=' == $google_font_url ) {
|
184 |
-
return;
|
185 |
-
}
|
186 |
-
|
187 |
-
wp_enqueue_style( 'cartflows-google-fonts', esc_url( $google_font_url ), array(), CARTFLOWS_VER, 'all' );
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Get string between
|
192 |
-
*
|
193 |
-
* @param string $string Input string.
|
194 |
-
* @param string $start First string.
|
195 |
-
* @param string $end Last string.
|
196 |
-
* @return string string.
|
197 |
-
*/
|
198 |
-
public static function get_string_between( $string, $start, $end ) {
|
199 |
-
$string = ' ' . $string;
|
200 |
-
$ini = strpos( $string, $start );
|
201 |
-
if ( 0 == $ini ) {
|
202 |
-
return '';
|
203 |
-
}
|
204 |
-
$ini += strlen( $start );
|
205 |
-
$len = strpos( $string, $end, $ini ) - $ini;
|
206 |
-
return substr( $string, $ini, $len );
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Google Font URL
|
211 |
-
* Combine multiple google font in one URL
|
212 |
-
*
|
213 |
-
* @link https://shellcreeper.com/?p=1476
|
214 |
-
* @param array $fonts Google Fonts array.
|
215 |
-
* @param array $subsets Font's Subsets array.
|
216 |
-
*
|
217 |
-
* @return string
|
218 |
-
*/
|
219 |
-
public static function google_fonts_url( $fonts, $subsets = array() ) {
|
220 |
-
|
221 |
-
/* URL */
|
222 |
-
$base_url = '//fonts.googleapis.com/css';
|
223 |
-
$font_args = array();
|
224 |
-
$family = array();
|
225 |
-
|
226 |
-
$fonts = apply_filters( 'cartflows_google_fonts', $fonts );
|
227 |
-
|
228 |
-
/* Format Each Font Family in Array */
|
229 |
-
foreach ( $fonts as $font_name => $font_weight ) {
|
230 |
-
$font_name = str_replace( ' ', '+', $font_name );
|
231 |
-
if ( ! empty( $font_weight ) ) {
|
232 |
-
if ( is_array( $font_weight ) ) {
|
233 |
-
$font_weight = implode( ',', $font_weight );
|
234 |
-
}
|
235 |
-
$font_family = explode( ',', $font_name );
|
236 |
-
$font_family = str_replace( "'", '', wcf_get_prop( $font_family, 0 ) );
|
237 |
-
$family[] = trim( $font_family . ':' . urlencode( trim( $font_weight ) ) );//phpcs:ignore
|
238 |
-
} else {
|
239 |
-
$family[] = trim( $font_name );
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
/* Only return URL if font family defined. */
|
244 |
-
if ( ! empty( $family ) ) {
|
245 |
-
|
246 |
-
/* Make Font Family a String */
|
247 |
-
$family = implode( '|', $family );
|
248 |
-
|
249 |
-
/* Add font family in args */
|
250 |
-
$font_args['family'] = $family;
|
251 |
-
|
252 |
-
/* Add font subsets in args */
|
253 |
-
if ( ! empty( $subsets ) ) {
|
254 |
-
|
255 |
-
/* format subsets to string */
|
256 |
-
if ( is_array( $subsets ) ) {
|
257 |
-
$subsets = implode( ',', $subsets );
|
258 |
-
}
|
259 |
-
|
260 |
-
$font_args['subset'] = urlencode( trim( $subsets ) );//phpcs:ignore
|
261 |
-
}
|
262 |
-
return add_query_arg( $font_args, $base_url );
|
263 |
-
}
|
264 |
-
|
265 |
-
return '';
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Generate Google Font URL from the post meta.
|
270 |
-
*
|
271 |
-
* @param integer $post_id Post ID.
|
272 |
-
* @return string Google URL if post meta is set.
|
273 |
-
*/
|
274 |
-
public function generate_google_url( $post_id ) {
|
275 |
-
|
276 |
-
$font_weight = array();
|
277 |
-
$fields = get_post_meta( $post_id );
|
278 |
-
|
279 |
-
foreach ( $fields as $key => $value ) {
|
280 |
-
if ( false !== strpos( $key, 'font-family' ) ) {
|
281 |
-
$font_family = ! empty( $value[0] ) ? self::get_string_between( $value[0], '\'', '\'' ) : '';
|
282 |
-
$font_list[ $font_family ] = array();
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
$google_fonts = array();
|
287 |
-
$font_subset = array();
|
288 |
-
|
289 |
-
$system_fonts = self::get_system_fonts();
|
290 |
-
$get_google_fonts = self::get_google_fonts();
|
291 |
-
|
292 |
-
$variants = array( 'variants' => array( 400 ) );
|
293 |
-
foreach ( $font_list as $name => $font ) {
|
294 |
-
if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) {
|
295 |
-
|
296 |
-
if ( isset( $get_google_fonts[ $name ] ) ) {
|
297 |
-
$variants = $get_google_fonts[ $name ][0];
|
298 |
-
}
|
299 |
-
|
300 |
-
// Add font variants.
|
301 |
-
$google_fonts[ $name ] = $variants;
|
302 |
-
|
303 |
-
// Add Subset.
|
304 |
-
$subset = apply_filters( 'cartflows_font_subset', '', $name );
|
305 |
-
if ( ! empty( $subset ) ) {
|
306 |
-
$font_subset[] = $subset;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
return self::google_fonts_url( $google_fonts, $font_subset );
|
312 |
-
}
|
313 |
-
}
|
314 |
-
|
315 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Helper class for font settings.
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
* @author CartFlows
|
7 |
+
* @copyright Copyright (c) 2018, CartFlows
|
8 |
+
* @link https://cartflows.com/
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Font info class for System and Google fonts.
|
19 |
+
*/
|
20 |
+
if ( ! class_exists( 'CartFlows_Font_Families' ) ) :
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Font info class for System and Google fonts.
|
24 |
+
*/
|
25 |
+
final class CartFlows_Font_Families {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* System Fonts
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @var array
|
32 |
+
*/
|
33 |
+
public static $system_fonts = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Google Fonts
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
* @var array
|
40 |
+
*/
|
41 |
+
public static $google_fonts = array();
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Get System Fonts
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
*
|
48 |
+
* @return Array All the system fonts in CartFlows
|
49 |
+
*/
|
50 |
+
public static function get_system_fonts() {
|
51 |
+
if ( empty( self::$system_fonts ) ) {
|
52 |
+
self::$system_fonts = array(
|
53 |
+
'Helvetica' => array(
|
54 |
+
'fallback' => 'Verdana, Arial, sans-serif',
|
55 |
+
'variants' => array(
|
56 |
+
'300',
|
57 |
+
'400',
|
58 |
+
'700',
|
59 |
+
),
|
60 |
+
),
|
61 |
+
'Verdana' => array(
|
62 |
+
'fallback' => 'Helvetica, Arial, sans-serif',
|
63 |
+
'variants' => array(
|
64 |
+
'300',
|
65 |
+
'400',
|
66 |
+
'700',
|
67 |
+
),
|
68 |
+
),
|
69 |
+
'Arial' => array(
|
70 |
+
'fallback' => 'Helvetica, Verdana, sans-serif',
|
71 |
+
'variants' => array(
|
72 |
+
'300',
|
73 |
+
'400',
|
74 |
+
'700',
|
75 |
+
),
|
76 |
+
),
|
77 |
+
'Times' => array(
|
78 |
+
'fallback' => 'Georgia, serif',
|
79 |
+
'variants' => array(
|
80 |
+
'300',
|
81 |
+
'400',
|
82 |
+
'700',
|
83 |
+
),
|
84 |
+
),
|
85 |
+
'Georgia' => array(
|
86 |
+
'fallback' => 'Times, serif',
|
87 |
+
'variants' => array(
|
88 |
+
'300',
|
89 |
+
'400',
|
90 |
+
'700',
|
91 |
+
),
|
92 |
+
),
|
93 |
+
'Courier' => array(
|
94 |
+
'fallback' => 'monospace',
|
95 |
+
'variants' => array(
|
96 |
+
'300',
|
97 |
+
'400',
|
98 |
+
'700',
|
99 |
+
),
|
100 |
+
),
|
101 |
+
);
|
102 |
+
}
|
103 |
+
|
104 |
+
return apply_filters( 'cartflows_system_fonts', self::$system_fonts );
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Custom Fonts
|
109 |
+
*
|
110 |
+
* @since 1.0.0
|
111 |
+
*
|
112 |
+
* @return Array All the custom fonts in CartFlows
|
113 |
+
*/
|
114 |
+
public static function get_custom_fonts() {
|
115 |
+
$custom_fonts = array();
|
116 |
+
|
117 |
+
return apply_filters( 'cartflows_custom_fonts', $custom_fonts );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Google Fonts used in CartFlows.
|
122 |
+
* Array is generated from the google-fonts.json file.
|
123 |
+
*
|
124 |
+
* @since 1.0.0
|
125 |
+
*
|
126 |
+
* @return Array Array of Google Fonts.
|
127 |
+
*/
|
128 |
+
public static function get_google_fonts() {
|
129 |
+
|
130 |
+
if ( empty( self::$google_fonts ) ) {
|
131 |
+
|
132 |
+
$google_fonts_file = CARTFLOWS_DIR . 'classes/fields/typography/google-fonts.json';
|
133 |
+
|
134 |
+
if ( ! file_exists( $google_fonts_file ) ) {
|
135 |
+
return array();
|
136 |
+
}
|
137 |
+
|
138 |
+
global $wp_filesystem;
|
139 |
+
if ( empty( $wp_filesystem ) ) {
|
140 |
+
require_once ABSPATH . '/wp-admin/includes/file.php';
|
141 |
+
WP_Filesystem();
|
142 |
+
}
|
143 |
+
|
144 |
+
$file_contants = $wp_filesystem->get_contents( $google_fonts_file );
|
145 |
+
$google_fonts_json = json_decode( $file_contants, 1 );
|
146 |
+
|
147 |
+
if ( is_array( $google_fonts_json ) || is_object( $google_fonts_json ) ) {
|
148 |
+
|
149 |
+
foreach ( $google_fonts_json as $key => $font ) {
|
150 |
+
$name = key( $font );
|
151 |
+
foreach ( $font[ $name ] as $font_key => $single_font ) {
|
152 |
+
|
153 |
+
if ( 'variants' === $font_key ) {
|
154 |
+
|
155 |
+
foreach ( $single_font as $variant_key => $variant ) {
|
156 |
+
|
157 |
+
if ( 'regular' == $variant ) {
|
158 |
+
$font[ $name ][ $font_key ][ $variant_key ] = '400';
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
self::$google_fonts[ $name ] = array_values( $font[ $name ] );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
return apply_filters( 'cartflows_google_fonts', self::$google_fonts );
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Render Fonts
|
174 |
+
*
|
175 |
+
* @param array $post_id post ID.
|
176 |
+
* @return void
|
177 |
+
*/
|
178 |
+
public static function render_fonts( $post_id ) {
|
179 |
+
|
180 |
+
$google_font_url = get_post_meta( $post_id, 'wcf-field-google-font-url', true );
|
181 |
+
|
182 |
+
// @todo Avoid the URL generator from the JS and remove the below static URL check condition.
|
183 |
+
if ( empty( $google_font_url ) || '//fonts.googleapis.com/css?family=' == $google_font_url ) {
|
184 |
+
return;
|
185 |
+
}
|
186 |
+
|
187 |
+
wp_enqueue_style( 'cartflows-google-fonts', esc_url( $google_font_url ), array(), CARTFLOWS_VER, 'all' );
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Get string between
|
192 |
+
*
|
193 |
+
* @param string $string Input string.
|
194 |
+
* @param string $start First string.
|
195 |
+
* @param string $end Last string.
|
196 |
+
* @return string string.
|
197 |
+
*/
|
198 |
+
public static function get_string_between( $string, $start, $end ) {
|
199 |
+
$string = ' ' . $string;
|
200 |
+
$ini = strpos( $string, $start );
|
201 |
+
if ( 0 == $ini ) {
|
202 |
+
return '';
|
203 |
+
}
|
204 |
+
$ini += strlen( $start );
|
205 |
+
$len = strpos( $string, $end, $ini ) - $ini;
|
206 |
+
return substr( $string, $ini, $len );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Google Font URL
|
211 |
+
* Combine multiple google font in one URL
|
212 |
+
*
|
213 |
+
* @link https://shellcreeper.com/?p=1476
|
214 |
+
* @param array $fonts Google Fonts array.
|
215 |
+
* @param array $subsets Font's Subsets array.
|
216 |
+
*
|
217 |
+
* @return string
|
218 |
+
*/
|
219 |
+
public static function google_fonts_url( $fonts, $subsets = array() ) {
|
220 |
+
|
221 |
+
/* URL */
|
222 |
+
$base_url = '//fonts.googleapis.com/css';
|
223 |
+
$font_args = array();
|
224 |
+
$family = array();
|
225 |
+
|
226 |
+
$fonts = apply_filters( 'cartflows_google_fonts', $fonts );
|
227 |
+
|
228 |
+
/* Format Each Font Family in Array */
|
229 |
+
foreach ( $fonts as $font_name => $font_weight ) {
|
230 |
+
$font_name = str_replace( ' ', '+', $font_name );
|
231 |
+
if ( ! empty( $font_weight ) ) {
|
232 |
+
if ( is_array( $font_weight ) ) {
|
233 |
+
$font_weight = implode( ',', $font_weight );
|
234 |
+
}
|
235 |
+
$font_family = explode( ',', $font_name );
|
236 |
+
$font_family = str_replace( "'", '', wcf_get_prop( $font_family, 0 ) );
|
237 |
+
$family[] = trim( $font_family . ':' . urlencode( trim( $font_weight ) ) );//phpcs:ignore
|
238 |
+
} else {
|
239 |
+
$family[] = trim( $font_name );
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
/* Only return URL if font family defined. */
|
244 |
+
if ( ! empty( $family ) ) {
|
245 |
+
|
246 |
+
/* Make Font Family a String */
|
247 |
+
$family = implode( '|', $family );
|
248 |
+
|
249 |
+
/* Add font family in args */
|
250 |
+
$font_args['family'] = $family;
|
251 |
+
|
252 |
+
/* Add font subsets in args */
|
253 |
+
if ( ! empty( $subsets ) ) {
|
254 |
+
|
255 |
+
/* format subsets to string */
|
256 |
+
if ( is_array( $subsets ) ) {
|
257 |
+
$subsets = implode( ',', $subsets );
|
258 |
+
}
|
259 |
+
|
260 |
+
$font_args['subset'] = urlencode( trim( $subsets ) );//phpcs:ignore
|
261 |
+
}
|
262 |
+
return add_query_arg( $font_args, $base_url );
|
263 |
+
}
|
264 |
+
|
265 |
+
return '';
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Generate Google Font URL from the post meta.
|
270 |
+
*
|
271 |
+
* @param integer $post_id Post ID.
|
272 |
+
* @return string Google URL if post meta is set.
|
273 |
+
*/
|
274 |
+
public function generate_google_url( $post_id ) {
|
275 |
+
|
276 |
+
$font_weight = array();
|
277 |
+
$fields = get_post_meta( $post_id );
|
278 |
+
|
279 |
+
foreach ( $fields as $key => $value ) {
|
280 |
+
if ( false !== strpos( $key, 'font-family' ) ) {
|
281 |
+
$font_family = ! empty( $value[0] ) ? self::get_string_between( $value[0], '\'', '\'' ) : '';
|
282 |
+
$font_list[ $font_family ] = array();
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
$google_fonts = array();
|
287 |
+
$font_subset = array();
|
288 |
+
|
289 |
+
$system_fonts = self::get_system_fonts();
|
290 |
+
$get_google_fonts = self::get_google_fonts();
|
291 |
+
|
292 |
+
$variants = array( 'variants' => array( 400 ) );
|
293 |
+
foreach ( $font_list as $name => $font ) {
|
294 |
+
if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) {
|
295 |
+
|
296 |
+
if ( isset( $get_google_fonts[ $name ] ) ) {
|
297 |
+
$variants = $get_google_fonts[ $name ][0];
|
298 |
+
}
|
299 |
+
|
300 |
+
// Add font variants.
|
301 |
+
$google_fonts[ $name ] = $variants;
|
302 |
+
|
303 |
+
// Add Subset.
|
304 |
+
$subset = apply_filters( 'cartflows_font_subset', '', $name );
|
305 |
+
if ( ! empty( $subset ) ) {
|
306 |
+
$font_subset[] = $subset;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
return self::google_fonts_url( $google_fonts, $font_subset );
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
endif;
|
classes/logger/class-cartflows-log-handler-file.php
CHANGED
@@ -1,442 +1,442 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class Cartflows_Log_Handler_File file.
|
4 |
-
*
|
5 |
-
* @package WooCommerce\Log Handlers
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit; // Exit if accessed directly.
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Handles log entries by writing to a file.
|
14 |
-
*
|
15 |
-
* @class Cartflows_Log_Handler_File
|
16 |
-
* @version 1.0.0
|
17 |
-
* @package WooCommerce/Classes/Log_Handlers
|
18 |
-
*/
|
19 |
-
class Cartflows_Log_Handler_File extends Cartflows_Log_Handler {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Stores open file handles.
|
23 |
-
*
|
24 |
-
* @var array
|
25 |
-
*/
|
26 |
-
protected $handles = array();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* File size limit for log files in bytes.
|
30 |
-
*
|
31 |
-
* @var int
|
32 |
-
*/
|
33 |
-
protected $log_size_limit;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Cache logs that could not be written.
|
37 |
-
*
|
38 |
-
* If a log is written too early in the request, pluggable functions may be unavailable. These
|
39 |
-
* logs will be cached and written on 'plugins_loaded' action.
|
40 |
-
*
|
41 |
-
* @var array
|
42 |
-
*/
|
43 |
-
protected $cached_logs = array();
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Constructor for the logger.
|
47 |
-
*
|
48 |
-
* @param int $log_size_limit Optional. Size limit for log files. Default 5mb.
|
49 |
-
*/
|
50 |
-
public function __construct( $log_size_limit = null ) {
|
51 |
-
if ( null === $log_size_limit ) {
|
52 |
-
$log_size_limit = 5 * 1024 * 1024;
|
53 |
-
}
|
54 |
-
|
55 |
-
$this->log_size_limit = apply_filters( 'cartflows_log_file_size_limit', $log_size_limit );
|
56 |
-
|
57 |
-
add_action( 'plugins_loaded', array( $this, 'write_cached_logs' ) );
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Destructor.
|
62 |
-
*
|
63 |
-
* Cleans up open file handles.
|
64 |
-
*/
|
65 |
-
public function __destruct() {
|
66 |
-
foreach ( $this->handles as $handle ) {
|
67 |
-
if ( is_resource( $handle ) ) {
|
68 |
-
fclose( $handle ); // @codingStandardsIgnoreLine.
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Handle a log entry.
|
75 |
-
*
|
76 |
-
* @param int $timestamp Log timestamp.
|
77 |
-
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
78 |
-
* @param string $message Log message.
|
79 |
-
* @param array $context {
|
80 |
-
* Additional information for log handlers.
|
81 |
-
*
|
82 |
-
* @type string $source Optional. Determines log file to write to. Default 'log'.
|
83 |
-
* @type bool $_legacy Optional. Default false. True to use outdated log format
|
84 |
-
* originally used in deprecated Cartflows_WC_Logger::add calls.
|
85 |
-
* }
|
86 |
-
*
|
87 |
-
* @return bool False if value was not handled and true if value was handled.
|
88 |
-
*/
|
89 |
-
public function handle( $timestamp, $level, $message, $context ) {
|
90 |
-
|
91 |
-
if ( isset( $context['source'] ) && $context['source'] ) {
|
92 |
-
$handle = $context['source'];
|
93 |
-
} else {
|
94 |
-
$handle = 'log';
|
95 |
-
}
|
96 |
-
|
97 |
-
$entry = self::format_entry( $timestamp, $level, $message, $context );
|
98 |
-
|
99 |
-
return $this->add( $entry, $handle );
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Builds a log entry text from timestamp, level and message.
|
104 |
-
*
|
105 |
-
* @param int $timestamp Log timestamp.
|
106 |
-
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
107 |
-
* @param string $message Log message.
|
108 |
-
* @param array $context Additional information for log handlers.
|
109 |
-
*
|
110 |
-
* @return string Formatted log entry.
|
111 |
-
*/
|
112 |
-
protected static function format_entry( $timestamp, $level, $message, $context ) {
|
113 |
-
|
114 |
-
if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) {
|
115 |
-
if ( isset( $context['source'] ) && $context['source'] ) {
|
116 |
-
$handle = $context['source'];
|
117 |
-
} else {
|
118 |
-
$handle = 'log';
|
119 |
-
}
|
120 |
-
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
|
121 |
-
$time = date_i18n( 'm-d-Y @ H:i:s' );
|
122 |
-
$entry = "{$time} - {$message}";
|
123 |
-
} else {
|
124 |
-
$entry = parent::format_entry( $timestamp, $level, $message, $context );
|
125 |
-
}
|
126 |
-
|
127 |
-
return $entry;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Open log file for writing.
|
132 |
-
*
|
133 |
-
* @param string $handle Log handle.
|
134 |
-
* @param string $mode Optional. File mode. Default 'a'.
|
135 |
-
* @return bool Success.
|
136 |
-
*/
|
137 |
-
protected function open( $handle, $mode = 'a' ) {
|
138 |
-
if ( $this->is_open( $handle ) ) {
|
139 |
-
return true;
|
140 |
-
}
|
141 |
-
|
142 |
-
$file = self::get_log_file_path( $handle );
|
143 |
-
|
144 |
-
if ( $file ) {
|
145 |
-
if ( ! file_exists( $file ) ) {
|
146 |
-
$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
|
147 |
-
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
|
148 |
-
|
149 |
-
if ( defined( 'FS_CHMOD_FILE' ) ) {
|
150 |
-
@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
$resource = @fopen( $file, $mode ); // @codingStandardsIgnoreLine.
|
155 |
-
|
156 |
-
if ( $resource ) {
|
157 |
-
$this->handles[ $handle ] = $resource;
|
158 |
-
return true;
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
return false;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Check if a handle is open.
|
167 |
-
*
|
168 |
-
* @param string $handle Log handle.
|
169 |
-
* @return bool True if $handle is open.
|
170 |
-
*/
|
171 |
-
protected function is_open( $handle ) {
|
172 |
-
return array_key_exists( $handle, $this->handles ) && is_resource( $this->handles[ $handle ] );
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Close a handle.
|
177 |
-
*
|
178 |
-
* @param string $handle Log handle.
|
179 |
-
* @return bool success
|
180 |
-
*/
|
181 |
-
protected function close( $handle ) {
|
182 |
-
$result = false;
|
183 |
-
|
184 |
-
if ( $this->is_open( $handle ) ) {
|
185 |
-
$result = fclose( $this->handles[ $handle ] ); // @codingStandardsIgnoreLine.
|
186 |
-
unset( $this->handles[ $handle ] );
|
187 |
-
}
|
188 |
-
|
189 |
-
return $result;
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Add a log entry to chosen file.
|
194 |
-
*
|
195 |
-
* @param string $entry Log entry text.
|
196 |
-
* @param string $handle Log entry handle.
|
197 |
-
*
|
198 |
-
* @return bool True if write was successful.
|
199 |
-
*/
|
200 |
-
protected function add( $entry, $handle ) {
|
201 |
-
$result = false;
|
202 |
-
|
203 |
-
if ( $this->should_rotate( $handle ) ) {
|
204 |
-
$this->log_rotate( $handle );
|
205 |
-
}
|
206 |
-
|
207 |
-
if ( $this->open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
|
208 |
-
$result = fwrite( $this->handles[ $handle ], $entry . PHP_EOL ); // @codingStandardsIgnoreLine.
|
209 |
-
} else {
|
210 |
-
$this->cache_log( $entry, $handle );
|
211 |
-
}
|
212 |
-
|
213 |
-
return false !== $result;
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Clear entries from chosen file.
|
218 |
-
*
|
219 |
-
* @param string $handle Log handle.
|
220 |
-
*
|
221 |
-
* @return bool
|
222 |
-
*/
|
223 |
-
public function clear( $handle ) {
|
224 |
-
$result = false;
|
225 |
-
|
226 |
-
// Close the file if it's already open.
|
227 |
-
$this->close( $handle );
|
228 |
-
|
229 |
-
/**
|
230 |
-
* $this->open( $handle, 'w' ) == Open the file for writing only. Place the file pointer at
|
231 |
-
* the beginning of the file, and truncate the file to zero length.
|
232 |
-
*/
|
233 |
-
if ( $this->open( $handle, 'w' ) && is_resource( $this->handles[ $handle ] ) ) {
|
234 |
-
$result = true;
|
235 |
-
}
|
236 |
-
|
237 |
-
do_action( 'cartflows_log_clear', $handle );
|
238 |
-
|
239 |
-
return $result;
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Remove/delete the chosen file.
|
244 |
-
*
|
245 |
-
* @param string $handle Log handle.
|
246 |
-
*
|
247 |
-
* @return bool
|
248 |
-
*/
|
249 |
-
public function remove( $handle ) {
|
250 |
-
$removed = false;
|
251 |
-
$logs = $this->get_log_files();
|
252 |
-
$handle = sanitize_title( $handle );
|
253 |
-
|
254 |
-
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
|
255 |
-
$file = realpath( trailingslashit( CARTFLOWS_LOG_DIR ) . $logs[ $handle ] );
|
256 |
-
if ( 0 === stripos( $file, realpath( trailingslashit( CARTFLOWS_LOG_DIR ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
257 |
-
$this->close( $file ); // Close first to be certain no processes keep it alive after it is unlinked.
|
258 |
-
$removed = unlink( $file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
|
259 |
-
}
|
260 |
-
do_action( 'cartflows_log_remove', $handle, $removed );
|
261 |
-
}
|
262 |
-
return $removed;
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Check if log file should be rotated.
|
267 |
-
*
|
268 |
-
* Compares the size of the log file to determine whether it is over the size limit.
|
269 |
-
*
|
270 |
-
* @param string $handle Log handle.
|
271 |
-
* @return bool True if if should be rotated.
|
272 |
-
*/
|
273 |
-
protected function should_rotate( $handle ) {
|
274 |
-
$file = self::get_log_file_path( $handle );
|
275 |
-
if ( $file ) {
|
276 |
-
if ( $this->is_open( $handle ) ) {
|
277 |
-
$file_stat = fstat( $this->handles[ $handle ] );
|
278 |
-
return $file_stat['size'] > $this->log_size_limit;
|
279 |
-
} elseif ( file_exists( $file ) ) {
|
280 |
-
return filesize( $file ) > $this->log_size_limit;
|
281 |
-
} else {
|
282 |
-
return false;
|
283 |
-
}
|
284 |
-
} else {
|
285 |
-
return false;
|
286 |
-
}
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Rotate log files.
|
291 |
-
*
|
292 |
-
* Logs are rotated by prepending '.x' to the '.log' suffix.
|
293 |
-
* The current log plus 10 historical logs are maintained.
|
294 |
-
* For example:
|
295 |
-
* base.9.log -> [ REMOVED ]
|
296 |
-
* base.8.log -> base.9.log
|
297 |
-
* ...
|
298 |
-
* base.0.log -> base.1.log
|
299 |
-
* base.log -> base.0.log
|
300 |
-
*
|
301 |
-
* @param string $handle Log handle.
|
302 |
-
*/
|
303 |
-
protected function log_rotate( $handle ) {
|
304 |
-
for ( $i = 8; $i >= 0; $i-- ) {
|
305 |
-
$this->increment_log_infix( $handle, $i );
|
306 |
-
}
|
307 |
-
$this->increment_log_infix( $handle );
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Increment a log file suffix.
|
312 |
-
*
|
313 |
-
* @param string $handle Log handle.
|
314 |
-
* @param null|int $number Optional. Default null. Log suffix number to be incremented.
|
315 |
-
* @return bool True if increment was successful, otherwise false.
|
316 |
-
*/
|
317 |
-
protected function increment_log_infix( $handle, $number = null ) {
|
318 |
-
if ( null === $number ) {
|
319 |
-
$suffix = '';
|
320 |
-
$next_suffix = '.0';
|
321 |
-
} else {
|
322 |
-
$suffix = '.' . $number;
|
323 |
-
$next_suffix = '.' . ( $number + 1 );
|
324 |
-
}
|
325 |
-
|
326 |
-
$rename_from = self::get_log_file_path( "{$handle}{$suffix}" );
|
327 |
-
$rename_to = self::get_log_file_path( "{$handle}{$next_suffix}" );
|
328 |
-
|
329 |
-
if ( $this->is_open( $rename_from ) ) {
|
330 |
-
$this->close( $rename_from );
|
331 |
-
}
|
332 |
-
|
333 |
-
if ( is_writable( $rename_from ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
334 |
-
return rename( $rename_from, $rename_to ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_rename
|
335 |
-
} else {
|
336 |
-
return false;
|
337 |
-
}
|
338 |
-
|
339 |
-
}
|
340 |
-
|
341 |
-
/**
|
342 |
-
* Get a log file path.
|
343 |
-
*
|
344 |
-
* @param string $handle Log name.
|
345 |
-
* @return bool|string The log file path or false if path cannot be determined.
|
346 |
-
*/
|
347 |
-
public static function get_log_file_path( $handle ) {
|
348 |
-
if ( function_exists( 'wp_hash' ) ) {
|
349 |
-
return trailingslashit( CARTFLOWS_LOG_DIR ) . self::get_log_file_name( $handle );
|
350 |
-
} else {
|
351 |
-
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.0' );
|
352 |
-
return false;
|
353 |
-
}
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Get a log file name.
|
358 |
-
*
|
359 |
-
* File names consist of the handle, followed by the date, followed by a hash, .log.
|
360 |
-
*
|
361 |
-
* @since 3.3
|
362 |
-
* @param string $handle Log name.
|
363 |
-
* @return bool|string The log file name or false if cannot be determined.
|
364 |
-
*/
|
365 |
-
public static function get_log_file_name( $handle ) {
|
366 |
-
if ( function_exists( 'wp_hash' ) ) {
|
367 |
-
$date_suffix = gmdate( 'Y-m-d', time() );
|
368 |
-
$hash_suffix = wp_hash( $handle );
|
369 |
-
return sanitize_file_name( implode( '-', array( $handle, $date_suffix, $hash_suffix ) ) . '.log' );
|
370 |
-
} else {
|
371 |
-
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.3' );
|
372 |
-
return false;
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* Cache log to write later.
|
378 |
-
*
|
379 |
-
* @param string $entry Log entry text.
|
380 |
-
* @param string $handle Log entry handle.
|
381 |
-
*/
|
382 |
-
protected function cache_log( $entry, $handle ) {
|
383 |
-
$this->cached_logs[] = array(
|
384 |
-
'entry' => $entry,
|
385 |
-
'handle' => $handle,
|
386 |
-
);
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* Write cached logs.
|
391 |
-
*/
|
392 |
-
public function write_cached_logs() {
|
393 |
-
foreach ( $this->cached_logs as $log ) {
|
394 |
-
$this->add( $log['entry'], $log['handle'] );
|
395 |
-
}
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Delete all logs older than a defined timestamp.
|
400 |
-
*
|
401 |
-
* @since 3.4.0
|
402 |
-
* @param integer $timestamp Timestamp to delete logs before.
|
403 |
-
*/
|
404 |
-
public static function delete_logs_before_timestamp( $timestamp = 0 ) {
|
405 |
-
if ( ! $timestamp ) {
|
406 |
-
return;
|
407 |
-
}
|
408 |
-
|
409 |
-
$log_files = self::get_log_files();
|
410 |
-
|
411 |
-
foreach ( $log_files as $log_file ) {
|
412 |
-
$last_modified = filemtime( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file );
|
413 |
-
|
414 |
-
if ( $last_modified < $timestamp ) {
|
415 |
-
@unlink( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file ); // @codingStandardsIgnoreLine.
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Get all log files in the log directory.
|
422 |
-
*
|
423 |
-
* @since 3.4.0
|
424 |
-
* @return array
|
425 |
-
*/
|
426 |
-
public static function get_log_files() {
|
427 |
-
$files = @scandir( CARTFLOWS_LOG_DIR ); // @codingStandardsIgnoreLine.
|
428 |
-
$result = array();
|
429 |
-
|
430 |
-
if ( ! empty( $files ) ) {
|
431 |
-
foreach ( $files as $key => $value ) {
|
432 |
-
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
|
433 |
-
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
|
434 |
-
$result[ sanitize_title( $value ) ] = $value;
|
435 |
-
}
|
436 |
-
}
|
437 |
-
}
|
438 |
-
}
|
439 |
-
|
440 |
-
return $result;
|
441 |
-
}
|
442 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class Cartflows_Log_Handler_File file.
|
4 |
+
*
|
5 |
+
* @package WooCommerce\Log Handlers
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly.
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Handles log entries by writing to a file.
|
14 |
+
*
|
15 |
+
* @class Cartflows_Log_Handler_File
|
16 |
+
* @version 1.0.0
|
17 |
+
* @package WooCommerce/Classes/Log_Handlers
|
18 |
+
*/
|
19 |
+
class Cartflows_Log_Handler_File extends Cartflows_Log_Handler {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Stores open file handles.
|
23 |
+
*
|
24 |
+
* @var array
|
25 |
+
*/
|
26 |
+
protected $handles = array();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* File size limit for log files in bytes.
|
30 |
+
*
|
31 |
+
* @var int
|
32 |
+
*/
|
33 |
+
protected $log_size_limit;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Cache logs that could not be written.
|
37 |
+
*
|
38 |
+
* If a log is written too early in the request, pluggable functions may be unavailable. These
|
39 |
+
* logs will be cached and written on 'plugins_loaded' action.
|
40 |
+
*
|
41 |
+
* @var array
|
42 |
+
*/
|
43 |
+
protected $cached_logs = array();
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Constructor for the logger.
|
47 |
+
*
|
48 |
+
* @param int $log_size_limit Optional. Size limit for log files. Default 5mb.
|
49 |
+
*/
|
50 |
+
public function __construct( $log_size_limit = null ) {
|
51 |
+
if ( null === $log_size_limit ) {
|
52 |
+
$log_size_limit = 5 * 1024 * 1024;
|
53 |
+
}
|
54 |
+
|
55 |
+
$this->log_size_limit = apply_filters( 'cartflows_log_file_size_limit', $log_size_limit );
|
56 |
+
|
57 |
+
add_action( 'plugins_loaded', array( $this, 'write_cached_logs' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Destructor.
|
62 |
+
*
|
63 |
+
* Cleans up open file handles.
|
64 |
+
*/
|
65 |
+
public function __destruct() {
|
66 |
+
foreach ( $this->handles as $handle ) {
|
67 |
+
if ( is_resource( $handle ) ) {
|
68 |
+
fclose( $handle ); // @codingStandardsIgnoreLine.
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Handle a log entry.
|
75 |
+
*
|
76 |
+
* @param int $timestamp Log timestamp.
|
77 |
+
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
78 |
+
* @param string $message Log message.
|
79 |
+
* @param array $context {
|
80 |
+
* Additional information for log handlers.
|
81 |
+
*
|
82 |
+
* @type string $source Optional. Determines log file to write to. Default 'log'.
|
83 |
+
* @type bool $_legacy Optional. Default false. True to use outdated log format
|
84 |
+
* originally used in deprecated Cartflows_WC_Logger::add calls.
|
85 |
+
* }
|
86 |
+
*
|
87 |
+
* @return bool False if value was not handled and true if value was handled.
|
88 |
+
*/
|
89 |
+
public function handle( $timestamp, $level, $message, $context ) {
|
90 |
+
|
91 |
+
if ( isset( $context['source'] ) && $context['source'] ) {
|
92 |
+
$handle = $context['source'];
|
93 |
+
} else {
|
94 |
+
$handle = 'log';
|
95 |
+
}
|
96 |
+
|
97 |
+
$entry = self::format_entry( $timestamp, $level, $message, $context );
|
98 |
+
|
99 |
+
return $this->add( $entry, $handle );
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Builds a log entry text from timestamp, level and message.
|
104 |
+
*
|
105 |
+
* @param int $timestamp Log timestamp.
|
106 |
+
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
107 |
+
* @param string $message Log message.
|
108 |
+
* @param array $context Additional information for log handlers.
|
109 |
+
*
|
110 |
+
* @return string Formatted log entry.
|
111 |
+
*/
|
112 |
+
protected static function format_entry( $timestamp, $level, $message, $context ) {
|
113 |
+
|
114 |
+
if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) {
|
115 |
+
if ( isset( $context['source'] ) && $context['source'] ) {
|
116 |
+
$handle = $context['source'];
|
117 |
+
} else {
|
118 |
+
$handle = 'log';
|
119 |
+
}
|
120 |
+
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
|
121 |
+
$time = date_i18n( 'm-d-Y @ H:i:s' );
|
122 |
+
$entry = "{$time} - {$message}";
|
123 |
+
} else {
|
124 |
+
$entry = parent::format_entry( $timestamp, $level, $message, $context );
|
125 |
+
}
|
126 |
+
|
127 |
+
return $entry;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Open log file for writing.
|
132 |
+
*
|
133 |
+
* @param string $handle Log handle.
|
134 |
+
* @param string $mode Optional. File mode. Default 'a'.
|
135 |
+
* @return bool Success.
|
136 |
+
*/
|
137 |
+
protected function open( $handle, $mode = 'a' ) {
|
138 |
+
if ( $this->is_open( $handle ) ) {
|
139 |
+
return true;
|
140 |
+
}
|
141 |
+
|
142 |
+
$file = self::get_log_file_path( $handle );
|
143 |
+
|
144 |
+
if ( $file ) {
|
145 |
+
if ( ! file_exists( $file ) ) {
|
146 |
+
$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
|
147 |
+
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
|
148 |
+
|
149 |
+
if ( defined( 'FS_CHMOD_FILE' ) ) {
|
150 |
+
@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
$resource = @fopen( $file, $mode ); // @codingStandardsIgnoreLine.
|
155 |
+
|
156 |
+
if ( $resource ) {
|
157 |
+
$this->handles[ $handle ] = $resource;
|
158 |
+
return true;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
return false;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Check if a handle is open.
|
167 |
+
*
|
168 |
+
* @param string $handle Log handle.
|
169 |
+
* @return bool True if $handle is open.
|
170 |
+
*/
|
171 |
+
protected function is_open( $handle ) {
|
172 |
+
return array_key_exists( $handle, $this->handles ) && is_resource( $this->handles[ $handle ] );
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Close a handle.
|
177 |
+
*
|
178 |
+
* @param string $handle Log handle.
|
179 |
+
* @return bool success
|
180 |
+
*/
|
181 |
+
protected function close( $handle ) {
|
182 |
+
$result = false;
|
183 |
+
|
184 |
+
if ( $this->is_open( $handle ) ) {
|
185 |
+
$result = fclose( $this->handles[ $handle ] ); // @codingStandardsIgnoreLine.
|
186 |
+
unset( $this->handles[ $handle ] );
|
187 |
+
}
|
188 |
+
|
189 |
+
return $result;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Add a log entry to chosen file.
|
194 |
+
*
|
195 |
+
* @param string $entry Log entry text.
|
196 |
+
* @param string $handle Log entry handle.
|
197 |
+
*
|
198 |
+
* @return bool True if write was successful.
|
199 |
+
*/
|
200 |
+
protected function add( $entry, $handle ) {
|
201 |
+
$result = false;
|
202 |
+
|
203 |
+
if ( $this->should_rotate( $handle ) ) {
|
204 |
+
$this->log_rotate( $handle );
|
205 |
+
}
|
206 |
+
|
207 |
+
if ( $this->open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
|
208 |
+
$result = fwrite( $this->handles[ $handle ], $entry . PHP_EOL ); // @codingStandardsIgnoreLine.
|
209 |
+
} else {
|
210 |
+
$this->cache_log( $entry, $handle );
|
211 |
+
}
|
212 |
+
|
213 |
+
return false !== $result;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Clear entries from chosen file.
|
218 |
+
*
|
219 |
+
* @param string $handle Log handle.
|
220 |
+
*
|
221 |
+
* @return bool
|
222 |
+
*/
|
223 |
+
public function clear( $handle ) {
|
224 |
+
$result = false;
|
225 |
+
|
226 |
+
// Close the file if it's already open.
|
227 |
+
$this->close( $handle );
|
228 |
+
|
229 |
+
/**
|
230 |
+
* $this->open( $handle, 'w' ) == Open the file for writing only. Place the file pointer at
|
231 |
+
* the beginning of the file, and truncate the file to zero length.
|
232 |
+
*/
|
233 |
+
if ( $this->open( $handle, 'w' ) && is_resource( $this->handles[ $handle ] ) ) {
|
234 |
+
$result = true;
|
235 |
+
}
|
236 |
+
|
237 |
+
do_action( 'cartflows_log_clear', $handle );
|
238 |
+
|
239 |
+
return $result;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Remove/delete the chosen file.
|
244 |
+
*
|
245 |
+
* @param string $handle Log handle.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function remove( $handle ) {
|
250 |
+
$removed = false;
|
251 |
+
$logs = $this->get_log_files();
|
252 |
+
$handle = sanitize_title( $handle );
|
253 |
+
|
254 |
+
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
|
255 |
+
$file = realpath( trailingslashit( CARTFLOWS_LOG_DIR ) . $logs[ $handle ] );
|
256 |
+
if ( 0 === stripos( $file, realpath( trailingslashit( CARTFLOWS_LOG_DIR ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
257 |
+
$this->close( $file ); // Close first to be certain no processes keep it alive after it is unlinked.
|
258 |
+
$removed = unlink( $file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
|
259 |
+
}
|
260 |
+
do_action( 'cartflows_log_remove', $handle, $removed );
|
261 |
+
}
|
262 |
+
return $removed;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Check if log file should be rotated.
|
267 |
+
*
|
268 |
+
* Compares the size of the log file to determine whether it is over the size limit.
|
269 |
+
*
|
270 |
+
* @param string $handle Log handle.
|
271 |
+
* @return bool True if if should be rotated.
|
272 |
+
*/
|
273 |
+
protected function should_rotate( $handle ) {
|
274 |
+
$file = self::get_log_file_path( $handle );
|
275 |
+
if ( $file ) {
|
276 |
+
if ( $this->is_open( $handle ) ) {
|
277 |
+
$file_stat = fstat( $this->handles[ $handle ] );
|
278 |
+
return $file_stat['size'] > $this->log_size_limit;
|
279 |
+
} elseif ( file_exists( $file ) ) {
|
280 |
+
return filesize( $file ) > $this->log_size_limit;
|
281 |
+
} else {
|
282 |
+
return false;
|
283 |
+
}
|
284 |
+
} else {
|
285 |
+
return false;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Rotate log files.
|
291 |
+
*
|
292 |
+
* Logs are rotated by prepending '.x' to the '.log' suffix.
|
293 |
+
* The current log plus 10 historical logs are maintained.
|
294 |
+
* For example:
|
295 |
+
* base.9.log -> [ REMOVED ]
|
296 |
+
* base.8.log -> base.9.log
|
297 |
+
* ...
|
298 |
+
* base.0.log -> base.1.log
|
299 |
+
* base.log -> base.0.log
|
300 |
+
*
|
301 |
+
* @param string $handle Log handle.
|
302 |
+
*/
|
303 |
+
protected function log_rotate( $handle ) {
|
304 |
+
for ( $i = 8; $i >= 0; $i-- ) {
|
305 |
+
$this->increment_log_infix( $handle, $i );
|
306 |
+
}
|
307 |
+
$this->increment_log_infix( $handle );
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Increment a log file suffix.
|
312 |
+
*
|
313 |
+
* @param string $handle Log handle.
|
314 |
+
* @param null|int $number Optional. Default null. Log suffix number to be incremented.
|
315 |
+
* @return bool True if increment was successful, otherwise false.
|
316 |
+
*/
|
317 |
+
protected function increment_log_infix( $handle, $number = null ) {
|
318 |
+
if ( null === $number ) {
|
319 |
+
$suffix = '';
|
320 |
+
$next_suffix = '.0';
|
321 |
+
} else {
|
322 |
+
$suffix = '.' . $number;
|
323 |
+
$next_suffix = '.' . ( $number + 1 );
|
324 |
+
}
|
325 |
+
|
326 |
+
$rename_from = self::get_log_file_path( "{$handle}{$suffix}" );
|
327 |
+
$rename_to = self::get_log_file_path( "{$handle}{$next_suffix}" );
|
328 |
+
|
329 |
+
if ( $this->is_open( $rename_from ) ) {
|
330 |
+
$this->close( $rename_from );
|
331 |
+
}
|
332 |
+
|
333 |
+
if ( is_writable( $rename_from ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
|
334 |
+
return rename( $rename_from, $rename_to ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_rename
|
335 |
+
} else {
|
336 |
+
return false;
|
337 |
+
}
|
338 |
+
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Get a log file path.
|
343 |
+
*
|
344 |
+
* @param string $handle Log name.
|
345 |
+
* @return bool|string The log file path or false if path cannot be determined.
|
346 |
+
*/
|
347 |
+
public static function get_log_file_path( $handle ) {
|
348 |
+
if ( function_exists( 'wp_hash' ) ) {
|
349 |
+
return trailingslashit( CARTFLOWS_LOG_DIR ) . self::get_log_file_name( $handle );
|
350 |
+
} else {
|
351 |
+
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.0' );
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Get a log file name.
|
358 |
+
*
|
359 |
+
* File names consist of the handle, followed by the date, followed by a hash, .log.
|
360 |
+
*
|
361 |
+
* @since 3.3
|
362 |
+
* @param string $handle Log name.
|
363 |
+
* @return bool|string The log file name or false if cannot be determined.
|
364 |
+
*/
|
365 |
+
public static function get_log_file_name( $handle ) {
|
366 |
+
if ( function_exists( 'wp_hash' ) ) {
|
367 |
+
$date_suffix = gmdate( 'Y-m-d', time() );
|
368 |
+
$hash_suffix = wp_hash( $handle );
|
369 |
+
return sanitize_file_name( implode( '-', array( $handle, $date_suffix, $hash_suffix ) ) . '.log' );
|
370 |
+
} else {
|
371 |
+
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.3' );
|
372 |
+
return false;
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* Cache log to write later.
|
378 |
+
*
|
379 |
+
* @param string $entry Log entry text.
|
380 |
+
* @param string $handle Log entry handle.
|
381 |
+
*/
|
382 |
+
protected function cache_log( $entry, $handle ) {
|
383 |
+
$this->cached_logs[] = array(
|
384 |
+
'entry' => $entry,
|
385 |
+
'handle' => $handle,
|
386 |
+
);
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Write cached logs.
|
391 |
+
*/
|
392 |
+
public function write_cached_logs() {
|
393 |
+
foreach ( $this->cached_logs as $log ) {
|
394 |
+
$this->add( $log['entry'], $log['handle'] );
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
/**
|
399 |
+
* Delete all logs older than a defined timestamp.
|
400 |
+
*
|
401 |
+
* @since 3.4.0
|
402 |
+
* @param integer $timestamp Timestamp to delete logs before.
|
403 |
+
*/
|
404 |
+
public static function delete_logs_before_timestamp( $timestamp = 0 ) {
|
405 |
+
if ( ! $timestamp ) {
|
406 |
+
return;
|
407 |
+
}
|
408 |
+
|
409 |
+
$log_files = self::get_log_files();
|
410 |
+
|
411 |
+
foreach ( $log_files as $log_file ) {
|
412 |
+
$last_modified = filemtime( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file );
|
413 |
+
|
414 |
+
if ( $last_modified < $timestamp ) {
|
415 |
+
@unlink( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file ); // @codingStandardsIgnoreLine.
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Get all log files in the log directory.
|
422 |
+
*
|
423 |
+
* @since 3.4.0
|
424 |
+
* @return array
|
425 |
+
*/
|
426 |
+
public static function get_log_files() {
|
427 |
+
$files = @scandir( CARTFLOWS_LOG_DIR ); // @codingStandardsIgnoreLine.
|
428 |
+
$result = array();
|
429 |
+
|
430 |
+
if ( ! empty( $files ) ) {
|
431 |
+
foreach ( $files as $key => $value ) {
|
432 |
+
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
|
433 |
+
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
|
434 |
+
$result[ sanitize_title( $value ) ] = $value;
|
435 |
+
}
|
436 |
+
}
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
return $result;
|
441 |
+
}
|
442 |
+
}
|
classes/logger/class-cartflows-log-handler.php
CHANGED
@@ -1,57 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Log handling functionality.
|
4 |
-
*
|
5 |
-
* @class Cartflows_Log_Handler
|
6 |
-
* @package WooCommerce/Abstracts
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit; // Exit if accessed directly.
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Abstract WC Log Handler Class
|
15 |
-
*
|
16 |
-
* @version 1.0.0
|
17 |
-
* @package WooCommerce/Abstracts
|
18 |
-
*/
|
19 |
-
abstract class Cartflows_Log_Handler implements Cartflows_Log_Handler_Interface {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Formats a timestamp for use in log messages.
|
23 |
-
*
|
24 |
-
* @param int $timestamp Log timestamp.
|
25 |
-
* @return string Formatted time for use in log entry.
|
26 |
-
*/
|
27 |
-
protected static function format_time( $timestamp ) {
|
28 |
-
return gmdate( 'c', $timestamp );
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Builds a log entry text from level, timestamp and message.
|
33 |
-
*
|
34 |
-
* @param int $timestamp Log timestamp.
|
35 |
-
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
36 |
-
* @param string $message Log message.
|
37 |
-
* @param array $context Additional information for log handlers.
|
38 |
-
*
|
39 |
-
* @return string Formatted log entry.
|
40 |
-
*/
|
41 |
-
protected static function format_entry( $timestamp, $level, $message, $context ) {
|
42 |
-
$time_string = self::format_time( $timestamp );
|
43 |
-
$level_string = strtoupper( $level );
|
44 |
-
$entry = "{$time_string} {$level_string} {$message}";
|
45 |
-
|
46 |
-
return apply_filters(
|
47 |
-
'cartflows_format_log_entry',
|
48 |
-
$entry,
|
49 |
-
array(
|
50 |
-
'timestamp' => $timestamp,
|
51 |
-
'level' => $level,
|
52 |
-
'message' => $message,
|
53 |
-
'context' => $context,
|
54 |
-
)
|
55 |
-
);
|
56 |
-
}
|
57 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Log handling functionality.
|
4 |
+
*
|
5 |
+
* @class Cartflows_Log_Handler
|
6 |
+
* @package WooCommerce/Abstracts
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit; // Exit if accessed directly.
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Abstract WC Log Handler Class
|
15 |
+
*
|
16 |
+
* @version 1.0.0
|
17 |
+
* @package WooCommerce/Abstracts
|
18 |
+
*/
|
19 |
+
abstract class Cartflows_Log_Handler implements Cartflows_Log_Handler_Interface {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Formats a timestamp for use in log messages.
|
23 |
+
*
|
24 |
+
* @param int $timestamp Log timestamp.
|
25 |
+
* @return string Formatted time for use in log entry.
|
26 |
+
*/
|
27 |
+
protected static function format_time( $timestamp ) {
|
28 |
+
return gmdate( 'c', $timestamp );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Builds a log entry text from level, timestamp and message.
|
33 |
+
*
|
34 |
+
* @param int $timestamp Log timestamp.
|
35 |
+
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
36 |
+
* @param string $message Log message.
|
37 |
+
* @param array $context Additional information for log handlers.
|
38 |
+
*
|
39 |
+
* @return string Formatted log entry.
|
40 |
+
*/
|
41 |
+
protected static function format_entry( $timestamp, $level, $message, $context ) {
|
42 |
+
$time_string = self::format_time( $timestamp );
|
43 |
+
$level_string = strtoupper( $level );
|
44 |
+
$entry = "{$time_string} {$level_string} {$message}";
|
45 |
+
|
46 |
+
return apply_filters(
|
47 |
+
'cartflows_format_log_entry',
|
48 |
+
$entry,
|
49 |
+
array(
|
50 |
+
'timestamp' => $timestamp,
|
51 |
+
'level' => $level,
|
52 |
+
'message' => $message,
|
53 |
+
'context' => $context,
|
54 |
+
)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
}
|
classes/logger/class-cartflows-wc-logger.php
CHANGED
@@ -1,301 +1,301 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Provides logging capabilities for debugging purposes.
|
4 |
-
*
|
5 |
-
* @class Cartflows_WC_Logger
|
6 |
-
* @version 2.0.0
|
7 |
-
* @package WooCommerce/Classes
|
8 |
-
*/
|
9 |
-
|
10 |
-
defined( 'ABSPATH' ) || exit;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Cartflows_WC_Logger class.
|
14 |
-
*/
|
15 |
-
class Cartflows_WC_Logger implements Cartflows_WC_Logger_Interface {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Stores registered log handlers.
|
19 |
-
*
|
20 |
-
* @var array
|
21 |
-
*/
|
22 |
-
protected $handlers;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Minimum log level this handler will process.
|
26 |
-
*
|
27 |
-
* @var int Integer representation of minimum log level to handle.
|
28 |
-
*/
|
29 |
-
protected $threshold;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Constructor for the logger.
|
33 |
-
*
|
34 |
-
* @param array $handlers Optional. Array of log handlers. If $handlers is not provided, the filter 'woocommerce_register_log_handlers' will be used to define the handlers. If $handlers is provided, the filter will not be applied and the handlers will be used directly.
|
35 |
-
* @param string $threshold Optional. Define an explicit threshold. May be configured via WC_LOG_THRESHOLD. By default, all logs will be processed.
|
36 |
-
*/
|
37 |
-
public function __construct( $handlers = null, $threshold = null ) {
|
38 |
-
if ( null === $handlers ) {
|
39 |
-
$handlers = apply_filters( 'cartflows_register_log_handlers', array() );
|
40 |
-
|
41 |
-
$default_handler = new Cartflows_Log_Handler_File();
|
42 |
-
|
43 |
-
array_push( $handlers, $default_handler );
|
44 |
-
}
|
45 |
-
|
46 |
-
$register_handlers = array();
|
47 |
-
|
48 |
-
if ( ! empty( $handlers ) && is_array( $handlers ) ) {
|
49 |
-
foreach ( $handlers as $handler ) {
|
50 |
-
$implements = class_implements( $handler );
|
51 |
-
if ( is_object( $handler ) && is_array( $implements ) && in_array( 'Cartflows_Log_Handler_Interface', $implements, true ) ) {
|
52 |
-
$register_handlers[] = $handler;
|
53 |
-
} else {
|
54 |
-
wc_doing_it_wrong(
|
55 |
-
__METHOD__,
|
56 |
-
sprintf(
|
57 |
-
/* translators: 1: class name 2: Cartflows_Log_Handler_Interface */
|
58 |
-
__( 'The provided handler %1$s does not implement %2$s.', 'cartflows' ),
|
59 |
-
'<code>' . esc_html( is_object( $handler ) ? get_class( $handler ) : $handler ) . '</code>',
|
60 |
-
'<code>Cartflows_Log_Handler_Interface</code>'
|
61 |
-
),
|
62 |
-
'3.0'
|
63 |
-
);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
if ( null !== $threshold ) {
|
69 |
-
$threshold = Cartflows_Log_Levels::get_level_severity( $threshold );
|
70 |
-
} elseif ( defined( 'WC_LOG_THRESHOLD' ) && Cartflows_Log_Levels::is_valid_level( WC_LOG_THRESHOLD ) ) {
|
71 |
-
$threshold = Cartflows_Log_Levels::get_level_severity( WC_LOG_THRESHOLD );
|
72 |
-
} else {
|
73 |
-
$threshold = null;
|
74 |
-
}
|
75 |
-
|
76 |
-
$this->handlers = $register_handlers;
|
77 |
-
$this->threshold = $threshold;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Determine whether to handle or ignore log.
|
82 |
-
*
|
83 |
-
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
84 |
-
* @return bool True if the log should be handled.
|
85 |
-
*/
|
86 |
-
protected function should_handle( $level ) {
|
87 |
-
if ( null === $this->threshold ) {
|
88 |
-
return true;
|
89 |
-
}
|
90 |
-
return $this->threshold <= Cartflows_Log_Levels::get_level_severity( $level );
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Add a log entry.
|
95 |
-
*
|
96 |
-
* This is not the preferred method for adding log messages. Please use log() or any one of
|
97 |
-
* the level methods (debug(), info(), etc.). This method may be deprecated in the future.
|
98 |
-
*
|
99 |
-
* @param string $handle File handle.
|
100 |
-
* @param string $message Message to log.
|
101 |
-
* @param string $level Logging level.
|
102 |
-
* @return bool
|
103 |
-
*/
|
104 |
-
public function add( $handle, $message, $level = Cartflows_Log_Levels::NOTICE ) {
|
105 |
-
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
|
106 |
-
$this->log(
|
107 |
-
$level,
|
108 |
-
$message,
|
109 |
-
array(
|
110 |
-
'source' => $handle,
|
111 |
-
'_legacy' => true,
|
112 |
-
)
|
113 |
-
);
|
114 |
-
wc_do_deprecated_action( 'cartflows_log_add', array( $handle, $message ), '3.0', 'This action has been deprecated with no alternative.' );
|
115 |
-
return true;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Add a log entry.
|
120 |
-
*
|
121 |
-
* @param string $level One of the following:
|
122 |
-
* 'emergency': System is unusable.
|
123 |
-
* 'alert': Action must be taken immediately.
|
124 |
-
* 'critical': Critical conditions.
|
125 |
-
* 'error': Error conditions.
|
126 |
-
* 'warning': Warning conditions.
|
127 |
-
* 'notice': Normal but significant condition.
|
128 |
-
* 'info': Informational messages.
|
129 |
-
* 'debug': Debug-level messages.
|
130 |
-
* @param string $message Log message.
|
131 |
-
* @param array $context Optional. Additional information for log handlers.
|
132 |
-
*/
|
133 |
-
public function log( $level, $message, $context = array() ) {
|
134 |
-
if ( ! Cartflows_Log_Levels::is_valid_level( $level ) ) {
|
135 |
-
/* translators: 1: Cartflows_WC_Logger::log 2: level */
|
136 |
-
wc_doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'cartflows' ), '<code>Cartflows_WC_Logger::log</code>', $level ), '3.0' );
|
137 |
-
}
|
138 |
-
|
139 |
-
if ( $this->should_handle( $level ) ) {
|
140 |
-
$timestamp = time();
|
141 |
-
$message = apply_filters( 'cartflows_logger_log_message', $message, $level, $context );
|
142 |
-
|
143 |
-
foreach ( $this->handlers as $handler ) {
|
144 |
-
$handler->handle( $timestamp, $level, $message, $context );
|
145 |
-
}
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Adds an emergency level message.
|
151 |
-
*
|
152 |
-
* System is unusable.
|
153 |
-
*
|
154 |
-
* @see Cartflows_WC_Logger::log
|
155 |
-
*
|
156 |
-
* @param string $message Message to log.
|
157 |
-
* @param array $context Log context.
|
158 |
-
*/
|
159 |
-
public function emergency( $message, $context = array() ) {
|
160 |
-
$this->log( Cartflows_Log_Levels::EMERGENCY, $message, $context );
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Adds an alert level message.
|
165 |
-
*
|
166 |
-
* Action must be taken immediately.
|
167 |
-
* Example: Entire website down, database unavailable, etc.
|
168 |
-
*
|
169 |
-
* @see Cartflows_WC_Logger::log
|
170 |
-
*
|
171 |
-
* @param string $message Message to log.
|
172 |
-
* @param array $context Log context.
|
173 |
-
*/
|
174 |
-
public function alert( $message, $context = array() ) {
|
175 |
-
$this->log( Cartflows_Log_Levels::ALERT, $message, $context );
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Adds a critical level message.
|
180 |
-
*
|
181 |
-
* Critical conditions.
|
182 |
-
* Example: Application component unavailable, unexpected exception.
|
183 |
-
*
|
184 |
-
* @see Cartflows_WC_Logger::log
|
185 |
-
*
|
186 |
-
* @param string $message Message to log.
|
187 |
-
* @param array $context Log context.
|
188 |
-
*/
|
189 |
-
public function critical( $message, $context = array() ) {
|
190 |
-
$this->log( Cartflows_Log_Levels::CRITICAL, $message, $context );
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Adds an error level message.
|
195 |
-
*
|
196 |
-
* Runtime errors that do not require immediate action but should typically be logged
|
197 |
-
* and monitored.
|
198 |
-
*
|
199 |
-
* @see Cartflows_WC_Logger::log
|
200 |
-
*
|
201 |
-
* @param string $message Message to log.
|
202 |
-
* @param array $context Log context.
|
203 |
-
*/
|
204 |
-
public function error( $message, $context = array() ) {
|
205 |
-
$this->log( Cartflows_Log_Levels::ERROR, $message, $context );
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Adds a warning level message.
|
210 |
-
*
|
211 |
-
* Exceptional occurrences that are not errors.
|
212 |
-
*
|
213 |
-
* Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
|
214 |
-
* necessarily wrong.
|
215 |
-
*
|
216 |
-
* @see Cartflows_WC_Logger::log
|
217 |
-
*
|
218 |
-
* @param string $message Message to log.
|
219 |
-
* @param array $context Log context.
|
220 |
-
*/
|
221 |
-
public function warning( $message, $context = array() ) {
|
222 |
-
$this->log( Cartflows_Log_Levels::WARNING, $message, $context );
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Adds a notice level message.
|
227 |
-
*
|
228 |
-
* Normal but significant events.
|
229 |
-
*
|
230 |
-
* @see Cartflows_WC_Logger::log
|
231 |
-
*
|
232 |
-
* @param string $message Message to log.
|
233 |
-
* @param array $context Log context.
|
234 |
-
*/
|
235 |
-
public function notice( $message, $context = array() ) {
|
236 |
-
$this->log( Cartflows_Log_Levels::NOTICE, $message, $context );
|
237 |
-
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Adds a info level message.
|
241 |
-
*
|
242 |
-
* Interesting events.
|
243 |
-
* Example: User logs in, SQL logs.
|
244 |
-
*
|
245 |
-
* @see Cartflows_WC_Logger::log
|
246 |
-
*
|
247 |
-
* @param string $message Message to log.
|
248 |
-
* @param array $context Log context.
|
249 |
-
*/
|
250 |
-
public function info( $message, $context = array() ) {
|
251 |
-
$this->log( Cartflows_Log_Levels::INFO, $message, $context );
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Adds a debug level message.
|
256 |
-
*
|
257 |
-
* Detailed debug information.
|
258 |
-
*
|
259 |
-
* @see Cartflows_WC_Logger::log
|
260 |
-
*
|
261 |
-
* @param string $message Message to log.
|
262 |
-
* @param array $context Log context.
|
263 |
-
*/
|
264 |
-
public function debug( $message, $context = array() ) {
|
265 |
-
$this->log( Cartflows_Log_Levels::DEBUG, $message, $context );
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Clear entries for a chosen file/source.
|
270 |
-
*
|
271 |
-
* @param string $source Source/handle to clear.
|
272 |
-
* @return bool
|
273 |
-
*/
|
274 |
-
public function clear( $source = '' ) {
|
275 |
-
if ( ! $source ) {
|
276 |
-
return false;
|
277 |
-
}
|
278 |
-
foreach ( $this->handlers as $handler ) {
|
279 |
-
if ( is_callable( array( $handler, 'clear' ) ) ) {
|
280 |
-
$handler->clear( $source );
|
281 |
-
}
|
282 |
-
}
|
283 |
-
return true;
|
284 |
-
}
|
285 |
-
|
286 |
-
/**
|
287 |
-
* Clear all logs older than a defined number of days. Defaults to 30 days.
|
288 |
-
*
|
289 |
-
* @since 3.4.0
|
290 |
-
*/
|
291 |
-
public function clear_expired_logs() {
|
292 |
-
$days = absint( apply_filters( 'cartflows_logger_days_to_retain_logs', 30 ) );
|
293 |
-
$timestamp = strtotime( "-{$days} days" );
|
294 |
-
|
295 |
-
foreach ( $this->handlers as $handler ) {
|
296 |
-
if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
|
297 |
-
$handler->delete_logs_before_timestamp( $timestamp );
|
298 |
-
}
|
299 |
-
}
|
300 |
-
}
|
301 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Provides logging capabilities for debugging purposes.
|
4 |
+
*
|
5 |
+
* @class Cartflows_WC_Logger
|
6 |
+
* @version 2.0.0
|
7 |
+
* @package WooCommerce/Classes
|
8 |
+
*/
|
9 |
+
|
10 |
+
defined( 'ABSPATH' ) || exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Cartflows_WC_Logger class.
|
14 |
+
*/
|
15 |
+
class Cartflows_WC_Logger implements Cartflows_WC_Logger_Interface {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Stores registered log handlers.
|
19 |
+
*
|
20 |
+
* @var array
|
21 |
+
*/
|
22 |
+
protected $handlers;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Minimum log level this handler will process.
|
26 |
+
*
|
27 |
+
* @var int Integer representation of minimum log level to handle.
|
28 |
+
*/
|
29 |
+
protected $threshold;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor for the logger.
|
33 |
+
*
|
34 |
+
* @param array $handlers Optional. Array of log handlers. If $handlers is not provided, the filter 'woocommerce_register_log_handlers' will be used to define the handlers. If $handlers is provided, the filter will not be applied and the handlers will be used directly.
|
35 |
+
* @param string $threshold Optional. Define an explicit threshold. May be configured via WC_LOG_THRESHOLD. By default, all logs will be processed.
|
36 |
+
*/
|
37 |
+
public function __construct( $handlers = null, $threshold = null ) {
|
38 |
+
if ( null === $handlers ) {
|
39 |
+
$handlers = apply_filters( 'cartflows_register_log_handlers', array() );
|
40 |
+
|
41 |
+
$default_handler = new Cartflows_Log_Handler_File();
|
42 |
+
|
43 |
+
array_push( $handlers, $default_handler );
|
44 |
+
}
|
45 |
+
|
46 |
+
$register_handlers = array();
|
47 |
+
|
48 |
+
if ( ! empty( $handlers ) && is_array( $handlers ) ) {
|
49 |
+
foreach ( $handlers as $handler ) {
|
50 |
+
$implements = class_implements( $handler );
|
51 |
+
if ( is_object( $handler ) && is_array( $implements ) && in_array( 'Cartflows_Log_Handler_Interface', $implements, true ) ) {
|
52 |
+
$register_handlers[] = $handler;
|
53 |
+
} else {
|
54 |
+
wc_doing_it_wrong(
|
55 |
+
__METHOD__,
|
56 |
+
sprintf(
|
57 |
+
/* translators: 1: class name 2: Cartflows_Log_Handler_Interface */
|
58 |
+
__( 'The provided handler %1$s does not implement %2$s.', 'cartflows' ),
|
59 |
+
'<code>' . esc_html( is_object( $handler ) ? get_class( $handler ) : $handler ) . '</code>',
|
60 |
+
'<code>Cartflows_Log_Handler_Interface</code>'
|
61 |
+
),
|
62 |
+
'3.0'
|
63 |
+
);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( null !== $threshold ) {
|
69 |
+
$threshold = Cartflows_Log_Levels::get_level_severity( $threshold );
|
70 |
+
} elseif ( defined( 'WC_LOG_THRESHOLD' ) && Cartflows_Log_Levels::is_valid_level( WC_LOG_THRESHOLD ) ) {
|
71 |
+
$threshold = Cartflows_Log_Levels::get_level_severity( WC_LOG_THRESHOLD );
|
72 |
+
} else {
|
73 |
+
$threshold = null;
|
74 |
+
}
|
75 |
+
|
76 |
+
$this->handlers = $register_handlers;
|
77 |
+
$this->threshold = $threshold;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Determine whether to handle or ignore log.
|
82 |
+
*
|
83 |
+
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
|
84 |
+
* @return bool True if the log should be handled.
|
85 |
+
*/
|
86 |
+
protected function should_handle( $level ) {
|
87 |
+
if ( null === $this->threshold ) {
|
88 |
+
return true;
|
89 |
+
}
|
90 |
+
return $this->threshold <= Cartflows_Log_Levels::get_level_severity( $level );
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Add a log entry.
|
95 |
+
*
|
96 |
+
* This is not the preferred method for adding log messages. Please use log() or any one of
|
97 |
+
* the level methods (debug(), info(), etc.). This method may be deprecated in the future.
|
98 |
+
*
|
99 |
+
* @param string $handle File handle.
|
100 |
+
* @param string $message Message to log.
|
101 |
+
* @param string $level Logging level.
|
102 |
+
* @return bool
|
103 |
+
*/
|
104 |
+
public function add( $handle, $message, $level = Cartflows_Log_Levels::NOTICE ) {
|
105 |
+
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
|
106 |
+
$this->log(
|
107 |
+
$level,
|
108 |
+
$message,
|
109 |
+
array(
|
110 |
+
'source' => $handle,
|
111 |
+
'_legacy' => true,
|
112 |
+
)
|
113 |
+
);
|
114 |
+
wc_do_deprecated_action( 'cartflows_log_add', array( $handle, $message ), '3.0', 'This action has been deprecated with no alternative.' );
|
115 |
+
return true;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Add a log entry.
|
120 |
+
*
|
121 |
+
* @param string $level One of the following:
|
122 |
+
* 'emergency': System is unusable.
|
123 |
+
* 'alert': Action must be taken immediately.
|
124 |
+
* 'critical': Critical conditions.
|
125 |
+
* 'error': Error conditions.
|
126 |
+
* 'warning': Warning conditions.
|
127 |
+
* 'notice': Normal but significant condition.
|
128 |
+
* 'info': Informational messages.
|
129 |
+
* 'debug': Debug-level messages.
|
130 |
+
* @param string $message Log message.
|
131 |
+
* @param array $context Optional. Additional information for log handlers.
|
132 |
+
*/
|
133 |
+
public function log( $level, $message, $context = array() ) {
|
134 |
+
if ( ! Cartflows_Log_Levels::is_valid_level( $level ) ) {
|
135 |
+
/* translators: 1: Cartflows_WC_Logger::log 2: level */
|
136 |
+
wc_doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'cartflows' ), '<code>Cartflows_WC_Logger::log</code>', $level ), '3.0' );
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( $this->should_handle( $level ) ) {
|
140 |
+
$timestamp = time();
|
141 |
+
$message = apply_filters( 'cartflows_logger_log_message', $message, $level, $context );
|
142 |
+
|
143 |
+
foreach ( $this->handlers as $handler ) {
|
144 |
+
$handler->handle( $timestamp, $level, $message, $context );
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Adds an emergency level message.
|
151 |
+
*
|
152 |
+
* System is unusable.
|
153 |
+
*
|
154 |
+
* @see Cartflows_WC_Logger::log
|
155 |
+
*
|
156 |
+
* @param string $message Message to log.
|
157 |
+
* @param array $context Log context.
|
158 |
+
*/
|
159 |
+
public function emergency( $message, $context = array() ) {
|
160 |
+
$this->log( Cartflows_Log_Levels::EMERGENCY, $message, $context );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Adds an alert level message.
|
165 |
+
*
|
166 |
+
* Action must be taken immediately.
|
167 |
+
* Example: Entire website down, database unavailable, etc.
|
168 |
+
*
|
169 |
+
* @see Cartflows_WC_Logger::log
|
170 |
+
*
|
171 |
+
* @param string $message Message to log.
|
172 |
+
* @param array $context Log context.
|
173 |
+
*/
|
174 |
+
public function alert( $message, $context = array() ) {
|
175 |
+
$this->log( Cartflows_Log_Levels::ALERT, $message, $context );
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Adds a critical level message.
|
180 |
+
*
|
181 |
+
* Critical conditions.
|
182 |
+
* Example: Application component unavailable, unexpected exception.
|
183 |
+
*
|
184 |
+
* @see Cartflows_WC_Logger::log
|
185 |
+
*
|
186 |
+
* @param string $message Message to log.
|
187 |
+
* @param array $context Log context.
|
188 |
+
*/
|
189 |
+
public function critical( $message, $context = array() ) {
|
190 |
+
$this->log( Cartflows_Log_Levels::CRITICAL, $message, $context );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Adds an error level message.
|
195 |
+
*
|
196 |
+
* Runtime errors that do not require immediate action but should typically be logged
|
197 |
+
* and monitored.
|
198 |
+
*
|
199 |
+
* @see Cartflows_WC_Logger::log
|
200 |
+
*
|
201 |
+
* @param string $message Message to log.
|
202 |
+
* @param array $context Log context.
|
203 |
+
*/
|
204 |
+
public function error( $message, $context = array() ) {
|
205 |
+
$this->log( Cartflows_Log_Levels::ERROR, $message, $context );
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Adds a warning level message.
|
210 |
+
*
|
211 |
+
* Exceptional occurrences that are not errors.
|
212 |
+
*
|
213 |
+
* Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
|
214 |
+
* necessarily wrong.
|
215 |
+
*
|
216 |
+
* @see Cartflows_WC_Logger::log
|
217 |
+
*
|
218 |
+
* @param string $message Message to log.
|
219 |
+
* @param array $context Log context.
|
220 |
+
*/
|
221 |
+
public function warning( $message, $context = array() ) {
|
222 |
+
$this->log( Cartflows_Log_Levels::WARNING, $message, $context );
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Adds a notice level message.
|
227 |
+
*
|
228 |
+
* Normal but significant events.
|
229 |
+
*
|
230 |
+
* @see Cartflows_WC_Logger::log
|
231 |
+
*
|
232 |
+
* @param string $message Message to log.
|
233 |
+
* @param array $context Log context.
|
234 |
+
*/
|
235 |
+
public function notice( $message, $context = array() ) {
|
236 |
+
$this->log( Cartflows_Log_Levels::NOTICE, $message, $context );
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Adds a info level message.
|
241 |
+
*
|
242 |
+
* Interesting events.
|
243 |
+
* Example: User logs in, SQL logs.
|
244 |
+
*
|
245 |
+
* @see Cartflows_WC_Logger::log
|
246 |
+
*
|
247 |
+
* @param string $message Message to log.
|
248 |
+
* @param array $context Log context.
|
249 |
+
*/
|
250 |
+
public function info( $message, $context = array() ) {
|
251 |
+
$this->log( Cartflows_Log_Levels::INFO, $message, $context );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Adds a debug level message.
|
256 |
+
*
|
257 |
+
* Detailed debug information.
|
258 |
+
*
|
259 |
+
* @see Cartflows_WC_Logger::log
|
260 |
+
*
|
261 |
+
* @param string $message Message to log.
|
262 |
+
* @param array $context Log context.
|
263 |
+
*/
|
264 |
+
public function debug( $message, $context = array() ) {
|
265 |
+
$this->log( Cartflows_Log_Levels::DEBUG, $message, $context );
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Clear entries for a chosen file/source.
|
270 |
+
*
|
271 |
+
* @param string $source Source/handle to clear.
|
272 |
+
* @return bool
|
273 |
+
*/
|
274 |
+
public function clear( $source = '' ) {
|
275 |
+
if ( ! $source ) {
|
276 |
+
return false;
|
277 |
+
}
|
278 |
+
foreach ( $this->handlers as $handler ) {
|
279 |
+
if ( is_callable( array( $handler, 'clear' ) ) ) {
|
280 |
+
$handler->clear( $source );
|
281 |
+
}
|
282 |
+
}
|
283 |
+
return true;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Clear all logs older than a defined number of days. Defaults to 30 days.
|
288 |
+
*
|
289 |
+
* @since 3.4.0
|
290 |
+
*/
|
291 |
+
public function clear_expired_logs() {
|
292 |
+
$days = absint( apply_filters( 'cartflows_logger_days_to_retain_logs', 30 ) );
|
293 |
+
$timestamp = strtotime( "-{$days} days" );
|
294 |
+
|
295 |
+
foreach ( $this->handlers as $handler ) {
|
296 |
+
if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
|
297 |
+
$handler->delete_logs_before_timestamp( $timestamp );
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
includes/admin/cartflows-admin.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CARTFLOWS Admin HTML.
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
?>
|
9 |
-
<div class="wcf-menu-page-wrapper">
|
10 |
-
<div id="wcf-menu-page">
|
11 |
-
<div class="wcf-menu-page-header <?php echo esc_attr( implode( ' ', $header_wrapper_class ) ); ?>">
|
12 |
-
<div class="wcf-container wcf-flex">
|
13 |
-
<div class="wcf-title">
|
14 |
-
<span class="screen-reader-text"><?php echo esc_attr( CARTFLOWS_PLUGIN_NAME ); ?></span>
|
15 |
-
<img class="wcf-logo" src="<?php echo esc_attr( CARTFLOWS_URL ) . 'assets/images/cartflows-logo.svg'; ?>" />
|
16 |
-
</div>
|
17 |
-
<div class="wcf-top-links">
|
18 |
-
<?php
|
19 |
-
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
20 |
-
?>
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
|
25 |
-
<?php
|
26 |
-
// Settings update message.
|
27 |
-
if ( isset( $_REQUEST['message'] ) && ( 'saved' == $_REQUEST['message'] || 'saved_ext' == $_REQUEST['message'] ) ) {
|
28 |
-
?>
|
29 |
-
<div id="message" class="notice notice-success is-dismissive wcf-notice"><p> <?php esc_html_e( 'Settings saved successfully.', 'cartflows' ); ?> </p></div>
|
30 |
-
<?php
|
31 |
-
}
|
32 |
-
?>
|
33 |
-
<?php do_action( 'cartflows_render_admin_content' ); ?>
|
34 |
-
</div>
|
35 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CARTFLOWS Admin HTML.
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<div class="wcf-menu-page-wrapper">
|
10 |
+
<div id="wcf-menu-page">
|
11 |
+
<div class="wcf-menu-page-header <?php echo esc_attr( implode( ' ', $header_wrapper_class ) ); ?>">
|
12 |
+
<div class="wcf-container wcf-flex">
|
13 |
+
<div class="wcf-title">
|
14 |
+
<span class="screen-reader-text"><?php echo esc_attr( CARTFLOWS_PLUGIN_NAME ); ?></span>
|
15 |
+
<img class="wcf-logo" src="<?php echo esc_attr( CARTFLOWS_URL ) . 'assets/images/cartflows-logo.svg'; ?>" />
|
16 |
+
</div>
|
17 |
+
<div class="wcf-top-links">
|
18 |
+
<?php
|
19 |
+
esc_attr_e( 'Modernizing WordPress eCommerce!', 'cartflows' );
|
20 |
+
?>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<?php
|
26 |
+
// Settings update message.
|
27 |
+
if ( isset( $_REQUEST['message'] ) && ( 'saved' == $_REQUEST['message'] || 'saved_ext' == $_REQUEST['message'] ) ) {
|
28 |
+
?>
|
29 |
+
<div id="message" class="notice notice-success is-dismissive wcf-notice"><p> <?php esc_html_e( 'Settings saved successfully.', 'cartflows' ); ?> </p></div>
|
30 |
+
<?php
|
31 |
+
}
|
32 |
+
?>
|
33 |
+
<?php do_action( 'cartflows_render_admin_content' ); ?>
|
34 |
+
</div>
|
35 |
+
</div>
|
includes/admin/cartflows-error-log.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin View: Page - Status Logs
|
4 |
-
*
|
5 |
-
* @package WooCommerce/Admin/Logs
|
6 |
-
*/
|
7 |
-
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
?>
|
15 |
-
<?php if ( $logs ) : ?>
|
16 |
-
<div id="log-viewer-select">
|
17 |
-
<div class="alignright">
|
18 |
-
<form action="
|
19 |
-
<?php
|
20 |
-
echo esc_url(
|
21 |
-
add_query_arg(
|
22 |
-
array(
|
23 |
-
'page' => 'cartflows_settings',
|
24 |
-
'cartflows-error-log' => 1,
|
25 |
-
'tab' => 'logs',
|
26 |
-
),
|
27 |
-
admin_url( '/admin.php' )
|
28 |
-
)
|
29 |
-
);
|
30 |
-
?>
|
31 |
-
" method="post">
|
32 |
-
<select name="log_file">
|
33 |
-
<?php foreach ( $logs as $log_key => $log_file ) : ?>
|
34 |
-
<?php
|
35 |
-
$timestamp = filemtime( CARTFLOWS_LOG_DIR . $log_file );
|
36 |
-
$date = sprintf( __( '%1$s at %2$s', 'cartflows' ), date_i18n( 'F j, Y', $timestamp ), date_i18n( 'g:i a', $timestamp ) ); // phpcs:ignore
|
37 |
-
?>
|
38 |
-
<option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo esc_html( $date ); ?>)</option>
|
39 |
-
<?php endforeach; ?>
|
40 |
-
</select>
|
41 |
-
<button type="submit" class="button" value="<?php esc_attr_e( 'View', 'cartflows' ); ?>"><?php esc_html_e( 'View', 'cartflows' ); ?></button>
|
42 |
-
</form>
|
43 |
-
</div>
|
44 |
-
<div class="clear"></div>
|
45 |
-
</div>
|
46 |
-
<div id="log-viewer">
|
47 |
-
<div class="wcf-log-container">
|
48 |
-
<pre><?php echo esc_html( file_get_contents( CARTFLOWS_LOG_DIR . $viewed_log ) );//phpcs:ignore ?></pre>
|
49 |
-
</div>
|
50 |
-
<?php if ( ! empty( $viewed_log ) ) : ?>
|
51 |
-
<a onclick="return confirm('Are you sure to delete this log?');" style="float: right" href="
|
52 |
-
<?php
|
53 |
-
echo esc_url(
|
54 |
-
wp_nonce_url(
|
55 |
-
add_query_arg(
|
56 |
-
array(
|
57 |
-
'handle' => sanitize_title( $viewed_log ),
|
58 |
-
'tab' => 'logs',
|
59 |
-
)
|
60 |
-
),
|
61 |
-
'remove_log'
|
62 |
-
)
|
63 |
-
);
|
64 |
-
?>
|
65 |
-
"><?php esc_html_e( 'Delete log', 'cartflows' ); ?></a>
|
66 |
-
<?php endif; ?>
|
67 |
-
|
68 |
-
</div>
|
69 |
-
<?php else : ?>
|
70 |
-
<div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'cartflows' ); ?></p></div>
|
71 |
-
<?php endif; ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin View: Page - Status Logs
|
4 |
+
*
|
5 |
+
* @package WooCommerce/Admin/Logs
|
6 |
+
*/
|
7 |
+
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
?>
|
15 |
+
<?php if ( $logs ) : ?>
|
16 |
+
<div id="log-viewer-select">
|
17 |
+
<div class="alignright">
|
18 |
+
<form action="
|
19 |
+
<?php
|
20 |
+
echo esc_url(
|
21 |
+
add_query_arg(
|
22 |
+
array(
|
23 |
+
'page' => 'cartflows_settings',
|
24 |
+
'cartflows-error-log' => 1,
|
25 |
+
'tab' => 'logs',
|
26 |
+
),
|
27 |
+
admin_url( '/admin.php' )
|
28 |
+
)
|
29 |
+
);
|
30 |
+
?>
|
31 |
+
" method="post">
|
32 |
+
<select name="log_file">
|
33 |
+
<?php foreach ( $logs as $log_key => $log_file ) : ?>
|
34 |
+
<?php
|
35 |
+
$timestamp = filemtime( CARTFLOWS_LOG_DIR . $log_file );
|
36 |
+
$date = sprintf( __( '%1$s at %2$s', 'cartflows' ), date_i18n( 'F j, Y', $timestamp ), date_i18n( 'g:i a', $timestamp ) ); // phpcs:ignore
|
37 |
+
?>
|
38 |
+
<option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo esc_html( $date ); ?>)</option>
|
39 |
+
<?php endforeach; ?>
|
40 |
+
</select>
|
41 |
+
<button type="submit" class="button" value="<?php esc_attr_e( 'View', 'cartflows' ); ?>"><?php esc_html_e( 'View', 'cartflows' ); ?></button>
|
42 |
+
</form>
|
43 |
+
</div>
|
44 |
+
<div class="clear"></div>
|
45 |
+
</div>
|
46 |
+
<div id="log-viewer">
|
47 |
+
<div class="wcf-log-container">
|
48 |
+
<pre><?php echo esc_html( file_get_contents( CARTFLOWS_LOG_DIR . $viewed_log ) );//phpcs:ignore ?></pre>
|
49 |
+
</div>
|
50 |
+
<?php if ( ! empty( $viewed_log ) ) : ?>
|
51 |
+
<a onclick="return confirm('Are you sure to delete this log?');" style="float: right" href="
|
52 |
+
<?php
|
53 |
+
echo esc_url(
|
54 |
+
wp_nonce_url(
|
55 |
+
add_query_arg(
|
56 |
+
array(
|
57 |
+
'handle' => sanitize_title( $viewed_log ),
|
58 |
+
'tab' => 'logs',
|
59 |
+
)
|
60 |
+
),
|
61 |
+
'remove_log'
|
62 |
+
)
|
63 |
+
);
|
64 |
+
?>
|
65 |
+
"><?php esc_html_e( 'Delete log', 'cartflows' ); ?></a>
|
66 |
+
<?php endif; ?>
|
67 |
+
|
68 |
+
</div>
|
69 |
+
<?php else : ?>
|
70 |
+
<div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'cartflows' ); ?></p></div>
|
71 |
+
<?php endif; ?>
|
includes/admin/cartflows-general-bck.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* General Setting Form
|
4 |
-
*
|
5 |
-
* @package CARTFLOWS
|
6 |
-
*/
|
7 |
-
|
8 |
-
$extensions = array(
|
9 |
-
'common' => array(
|
10 |
-
'title' => __( 'Selec', 'cartflows' ),
|
11 |
-
'setting_url' => admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS . '&action=common-settings' ),
|
12 |
-
),
|
13 |
-
);
|
14 |
-
|
15 |
-
?>
|
16 |
-
|
17 |
-
<div class="wcf-container wcf-<?php echo $action; ?>">
|
18 |
-
<div id="poststuff">
|
19 |
-
<div id="post-body" class="columns-2">
|
20 |
-
<div id="post-body-content">
|
21 |
-
<!-- All WordPress Notices below header -->
|
22 |
-
<h1 class="screen-reader-text"> <?php
|
23 |
-
<div class="widgets postbox">
|
24 |
-
<h2 class="hndle wcf-flex wcf-widgets-heading"><span><?php esc_html_e( 'Welcome', 'cartflows' ); ?></span>
|
25 |
-
</h2>
|
26 |
-
<div class="inside">
|
27 |
-
<ul class="wcf-setting-tab-wrapper" >
|
28 |
-
<?php
|
29 |
-
|
30 |
-
foreach ( $extensions as $key => $data ) {
|
31 |
-
echo '<li id="' . esc_attr( $key ) . '" class="wcf-setting-tab ' . esc_attr( $key ) . '">';
|
32 |
-
echo '<a class="wcf-tab-title" href="#" target="_blank" rel="noopener">' . esc_attr( $data['title'] ) . '</a>';
|
33 |
-
echo '<div class="wcf-tab-link-wrapper">';
|
34 |
-
echo '<a class="wcf-tab-link" href="' . esc_url( $data['setting_url'] ) . '">' .
|
35 |
-
echo '</div>';
|
36 |
-
echo '</li>';
|
37 |
-
}
|
38 |
-
?>
|
39 |
-
</ul>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
<!-- /post-body -->
|
45 |
-
<br class="clear">
|
46 |
-
</div>
|
47 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* General Setting Form
|
4 |
+
*
|
5 |
+
* @package CARTFLOWS
|
6 |
+
*/
|
7 |
+
|
8 |
+
$extensions = array(
|
9 |
+
'common' => array(
|
10 |
+
'title' => __( 'Selec', 'cartflows' ),
|
11 |
+
'setting_url' => admin_url( 'admin.php?page=' . CARTFLOWS_SETTINGS . '&action=common-settings' ),
|
12 |
+
),
|
13 |
+
);
|
14 |
+
|
15 |
+
?>
|
16 |
+
|
17 |
+
<div class="wcf-container wcf-<?php echo $action; ?>">
|
18 |
+
<div id="poststuff">
|
19 |
+
<div id="post-body" class="columns-2">
|
20 |
+
<div id="post-body-content">
|
21 |
+
<!-- All WordPress Notices below header -->
|
22 |
+
<h1 class="screen-reader-text"> <?php esc_html_e( 'General', 'cartflows' ); ?> </h1>
|
23 |
+
<div class="widgets postbox">
|
24 |
+
<h2 class="hndle wcf-flex wcf-widgets-heading"><span><?php esc_html_e( 'Welcome', 'cartflows' ); ?></span>
|
25 |
+
</h2>
|
26 |
+
<div class="inside">
|
27 |
+
<ul class="wcf-setting-tab-wrapper" >
|
28 |
+
<?php
|
29 |
+
|
30 |
+
foreach ( $extensions as $key => $data ) {
|
31 |
+
echo '<li id="' . esc_attr( $key ) . '" class="wcf-setting-tab ' . esc_attr( $key ) . '">';
|
32 |
+
echo '<a class="wcf-tab-title" href="#" target="_blank" rel="noopener">' . esc_attr( $data['title'] ) . '</a>';
|
33 |
+
echo '<div class="wcf-tab-link-wrapper">';
|
34 |
+
echo '<a class="wcf-tab-link" href="' . esc_url( $data['setting_url'] ) . '">' . esc_html__( 'Settings', 'cartflows' ) . '</a>';
|
35 |
+
echo '</div>';
|
36 |
+
echo '</li>';
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
</ul>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
<!-- /post-body -->
|
45 |
+
<br class="clear">
|
46 |
+
</div>
|
47 |
+
</div>
|
includes/admin/cartflows-general.php
CHANGED
@@ -26,14 +26,14 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
26 |
<?php else : ?>
|
27 |
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
28 |
<input type="hidden" name="action" value="wcf_save_common_settings">
|
29 |
-
<h1 class="screen-reader-text"><?php
|
30 |
|
31 |
<div id="poststuff">
|
32 |
<div id="post-body" class="columns-2">
|
33 |
<div id="post-body-content">
|
34 |
<div class="postbox introduction">
|
35 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
36 |
-
<span><?php
|
37 |
</h2>
|
38 |
<div class="inside">
|
39 |
<div class="iframe-wrap">
|
@@ -49,7 +49,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
49 |
|
50 |
<div class="general-settings-form postbox">
|
51 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
52 |
-
<span><?php
|
53 |
</h2>
|
54 |
<div class="inside">
|
55 |
<form method="post" class="wrap wcf-clear" action="" >
|
@@ -105,7 +105,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
105 |
|
106 |
<div class="general-settingss-form postbox">
|
107 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
108 |
-
<span><?php
|
109 |
</h2>
|
110 |
<div class="inside">
|
111 |
<form method="post" class="wrap wcf-clear" action="" >
|
@@ -193,7 +193,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
193 |
<div class="general-settingss-form postbox">
|
194 |
<h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
|
195 |
|
196 |
-
<span><?php
|
197 |
</h2>
|
198 |
|
199 |
<form method="post" class="wrap wcf-clear" action="">
|
@@ -288,7 +288,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
288 |
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
289 |
</p>
|
290 |
<p>
|
291 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php
|
292 |
</p>
|
293 |
</div>
|
294 |
</div>
|
@@ -303,7 +303,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
303 |
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
304 |
</p>
|
305 |
<p>
|
306 |
-
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php
|
307 |
</p>
|
308 |
</div>
|
309 |
</div>
|
@@ -318,7 +318,7 @@ $error_log = filter_input( INPUT_GET, 'cartflows-error-log', FILTER_VALIDATE_BOO
|
|
318 |
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
319 |
</p>
|
320 |
<p>
|
321 |
-
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php
|
322 |
</p>
|
323 |
</div>
|
324 |
</div>
|
26 |
<?php else : ?>
|
27 |
<div class="wrap wcf-addon-wrap wcf-clear wcf-container">
|
28 |
<input type="hidden" name="action" value="wcf_save_common_settings">
|
29 |
+
<h1 class="screen-reader-text"><?php esc_html_e( 'General Settings', 'cartflows' ); ?></h1>
|
30 |
|
31 |
<div id="poststuff">
|
32 |
<div id="post-body" class="columns-2">
|
33 |
<div id="post-body-content">
|
34 |
<div class="postbox introduction">
|
35 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
36 |
+
<span><?php esc_html_e( 'Getting Started', 'cartflows' ); ?></span>
|
37 |
</h2>
|
38 |
<div class="inside">
|
39 |
<div class="iframe-wrap">
|
49 |
|
50 |
<div class="general-settings-form postbox">
|
51 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
52 |
+
<span><?php esc_html_e( 'General Settings', 'cartflows' ); ?></span>
|
53 |
</h2>
|
54 |
<div class="inside">
|
55 |
<form method="post" class="wrap wcf-clear" action="" >
|
105 |
|
106 |
<div class="general-settingss-form postbox">
|
107 |
<h2 class="hndle wcf-normal-cusror ui-sortable-handle">
|
108 |
+
<span><?php esc_html_e( 'Permalink Settings', 'cartflows' ); ?></span>
|
109 |
</h2>
|
110 |
<div class="inside">
|
111 |
<form method="post" class="wrap wcf-clear" action="" >
|
193 |
<div class="general-settingss-form postbox">
|
194 |
<h2 class="wcf-facebook-hndle wcf-normal-cusror ui-sortable-handle hndle">
|
195 |
|
196 |
+
<span><?php esc_html_e( 'Facebook Pixel Settings', 'cartflows' ); ?></span>
|
197 |
</h2>
|
198 |
|
199 |
<form method="post" class="wrap wcf-clear" action="">
|
288 |
<?php esc_html_e( 'Not sure how something works? Take a peek at the knowledge base and learn.', 'cartflows' ); ?>
|
289 |
</p>
|
290 |
<p>
|
291 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/docs' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Visit Knowledge Base »', 'cartflows' ); ?></a>
|
292 |
</p>
|
293 |
</div>
|
294 |
</div>
|
303 |
<?php esc_html_e( 'Join the community of super helpful CartFlows users. Say hello, ask questions, give feedback and help each other!', 'cartflows' ); ?>
|
304 |
</p>
|
305 |
<p>
|
306 |
+
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/cartflows/' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Join Our Facebook Group »', 'cartflows' ); ?></a>
|
307 |
</p>
|
308 |
</div>
|
309 |
</div>
|
318 |
<?php esc_html_e( 'Got a question? Get in touch with CartFlows developers. We\'re happy to help!', 'cartflows' ); ?>
|
319 |
</p>
|
320 |
<p>
|
321 |
+
<a href="<?php echo esc_url( 'https://cartflows.com/contact' ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a Ticket »', 'cartflows' ); ?></a>
|
322 |
</p>
|
323 |
</div>
|
324 |
</div>
|
includes/exporter.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Exporter
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
?>
|
9 |
-
<div class="cartflows-ie">
|
10 |
-
<div class="postbox">
|
11 |
-
<div class="inside">
|
12 |
-
<h3><?php
|
13 |
-
<p><?php
|
14 |
-
<form method="post">
|
15 |
-
<p><input type="hidden" name="cartflows-action" value="export" /></p>
|
16 |
-
<p style="margin-bottom:0">
|
17 |
-
<?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
|
18 |
-
<?php submit_button( __( 'Export', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
|
19 |
-
</p>
|
20 |
-
</form>
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Exporter
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<div class="cartflows-ie">
|
10 |
+
<div class="postbox">
|
11 |
+
<div class="inside">
|
12 |
+
<h3><?php esc_html_e( 'Export Flows to a JSON file', 'cartflows' ); ?></h3>
|
13 |
+
<p><?php esc_html_e( 'This tool allows you to generate and download a JSON file containing a list of all flows.', 'cartflows' ); ?></p>
|
14 |
+
<form method="post">
|
15 |
+
<p><input type="hidden" name="cartflows-action" value="export" /></p>
|
16 |
+
<p style="margin-bottom:0">
|
17 |
+
<?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
|
18 |
+
<?php submit_button( __( 'Export', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
|
19 |
+
</p>
|
20 |
+
</form>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
</div>
|
includes/importer.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Importer
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
?>
|
9 |
-
<div class="cartflows-ie">
|
10 |
-
<div class="postbox">
|
11 |
-
<div class="inside">
|
12 |
-
<h3><?php
|
13 |
-
<p><?php
|
14 |
-
<form method="post" enctype="multipart/form-data">
|
15 |
-
<p>
|
16 |
-
<input type="file" name="file"/>
|
17 |
-
<input type="hidden" name="cartflows-action" value="import" />
|
18 |
-
</p>
|
19 |
-
<p style="margin-bottom:0">
|
20 |
-
<?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
|
21 |
-
<?php submit_button( __( 'Import', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
|
22 |
-
</p>
|
23 |
-
</form>
|
24 |
-
</div>
|
25 |
-
</div>
|
26 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Importer
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
?>
|
9 |
+
<div class="cartflows-ie">
|
10 |
+
<div class="postbox">
|
11 |
+
<div class="inside">
|
12 |
+
<h3><?php esc_html_e( 'Import Flows to a JSON file', 'cartflows' ); ?></h3>
|
13 |
+
<p><?php esc_html_e( 'This tool allows you to import the flows from the JSON file.', 'cartflows' ); ?></p>
|
14 |
+
<form method="post" enctype="multipart/form-data">
|
15 |
+
<p>
|
16 |
+
<input type="file" name="file"/>
|
17 |
+
<input type="hidden" name="cartflows-action" value="import" />
|
18 |
+
</p>
|
19 |
+
<p style="margin-bottom:0">
|
20 |
+
<?php wp_nonce_field( 'cartflows-action-nonce', 'cartflows-action-nonce' ); ?>
|
21 |
+
<?php submit_button( __( 'Import', 'cartflows' ), 'button-primary', 'submit', false, array( 'id' => '' ) ); ?>
|
22 |
+
</p>
|
23 |
+
</form>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</div>
|
languages/cartflows.pot
CHANGED
@@ -1,1798 +1,1798 @@
|
|
1 |
-
# Copyright (C) 2019 CartFlows Inc
|
2 |
-
# This file is distributed under the same license as the CartFlows package.
|
3 |
-
msgid ""
|
4 |
-
msgstr ""
|
5 |
-
"Project-Id-Version: CartFlows 1.3.
|
6 |
-
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
-
"POT-Creation-Date: 2019-12-
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
|
12 |
-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
-
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
-
"Language: en\n"
|
15 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
-
"X-Poedit-Country: United States\n"
|
17 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
-
"X-Poedit-KeywordsList: "
|
19 |
-
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
20 |
-
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
21 |
-
"X-Poedit-Basepath: ../\n"
|
22 |
-
"X-Poedit-SearchPath-0: .\n"
|
23 |
-
"X-Poedit-Bookmarks: \n"
|
24 |
-
"X-Textdomain-Support: yes\n"
|
25 |
-
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
26 |
-
|
27 |
-
#: classes/batch-process/class-cartflows-importer-elementor.php:44
|
28 |
-
msgid "Invalid content."
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: classes/batch-process/class-cartflows-importer-elementor.php:52
|
32 |
-
msgid "Invalid content. Expected an array."
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: classes/batch-process/helpers/class-wp-background-process.php:435
|
36 |
-
msgid "Every %d Minutes"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: classes/class-cartflows-admin-fields.php:231
|
40 |
-
msgid "Select"
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: classes/class-cartflows-admin-fields.php:234
|
44 |
-
msgid "No Checkout Steps"
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: classes/class-cartflows-admin-fields.php:260
|
48 |
-
#. translators: %s: link
|
49 |
-
msgid ""
|
50 |
-
"Be sure not to add any product in above selected Global Checkout step. "
|
51 |
-
"Please read information about how to set up Global Checkout %1$shere%2$s."
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: classes/class-cartflows-admin.php:153 classes/class-cartflows-admin.php:154
|
55 |
-
#: includes/admin/cartflows-general-bck.php:34
|
56 |
-
msgid "Settings"
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: classes/class-cartflows-admin.php:405
|
60 |
-
msgid "Installing and activating.."
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: classes/class-cartflows-admin.php:406
|
64 |
-
msgid "There was an error with the installation of plugin."
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: classes/class-cartflows-admin.php:460
|
68 |
-
msgid "Flows Library"
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: classes/class-cartflows-admin.php:467
|
72 |
-
#: modules/flow/view/meta-flow-steps.php:145
|
73 |
-
msgid "Ready Templates"
|
74 |
-
msgstr ""
|
75 |
-
|
76 |
-
#: classes/class-cartflows-admin.php:470
|
77 |
-
#: modules/flow/view/meta-flow-steps.php:148
|
78 |
-
msgid "Create Your Own"
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
#: classes/class-cartflows-admin.php:481
|
82 |
-
#: modules/flow/view/meta-flow-steps.php:160
|
83 |
-
msgid "Search Sites"
|
84 |
-
msgstr ""
|
85 |
-
|
86 |
-
#: classes/class-cartflows-admin.php:482
|
87 |
-
#: modules/flow/view/meta-flow-steps.php:161
|
88 |
-
msgid "Search Flow..."
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: classes/class-cartflows-admin.php:499
|
92 |
-
msgid "Design Your Flow"
|
93 |
-
msgstr ""
|
94 |
-
|
95 |
-
#: classes/class-cartflows-admin.php:500
|
96 |
-
#: classes/class-cartflows-importer.php:636
|
97 |
-
#: classes/class-cartflows-importer.php:735
|
98 |
-
#: modules/flow/view/meta-flow-steps.php:191
|
99 |
-
msgid "Learn How"
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
#: classes/class-cartflows-api.php:368
|
103 |
-
msgid "Request successfully processed!"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: classes/class-cartflows-cloning.php:423
|
107 |
-
msgid "Clone this flow"
|
108 |
-
msgstr ""
|
109 |
-
|
110 |
-
#: classes/class-cartflows-cloning.php:423
|
111 |
-
#: modules/flow/view/meta-flow-steps.php:105
|
112 |
-
msgid "Clone"
|
113 |
-
msgstr ""
|
114 |
-
|
115 |
-
#: classes/class-cartflows-flow-frontend.php:53
|
116 |
-
msgid ""
|
117 |
-
"Test mode is active — which displays random products for previewing. It can "
|
118 |
-
"be deactivated from the flow settings in the admin dashboard."
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
#: classes/class-cartflows-flow-frontend.php:58
|
122 |
-
msgid "Click here to disable it"
|
123 |
-
msgstr ""
|
124 |
-
|
125 |
-
#: classes/class-cartflows-importer.php:80
|
126 |
-
msgid "Export this flow"
|
127 |
-
msgstr ""
|
128 |
-
|
129 |
-
#: classes/class-cartflows-importer.php:80 includes/exporter.php:18
|
130 |
-
msgid "Export"
|
131 |
-
msgstr ""
|
132 |
-
|
133 |
-
#: classes/class-cartflows-importer.php:91
|
134 |
-
msgid "Flow Export"
|
135 |
-
msgstr ""
|
136 |
-
|
137 |
-
#: classes/class-cartflows-importer.php:92
|
138 |
-
msgid "Flow Import"
|
139 |
-
msgstr ""
|
140 |
-
|
141 |
-
#: classes/class-cartflows-importer.php:103
|
142 |
-
msgid "No post to export has been supplied!"
|
143 |
-
msgstr ""
|
144 |
-
|
145 |
-
#: classes/class-cartflows-importer.php:294
|
146 |
-
msgid "Please upload a valid .json file"
|
147 |
-
msgstr ""
|
148 |
-
|
149 |
-
#: classes/class-cartflows-importer.php:300
|
150 |
-
msgid "Please upload a file to import"
|
151 |
-
msgstr ""
|
152 |
-
|
153 |
-
#: classes/class-cartflows-importer.php:477
|
154 |
-
msgid "Successfully imported flows."
|
155 |
-
msgstr ""
|
156 |
-
|
157 |
-
#: classes/class-cartflows-importer.php:509
|
158 |
-
msgid "Loading Steps"
|
159 |
-
msgstr ""
|
160 |
-
|
161 |
-
#: classes/class-cartflows-importer.php:511
|
162 |
-
msgid "Getting steps from the cloud. Please wait for the moment."
|
163 |
-
msgstr ""
|
164 |
-
|
165 |
-
#: classes/class-cartflows-importer.php:522
|
166 |
-
msgid "Searching Template.."
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: classes/class-cartflows-importer.php:524
|
170 |
-
msgid "Getting templates from the cloud. Please wait for the moment."
|
171 |
-
msgstr ""
|
172 |
-
|
173 |
-
#: classes/class-cartflows-importer.php:533
|
174 |
-
msgid "Importing.."
|
175 |
-
msgstr ""
|
176 |
-
|
177 |
-
#: classes/class-cartflows-importer.php:542
|
178 |
-
#: classes/class-cartflows-importer.php:582
|
179 |
-
msgid "Imported"
|
180 |
-
msgstr ""
|
181 |
-
|
182 |
-
#: classes/class-cartflows-importer.php:543
|
183 |
-
#: classes/class-cartflows-importer.php:583
|
184 |
-
msgid "Thanks for patience"
|
185 |
-
msgstr ""
|
186 |
-
|
187 |
-
#: classes/class-cartflows-importer.php:552
|
188 |
-
#: classes/class-cartflows-importer.php:564
|
189 |
-
msgid "Coming Soon!"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: classes/class-cartflows-importer.php:583
|
193 |
-
msgid "Redirecting to the Elementor edit window."
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
#: classes/class-cartflows-importer.php:629
|
197 |
-
#: classes/class-cartflows-importer.php:745
|
198 |
-
msgid "Pro"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
-
#: classes/class-cartflows-importer.php:670
|
202 |
-
#: classes/class-cartflows-importer.php:777
|
203 |
-
msgid "Activate License"
|
204 |
-
msgstr ""
|
205 |
-
|
206 |
-
#: classes/class-cartflows-importer.php:672
|
207 |
-
#: classes/class-cartflows-importer.php:779
|
208 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:541
|
209 |
-
msgid "Get Pro"
|
210 |
-
msgstr ""
|
211 |
-
|
212 |
-
#: classes/class-cartflows-importer.php:697
|
213 |
-
msgid "Create"
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
#: classes/class-cartflows-importer.php:796
|
217 |
-
msgid "Under Maintenance.."
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: classes/class-cartflows-importer.php:797
|
221 |
-
msgid ""
|
222 |
-
"If you are seeing this message, most likely our servers are under routine "
|
223 |
-
"maintenance and we will be back shortly."
|
224 |
-
msgstr ""
|
225 |
-
|
226 |
-
#: classes/class-cartflows-importer.php:798
|
227 |
-
msgid ""
|
228 |
-
"In rare case, it is possible your website is having trouble connecting with "
|
229 |
-
"ours. If you need help, please feel free to get in touch with us from our "
|
230 |
-
"website.."
|
231 |
-
msgstr ""
|
232 |
-
|
233 |
-
#: classes/class-cartflows-importer.php:828
|
234 |
-
#. translators: %s: Plugin string
|
235 |
-
msgid ""
|
236 |
-
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
237 |
-
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
238 |
-
msgstr ""
|
239 |
-
|
240 |
-
#: classes/class-cartflows-importer.php:843
|
241 |
-
msgid "All"
|
242 |
-
msgstr ""
|
243 |
-
|
244 |
-
#: classes/class-cartflows-importer.php:846
|
245 |
-
msgid "Select Step Type"
|
246 |
-
msgstr ""
|
247 |
-
|
248 |
-
#: classes/class-cartflows-importer.php:922
|
249 |
-
msgid "Import from Cloud"
|
250 |
-
msgstr ""
|
251 |
-
|
252 |
-
#: classes/class-cartflows-importer.php:1236
|
253 |
-
msgid "Sales Landing"
|
254 |
-
msgstr ""
|
255 |
-
|
256 |
-
#: classes/class-cartflows-importer.php:1240
|
257 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:244
|
258 |
-
#: modules/flow/view/meta-flow-steps.php:12
|
259 |
-
msgid "Checkout (Woo)"
|
260 |
-
msgstr ""
|
261 |
-
|
262 |
-
#: classes/class-cartflows-importer.php:1244
|
263 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:251
|
264 |
-
#: modules/flow/view/meta-flow-steps.php:13
|
265 |
-
msgid "Thank You (Woo)"
|
266 |
-
msgstr ""
|
267 |
-
|
268 |
-
#: classes/class-cartflows-importer.php:1252
|
269 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:237
|
270 |
-
#: modules/flow/view/meta-flow-steps.php:11
|
271 |
-
msgid "Landing"
|
272 |
-
msgstr ""
|
273 |
-
|
274 |
-
#: classes/class-cartflows-importer.php:1256
|
275 |
-
msgid "Thank You"
|
276 |
-
msgstr ""
|
277 |
-
|
278 |
-
#: classes/class-cartflows-importer.php:1358
|
279 |
-
#. translators: %s: template ID
|
280 |
-
msgid "Invalid template id %1$s or post id %2$s."
|
281 |
-
msgstr ""
|
282 |
-
|
283 |
-
#: classes/class-cartflows-importer.php:1416
|
284 |
-
#. translators: %s: flow ID
|
285 |
-
msgid "Invalid flow id %1$s OR step type %2$s."
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
#: classes/class-cartflows-importer.php:1541
|
289 |
-
msgid ""
|
290 |
-
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
291 |
-
"to import the step."
|
292 |
-
msgstr ""
|
293 |
-
|
294 |
-
#: classes/class-cartflows-importer.php:1644
|
295 |
-
msgid "Action failed. Invalid Security Nonce."
|
296 |
-
msgstr ""
|
297 |
-
|
298 |
-
#: classes/class-cartflows-importer.php:1651
|
299 |
-
msgid "User have not plugin install permissions."
|
300 |
-
msgstr ""
|
301 |
-
|
302 |
-
#: classes/class-cartflows-importer.php:1673
|
303 |
-
msgid "Plugin Successfully Activated"
|
304 |
-
msgstr ""
|
305 |
-
|
306 |
-
#: classes/class-cartflows-learndash-compatibility.php:79
|
307 |
-
msgid "None"
|
308 |
-
msgstr ""
|
309 |
-
|
310 |
-
#: classes/class-cartflows-learndash-compatibility.php:106
|
311 |
-
#. translators: 1: anchor start, 2: anchor close
|
312 |
-
msgid ""
|
313 |
-
"Non-enrolled students will redirect to the selected CartFlows template. If "
|
314 |
-
"you have not created any Flow already, add new Flow from %1$shere%2$s."
|
315 |
-
msgstr ""
|
316 |
-
|
317 |
-
#: classes/class-cartflows-learndash-compatibility.php:112
|
318 |
-
msgid "Select CartFlows Template for this Course"
|
319 |
-
msgstr ""
|
320 |
-
|
321 |
-
#: classes/class-cartflows-loader.php:225
|
322 |
-
#. translators: %s: html tags
|
323 |
-
msgid ""
|
324 |
-
"You are using an older version of %1$sCartFlows Pro%2$s. Please update "
|
325 |
-
"%1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher."
|
326 |
-
msgstr ""
|
327 |
-
|
328 |
-
#: classes/class-cartflows-loader.php:482
|
329 |
-
#. translators: %s: html tags
|
330 |
-
msgid ""
|
331 |
-
"This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & "
|
332 |
-
"activated."
|
333 |
-
msgstr ""
|
334 |
-
|
335 |
-
#: classes/class-cartflows-loader.php:492
|
336 |
-
msgid "Activate WooCommerce"
|
337 |
-
msgstr ""
|
338 |
-
|
339 |
-
#: classes/class-cartflows-loader.php:500
|
340 |
-
msgid "Install WooCommerce"
|
341 |
-
msgstr ""
|
342 |
-
|
343 |
-
#: classes/class-cartflows-logger.php:161
|
344 |
-
msgid "Action failed. Please refresh the page and retry."
|
345 |
-
msgstr ""
|
346 |
-
|
347 |
-
#: classes/class-cartflows-meta-fields.php:86
|
348 |
-
msgid "Thin 100"
|
349 |
-
msgstr ""
|
350 |
-
|
351 |
-
#: classes/class-cartflows-meta-fields.php:87
|
352 |
-
msgid "Extra-Light 200"
|
353 |
-
msgstr ""
|
354 |
-
|
355 |
-
#: classes/class-cartflows-meta-fields.php:88
|
356 |
-
msgid "Light 300"
|
357 |
-
msgstr ""
|
358 |
-
|
359 |
-
#: classes/class-cartflows-meta-fields.php:89
|
360 |
-
msgid "Normal 400"
|
361 |
-
msgstr ""
|
362 |
-
|
363 |
-
#: classes/class-cartflows-meta-fields.php:90
|
364 |
-
msgid "Medium 500"
|
365 |
-
msgstr ""
|
366 |
-
|
367 |
-
#: classes/class-cartflows-meta-fields.php:91
|
368 |
-
msgid "Semi-Bold 600"
|
369 |
-
msgstr ""
|
370 |
-
|
371 |
-
#: classes/class-cartflows-meta-fields.php:92
|
372 |
-
msgid "Bold 700"
|
373 |
-
msgstr ""
|
374 |
-
|
375 |
-
#: classes/class-cartflows-meta-fields.php:93
|
376 |
-
msgid "Extra-Bold 800"
|
377 |
-
msgstr ""
|
378 |
-
|
379 |
-
#: classes/class-cartflows-meta-fields.php:94
|
380 |
-
msgid "Ultra-Bold 900"
|
381 |
-
msgstr ""
|
382 |
-
|
383 |
-
#: classes/class-cartflows-meta-fields.php:217
|
384 |
-
#: classes/class-cartflows-meta-fields.php:325
|
385 |
-
#: classes/class-cartflows-meta-fields.php:1426
|
386 |
-
msgid "Remove"
|
387 |
-
msgstr ""
|
388 |
-
|
389 |
-
#: classes/class-cartflows-meta-fields.php:446
|
390 |
-
msgid "Field Width"
|
391 |
-
msgstr ""
|
392 |
-
|
393 |
-
#: classes/class-cartflows-meta-fields.php:450
|
394 |
-
msgid "33%"
|
395 |
-
msgstr ""
|
396 |
-
|
397 |
-
#: classes/class-cartflows-meta-fields.php:451
|
398 |
-
msgid "50%"
|
399 |
-
msgstr ""
|
400 |
-
|
401 |
-
#: classes/class-cartflows-meta-fields.php:452
|
402 |
-
msgid "100%"
|
403 |
-
msgstr ""
|
404 |
-
|
405 |
-
#: classes/class-cartflows-meta-fields.php:463
|
406 |
-
msgid "Field Label"
|
407 |
-
msgstr ""
|
408 |
-
|
409 |
-
#: classes/class-cartflows-meta-fields.php:477
|
410 |
-
msgid "Options"
|
411 |
-
msgstr ""
|
412 |
-
|
413 |
-
#: classes/class-cartflows-meta-fields.php:492
|
414 |
-
#: classes/class-cartflows-meta-fields.php:505
|
415 |
-
#: includes/admin/cartflows-general.php:123
|
416 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:555
|
417 |
-
msgid "Default"
|
418 |
-
msgstr ""
|
419 |
-
|
420 |
-
#: classes/class-cartflows-meta-fields.php:496
|
421 |
-
msgid "Checked"
|
422 |
-
msgstr ""
|
423 |
-
|
424 |
-
#: classes/class-cartflows-meta-fields.php:497
|
425 |
-
msgid "Un-Checked"
|
426 |
-
msgstr ""
|
427 |
-
|
428 |
-
#: classes/class-cartflows-meta-fields.php:518
|
429 |
-
msgid "Placeholder"
|
430 |
-
msgstr ""
|
431 |
-
|
432 |
-
#: classes/class-cartflows-meta-fields.php:530
|
433 |
-
msgid "Required"
|
434 |
-
msgstr ""
|
435 |
-
|
436 |
-
#: classes/class-cartflows-meta-fields.php:542
|
437 |
-
msgid "Enable this field"
|
438 |
-
msgstr ""
|
439 |
-
|
440 |
-
#: classes/class-cartflows-meta-fields.php:562
|
441 |
-
msgid "Label"
|
442 |
-
msgstr ""
|
443 |
-
|
444 |
-
#: classes/class-cartflows-meta-fields.php:999
|
445 |
-
#: classes/class-cartflows-meta-fields.php:1418
|
446 |
-
msgid "Search for a product…"
|
447 |
-
msgstr ""
|
448 |
-
|
449 |
-
#: classes/class-cartflows-meta-fields.php:1040
|
450 |
-
msgid "Search for a coupon…"
|
451 |
-
msgstr ""
|
452 |
-
|
453 |
-
#: classes/class-cartflows-meta.php:34
|
454 |
-
msgid "Update"
|
455 |
-
msgstr ""
|
456 |
-
|
457 |
-
#: classes/class-cartflows-meta.php:42
|
458 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:84
|
459 |
-
msgid "Back to edit Flow"
|
460 |
-
msgstr ""
|
461 |
-
|
462 |
-
#: classes/class-cartflows-meta.php:63
|
463 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:193
|
464 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:136
|
465 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:148
|
466 |
-
msgid "Custom Script"
|
467 |
-
msgstr ""
|
468 |
-
|
469 |
-
#: classes/class-cartflows-meta.php:66
|
470 |
-
msgid ""
|
471 |
-
"Custom script lets you add your own custom script on front end of this flow "
|
472 |
-
"page."
|
473 |
-
msgstr ""
|
474 |
-
|
475 |
-
#: classes/class-cartflows-metabox.php:59
|
476 |
-
msgid "Flow Details"
|
477 |
-
msgstr ""
|
478 |
-
|
479 |
-
#: classes/class-cartflows-wizard.php:83
|
480 |
-
msgid "Thanks for installing and using CartFlows!"
|
481 |
-
msgstr ""
|
482 |
-
|
483 |
-
#: classes/class-cartflows-wizard.php:84
|
484 |
-
msgid ""
|
485 |
-
"It is easy to use the CartFlows. Please use the setup wizard to quick start "
|
486 |
-
"setup."
|
487 |
-
msgstr ""
|
488 |
-
|
489 |
-
#: classes/class-cartflows-wizard.php:86
|
490 |
-
msgid "Start Wizard"
|
491 |
-
msgstr ""
|
492 |
-
|
493 |
-
#: classes/class-cartflows-wizard.php:87
|
494 |
-
msgid "Skip Setup"
|
495 |
-
msgstr ""
|
496 |
-
|
497 |
-
#: classes/class-cartflows-wizard.php:117
|
498 |
-
#: includes/admin/cartflows-general-bck.php:24
|
499 |
-
msgid "Welcome"
|
500 |
-
msgstr ""
|
501 |
-
|
502 |
-
#: classes/class-cartflows-wizard.php:122
|
503 |
-
msgid "Page Builder"
|
504 |
-
msgstr ""
|
505 |
-
|
506 |
-
#: classes/class-cartflows-wizard.php:126
|
507 |
-
msgid "Checkout"
|
508 |
-
msgstr ""
|
509 |
-
|
510 |
-
#: classes/class-cartflows-wizard.php:130
|
511 |
-
msgid "Training"
|
512 |
-
msgstr ""
|
513 |
-
|
514 |
-
#: classes/class-cartflows-wizard.php:134
|
515 |
-
msgid "Ready!"
|
516 |
-
msgstr ""
|
517 |
-
|
518 |
-
#: classes/class-cartflows-wizard.php:208
|
519 |
-
msgid "CartFlows Setup"
|
520 |
-
msgstr ""
|
521 |
-
|
522 |
-
#: classes/class-cartflows-wizard.php:234
|
523 |
-
msgid "Exit Setup Wizard"
|
524 |
-
msgstr ""
|
525 |
-
|
526 |
-
#: classes/class-cartflows-wizard.php:287
|
527 |
-
msgid "Welcome to CartFlows!"
|
528 |
-
msgstr ""
|
529 |
-
|
530 |
-
#: classes/class-cartflows-wizard.php:288
|
531 |
-
msgid ""
|
532 |
-
"Thank you for choosing CartFlows to get more leads, increase conversions, & "
|
533 |
-
"maximize profits. This short setup wizard will guide you though configuring "
|
534 |
-
"CartFlows and creating your first funnel."
|
535 |
-
msgstr ""
|
536 |
-
|
537 |
-
#: classes/class-cartflows-wizard.php:294
|
538 |
-
msgid "Lets Go »"
|
539 |
-
msgstr ""
|
540 |
-
|
541 |
-
#: classes/class-cartflows-wizard.php:321
|
542 |
-
msgid "Page Builder Setup"
|
543 |
-
msgstr ""
|
544 |
-
|
545 |
-
#: classes/class-cartflows-wizard.php:322
|
546 |
-
msgid "Please select a page builder you would like to use with CartFlows."
|
547 |
-
msgstr ""
|
548 |
-
|
549 |
-
#: classes/class-cartflows-wizard.php:327
|
550 |
-
msgid "Select Page Builder"
|
551 |
-
msgstr ""
|
552 |
-
|
553 |
-
#: classes/class-cartflows-wizard.php:334
|
554 |
-
#: includes/admin/cartflows-general.php:88
|
555 |
-
msgid "Elementor"
|
556 |
-
msgstr ""
|
557 |
-
|
558 |
-
#: classes/class-cartflows-wizard.php:344
|
559 |
-
msgid "Beaver Builder Plugin (Lite Version)"
|
560 |
-
msgstr ""
|
561 |
-
|
562 |
-
#: classes/class-cartflows-wizard.php:354
|
563 |
-
#: includes/admin/cartflows-general.php:90
|
564 |
-
msgid "Divi"
|
565 |
-
msgstr ""
|
566 |
-
|
567 |
-
#: classes/class-cartflows-wizard.php:364
|
568 |
-
#: includes/admin/cartflows-general.php:91
|
569 |
-
msgid "Other"
|
570 |
-
msgstr ""
|
571 |
-
|
572 |
-
#: classes/class-cartflows-wizard.php:386
|
573 |
-
msgid ""
|
574 |
-
"While CartFlows Should work with most page builders, we offer templates for "
|
575 |
-
"the above page builders."
|
576 |
-
msgstr ""
|
577 |
-
|
578 |
-
#: classes/class-cartflows-wizard.php:389
|
579 |
-
#: classes/class-cartflows-wizard.php:434
|
580 |
-
#: classes/class-cartflows-wizard.php:613
|
581 |
-
msgid "« Previous"
|
582 |
-
msgstr ""
|
583 |
-
|
584 |
-
#: classes/class-cartflows-wizard.php:392
|
585 |
-
msgid "Skip this step"
|
586 |
-
msgstr ""
|
587 |
-
|
588 |
-
#: classes/class-cartflows-wizard.php:393
|
589 |
-
msgid "Next »"
|
590 |
-
msgstr ""
|
591 |
-
|
592 |
-
#: classes/class-cartflows-wizard.php:412
|
593 |
-
msgid "Choose a checkout"
|
594 |
-
msgstr ""
|
595 |
-
|
596 |
-
#: classes/class-cartflows-wizard.php:415
|
597 |
-
msgid ""
|
598 |
-
"While CartFlows is designed to use WooCommerce sell digital and physical "
|
599 |
-
"products, not all funnels need a checkout system."
|
600 |
-
msgstr ""
|
601 |
-
|
602 |
-
#: classes/class-cartflows-wizard.php:417
|
603 |
-
msgid ""
|
604 |
-
"Would you like to install WooCommerce to sell digital and physical products "
|
605 |
-
"in your funnels?"
|
606 |
-
msgstr ""
|
607 |
-
|
608 |
-
#: classes/class-cartflows-wizard.php:424
|
609 |
-
msgid "The following plugin will be installed and activated for you:"
|
610 |
-
msgstr ""
|
611 |
-
|
612 |
-
#: classes/class-cartflows-wizard.php:425
|
613 |
-
msgid "WooCommerce"
|
614 |
-
msgstr ""
|
615 |
-
|
616 |
-
#: classes/class-cartflows-wizard.php:426
|
617 |
-
msgid "WooCommerce Cart Abandonment Recovery"
|
618 |
-
msgstr ""
|
619 |
-
|
620 |
-
#: classes/class-cartflows-wizard.php:437
|
621 |
-
#: classes/class-cartflows-wizard.php:616
|
622 |
-
msgid "No thanks"
|
623 |
-
msgstr ""
|
624 |
-
|
625 |
-
#: classes/class-cartflows-wizard.php:438
|
626 |
-
msgid "Yes"
|
627 |
-
msgstr ""
|
628 |
-
|
629 |
-
#: classes/class-cartflows-wizard.php:549
|
630 |
-
msgid "Congratulations, You Did It!"
|
631 |
-
msgstr ""
|
632 |
-
|
633 |
-
#: classes/class-cartflows-wizard.php:556
|
634 |
-
msgid ""
|
635 |
-
"CartFlows is ready to use on your website. You've successfully completed "
|
636 |
-
"the setup process and all that is left for you to do is create your first "
|
637 |
-
"flow."
|
638 |
-
msgstr ""
|
639 |
-
|
640 |
-
#: classes/class-cartflows-wizard.php:570
|
641 |
-
msgid "Create a flow"
|
642 |
-
msgstr ""
|
643 |
-
|
644 |
-
#: classes/class-cartflows-wizard.php:587
|
645 |
-
msgid "Exclusive CartFlows Training Course Offer"
|
646 |
-
msgstr ""
|
647 |
-
|
648 |
-
#: classes/class-cartflows-wizard.php:598
|
649 |
-
msgid ""
|
650 |
-
"We want you to get off to a great start using CartFlows, so we would like "
|
651 |
-
"to give access to our exclusive training course."
|
652 |
-
msgstr ""
|
653 |
-
|
654 |
-
#: classes/class-cartflows-wizard.php:599
|
655 |
-
msgid "Get access to this couse, for free, by entering your email below."
|
656 |
-
msgstr ""
|
657 |
-
|
658 |
-
#: classes/class-cartflows-wizard.php:601
|
659 |
-
msgid "Enter Email address"
|
660 |
-
msgstr ""
|
661 |
-
|
662 |
-
#: classes/class-cartflows-wizard.php:617
|
663 |
-
msgid "Allow"
|
664 |
-
msgstr ""
|
665 |
-
|
666 |
-
#: classes/logger/class-cartflows-log-handler-file.php:351
|
667 |
-
#: classes/logger/class-cartflows-log-handler-file.php:371
|
668 |
-
msgid "This method should not be called before plugins_loaded."
|
669 |
-
msgstr ""
|
670 |
-
|
671 |
-
#: classes/logger/class-cartflows-wc-logger.php:58
|
672 |
-
#. translators: 1: class name 2: Cartflows_Log_Handler_Interface
|
673 |
-
msgid "The provided handler %1$s does not implement %2$s."
|
674 |
-
msgstr ""
|
675 |
-
|
676 |
-
#: classes/logger/class-cartflows-wc-logger.php:136
|
677 |
-
#. translators: 1: Cartflows_WC_Logger::log 2: level
|
678 |
-
msgid "%1$s was called with an invalid level \"%2$s\"."
|
679 |
-
msgstr ""
|
680 |
-
|
681 |
-
#: includes/admin/cartflows-admin.php:19
|
682 |
-
#: includes/admin/cartflows-general.php:44
|
683 |
-
msgid "Modernizing WordPress eCommerce!"
|
684 |
-
msgstr ""
|
685 |
-
|
686 |
-
#: includes/admin/cartflows-admin.php:29
|
687 |
-
msgid "Settings saved successfully."
|
688 |
-
msgstr ""
|
689 |
-
|
690 |
-
#: includes/admin/cartflows-error-log.php:36
|
691 |
-
msgid "%1$s at %2$s"
|
692 |
-
msgstr ""
|
693 |
-
|
694 |
-
#: includes/admin/cartflows-error-log.php:41
|
695 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:176
|
696 |
-
#: modules/flow/view/meta-flow-steps.php:97
|
697 |
-
msgid "View"
|
698 |
-
msgstr ""
|
699 |
-
|
700 |
-
#: includes/admin/cartflows-error-log.php:65
|
701 |
-
msgid "Delete log"
|
702 |
-
msgstr ""
|
703 |
-
|
704 |
-
#: includes/admin/cartflows-error-log.php:70
|
705 |
-
msgid "There are currently no logs to view."
|
706 |
-
msgstr ""
|
707 |
-
|
708 |
-
#: includes/admin/cartflows-general-bck.php:10
|
709 |
-
msgid "Selec"
|
710 |
-
msgstr ""
|
711 |
-
|
712 |
-
#: includes/admin/cartflows-general-bck.php:22
|
713 |
-
msgid "General"
|
714 |
-
msgstr ""
|
715 |
-
|
716 |
-
#: includes/admin/cartflows-general.php:29
|
717 |
-
#: includes/admin/cartflows-general.php:52
|
718 |
-
msgid "General Settings"
|
719 |
-
msgstr ""
|
720 |
-
|
721 |
-
#: includes/admin/cartflows-general.php:36
|
722 |
-
msgid "Getting Started"
|
723 |
-
msgstr ""
|
724 |
-
|
725 |
-
#: includes/admin/cartflows-general.php:65
|
726 |
-
msgid "Disallow search engines from indexing flows"
|
727 |
-
msgstr ""
|
728 |
-
|
729 |
-
#: includes/admin/cartflows-general.php:75
|
730 |
-
#: modules/flow/view/meta-flow-steps.php:86
|
731 |
-
msgid "Global Checkout"
|
732 |
-
msgstr ""
|
733 |
-
|
734 |
-
#: includes/admin/cartflows-general.php:84
|
735 |
-
msgid "Show Templates designed with"
|
736 |
-
msgstr ""
|
737 |
-
|
738 |
-
#: includes/admin/cartflows-general.php:85
|
739 |
-
msgid ""
|
740 |
-
"CartFlows offers flow templates that can be imported in one click. These "
|
741 |
-
"templates are available in few different page builders. Please choose your "
|
742 |
-
"preferred page builder from the list so you will only see templates that "
|
743 |
-
"are made using that page builder.."
|
744 |
-
msgstr ""
|
745 |
-
|
746 |
-
#: includes/admin/cartflows-general.php:89
|
747 |
-
msgid "Beaver Builder"
|
748 |
-
msgstr ""
|
749 |
-
|
750 |
-
#: includes/admin/cartflows-general.php:100
|
751 |
-
#: includes/admin/cartflows-general.php:182
|
752 |
-
#: includes/admin/cartflows-general.php:267
|
753 |
-
msgid "Save Changes"
|
754 |
-
msgstr ""
|
755 |
-
|
756 |
-
#: includes/admin/cartflows-general.php:108
|
757 |
-
msgid "Permalink Settings"
|
758 |
-
msgstr ""
|
759 |
-
|
760 |
-
#: includes/admin/cartflows-general.php:129
|
761 |
-
msgid "Flow and Step Slug"
|
762 |
-
msgstr ""
|
763 |
-
|
764 |
-
#: includes/admin/cartflows-general.php:135
|
765 |
-
msgid "Flow Slug"
|
766 |
-
msgstr ""
|
767 |
-
|
768 |
-
#: includes/admin/cartflows-general.php:141
|
769 |
-
msgid "Step Slug"
|
770 |
-
msgstr ""
|
771 |
-
|
772 |
-
#: includes/admin/cartflows-general.php:153
|
773 |
-
msgid "Post Type Permalink Base"
|
774 |
-
msgstr ""
|
775 |
-
|
776 |
-
#: includes/admin/cartflows-general.php:161
|
777 |
-
msgid "Step Base"
|
778 |
-
msgstr ""
|
779 |
-
|
780 |
-
#: includes/admin/cartflows-general.php:171
|
781 |
-
msgid "Flow Base"
|
782 |
-
msgstr ""
|
783 |
-
|
784 |
-
#: includes/admin/cartflows-general.php:183
|
785 |
-
msgid "Set Default"
|
786 |
-
msgstr ""
|
787 |
-
|
788 |
-
#: includes/admin/cartflows-general.php:196
|
789 |
-
msgid "Facebook Pixel Settings"
|
790 |
-
msgstr ""
|
791 |
-
|
792 |
-
#: includes/admin/cartflows-general.php:211
|
793 |
-
msgid "Enable Facebook Pixel Tracking"
|
794 |
-
msgstr ""
|
795 |
-
|
796 |
-
#: includes/admin/cartflows-general.php:222
|
797 |
-
msgid "Enter Facebook pixel ID"
|
798 |
-
msgstr ""
|
799 |
-
|
800 |
-
#: includes/admin/cartflows-general.php:230
|
801 |
-
msgid "Enable Events:"
|
802 |
-
msgstr ""
|
803 |
-
|
804 |
-
#: includes/admin/cartflows-general.php:239
|
805 |
-
msgid "Initiate Checkout"
|
806 |
-
msgstr ""
|
807 |
-
|
808 |
-
#: includes/admin/cartflows-general.php:248
|
809 |
-
msgid "Add Payment Info"
|
810 |
-
msgstr ""
|
811 |
-
|
812 |
-
#: includes/admin/cartflows-general.php:257
|
813 |
-
msgid "Purchase Complete"
|
814 |
-
msgstr ""
|
815 |
-
|
816 |
-
#: includes/admin/cartflows-general.php:284
|
817 |
-
msgid "Knowledge Base"
|
818 |
-
msgstr ""
|
819 |
-
|
820 |
-
#: includes/admin/cartflows-general.php:288
|
821 |
-
msgid "Not sure how something works? Take a peek at the knowledge base and learn."
|
822 |
-
msgstr ""
|
823 |
-
|
824 |
-
#: includes/admin/cartflows-general.php:291
|
825 |
-
msgid "Visit Knowledge Base »"
|
826 |
-
msgstr ""
|
827 |
-
|
828 |
-
#: includes/admin/cartflows-general.php:299
|
829 |
-
msgid "Community"
|
830 |
-
msgstr ""
|
831 |
-
|
832 |
-
#: includes/admin/cartflows-general.php:303
|
833 |
-
msgid ""
|
834 |
-
"Join the community of super helpful CartFlows users. Say hello, ask "
|
835 |
-
"questions, give feedback and help each other!"
|
836 |
-
msgstr ""
|
837 |
-
|
838 |
-
#: includes/admin/cartflows-general.php:306
|
839 |
-
msgid "Join Our Facebook Group »"
|
840 |
-
msgstr ""
|
841 |
-
|
842 |
-
#: includes/admin/cartflows-general.php:314
|
843 |
-
msgid "Five Star Support"
|
844 |
-
msgstr ""
|
845 |
-
|
846 |
-
#: includes/admin/cartflows-general.php:318
|
847 |
-
msgid "Got a question? Get in touch with CartFlows developers. We're happy to help!"
|
848 |
-
msgstr ""
|
849 |
-
|
850 |
-
#: includes/admin/cartflows-general.php:321
|
851 |
-
msgid "Submit a Ticket »"
|
852 |
-
msgstr ""
|
853 |
-
|
854 |
-
#: includes/admin/cartflows-general.php:331
|
855 |
-
msgid "Load Minified CSS"
|
856 |
-
msgstr ""
|
857 |
-
|
858 |
-
#: includes/admin/cartflows-general.php:336
|
859 |
-
msgid ""
|
860 |
-
"Load the Minified CSS from here. Just Enable it by checking the below given "
|
861 |
-
"checkbox."
|
862 |
-
msgstr ""
|
863 |
-
|
864 |
-
#: includes/admin/cartflows-general.php:343
|
865 |
-
msgid "Load minified CSS & JS Files"
|
866 |
-
msgstr ""
|
867 |
-
|
868 |
-
#: includes/admin/cartflows-general.php:348
|
869 |
-
msgid "Save"
|
870 |
-
msgstr ""
|
871 |
-
|
872 |
-
#: includes/exporter.php:12
|
873 |
-
msgid "Export Flows to a JSON file"
|
874 |
-
msgstr ""
|
875 |
-
|
876 |
-
#: includes/exporter.php:13
|
877 |
-
msgid ""
|
878 |
-
"This tool allows you to generate and download a JSON file containing a list "
|
879 |
-
"of all flows."
|
880 |
-
msgstr ""
|
881 |
-
|
882 |
-
#: includes/importer.php:12
|
883 |
-
msgid "Import Flows to a JSON file"
|
884 |
-
msgstr ""
|
885 |
-
|
886 |
-
#: includes/importer.php:13
|
887 |
-
msgid "This tool allows you to import the flows from the JSON file."
|
888 |
-
msgstr ""
|
889 |
-
|
890 |
-
#: includes/importer.php:21
|
891 |
-
msgid "Import"
|
892 |
-
msgstr ""
|
893 |
-
|
894 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:232
|
895 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:65
|
896 |
-
msgid ""
|
897 |
-
"WooCommerce functions do not exist. If you are in an IFrame, please reload "
|
898 |
-
"it."
|
899 |
-
msgstr ""
|
900 |
-
|
901 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:233
|
902 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:66
|
903 |
-
msgid "Click Here to Reload"
|
904 |
-
msgstr ""
|
905 |
-
|
906 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:251
|
907 |
-
msgid "Checkout ID not found"
|
908 |
-
msgstr ""
|
909 |
-
|
910 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:314
|
911 |
-
#: modules/checkout/templates/embed/checkout-template-simple.php:25
|
912 |
-
#: modules/checkout/templates/wcf-template.php:36
|
913 |
-
msgid "Your cart is currently empty."
|
914 |
-
msgstr ""
|
915 |
-
|
916 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:379
|
917 |
-
msgid ""
|
918 |
-
"No product is selected. Please select products from the checkout meta "
|
919 |
-
"settings to continue."
|
920 |
-
msgstr ""
|
921 |
-
|
922 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:432
|
923 |
-
msgid "Variations Not set"
|
924 |
-
msgstr ""
|
925 |
-
|
926 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:440
|
927 |
-
msgid "This product can't be purchased"
|
928 |
-
msgstr ""
|
929 |
-
|
930 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
931 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
932 |
-
msgid "Coupon Code"
|
933 |
-
msgstr ""
|
934 |
-
|
935 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
936 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
937 |
-
msgid "Apply"
|
938 |
-
msgstr ""
|
939 |
-
|
940 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
941 |
-
msgid "Sorry there was a problem removing this coupon."
|
942 |
-
msgstr ""
|
943 |
-
|
944 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
945 |
-
msgid "Coupon has been removed."
|
946 |
-
msgstr ""
|
947 |
-
|
948 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
949 |
-
msgid "Sorry there was a problem removing "
|
950 |
-
msgstr ""
|
951 |
-
|
952 |
-
#: modules/checkout/classes/class-cartflows-checkout-markup.php:
|
953 |
-
msgid " has been removed."
|
954 |
-
msgstr ""
|
955 |
-
|
956 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:66
|
957 |
-
msgid "Checkout Layout"
|
958 |
-
msgstr ""
|
959 |
-
|
960 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:151
|
961 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:130
|
962 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:130
|
963 |
-
msgid "Shortcodes"
|
964 |
-
msgstr ""
|
965 |
-
|
966 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:157
|
967 |
-
msgid "Select Product"
|
968 |
-
msgstr ""
|
969 |
-
|
970 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:163
|
971 |
-
msgid "Order Bump"
|
972 |
-
msgstr ""
|
973 |
-
|
974 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:169
|
975 |
-
msgid "Checkout Offer"
|
976 |
-
msgstr ""
|
977 |
-
|
978 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:175
|
979 |
-
msgid "Checkout Design"
|
980 |
-
msgstr ""
|
981 |
-
|
982 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:181
|
983 |
-
msgid "Checkout Fields"
|
984 |
-
msgstr ""
|
985 |
-
|
986 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:187
|
987 |
-
msgid "Checkout Settings"
|
988 |
-
msgstr ""
|
989 |
-
|
990 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:204
|
991 |
-
msgid "Logo (Optional)"
|
992 |
-
msgstr ""
|
993 |
-
|
994 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:266
|
995 |
-
msgid "Add this shortcode to your checkout page"
|
996 |
-
msgstr ""
|
997 |
-
|
998 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:302
|
999 |
-
#. translators: %s: link
|
1000 |
-
msgid ""
|
1001 |
-
"Upgrade to %1$sCartFlows Pro%2$s for Pre-applied Coupon, Product Variations "
|
1002 |
-
"& Quantity Options."
|
1003 |
-
msgstr ""
|
1004 |
-
|
1005 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:329
|
1006 |
-
#. translators: %s: link
|
1007 |
-
msgid "Upgrade to %1$sCartFlows Pro%2$s for Checkout Offer feature"
|
1008 |
-
msgstr ""
|
1009 |
-
|
1010 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:339
|
1011 |
-
#. translators: %s: link
|
1012 |
-
msgid "Update to %1$sCartFlows Pro%2$s to %3$s or above for Checkout Offer feature"
|
1013 |
-
msgstr ""
|
1014 |
-
|
1015 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:367
|
1016 |
-
#. translators: %s: link
|
1017 |
-
msgid "Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature."
|
1018 |
-
msgstr ""
|
1019 |
-
|
1020 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:394
|
1021 |
-
#. translators: %s: link
|
1022 |
-
msgid "Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature."
|
1023 |
-
msgstr ""
|
1024 |
-
|
1025 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:418
|
1026 |
-
msgid "Enable cart editing on checkout"
|
1027 |
-
msgstr ""
|
1028 |
-
|
1029 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:426
|
1030 |
-
#. translators: %s: link
|
1031 |
-
msgid "Users will able to remove products from the checkout page."
|
1032 |
-
msgstr ""
|
1033 |
-
|
1034 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:454
|
1035 |
-
msgid "One Column (Available in CartFlows Pro) "
|
1036 |
-
msgstr ""
|
1037 |
-
|
1038 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:455
|
1039 |
-
msgid "Two Step (Available in CartFlows Pro) "
|
1040 |
-
msgstr ""
|
1041 |
-
|
1042 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:461
|
1043 |
-
msgid "Checkout Skin"
|
1044 |
-
msgstr ""
|
1045 |
-
|
1046 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:465
|
1047 |
-
msgid "One Column"
|
1048 |
-
msgstr ""
|
1049 |
-
|
1050 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:466
|
1051 |
-
msgid "Two Column"
|
1052 |
-
msgstr ""
|
1053 |
-
|
1054 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:467
|
1055 |
-
msgid "Two Step"
|
1056 |
-
msgstr ""
|
1057 |
-
|
1058 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:476
|
1059 |
-
msgid "Primary Color"
|
1060 |
-
msgstr ""
|
1061 |
-
|
1062 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:485
|
1063 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:520
|
1064 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:566
|
1065 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:658
|
1066 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:203
|
1067 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:226
|
1068 |
-
msgid "Font Family"
|
1069 |
-
msgstr ""
|
1070 |
-
|
1071 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:493
|
1072 |
-
msgid "Advance Options"
|
1073 |
-
msgstr ""
|
1074 |
-
|
1075 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:505
|
1076 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:211
|
1077 |
-
msgid "Heading"
|
1078 |
-
msgstr ""
|
1079 |
-
|
1080 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:511
|
1081 |
-
msgid "Heading Color"
|
1082 |
-
msgstr ""
|
1083 |
-
|
1084 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:529
|
1085 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:575
|
1086 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:667
|
1087 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:235
|
1088 |
-
msgid "Font Weight"
|
1089 |
-
msgstr ""
|
1090 |
-
|
1091 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:537
|
1092 |
-
msgid "Input Fields"
|
1093 |
-
msgstr ""
|
1094 |
-
|
1095 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:545
|
1096 |
-
msgid "Floating Labels (Available in CartFlows Pro)"
|
1097 |
-
msgstr ""
|
1098 |
-
|
1099 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:551
|
1100 |
-
msgid "Style"
|
1101 |
-
msgstr ""
|
1102 |
-
|
1103 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:556
|
1104 |
-
msgid "Floating Labels"
|
1105 |
-
msgstr ""
|
1106 |
-
|
1107 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:583
|
1108 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:675
|
1109 |
-
msgid "Size"
|
1110 |
-
msgstr ""
|
1111 |
-
|
1112 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:587
|
1113 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:679
|
1114 |
-
msgid "Extra Small"
|
1115 |
-
msgstr ""
|
1116 |
-
|
1117 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:588
|
1118 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:680
|
1119 |
-
msgid "Small"
|
1120 |
-
msgstr ""
|
1121 |
-
|
1122 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:589
|
1123 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:681
|
1124 |
-
msgid "Medium"
|
1125 |
-
msgstr ""
|
1126 |
-
|
1127 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:590
|
1128 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:682
|
1129 |
-
msgid "Large"
|
1130 |
-
msgstr ""
|
1131 |
-
|
1132 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:591
|
1133 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:683
|
1134 |
-
msgid "Extra Large"
|
1135 |
-
msgstr ""
|
1136 |
-
|
1137 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:592
|
1138 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:684
|
1139 |
-
msgid "Custom"
|
1140 |
-
msgstr ""
|
1141 |
-
|
1142 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:599
|
1143 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:691
|
1144 |
-
msgid "Top Bottom Spacing"
|
1145 |
-
msgstr ""
|
1146 |
-
|
1147 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:607
|
1148 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:699
|
1149 |
-
msgid "Left Right Spacing"
|
1150 |
-
msgstr ""
|
1151 |
-
|
1152 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:615
|
1153 |
-
msgid "Text / Placeholder Color"
|
1154 |
-
msgstr ""
|
1155 |
-
|
1156 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:623
|
1157 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:723
|
1158 |
-
msgid "Background Color"
|
1159 |
-
msgstr ""
|
1160 |
-
|
1161 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:631
|
1162 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:739
|
1163 |
-
msgid "Border Color"
|
1164 |
-
msgstr ""
|
1165 |
-
|
1166 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:638
|
1167 |
-
msgid "Label Color"
|
1168 |
-
msgstr ""
|
1169 |
-
|
1170 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:651
|
1171 |
-
msgid "Buttons"
|
1172 |
-
msgstr ""
|
1173 |
-
|
1174 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:707
|
1175 |
-
msgid "Text Color"
|
1176 |
-
msgstr ""
|
1177 |
-
|
1178 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:715
|
1179 |
-
msgid "Text Hover Color"
|
1180 |
-
msgstr ""
|
1181 |
-
|
1182 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:731
|
1183 |
-
msgid "Background Hover Color"
|
1184 |
-
msgstr ""
|
1185 |
-
|
1186 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:747
|
1187 |
-
msgid "Border Hover Color"
|
1188 |
-
msgstr ""
|
1189 |
-
|
1190 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:760
|
1191 |
-
msgid "Sections"
|
1192 |
-
msgstr ""
|
1193 |
-
|
1194 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:766
|
1195 |
-
msgid "Highlight Area Background Color"
|
1196 |
-
msgstr ""
|
1197 |
-
|
1198 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:805
|
1199 |
-
msgid "Header Logo"
|
1200 |
-
msgstr ""
|
1201 |
-
|
1202 |
-
#: modules/checkout/classes/class-cartflows-checkout-meta.php:813
|
1203 |
-
msgid "Logo Width (In px)"
|
1204 |
-
msgstr ""
|
1205 |
-
|
1206 |
-
#: modules/checkout/templates/wcf-template.php:46
|
1207 |
-
msgid "Copyright ©"
|
1208 |
-
msgstr ""
|
1209 |
-
|
1210 |
-
#: modules/checkout/templates/wcf-template.php:50
|
1211 |
-
msgid "All Rights Reserved"
|
1212 |
-
msgstr ""
|
1213 |
-
|
1214 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:199
|
1215 |
-
#. translators: %s flow id
|
1216 |
-
msgid "Steps not created for flow - %s"
|
1217 |
-
msgstr ""
|
1218 |
-
|
1219 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:213
|
1220 |
-
#. translators: %s flow id
|
1221 |
-
msgid "Steps already exists. Flow - %s"
|
1222 |
-
msgstr ""
|
1223 |
-
|
1224 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:224
|
1225 |
-
msgid "Landing Page"
|
1226 |
-
msgstr ""
|
1227 |
-
|
1228 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:225
|
1229 |
-
msgid "Checkout Page"
|
1230 |
-
msgstr ""
|
1231 |
-
|
1232 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:226
|
1233 |
-
msgid "Thank You Page"
|
1234 |
-
msgstr ""
|
1235 |
-
|
1236 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:262
|
1237 |
-
#. translators: %s flow id
|
1238 |
-
msgid "Steps created for flow - %s"
|
1239 |
-
msgstr ""
|
1240 |
-
|
1241 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:334
|
1242 |
-
#. translators: %s flow id
|
1243 |
-
msgid "Step not deleted for flow - %s"
|
1244 |
-
msgstr ""
|
1245 |
-
|
1246 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:365
|
1247 |
-
#. translators: %s flow id
|
1248 |
-
msgid "Step deleted for flow - %s"
|
1249 |
-
msgstr ""
|
1250 |
-
|
1251 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:389
|
1252 |
-
#. translators: %s flow id
|
1253 |
-
msgid "Steps not sorted for flow - %s"
|
1254 |
-
msgstr ""
|
1255 |
-
|
1256 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:412
|
1257 |
-
#. translators: %s flow id
|
1258 |
-
msgid "Steps sorted for flow - %s"
|
1259 |
-
msgstr ""
|
1260 |
-
|
1261 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:523
|
1262 |
-
msgid "Analytics"
|
1263 |
-
msgstr ""
|
1264 |
-
|
1265 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:540
|
1266 |
-
#. translators: %s: link
|
1267 |
-
msgid "Upgrade to %1$sCartFlows Pro%2$s for Analytics feature"
|
1268 |
-
msgstr ""
|
1269 |
-
|
1270 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:558
|
1271 |
-
msgid "Flow Settings"
|
1272 |
-
msgstr ""
|
1273 |
-
|
1274 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:643
|
1275 |
-
msgid "Enable Test Mode"
|
1276 |
-
msgstr ""
|
1277 |
-
|
1278 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:650
|
1279 |
-
msgid ""
|
1280 |
-
"If you are using WooCommerce plugin then test mode will add random products "
|
1281 |
-
"in your flow, so you can preview it easily while testing."
|
1282 |
-
msgstr ""
|
1283 |
-
|
1284 |
-
#: modules/flow/classes/class-cartflows-flow-meta.php:769
|
1285 |
-
#: modules/flow/view/meta-flow-steps.php:122
|
1286 |
-
msgid "Add New Step"
|
1287 |
-
msgstr ""
|
1288 |
-
|
1289 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:69
|
1290 |
-
msgid "Flow: "
|
1291 |
-
msgstr ""
|
1292 |
-
|
1293 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:69
|
1294 |
-
msgid "Name: "
|
1295 |
-
msgstr ""
|
1296 |
-
|
1297 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:101
|
1298 |
-
msgid "Search Flows"
|
1299 |
-
msgstr ""
|
1300 |
-
|
1301 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:102
|
1302 |
-
msgid "All Flows"
|
1303 |
-
msgstr ""
|
1304 |
-
|
1305 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:103
|
1306 |
-
msgid "Edit Flow"
|
1307 |
-
msgstr ""
|
1308 |
-
|
1309 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:104
|
1310 |
-
msgid "View Flow"
|
1311 |
-
msgstr ""
|
1312 |
-
|
1313 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:105
|
1314 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:107
|
1315 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:166
|
1316 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:168
|
1317 |
-
msgid "Add New"
|
1318 |
-
msgstr ""
|
1319 |
-
|
1320 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:106
|
1321 |
-
msgid "Update Flow"
|
1322 |
-
msgstr ""
|
1323 |
-
|
1324 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:108
|
1325 |
-
msgid "New Flow Name"
|
1326 |
-
msgstr ""
|
1327 |
-
|
1328 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:160
|
1329 |
-
msgid "Slug"
|
1330 |
-
msgstr ""
|
1331 |
-
|
1332 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:283
|
1333 |
-
msgid "Flows"
|
1334 |
-
msgstr ""
|
1335 |
-
|
1336 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:305
|
1337 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:311
|
1338 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:390
|
1339 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:396
|
1340 |
-
#. translators: %s: singular custom post type name
|
1341 |
-
msgid "%s updated."
|
1342 |
-
msgstr ""
|
1343 |
-
|
1344 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:307
|
1345 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:392
|
1346 |
-
#. translators: %s: singular custom post type name
|
1347 |
-
msgid "Custom %s updated."
|
1348 |
-
msgstr ""
|
1349 |
-
|
1350 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:309
|
1351 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:394
|
1352 |
-
#. translators: %s: singular custom post type name
|
1353 |
-
msgid "Custom %s deleted."
|
1354 |
-
msgstr ""
|
1355 |
-
|
1356 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:313
|
1357 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:398
|
1358 |
-
#. translators: %1$s: singular custom post type name ,%2$s: date and time of
|
1359 |
-
#. the revision
|
1360 |
-
msgid "%1$s restored to revision from %2$s"
|
1361 |
-
msgstr ""
|
1362 |
-
|
1363 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:315
|
1364 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:400
|
1365 |
-
#. translators: %s: singular custom post type name
|
1366 |
-
msgid "%s published."
|
1367 |
-
msgstr ""
|
1368 |
-
|
1369 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:317
|
1370 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:402
|
1371 |
-
#. translators: %s: singular custom post type name
|
1372 |
-
msgid "%s saved."
|
1373 |
-
msgstr ""
|
1374 |
-
|
1375 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:319
|
1376 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:404
|
1377 |
-
#. translators: %s: singular custom post type name
|
1378 |
-
msgid "%s submitted."
|
1379 |
-
msgstr ""
|
1380 |
-
|
1381 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:321
|
1382 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:406
|
1383 |
-
#. translators: %s: singular custom post type name
|
1384 |
-
msgid "%s scheduled for."
|
1385 |
-
msgstr ""
|
1386 |
-
|
1387 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:323
|
1388 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:408
|
1389 |
-
#. translators: %s: singular custom post type name
|
1390 |
-
msgid "%s draft updated."
|
1391 |
-
msgstr ""
|
1392 |
-
|
1393 |
-
#: modules/flow/classes/class-cartflows-flow-shortcodes.php:148
|
1394 |
-
#: modules/widgets/class-cartflows-next-step.php:78
|
1395 |
-
msgid "Next Step"
|
1396 |
-
msgstr ""
|
1397 |
-
|
1398 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:162
|
1399 |
-
msgid "Search Steps"
|
1400 |
-
msgstr ""
|
1401 |
-
|
1402 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:163
|
1403 |
-
msgid "All Steps"
|
1404 |
-
msgstr ""
|
1405 |
-
|
1406 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:164
|
1407 |
-
#: modules/flow/view/meta-flow-steps.php:99
|
1408 |
-
msgid "Edit Step"
|
1409 |
-
msgstr ""
|
1410 |
-
|
1411 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:165
|
1412 |
-
#: modules/flow/view/meta-flow-steps.php:95
|
1413 |
-
msgid "View Step"
|
1414 |
-
msgstr ""
|
1415 |
-
|
1416 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:167
|
1417 |
-
msgid "Update Step"
|
1418 |
-
msgstr ""
|
1419 |
-
|
1420 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:169
|
1421 |
-
msgid "New Step Name"
|
1422 |
-
msgstr ""
|
1423 |
-
|
1424 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:209
|
1425 |
-
msgid "Step Type"
|
1426 |
-
msgstr ""
|
1427 |
-
|
1428 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:219
|
1429 |
-
msgid "Step Flow"
|
1430 |
-
msgstr ""
|
1431 |
-
|
1432 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:258
|
1433 |
-
#: modules/flow/view/meta-flow-steps.php:14
|
1434 |
-
msgid "Upsell (Woo)"
|
1435 |
-
msgstr ""
|
1436 |
-
|
1437 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:265
|
1438 |
-
#: modules/flow/view/meta-flow-steps.php:15
|
1439 |
-
msgid "Downsell (Woo)"
|
1440 |
-
msgstr ""
|
1441 |
-
|
1442 |
-
#: modules/flow/view/meta-flow-steps.php:78
|
1443 |
-
msgid "No Product Assigned"
|
1444 |
-
msgstr ""
|
1445 |
-
|
1446 |
-
#: modules/flow/view/meta-flow-steps.php:82
|
1447 |
-
msgid "Global Checkout - Remove selected checkout product"
|
1448 |
-
msgstr ""
|
1449 |
-
|
1450 |
-
#: modules/flow/view/meta-flow-steps.php:101
|
1451 |
-
msgid "Edit"
|
1452 |
-
msgstr ""
|
1453 |
-
|
1454 |
-
#: modules/flow/view/meta-flow-steps.php:103
|
1455 |
-
msgid "Clone Step"
|
1456 |
-
msgstr ""
|
1457 |
-
|
1458 |
-
#: modules/flow/view/meta-flow-steps.php:107
|
1459 |
-
msgid "Delete Step"
|
1460 |
-
msgstr ""
|
1461 |
-
|
1462 |
-
#: modules/flow/view/meta-flow-steps.php:109
|
1463 |
-
msgid "Delete"
|
1464 |
-
msgstr ""
|
1465 |
-
|
1466 |
-
#: modules/flow/view/meta-flow-steps.php:138
|
1467 |
-
msgid "Steps Library"
|
1468 |
-
msgstr ""
|
1469 |
-
|
1470 |
-
#: modules/flow/view/meta-flow-steps.php:187
|
1471 |
-
msgid "Create Step"
|
1472 |
-
msgstr ""
|
1473 |
-
|
1474 |
-
#: modules/flow/view/meta-flow-steps.php:189
|
1475 |
-
msgid "You need a Cartflows Pro version to import Upsell / Downsell"
|
1476 |
-
msgstr ""
|
1477 |
-
|
1478 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:66
|
1479 |
-
msgid "Landing Page Settings"
|
1480 |
-
msgstr ""
|
1481 |
-
|
1482 |
-
#: modules/landing/classes/class-cartflows-landing-meta.php:169
|
1483 |
-
msgid "Next Step Link"
|
1484 |
-
msgstr ""
|
1485 |
-
|
1486 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:65
|
1487 |
-
msgid "Thank You Page Settings"
|
1488 |
-
msgstr ""
|
1489 |
-
|
1490 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:136
|
1491 |
-
msgid "Thank You Design"
|
1492 |
-
msgstr ""
|
1493 |
-
|
1494 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:142
|
1495 |
-
msgid "Thank You Fields"
|
1496 |
-
msgstr ""
|
1497 |
-
|
1498 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:176
|
1499 |
-
msgid "Order Details"
|
1500 |
-
msgstr ""
|
1501 |
-
|
1502 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:188
|
1503 |
-
msgid "Text"
|
1504 |
-
msgstr ""
|
1505 |
-
|
1506 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:194
|
1507 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:217
|
1508 |
-
msgid "Color"
|
1509 |
-
msgstr ""
|
1510 |
-
|
1511 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:243
|
1512 |
-
msgid "Advanced Options"
|
1513 |
-
msgstr ""
|
1514 |
-
|
1515 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:253
|
1516 |
-
msgid "Container Width (In px)"
|
1517 |
-
msgstr ""
|
1518 |
-
|
1519 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:261
|
1520 |
-
msgid "Section Background Color"
|
1521 |
-
msgstr ""
|
1522 |
-
|
1523 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:275
|
1524 |
-
msgid "Enable Order Overview "
|
1525 |
-
msgstr ""
|
1526 |
-
|
1527 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:283
|
1528 |
-
msgid "Enable Order Details "
|
1529 |
-
msgstr ""
|
1530 |
-
|
1531 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:291
|
1532 |
-
msgid "Enable Billing Details "
|
1533 |
-
msgstr ""
|
1534 |
-
|
1535 |
-
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:299
|
1536 |
-
msgid "Enable Shipping Details "
|
1537 |
-
msgstr ""
|
1538 |
-
|
1539 |
-
#: modules/widgets/class-cartflows-next-step.php:24
|
1540 |
-
msgid "CartFlows Next Step"
|
1541 |
-
msgstr ""
|
1542 |
-
|
1543 |
-
#: modules/widgets/class-cartflows-next-step.php:26
|
1544 |
-
msgid "Next Step Widgets"
|
1545 |
-
msgstr ""
|
1546 |
-
|
1547 |
-
#: modules/widgets/class-cartflows-next-step.php:106
|
1548 |
-
msgid "New title"
|
1549 |
-
msgstr ""
|
1550 |
-
|
1551 |
-
#: modules/widgets/class-cartflows-next-step.php:123
|
1552 |
-
msgid "Title:"
|
1553 |
-
msgstr ""
|
1554 |
-
|
1555 |
-
#: modules/widgets/class-cartflows-next-step.php:127
|
1556 |
-
msgid "Flow ID:"
|
1557 |
-
msgstr ""
|
1558 |
-
|
1559 |
-
#: modules/widgets/class-cartflows-next-step.php:131
|
1560 |
-
msgid "Step ID:"
|
1561 |
-
msgstr ""
|
1562 |
-
|
1563 |
-
#: woocommerce/template/cart/cart-shipping.php:51
|
1564 |
-
#. Translators: $s shipping destination.
|
1565 |
-
msgid "Estimate for %s."
|
1566 |
-
msgstr ""
|
1567 |
-
|
1568 |
-
#: woocommerce/template/cart/cart-shipping.php:52
|
1569 |
-
msgid "Change address"
|
1570 |
-
msgstr ""
|
1571 |
-
|
1572 |
-
#: woocommerce/template/cart/cart-shipping.php:54
|
1573 |
-
msgid "This is only an estimate. Prices will be updated during checkout."
|
1574 |
-
msgstr ""
|
1575 |
-
|
1576 |
-
#: woocommerce/template/cart/cart-shipping.php:61
|
1577 |
-
msgid "Enter your address to view shipping options."
|
1578 |
-
msgstr ""
|
1579 |
-
|
1580 |
-
#: woocommerce/template/cart/cart-shipping.php:63
|
1581 |
-
msgid ""
|
1582 |
-
"There are no shipping methods available. Please ensure that your address "
|
1583 |
-
"has been entered correctly, or contact us if you need any help."
|
1584 |
-
msgstr ""
|
1585 |
-
|
1586 |
-
#: woocommerce/template/cart/cart-shipping.php:66
|
1587 |
-
#. Translators: $s shipping destination.
|
1588 |
-
msgid "No shipping options were found for %s."
|
1589 |
-
msgstr ""
|
1590 |
-
|
1591 |
-
#: woocommerce/template/cart/cart-shipping.php:67
|
1592 |
-
msgid "Enter a different address"
|
1593 |
-
msgstr ""
|
1594 |
-
|
1595 |
-
#: woocommerce/template/checkout/form-billing.php:27
|
1596 |
-
msgid "Billing & Shipping"
|
1597 |
-
msgstr ""
|
1598 |
-
|
1599 |
-
#: woocommerce/template/checkout/form-billing.php:31
|
1600 |
-
msgid "Billing details"
|
1601 |
-
msgstr ""
|
1602 |
-
|
1603 |
-
#: woocommerce/template/checkout/form-billing.php:59
|
1604 |
-
msgid "Create an account?"
|
1605 |
-
msgstr ""
|
1606 |
-
|
1607 |
-
#: woocommerce/template/checkout/form-checkout.php:26
|
1608 |
-
msgid "You must be logged in to checkout."
|
1609 |
-
msgstr ""
|
1610 |
-
|
1611 |
-
#: woocommerce/template/checkout/form-checkout.php:52
|
1612 |
-
msgid "Your order"
|
1613 |
-
msgstr ""
|
1614 |
-
|
1615 |
-
#: woocommerce/template/checkout/form-coupon.php:26
|
1616 |
-
msgid "Have a coupon?"
|
1617 |
-
msgstr ""
|
1618 |
-
|
1619 |
-
#: woocommerce/template/checkout/form-coupon.php:26
|
1620 |
-
msgid "Click here to enter your code"
|
1621 |
-
msgstr ""
|
1622 |
-
|
1623 |
-
#: woocommerce/template/checkout/form-coupon.php:31
|
1624 |
-
msgid "If you have a coupon code, please apply it below."
|
1625 |
-
msgstr ""
|
1626 |
-
|
1627 |
-
#: woocommerce/template/checkout/form-coupon.php:34
|
1628 |
-
msgid "Coupon code"
|
1629 |
-
msgstr ""
|
1630 |
-
|
1631 |
-
#: woocommerce/template/checkout/form-coupon.php:38
|
1632 |
-
msgid "Apply coupon"
|
1633 |
-
msgstr ""
|
1634 |
-
|
1635 |
-
#: woocommerce/template/checkout/form-login.php:26
|
1636 |
-
msgid "Returning customer?"
|
1637 |
-
msgstr ""
|
1638 |
-
|
1639 |
-
#: woocommerce/template/checkout/form-login.php:26
|
1640 |
-
msgid "Click here to login"
|
1641 |
-
msgstr ""
|
1642 |
-
|
1643 |
-
#: woocommerce/template/checkout/form-login.php:32
|
1644 |
-
msgid ""
|
1645 |
-
"If you have shopped with us before, please enter your details below. If you "
|
1646 |
-
"are a new customer, please proceed to the Billing & Shipping section."
|
1647 |
-
msgstr ""
|
1648 |
-
|
1649 |
-
#: woocommerce/template/checkout/form-shipping.php:26
|
1650 |
-
msgid "Ship to a different address?"
|
1651 |
-
msgstr ""
|
1652 |
-
|
1653 |
-
#: woocommerce/template/checkout/form-shipping.php:57
|
1654 |
-
msgid "Additional information"
|
1655 |
-
msgstr ""
|
1656 |
-
|
1657 |
-
#: woocommerce/template/checkout/payment.php:33
|
1658 |
-
msgid ""
|
1659 |
-
"Sorry, it seems that there are no available payment methods for your state. "
|
1660 |
-
"Please contact us if you require assistance or wish to make alternate "
|
1661 |
-
"arrangements."
|
1662 |
-
msgstr ""
|
1663 |
-
|
1664 |
-
#: woocommerce/template/checkout/payment.php:33
|
1665 |
-
msgid "Please fill in your details above to see available payment methods."
|
1666 |
-
msgstr ""
|
1667 |
-
|
1668 |
-
#: woocommerce/template/checkout/payment.php:42
|
1669 |
-
#. translators: $1 and $2 opening and closing emphasis tags respectively
|
1670 |
-
msgid ""
|
1671 |
-
"Since your browser does not support JavaScript, or it is disabled, please "
|
1672 |
-
"ensure you click the %1$sUpdate Totals%2$s button before placing your "
|
1673 |
-
"order. You may be charged more than the amount stated above if you fail to "
|
1674 |
-
"do so."
|
1675 |
-
msgstr ""
|
1676 |
-
|
1677 |
-
#: woocommerce/template/checkout/payment.php:44
|
1678 |
-
msgid "Update totals"
|
1679 |
-
msgstr ""
|
1680 |
-
|
1681 |
-
#: woocommerce/template/checkout/review-order.php:26
|
1682 |
-
msgid "Product"
|
1683 |
-
msgstr ""
|
1684 |
-
|
1685 |
-
#: woocommerce/template/checkout/review-order.php:27
|
1686 |
-
#: woocommerce/template/checkout/review-order.php:107
|
1687 |
-
msgid "Total"
|
1688 |
-
msgstr ""
|
1689 |
-
|
1690 |
-
#: woocommerce/template/checkout/review-order.php:60
|
1691 |
-
msgid "Subtotal"
|
1692 |
-
msgstr ""
|
1693 |
-
|
1694 |
-
#: woocommerce/template/checkout/thankyou.php:30
|
1695 |
-
msgid ""
|
1696 |
-
"Unfortunately your order cannot be processed as the originating "
|
1697 |
-
"bank/merchant has declined your transaction. Please attempt your purchase "
|
1698 |
-
"again."
|
1699 |
-
msgstr ""
|
1700 |
-
|
1701 |
-
#: woocommerce/template/checkout/thankyou.php:33
|
1702 |
-
msgid "Pay"
|
1703 |
-
msgstr ""
|
1704 |
-
|
1705 |
-
#: woocommerce/template/checkout/thankyou.php:35
|
1706 |
-
msgid "My account"
|
1707 |
-
msgstr ""
|
1708 |
-
|
1709 |
-
#: woocommerce/template/checkout/thankyou.php:41
|
1710 |
-
#: woocommerce/template/checkout/thankyou.php:83
|
1711 |
-
msgid "Thank you. Your order has been received."
|
1712 |
-
msgstr ""
|
1713 |
-
|
1714 |
-
#: woocommerce/template/checkout/thankyou.php:46
|
1715 |
-
msgid "Order number:"
|
1716 |
-
msgstr ""
|
1717 |
-
|
1718 |
-
#: woocommerce/template/checkout/thankyou.php:51
|
1719 |
-
msgid "Date:"
|
1720 |
-
msgstr ""
|
1721 |
-
|
1722 |
-
#: woocommerce/template/checkout/thankyou.php:57
|
1723 |
-
msgid "Email:"
|
1724 |
-
msgstr ""
|
1725 |
-
|
1726 |
-
#: woocommerce/template/checkout/thankyou.php:63
|
1727 |
-
msgid "Total:"
|
1728 |
-
msgstr ""
|
1729 |
-
|
1730 |
-
#: woocommerce/template/checkout/thankyou.php:69
|
1731 |
-
msgid "Payment method:"
|
1732 |
-
msgstr ""
|
1733 |
-
|
1734 |
-
#: woocommerce/template/global/form-login.php:34
|
1735 |
-
msgid "Username or email"
|
1736 |
-
msgstr ""
|
1737 |
-
|
1738 |
-
#: woocommerce/template/global/form-login.php:38
|
1739 |
-
msgid "Password"
|
1740 |
-
msgstr ""
|
1741 |
-
|
1742 |
-
#: woocommerce/template/global/form-login.php:48
|
1743 |
-
msgid "Login"
|
1744 |
-
msgstr ""
|
1745 |
-
|
1746 |
-
#: woocommerce/template/global/form-login.php:53
|
1747 |
-
msgid "Remember me"
|
1748 |
-
msgstr ""
|
1749 |
-
|
1750 |
-
#: woocommerce/template/global/form-login.php:57
|
1751 |
-
msgid "Lost your password?"
|
1752 |
-
msgstr ""
|
1753 |
-
|
1754 |
-
#. Plugin Name of the plugin/theme
|
1755 |
-
msgid "CartFlows"
|
1756 |
-
msgstr ""
|
1757 |
-
|
1758 |
-
#. Author URI of the plugin/theme
|
1759 |
-
msgid "https://cartflows.com/"
|
1760 |
-
msgstr ""
|
1761 |
-
|
1762 |
-
#. Description of the plugin/theme
|
1763 |
-
msgid "Create beautiful checkout pages & sales flows for WooCommerce."
|
1764 |
-
msgstr ""
|
1765 |
-
|
1766 |
-
#. Author of the plugin/theme
|
1767 |
-
msgid "CartFlows Inc"
|
1768 |
-
msgstr ""
|
1769 |
-
|
1770 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:99
|
1771 |
-
msgctxt "flow general name"
|
1772 |
-
msgid "Flows"
|
1773 |
-
msgstr ""
|
1774 |
-
|
1775 |
-
#: modules/flow/classes/class-cartflows-flow-post-type.php:100
|
1776 |
-
msgctxt "flow singular name"
|
1777 |
-
msgid "Flow"
|
1778 |
-
msgstr ""
|
1779 |
-
|
1780 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:160
|
1781 |
-
msgctxt "flow step general name"
|
1782 |
-
msgid "Steps"
|
1783 |
-
msgstr ""
|
1784 |
-
|
1785 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:161
|
1786 |
-
msgctxt "flow step singular name"
|
1787 |
-
msgid "Step"
|
1788 |
-
msgstr ""
|
1789 |
-
|
1790 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:306
|
1791 |
-
msgctxt "cartflows"
|
1792 |
-
msgid "CartFlows — Boxed"
|
1793 |
-
msgstr ""
|
1794 |
-
|
1795 |
-
#: modules/flow/classes/class-cartflows-step-post-type.php:307
|
1796 |
-
msgctxt "cartflows"
|
1797 |
-
msgid "Template for Page Builders"
|
1798 |
msgstr ""
|
1 |
+
# Copyright (C) 2019 CartFlows Inc
|
2 |
+
# This file is distributed under the same license as the CartFlows package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: CartFlows 1.3.3\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
|
7 |
+
"POT-Creation-Date: 2019-12-26 07:34:34+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
"Language: en\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
+
"X-Poedit-Country: United States\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-KeywordsList: "
|
19 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
20 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
21 |
+
"X-Poedit-Basepath: ../\n"
|
22 |
+
"X-Poedit-SearchPath-0: .\n"
|
23 |
+
"X-Poedit-Bookmarks: \n"
|
24 |
+
"X-Textdomain-Support: yes\n"
|
25 |
+
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
26 |
+
|
27 |
+
#: classes/batch-process/class-cartflows-importer-elementor.php:44
|
28 |
+
msgid "Invalid content."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: classes/batch-process/class-cartflows-importer-elementor.php:52
|
32 |
+
msgid "Invalid content. Expected an array."
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: classes/batch-process/helpers/class-wp-background-process.php:435
|
36 |
+
msgid "Every %d Minutes"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: classes/class-cartflows-admin-fields.php:231
|
40 |
+
msgid "Select"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: classes/class-cartflows-admin-fields.php:234
|
44 |
+
msgid "No Checkout Steps"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: classes/class-cartflows-admin-fields.php:260
|
48 |
+
#. translators: %s: link
|
49 |
+
msgid ""
|
50 |
+
"Be sure not to add any product in above selected Global Checkout step. "
|
51 |
+
"Please read information about how to set up Global Checkout %1$shere%2$s."
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: classes/class-cartflows-admin.php:153 classes/class-cartflows-admin.php:154
|
55 |
+
#: includes/admin/cartflows-general-bck.php:34
|
56 |
+
msgid "Settings"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: classes/class-cartflows-admin.php:405
|
60 |
+
msgid "Installing and activating.."
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: classes/class-cartflows-admin.php:406
|
64 |
+
msgid "There was an error with the installation of plugin."
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: classes/class-cartflows-admin.php:460
|
68 |
+
msgid "Flows Library"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: classes/class-cartflows-admin.php:467
|
72 |
+
#: modules/flow/view/meta-flow-steps.php:145
|
73 |
+
msgid "Ready Templates"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: classes/class-cartflows-admin.php:470
|
77 |
+
#: modules/flow/view/meta-flow-steps.php:148
|
78 |
+
msgid "Create Your Own"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: classes/class-cartflows-admin.php:481
|
82 |
+
#: modules/flow/view/meta-flow-steps.php:160
|
83 |
+
msgid "Search Sites"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: classes/class-cartflows-admin.php:482
|
87 |
+
#: modules/flow/view/meta-flow-steps.php:161
|
88 |
+
msgid "Search Flow..."
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: classes/class-cartflows-admin.php:499
|
92 |
+
msgid "Design Your Flow"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: classes/class-cartflows-admin.php:500
|
96 |
+
#: classes/class-cartflows-importer.php:636
|
97 |
+
#: classes/class-cartflows-importer.php:735
|
98 |
+
#: modules/flow/view/meta-flow-steps.php:191
|
99 |
+
msgid "Learn How"
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: classes/class-cartflows-api.php:368
|
103 |
+
msgid "Request successfully processed!"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: classes/class-cartflows-cloning.php:423
|
107 |
+
msgid "Clone this flow"
|
108 |
+
msgstr ""
|
109 |
+
|
110 |
+
#: classes/class-cartflows-cloning.php:423
|
111 |
+
#: modules/flow/view/meta-flow-steps.php:105
|
112 |
+
msgid "Clone"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
#: classes/class-cartflows-flow-frontend.php:53
|
116 |
+
msgid ""
|
117 |
+
"Test mode is active — which displays random products for previewing. It can "
|
118 |
+
"be deactivated from the flow settings in the admin dashboard."
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: classes/class-cartflows-flow-frontend.php:58
|
122 |
+
msgid "Click here to disable it"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: classes/class-cartflows-importer.php:80
|
126 |
+
msgid "Export this flow"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: classes/class-cartflows-importer.php:80 includes/exporter.php:18
|
130 |
+
msgid "Export"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: classes/class-cartflows-importer.php:91
|
134 |
+
msgid "Flow Export"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: classes/class-cartflows-importer.php:92
|
138 |
+
msgid "Flow Import"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: classes/class-cartflows-importer.php:103
|
142 |
+
msgid "No post to export has been supplied!"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: classes/class-cartflows-importer.php:294
|
146 |
+
msgid "Please upload a valid .json file"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: classes/class-cartflows-importer.php:300
|
150 |
+
msgid "Please upload a file to import"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: classes/class-cartflows-importer.php:477
|
154 |
+
msgid "Successfully imported flows."
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: classes/class-cartflows-importer.php:509
|
158 |
+
msgid "Loading Steps"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: classes/class-cartflows-importer.php:511
|
162 |
+
msgid "Getting steps from the cloud. Please wait for the moment."
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: classes/class-cartflows-importer.php:522
|
166 |
+
msgid "Searching Template.."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: classes/class-cartflows-importer.php:524
|
170 |
+
msgid "Getting templates from the cloud. Please wait for the moment."
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: classes/class-cartflows-importer.php:533
|
174 |
+
msgid "Importing.."
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: classes/class-cartflows-importer.php:542
|
178 |
+
#: classes/class-cartflows-importer.php:582
|
179 |
+
msgid "Imported"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#: classes/class-cartflows-importer.php:543
|
183 |
+
#: classes/class-cartflows-importer.php:583
|
184 |
+
msgid "Thanks for patience"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: classes/class-cartflows-importer.php:552
|
188 |
+
#: classes/class-cartflows-importer.php:564
|
189 |
+
msgid "Coming Soon!"
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: classes/class-cartflows-importer.php:583
|
193 |
+
msgid "Redirecting to the Elementor edit window."
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: classes/class-cartflows-importer.php:629
|
197 |
+
#: classes/class-cartflows-importer.php:745
|
198 |
+
msgid "Pro"
|
199 |
+
msgstr ""
|
200 |
+
|
201 |
+
#: classes/class-cartflows-importer.php:670
|
202 |
+
#: classes/class-cartflows-importer.php:777
|
203 |
+
msgid "Activate License"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: classes/class-cartflows-importer.php:672
|
207 |
+
#: classes/class-cartflows-importer.php:779
|
208 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:541
|
209 |
+
msgid "Get Pro"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: classes/class-cartflows-importer.php:697
|
213 |
+
msgid "Create"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: classes/class-cartflows-importer.php:796
|
217 |
+
msgid "Under Maintenance.."
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: classes/class-cartflows-importer.php:797
|
221 |
+
msgid ""
|
222 |
+
"If you are seeing this message, most likely our servers are under routine "
|
223 |
+
"maintenance and we will be back shortly."
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: classes/class-cartflows-importer.php:798
|
227 |
+
msgid ""
|
228 |
+
"In rare case, it is possible your website is having trouble connecting with "
|
229 |
+
"ours. If you need help, please feel free to get in touch with us from our "
|
230 |
+
"website.."
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#: classes/class-cartflows-importer.php:828
|
234 |
+
#. translators: %s: Plugin string
|
235 |
+
msgid ""
|
236 |
+
"%1$s to see CartFlows templates. If you prefer another page builder tool, "
|
237 |
+
"you can <a href=\"%2$s\" target=\"blank\">select it here</a>."
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: classes/class-cartflows-importer.php:843
|
241 |
+
msgid "All"
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
+
#: classes/class-cartflows-importer.php:846
|
245 |
+
msgid "Select Step Type"
|
246 |
+
msgstr ""
|
247 |
+
|
248 |
+
#: classes/class-cartflows-importer.php:922
|
249 |
+
msgid "Import from Cloud"
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
+
#: classes/class-cartflows-importer.php:1236
|
253 |
+
msgid "Sales Landing"
|
254 |
+
msgstr ""
|
255 |
+
|
256 |
+
#: classes/class-cartflows-importer.php:1240
|
257 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:244
|
258 |
+
#: modules/flow/view/meta-flow-steps.php:12
|
259 |
+
msgid "Checkout (Woo)"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: classes/class-cartflows-importer.php:1244
|
263 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:251
|
264 |
+
#: modules/flow/view/meta-flow-steps.php:13
|
265 |
+
msgid "Thank You (Woo)"
|
266 |
+
msgstr ""
|
267 |
+
|
268 |
+
#: classes/class-cartflows-importer.php:1252
|
269 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:237
|
270 |
+
#: modules/flow/view/meta-flow-steps.php:11
|
271 |
+
msgid "Landing"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: classes/class-cartflows-importer.php:1256
|
275 |
+
msgid "Thank You"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: classes/class-cartflows-importer.php:1358
|
279 |
+
#. translators: %s: template ID
|
280 |
+
msgid "Invalid template id %1$s or post id %2$s."
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: classes/class-cartflows-importer.php:1416
|
284 |
+
#. translators: %s: flow ID
|
285 |
+
msgid "Invalid flow id %1$s OR step type %2$s."
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: classes/class-cartflows-importer.php:1541
|
289 |
+
msgid ""
|
290 |
+
"Elementor is not activated. Please activate plugin Elementor Page Builder "
|
291 |
+
"to import the step."
|
292 |
+
msgstr ""
|
293 |
+
|
294 |
+
#: classes/class-cartflows-importer.php:1644
|
295 |
+
msgid "Action failed. Invalid Security Nonce."
|
296 |
+
msgstr ""
|
297 |
+
|
298 |
+
#: classes/class-cartflows-importer.php:1651
|
299 |
+
msgid "User have not plugin install permissions."
|
300 |
+
msgstr ""
|
301 |
+
|
302 |
+
#: classes/class-cartflows-importer.php:1673
|
303 |
+
msgid "Plugin Successfully Activated"
|
304 |
+
msgstr ""
|
305 |
+
|
306 |
+
#: classes/class-cartflows-learndash-compatibility.php:79
|
307 |
+
msgid "None"
|
308 |
+
msgstr ""
|
309 |
+
|
310 |
+
#: classes/class-cartflows-learndash-compatibility.php:106
|
311 |
+
#. translators: 1: anchor start, 2: anchor close
|
312 |
+
msgid ""
|
313 |
+
"Non-enrolled students will redirect to the selected CartFlows template. If "
|
314 |
+
"you have not created any Flow already, add new Flow from %1$shere%2$s."
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: classes/class-cartflows-learndash-compatibility.php:112
|
318 |
+
msgid "Select CartFlows Template for this Course"
|
319 |
+
msgstr ""
|
320 |
+
|
321 |
+
#: classes/class-cartflows-loader.php:225
|
322 |
+
#. translators: %s: html tags
|
323 |
+
msgid ""
|
324 |
+
"You are using an older version of %1$sCartFlows Pro%2$s. Please update "
|
325 |
+
"%1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher."
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: classes/class-cartflows-loader.php:482
|
329 |
+
#. translators: %s: html tags
|
330 |
+
msgid ""
|
331 |
+
"This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & "
|
332 |
+
"activated."
|
333 |
+
msgstr ""
|
334 |
+
|
335 |
+
#: classes/class-cartflows-loader.php:492
|
336 |
+
msgid "Activate WooCommerce"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: classes/class-cartflows-loader.php:500
|
340 |
+
msgid "Install WooCommerce"
|
341 |
+
msgstr ""
|
342 |
+
|
343 |
+
#: classes/class-cartflows-logger.php:161
|
344 |
+
msgid "Action failed. Please refresh the page and retry."
|
345 |
+
msgstr ""
|
346 |
+
|
347 |
+
#: classes/class-cartflows-meta-fields.php:86
|
348 |
+
msgid "Thin 100"
|
349 |
+
msgstr ""
|
350 |
+
|
351 |
+
#: classes/class-cartflows-meta-fields.php:87
|
352 |
+
msgid "Extra-Light 200"
|
353 |
+
msgstr ""
|
354 |
+
|
355 |
+
#: classes/class-cartflows-meta-fields.php:88
|
356 |
+
msgid "Light 300"
|
357 |
+
msgstr ""
|
358 |
+
|
359 |
+
#: classes/class-cartflows-meta-fields.php:89
|
360 |
+
msgid "Normal 400"
|
361 |
+
msgstr ""
|
362 |
+
|
363 |
+
#: classes/class-cartflows-meta-fields.php:90
|
364 |
+
msgid "Medium 500"
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: classes/class-cartflows-meta-fields.php:91
|
368 |
+
msgid "Semi-Bold 600"
|
369 |
+
msgstr ""
|
370 |
+
|
371 |
+
#: classes/class-cartflows-meta-fields.php:92
|
372 |
+
msgid "Bold 700"
|
373 |
+
msgstr ""
|
374 |
+
|
375 |
+
#: classes/class-cartflows-meta-fields.php:93
|
376 |
+
msgid "Extra-Bold 800"
|
377 |
+
msgstr ""
|
378 |
+
|
379 |
+
#: classes/class-cartflows-meta-fields.php:94
|
380 |
+
msgid "Ultra-Bold 900"
|
381 |
+
msgstr ""
|
382 |
+
|
383 |
+
#: classes/class-cartflows-meta-fields.php:217
|
384 |
+
#: classes/class-cartflows-meta-fields.php:325
|
385 |
+
#: classes/class-cartflows-meta-fields.php:1426
|
386 |
+
msgid "Remove"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: classes/class-cartflows-meta-fields.php:446
|
390 |
+
msgid "Field Width"
|
391 |
+
msgstr ""
|
392 |
+
|
393 |
+
#: classes/class-cartflows-meta-fields.php:450
|
394 |
+
msgid "33%"
|
395 |
+
msgstr ""
|
396 |
+
|
397 |
+
#: classes/class-cartflows-meta-fields.php:451
|
398 |
+
msgid "50%"
|
399 |
+
msgstr ""
|
400 |
+
|
401 |
+
#: classes/class-cartflows-meta-fields.php:452
|
402 |
+
msgid "100%"
|
403 |
+
msgstr ""
|
404 |
+
|
405 |
+
#: classes/class-cartflows-meta-fields.php:463
|
406 |
+
msgid "Field Label"
|
407 |
+
msgstr ""
|
408 |
+
|
409 |
+
#: classes/class-cartflows-meta-fields.php:477
|
410 |
+
msgid "Options"
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#: classes/class-cartflows-meta-fields.php:492
|
414 |
+
#: classes/class-cartflows-meta-fields.php:505
|
415 |
+
#: includes/admin/cartflows-general.php:123
|
416 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:555
|
417 |
+
msgid "Default"
|
418 |
+
msgstr ""
|
419 |
+
|
420 |
+
#: classes/class-cartflows-meta-fields.php:496
|
421 |
+
msgid "Checked"
|
422 |
+
msgstr ""
|
423 |
+
|
424 |
+
#: classes/class-cartflows-meta-fields.php:497
|
425 |
+
msgid "Un-Checked"
|
426 |
+
msgstr ""
|
427 |
+
|
428 |
+
#: classes/class-cartflows-meta-fields.php:518
|
429 |
+
msgid "Placeholder"
|
430 |
+
msgstr ""
|
431 |
+
|
432 |
+
#: classes/class-cartflows-meta-fields.php:530
|
433 |
+
msgid "Required"
|
434 |
+
msgstr ""
|
435 |
+
|
436 |
+
#: classes/class-cartflows-meta-fields.php:542
|
437 |
+
msgid "Enable this field"
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
#: classes/class-cartflows-meta-fields.php:562
|
441 |
+
msgid "Label"
|
442 |
+
msgstr ""
|
443 |
+
|
444 |
+
#: classes/class-cartflows-meta-fields.php:999
|
445 |
+
#: classes/class-cartflows-meta-fields.php:1418
|
446 |
+
msgid "Search for a product…"
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
#: classes/class-cartflows-meta-fields.php:1040
|
450 |
+
msgid "Search for a coupon…"
|
451 |
+
msgstr ""
|
452 |
+
|
453 |
+
#: classes/class-cartflows-meta.php:34
|
454 |
+
msgid "Update"
|
455 |
+
msgstr ""
|
456 |
+
|
457 |
+
#: classes/class-cartflows-meta.php:42
|
458 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:84
|
459 |
+
msgid "Back to edit Flow"
|
460 |
+
msgstr ""
|
461 |
+
|
462 |
+
#: classes/class-cartflows-meta.php:63
|
463 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:193
|
464 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:136
|
465 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:148
|
466 |
+
msgid "Custom Script"
|
467 |
+
msgstr ""
|
468 |
+
|
469 |
+
#: classes/class-cartflows-meta.php:66
|
470 |
+
msgid ""
|
471 |
+
"Custom script lets you add your own custom script on front end of this flow "
|
472 |
+
"page."
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: classes/class-cartflows-metabox.php:59
|
476 |
+
msgid "Flow Details"
|
477 |
+
msgstr ""
|
478 |
+
|
479 |
+
#: classes/class-cartflows-wizard.php:83
|
480 |
+
msgid "Thanks for installing and using CartFlows!"
|
481 |
+
msgstr ""
|
482 |
+
|
483 |
+
#: classes/class-cartflows-wizard.php:84
|
484 |
+
msgid ""
|
485 |
+
"It is easy to use the CartFlows. Please use the setup wizard to quick start "
|
486 |
+
"setup."
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: classes/class-cartflows-wizard.php:86
|
490 |
+
msgid "Start Wizard"
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: classes/class-cartflows-wizard.php:87
|
494 |
+
msgid "Skip Setup"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: classes/class-cartflows-wizard.php:117
|
498 |
+
#: includes/admin/cartflows-general-bck.php:24
|
499 |
+
msgid "Welcome"
|
500 |
+
msgstr ""
|
501 |
+
|
502 |
+
#: classes/class-cartflows-wizard.php:122
|
503 |
+
msgid "Page Builder"
|
504 |
+
msgstr ""
|
505 |
+
|
506 |
+
#: classes/class-cartflows-wizard.php:126
|
507 |
+
msgid "Checkout"
|
508 |
+
msgstr ""
|
509 |
+
|
510 |
+
#: classes/class-cartflows-wizard.php:130
|
511 |
+
msgid "Training"
|
512 |
+
msgstr ""
|
513 |
+
|
514 |
+
#: classes/class-cartflows-wizard.php:134
|
515 |
+
msgid "Ready!"
|
516 |
+
msgstr ""
|
517 |
+
|
518 |
+
#: classes/class-cartflows-wizard.php:208
|
519 |
+
msgid "CartFlows Setup"
|
520 |
+
msgstr ""
|
521 |
+
|
522 |
+
#: classes/class-cartflows-wizard.php:234
|
523 |
+
msgid "Exit Setup Wizard"
|
524 |
+
msgstr ""
|
525 |
+
|
526 |
+
#: classes/class-cartflows-wizard.php:287
|
527 |
+
msgid "Welcome to CartFlows!"
|
528 |
+
msgstr ""
|
529 |
+
|
530 |
+
#: classes/class-cartflows-wizard.php:288
|
531 |
+
msgid ""
|
532 |
+
"Thank you for choosing CartFlows to get more leads, increase conversions, & "
|
533 |
+
"maximize profits. This short setup wizard will guide you though configuring "
|
534 |
+
"CartFlows and creating your first funnel."
|
535 |
+
msgstr ""
|
536 |
+
|
537 |
+
#: classes/class-cartflows-wizard.php:294
|
538 |
+
msgid "Lets Go »"
|
539 |
+
msgstr ""
|
540 |
+
|
541 |
+
#: classes/class-cartflows-wizard.php:321
|
542 |
+
msgid "Page Builder Setup"
|
543 |
+
msgstr ""
|
544 |
+
|
545 |
+
#: classes/class-cartflows-wizard.php:322
|
546 |
+
msgid "Please select a page builder you would like to use with CartFlows."
|
547 |
+
msgstr ""
|
548 |
+
|
549 |
+
#: classes/class-cartflows-wizard.php:327
|
550 |
+
msgid "Select Page Builder"
|
551 |
+
msgstr ""
|
552 |
+
|
553 |
+
#: classes/class-cartflows-wizard.php:334
|
554 |
+
#: includes/admin/cartflows-general.php:88
|
555 |
+
msgid "Elementor"
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
+
#: classes/class-cartflows-wizard.php:344
|
559 |
+
msgid "Beaver Builder Plugin (Lite Version)"
|
560 |
+
msgstr ""
|
561 |
+
|
562 |
+
#: classes/class-cartflows-wizard.php:354
|
563 |
+
#: includes/admin/cartflows-general.php:90
|
564 |
+
msgid "Divi"
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: classes/class-cartflows-wizard.php:364
|
568 |
+
#: includes/admin/cartflows-general.php:91
|
569 |
+
msgid "Other"
|
570 |
+
msgstr ""
|
571 |
+
|
572 |
+
#: classes/class-cartflows-wizard.php:386
|
573 |
+
msgid ""
|
574 |
+
"While CartFlows Should work with most page builders, we offer templates for "
|
575 |
+
"the above page builders."
|
576 |
+
msgstr ""
|
577 |
+
|
578 |
+
#: classes/class-cartflows-wizard.php:389
|
579 |
+
#: classes/class-cartflows-wizard.php:434
|
580 |
+
#: classes/class-cartflows-wizard.php:613
|
581 |
+
msgid "« Previous"
|
582 |
+
msgstr ""
|
583 |
+
|
584 |
+
#: classes/class-cartflows-wizard.php:392
|
585 |
+
msgid "Skip this step"
|
586 |
+
msgstr ""
|
587 |
+
|
588 |
+
#: classes/class-cartflows-wizard.php:393
|
589 |
+
msgid "Next »"
|
590 |
+
msgstr ""
|
591 |
+
|
592 |
+
#: classes/class-cartflows-wizard.php:412
|
593 |
+
msgid "Choose a checkout"
|
594 |
+
msgstr ""
|
595 |
+
|
596 |
+
#: classes/class-cartflows-wizard.php:415
|
597 |
+
msgid ""
|
598 |
+
"While CartFlows is designed to use WooCommerce sell digital and physical "
|
599 |
+
"products, not all funnels need a checkout system."
|
600 |
+
msgstr ""
|
601 |
+
|
602 |
+
#: classes/class-cartflows-wizard.php:417
|
603 |
+
msgid ""
|
604 |
+
"Would you like to install WooCommerce to sell digital and physical products "
|
605 |
+
"in your funnels?"
|
606 |
+
msgstr ""
|
607 |
+
|
608 |
+
#: classes/class-cartflows-wizard.php:424
|
609 |
+
msgid "The following plugin will be installed and activated for you:"
|
610 |
+
msgstr ""
|
611 |
+
|
612 |
+
#: classes/class-cartflows-wizard.php:425
|
613 |
+
msgid "WooCommerce"
|
614 |
+
msgstr ""
|
615 |
+
|
616 |
+
#: classes/class-cartflows-wizard.php:426
|
617 |
+
msgid "WooCommerce Cart Abandonment Recovery"
|
618 |
+
msgstr ""
|
619 |
+
|
620 |
+
#: classes/class-cartflows-wizard.php:437
|
621 |
+
#: classes/class-cartflows-wizard.php:616
|
622 |
+
msgid "No thanks"
|
623 |
+
msgstr ""
|
624 |
+
|
625 |
+
#: classes/class-cartflows-wizard.php:438
|
626 |
+
msgid "Yes"
|
627 |
+
msgstr ""
|
628 |
+
|
629 |
+
#: classes/class-cartflows-wizard.php:549
|
630 |
+
msgid "Congratulations, You Did It!"
|
631 |
+
msgstr ""
|
632 |
+
|
633 |
+
#: classes/class-cartflows-wizard.php:556
|
634 |
+
msgid ""
|
635 |
+
"CartFlows is ready to use on your website. You've successfully completed "
|
636 |
+
"the setup process and all that is left for you to do is create your first "
|
637 |
+
"flow."
|
638 |
+
msgstr ""
|
639 |
+
|
640 |
+
#: classes/class-cartflows-wizard.php:570
|
641 |
+
msgid "Create a flow"
|
642 |
+
msgstr ""
|
643 |
+
|
644 |
+
#: classes/class-cartflows-wizard.php:587
|
645 |
+
msgid "Exclusive CartFlows Training Course Offer"
|
646 |
+
msgstr ""
|
647 |
+
|
648 |
+
#: classes/class-cartflows-wizard.php:598
|
649 |
+
msgid ""
|
650 |
+
"We want you to get off to a great start using CartFlows, so we would like "
|
651 |
+
"to give access to our exclusive training course."
|
652 |
+
msgstr ""
|
653 |
+
|
654 |
+
#: classes/class-cartflows-wizard.php:599
|
655 |
+
msgid "Get access to this couse, for free, by entering your email below."
|
656 |
+
msgstr ""
|
657 |
+
|
658 |
+
#: classes/class-cartflows-wizard.php:601
|
659 |
+
msgid "Enter Email address"
|
660 |
+
msgstr ""
|
661 |
+
|
662 |
+
#: classes/class-cartflows-wizard.php:617
|
663 |
+
msgid "Allow"
|
664 |
+
msgstr ""
|
665 |
+
|
666 |
+
#: classes/logger/class-cartflows-log-handler-file.php:351
|
667 |
+
#: classes/logger/class-cartflows-log-handler-file.php:371
|
668 |
+
msgid "This method should not be called before plugins_loaded."
|
669 |
+
msgstr ""
|
670 |
+
|
671 |
+
#: classes/logger/class-cartflows-wc-logger.php:58
|
672 |
+
#. translators: 1: class name 2: Cartflows_Log_Handler_Interface
|
673 |
+
msgid "The provided handler %1$s does not implement %2$s."
|
674 |
+
msgstr ""
|
675 |
+
|
676 |
+
#: classes/logger/class-cartflows-wc-logger.php:136
|
677 |
+
#. translators: 1: Cartflows_WC_Logger::log 2: level
|
678 |
+
msgid "%1$s was called with an invalid level \"%2$s\"."
|
679 |
+
msgstr ""
|
680 |
+
|
681 |
+
#: includes/admin/cartflows-admin.php:19
|
682 |
+
#: includes/admin/cartflows-general.php:44
|
683 |
+
msgid "Modernizing WordPress eCommerce!"
|
684 |
+
msgstr ""
|
685 |
+
|
686 |
+
#: includes/admin/cartflows-admin.php:29
|
687 |
+
msgid "Settings saved successfully."
|
688 |
+
msgstr ""
|
689 |
+
|
690 |
+
#: includes/admin/cartflows-error-log.php:36
|
691 |
+
msgid "%1$s at %2$s"
|
692 |
+
msgstr ""
|
693 |
+
|
694 |
+
#: includes/admin/cartflows-error-log.php:41
|
695 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:176
|
696 |
+
#: modules/flow/view/meta-flow-steps.php:97
|
697 |
+
msgid "View"
|
698 |
+
msgstr ""
|
699 |
+
|
700 |
+
#: includes/admin/cartflows-error-log.php:65
|
701 |
+
msgid "Delete log"
|
702 |
+
msgstr ""
|
703 |
+
|
704 |
+
#: includes/admin/cartflows-error-log.php:70
|
705 |
+
msgid "There are currently no logs to view."
|
706 |
+
msgstr ""
|
707 |
+
|
708 |
+
#: includes/admin/cartflows-general-bck.php:10
|
709 |
+
msgid "Selec"
|
710 |
+
msgstr ""
|
711 |
+
|
712 |
+
#: includes/admin/cartflows-general-bck.php:22
|
713 |
+
msgid "General"
|
714 |
+
msgstr ""
|
715 |
+
|
716 |
+
#: includes/admin/cartflows-general.php:29
|
717 |
+
#: includes/admin/cartflows-general.php:52
|
718 |
+
msgid "General Settings"
|
719 |
+
msgstr ""
|
720 |
+
|
721 |
+
#: includes/admin/cartflows-general.php:36
|
722 |
+
msgid "Getting Started"
|
723 |
+
msgstr ""
|
724 |
+
|
725 |
+
#: includes/admin/cartflows-general.php:65
|
726 |
+
msgid "Disallow search engines from indexing flows"
|
727 |
+
msgstr ""
|
728 |
+
|
729 |
+
#: includes/admin/cartflows-general.php:75
|
730 |
+
#: modules/flow/view/meta-flow-steps.php:86
|
731 |
+
msgid "Global Checkout"
|
732 |
+
msgstr ""
|
733 |
+
|
734 |
+
#: includes/admin/cartflows-general.php:84
|
735 |
+
msgid "Show Templates designed with"
|
736 |
+
msgstr ""
|
737 |
+
|
738 |
+
#: includes/admin/cartflows-general.php:85
|
739 |
+
msgid ""
|
740 |
+
"CartFlows offers flow templates that can be imported in one click. These "
|
741 |
+
"templates are available in few different page builders. Please choose your "
|
742 |
+
"preferred page builder from the list so you will only see templates that "
|
743 |
+
"are made using that page builder.."
|
744 |
+
msgstr ""
|
745 |
+
|
746 |
+
#: includes/admin/cartflows-general.php:89
|
747 |
+
msgid "Beaver Builder"
|
748 |
+
msgstr ""
|
749 |
+
|
750 |
+
#: includes/admin/cartflows-general.php:100
|
751 |
+
#: includes/admin/cartflows-general.php:182
|
752 |
+
#: includes/admin/cartflows-general.php:267
|
753 |
+
msgid "Save Changes"
|
754 |
+
msgstr ""
|
755 |
+
|
756 |
+
#: includes/admin/cartflows-general.php:108
|
757 |
+
msgid "Permalink Settings"
|
758 |
+
msgstr ""
|
759 |
+
|
760 |
+
#: includes/admin/cartflows-general.php:129
|
761 |
+
msgid "Flow and Step Slug"
|
762 |
+
msgstr ""
|
763 |
+
|
764 |
+
#: includes/admin/cartflows-general.php:135
|
765 |
+
msgid "Flow Slug"
|
766 |
+
msgstr ""
|
767 |
+
|
768 |
+
#: includes/admin/cartflows-general.php:141
|
769 |
+
msgid "Step Slug"
|
770 |
+
msgstr ""
|
771 |
+
|
772 |
+
#: includes/admin/cartflows-general.php:153
|
773 |
+
msgid "Post Type Permalink Base"
|
774 |
+
msgstr ""
|
775 |
+
|
776 |
+
#: includes/admin/cartflows-general.php:161
|
777 |
+
msgid "Step Base"
|
778 |
+
msgstr ""
|
779 |
+
|
780 |
+
#: includes/admin/cartflows-general.php:171
|
781 |
+
msgid "Flow Base"
|
782 |
+
msgstr ""
|
783 |
+
|
784 |
+
#: includes/admin/cartflows-general.php:183
|
785 |
+
msgid "Set Default"
|
786 |
+
msgstr ""
|
787 |
+
|
788 |
+
#: includes/admin/cartflows-general.php:196
|
789 |
+
msgid "Facebook Pixel Settings"
|
790 |
+
msgstr ""
|
791 |
+
|
792 |
+
#: includes/admin/cartflows-general.php:211
|
793 |
+
msgid "Enable Facebook Pixel Tracking"
|
794 |
+
msgstr ""
|
795 |
+
|
796 |
+
#: includes/admin/cartflows-general.php:222
|
797 |
+
msgid "Enter Facebook pixel ID"
|
798 |
+
msgstr ""
|
799 |
+
|
800 |
+
#: includes/admin/cartflows-general.php:230
|
801 |
+
msgid "Enable Events:"
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: includes/admin/cartflows-general.php:239
|
805 |
+
msgid "Initiate Checkout"
|
806 |
+
msgstr ""
|
807 |
+
|
808 |
+
#: includes/admin/cartflows-general.php:248
|
809 |
+
msgid "Add Payment Info"
|
810 |
+
msgstr ""
|
811 |
+
|
812 |
+
#: includes/admin/cartflows-general.php:257
|
813 |
+
msgid "Purchase Complete"
|
814 |
+
msgstr ""
|
815 |
+
|
816 |
+
#: includes/admin/cartflows-general.php:284
|
817 |
+
msgid "Knowledge Base"
|
818 |
+
msgstr ""
|
819 |
+
|
820 |
+
#: includes/admin/cartflows-general.php:288
|
821 |
+
msgid "Not sure how something works? Take a peek at the knowledge base and learn."
|
822 |
+
msgstr ""
|
823 |
+
|
824 |
+
#: includes/admin/cartflows-general.php:291
|
825 |
+
msgid "Visit Knowledge Base »"
|
826 |
+
msgstr ""
|
827 |
+
|
828 |
+
#: includes/admin/cartflows-general.php:299
|
829 |
+
msgid "Community"
|
830 |
+
msgstr ""
|
831 |
+
|
832 |
+
#: includes/admin/cartflows-general.php:303
|
833 |
+
msgid ""
|
834 |
+
"Join the community of super helpful CartFlows users. Say hello, ask "
|
835 |
+
"questions, give feedback and help each other!"
|
836 |
+
msgstr ""
|
837 |
+
|
838 |
+
#: includes/admin/cartflows-general.php:306
|
839 |
+
msgid "Join Our Facebook Group »"
|
840 |
+
msgstr ""
|
841 |
+
|
842 |
+
#: includes/admin/cartflows-general.php:314
|
843 |
+
msgid "Five Star Support"
|
844 |
+
msgstr ""
|
845 |
+
|
846 |
+
#: includes/admin/cartflows-general.php:318
|
847 |
+
msgid "Got a question? Get in touch with CartFlows developers. We're happy to help!"
|
848 |
+
msgstr ""
|
849 |
+
|
850 |
+
#: includes/admin/cartflows-general.php:321
|
851 |
+
msgid "Submit a Ticket »"
|
852 |
+
msgstr ""
|
853 |
+
|
854 |
+
#: includes/admin/cartflows-general.php:331
|
855 |
+
msgid "Load Minified CSS"
|
856 |
+
msgstr ""
|
857 |
+
|
858 |
+
#: includes/admin/cartflows-general.php:336
|
859 |
+
msgid ""
|
860 |
+
"Load the Minified CSS from here. Just Enable it by checking the below given "
|
861 |
+
"checkbox."
|
862 |
+
msgstr ""
|
863 |
+
|
864 |
+
#: includes/admin/cartflows-general.php:343
|
865 |
+
msgid "Load minified CSS & JS Files"
|
866 |
+
msgstr ""
|
867 |
+
|
868 |
+
#: includes/admin/cartflows-general.php:348
|
869 |
+
msgid "Save"
|
870 |
+
msgstr ""
|
871 |
+
|
872 |
+
#: includes/exporter.php:12
|
873 |
+
msgid "Export Flows to a JSON file"
|
874 |
+
msgstr ""
|
875 |
+
|
876 |
+
#: includes/exporter.php:13
|
877 |
+
msgid ""
|
878 |
+
"This tool allows you to generate and download a JSON file containing a list "
|
879 |
+
"of all flows."
|
880 |
+
msgstr ""
|
881 |
+
|
882 |
+
#: includes/importer.php:12
|
883 |
+
msgid "Import Flows to a JSON file"
|
884 |
+
msgstr ""
|
885 |
+
|
886 |
+
#: includes/importer.php:13
|
887 |
+
msgid "This tool allows you to import the flows from the JSON file."
|
888 |
+
msgstr ""
|
889 |
+
|
890 |
+
#: includes/importer.php:21
|
891 |
+
msgid "Import"
|
892 |
+
msgstr ""
|
893 |
+
|
894 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:232
|
895 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:65
|
896 |
+
msgid ""
|
897 |
+
"WooCommerce functions do not exist. If you are in an IFrame, please reload "
|
898 |
+
"it."
|
899 |
+
msgstr ""
|
900 |
+
|
901 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:233
|
902 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-markup.php:66
|
903 |
+
msgid "Click Here to Reload"
|
904 |
+
msgstr ""
|
905 |
+
|
906 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:251
|
907 |
+
msgid "Checkout ID not found"
|
908 |
+
msgstr ""
|
909 |
+
|
910 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:314
|
911 |
+
#: modules/checkout/templates/embed/checkout-template-simple.php:25
|
912 |
+
#: modules/checkout/templates/wcf-template.php:36
|
913 |
+
msgid "Your cart is currently empty."
|
914 |
+
msgstr ""
|
915 |
+
|
916 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:379
|
917 |
+
msgid ""
|
918 |
+
"No product is selected. Please select products from the checkout meta "
|
919 |
+
"settings to continue."
|
920 |
+
msgstr ""
|
921 |
+
|
922 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:432
|
923 |
+
msgid "Variations Not set"
|
924 |
+
msgstr ""
|
925 |
+
|
926 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:440
|
927 |
+
msgid "This product can't be purchased"
|
928 |
+
msgstr ""
|
929 |
+
|
930 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1051
|
931 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1094
|
932 |
+
msgid "Coupon Code"
|
933 |
+
msgstr ""
|
934 |
+
|
935 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1052
|
936 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1103
|
937 |
+
msgid "Apply"
|
938 |
+
msgstr ""
|
939 |
+
|
940 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1259
|
941 |
+
msgid "Sorry there was a problem removing this coupon."
|
942 |
+
msgstr ""
|
943 |
+
|
944 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1262
|
945 |
+
msgid "Coupon has been removed."
|
946 |
+
msgstr ""
|
947 |
+
|
948 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1281
|
949 |
+
msgid "Sorry there was a problem removing "
|
950 |
+
msgstr ""
|
951 |
+
|
952 |
+
#: modules/checkout/classes/class-cartflows-checkout-markup.php:1284
|
953 |
+
msgid " has been removed."
|
954 |
+
msgstr ""
|
955 |
+
|
956 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:66
|
957 |
+
msgid "Checkout Layout"
|
958 |
+
msgstr ""
|
959 |
+
|
960 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:151
|
961 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:130
|
962 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:130
|
963 |
+
msgid "Shortcodes"
|
964 |
+
msgstr ""
|
965 |
+
|
966 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:157
|
967 |
+
msgid "Select Product"
|
968 |
+
msgstr ""
|
969 |
+
|
970 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:163
|
971 |
+
msgid "Order Bump"
|
972 |
+
msgstr ""
|
973 |
+
|
974 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:169
|
975 |
+
msgid "Checkout Offer"
|
976 |
+
msgstr ""
|
977 |
+
|
978 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:175
|
979 |
+
msgid "Checkout Design"
|
980 |
+
msgstr ""
|
981 |
+
|
982 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:181
|
983 |
+
msgid "Checkout Fields"
|
984 |
+
msgstr ""
|
985 |
+
|
986 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:187
|
987 |
+
msgid "Checkout Settings"
|
988 |
+
msgstr ""
|
989 |
+
|
990 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:204
|
991 |
+
msgid "Logo (Optional)"
|
992 |
+
msgstr ""
|
993 |
+
|
994 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:266
|
995 |
+
msgid "Add this shortcode to your checkout page"
|
996 |
+
msgstr ""
|
997 |
+
|
998 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:302
|
999 |
+
#. translators: %s: link
|
1000 |
+
msgid ""
|
1001 |
+
"Upgrade to %1$sCartFlows Pro%2$s for Pre-applied Coupon, Product Variations "
|
1002 |
+
"& Quantity Options."
|
1003 |
+
msgstr ""
|
1004 |
+
|
1005 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:329
|
1006 |
+
#. translators: %s: link
|
1007 |
+
msgid "Upgrade to %1$sCartFlows Pro%2$s for Checkout Offer feature"
|
1008 |
+
msgstr ""
|
1009 |
+
|
1010 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:339
|
1011 |
+
#. translators: %s: link
|
1012 |
+
msgid "Update to %1$sCartFlows Pro%2$s to %3$s or above for Checkout Offer feature"
|
1013 |
+
msgstr ""
|
1014 |
+
|
1015 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:367
|
1016 |
+
#. translators: %s: link
|
1017 |
+
msgid "Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature."
|
1018 |
+
msgstr ""
|
1019 |
+
|
1020 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:394
|
1021 |
+
#. translators: %s: link
|
1022 |
+
msgid "Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature."
|
1023 |
+
msgstr ""
|
1024 |
+
|
1025 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:418
|
1026 |
+
msgid "Enable cart editing on checkout"
|
1027 |
+
msgstr ""
|
1028 |
+
|
1029 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:426
|
1030 |
+
#. translators: %s: link
|
1031 |
+
msgid "Users will able to remove products from the checkout page."
|
1032 |
+
msgstr ""
|
1033 |
+
|
1034 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:454
|
1035 |
+
msgid "One Column (Available in CartFlows Pro) "
|
1036 |
+
msgstr ""
|
1037 |
+
|
1038 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:455
|
1039 |
+
msgid "Two Step (Available in CartFlows Pro) "
|
1040 |
+
msgstr ""
|
1041 |
+
|
1042 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:461
|
1043 |
+
msgid "Checkout Skin"
|
1044 |
+
msgstr ""
|
1045 |
+
|
1046 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:465
|
1047 |
+
msgid "One Column"
|
1048 |
+
msgstr ""
|
1049 |
+
|
1050 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:466
|
1051 |
+
msgid "Two Column"
|
1052 |
+
msgstr ""
|
1053 |
+
|
1054 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:467
|
1055 |
+
msgid "Two Step"
|
1056 |
+
msgstr ""
|
1057 |
+
|
1058 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:476
|
1059 |
+
msgid "Primary Color"
|
1060 |
+
msgstr ""
|
1061 |
+
|
1062 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:485
|
1063 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:520
|
1064 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:566
|
1065 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:658
|
1066 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:203
|
1067 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:226
|
1068 |
+
msgid "Font Family"
|
1069 |
+
msgstr ""
|
1070 |
+
|
1071 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:493
|
1072 |
+
msgid "Advance Options"
|
1073 |
+
msgstr ""
|
1074 |
+
|
1075 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:505
|
1076 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:211
|
1077 |
+
msgid "Heading"
|
1078 |
+
msgstr ""
|
1079 |
+
|
1080 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:511
|
1081 |
+
msgid "Heading Color"
|
1082 |
+
msgstr ""
|
1083 |
+
|
1084 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:529
|
1085 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:575
|
1086 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:667
|
1087 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:235
|
1088 |
+
msgid "Font Weight"
|
1089 |
+
msgstr ""
|
1090 |
+
|
1091 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:537
|
1092 |
+
msgid "Input Fields"
|
1093 |
+
msgstr ""
|
1094 |
+
|
1095 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:545
|
1096 |
+
msgid "Floating Labels (Available in CartFlows Pro)"
|
1097 |
+
msgstr ""
|
1098 |
+
|
1099 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:551
|
1100 |
+
msgid "Style"
|
1101 |
+
msgstr ""
|
1102 |
+
|
1103 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:556
|
1104 |
+
msgid "Floating Labels"
|
1105 |
+
msgstr ""
|
1106 |
+
|
1107 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:583
|
1108 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:675
|
1109 |
+
msgid "Size"
|
1110 |
+
msgstr ""
|
1111 |
+
|
1112 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:587
|
1113 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:679
|
1114 |
+
msgid "Extra Small"
|
1115 |
+
msgstr ""
|
1116 |
+
|
1117 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:588
|
1118 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:680
|
1119 |
+
msgid "Small"
|
1120 |
+
msgstr ""
|
1121 |
+
|
1122 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:589
|
1123 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:681
|
1124 |
+
msgid "Medium"
|
1125 |
+
msgstr ""
|
1126 |
+
|
1127 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:590
|
1128 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:682
|
1129 |
+
msgid "Large"
|
1130 |
+
msgstr ""
|
1131 |
+
|
1132 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:591
|
1133 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:683
|
1134 |
+
msgid "Extra Large"
|
1135 |
+
msgstr ""
|
1136 |
+
|
1137 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:592
|
1138 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:684
|
1139 |
+
msgid "Custom"
|
1140 |
+
msgstr ""
|
1141 |
+
|
1142 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:599
|
1143 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:691
|
1144 |
+
msgid "Top Bottom Spacing"
|
1145 |
+
msgstr ""
|
1146 |
+
|
1147 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:607
|
1148 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:699
|
1149 |
+
msgid "Left Right Spacing"
|
1150 |
+
msgstr ""
|
1151 |
+
|
1152 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:615
|
1153 |
+
msgid "Text / Placeholder Color"
|
1154 |
+
msgstr ""
|
1155 |
+
|
1156 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:623
|
1157 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:723
|
1158 |
+
msgid "Background Color"
|
1159 |
+
msgstr ""
|
1160 |
+
|
1161 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:631
|
1162 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:739
|
1163 |
+
msgid "Border Color"
|
1164 |
+
msgstr ""
|
1165 |
+
|
1166 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:638
|
1167 |
+
msgid "Label Color"
|
1168 |
+
msgstr ""
|
1169 |
+
|
1170 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:651
|
1171 |
+
msgid "Buttons"
|
1172 |
+
msgstr ""
|
1173 |
+
|
1174 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:707
|
1175 |
+
msgid "Text Color"
|
1176 |
+
msgstr ""
|
1177 |
+
|
1178 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:715
|
1179 |
+
msgid "Text Hover Color"
|
1180 |
+
msgstr ""
|
1181 |
+
|
1182 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:731
|
1183 |
+
msgid "Background Hover Color"
|
1184 |
+
msgstr ""
|
1185 |
+
|
1186 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:747
|
1187 |
+
msgid "Border Hover Color"
|
1188 |
+
msgstr ""
|
1189 |
+
|
1190 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:760
|
1191 |
+
msgid "Sections"
|
1192 |
+
msgstr ""
|
1193 |
+
|
1194 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:766
|
1195 |
+
msgid "Highlight Area Background Color"
|
1196 |
+
msgstr ""
|
1197 |
+
|
1198 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:805
|
1199 |
+
msgid "Header Logo"
|
1200 |
+
msgstr ""
|
1201 |
+
|
1202 |
+
#: modules/checkout/classes/class-cartflows-checkout-meta.php:813
|
1203 |
+
msgid "Logo Width (In px)"
|
1204 |
+
msgstr ""
|
1205 |
+
|
1206 |
+
#: modules/checkout/templates/wcf-template.php:46
|
1207 |
+
msgid "Copyright ©"
|
1208 |
+
msgstr ""
|
1209 |
+
|
1210 |
+
#: modules/checkout/templates/wcf-template.php:50
|
1211 |
+
msgid "All Rights Reserved"
|
1212 |
+
msgstr ""
|
1213 |
+
|
1214 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:199
|
1215 |
+
#. translators: %s flow id
|
1216 |
+
msgid "Steps not created for flow - %s"
|
1217 |
+
msgstr ""
|
1218 |
+
|
1219 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:213
|
1220 |
+
#. translators: %s flow id
|
1221 |
+
msgid "Steps already exists. Flow - %s"
|
1222 |
+
msgstr ""
|
1223 |
+
|
1224 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:224
|
1225 |
+
msgid "Landing Page"
|
1226 |
+
msgstr ""
|
1227 |
+
|
1228 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:225
|
1229 |
+
msgid "Checkout Page"
|
1230 |
+
msgstr ""
|
1231 |
+
|
1232 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:226
|
1233 |
+
msgid "Thank You Page"
|
1234 |
+
msgstr ""
|
1235 |
+
|
1236 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:262
|
1237 |
+
#. translators: %s flow id
|
1238 |
+
msgid "Steps created for flow - %s"
|
1239 |
+
msgstr ""
|
1240 |
+
|
1241 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:334
|
1242 |
+
#. translators: %s flow id
|
1243 |
+
msgid "Step not deleted for flow - %s"
|
1244 |
+
msgstr ""
|
1245 |
+
|
1246 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:365
|
1247 |
+
#. translators: %s flow id
|
1248 |
+
msgid "Step deleted for flow - %s"
|
1249 |
+
msgstr ""
|
1250 |
+
|
1251 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:389
|
1252 |
+
#. translators: %s flow id
|
1253 |
+
msgid "Steps not sorted for flow - %s"
|
1254 |
+
msgstr ""
|
1255 |
+
|
1256 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:412
|
1257 |
+
#. translators: %s flow id
|
1258 |
+
msgid "Steps sorted for flow - %s"
|
1259 |
+
msgstr ""
|
1260 |
+
|
1261 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:523
|
1262 |
+
msgid "Analytics"
|
1263 |
+
msgstr ""
|
1264 |
+
|
1265 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:540
|
1266 |
+
#. translators: %s: link
|
1267 |
+
msgid "Upgrade to %1$sCartFlows Pro%2$s for Analytics feature"
|
1268 |
+
msgstr ""
|
1269 |
+
|
1270 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:558
|
1271 |
+
msgid "Flow Settings"
|
1272 |
+
msgstr ""
|
1273 |
+
|
1274 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:643
|
1275 |
+
msgid "Enable Test Mode"
|
1276 |
+
msgstr ""
|
1277 |
+
|
1278 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:650
|
1279 |
+
msgid ""
|
1280 |
+
"If you are using WooCommerce plugin then test mode will add random products "
|
1281 |
+
"in your flow, so you can preview it easily while testing."
|
1282 |
+
msgstr ""
|
1283 |
+
|
1284 |
+
#: modules/flow/classes/class-cartflows-flow-meta.php:769
|
1285 |
+
#: modules/flow/view/meta-flow-steps.php:122
|
1286 |
+
msgid "Add New Step"
|
1287 |
+
msgstr ""
|
1288 |
+
|
1289 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:69
|
1290 |
+
msgid "Flow: "
|
1291 |
+
msgstr ""
|
1292 |
+
|
1293 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:69
|
1294 |
+
msgid "Name: "
|
1295 |
+
msgstr ""
|
1296 |
+
|
1297 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:101
|
1298 |
+
msgid "Search Flows"
|
1299 |
+
msgstr ""
|
1300 |
+
|
1301 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:102
|
1302 |
+
msgid "All Flows"
|
1303 |
+
msgstr ""
|
1304 |
+
|
1305 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:103
|
1306 |
+
msgid "Edit Flow"
|
1307 |
+
msgstr ""
|
1308 |
+
|
1309 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:104
|
1310 |
+
msgid "View Flow"
|
1311 |
+
msgstr ""
|
1312 |
+
|
1313 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:105
|
1314 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:107
|
1315 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:166
|
1316 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:168
|
1317 |
+
msgid "Add New"
|
1318 |
+
msgstr ""
|
1319 |
+
|
1320 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:106
|
1321 |
+
msgid "Update Flow"
|
1322 |
+
msgstr ""
|
1323 |
+
|
1324 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:108
|
1325 |
+
msgid "New Flow Name"
|
1326 |
+
msgstr ""
|
1327 |
+
|
1328 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:160
|
1329 |
+
msgid "Slug"
|
1330 |
+
msgstr ""
|
1331 |
+
|
1332 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:283
|
1333 |
+
msgid "Flows"
|
1334 |
+
msgstr ""
|
1335 |
+
|
1336 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:305
|
1337 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:311
|
1338 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:390
|
1339 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:396
|
1340 |
+
#. translators: %s: singular custom post type name
|
1341 |
+
msgid "%s updated."
|
1342 |
+
msgstr ""
|
1343 |
+
|
1344 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:307
|
1345 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:392
|
1346 |
+
#. translators: %s: singular custom post type name
|
1347 |
+
msgid "Custom %s updated."
|
1348 |
+
msgstr ""
|
1349 |
+
|
1350 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:309
|
1351 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:394
|
1352 |
+
#. translators: %s: singular custom post type name
|
1353 |
+
msgid "Custom %s deleted."
|
1354 |
+
msgstr ""
|
1355 |
+
|
1356 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:313
|
1357 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:398
|
1358 |
+
#. translators: %1$s: singular custom post type name ,%2$s: date and time of
|
1359 |
+
#. the revision
|
1360 |
+
msgid "%1$s restored to revision from %2$s"
|
1361 |
+
msgstr ""
|
1362 |
+
|
1363 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:315
|
1364 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:400
|
1365 |
+
#. translators: %s: singular custom post type name
|
1366 |
+
msgid "%s published."
|
1367 |
+
msgstr ""
|
1368 |
+
|
1369 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:317
|
1370 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:402
|
1371 |
+
#. translators: %s: singular custom post type name
|
1372 |
+
msgid "%s saved."
|
1373 |
+
msgstr ""
|
1374 |
+
|
1375 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:319
|
1376 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:404
|
1377 |
+
#. translators: %s: singular custom post type name
|
1378 |
+
msgid "%s submitted."
|
1379 |
+
msgstr ""
|
1380 |
+
|
1381 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:321
|
1382 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:406
|
1383 |
+
#. translators: %s: singular custom post type name
|
1384 |
+
msgid "%s scheduled for."
|
1385 |
+
msgstr ""
|
1386 |
+
|
1387 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:323
|
1388 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:408
|
1389 |
+
#. translators: %s: singular custom post type name
|
1390 |
+
msgid "%s draft updated."
|
1391 |
+
msgstr ""
|
1392 |
+
|
1393 |
+
#: modules/flow/classes/class-cartflows-flow-shortcodes.php:148
|
1394 |
+
#: modules/widgets/class-cartflows-next-step.php:78
|
1395 |
+
msgid "Next Step"
|
1396 |
+
msgstr ""
|
1397 |
+
|
1398 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:162
|
1399 |
+
msgid "Search Steps"
|
1400 |
+
msgstr ""
|
1401 |
+
|
1402 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:163
|
1403 |
+
msgid "All Steps"
|
1404 |
+
msgstr ""
|
1405 |
+
|
1406 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:164
|
1407 |
+
#: modules/flow/view/meta-flow-steps.php:99
|
1408 |
+
msgid "Edit Step"
|
1409 |
+
msgstr ""
|
1410 |
+
|
1411 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:165
|
1412 |
+
#: modules/flow/view/meta-flow-steps.php:95
|
1413 |
+
msgid "View Step"
|
1414 |
+
msgstr ""
|
1415 |
+
|
1416 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:167
|
1417 |
+
msgid "Update Step"
|
1418 |
+
msgstr ""
|
1419 |
+
|
1420 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:169
|
1421 |
+
msgid "New Step Name"
|
1422 |
+
msgstr ""
|
1423 |
+
|
1424 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:209
|
1425 |
+
msgid "Step Type"
|
1426 |
+
msgstr ""
|
1427 |
+
|
1428 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:219
|
1429 |
+
msgid "Step Flow"
|
1430 |
+
msgstr ""
|
1431 |
+
|
1432 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:258
|
1433 |
+
#: modules/flow/view/meta-flow-steps.php:14
|
1434 |
+
msgid "Upsell (Woo)"
|
1435 |
+
msgstr ""
|
1436 |
+
|
1437 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:265
|
1438 |
+
#: modules/flow/view/meta-flow-steps.php:15
|
1439 |
+
msgid "Downsell (Woo)"
|
1440 |
+
msgstr ""
|
1441 |
+
|
1442 |
+
#: modules/flow/view/meta-flow-steps.php:78
|
1443 |
+
msgid "No Product Assigned"
|
1444 |
+
msgstr ""
|
1445 |
+
|
1446 |
+
#: modules/flow/view/meta-flow-steps.php:82
|
1447 |
+
msgid "Global Checkout - Remove selected checkout product"
|
1448 |
+
msgstr ""
|
1449 |
+
|
1450 |
+
#: modules/flow/view/meta-flow-steps.php:101
|
1451 |
+
msgid "Edit"
|
1452 |
+
msgstr ""
|
1453 |
+
|
1454 |
+
#: modules/flow/view/meta-flow-steps.php:103
|
1455 |
+
msgid "Clone Step"
|
1456 |
+
msgstr ""
|
1457 |
+
|
1458 |
+
#: modules/flow/view/meta-flow-steps.php:107
|
1459 |
+
msgid "Delete Step"
|
1460 |
+
msgstr ""
|
1461 |
+
|
1462 |
+
#: modules/flow/view/meta-flow-steps.php:109
|
1463 |
+
msgid "Delete"
|
1464 |
+
msgstr ""
|
1465 |
+
|
1466 |
+
#: modules/flow/view/meta-flow-steps.php:138
|
1467 |
+
msgid "Steps Library"
|
1468 |
+
msgstr ""
|
1469 |
+
|
1470 |
+
#: modules/flow/view/meta-flow-steps.php:187
|
1471 |
+
msgid "Create Step"
|
1472 |
+
msgstr ""
|
1473 |
+
|
1474 |
+
#: modules/flow/view/meta-flow-steps.php:189
|
1475 |
+
msgid "You need a Cartflows Pro version to import Upsell / Downsell"
|
1476 |
+
msgstr ""
|
1477 |
+
|
1478 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:66
|
1479 |
+
msgid "Landing Page Settings"
|
1480 |
+
msgstr ""
|
1481 |
+
|
1482 |
+
#: modules/landing/classes/class-cartflows-landing-meta.php:169
|
1483 |
+
msgid "Next Step Link"
|
1484 |
+
msgstr ""
|
1485 |
+
|
1486 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:65
|
1487 |
+
msgid "Thank You Page Settings"
|
1488 |
+
msgstr ""
|
1489 |
+
|
1490 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:136
|
1491 |
+
msgid "Thank You Design"
|
1492 |
+
msgstr ""
|
1493 |
+
|
1494 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:142
|
1495 |
+
msgid "Thank You Fields"
|
1496 |
+
msgstr ""
|
1497 |
+
|
1498 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:176
|
1499 |
+
msgid "Order Details"
|
1500 |
+
msgstr ""
|
1501 |
+
|
1502 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:188
|
1503 |
+
msgid "Text"
|
1504 |
+
msgstr ""
|
1505 |
+
|
1506 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:194
|
1507 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:217
|
1508 |
+
msgid "Color"
|
1509 |
+
msgstr ""
|
1510 |
+
|
1511 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:243
|
1512 |
+
msgid "Advanced Options"
|
1513 |
+
msgstr ""
|
1514 |
+
|
1515 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:253
|
1516 |
+
msgid "Container Width (In px)"
|
1517 |
+
msgstr ""
|
1518 |
+
|
1519 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:261
|
1520 |
+
msgid "Section Background Color"
|
1521 |
+
msgstr ""
|
1522 |
+
|
1523 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:275
|
1524 |
+
msgid "Enable Order Overview "
|
1525 |
+
msgstr ""
|
1526 |
+
|
1527 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:283
|
1528 |
+
msgid "Enable Order Details "
|
1529 |
+
msgstr ""
|
1530 |
+
|
1531 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:291
|
1532 |
+
msgid "Enable Billing Details "
|
1533 |
+
msgstr ""
|
1534 |
+
|
1535 |
+
#: modules/thankyou/classes/class-cartflows-thankyou-meta.php:299
|
1536 |
+
msgid "Enable Shipping Details "
|
1537 |
+
msgstr ""
|
1538 |
+
|
1539 |
+
#: modules/widgets/class-cartflows-next-step.php:24
|
1540 |
+
msgid "CartFlows Next Step"
|
1541 |
+
msgstr ""
|
1542 |
+
|
1543 |
+
#: modules/widgets/class-cartflows-next-step.php:26
|
1544 |
+
msgid "Next Step Widgets"
|
1545 |
+
msgstr ""
|
1546 |
+
|
1547 |
+
#: modules/widgets/class-cartflows-next-step.php:106
|
1548 |
+
msgid "New title"
|
1549 |
+
msgstr ""
|
1550 |
+
|
1551 |
+
#: modules/widgets/class-cartflows-next-step.php:123
|
1552 |
+
msgid "Title:"
|
1553 |
+
msgstr ""
|
1554 |
+
|
1555 |
+
#: modules/widgets/class-cartflows-next-step.php:127
|
1556 |
+
msgid "Flow ID:"
|
1557 |
+
msgstr ""
|
1558 |
+
|
1559 |
+
#: modules/widgets/class-cartflows-next-step.php:131
|
1560 |
+
msgid "Step ID:"
|
1561 |
+
msgstr ""
|
1562 |
+
|
1563 |
+
#: woocommerce/template/cart/cart-shipping.php:51
|
1564 |
+
#. Translators: $s shipping destination.
|
1565 |
+
msgid "Estimate for %s."
|
1566 |
+
msgstr ""
|
1567 |
+
|
1568 |
+
#: woocommerce/template/cart/cart-shipping.php:52
|
1569 |
+
msgid "Change address"
|
1570 |
+
msgstr ""
|
1571 |
+
|
1572 |
+
#: woocommerce/template/cart/cart-shipping.php:54
|
1573 |
+
msgid "This is only an estimate. Prices will be updated during checkout."
|
1574 |
+
msgstr ""
|
1575 |
+
|
1576 |
+
#: woocommerce/template/cart/cart-shipping.php:61
|
1577 |
+
msgid "Enter your address to view shipping options."
|
1578 |
+
msgstr ""
|
1579 |
+
|
1580 |
+
#: woocommerce/template/cart/cart-shipping.php:63
|
1581 |
+
msgid ""
|
1582 |
+
"There are no shipping methods available. Please ensure that your address "
|
1583 |
+
"has been entered correctly, or contact us if you need any help."
|
1584 |
+
msgstr ""
|
1585 |
+
|
1586 |
+
#: woocommerce/template/cart/cart-shipping.php:66
|
1587 |
+
#. Translators: $s shipping destination.
|
1588 |
+
msgid "No shipping options were found for %s."
|
1589 |
+
msgstr ""
|
1590 |
+
|
1591 |
+
#: woocommerce/template/cart/cart-shipping.php:67
|
1592 |
+
msgid "Enter a different address"
|
1593 |
+
msgstr ""
|
1594 |
+
|
1595 |
+
#: woocommerce/template/checkout/form-billing.php:27
|
1596 |
+
msgid "Billing & Shipping"
|
1597 |
+
msgstr ""
|
1598 |
+
|
1599 |
+
#: woocommerce/template/checkout/form-billing.php:31
|
1600 |
+
msgid "Billing details"
|
1601 |
+
msgstr ""
|
1602 |
+
|
1603 |
+
#: woocommerce/template/checkout/form-billing.php:59
|
1604 |
+
msgid "Create an account?"
|
1605 |
+
msgstr ""
|
1606 |
+
|
1607 |
+
#: woocommerce/template/checkout/form-checkout.php:26
|
1608 |
+
msgid "You must be logged in to checkout."
|
1609 |
+
msgstr ""
|
1610 |
+
|
1611 |
+
#: woocommerce/template/checkout/form-checkout.php:52
|
1612 |
+
msgid "Your order"
|
1613 |
+
msgstr ""
|
1614 |
+
|
1615 |
+
#: woocommerce/template/checkout/form-coupon.php:26
|
1616 |
+
msgid "Have a coupon?"
|
1617 |
+
msgstr ""
|
1618 |
+
|
1619 |
+
#: woocommerce/template/checkout/form-coupon.php:26
|
1620 |
+
msgid "Click here to enter your code"
|
1621 |
+
msgstr ""
|
1622 |
+
|
1623 |
+
#: woocommerce/template/checkout/form-coupon.php:31
|
1624 |
+
msgid "If you have a coupon code, please apply it below."
|
1625 |
+
msgstr ""
|
1626 |
+
|
1627 |
+
#: woocommerce/template/checkout/form-coupon.php:34
|
1628 |
+
msgid "Coupon code"
|
1629 |
+
msgstr ""
|
1630 |
+
|
1631 |
+
#: woocommerce/template/checkout/form-coupon.php:38
|
1632 |
+
msgid "Apply coupon"
|
1633 |
+
msgstr ""
|
1634 |
+
|
1635 |
+
#: woocommerce/template/checkout/form-login.php:26
|
1636 |
+
msgid "Returning customer?"
|
1637 |
+
msgstr ""
|
1638 |
+
|
1639 |
+
#: woocommerce/template/checkout/form-login.php:26
|
1640 |
+
msgid "Click here to login"
|
1641 |
+
msgstr ""
|
1642 |
+
|
1643 |
+
#: woocommerce/template/checkout/form-login.php:32
|
1644 |
+
msgid ""
|
1645 |
+
"If you have shopped with us before, please enter your details below. If you "
|
1646 |
+
"are a new customer, please proceed to the Billing & Shipping section."
|
1647 |
+
msgstr ""
|
1648 |
+
|
1649 |
+
#: woocommerce/template/checkout/form-shipping.php:26
|
1650 |
+
msgid "Ship to a different address?"
|
1651 |
+
msgstr ""
|
1652 |
+
|
1653 |
+
#: woocommerce/template/checkout/form-shipping.php:57
|
1654 |
+
msgid "Additional information"
|
1655 |
+
msgstr ""
|
1656 |
+
|
1657 |
+
#: woocommerce/template/checkout/payment.php:33
|
1658 |
+
msgid ""
|
1659 |
+
"Sorry, it seems that there are no available payment methods for your state. "
|
1660 |
+
"Please contact us if you require assistance or wish to make alternate "
|
1661 |
+
"arrangements."
|
1662 |
+
msgstr ""
|
1663 |
+
|
1664 |
+
#: woocommerce/template/checkout/payment.php:33
|
1665 |
+
msgid "Please fill in your details above to see available payment methods."
|
1666 |
+
msgstr ""
|
1667 |
+
|
1668 |
+
#: woocommerce/template/checkout/payment.php:42
|
1669 |
+
#. translators: $1 and $2 opening and closing emphasis tags respectively
|
1670 |
+
msgid ""
|
1671 |
+
"Since your browser does not support JavaScript, or it is disabled, please "
|
1672 |
+
"ensure you click the %1$sUpdate Totals%2$s button before placing your "
|
1673 |
+
"order. You may be charged more than the amount stated above if you fail to "
|
1674 |
+
"do so."
|
1675 |
+
msgstr ""
|
1676 |
+
|
1677 |
+
#: woocommerce/template/checkout/payment.php:44
|
1678 |
+
msgid "Update totals"
|
1679 |
+
msgstr ""
|
1680 |
+
|
1681 |
+
#: woocommerce/template/checkout/review-order.php:26
|
1682 |
+
msgid "Product"
|
1683 |
+
msgstr ""
|
1684 |
+
|
1685 |
+
#: woocommerce/template/checkout/review-order.php:27
|
1686 |
+
#: woocommerce/template/checkout/review-order.php:107
|
1687 |
+
msgid "Total"
|
1688 |
+
msgstr ""
|
1689 |
+
|
1690 |
+
#: woocommerce/template/checkout/review-order.php:60
|
1691 |
+
msgid "Subtotal"
|
1692 |
+
msgstr ""
|
1693 |
+
|
1694 |
+
#: woocommerce/template/checkout/thankyou.php:30
|
1695 |
+
msgid ""
|
1696 |
+
"Unfortunately your order cannot be processed as the originating "
|
1697 |
+
"bank/merchant has declined your transaction. Please attempt your purchase "
|
1698 |
+
"again."
|
1699 |
+
msgstr ""
|
1700 |
+
|
1701 |
+
#: woocommerce/template/checkout/thankyou.php:33
|
1702 |
+
msgid "Pay"
|
1703 |
+
msgstr ""
|
1704 |
+
|
1705 |
+
#: woocommerce/template/checkout/thankyou.php:35
|
1706 |
+
msgid "My account"
|
1707 |
+
msgstr ""
|
1708 |
+
|
1709 |
+
#: woocommerce/template/checkout/thankyou.php:41
|
1710 |
+
#: woocommerce/template/checkout/thankyou.php:83
|
1711 |
+
msgid "Thank you. Your order has been received."
|
1712 |
+
msgstr ""
|
1713 |
+
|
1714 |
+
#: woocommerce/template/checkout/thankyou.php:46
|
1715 |
+
msgid "Order number:"
|
1716 |
+
msgstr ""
|
1717 |
+
|
1718 |
+
#: woocommerce/template/checkout/thankyou.php:51
|
1719 |
+
msgid "Date:"
|
1720 |
+
msgstr ""
|
1721 |
+
|
1722 |
+
#: woocommerce/template/checkout/thankyou.php:57
|
1723 |
+
msgid "Email:"
|
1724 |
+
msgstr ""
|
1725 |
+
|
1726 |
+
#: woocommerce/template/checkout/thankyou.php:63
|
1727 |
+
msgid "Total:"
|
1728 |
+
msgstr ""
|
1729 |
+
|
1730 |
+
#: woocommerce/template/checkout/thankyou.php:69
|
1731 |
+
msgid "Payment method:"
|
1732 |
+
msgstr ""
|
1733 |
+
|
1734 |
+
#: woocommerce/template/global/form-login.php:34
|
1735 |
+
msgid "Username or email"
|
1736 |
+
msgstr ""
|
1737 |
+
|
1738 |
+
#: woocommerce/template/global/form-login.php:38
|
1739 |
+
msgid "Password"
|
1740 |
+
msgstr ""
|
1741 |
+
|
1742 |
+
#: woocommerce/template/global/form-login.php:48
|
1743 |
+
msgid "Login"
|
1744 |
+
msgstr ""
|
1745 |
+
|
1746 |
+
#: woocommerce/template/global/form-login.php:53
|
1747 |
+
msgid "Remember me"
|
1748 |
+
msgstr ""
|
1749 |
+
|
1750 |
+
#: woocommerce/template/global/form-login.php:57
|
1751 |
+
msgid "Lost your password?"
|
1752 |
+
msgstr ""
|
1753 |
+
|
1754 |
+
#. Plugin Name of the plugin/theme
|
1755 |
+
msgid "CartFlows"
|
1756 |
+
msgstr ""
|
1757 |
+
|
1758 |
+
#. Author URI of the plugin/theme
|
1759 |
+
msgid "https://cartflows.com/"
|
1760 |
+
msgstr ""
|
1761 |
+
|
1762 |
+
#. Description of the plugin/theme
|
1763 |
+
msgid "Create beautiful checkout pages & sales flows for WooCommerce."
|
1764 |
+
msgstr ""
|
1765 |
+
|
1766 |
+
#. Author of the plugin/theme
|
1767 |
+
msgid "CartFlows Inc"
|
1768 |
+
msgstr ""
|
1769 |
+
|
1770 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:99
|
1771 |
+
msgctxt "flow general name"
|
1772 |
+
msgid "Flows"
|
1773 |
+
msgstr ""
|
1774 |
+
|
1775 |
+
#: modules/flow/classes/class-cartflows-flow-post-type.php:100
|
1776 |
+
msgctxt "flow singular name"
|
1777 |
+
msgid "Flow"
|
1778 |
+
msgstr ""
|
1779 |
+
|
1780 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:160
|
1781 |
+
msgctxt "flow step general name"
|
1782 |
+
msgid "Steps"
|
1783 |
+
msgstr ""
|
1784 |
+
|
1785 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:161
|
1786 |
+
msgctxt "flow step singular name"
|
1787 |
+
msgid "Step"
|
1788 |
+
msgstr ""
|
1789 |
+
|
1790 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:306
|
1791 |
+
msgctxt "cartflows"
|
1792 |
+
msgid "CartFlows — Boxed"
|
1793 |
+
msgstr ""
|
1794 |
+
|
1795 |
+
#: modules/flow/classes/class-cartflows-step-post-type.php:307
|
1796 |
+
msgctxt "cartflows"
|
1797 |
+
msgid "Template for Page Builders"
|
1798 |
msgstr ""
|
modules/checkout/classes/class-cartflows-checkout-markup.php
CHANGED
@@ -52,7 +52,7 @@ class Cartflows_Checkout_Markup {
|
|
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 |
|
@@ -112,7 +112,7 @@ class Cartflows_Checkout_Markup {
|
|
112 |
|
113 |
$checkout_id = get_the_ID();
|
114 |
if ( ! $checkout_id ) {
|
115 |
-
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? wp_unslash( $_POST['option']['checkout_id'] ) : ''
|
116 |
}
|
117 |
|
118 |
if ( ! empty( $checkout_id ) ) {
|
@@ -180,16 +180,16 @@ class Cartflows_Checkout_Markup {
|
|
180 |
if (
|
181 |
isset( $_SERVER['REQUEST_URI'] ) &&
|
182 |
// ignore on order-pay.
|
183 |
-
false === wcf_mb_strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), '/' . $order_pay_endpoint . '/' ) &&
|
184 |
// ignore on TY page.
|
185 |
-
false === wcf_mb_strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), '/' . $order_received_endpoint . '/' ) &&
|
186 |
// ignore if order-pay in query param.
|
187 |
-
false === wcf_mb_strpos( wp_unslash( $_SERVER['REQUEST_URI'] ), $order_pay_endpoint . '=' )
|
188 |
) {
|
189 |
|
190 |
if ( '' !== $global_checkout ) {
|
191 |
|
192 |
-
$link = get_permalink( $global_checkout );
|
193 |
|
194 |
if ( ! empty( $link ) ) {
|
195 |
|
@@ -429,7 +429,7 @@ class Cartflows_Checkout_Markup {
|
|
429 |
WC()->cart->add_to_cart( $product_childrens[0], $quantity );
|
430 |
$cart_product_count++;
|
431 |
} else {
|
432 |
-
echo '<p>' .
|
433 |
}
|
434 |
}
|
435 |
} else {
|
@@ -878,21 +878,28 @@ class Cartflows_Checkout_Markup {
|
|
878 |
* Get ajax end points.
|
879 |
*
|
880 |
* @param string $endpoint_url end point URL.
|
|
|
881 |
* @return string
|
882 |
*/
|
883 |
-
public function get_ajax_endpoint( $endpoint_url ) {
|
884 |
|
885 |
global $post;
|
886 |
|
887 |
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
888 |
|
889 |
-
if ( _is_wcf_checkout_type()
|
890 |
|
891 |
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
892 |
|
893 |
-
$
|
894 |
-
|
895 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
896 |
|
897 |
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
898 |
$uri = $uri[0];
|
@@ -917,7 +924,7 @@ class Cartflows_Checkout_Markup {
|
|
917 |
|
918 |
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
919 |
|
920 |
-
$checkout_id = wc_clean( wp_unslash( $_POST['_wcf_checkout_id'] ) );
|
921 |
|
922 |
update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
|
923 |
|
@@ -955,7 +962,7 @@ class Cartflows_Checkout_Markup {
|
|
955 |
*/
|
956 |
if ( isset( $_POST['_wcf_flow_id'] ) ) {
|
957 |
|
958 |
-
$checkout_id = wc_clean( wp_unslash( $_POST['_wcf_flow_id'] ) );
|
959 |
|
960 |
update_post_meta( $order_id, '_wcf_flow_id', $checkout_id );
|
961 |
}
|
@@ -1246,13 +1253,13 @@ class Cartflows_Checkout_Markup {
|
|
1246 |
public function remove_coupon() {
|
1247 |
|
1248 |
check_ajax_referer( 'wcf-remove-coupon', 'security' );
|
1249 |
-
$coupon = isset( $_POST['coupon_code'] ) ? wc_clean( wp_unslash( $_POST['coupon_code'] ) ) : false;
|
1250 |
|
1251 |
if ( empty( $coupon ) ) {
|
1252 |
-
echo "<div class='woocommerce-error'>" .
|
1253 |
} else {
|
1254 |
WC()->cart->remove_coupon( $coupon );
|
1255 |
-
echo "<div class='woocommerce-error'>" .
|
1256 |
}
|
1257 |
wc_print_notices();
|
1258 |
wp_die();
|
@@ -1264,8 +1271,8 @@ class Cartflows_Checkout_Markup {
|
|
1264 |
public function wcf_woo_remove_cart_product() {
|
1265 |
|
1266 |
check_ajax_referer( 'wcf-remove-cart-product', 'security' );
|
1267 |
-
$product_key = isset( $_POST['p_key'] ) ? wc_clean( wp_unslash( $_POST['p_key'] ) ) : false;
|
1268 |
-
$product_id = isset( $_POST['p_id'] ) ? wc_clean( wp_unslash( $_POST['p_id'] ) ) : '';
|
1269 |
$product_title = get_the_title( $product_id );
|
1270 |
|
1271 |
$needs_shipping = false;
|
52 |
add_action( 'wp', array( $this, 'shortcode_load_data' ), 999 );
|
53 |
|
54 |
/* Ajax Endpoint */
|
55 |
+
add_filter( 'woocommerce_ajax_get_endpoint', array( $this, 'get_ajax_endpoint' ), 10, 2 );
|
56 |
|
57 |
add_filter( 'cartflows_add_before_main_section', array( $this, 'enable_logo_in_header' ) );
|
58 |
|
112 |
|
113 |
$checkout_id = get_the_ID();
|
114 |
if ( ! $checkout_id ) {
|
115 |
+
$checkout_id = ( isset( $_POST['option']['checkout_id'] ) ) ? wp_unslash( $_POST['option']['checkout_id'] ) : '';//phpcs:ignore
|
116 |
}
|
117 |
|
118 |
if ( ! empty( $checkout_id ) ) {
|
180 |
if (
|
181 |
isset( $_SERVER['REQUEST_URI'] ) &&
|
182 |
// ignore on order-pay.
|
183 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_pay_endpoint . '/' ) &&
|
184 |
// ignore on TY page.
|
185 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/' . $order_received_endpoint . '/' ) &&
|
186 |
// ignore if order-pay in query param.
|
187 |
+
false === wcf_mb_strpos( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), $order_pay_endpoint . '=' )
|
188 |
) {
|
189 |
|
190 |
if ( '' !== $global_checkout ) {
|
191 |
|
192 |
+
$link = apply_filters( 'cartflows_global_checkout_url', get_permalink( $global_checkout ) );
|
193 |
|
194 |
if ( ! empty( $link ) ) {
|
195 |
|
429 |
WC()->cart->add_to_cart( $product_childrens[0], $quantity );
|
430 |
$cart_product_count++;
|
431 |
} else {
|
432 |
+
echo '<p>' . esc_html__( 'Variations Not set', 'cartflows' ) . '</p>';
|
433 |
}
|
434 |
}
|
435 |
} else {
|
878 |
* Get ajax end points.
|
879 |
*
|
880 |
* @param string $endpoint_url end point URL.
|
881 |
+
* @param string $request end point request.
|
882 |
* @return string
|
883 |
*/
|
884 |
+
public function get_ajax_endpoint( $endpoint_url, $request ) {
|
885 |
|
886 |
global $post;
|
887 |
|
888 |
if ( ! empty( $post ) && ! empty( $_SERVER['REQUEST_URI'] ) ) {
|
889 |
|
890 |
+
if ( _is_wcf_checkout_type() ) {
|
891 |
|
892 |
if ( mb_strpos( $endpoint_url, 'checkout', 0, 'utf-8' ) === false ) {
|
893 |
|
894 |
+
if ( '' === $request ) {
|
895 |
+
$query_args = array(
|
896 |
+
'wc-ajax' => '%%endpoint%%',
|
897 |
+
);
|
898 |
+
} else {
|
899 |
+
$query_args = array(
|
900 |
+
'wc-ajax' => $request,
|
901 |
+
);
|
902 |
+
}
|
903 |
|
904 |
$uri = explode( '?', $_SERVER['REQUEST_URI'], 2 ); //phpcs:ignore
|
905 |
$uri = $uri[0];
|
924 |
|
925 |
if ( isset( $_POST['_wcf_checkout_id'] ) ) {
|
926 |
|
927 |
+
$checkout_id = wc_clean( wp_unslash( $_POST['_wcf_checkout_id'] ) ); //phpcs:ignore
|
928 |
|
929 |
update_post_meta( $order_id, '_wcf_checkout_id', $checkout_id );
|
930 |
|
962 |
*/
|
963 |
if ( isset( $_POST['_wcf_flow_id'] ) ) {
|
964 |
|
965 |
+
$checkout_id = wc_clean( wp_unslash( $_POST['_wcf_flow_id'] ) ); //phpcs:ignore
|
966 |
|
967 |
update_post_meta( $order_id, '_wcf_flow_id', $checkout_id );
|
968 |
}
|
1253 |
public function remove_coupon() {
|
1254 |
|
1255 |
check_ajax_referer( 'wcf-remove-coupon', 'security' );
|
1256 |
+
$coupon = isset( $_POST['coupon_code'] ) ? wc_clean( wp_unslash( $_POST['coupon_code'] ) ) : false; //phpcs:ignore
|
1257 |
|
1258 |
if ( empty( $coupon ) ) {
|
1259 |
+
echo "<div class='woocommerce-error'>" . esc_html__( 'Sorry there was a problem removing this coupon.', 'cartflows' );
|
1260 |
} else {
|
1261 |
WC()->cart->remove_coupon( $coupon );
|
1262 |
+
echo "<div class='woocommerce-error'>" . esc_html__( 'Coupon has been removed.', 'cartflows' ) . '</div>';
|
1263 |
}
|
1264 |
wc_print_notices();
|
1265 |
wp_die();
|
1271 |
public function wcf_woo_remove_cart_product() {
|
1272 |
|
1273 |
check_ajax_referer( 'wcf-remove-cart-product', 'security' );
|
1274 |
+
$product_key = isset( $_POST['p_key'] ) ? wc_clean( wp_unslash( $_POST['p_key'] ) ) : false; //phpcs:ignore
|
1275 |
+
$product_id = isset( $_POST['p_id'] ) ? wc_clean( wp_unslash( $_POST['p_id'] ) ) : ''; //phpcs:ignore
|
1276 |
$product_title = get_the_title( $product_id );
|
1277 |
|
1278 |
$needs_shipping = false;
|
modules/checkout/classes/class-cartflows-checkout-meta.php
CHANGED
@@ -263,7 +263,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
263 |
'label' => 'Checkout Page',
|
264 |
'name' => 'wcf-checkout-shortcode',
|
265 |
'content' => '[cartflows_checkout]',
|
266 |
-
'help' =>
|
267 |
)
|
268 |
);
|
269 |
?>
|
@@ -299,7 +299,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
299 |
array(
|
300 |
'name' => 'wcf-upgrade-to-pro',
|
301 |
/* translators: %s: link */
|
302 |
-
'content' => '<i>' . sprintf(
|
303 |
)
|
304 |
);
|
305 |
}
|
@@ -326,7 +326,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
326 |
array(
|
327 |
'name' => 'wcf-upgrade-to-pro',
|
328 |
/* translators: %s: link */
|
329 |
-
'content' => '<i>' . sprintf(
|
330 |
)
|
331 |
);
|
332 |
} elseif ( _is_cartflows_pro_ver_less_than( '1.2.0' ) ) {
|
@@ -336,7 +336,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
336 |
array(
|
337 |
'name' => 'wcf-upgrade-to-pro',
|
338 |
/* translators: %s: link */
|
339 |
-
'content' => '<i>' . sprintf(
|
340 |
)
|
341 |
);
|
342 |
}
|
@@ -364,7 +364,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
364 |
array(
|
365 |
'name' => 'wcf-upgrade-to-pro',
|
366 |
/* translators: %s: link */
|
367 |
-
'content' => '<i>' . sprintf(
|
368 |
)
|
369 |
);
|
370 |
}
|
@@ -391,7 +391,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
391 |
array(
|
392 |
'name' => 'wcf-upgrade-to-pro',
|
393 |
/* translators: %s: link */
|
394 |
-
'content' => '<i>' . sprintf(
|
395 |
)
|
396 |
);
|
397 |
}
|
@@ -415,7 +415,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
415 |
array(
|
416 |
'name' => 'wcf-remove-product-field',
|
417 |
'value' => $options['wcf-remove-product-field'],
|
418 |
-
'after' =>
|
419 |
)
|
420 |
);
|
421 |
|
@@ -423,7 +423,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
423 |
array(
|
424 |
'name' => '',
|
425 |
/* translators: %s: link */
|
426 |
-
'content' => '<i>' . sprintf(
|
427 |
)
|
428 |
);
|
429 |
?>
|
@@ -462,9 +462,9 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
462 |
'name' => 'wcf-checkout-layout',
|
463 |
'value' => $options['wcf-checkout-layout'],
|
464 |
'options' => array(
|
465 |
-
'one-column' =>
|
466 |
-
'two-column' =>
|
467 |
-
'two-step' =>
|
468 |
),
|
469 |
'pro-options' => $layout_pro_option,
|
470 |
|
@@ -482,7 +482,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
482 |
echo wcf()->meta->get_font_family_field(
|
483 |
array(
|
484 |
'for' => 'wcf-base',
|
485 |
-
'label' =>
|
486 |
'name' => 'wcf-base-font-family',
|
487 |
'value' => $options['wcf-base-font-family'],
|
488 |
)
|
@@ -517,7 +517,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
517 |
echo wcf()->meta->get_font_family_field(
|
518 |
array(
|
519 |
'for' => 'wcf-heading',
|
520 |
-
'label' =>
|
521 |
'name' => 'wcf-heading-font-family',
|
522 |
'value' => $options['wcf-heading-font-family'],
|
523 |
)
|
@@ -526,7 +526,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
526 |
echo wcf()->meta->get_font_weight_field(
|
527 |
array(
|
528 |
'for' => 'wcf-heading',
|
529 |
-
'label' =>
|
530 |
'name' => 'wcf-heading-font-weight',
|
531 |
'value' => $options['wcf-heading-font-weight'],
|
532 |
)
|
@@ -552,8 +552,8 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
552 |
'name' => 'wcf-fields-skins',
|
553 |
'value' => $options['wcf-fields-skins'],
|
554 |
'options' => array(
|
555 |
-
'default' =>
|
556 |
-
'style-one' =>
|
557 |
),
|
558 |
'pro-options' => $fields_skin_pro_option,
|
559 |
|
@@ -563,7 +563,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
563 |
echo wcf()->meta->get_font_family_field(
|
564 |
array(
|
565 |
'for' => 'wcf-input',
|
566 |
-
'label' =>
|
567 |
'name' => 'wcf-input-font-family',
|
568 |
'value' => $options['wcf-input-font-family'],
|
569 |
)
|
@@ -572,7 +572,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
572 |
echo wcf()->meta->get_font_weight_field(
|
573 |
array(
|
574 |
'for' => 'wcf-input',
|
575 |
-
'label' =>
|
576 |
'name' => 'wcf-input-font-weight',
|
577 |
'value' => $options['wcf-input-font-weight'],
|
578 |
)
|
@@ -584,12 +584,12 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
584 |
'name' => 'wcf-input-field-size',
|
585 |
'value' => $options['wcf-input-field-size'],
|
586 |
'options' => array(
|
587 |
-
'33px' =>
|
588 |
-
'38px' =>
|
589 |
-
'44px' =>
|
590 |
-
'58px' =>
|
591 |
-
'68px' =>
|
592 |
-
'custom' =>
|
593 |
),
|
594 |
)
|
595 |
);
|
@@ -655,7 +655,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
655 |
echo wcf()->meta->get_font_family_field(
|
656 |
array(
|
657 |
'for' => 'wcf-button',
|
658 |
-
'label' =>
|
659 |
'name' => 'wcf-button-font-family',
|
660 |
'value' => $options['wcf-button-font-family'],
|
661 |
)
|
@@ -664,7 +664,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
664 |
echo wcf()->meta->get_font_weight_field(
|
665 |
array(
|
666 |
'for' => 'wcf-button',
|
667 |
-
'label' =>
|
668 |
'name' => 'wcf-button-font-weight',
|
669 |
'value' => $options['wcf-button-font-weight'],
|
670 |
)
|
@@ -676,12 +676,12 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
676 |
'name' => 'wcf-input-button-size',
|
677 |
'value' => $options['wcf-input-button-size'],
|
678 |
'options' => array(
|
679 |
-
'33px' =>
|
680 |
-
'38px' =>
|
681 |
-
'44px' =>
|
682 |
-
'58px' =>
|
683 |
-
'68px' =>
|
684 |
-
'custom' =>
|
685 |
),
|
686 |
)
|
687 |
);
|
@@ -802,7 +802,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
802 |
array(
|
803 |
'name' => 'wcf-header-logo-image',
|
804 |
'value' => $options['wcf-header-logo-image'],
|
805 |
-
'label' =>
|
806 |
)
|
807 |
);
|
808 |
|
@@ -810,7 +810,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
810 |
array(
|
811 |
'name' => 'wcf-header-logo-width',
|
812 |
'value' => $options['wcf-header-logo-width'],
|
813 |
-
'label' =>
|
814 |
)
|
815 |
);
|
816 |
?>
|
@@ -850,7 +850,7 @@ class Cartflows_Checkout_Meta extends Cartflows_Meta {
|
|
850 |
$is_autosave = wp_is_post_autosave( $post_id );
|
851 |
$is_revision = wp_is_post_revision( $post_id );
|
852 |
|
853 |
-
$is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce-checkout-step-meta'] ), 'save-nonce-checkout-step-meta' ) ) ? true : false;
|
854 |
|
855 |
// Exits script depending on save status.
|
856 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
263 |
'label' => 'Checkout Page',
|
264 |
'name' => 'wcf-checkout-shortcode',
|
265 |
'content' => '[cartflows_checkout]',
|
266 |
+
'help' => esc_html__( 'Add this shortcode to your checkout page', 'cartflows' ),
|
267 |
)
|
268 |
);
|
269 |
?>
|
299 |
array(
|
300 |
'name' => 'wcf-upgrade-to-pro',
|
301 |
/* translators: %s: link */
|
302 |
+
'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Pre-applied Coupon, Product Variations & Quantity Options.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
|
303 |
)
|
304 |
);
|
305 |
}
|
326 |
array(
|
327 |
'name' => 'wcf-upgrade-to-pro',
|
328 |
/* translators: %s: link */
|
329 |
+
'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
|
330 |
)
|
331 |
);
|
332 |
} elseif ( _is_cartflows_pro_ver_less_than( '1.2.0' ) ) {
|
336 |
array(
|
337 |
'name' => 'wcf-upgrade-to-pro',
|
338 |
/* translators: %s: link */
|
339 |
+
'content' => '<i>' . sprintf( esc_html__( 'Update to %1$sCartFlows Pro%2$s to %3$s or above for Checkout Offer feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>', $version ) . '</i>',
|
340 |
)
|
341 |
);
|
342 |
}
|
364 |
array(
|
365 |
'name' => 'wcf-upgrade-to-pro',
|
366 |
/* translators: %s: link */
|
367 |
+
'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Order Bump feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
|
368 |
)
|
369 |
);
|
370 |
}
|
391 |
array(
|
392 |
'name' => 'wcf-upgrade-to-pro',
|
393 |
/* translators: %s: link */
|
394 |
+
'content' => '<i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Custom Fields feature.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
|
395 |
)
|
396 |
);
|
397 |
}
|
415 |
array(
|
416 |
'name' => 'wcf-remove-product-field',
|
417 |
'value' => $options['wcf-remove-product-field'],
|
418 |
+
'after' => esc_html__( 'Enable cart editing on checkout', 'cartflows' ),
|
419 |
)
|
420 |
);
|
421 |
|
423 |
array(
|
424 |
'name' => '',
|
425 |
/* translators: %s: link */
|
426 |
+
'content' => '<i>' . sprintf( esc_html__( 'Users will able to remove products from the checkout page.', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i>',
|
427 |
)
|
428 |
);
|
429 |
?>
|
462 |
'name' => 'wcf-checkout-layout',
|
463 |
'value' => $options['wcf-checkout-layout'],
|
464 |
'options' => array(
|
465 |
+
'one-column' => esc_html__( 'One Column', 'cartflows' ),
|
466 |
+
'two-column' => esc_html__( 'Two Column', 'cartflows' ),
|
467 |
+
'two-step' => esc_html__( 'Two Step', 'cartflows' ),
|
468 |
),
|
469 |
'pro-options' => $layout_pro_option,
|
470 |
|
482 |
echo wcf()->meta->get_font_family_field(
|
483 |
array(
|
484 |
'for' => 'wcf-base',
|
485 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
486 |
'name' => 'wcf-base-font-family',
|
487 |
'value' => $options['wcf-base-font-family'],
|
488 |
)
|
517 |
echo wcf()->meta->get_font_family_field(
|
518 |
array(
|
519 |
'for' => 'wcf-heading',
|
520 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
521 |
'name' => 'wcf-heading-font-family',
|
522 |
'value' => $options['wcf-heading-font-family'],
|
523 |
)
|
526 |
echo wcf()->meta->get_font_weight_field(
|
527 |
array(
|
528 |
'for' => 'wcf-heading',
|
529 |
+
'label' => esc_html__( 'Font Weight', 'cartflows' ),
|
530 |
'name' => 'wcf-heading-font-weight',
|
531 |
'value' => $options['wcf-heading-font-weight'],
|
532 |
)
|
552 |
'name' => 'wcf-fields-skins',
|
553 |
'value' => $options['wcf-fields-skins'],
|
554 |
'options' => array(
|
555 |
+
'default' => esc_html__( 'Default', 'cartflows' ),
|
556 |
+
'style-one' => esc_html__( 'Floating Labels', 'cartflows' ),
|
557 |
),
|
558 |
'pro-options' => $fields_skin_pro_option,
|
559 |
|
563 |
echo wcf()->meta->get_font_family_field(
|
564 |
array(
|
565 |
'for' => 'wcf-input',
|
566 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
567 |
'name' => 'wcf-input-font-family',
|
568 |
'value' => $options['wcf-input-font-family'],
|
569 |
)
|
572 |
echo wcf()->meta->get_font_weight_field(
|
573 |
array(
|
574 |
'for' => 'wcf-input',
|
575 |
+
'label' => esc_html__( 'Font Weight', 'cartflows' ),
|
576 |
'name' => 'wcf-input-font-weight',
|
577 |
'value' => $options['wcf-input-font-weight'],
|
578 |
)
|
584 |
'name' => 'wcf-input-field-size',
|
585 |
'value' => $options['wcf-input-field-size'],
|
586 |
'options' => array(
|
587 |
+
'33px' => esc_html__( 'Extra Small', 'cartflows' ),
|
588 |
+
'38px' => esc_html__( 'Small', 'cartflows' ),
|
589 |
+
'44px' => esc_html__( 'Medium', 'cartflows' ),
|
590 |
+
'58px' => esc_html__( 'Large', 'cartflows' ),
|
591 |
+
'68px' => esc_html__( 'Extra Large', 'cartflows' ),
|
592 |
+
'custom' => esc_html__( 'Custom', 'cartflows' ),
|
593 |
),
|
594 |
)
|
595 |
);
|
655 |
echo wcf()->meta->get_font_family_field(
|
656 |
array(
|
657 |
'for' => 'wcf-button',
|
658 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
659 |
'name' => 'wcf-button-font-family',
|
660 |
'value' => $options['wcf-button-font-family'],
|
661 |
)
|
664 |
echo wcf()->meta->get_font_weight_field(
|
665 |
array(
|
666 |
'for' => 'wcf-button',
|
667 |
+
'label' => esc_html__( 'Font Weight', 'cartflows' ),
|
668 |
'name' => 'wcf-button-font-weight',
|
669 |
'value' => $options['wcf-button-font-weight'],
|
670 |
)
|
676 |
'name' => 'wcf-input-button-size',
|
677 |
'value' => $options['wcf-input-button-size'],
|
678 |
'options' => array(
|
679 |
+
'33px' => esc_html__( 'Extra Small', 'cartflows' ),
|
680 |
+
'38px' => esc_html__( 'Small', 'cartflows' ),
|
681 |
+
'44px' => esc_html__( 'Medium', 'cartflows' ),
|
682 |
+
'58px' => esc_html__( 'Large', 'cartflows' ),
|
683 |
+
'68px' => esc_html__( 'Extra Large', 'cartflows' ),
|
684 |
+
'custom' => esc_html__( 'Custom', 'cartflows' ),
|
685 |
),
|
686 |
)
|
687 |
);
|
802 |
array(
|
803 |
'name' => 'wcf-header-logo-image',
|
804 |
'value' => $options['wcf-header-logo-image'],
|
805 |
+
'label' => esc_html__( 'Header Logo', 'cartflows' ),
|
806 |
)
|
807 |
);
|
808 |
|
810 |
array(
|
811 |
'name' => 'wcf-header-logo-width',
|
812 |
'value' => $options['wcf-header-logo-width'],
|
813 |
+
'label' => esc_html__( 'Logo Width (In px)', 'cartflows' ),
|
814 |
)
|
815 |
);
|
816 |
?>
|
850 |
$is_autosave = wp_is_post_autosave( $post_id );
|
851 |
$is_revision = wp_is_post_revision( $post_id );
|
852 |
|
853 |
+
$is_valid_nonce = ( isset( $_POST['nonce-checkout-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-checkout-step-meta'] ) ), 'save-nonce-checkout-step-meta' ) ) ? true : false;
|
854 |
|
855 |
// Exits script depending on save status.
|
856 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
modules/checkout/templates/embed/checkout-template-simple.php
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Checkout template
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
|
9 |
-
$fields_skins = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-fields-skins' );
|
10 |
-
?>
|
11 |
-
<div id="wcf-embed-checkout-form" class="wcf-embed-checkout-form wcf-embed-checkout-form-<?php echo $checkout_layout; ?> wcf-field-<?php echo $fields_skins; ?>">
|
12 |
-
<!-- CHECKOUT SHORTCODE -->
|
13 |
-
<?php do_action( 'cartflows_add_before_main_section', $checkout_layout ); ?>
|
14 |
-
|
15 |
-
<?php
|
16 |
-
$checkout_html = do_shortcode( '[woocommerce_checkout]' );
|
17 |
-
|
18 |
-
if (
|
19 |
-
empty( $checkout_html ) ||
|
20 |
-
trim( $checkout_html ) == '<div class="woocommerce"></div>'
|
21 |
-
) {
|
22 |
-
|
23 |
-
do_action( 'cartflows_checkout_cart_empty', $checkout_id );
|
24 |
-
|
25 |
-
echo
|
26 |
-
} else {
|
27 |
-
echo $checkout_html;
|
28 |
-
}
|
29 |
-
?>
|
30 |
-
|
31 |
-
<?php do_action( 'cartflows_add_after_main_section', $arg = '' ); ?>
|
32 |
-
<!-- END CHECKOUT SHORTCODE -->
|
33 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checkout template
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$checkout_layout = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-checkout-layout' );
|
9 |
+
$fields_skins = wcf()->options->get_checkout_meta_value( $checkout_id, 'wcf-fields-skins' );
|
10 |
+
?>
|
11 |
+
<div id="wcf-embed-checkout-form" class="wcf-embed-checkout-form wcf-embed-checkout-form-<?php echo $checkout_layout; ?> wcf-field-<?php echo $fields_skins; ?>">
|
12 |
+
<!-- CHECKOUT SHORTCODE -->
|
13 |
+
<?php do_action( 'cartflows_add_before_main_section', $checkout_layout ); ?>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
$checkout_html = do_shortcode( '[woocommerce_checkout]' );
|
17 |
+
|
18 |
+
if (
|
19 |
+
empty( $checkout_html ) ||
|
20 |
+
trim( $checkout_html ) == '<div class="woocommerce"></div>'
|
21 |
+
) {
|
22 |
+
|
23 |
+
do_action( 'cartflows_checkout_cart_empty', $checkout_id );
|
24 |
+
|
25 |
+
echo esc_html__( 'Your cart is currently empty.', 'cartflows' );
|
26 |
+
} else {
|
27 |
+
echo $checkout_html;
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
|
31 |
+
<?php do_action( 'cartflows_add_after_main_section', $arg = '' ); ?>
|
32 |
+
<!-- END CHECKOUT SHORTCODE -->
|
33 |
+
</div>
|
modules/checkout/templates/wcf-template.php
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
empty( $checkout_html ) ||
|
34 |
trim( $checkout_html ) == '<div class="woocommerce"></div>'
|
35 |
) {
|
36 |
-
echo
|
37 |
} else {
|
38 |
echo $checkout_html;
|
39 |
}
|
@@ -43,11 +43,11 @@
|
|
43 |
</div>
|
44 |
|
45 |
<footer class="footer">
|
46 |
-
<p><?php
|
47 |
echo gmdate( 'Y' );
|
48 |
echo ' ' . get_bloginfo( 'name' );
|
49 |
?>
|
50 |
-
- <?php
|
51 |
</footer>
|
52 |
</div>
|
53 |
|
33 |
empty( $checkout_html ) ||
|
34 |
trim( $checkout_html ) == '<div class="woocommerce"></div>'
|
35 |
) {
|
36 |
+
echo esc_html__( 'Your cart is currently empty.', 'cartflows' );
|
37 |
} else {
|
38 |
echo $checkout_html;
|
39 |
}
|
43 |
</div>
|
44 |
|
45 |
<footer class="footer">
|
46 |
+
<p><?php esc_html_e( 'Copyright ©', 'cartflows' ); ?> <?php
|
47 |
echo gmdate( 'Y' );
|
48 |
echo ' ' . get_bloginfo( 'name' );
|
49 |
?>
|
50 |
+
- <?php esc_html_e( 'All Rights Reserved', 'cartflows' ); ?></p>
|
51 |
</footer>
|
52 |
</div>
|
53 |
|
modules/flow/classes/class-cartflows-flow-loader.php
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Flow loader
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialization
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Flow_Loader {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Initiator
|
25 |
-
*/
|
26 |
-
public static function get_instance() {
|
27 |
-
if ( ! isset( self::$instance ) ) {
|
28 |
-
self::$instance = new self();
|
29 |
-
}
|
30 |
-
return self::$instance;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*/
|
36 |
-
public function __construct() {
|
37 |
-
$this->include_files();
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Load classes.
|
42 |
-
*
|
43 |
-
* @since 1.0.0
|
44 |
-
*
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
public function include_files() {
|
48 |
-
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-post-type.php';
|
49 |
-
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-step-post-type.php';
|
50 |
-
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-step-post-meta.php';
|
51 |
-
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-shortcodes.php';
|
52 |
-
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-permalink.php';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Kicking this off by calling 'get_instance()' method
|
58 |
-
*/
|
59 |
-
Cartflows_Flow_Loader::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Flow loader
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialization
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Flow_Loader {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initiator
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( ! isset( self::$instance ) ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*/
|
36 |
+
public function __construct() {
|
37 |
+
$this->include_files();
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Load classes.
|
42 |
+
*
|
43 |
+
* @since 1.0.0
|
44 |
+
*
|
45 |
+
* @return void
|
46 |
+
*/
|
47 |
+
public function include_files() {
|
48 |
+
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-post-type.php';
|
49 |
+
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-step-post-type.php';
|
50 |
+
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-step-post-meta.php';
|
51 |
+
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-flow-shortcodes.php';
|
52 |
+
require_once CARTFLOWS_FLOW_DIR . 'classes/class-cartflows-permalink.php';
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Kicking this off by calling 'get_instance()' method
|
58 |
+
*/
|
59 |
+
Cartflows_Flow_Loader::get_instance();
|
modules/flow/classes/class-cartflows-flow-meta.php
CHANGED
@@ -81,7 +81,7 @@ class Cartflows_Flow_Meta {
|
|
81 |
<p>
|
82 |
<a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button button-primary button-hero" style="text-decoration: none;">
|
83 |
<i class="dashicons dashicons-arrow-left-alt"></i>
|
84 |
-
<?php
|
85 |
</a>
|
86 |
</p>
|
87 |
</div>
|
@@ -537,8 +537,8 @@ class Cartflows_Flow_Meta {
|
|
537 |
|
538 |
echo '<div>';
|
539 |
/* translators: %s: link */
|
540 |
-
echo '<p><i>' . sprintf(
|
541 |
-
echo '<p><a target="_blank" href="https://cartflows.com/" class="button button-primary">' .
|
542 |
echo '</div>';
|
543 |
|
544 |
}
|
@@ -640,14 +640,14 @@ class Cartflows_Flow_Meta {
|
|
640 |
array(
|
641 |
'name' => 'wcf-testing',
|
642 |
'value' => $options['wcf-testing'],
|
643 |
-
'after' =>
|
644 |
)
|
645 |
);
|
646 |
|
647 |
echo wcf()->meta->get_description_field(
|
648 |
array(
|
649 |
'name' => 'wcf-testing-note',
|
650 |
-
'content' =>
|
651 |
)
|
652 |
);
|
653 |
|
@@ -725,7 +725,7 @@ class Cartflows_Flow_Meta {
|
|
725 |
$is_autosave = wp_is_post_autosave( $post_id );
|
726 |
$is_revision = wp_is_post_revision( $post_id );
|
727 |
|
728 |
-
$is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce-flow-meta'] ), 'save-nonce-flow-meta' ) ) ? true : false;
|
729 |
|
730 |
// Exits script depending on save status.
|
731 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
81 |
<p>
|
82 |
<a href="<?php echo esc_url( get_edit_post_link( $flow_id ) ); ?>" class="button button-primary button-hero" style="text-decoration: none;">
|
83 |
<i class="dashicons dashicons-arrow-left-alt"></i>
|
84 |
+
<?php esc_html_e( 'Back to edit Flow', 'cartflows' ); ?>
|
85 |
</a>
|
86 |
</p>
|
87 |
</div>
|
537 |
|
538 |
echo '<div>';
|
539 |
/* translators: %s: link */
|
540 |
+
echo '<p><i>' . sprintf( esc_html__( 'Upgrade to %1$sCartFlows Pro%2$s for Analytics feature', 'cartflows' ), '<a href="https://cartflows.com/" target="_blank">', '</a>' ) . '</i></p>';
|
541 |
+
echo '<p><a target="_blank" href="https://cartflows.com/" class="button button-primary">' . esc_html__( 'Get Pro', 'cartflows' ) . '</a></p>';
|
542 |
echo '</div>';
|
543 |
|
544 |
}
|
640 |
array(
|
641 |
'name' => 'wcf-testing',
|
642 |
'value' => $options['wcf-testing'],
|
643 |
+
'after' => esc_html__( 'Enable Test Mode', 'cartflows' ),
|
644 |
)
|
645 |
);
|
646 |
|
647 |
echo wcf()->meta->get_description_field(
|
648 |
array(
|
649 |
'name' => 'wcf-testing-note',
|
650 |
+
'content' => esc_html__( 'If you are using WooCommerce plugin then test mode will add random products in your flow, so you can preview it easily while testing.', 'cartflows' ),
|
651 |
)
|
652 |
);
|
653 |
|
725 |
$is_autosave = wp_is_post_autosave( $post_id );
|
726 |
$is_revision = wp_is_post_revision( $post_id );
|
727 |
|
728 |
+
$is_valid_nonce = ( isset( $_POST['nonce-flow-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-flow-meta'] ) ), 'save-nonce-flow-meta' ) ) ? true : false;
|
729 |
|
730 |
// Exits script depending on save status.
|
731 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
modules/flow/classes/class-cartflows-flow-post-type.php
CHANGED
@@ -1,334 +1,334 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Flow post type
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialization
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Flow_Post_Type {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Initiator
|
25 |
-
*/
|
26 |
-
public static function get_instance() {
|
27 |
-
if ( ! isset( self::$instance ) ) {
|
28 |
-
self::$instance = new self();
|
29 |
-
}
|
30 |
-
return self::$instance;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*/
|
36 |
-
public function __construct() {
|
37 |
-
|
38 |
-
add_action( 'init', array( $this, 'flow_post_type' ) );
|
39 |
-
add_action( 'admin_menu', array( $this, 'register_as_submenu' ), 100 );
|
40 |
-
add_action( 'do_meta_boxes', array( $this, 'wcf_change_metabox_position' ) );
|
41 |
-
|
42 |
-
add_filter( 'post_updated_messages', array( $this, 'custom_post_type_post_update_messages' ) );
|
43 |
-
|
44 |
-
add_filter( 'display_post_states', array( $this, 'add_cartflows_post_state' ), 15, 1 );
|
45 |
-
|
46 |
-
add_filter( 'hidden_meta_boxes', array( $this, 'display_flow_slug_meta_box' ), 10, 2 );
|
47 |
-
|
48 |
-
/* View Post URL */
|
49 |
-
add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
|
50 |
-
add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 10, 2 );
|
51 |
-
add_action( 'template_redirect', array( $this, 'redirect_to_step' ), 10 );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Add CartFlows post status.
|
56 |
-
*
|
57 |
-
* @param array $post_states post data.
|
58 |
-
* @return array
|
59 |
-
*/
|
60 |
-
public function add_cartflows_post_state( $post_states ) {
|
61 |
-
|
62 |
-
if ( isset( $_GET['post_type'] ) && CARTFLOWS_STEP_POST_TYPE == $_GET['post_type'] ) {
|
63 |
-
|
64 |
-
global $post;
|
65 |
-
|
66 |
-
$flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
|
67 |
-
$flow_title = get_the_title( $flow_id );
|
68 |
-
|
69 |
-
$post_states['cartflows_step'] = '( ' . __( 'Flow: ', 'cartflows' ) . $flow_id . ' | ' . __( 'Name: ', 'cartflows' ) . $flow_title . ')';
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
return $post_states;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Display slugdiv.
|
78 |
-
*
|
79 |
-
* @param array $hidden metaboxes.
|
80 |
-
* @param obj $screen screen.
|
81 |
-
* @return array
|
82 |
-
*/
|
83 |
-
public function display_flow_slug_meta_box( $hidden, $screen ) {
|
84 |
-
$post_type = $screen->id;
|
85 |
-
if ( ! empty( $post_type ) && CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
|
86 |
-
$pos = array_search( 'slugdiv', $hidden, true );
|
87 |
-
unset( $hidden[ $pos ] );
|
88 |
-
}
|
89 |
-
|
90 |
-
return $hidden;
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Create custom post type
|
95 |
-
*/
|
96 |
-
public function flow_post_type() {
|
97 |
-
|
98 |
-
$labels = array(
|
99 |
-
'name' => esc_html_x( 'Flows', 'flow general name', 'cartflows' ),
|
100 |
-
'singular_name' => esc_html_x( 'Flow', 'flow singular name', 'cartflows' ),
|
101 |
-
'search_items' => esc_html__( 'Search Flows', 'cartflows' ),
|
102 |
-
'all_items' => esc_html__( 'All Flows', 'cartflows' ),
|
103 |
-
'edit_item' => esc_html__( 'Edit Flow', 'cartflows' ),
|
104 |
-
'view_item' => esc_html__( 'View Flow', 'cartflows' ),
|
105 |
-
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
106 |
-
'update_item' => esc_html__( 'Update Flow', 'cartflows' ),
|
107 |
-
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
108 |
-
'new_item_name' => esc_html__( 'New Flow Name', 'cartflows' ),
|
109 |
-
);
|
110 |
-
|
111 |
-
$args = array(
|
112 |
-
'labels' => $labels,
|
113 |
-
'show_in_menu' => false,
|
114 |
-
'public' => false, // it's not public, not own permalink.
|
115 |
-
'publicly_queryable' => true, // you should be able to query it.
|
116 |
-
'show_ui' => true,
|
117 |
-
'query_var' => true,
|
118 |
-
'can_export' => true,
|
119 |
-
'show_in_admin_bar' => true,
|
120 |
-
'exclude_from_search' => true,
|
121 |
-
'has_archive' => false, // it shouldn't have archive page.
|
122 |
-
'rewrite' => false, // it shouldn't have rewrite rules.
|
123 |
-
'supports' => array( 'title', 'thumbnail', 'slug' ),
|
124 |
-
'capability_type' => 'post',
|
125 |
-
);
|
126 |
-
|
127 |
-
if ( false && ! _is_cartflows_pro() ) {
|
128 |
-
|
129 |
-
$flow_posts = get_posts(
|
130 |
-
array(
|
131 |
-
'posts_per_page' => 4,
|
132 |
-
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
133 |
-
'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
|
134 |
-
)
|
135 |
-
);
|
136 |
-
|
137 |
-
if ( is_array( $flow_posts ) ) {
|
138 |
-
|
139 |
-
$flow_count = count( $flow_posts );
|
140 |
-
|
141 |
-
if ( $flow_count > 3 || 3 === $flow_count ) {
|
142 |
-
|
143 |
-
$args['capabilities'] = array(
|
144 |
-
'create_posts' => 'do_not_allow',
|
145 |
-
);
|
146 |
-
$args['map_meta_cap'] = true;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
register_post_type( CARTFLOWS_FLOW_POST_TYPE, $args );
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Change metabox position.
|
156 |
-
*/
|
157 |
-
public function wcf_change_metabox_position() {
|
158 |
-
|
159 |
-
remove_meta_box( 'slugdiv', CARTFLOWS_FLOW_POST_TYPE, 'normal' );
|
160 |
-
add_meta_box( 'slugdiv', __( 'Slug', 'cartflows' ), 'post_slug_meta_box', CARTFLOWS_FLOW_POST_TYPE, 'side', 'high' );
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Add post raw actions
|
165 |
-
*
|
166 |
-
* @param array $actions actions.
|
167 |
-
* @param array $post post data.
|
168 |
-
* @return array
|
169 |
-
*/
|
170 |
-
public function post_row_actions( $actions, $post ) {
|
171 |
-
|
172 |
-
$first_step = $this->get_first_step_url( $post );
|
173 |
-
|
174 |
-
if ( $first_step && isset( $actions['view'] ) ) {
|
175 |
-
|
176 |
-
$actions['view'] = '<a href="' . $first_step . '">' . __( 'View', 'cartflows' ) . '</a>';
|
177 |
-
}
|
178 |
-
|
179 |
-
return $actions;
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Returns previous post link
|
184 |
-
*
|
185 |
-
* @param string $prev_link previous link.
|
186 |
-
* @param array $post post data.
|
187 |
-
* @return string
|
188 |
-
*/
|
189 |
-
public function preview_post_link( $prev_link, $post ) {
|
190 |
-
|
191 |
-
if ( $this->is_flow_post_type( $post ) ) {
|
192 |
-
|
193 |
-
$first_step = $this->get_first_step_url( $post );
|
194 |
-
|
195 |
-
if ( $first_step ) {
|
196 |
-
|
197 |
-
return $first_step;
|
198 |
-
}
|
199 |
-
|
200 |
-
return '';
|
201 |
-
}
|
202 |
-
|
203 |
-
return $prev_link;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Check if post type is flow
|
208 |
-
*
|
209 |
-
* @param array $post post data.
|
210 |
-
* @return bool
|
211 |
-
*/
|
212 |
-
public function is_flow_post_type( $post ) {
|
213 |
-
|
214 |
-
if ( isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
|
215 |
-
|
216 |
-
return true;
|
217 |
-
}
|
218 |
-
|
219 |
-
return false;
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Redirect to first step
|
224 |
-
*
|
225 |
-
* @return void
|
226 |
-
*/
|
227 |
-
public function redirect_to_step() {
|
228 |
-
|
229 |
-
global $post;
|
230 |
-
|
231 |
-
$first_step = $this->get_first_step_url( $post );
|
232 |
-
|
233 |
-
if ( $first_step ) {
|
234 |
-
|
235 |
-
wp_safe_redirect( $first_step );
|
236 |
-
die;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Return first step URL
|
242 |
-
*
|
243 |
-
* @param array $post post data.
|
244 |
-
* @return bool
|
245 |
-
*/
|
246 |
-
public function get_first_step_url( $post ) {
|
247 |
-
|
248 |
-
if ( $this->is_flow_post_type( $post ) ) {
|
249 |
-
|
250 |
-
$flow_id = $post->ID;
|
251 |
-
$title = $post->post_title;
|
252 |
-
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
253 |
-
|
254 |
-
if ( is_array( $steps ) && ! empty( $steps ) && isset( $steps[0]['id'] ) ) {
|
255 |
-
|
256 |
-
return get_permalink( $steps[0]['id'] );
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
return false;
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Register the admin menu for Custom Layouts
|
265 |
-
*
|
266 |
-
* @since 1.0.0
|
267 |
-
* Moved the menu under Appearance -> Custom Layouts
|
268 |
-
public function register_admin_menu() {
|
269 |
-
add_submenu_page(
|
270 |
-
CARTFLOWS_SLUG,
|
271 |
-
__( 'Flows', 'wcf' ),
|
272 |
-
__( 'Flows', 'wcf' ),
|
273 |
-
'edit_pages',
|
274 |
-
'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE
|
275 |
-
);
|
276 |
-
}
|
277 |
-
*/
|
278 |
-
public function register_as_submenu() {
|
279 |
-
|
280 |
-
global $submenu;
|
281 |
-
|
282 |
-
$submenu[ CARTFLOWS_SLUG ][0] = array( //phpcs:ignore
|
283 |
-
__( 'Flows', 'cartflows' ),
|
284 |
-
'edit_pages',
|
285 |
-
'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE,
|
286 |
-
);
|
287 |
-
}
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Add Update messages for any custom post type
|
291 |
-
*
|
292 |
-
* @param array $messages Array of default messages.
|
293 |
-
*/
|
294 |
-
public function custom_post_type_post_update_messages( $messages ) {
|
295 |
-
|
296 |
-
$custom_post_type = get_post_type( get_the_ID() );
|
297 |
-
|
298 |
-
if ( CARTFLOWS_FLOW_POST_TYPE == $custom_post_type ) {
|
299 |
-
|
300 |
-
$obj = get_post_type_object( $custom_post_type );
|
301 |
-
$singular_name = $obj->labels->singular_name;
|
302 |
-
$messages[ $custom_post_type ] = array(
|
303 |
-
0 => '', // Unused. Messages start at index 1.
|
304 |
-
/* translators: %s: singular custom post type name */
|
305 |
-
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
306 |
-
/* translators: %s: singular custom post type name */
|
307 |
-
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
308 |
-
/* translators: %s: singular custom post type name */
|
309 |
-
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
310 |
-
/* translators: %s: singular custom post type name */
|
311 |
-
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
312 |
-
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
313 |
-
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,
|
314 |
-
/* translators: %s: singular custom post type name */
|
315 |
-
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
316 |
-
/* translators: %s: singular custom post type name */
|
317 |
-
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
318 |
-
/* translators: %s: singular custom post type name */
|
319 |
-
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
320 |
-
/* translators: %s: singular custom post type name */
|
321 |
-
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
322 |
-
/* translators: %s: singular custom post type name */
|
323 |
-
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
324 |
-
);
|
325 |
-
}
|
326 |
-
|
327 |
-
return $messages;
|
328 |
-
}
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Kicking this off by calling 'get_instance()' method
|
333 |
-
*/
|
334 |
-
Cartflows_Flow_Post_Type::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Flow post type
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialization
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Flow_Post_Type {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initiator
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( ! isset( self::$instance ) ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*/
|
36 |
+
public function __construct() {
|
37 |
+
|
38 |
+
add_action( 'init', array( $this, 'flow_post_type' ) );
|
39 |
+
add_action( 'admin_menu', array( $this, 'register_as_submenu' ), 100 );
|
40 |
+
add_action( 'do_meta_boxes', array( $this, 'wcf_change_metabox_position' ) );
|
41 |
+
|
42 |
+
add_filter( 'post_updated_messages', array( $this, 'custom_post_type_post_update_messages' ) );
|
43 |
+
|
44 |
+
add_filter( 'display_post_states', array( $this, 'add_cartflows_post_state' ), 15, 1 );
|
45 |
+
|
46 |
+
add_filter( 'hidden_meta_boxes', array( $this, 'display_flow_slug_meta_box' ), 10, 2 );
|
47 |
+
|
48 |
+
/* View Post URL */
|
49 |
+
add_filter( 'post_row_actions', array( $this, 'post_row_actions' ), 10, 2 );
|
50 |
+
add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 10, 2 );
|
51 |
+
add_action( 'template_redirect', array( $this, 'redirect_to_step' ), 10 );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Add CartFlows post status.
|
56 |
+
*
|
57 |
+
* @param array $post_states post data.
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
public function add_cartflows_post_state( $post_states ) {
|
61 |
+
|
62 |
+
if ( isset( $_GET['post_type'] ) && CARTFLOWS_STEP_POST_TYPE == $_GET['post_type'] ) {
|
63 |
+
|
64 |
+
global $post;
|
65 |
+
|
66 |
+
$flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
|
67 |
+
$flow_title = get_the_title( $flow_id );
|
68 |
+
|
69 |
+
$post_states['cartflows_step'] = '( ' . __( 'Flow: ', 'cartflows' ) . $flow_id . ' | ' . __( 'Name: ', 'cartflows' ) . $flow_title . ')';
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
return $post_states;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Display slugdiv.
|
78 |
+
*
|
79 |
+
* @param array $hidden metaboxes.
|
80 |
+
* @param obj $screen screen.
|
81 |
+
* @return array
|
82 |
+
*/
|
83 |
+
public function display_flow_slug_meta_box( $hidden, $screen ) {
|
84 |
+
$post_type = $screen->id;
|
85 |
+
if ( ! empty( $post_type ) && CARTFLOWS_FLOW_POST_TYPE === $post_type ) {
|
86 |
+
$pos = array_search( 'slugdiv', $hidden, true );
|
87 |
+
unset( $hidden[ $pos ] );
|
88 |
+
}
|
89 |
+
|
90 |
+
return $hidden;
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Create custom post type
|
95 |
+
*/
|
96 |
+
public function flow_post_type() {
|
97 |
+
|
98 |
+
$labels = array(
|
99 |
+
'name' => esc_html_x( 'Flows', 'flow general name', 'cartflows' ),
|
100 |
+
'singular_name' => esc_html_x( 'Flow', 'flow singular name', 'cartflows' ),
|
101 |
+
'search_items' => esc_html__( 'Search Flows', 'cartflows' ),
|
102 |
+
'all_items' => esc_html__( 'All Flows', 'cartflows' ),
|
103 |
+
'edit_item' => esc_html__( 'Edit Flow', 'cartflows' ),
|
104 |
+
'view_item' => esc_html__( 'View Flow', 'cartflows' ),
|
105 |
+
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
106 |
+
'update_item' => esc_html__( 'Update Flow', 'cartflows' ),
|
107 |
+
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
108 |
+
'new_item_name' => esc_html__( 'New Flow Name', 'cartflows' ),
|
109 |
+
);
|
110 |
+
|
111 |
+
$args = array(
|
112 |
+
'labels' => $labels,
|
113 |
+
'show_in_menu' => false,
|
114 |
+
'public' => false, // it's not public, not own permalink.
|
115 |
+
'publicly_queryable' => true, // you should be able to query it.
|
116 |
+
'show_ui' => true,
|
117 |
+
'query_var' => true,
|
118 |
+
'can_export' => true,
|
119 |
+
'show_in_admin_bar' => true,
|
120 |
+
'exclude_from_search' => true,
|
121 |
+
'has_archive' => false, // it shouldn't have archive page.
|
122 |
+
'rewrite' => false, // it shouldn't have rewrite rules.
|
123 |
+
'supports' => array( 'title', 'thumbnail', 'slug' ),
|
124 |
+
'capability_type' => 'post',
|
125 |
+
);
|
126 |
+
|
127 |
+
if ( false && ! _is_cartflows_pro() ) {
|
128 |
+
|
129 |
+
$flow_posts = get_posts(
|
130 |
+
array(
|
131 |
+
'posts_per_page' => 4,
|
132 |
+
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
|
133 |
+
'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
|
134 |
+
)
|
135 |
+
);
|
136 |
+
|
137 |
+
if ( is_array( $flow_posts ) ) {
|
138 |
+
|
139 |
+
$flow_count = count( $flow_posts );
|
140 |
+
|
141 |
+
if ( $flow_count > 3 || 3 === $flow_count ) {
|
142 |
+
|
143 |
+
$args['capabilities'] = array(
|
144 |
+
'create_posts' => 'do_not_allow',
|
145 |
+
);
|
146 |
+
$args['map_meta_cap'] = true;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
register_post_type( CARTFLOWS_FLOW_POST_TYPE, $args );
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Change metabox position.
|
156 |
+
*/
|
157 |
+
public function wcf_change_metabox_position() {
|
158 |
+
|
159 |
+
remove_meta_box( 'slugdiv', CARTFLOWS_FLOW_POST_TYPE, 'normal' );
|
160 |
+
add_meta_box( 'slugdiv', __( 'Slug', 'cartflows' ), 'post_slug_meta_box', CARTFLOWS_FLOW_POST_TYPE, 'side', 'high' );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Add post raw actions
|
165 |
+
*
|
166 |
+
* @param array $actions actions.
|
167 |
+
* @param array $post post data.
|
168 |
+
* @return array
|
169 |
+
*/
|
170 |
+
public function post_row_actions( $actions, $post ) {
|
171 |
+
|
172 |
+
$first_step = $this->get_first_step_url( $post );
|
173 |
+
|
174 |
+
if ( $first_step && isset( $actions['view'] ) ) {
|
175 |
+
|
176 |
+
$actions['view'] = '<a href="' . $first_step . '">' . __( 'View', 'cartflows' ) . '</a>';
|
177 |
+
}
|
178 |
+
|
179 |
+
return $actions;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Returns previous post link
|
184 |
+
*
|
185 |
+
* @param string $prev_link previous link.
|
186 |
+
* @param array $post post data.
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
public function preview_post_link( $prev_link, $post ) {
|
190 |
+
|
191 |
+
if ( $this->is_flow_post_type( $post ) ) {
|
192 |
+
|
193 |
+
$first_step = $this->get_first_step_url( $post );
|
194 |
+
|
195 |
+
if ( $first_step ) {
|
196 |
+
|
197 |
+
return $first_step;
|
198 |
+
}
|
199 |
+
|
200 |
+
return '';
|
201 |
+
}
|
202 |
+
|
203 |
+
return $prev_link;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Check if post type is flow
|
208 |
+
*
|
209 |
+
* @param array $post post data.
|
210 |
+
* @return bool
|
211 |
+
*/
|
212 |
+
public function is_flow_post_type( $post ) {
|
213 |
+
|
214 |
+
if ( isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
|
215 |
+
|
216 |
+
return true;
|
217 |
+
}
|
218 |
+
|
219 |
+
return false;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Redirect to first step
|
224 |
+
*
|
225 |
+
* @return void
|
226 |
+
*/
|
227 |
+
public function redirect_to_step() {
|
228 |
+
|
229 |
+
global $post;
|
230 |
+
|
231 |
+
$first_step = $this->get_first_step_url( $post );
|
232 |
+
|
233 |
+
if ( $first_step ) {
|
234 |
+
|
235 |
+
wp_safe_redirect( $first_step );
|
236 |
+
die;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Return first step URL
|
242 |
+
*
|
243 |
+
* @param array $post post data.
|
244 |
+
* @return bool
|
245 |
+
*/
|
246 |
+
public function get_first_step_url( $post ) {
|
247 |
+
|
248 |
+
if ( $this->is_flow_post_type( $post ) ) {
|
249 |
+
|
250 |
+
$flow_id = $post->ID;
|
251 |
+
$title = $post->post_title;
|
252 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
253 |
+
|
254 |
+
if ( is_array( $steps ) && ! empty( $steps ) && isset( $steps[0]['id'] ) ) {
|
255 |
+
|
256 |
+
return get_permalink( $steps[0]['id'] );
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
return false;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Register the admin menu for Custom Layouts
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
* Moved the menu under Appearance -> Custom Layouts
|
268 |
+
public function register_admin_menu() {
|
269 |
+
add_submenu_page(
|
270 |
+
CARTFLOWS_SLUG,
|
271 |
+
__( 'Flows', 'wcf' ),
|
272 |
+
__( 'Flows', 'wcf' ),
|
273 |
+
'edit_pages',
|
274 |
+
'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE
|
275 |
+
);
|
276 |
+
}
|
277 |
+
*/
|
278 |
+
public function register_as_submenu() {
|
279 |
+
|
280 |
+
global $submenu;
|
281 |
+
|
282 |
+
$submenu[ CARTFLOWS_SLUG ][0] = array( //phpcs:ignore
|
283 |
+
__( 'Flows', 'cartflows' ),
|
284 |
+
'edit_pages',
|
285 |
+
'edit.php?post_type=' . CARTFLOWS_FLOW_POST_TYPE,
|
286 |
+
);
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Add Update messages for any custom post type
|
291 |
+
*
|
292 |
+
* @param array $messages Array of default messages.
|
293 |
+
*/
|
294 |
+
public function custom_post_type_post_update_messages( $messages ) {
|
295 |
+
|
296 |
+
$custom_post_type = get_post_type( get_the_ID() );
|
297 |
+
|
298 |
+
if ( CARTFLOWS_FLOW_POST_TYPE == $custom_post_type ) {
|
299 |
+
|
300 |
+
$obj = get_post_type_object( $custom_post_type );
|
301 |
+
$singular_name = $obj->labels->singular_name;
|
302 |
+
$messages[ $custom_post_type ] = array(
|
303 |
+
0 => '', // Unused. Messages start at index 1.
|
304 |
+
/* translators: %s: singular custom post type name */
|
305 |
+
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
306 |
+
/* translators: %s: singular custom post type name */
|
307 |
+
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
308 |
+
/* translators: %s: singular custom post type name */
|
309 |
+
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
310 |
+
/* translators: %s: singular custom post type name */
|
311 |
+
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
312 |
+
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
313 |
+
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,
|
314 |
+
/* translators: %s: singular custom post type name */
|
315 |
+
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
316 |
+
/* translators: %s: singular custom post type name */
|
317 |
+
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
318 |
+
/* translators: %s: singular custom post type name */
|
319 |
+
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
320 |
+
/* translators: %s: singular custom post type name */
|
321 |
+
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
322 |
+
/* translators: %s: singular custom post type name */
|
323 |
+
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
324 |
+
);
|
325 |
+
}
|
326 |
+
|
327 |
+
return $messages;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* Kicking this off by calling 'get_instance()' method
|
333 |
+
*/
|
334 |
+
Cartflows_Flow_Post_Type::get_instance();
|
modules/flow/classes/class-cartflows-flow-shortcodes.php
CHANGED
@@ -1,173 +1,173 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Flow shortcodes
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialization
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Flow_Shortcodes {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Initiator
|
25 |
-
*/
|
26 |
-
public static function get_instance() {
|
27 |
-
if ( ! isset( self::$instance ) ) {
|
28 |
-
self::$instance = new self();
|
29 |
-
}
|
30 |
-
return self::$instance;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*/
|
36 |
-
public function __construct() {
|
37 |
-
|
38 |
-
add_shortcode( 'cartflows_next_step_link', array( $this, 'next_step_link' ) );
|
39 |
-
|
40 |
-
add_shortcode( 'cartflows_navigation', array( $this, 'navigation_shortcode' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Returns next step link
|
45 |
-
*
|
46 |
-
* @param array $atts attributes.
|
47 |
-
* @return string
|
48 |
-
*/
|
49 |
-
public function next_step_link( $atts ) {
|
50 |
-
|
51 |
-
global $post;
|
52 |
-
|
53 |
-
$output = '#';
|
54 |
-
|
55 |
-
if ( $post && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
56 |
-
|
57 |
-
$navigation = false;
|
58 |
-
|
59 |
-
$step_id = intval( $post->ID );
|
60 |
-
$flow_id = get_post_meta( $step_id, 'wcf-flow-id', true );
|
61 |
-
|
62 |
-
if ( ! $flow_id ) {
|
63 |
-
return $output;
|
64 |
-
}
|
65 |
-
|
66 |
-
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
67 |
-
|
68 |
-
if ( ! is_array( $steps ) || ( is_array( $steps ) && empty( $steps ) ) ) {
|
69 |
-
return $output;
|
70 |
-
}
|
71 |
-
|
72 |
-
foreach ( $steps as $i => $step ) {
|
73 |
-
|
74 |
-
if ( intval( $step['id'] ) === $step_id ) {
|
75 |
-
|
76 |
-
$next_i = $i + 1;
|
77 |
-
|
78 |
-
if ( isset( $steps[ $next_i ] ) ) {
|
79 |
-
$navigation = $steps[ $next_i ];
|
80 |
-
}
|
81 |
-
|
82 |
-
break;
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( $navigation && is_array( $navigation ) ) {
|
87 |
-
|
88 |
-
$output = get_permalink( $navigation['id'] );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
return $output;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Navigation shortcode callback
|
97 |
-
*
|
98 |
-
* @param array $atts attributes for shortcode.
|
99 |
-
* @return string
|
100 |
-
*/
|
101 |
-
public function navigation_shortcode( $atts ) {
|
102 |
-
$atts = shortcode_atts(
|
103 |
-
array(
|
104 |
-
'label' => '',
|
105 |
-
'icon' => '',
|
106 |
-
'icon_position' => '',
|
107 |
-
),
|
108 |
-
$atts
|
109 |
-
);
|
110 |
-
|
111 |
-
global $post;
|
112 |
-
|
113 |
-
$output = '';
|
114 |
-
|
115 |
-
if ( $post && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
116 |
-
|
117 |
-
$navigation = false;
|
118 |
-
|
119 |
-
$step_id = intval( $post->ID );
|
120 |
-
$flow_id = get_post_meta( $step_id, 'wcf-flow-id', true );
|
121 |
-
|
122 |
-
if ( ! $flow_id ) {
|
123 |
-
return $output;
|
124 |
-
}
|
125 |
-
|
126 |
-
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
127 |
-
|
128 |
-
if ( ! is_array( $steps ) || ( is_array( $steps ) && empty( $steps ) ) ) {
|
129 |
-
return $output;
|
130 |
-
}
|
131 |
-
|
132 |
-
foreach ( $steps as $i => $step ) {
|
133 |
-
|
134 |
-
if ( intval( $step['id'] ) === $step_id ) {
|
135 |
-
|
136 |
-
$next_i = $i + 1;
|
137 |
-
|
138 |
-
if ( isset( $steps[ $next_i ] ) ) {
|
139 |
-
$navigation = $steps[ $next_i ];
|
140 |
-
}
|
141 |
-
|
142 |
-
break;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
if ( $navigation && is_array( $navigation ) ) {
|
147 |
-
|
148 |
-
$label = ( '' != $atts['label'] ) ? $atts['label'] : __( 'Next Step', 'cartflows' );
|
149 |
-
$before = '';
|
150 |
-
$after = '';
|
151 |
-
|
152 |
-
if ( '' != $atts['icon'] ) {
|
153 |
-
if ( '' != $atts['icon_position'] ) {
|
154 |
-
if ( 'before' == $atts['icon_position'] ) {
|
155 |
-
$before = '<span class="wcf-nextstep-icon wcf-nextstep-icon-before"><i class="' . $atts['icon'] . '" aria-hidden="true"></i></span>';
|
156 |
-
} else {
|
157 |
-
$after = '<span class="wcf-nextstep-icon wcf-nextstep-icon-after"><i class="' . $atts['icon'] . '" aria-hidden="true"></i></span>';
|
158 |
-
}
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
$output = '<div><a target="_self" href="' . get_permalink( $navigation['id'] ) . '">' . $before . $label . $after . '</a></div>';
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
return $output;
|
167 |
-
}
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Kicking this off by calling 'get_instance()' method
|
172 |
-
*/
|
173 |
-
Cartflows_Flow_Shortcodes::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Flow shortcodes
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialization
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Flow_Shortcodes {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initiator
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( ! isset( self::$instance ) ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*/
|
36 |
+
public function __construct() {
|
37 |
+
|
38 |
+
add_shortcode( 'cartflows_next_step_link', array( $this, 'next_step_link' ) );
|
39 |
+
|
40 |
+
add_shortcode( 'cartflows_navigation', array( $this, 'navigation_shortcode' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Returns next step link
|
45 |
+
*
|
46 |
+
* @param array $atts attributes.
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function next_step_link( $atts ) {
|
50 |
+
|
51 |
+
global $post;
|
52 |
+
|
53 |
+
$output = '#';
|
54 |
+
|
55 |
+
if ( $post && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
56 |
+
|
57 |
+
$navigation = false;
|
58 |
+
|
59 |
+
$step_id = intval( $post->ID );
|
60 |
+
$flow_id = get_post_meta( $step_id, 'wcf-flow-id', true );
|
61 |
+
|
62 |
+
if ( ! $flow_id ) {
|
63 |
+
return $output;
|
64 |
+
}
|
65 |
+
|
66 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
67 |
+
|
68 |
+
if ( ! is_array( $steps ) || ( is_array( $steps ) && empty( $steps ) ) ) {
|
69 |
+
return $output;
|
70 |
+
}
|
71 |
+
|
72 |
+
foreach ( $steps as $i => $step ) {
|
73 |
+
|
74 |
+
if ( intval( $step['id'] ) === $step_id ) {
|
75 |
+
|
76 |
+
$next_i = $i + 1;
|
77 |
+
|
78 |
+
if ( isset( $steps[ $next_i ] ) ) {
|
79 |
+
$navigation = $steps[ $next_i ];
|
80 |
+
}
|
81 |
+
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( $navigation && is_array( $navigation ) ) {
|
87 |
+
|
88 |
+
$output = get_permalink( $navigation['id'] );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
return $output;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Navigation shortcode callback
|
97 |
+
*
|
98 |
+
* @param array $atts attributes for shortcode.
|
99 |
+
* @return string
|
100 |
+
*/
|
101 |
+
public function navigation_shortcode( $atts ) {
|
102 |
+
$atts = shortcode_atts(
|
103 |
+
array(
|
104 |
+
'label' => '',
|
105 |
+
'icon' => '',
|
106 |
+
'icon_position' => '',
|
107 |
+
),
|
108 |
+
$atts
|
109 |
+
);
|
110 |
+
|
111 |
+
global $post;
|
112 |
+
|
113 |
+
$output = '';
|
114 |
+
|
115 |
+
if ( $post && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
|
116 |
+
|
117 |
+
$navigation = false;
|
118 |
+
|
119 |
+
$step_id = intval( $post->ID );
|
120 |
+
$flow_id = get_post_meta( $step_id, 'wcf-flow-id', true );
|
121 |
+
|
122 |
+
if ( ! $flow_id ) {
|
123 |
+
return $output;
|
124 |
+
}
|
125 |
+
|
126 |
+
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
|
127 |
+
|
128 |
+
if ( ! is_array( $steps ) || ( is_array( $steps ) && empty( $steps ) ) ) {
|
129 |
+
return $output;
|
130 |
+
}
|
131 |
+
|
132 |
+
foreach ( $steps as $i => $step ) {
|
133 |
+
|
134 |
+
if ( intval( $step['id'] ) === $step_id ) {
|
135 |
+
|
136 |
+
$next_i = $i + 1;
|
137 |
+
|
138 |
+
if ( isset( $steps[ $next_i ] ) ) {
|
139 |
+
$navigation = $steps[ $next_i ];
|
140 |
+
}
|
141 |
+
|
142 |
+
break;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( $navigation && is_array( $navigation ) ) {
|
147 |
+
|
148 |
+
$label = ( '' != $atts['label'] ) ? $atts['label'] : __( 'Next Step', 'cartflows' );
|
149 |
+
$before = '';
|
150 |
+
$after = '';
|
151 |
+
|
152 |
+
if ( '' != $atts['icon'] ) {
|
153 |
+
if ( '' != $atts['icon_position'] ) {
|
154 |
+
if ( 'before' == $atts['icon_position'] ) {
|
155 |
+
$before = '<span class="wcf-nextstep-icon wcf-nextstep-icon-before"><i class="' . $atts['icon'] . '" aria-hidden="true"></i></span>';
|
156 |
+
} else {
|
157 |
+
$after = '<span class="wcf-nextstep-icon wcf-nextstep-icon-after"><i class="' . $atts['icon'] . '" aria-hidden="true"></i></span>';
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
$output = '<div><a target="_self" href="' . get_permalink( $navigation['id'] ) . '">' . $before . $label . $after . '</a></div>';
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
return $output;
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Kicking this off by calling 'get_instance()' method
|
172 |
+
*/
|
173 |
+
Cartflows_Flow_Shortcodes::get_instance();
|
modules/flow/classes/class-cartflows-permalink.php
CHANGED
@@ -127,7 +127,7 @@ class Cartflows_Permalink {
|
|
127 |
}
|
128 |
|
129 |
// Bail if this query doesn't match our very specific rewrite rule.
|
130 |
-
if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
|
131 |
return;
|
132 |
}
|
133 |
|
127 |
}
|
128 |
|
129 |
// Bail if this query doesn't match our very specific rewrite rule.
|
130 |
+
if ( ! isset( $query->query['thrive-variations'] ) && ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
|
131 |
return;
|
132 |
}
|
133 |
|
modules/flow/classes/class-cartflows-step-post-type.php
CHANGED
@@ -1,468 +1,468 @@
|
|
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 |
-
|
49 |
-
add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
|
50 |
-
|
51 |
-
add_filter( 'template_include', array( $this, 'load_page_template' ), 90 );
|
52 |
-
add_filter( 'template_redirect', array( $this, 'query_fix' ), 3 );
|
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 |
-
public 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 |
-
/* Remove Next / Previous Rel Link */
|
82 |
-
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
|
83 |
-
add_filter( 'next_post_rel_link', '__return_empty_string' );
|
84 |
-
add_filter( 'previous_post_rel_link', '__return_empty_string' );
|
85 |
-
|
86 |
-
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
87 |
-
|
88 |
-
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
89 |
-
|
90 |
-
$file = '';
|
91 |
-
|
92 |
-
switch ( $page_template ) {
|
93 |
-
|
94 |
-
case 'cartflows-default':
|
95 |
-
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
96 |
-
$this->body_classes[] = $page_template;
|
97 |
-
break;
|
98 |
-
case 'cartflows-canvas':
|
99 |
-
$file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
|
100 |
-
$this->body_classes[] = $page_template;
|
101 |
-
break;
|
102 |
-
default:
|
103 |
-
/**
|
104 |
-
* Remove Next/Prev Navigation
|
105 |
-
*/
|
106 |
-
add_filter( 'next_post_link', '__return_empty_string' );
|
107 |
-
add_filter( 'previous_post_link', '__return_empty_string' );
|
108 |
-
|
109 |
-
$page = locate_template( array( 'page.php' ) );
|
110 |
-
|
111 |
-
if ( ! empty( $page ) ) {
|
112 |
-
$file = $page;
|
113 |
-
}
|
114 |
-
|
115 |
-
break;
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Default:
|
119 |
-
* $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
120 |
-
* $this->body_classes[] = 'cartflows-default';
|
121 |
-
* break;
|
122 |
-
*/
|
123 |
-
}
|
124 |
-
|
125 |
-
// Just to be safe, we check if the file exist first.
|
126 |
-
if ( file_exists( $file ) ) {
|
127 |
-
|
128 |
-
/* Add Body Class */
|
129 |
-
add_filter( 'body_class', array( $this, 'body_class' ) );
|
130 |
-
|
131 |
-
return $file;
|
132 |
-
} else {
|
133 |
-
echo $file;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
return $template;
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Body classes.
|
142 |
-
*
|
143 |
-
* @since 1.0.0
|
144 |
-
* @param array $classes Body classes.
|
145 |
-
* @return array
|
146 |
-
*/
|
147 |
-
public function body_class( $classes = array() ) {
|
148 |
-
|
149 |
-
$classes = array_merge( $classes, $this->body_classes );
|
150 |
-
|
151 |
-
return $classes;
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Create custom post type
|
156 |
-
*/
|
157 |
-
public function step_post_type() {
|
158 |
-
|
159 |
-
$labels = array(
|
160 |
-
'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
|
161 |
-
'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
|
162 |
-
'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
|
163 |
-
'all_items' => esc_html__( 'All Steps', 'cartflows' ),
|
164 |
-
'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
|
165 |
-
'view_item' => esc_html__( 'View Step', 'cartflows' ),
|
166 |
-
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
167 |
-
'update_item' => esc_html__( 'Update Step', 'cartflows' ),
|
168 |
-
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
169 |
-
'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
|
170 |
-
);
|
171 |
-
|
172 |
-
$permalink_settings = Cartflows_Helper::get_permalink_settings();
|
173 |
-
|
174 |
-
$args = array(
|
175 |
-
'labels' => $labels,
|
176 |
-
'public' => true,
|
177 |
-
'query_var' => true,
|
178 |
-
'can_export' => true,
|
179 |
-
'exclude_from_search' => true,
|
180 |
-
'show_ui' => true,
|
181 |
-
'show_in_menu' => false,
|
182 |
-
'show_in_admin_bar' => true,
|
183 |
-
'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
|
184 |
-
'capability_type' => 'post',
|
185 |
-
'capabilities' => array(
|
186 |
-
'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
|
187 |
-
),
|
188 |
-
'map_meta_cap' => true,
|
189 |
-
);
|
190 |
-
|
191 |
-
if ( isset( $permalink_settings['permalink_structure'] ) && ! empty( $permalink_settings['permalink_structure'] ) ) {
|
192 |
-
$args['rewrite'] = array(
|
193 |
-
'slug' => $permalink_settings['permalink_structure'],
|
194 |
-
'with_front' => false,
|
195 |
-
);
|
196 |
-
|
197 |
-
} elseif ( isset( $permalink_settings['permalink'] ) && ! empty( $permalink_settings['permalink'] ) ) {
|
198 |
-
|
199 |
-
$args['rewrite'] = array(
|
200 |
-
'slug' => $permalink_settings['permalink'],
|
201 |
-
'with_front' => false,
|
202 |
-
);
|
203 |
-
}
|
204 |
-
|
205 |
-
register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
|
206 |
-
|
207 |
-
// Step Type.
|
208 |
-
$args = array(
|
209 |
-
'label' => __( 'Step Type', 'cartflows' ),
|
210 |
-
'public' => false,
|
211 |
-
'rewrite' => false,
|
212 |
-
'hierarchical' => false,
|
213 |
-
);
|
214 |
-
|
215 |
-
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
|
216 |
-
|
217 |
-
// Step Flow.
|
218 |
-
$args = array(
|
219 |
-
'label' => __( 'Step Flow', 'cartflows' ),
|
220 |
-
'public' => false,
|
221 |
-
'rewrite' => false,
|
222 |
-
'hierarchical' => false,
|
223 |
-
);
|
224 |
-
|
225 |
-
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
|
226 |
-
|
227 |
-
if ( is_admin() ) {
|
228 |
-
/**
|
229 |
-
* Register 'Elementor' & 'Beaver Builder' site types.
|
230 |
-
*
|
231 |
-
* @see self::add_terms();
|
232 |
-
*/
|
233 |
-
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
234 |
-
|
235 |
-
$terms = array(
|
236 |
-
array(
|
237 |
-
'name' => __( 'Landing', 'cartflows' ),
|
238 |
-
'slug' => 'landing',
|
239 |
-
'args' => array(
|
240 |
-
'slug' => 'landing',
|
241 |
-
),
|
242 |
-
),
|
243 |
-
array(
|
244 |
-
'name' => __( 'Checkout (Woo)', 'cartflows' ),
|
245 |
-
'slug' => 'checkout',
|
246 |
-
'args' => array(
|
247 |
-
'slug' => 'checkout',
|
248 |
-
),
|
249 |
-
),
|
250 |
-
array(
|
251 |
-
'name' => __( 'Thank You (Woo)', 'cartflows' ),
|
252 |
-
'slug' => 'thankyou',
|
253 |
-
'args' => array(
|
254 |
-
'slug' => 'thankyou',
|
255 |
-
),
|
256 |
-
),
|
257 |
-
array(
|
258 |
-
'name' => __( 'Upsell (Woo)', 'cartflows' ),
|
259 |
-
'slug' => 'upsell',
|
260 |
-
'args' => array(
|
261 |
-
'slug' => 'upsell',
|
262 |
-
),
|
263 |
-
),
|
264 |
-
array(
|
265 |
-
'name' => __( 'Downsell (Woo)', 'cartflows' ),
|
266 |
-
'slug' => 'downsell',
|
267 |
-
'args' => array(
|
268 |
-
'slug' => 'downsell',
|
269 |
-
),
|
270 |
-
),
|
271 |
-
);
|
272 |
-
|
273 |
-
$this->add_terms( $taxonomy, $terms );
|
274 |
-
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Add WordPress templates.
|
280 |
-
*
|
281 |
-
* Adds Cartflows templates to steps
|
282 |
-
*
|
283 |
-
* @since 1.0.0
|
284 |
-
* @access public
|
285 |
-
*/
|
286 |
-
public function add_wp_templates_support() {
|
287 |
-
add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Add page templates.
|
292 |
-
*
|
293 |
-
* @since 1.0.0
|
294 |
-
* @access public
|
295 |
-
*
|
296 |
-
* @param array $page_templates Array of page templates.
|
297 |
-
*
|
298 |
-
* @param object $wp_theme wp theme.
|
299 |
-
* @param object $post post.
|
300 |
-
*
|
301 |
-
* @return array Page templates.
|
302 |
-
*/
|
303 |
-
public function add_page_templates( $page_templates, $wp_theme, $post ) {
|
304 |
-
|
305 |
-
$page_templates = array(
|
306 |
-
'cartflows-default' => _x( 'CartFlows — Boxed', 'cartflows' ),
|
307 |
-
'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
|
308 |
-
);
|
309 |
-
|
310 |
-
return $page_templates;
|
311 |
-
}
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Query fixe throwing error on 404 page due our post type changes.
|
317 |
-
* We are setting post_type as empty array to fix the issue.
|
318 |
-
* Ther error was throwing due to redirect_canonical function
|
319 |
-
* This fix is apply for 404 page only
|
320 |
-
*/
|
321 |
-
public function query_fix() {
|
322 |
-
|
323 |
-
global $wp_query;
|
324 |
-
|
325 |
-
if ( $wp_query->is_404() ) {
|
326 |
-
$wp_query->set( 'post_type', array() );
|
327 |
-
}
|
328 |
-
}
|
329 |
-
|
330 |
-
/**
|
331 |
-
* Prevent slug duplicated
|
332 |
-
*
|
333 |
-
* @param string $slug post slug.
|
334 |
-
* @param int $post_ID post id.
|
335 |
-
* @param string $post_status post status.
|
336 |
-
* @param string $post_type post type.
|
337 |
-
* @param int $post_parent post parent id.
|
338 |
-
* @param string $original_slug original slug.
|
339 |
-
* @return string
|
340 |
-
*/
|
341 |
-
public function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
342 |
-
|
343 |
-
$check_post_types = array(
|
344 |
-
'post',
|
345 |
-
'page',
|
346 |
-
CARTFLOWS_STEP_POST_TYPE,
|
347 |
-
);
|
348 |
-
|
349 |
-
if ( ! in_array( $post_type, $check_post_types, true ) ) {
|
350 |
-
return $slug;
|
351 |
-
}
|
352 |
-
|
353 |
-
if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
|
354 |
-
// Saving a post, check for duplicates in POST or PAGE post types.
|
355 |
-
$post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
|
356 |
-
$page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
|
357 |
-
|
358 |
-
if ( $post_match || $page_match ) {
|
359 |
-
$slug .= '-2';
|
360 |
-
}
|
361 |
-
} else {
|
362 |
-
|
363 |
-
// Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
|
364 |
-
$custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
|
365 |
-
|
366 |
-
if ( $custom_post_type_match ) {
|
367 |
-
$slug .= '-2';
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
return $slug;
|
372 |
-
}
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Add Update messages for any custom post type
|
376 |
-
*
|
377 |
-
* @param array $messages Array of default messages.
|
378 |
-
*/
|
379 |
-
public function post_update_messages( $messages ) {
|
380 |
-
|
381 |
-
$custom_post_type = get_post_type( get_the_ID() );
|
382 |
-
|
383 |
-
if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
|
384 |
-
|
385 |
-
$obj = get_post_type_object( $custom_post_type );
|
386 |
-
$singular_name = $obj->labels->singular_name;
|
387 |
-
$messages[ $custom_post_type ] = array(
|
388 |
-
0 => '', // Unused. Messages start at index 1.
|
389 |
-
/* translators: %s: singular custom post type name */
|
390 |
-
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
391 |
-
/* translators: %s: singular custom post type name */
|
392 |
-
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
393 |
-
/* translators: %s: singular custom post type name */
|
394 |
-
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
395 |
-
/* translators: %s: singular custom post type name */
|
396 |
-
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
397 |
-
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
398 |
-
5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
399 |
-
/* translators: %s: singular custom post type name */
|
400 |
-
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
401 |
-
/* translators: %s: singular custom post type name */
|
402 |
-
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
403 |
-
/* translators: %s: singular custom post type name */
|
404 |
-
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
405 |
-
/* translators: %s: singular custom post type name */
|
406 |
-
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
407 |
-
/* translators: %s: singular custom post type name */
|
408 |
-
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
409 |
-
);
|
410 |
-
}
|
411 |
-
|
412 |
-
return $messages;
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
* Add Terms for Taxonomy.
|
417 |
-
*
|
418 |
-
* => Example.
|
419 |
-
*
|
420 |
-
* $taxonomy = '{taxonomy}';
|
421 |
-
* $terms = array(
|
422 |
-
* array(
|
423 |
-
* 'name' => 'Landing',
|
424 |
-
* 'slug' => 'landing',
|
425 |
-
* ),
|
426 |
-
* array(
|
427 |
-
* 'name' => 'Checkout',
|
428 |
-
* 'slug' => 'checkout',
|
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 |
-
public function add_terms( $taxonomy = '', $terms = array() ) {
|
440 |
-
|
441 |
-
foreach ( $terms as $key => $term ) {
|
442 |
-
|
443 |
-
$term_exist = term_exists( $term['slug'], $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 |
-
|
456 |
-
$term['args'] = array( $term['slug'] );
|
457 |
-
|
458 |
-
wp_insert_term( $term['name'], $taxonomy, $term['args'] );
|
459 |
-
}
|
460 |
-
}
|
461 |
-
}
|
462 |
-
}
|
463 |
-
}
|
464 |
-
|
465 |
-
/**
|
466 |
-
* Kicking this off by calling 'get_instance()' method
|
467 |
-
*/
|
468 |
-
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 |
+
|
49 |
+
add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
|
50 |
+
|
51 |
+
add_filter( 'template_include', array( $this, 'load_page_template' ), 90 );
|
52 |
+
add_filter( 'template_redirect', array( $this, 'query_fix' ), 3 );
|
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 |
+
public 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 |
+
/* Remove Next / Previous Rel Link */
|
82 |
+
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
|
83 |
+
add_filter( 'next_post_rel_link', '__return_empty_string' );
|
84 |
+
add_filter( 'previous_post_rel_link', '__return_empty_string' );
|
85 |
+
|
86 |
+
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
|
87 |
+
|
88 |
+
$page_template = apply_filters( 'cartflows_page_template', $page_template );
|
89 |
+
|
90 |
+
$file = '';
|
91 |
+
|
92 |
+
switch ( $page_template ) {
|
93 |
+
|
94 |
+
case 'cartflows-default':
|
95 |
+
$file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
96 |
+
$this->body_classes[] = $page_template;
|
97 |
+
break;
|
98 |
+
case 'cartflows-canvas':
|
99 |
+
$file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
|
100 |
+
$this->body_classes[] = $page_template;
|
101 |
+
break;
|
102 |
+
default:
|
103 |
+
/**
|
104 |
+
* Remove Next/Prev Navigation
|
105 |
+
*/
|
106 |
+
add_filter( 'next_post_link', '__return_empty_string' );
|
107 |
+
add_filter( 'previous_post_link', '__return_empty_string' );
|
108 |
+
|
109 |
+
$page = locate_template( array( 'page.php' ) );
|
110 |
+
|
111 |
+
if ( ! empty( $page ) ) {
|
112 |
+
$file = $page;
|
113 |
+
}
|
114 |
+
|
115 |
+
break;
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Default:
|
119 |
+
* $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
|
120 |
+
* $this->body_classes[] = 'cartflows-default';
|
121 |
+
* break;
|
122 |
+
*/
|
123 |
+
}
|
124 |
+
|
125 |
+
// Just to be safe, we check if the file exist first.
|
126 |
+
if ( file_exists( $file ) ) {
|
127 |
+
|
128 |
+
/* Add Body Class */
|
129 |
+
add_filter( 'body_class', array( $this, 'body_class' ) );
|
130 |
+
|
131 |
+
return $file;
|
132 |
+
} else {
|
133 |
+
echo $file;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
return $template;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Body classes.
|
142 |
+
*
|
143 |
+
* @since 1.0.0
|
144 |
+
* @param array $classes Body classes.
|
145 |
+
* @return array
|
146 |
+
*/
|
147 |
+
public function body_class( $classes = array() ) {
|
148 |
+
|
149 |
+
$classes = array_merge( $classes, $this->body_classes );
|
150 |
+
|
151 |
+
return $classes;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Create custom post type
|
156 |
+
*/
|
157 |
+
public function step_post_type() {
|
158 |
+
|
159 |
+
$labels = array(
|
160 |
+
'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
|
161 |
+
'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
|
162 |
+
'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
|
163 |
+
'all_items' => esc_html__( 'All Steps', 'cartflows' ),
|
164 |
+
'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
|
165 |
+
'view_item' => esc_html__( 'View Step', 'cartflows' ),
|
166 |
+
'add_new' => esc_html__( 'Add New', 'cartflows' ),
|
167 |
+
'update_item' => esc_html__( 'Update Step', 'cartflows' ),
|
168 |
+
'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
|
169 |
+
'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
|
170 |
+
);
|
171 |
+
|
172 |
+
$permalink_settings = Cartflows_Helper::get_permalink_settings();
|
173 |
+
|
174 |
+
$args = array(
|
175 |
+
'labels' => $labels,
|
176 |
+
'public' => true,
|
177 |
+
'query_var' => true,
|
178 |
+
'can_export' => true,
|
179 |
+
'exclude_from_search' => true,
|
180 |
+
'show_ui' => true,
|
181 |
+
'show_in_menu' => false,
|
182 |
+
'show_in_admin_bar' => true,
|
183 |
+
'supports' => array( 'title', 'editor', 'elementor', 'revisions' ),
|
184 |
+
'capability_type' => 'post',
|
185 |
+
'capabilities' => array(
|
186 |
+
'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
|
187 |
+
),
|
188 |
+
'map_meta_cap' => true,
|
189 |
+
);
|
190 |
+
|
191 |
+
if ( isset( $permalink_settings['permalink_structure'] ) && ! empty( $permalink_settings['permalink_structure'] ) ) {
|
192 |
+
$args['rewrite'] = array(
|
193 |
+
'slug' => $permalink_settings['permalink_structure'],
|
194 |
+
'with_front' => false,
|
195 |
+
);
|
196 |
+
|
197 |
+
} elseif ( isset( $permalink_settings['permalink'] ) && ! empty( $permalink_settings['permalink'] ) ) {
|
198 |
+
|
199 |
+
$args['rewrite'] = array(
|
200 |
+
'slug' => $permalink_settings['permalink'],
|
201 |
+
'with_front' => false,
|
202 |
+
);
|
203 |
+
}
|
204 |
+
|
205 |
+
register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
|
206 |
+
|
207 |
+
// Step Type.
|
208 |
+
$args = array(
|
209 |
+
'label' => __( 'Step Type', 'cartflows' ),
|
210 |
+
'public' => false,
|
211 |
+
'rewrite' => false,
|
212 |
+
'hierarchical' => false,
|
213 |
+
);
|
214 |
+
|
215 |
+
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
|
216 |
+
|
217 |
+
// Step Flow.
|
218 |
+
$args = array(
|
219 |
+
'label' => __( 'Step Flow', 'cartflows' ),
|
220 |
+
'public' => false,
|
221 |
+
'rewrite' => false,
|
222 |
+
'hierarchical' => false,
|
223 |
+
);
|
224 |
+
|
225 |
+
register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
|
226 |
+
|
227 |
+
if ( is_admin() ) {
|
228 |
+
/**
|
229 |
+
* Register 'Elementor' & 'Beaver Builder' site types.
|
230 |
+
*
|
231 |
+
* @see self::add_terms();
|
232 |
+
*/
|
233 |
+
$taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
|
234 |
+
|
235 |
+
$terms = array(
|
236 |
+
array(
|
237 |
+
'name' => __( 'Landing', 'cartflows' ),
|
238 |
+
'slug' => 'landing',
|
239 |
+
'args' => array(
|
240 |
+
'slug' => 'landing',
|
241 |
+
),
|
242 |
+
),
|
243 |
+
array(
|
244 |
+
'name' => __( 'Checkout (Woo)', 'cartflows' ),
|
245 |
+
'slug' => 'checkout',
|
246 |
+
'args' => array(
|
247 |
+
'slug' => 'checkout',
|
248 |
+
),
|
249 |
+
),
|
250 |
+
array(
|
251 |
+
'name' => __( 'Thank You (Woo)', 'cartflows' ),
|
252 |
+
'slug' => 'thankyou',
|
253 |
+
'args' => array(
|
254 |
+
'slug' => 'thankyou',
|
255 |
+
),
|
256 |
+
),
|
257 |
+
array(
|
258 |
+
'name' => __( 'Upsell (Woo)', 'cartflows' ),
|
259 |
+
'slug' => 'upsell',
|
260 |
+
'args' => array(
|
261 |
+
'slug' => 'upsell',
|
262 |
+
),
|
263 |
+
),
|
264 |
+
array(
|
265 |
+
'name' => __( 'Downsell (Woo)', 'cartflows' ),
|
266 |
+
'slug' => 'downsell',
|
267 |
+
'args' => array(
|
268 |
+
'slug' => 'downsell',
|
269 |
+
),
|
270 |
+
),
|
271 |
+
);
|
272 |
+
|
273 |
+
$this->add_terms( $taxonomy, $terms );
|
274 |
+
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Add WordPress templates.
|
280 |
+
*
|
281 |
+
* Adds Cartflows templates to steps
|
282 |
+
*
|
283 |
+
* @since 1.0.0
|
284 |
+
* @access public
|
285 |
+
*/
|
286 |
+
public function add_wp_templates_support() {
|
287 |
+
add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Add page templates.
|
292 |
+
*
|
293 |
+
* @since 1.0.0
|
294 |
+
* @access public
|
295 |
+
*
|
296 |
+
* @param array $page_templates Array of page templates.
|
297 |
+
*
|
298 |
+
* @param object $wp_theme wp theme.
|
299 |
+
* @param object $post post.
|
300 |
+
*
|
301 |
+
* @return array Page templates.
|
302 |
+
*/
|
303 |
+
public function add_page_templates( $page_templates, $wp_theme, $post ) {
|
304 |
+
|
305 |
+
$page_templates = array(
|
306 |
+
'cartflows-default' => _x( 'CartFlows — Boxed', 'cartflows' ),
|
307 |
+
'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
|
308 |
+
);
|
309 |
+
|
310 |
+
return $page_templates;
|
311 |
+
}
|
312 |
+
|
313 |
+
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Query fixe throwing error on 404 page due our post type changes.
|
317 |
+
* We are setting post_type as empty array to fix the issue.
|
318 |
+
* Ther error was throwing due to redirect_canonical function
|
319 |
+
* This fix is apply for 404 page only
|
320 |
+
*/
|
321 |
+
public function query_fix() {
|
322 |
+
|
323 |
+
global $wp_query;
|
324 |
+
|
325 |
+
if ( $wp_query->is_404() ) {
|
326 |
+
$wp_query->set( 'post_type', array() );
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Prevent slug duplicated
|
332 |
+
*
|
333 |
+
* @param string $slug post slug.
|
334 |
+
* @param int $post_ID post id.
|
335 |
+
* @param string $post_status post status.
|
336 |
+
* @param string $post_type post type.
|
337 |
+
* @param int $post_parent post parent id.
|
338 |
+
* @param string $original_slug original slug.
|
339 |
+
* @return string
|
340 |
+
*/
|
341 |
+
public function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
342 |
+
|
343 |
+
$check_post_types = array(
|
344 |
+
'post',
|
345 |
+
'page',
|
346 |
+
CARTFLOWS_STEP_POST_TYPE,
|
347 |
+
);
|
348 |
+
|
349 |
+
if ( ! in_array( $post_type, $check_post_types, true ) ) {
|
350 |
+
return $slug;
|
351 |
+
}
|
352 |
+
|
353 |
+
if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
|
354 |
+
// Saving a post, check for duplicates in POST or PAGE post types.
|
355 |
+
$post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
|
356 |
+
$page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
|
357 |
+
|
358 |
+
if ( $post_match || $page_match ) {
|
359 |
+
$slug .= '-2';
|
360 |
+
}
|
361 |
+
} else {
|
362 |
+
|
363 |
+
// Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
|
364 |
+
$custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
|
365 |
+
|
366 |
+
if ( $custom_post_type_match ) {
|
367 |
+
$slug .= '-2';
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
return $slug;
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Add Update messages for any custom post type
|
376 |
+
*
|
377 |
+
* @param array $messages Array of default messages.
|
378 |
+
*/
|
379 |
+
public function post_update_messages( $messages ) {
|
380 |
+
|
381 |
+
$custom_post_type = get_post_type( get_the_ID() );
|
382 |
+
|
383 |
+
if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
|
384 |
+
|
385 |
+
$obj = get_post_type_object( $custom_post_type );
|
386 |
+
$singular_name = $obj->labels->singular_name;
|
387 |
+
$messages[ $custom_post_type ] = array(
|
388 |
+
0 => '', // Unused. Messages start at index 1.
|
389 |
+
/* translators: %s: singular custom post type name */
|
390 |
+
1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
391 |
+
/* translators: %s: singular custom post type name */
|
392 |
+
2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
|
393 |
+
/* translators: %s: singular custom post type name */
|
394 |
+
3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
|
395 |
+
/* translators: %s: singular custom post type name */
|
396 |
+
4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
|
397 |
+
/* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
|
398 |
+
5 => isset( $_GET['revision'] ) ? sprintf( __( '%1$s restored to revision from %2$s', 'cartflows' ), $singular_name, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
399 |
+
/* translators: %s: singular custom post type name */
|
400 |
+
6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
|
401 |
+
/* translators: %s: singular custom post type name */
|
402 |
+
7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
|
403 |
+
/* translators: %s: singular custom post type name */
|
404 |
+
8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
|
405 |
+
/* translators: %s: singular custom post type name */
|
406 |
+
9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
|
407 |
+
/* translators: %s: singular custom post type name */
|
408 |
+
10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
|
409 |
+
);
|
410 |
+
}
|
411 |
+
|
412 |
+
return $messages;
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Add Terms for Taxonomy.
|
417 |
+
*
|
418 |
+
* => Example.
|
419 |
+
*
|
420 |
+
* $taxonomy = '{taxonomy}';
|
421 |
+
* $terms = array(
|
422 |
+
* array(
|
423 |
+
* 'name' => 'Landing',
|
424 |
+
* 'slug' => 'landing',
|
425 |
+
* ),
|
426 |
+
* array(
|
427 |
+
* 'name' => 'Checkout',
|
428 |
+
* 'slug' => 'checkout',
|
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 |
+
public function add_terms( $taxonomy = '', $terms = array() ) {
|
440 |
+
|
441 |
+
foreach ( $terms as $key => $term ) {
|
442 |
+
|
443 |
+
$term_exist = term_exists( $term['slug'], $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 |
+
|
456 |
+
$term['args'] = array( $term['slug'] );
|
457 |
+
|
458 |
+
wp_insert_term( $term['name'], $taxonomy, $term['args'] );
|
459 |
+
}
|
460 |
+
}
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Kicking this off by calling 'get_instance()' method
|
467 |
+
*/
|
468 |
+
Cartflows_Step_Post_Type::get_instance();
|
modules/flow/view/meta-flow-steps.php
CHANGED
@@ -1,199 +1,199 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* View Flow steps
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
9 |
-
|
10 |
-
$steps = array(
|
11 |
-
'landing' => __( 'Landing', 'cartflows' ),
|
12 |
-
'checkout' => __( 'Checkout (Woo)', 'cartflows' ),
|
13 |
-
'thankyou' => __( 'Thank You (Woo)', 'cartflows' ),
|
14 |
-
'upsell' => __( 'Upsell (Woo)', 'cartflows' ),
|
15 |
-
'downsell' => __( 'Downsell (Woo)', 'cartflows' ),
|
16 |
-
);
|
17 |
-
|
18 |
-
?>
|
19 |
-
<div class="wcf-flow-steps-meta-box">
|
20 |
-
<div class="wcf-flow-settings">
|
21 |
-
<?php do_action( 'cartflows_above_flow_steps' ); ?>
|
22 |
-
<div class="wcf-flow-steps-wrap">
|
23 |
-
<div class="wcf-flow-steps-container">
|
24 |
-
<?php if ( is_array( $options['steps'] ) ) { ?>
|
25 |
-
<?php foreach ( $options['steps'] as $index => $data ) { ?>
|
26 |
-
<?php
|
27 |
-
$term_slug = '';
|
28 |
-
$term_name = '';
|
29 |
-
$step_wrap_class = '';
|
30 |
-
$has_product_assigned = true;
|
31 |
-
$is_global_checkout = '';
|
32 |
-
$common = '';
|
33 |
-
|
34 |
-
if ( isset( $data['type'] ) ) {
|
35 |
-
$term_slug = $data['type'];
|
36 |
-
$term_name = $steps[ $data['type'] ];
|
37 |
-
}
|
38 |
-
|
39 |
-
if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
|
40 |
-
$step_wrap_class .= ' invalid-step';
|
41 |
-
}
|
42 |
-
|
43 |
-
if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
|
44 |
-
$step_wrap_class .= ' wcf-new-step-highlight';
|
45 |
-
}
|
46 |
-
|
47 |
-
if ( 'checkout' === $term_slug ) {
|
48 |
-
|
49 |
-
$common = Cartflows_Helper::get_common_settings();
|
50 |
-
|
51 |
-
$is_global_checkout = (int) $common['global_checkout'];
|
52 |
-
|
53 |
-
if ( $data['id'] === $is_global_checkout ) {
|
54 |
-
$step_wrap_class .= ' wcf-global-checkout';
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
|
59 |
-
|
60 |
-
$has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
|
61 |
-
|
62 |
-
if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
|
63 |
-
$step_wrap_class .= ' wcf-no-product-step';
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
?>
|
68 |
-
<div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
|
69 |
-
<div class="wcf-step">
|
70 |
-
<div class="wcf-step-left-content">
|
71 |
-
<span class="dashicons dashicons-menu"></span>
|
72 |
-
<span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
|
73 |
-
<span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
|
74 |
-
|
75 |
-
<?php
|
76 |
-
if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
|
77 |
-
?>
|
78 |
-
<span class="wcf-no-product-badge"><?php
|
79 |
-
<?php
|
80 |
-
} elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
|
81 |
-
?>
|
82 |
-
<span class="wcf-global-checkout-badge"><?php
|
83 |
-
<?php
|
84 |
-
} elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
|
85 |
-
?>
|
86 |
-
<span class="wcf-global-checkout-badge"><?php
|
87 |
-
<?php
|
88 |
-
}
|
89 |
-
?>
|
90 |
-
|
91 |
-
<input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
|
92 |
-
<?php do_action( 'cartflows_step_left_content', $data['id'], $term_slug ); ?>
|
93 |
-
</div>
|
94 |
-
<div class="wcf-steps-action-buttons">
|
95 |
-
<a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo
|
96 |
-
<span class="dashicons dashicons-visibility"></span>
|
97 |
-
<span class="wcf-step-act-btn-text"><?php echo
|
98 |
-
</a>
|
99 |
-
<a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo
|
100 |
-
<span class="dashicons dashicons-edit"></span>
|
101 |
-
<span class="wcf-step-act-btn-text"><?php echo
|
102 |
-
</a>
|
103 |
-
<a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo
|
104 |
-
<span class="dashicons dashicons-admin-page"></span>
|
105 |
-
<span class="wcf-step-act-btn-text"><?php echo
|
106 |
-
</a>
|
107 |
-
<a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo
|
108 |
-
<span class="dashicons dashicons-trash"></span>
|
109 |
-
<span class="wcf-step-act-btn-text"><?php echo
|
110 |
-
</a>
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
</div><!-- .wcf-step-wrap -->
|
114 |
-
<?php } ?>
|
115 |
-
<?php } ?>
|
116 |
-
</div><!-- .wcf-flow-steps-container -->
|
117 |
-
</div> <!-- .wcf-flow-steps-wrap -->
|
118 |
-
<div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
|
119 |
-
<?php do_action( 'cartflows_bellow_flow_steps' ); ?>
|
120 |
-
<div class='wcf-add-new-step-btn-wrap'>
|
121 |
-
<button class='wcf-trigger-popup button button-primary'>
|
122 |
-
<?php echo
|
123 |
-
</button>
|
124 |
-
</div>
|
125 |
-
</div><!-- .wcf-flow-buttons-wrap -->
|
126 |
-
</div><!-- .wcf-flow-settings -->
|
127 |
-
|
128 |
-
<div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
|
129 |
-
<div class="wcf-templates-popup-content">
|
130 |
-
<div class="spinner"></div>
|
131 |
-
<div class="wcf-templates-wrap wcf-templates-wrap-flows">
|
132 |
-
|
133 |
-
<div id="wcf-remote-step-actions" class="wcf-template-header">
|
134 |
-
<div class="wcf-template-logo-wrap">
|
135 |
-
<span class="wcf-cartflows-logo-img">
|
136 |
-
<span class="cartflows-logo-icon"></span>
|
137 |
-
</span>
|
138 |
-
<span class="wcf-cartflows-title"><?php
|
139 |
-
</div>
|
140 |
-
<div class="wcf-tab-wrapper">
|
141 |
-
<?php if ( 'other' !== $default_page_builder ) { ?>
|
142 |
-
<div id="wcf-get-started-steps">
|
143 |
-
<ul class="filter-links ">
|
144 |
-
<li>
|
145 |
-
<a href="#" class="current" data-slug="ready-templates" data-title="<?php
|
146 |
-
</li>
|
147 |
-
<li>
|
148 |
-
<a href="#" data-slug="canvas" data-title="<?php
|
149 |
-
</li>
|
150 |
-
</ul>
|
151 |
-
</div>
|
152 |
-
<?php } ?>
|
153 |
-
</div>
|
154 |
-
<div class="wcf-popup-close-wrap">
|
155 |
-
<span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
|
156 |
-
</div>
|
157 |
-
</div>
|
158 |
-
|
159 |
-
<!--<div class="wcf-search-form">
|
160 |
-
<label class="screen-reader-text" for="wp-filter-search-input"><?php
|
161 |
-
<input placeholder="<?php
|
162 |
-
</div>-->
|
163 |
-
|
164 |
-
<div id="wcf-remote-content">
|
165 |
-
<?php if ( 'other' !== $default_page_builder ) { ?>
|
166 |
-
<div id="wcf-ready-templates">
|
167 |
-
<div id="wcf-remote-filters">
|
168 |
-
<div id="wcf-page-builders"></div>
|
169 |
-
<div id="wcf-categories"></div>
|
170 |
-
</div>
|
171 |
-
<div class="wcf-page-builder-notice"></div>
|
172 |
-
<div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
|
173 |
-
<div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
|
174 |
-
</div>
|
175 |
-
<?php } ?>
|
176 |
-
<div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
|
177 |
-
<div class="inner">
|
178 |
-
<div id="wcf-scratch-steps-categories">
|
179 |
-
<select class="step-type-filter-links filter-links">
|
180 |
-
<option value="" class="current"> Select Step Type </option>
|
181 |
-
|
182 |
-
<?php foreach ( $steps as $key => $value ) { ?>
|
183 |
-
<option class="<?php echo $key; ?>" data-slug="<?php echo $key; ?>" data-title="<?php echo $key; ?>"><?php echo $value; ?></option>
|
184 |
-
<?php } ?>
|
185 |
-
</select>
|
186 |
-
</div>
|
187 |
-
<a href="#" class="button button-primary cartflows-step-import-blank"><?php
|
188 |
-
<?php if ( ! _is_cartflows_pro() ) { ?>
|
189 |
-
<div class="wcf-template-notice"><p><?php echo
|
190 |
-
<?php } ?>
|
191 |
-
<p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php
|
192 |
-
</div>
|
193 |
-
</div>
|
194 |
-
</div>
|
195 |
-
</div>
|
196 |
-
</div>
|
197 |
-
</div><!-- .wcf-templates-popup-overlay -->
|
198 |
-
</div>
|
199 |
-
<?php
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* View Flow steps
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
|
9 |
+
|
10 |
+
$steps = array(
|
11 |
+
'landing' => __( 'Landing', 'cartflows' ),
|
12 |
+
'checkout' => __( 'Checkout (Woo)', 'cartflows' ),
|
13 |
+
'thankyou' => __( 'Thank You (Woo)', 'cartflows' ),
|
14 |
+
'upsell' => __( 'Upsell (Woo)', 'cartflows' ),
|
15 |
+
'downsell' => __( 'Downsell (Woo)', 'cartflows' ),
|
16 |
+
);
|
17 |
+
|
18 |
+
?>
|
19 |
+
<div class="wcf-flow-steps-meta-box">
|
20 |
+
<div class="wcf-flow-settings">
|
21 |
+
<?php do_action( 'cartflows_above_flow_steps' ); ?>
|
22 |
+
<div class="wcf-flow-steps-wrap">
|
23 |
+
<div class="wcf-flow-steps-container">
|
24 |
+
<?php if ( is_array( $options['steps'] ) ) { ?>
|
25 |
+
<?php foreach ( $options['steps'] as $index => $data ) { ?>
|
26 |
+
<?php
|
27 |
+
$term_slug = '';
|
28 |
+
$term_name = '';
|
29 |
+
$step_wrap_class = '';
|
30 |
+
$has_product_assigned = true;
|
31 |
+
$is_global_checkout = '';
|
32 |
+
$common = '';
|
33 |
+
|
34 |
+
if ( isset( $data['type'] ) ) {
|
35 |
+
$term_slug = $data['type'];
|
36 |
+
$term_name = $steps[ $data['type'] ];
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( ! _is_cartflows_pro() && ( 'upsell' === $term_slug || 'downsell' === $term_slug ) ) {
|
40 |
+
$step_wrap_class .= ' invalid-step';
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( isset( $_GET['highlight-step-id'] ) && $_GET['highlight-step-id'] == $data['id'] ) {
|
44 |
+
$step_wrap_class .= ' wcf-new-step-highlight';
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( 'checkout' === $term_slug ) {
|
48 |
+
|
49 |
+
$common = Cartflows_Helper::get_common_settings();
|
50 |
+
|
51 |
+
$is_global_checkout = (int) $common['global_checkout'];
|
52 |
+
|
53 |
+
if ( $data['id'] === $is_global_checkout ) {
|
54 |
+
$step_wrap_class .= ' wcf-global-checkout';
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( 'upsell' === $term_slug || 'downsell' === $term_slug || 'checkout' === $term_slug ) {
|
59 |
+
|
60 |
+
$has_product_assigned = Cartflows_Helper::has_product_assigned( $data['id'] );
|
61 |
+
|
62 |
+
if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
|
63 |
+
$step_wrap_class .= ' wcf-no-product-step';
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
?>
|
68 |
+
<div class="wcf-step-wrap <?php echo $step_wrap_class; ?>" data-id="<?php echo $data['id']; ?>" data-term-slug="<?php echo esc_attr( $term_slug ); ?>">
|
69 |
+
<div class="wcf-step">
|
70 |
+
<div class="wcf-step-left-content">
|
71 |
+
<span class="dashicons dashicons-menu"></span>
|
72 |
+
<span><?php echo wp_trim_words( get_the_title( $data['id'] ), 3 ); ?></span>
|
73 |
+
<span class="wcf-flow-badge"><?php echo esc_attr( $term_name ); ?></span>
|
74 |
+
|
75 |
+
<?php
|
76 |
+
if ( ( ! $has_product_assigned ) && ( $data['id'] != $is_global_checkout ) ) {
|
77 |
+
?>
|
78 |
+
<span class="wcf-no-product-badge"><?php esc_html_e( 'No Product Assigned', 'cartflows' ); ?></span>
|
79 |
+
<?php
|
80 |
+
} elseif ( ( $has_product_assigned ) && ( $data['id'] === $is_global_checkout ) ) {
|
81 |
+
?>
|
82 |
+
<span class="wcf-global-checkout-badge"><?php esc_html_e( 'Global Checkout - Remove selected checkout product', 'cartflows' ); ?></span>
|
83 |
+
<?php
|
84 |
+
} elseif ( ( ! $has_product_assigned ) && $data['id'] === $is_global_checkout ) {
|
85 |
+
?>
|
86 |
+
<span class="wcf-global-checkout-badge"><?php esc_html_e( 'Global Checkout', 'cartflows' ); ?></span>
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
?>
|
90 |
+
|
91 |
+
<input type="hidden" class="wcf-steps-hidden" name="wcf-steps[]" value="<?php echo $data['id']; ?>">
|
92 |
+
<?php do_action( 'cartflows_step_left_content', $data['id'], $term_slug ); ?>
|
93 |
+
</div>
|
94 |
+
<div class="wcf-steps-action-buttons">
|
95 |
+
<a href="<?php echo get_permalink( $data['id'] ); ?>" target="_blank" class="wcf-step-view wcf-action-button wp-ui-text-highlight" title="<?php echo esc_html__( 'View Step', 'cartflows' ); ?>" >
|
96 |
+
<span class="dashicons dashicons-visibility"></span>
|
97 |
+
<span class="wcf-step-act-btn-text"><?php echo esc_html__( 'View', 'cartflows' ); ?></span>
|
98 |
+
</a>
|
99 |
+
<a href="<?php echo get_edit_post_link( $data['id'] ); ?>" class="wcf-step-edit wcf-action-button wp-ui-text-highlight" title="<?php echo esc_html__( 'Edit Step', 'cartflows' ); ?>" >
|
100 |
+
<span class="dashicons dashicons-edit"></span>
|
101 |
+
<span class="wcf-step-act-btn-text"><?php echo esc_html__( 'Edit', 'cartflows' ); ?></span>
|
102 |
+
</a>
|
103 |
+
<a href="<?php echo wp_nonce_url( 'admin.php?action=cartflows_clone_step&post=' . $data['id'], 'step_clone', 'step_clone_nonce' ); ?>" class="wcf-step-clone wcf-action-button wp-ui-text-highlight" title="<?php echo esc_html__( 'Clone Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
|
104 |
+
<span class="dashicons dashicons-admin-page"></span>
|
105 |
+
<span class="wcf-step-act-btn-text"><?php echo esc_html__( 'Clone', 'cartflows' ); ?></span>
|
106 |
+
</a>
|
107 |
+
<a href="#" class="wcf-step-delete wcf-action-button wp-ui-text-highlight" title="<?php echo esc_html__( 'Delete Step', 'cartflows' ); ?>" data-id="<?php echo $data['id']; ?>">
|
108 |
+
<span class="dashicons dashicons-trash"></span>
|
109 |
+
<span class="wcf-step-act-btn-text"><?php echo esc_html__( 'Delete', 'cartflows' ); ?></span>
|
110 |
+
</a>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div><!-- .wcf-step-wrap -->
|
114 |
+
<?php } ?>
|
115 |
+
<?php } ?>
|
116 |
+
</div><!-- .wcf-flow-steps-container -->
|
117 |
+
</div> <!-- .wcf-flow-steps-wrap -->
|
118 |
+
<div class="wcf-flow-buttons-wrap"> <!-- .wcf-flow-buttons-wrap -->
|
119 |
+
<?php do_action( 'cartflows_bellow_flow_steps' ); ?>
|
120 |
+
<div class='wcf-add-new-step-btn-wrap'>
|
121 |
+
<button class='wcf-trigger-popup button button-primary'>
|
122 |
+
<?php echo esc_html__( 'Add New Step', 'cartflows' ); ?>
|
123 |
+
</button>
|
124 |
+
</div>
|
125 |
+
</div><!-- .wcf-flow-buttons-wrap -->
|
126 |
+
</div><!-- .wcf-flow-settings -->
|
127 |
+
|
128 |
+
<div id="wcf-remote-step-importer" class="wcf-templates-popup-overlay">
|
129 |
+
<div class="wcf-templates-popup-content">
|
130 |
+
<div class="spinner"></div>
|
131 |
+
<div class="wcf-templates-wrap wcf-templates-wrap-flows">
|
132 |
+
|
133 |
+
<div id="wcf-remote-step-actions" class="wcf-template-header">
|
134 |
+
<div class="wcf-template-logo-wrap">
|
135 |
+
<span class="wcf-cartflows-logo-img">
|
136 |
+
<span class="cartflows-logo-icon"></span>
|
137 |
+
</span>
|
138 |
+
<span class="wcf-cartflows-title"><?php esc_html_e( 'Steps Library', 'cartflows' ); ?></span>
|
139 |
+
</div>
|
140 |
+
<div class="wcf-tab-wrapper">
|
141 |
+
<?php if ( 'other' !== $default_page_builder ) { ?>
|
142 |
+
<div id="wcf-get-started-steps">
|
143 |
+
<ul class="filter-links ">
|
144 |
+
<li>
|
145 |
+
<a href="#" class="current" data-slug="ready-templates" data-title="<?php esc_html_e( 'Ready Templates', 'cartflows' ); ?>"><?php esc_html_e( 'Ready Templates', 'cartflows' ); ?></a>
|
146 |
+
</li>
|
147 |
+
<li>
|
148 |
+
<a href="#" data-slug="canvas" data-title="<?php esc_html_e( 'Create Your Own', 'cartflows' ); ?>"><?php esc_html_e( 'Create Your Own', 'cartflows' ); ?></a>
|
149 |
+
</li>
|
150 |
+
</ul>
|
151 |
+
</div>
|
152 |
+
<?php } ?>
|
153 |
+
</div>
|
154 |
+
<div class="wcf-popup-close-wrap">
|
155 |
+
<span class="close-icon"><span class="wcf-cartflow-icons dashicons dashicons-no"></span></span>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
|
159 |
+
<!--<div class="wcf-search-form">
|
160 |
+
<label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'cartflows' ); ?> </label>
|
161 |
+
<input placeholder="<?php esc_html_e( 'Search Flow...', 'cartflows' ); ?>" type="text" aria-describedby="live-search-desc" class="wcf-flow-search-input">
|
162 |
+
</div>-->
|
163 |
+
|
164 |
+
<div id="wcf-remote-content">
|
165 |
+
<?php if ( 'other' !== $default_page_builder ) { ?>
|
166 |
+
<div id="wcf-ready-templates">
|
167 |
+
<div id="wcf-remote-filters">
|
168 |
+
<div id="wcf-page-builders"></div>
|
169 |
+
<div id="wcf-categories"></div>
|
170 |
+
</div>
|
171 |
+
<div class="wcf-page-builder-notice"></div>
|
172 |
+
<div id="wcf-remote-step-list" class="wcf-remote-list wcf-template-list-wrap"><span class="spinner is-active"></span></div>
|
173 |
+
<div id="wcf-upcoming-page-builders" style="display: none;" class="wcf-remote-list wcf-template-list-wrap"></div>
|
174 |
+
</div>
|
175 |
+
<?php } ?>
|
176 |
+
<div id="wcf-start-from-scratch" style="<?php echo ( 'other' !== $default_page_builder ) ? 'display: none;' : ''; ?>">
|
177 |
+
<div class="inner">
|
178 |
+
<div id="wcf-scratch-steps-categories">
|
179 |
+
<select class="step-type-filter-links filter-links">
|
180 |
+
<option value="" class="current"> Select Step Type </option>
|
181 |
+
|
182 |
+
<?php foreach ( $steps as $key => $value ) { ?>
|
183 |
+
<option class="<?php echo $key; ?>" data-slug="<?php echo $key; ?>" data-title="<?php echo $key; ?>"><?php echo $value; ?></option>
|
184 |
+
<?php } ?>
|
185 |
+
</select>
|
186 |
+
</div>
|
187 |
+
<a href="#" class="button button-primary cartflows-step-import-blank"><?php esc_html_e( 'Create Step', 'cartflows' ); ?></a>
|
188 |
+
<?php if ( ! _is_cartflows_pro() ) { ?>
|
189 |
+
<div class="wcf-template-notice"><p><?php echo esc_html__( 'You need a Cartflows Pro version to import Upsell / Downsell', 'cartflows' ); ?></p></div>
|
190 |
+
<?php } ?>
|
191 |
+
<p class="wcf-learn-how"><a href="https://cartflows.com/docs/cartflows-step-types/" target="_blank"><?php esc_html_e( 'Learn How', 'cartflows' ); ?> <i class="dashicons dashicons-external"></i></a></p>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
</div><!-- .wcf-templates-popup-overlay -->
|
198 |
+
</div>
|
199 |
+
<?php
|
modules/landing/classes/class-cartflows-landing-markup.php
CHANGED
@@ -1,139 +1,139 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Markup
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Checkout Markup
|
10 |
-
*
|
11 |
-
* @since 1.0.0
|
12 |
-
*/
|
13 |
-
class Cartflows_Landing_Markup {
|
14 |
-
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Member Variable
|
18 |
-
*
|
19 |
-
* @var object instance
|
20 |
-
*/
|
21 |
-
private static $instance;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Initiator
|
25 |
-
*/
|
26 |
-
public static function get_instance() {
|
27 |
-
if ( ! isset( self::$instance ) ) {
|
28 |
-
self::$instance = new self();
|
29 |
-
}
|
30 |
-
return self::$instance;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Constructor
|
35 |
-
*/
|
36 |
-
public function __construct() {
|
37 |
-
|
38 |
-
add_action( 'pre_get_posts', array( $this, 'wcf_pre_get_posts' ) );
|
39 |
-
add_action( 'template_redirect', array( $this, 'template_redirect' ) );
|
40 |
-
|
41 |
-
if ( is_admin() ) {
|
42 |
-
add_filter( 'wp_dropdown_pages', array( $this, 'wp_dropdown_pages' ) );
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Add landing pages in WordPress reading section.
|
48 |
-
*
|
49 |
-
* @param array $output output.
|
50 |
-
*/
|
51 |
-
public function wp_dropdown_pages( $output ) {
|
52 |
-
|
53 |
-
global $pagenow;
|
54 |
-
|
55 |
-
if ( ( 'options-reading.php' === $pagenow || 'customize.php' === $pagenow ) && preg_match( '#page_on_front#', $output ) ) {
|
56 |
-
|
57 |
-
$args = array(
|
58 |
-
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
59 |
-
'numberposts' => 100,
|
60 |
-
'meta_query' => array( //phpcs:ignore
|
61 |
-
'relation' => 'OR',
|
62 |
-
array(
|
63 |
-
'key' => 'wcf-step-type',
|
64 |
-
'value' => 'landing',
|
65 |
-
),
|
66 |
-
array(
|
67 |
-
'key' => 'wcf-step-type',
|
68 |
-
'value' => 'checkout',
|
69 |
-
),
|
70 |
-
),
|
71 |
-
);
|
72 |
-
|
73 |
-
$landing_pages = get_posts( $args );
|
74 |
-
|
75 |
-
if ( is_array( $landing_pages ) && ! empty( $landing_pages ) ) {
|
76 |
-
|
77 |
-
$cartflows_custom_option = '';
|
78 |
-
|
79 |
-
$front_page_id = get_option( 'page_on_front' );
|
80 |
-
|
81 |
-
foreach ( $landing_pages as $key => $landing_page ) {
|
82 |
-
|
83 |
-
$selected = selected( $front_page_id, $landing_page->ID, false );
|
84 |
-
|
85 |
-
$cartflows_custom_option .= "<option value=\"{$landing_page->ID}\"{$selected}>{$landing_page->post_title} ( #{$landing_page->ID} - CartFlows )</option>";
|
86 |
-
}
|
87 |
-
|
88 |
-
$cartflows_custom_option .= '</select>';
|
89 |
-
|
90 |
-
$output = str_replace( '</select>', $cartflows_custom_option, $output );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
return $output;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Set post query.
|
99 |
-
*
|
100 |
-
* @param string $query post query.
|
101 |
-
*/
|
102 |
-
public function wcf_pre_get_posts( $query ) {
|
103 |
-
|
104 |
-
if ( $query->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
105 |
-
|
106 |
-
$post_type = $query->get( 'post_type' );
|
107 |
-
|
108 |
-
$page_id = $query->get( 'page_id' );
|
109 |
-
|
110 |
-
if ( empty( $post_type ) && ! empty( $page_id ) ) {
|
111 |
-
$query->set( 'post_type', get_post_type( $page_id ) );
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Redirect to homepage if landing page set as home page.
|
118 |
-
*/
|
119 |
-
public function template_redirect() {
|
120 |
-
|
121 |
-
$compatibiliy = Cartflows_Compatibility::get_instance();
|
122 |
-
|
123 |
-
// Do not redirect for page builder preview.
|
124 |
-
if ( $compatibiliy->is_page_builder_preview() ) {
|
125 |
-
return;
|
126 |
-
}
|
127 |
-
|
128 |
-
global $post;
|
129 |
-
|
130 |
-
if ( is_singular() && ! is_front_page() && get_option( 'page_on_front' ) == $post->ID ) {
|
131 |
-
wp_safe_redirect( site_url(), 301 );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Kicking this off by calling 'get_instance()' method
|
138 |
-
*/
|
139 |
-
Cartflows_Landing_Markup::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Markup
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Checkout Markup
|
10 |
+
*
|
11 |
+
* @since 1.0.0
|
12 |
+
*/
|
13 |
+
class Cartflows_Landing_Markup {
|
14 |
+
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Member Variable
|
18 |
+
*
|
19 |
+
* @var object instance
|
20 |
+
*/
|
21 |
+
private static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initiator
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( ! isset( self::$instance ) ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor
|
35 |
+
*/
|
36 |
+
public function __construct() {
|
37 |
+
|
38 |
+
add_action( 'pre_get_posts', array( $this, 'wcf_pre_get_posts' ) );
|
39 |
+
add_action( 'template_redirect', array( $this, 'template_redirect' ) );
|
40 |
+
|
41 |
+
if ( is_admin() ) {
|
42 |
+
add_filter( 'wp_dropdown_pages', array( $this, 'wp_dropdown_pages' ) );
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Add landing pages in WordPress reading section.
|
48 |
+
*
|
49 |
+
* @param array $output output.
|
50 |
+
*/
|
51 |
+
public function wp_dropdown_pages( $output ) {
|
52 |
+
|
53 |
+
global $pagenow;
|
54 |
+
|
55 |
+
if ( ( 'options-reading.php' === $pagenow || 'customize.php' === $pagenow ) && preg_match( '#page_on_front#', $output ) ) {
|
56 |
+
|
57 |
+
$args = array(
|
58 |
+
'post_type' => CARTFLOWS_STEP_POST_TYPE,
|
59 |
+
'numberposts' => 100,
|
60 |
+
'meta_query' => array( //phpcs:ignore
|
61 |
+
'relation' => 'OR',
|
62 |
+
array(
|
63 |
+
'key' => 'wcf-step-type',
|
64 |
+
'value' => 'landing',
|
65 |
+
),
|
66 |
+
array(
|
67 |
+
'key' => 'wcf-step-type',
|
68 |
+
'value' => 'checkout',
|
69 |
+
),
|
70 |
+
),
|
71 |
+
);
|
72 |
+
|
73 |
+
$landing_pages = get_posts( $args );
|
74 |
+
|
75 |
+
if ( is_array( $landing_pages ) && ! empty( $landing_pages ) ) {
|
76 |
+
|
77 |
+
$cartflows_custom_option = '';
|
78 |
+
|
79 |
+
$front_page_id = get_option( 'page_on_front' );
|
80 |
+
|
81 |
+
foreach ( $landing_pages as $key => $landing_page ) {
|
82 |
+
|
83 |
+
$selected = selected( $front_page_id, $landing_page->ID, false );
|
84 |
+
|
85 |
+
$cartflows_custom_option .= "<option value=\"{$landing_page->ID}\"{$selected}>{$landing_page->post_title} ( #{$landing_page->ID} - CartFlows )</option>";
|
86 |
+
}
|
87 |
+
|
88 |
+
$cartflows_custom_option .= '</select>';
|
89 |
+
|
90 |
+
$output = str_replace( '</select>', $cartflows_custom_option, $output );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
return $output;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Set post query.
|
99 |
+
*
|
100 |
+
* @param string $query post query.
|
101 |
+
*/
|
102 |
+
public function wcf_pre_get_posts( $query ) {
|
103 |
+
|
104 |
+
if ( $query->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
105 |
+
|
106 |
+
$post_type = $query->get( 'post_type' );
|
107 |
+
|
108 |
+
$page_id = $query->get( 'page_id' );
|
109 |
+
|
110 |
+
if ( empty( $post_type ) && ! empty( $page_id ) ) {
|
111 |
+
$query->set( 'post_type', get_post_type( $page_id ) );
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Redirect to homepage if landing page set as home page.
|
118 |
+
*/
|
119 |
+
public function template_redirect() {
|
120 |
+
|
121 |
+
$compatibiliy = Cartflows_Compatibility::get_instance();
|
122 |
+
|
123 |
+
// Do not redirect for page builder preview.
|
124 |
+
if ( $compatibiliy->is_page_builder_preview() ) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
+
global $post;
|
129 |
+
|
130 |
+
if ( is_singular() && ! is_front_page() && get_option( 'page_on_front' ) == $post->ID ) {
|
131 |
+
wp_safe_redirect( site_url(), 301 );
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Kicking this off by calling 'get_instance()' method
|
138 |
+
*/
|
139 |
+
Cartflows_Landing_Markup::get_instance();
|
modules/landing/classes/class-cartflows-landing-meta.php
CHANGED
@@ -218,7 +218,7 @@ class Cartflows_Landing_Meta extends Cartflows_Meta {
|
|
218 |
$is_autosave = wp_is_post_autosave( $post_id );
|
219 |
$is_revision = wp_is_post_revision( $post_id );
|
220 |
|
221 |
-
$is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce-landing-step-meta'] ), 'save-nonce-landing-step-meta' ) ) ? true : false;
|
222 |
|
223 |
// Exits script depending on save status.
|
224 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
218 |
$is_autosave = wp_is_post_autosave( $post_id );
|
219 |
$is_revision = wp_is_post_revision( $post_id );
|
220 |
|
221 |
+
$is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-landing-step-meta'] ) ), 'save-nonce-landing-step-meta' ) ) ? true : false;
|
222 |
|
223 |
// Exits script depending on save status.
|
224 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
modules/thankyou/classes/class-cartflows-thankyou-markup.php
CHANGED
@@ -96,7 +96,7 @@ class Cartflows_Thankyou_Markup {
|
|
96 |
|
97 |
// Get the order.
|
98 |
$order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) );
|
99 |
-
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) );
|
100 |
|
101 |
if ( $order_id > 0 ) {
|
102 |
$order = wc_get_order( $order_id );
|
96 |
|
97 |
// Get the order.
|
98 |
$order_id = apply_filters( 'woocommerce_thankyou_order_id', empty( $_GET['wcf-order'] ) ? 0 : intval( $_GET['wcf-order'] ) );
|
99 |
+
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['wcf-key'] ) ? '' : wc_clean( wp_unslash( $_GET['wcf-key'] ) ) ); //phpcs:ignore
|
100 |
|
101 |
if ( $order_id > 0 ) {
|
102 |
$order = wc_get_order( $order_id );
|
modules/thankyou/classes/class-cartflows-thankyou-meta.php
CHANGED
@@ -200,7 +200,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
200 |
echo wcf()->meta->get_font_family_field(
|
201 |
array(
|
202 |
'for' => 'wcf-tq-font-family',
|
203 |
-
'label' =>
|
204 |
'name' => 'wcf-tq-font-family',
|
205 |
'value' => $options['wcf-tq-font-family'],
|
206 |
)
|
@@ -223,7 +223,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
223 |
echo wcf()->meta->get_font_family_field(
|
224 |
array(
|
225 |
'for' => 'wcf-tq-heading-font-family',
|
226 |
-
'label' =>
|
227 |
'name' => 'wcf-tq-heading-font-family',
|
228 |
'value' => $options['wcf-tq-heading-font-family'],
|
229 |
)
|
@@ -232,7 +232,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
232 |
echo wcf()->meta->get_font_weight_field(
|
233 |
array(
|
234 |
'for' => 'wcf-tq-heading-font-family',
|
235 |
-
'label' =>
|
236 |
'name' => 'wcf-tq-heading-font-wt',
|
237 |
'value' => $options['wcf-tq-heading-font-wt'],
|
238 |
)
|
@@ -250,7 +250,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
250 |
echo wcf()->meta->get_number_field(
|
251 |
array(
|
252 |
'for' => 'wcf-heading',
|
253 |
-
'label' =>
|
254 |
'name' => 'wcf-tq-container-width',
|
255 |
'value' => $options['wcf-tq-container-width'],
|
256 |
)
|
@@ -272,7 +272,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
272 |
array(
|
273 |
'name' => 'wcf-show-overview-section',
|
274 |
'value' => $options['wcf-show-overview-section'],
|
275 |
-
'after' =>
|
276 |
)
|
277 |
);
|
278 |
|
@@ -280,7 +280,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
280 |
array(
|
281 |
'name' => 'wcf-show-details-section',
|
282 |
'value' => $options['wcf-show-details-section'],
|
283 |
-
'after' =>
|
284 |
)
|
285 |
);
|
286 |
|
@@ -288,7 +288,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
288 |
array(
|
289 |
'name' => 'wcf-show-billing-section',
|
290 |
'value' => $options['wcf-show-billing-section'],
|
291 |
-
'after' =>
|
292 |
)
|
293 |
);
|
294 |
|
@@ -296,7 +296,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
296 |
array(
|
297 |
'name' => 'wcf-show-shipping-section',
|
298 |
'value' => $options['wcf-show-shipping-section'],
|
299 |
-
'after' =>
|
300 |
)
|
301 |
);
|
302 |
|
@@ -354,7 +354,7 @@ class Cartflows_Thankyou_Meta extends Cartflows_Meta {
|
|
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( wp_unslash( $_POST['nonce-thankyou-step-meta'] ), 'save-nonce-thankyou-step-meta' ) ) ? true : false;
|
358 |
|
359 |
// Exits script depending on save status.
|
360 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
200 |
echo wcf()->meta->get_font_family_field(
|
201 |
array(
|
202 |
'for' => 'wcf-tq-font-family',
|
203 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
204 |
'name' => 'wcf-tq-font-family',
|
205 |
'value' => $options['wcf-tq-font-family'],
|
206 |
)
|
223 |
echo wcf()->meta->get_font_family_field(
|
224 |
array(
|
225 |
'for' => 'wcf-tq-heading-font-family',
|
226 |
+
'label' => esc_html__( 'Font Family', 'cartflows' ),
|
227 |
'name' => 'wcf-tq-heading-font-family',
|
228 |
'value' => $options['wcf-tq-heading-font-family'],
|
229 |
)
|
232 |
echo wcf()->meta->get_font_weight_field(
|
233 |
array(
|
234 |
'for' => 'wcf-tq-heading-font-family',
|
235 |
+
'label' => esc_html__( 'Font Weight', 'cartflows' ),
|
236 |
'name' => 'wcf-tq-heading-font-wt',
|
237 |
'value' => $options['wcf-tq-heading-font-wt'],
|
238 |
)
|
250 |
echo wcf()->meta->get_number_field(
|
251 |
array(
|
252 |
'for' => 'wcf-heading',
|
253 |
+
'label' => esc_html__( 'Container Width (In px)', 'cartflows' ),
|
254 |
'name' => 'wcf-tq-container-width',
|
255 |
'value' => $options['wcf-tq-container-width'],
|
256 |
)
|
272 |
array(
|
273 |
'name' => 'wcf-show-overview-section',
|
274 |
'value' => $options['wcf-show-overview-section'],
|
275 |
+
'after' => esc_html__( 'Enable Order Overview ', 'cartflows' ),
|
276 |
)
|
277 |
);
|
278 |
|
280 |
array(
|
281 |
'name' => 'wcf-show-details-section',
|
282 |
'value' => $options['wcf-show-details-section'],
|
283 |
+
'after' => esc_html__( 'Enable Order Details ', 'cartflows' ),
|
284 |
)
|
285 |
);
|
286 |
|
288 |
array(
|
289 |
'name' => 'wcf-show-billing-section',
|
290 |
'value' => $options['wcf-show-billing-section'],
|
291 |
+
'after' => esc_html__( 'Enable Billing Details ', 'cartflows' ),
|
292 |
)
|
293 |
);
|
294 |
|
296 |
array(
|
297 |
'name' => 'wcf-show-shipping-section',
|
298 |
'value' => $options['wcf-show-shipping-section'],
|
299 |
+
'after' => esc_html__( 'Enable Shipping Details ', 'cartflows' ),
|
300 |
)
|
301 |
);
|
302 |
|
354 |
$is_autosave = wp_is_post_autosave( $post_id );
|
355 |
$is_revision = wp_is_post_revision( $post_id );
|
356 |
|
357 |
+
$is_valid_nonce = ( isset( $_POST['nonce-thankyou-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-thankyou-step-meta'] ) ), 'save-nonce-thankyou-step-meta' ) ) ? true : false;
|
358 |
|
359 |
// Exits script depending on save status.
|
360 |
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
|
modules/widgets/class-cartflows-next-step.php
CHANGED
@@ -120,15 +120,15 @@ class Cartflows_Next_Step extends WP_Widget {
|
|
120 |
// Widget admin form.
|
121 |
?>
|
122 |
<p>
|
123 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php
|
124 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
125 |
</p>
|
126 |
<p>
|
127 |
-
<label for="<?php echo $this->get_field_id( 'flow_id' ); ?>"><?php
|
128 |
<input class="widefat" id="<?php echo $this->get_field_id( 'flow_id' ); ?>" name="<?php echo $this->get_field_name( 'flow_id' ); ?>" type="text" value="<?php echo esc_attr( $flow_id ); ?>" />
|
129 |
</p>
|
130 |
<p>
|
131 |
-
<label for="<?php echo $this->get_field_id( 'step_id' ); ?>"><?php
|
132 |
<input class="widefat" id="<?php echo $this->get_field_id( 'step_id' ); ?>" name="<?php echo $this->get_field_name( 'step_id' ); ?>" type="text" value="<?php echo esc_attr( $step_id ); ?>" />
|
133 |
</p>
|
134 |
<?php
|
120 |
// Widget admin form.
|
121 |
?>
|
122 |
<p>
|
123 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'cartflows' ); ?></label>
|
124 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
125 |
</p>
|
126 |
<p>
|
127 |
+
<label for="<?php echo $this->get_field_id( 'flow_id' ); ?>"><?php esc_html_e( 'Flow ID:', 'cartflows' ); ?></label>
|
128 |
<input class="widefat" id="<?php echo $this->get_field_id( 'flow_id' ); ?>" name="<?php echo $this->get_field_name( 'flow_id' ); ?>" type="text" value="<?php echo esc_attr( $flow_id ); ?>" />
|
129 |
</p>
|
130 |
<p>
|
131 |
+
<label for="<?php echo $this->get_field_id( 'step_id' ); ?>"><?php esc_html_e( 'Step ID:', 'cartflows' ); ?></label>
|
132 |
<input class="widefat" id="<?php echo $this->get_field_id( 'step_id' ); ?>" name="<?php echo $this->get_field_name( 'step_id' ); ?>" type="text" value="<?php echo esc_attr( $step_id ); ?>" />
|
133 |
</p>
|
134 |
<?php
|
modules/widgets/class-cartflows-widgets.php
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Widgets
|
4 |
-
*
|
5 |
-
* @package CartFlows
|
6 |
-
*/
|
7 |
-
|
8 |
-
define( 'CARTFLOWS_WIDGETS_DIR', CARTFLOWS_DIR . 'modules/widgets/' );
|
9 |
-
define( 'CARTFLOWS_WIDGETS_URL', CARTFLOWS_URL . 'modules/widgets/' );
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Initial Setup
|
13 |
-
*
|
14 |
-
* @since 1.0.0
|
15 |
-
*/
|
16 |
-
class Cartflows_Widgets {
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Member Variable
|
21 |
-
*
|
22 |
-
* @var object instance
|
23 |
-
*/
|
24 |
-
private static $instance;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Initiator
|
28 |
-
*/
|
29 |
-
public static function get_instance() {
|
30 |
-
if ( ! isset( self::$instance ) ) {
|
31 |
-
self::$instance = new self();
|
32 |
-
}
|
33 |
-
return self::$instance;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Constructor function that initializes required actions and hooks
|
38 |
-
*/
|
39 |
-
public function __construct() {
|
40 |
-
|
41 |
-
require_once CARTFLOWS_WIDGETS_DIR . 'class-cartflows-next-step.php';
|
42 |
-
|
43 |
-
// Register and load the widget.
|
44 |
-
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Register widgets
|
49 |
-
*/
|
50 |
-
public function register_widgets() {
|
51 |
-
register_widget( 'cartflows_next_step' );
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Kicking this off by calling 'get_instance()' method
|
57 |
-
*/
|
58 |
-
Cartflows_Widgets::get_instance();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widgets
|
4 |
+
*
|
5 |
+
* @package CartFlows
|
6 |
+
*/
|
7 |
+
|
8 |
+
define( 'CARTFLOWS_WIDGETS_DIR', CARTFLOWS_DIR . 'modules/widgets/' );
|
9 |
+
define( 'CARTFLOWS_WIDGETS_URL', CARTFLOWS_URL . 'modules/widgets/' );
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initial Setup
|
13 |
+
*
|
14 |
+
* @since 1.0.0
|
15 |
+
*/
|
16 |
+
class Cartflows_Widgets {
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Member Variable
|
21 |
+
*
|
22 |
+
* @var object instance
|
23 |
+
*/
|
24 |
+
private static $instance;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Initiator
|
28 |
+
*/
|
29 |
+
public static function get_instance() {
|
30 |
+
if ( ! isset( self::$instance ) ) {
|
31 |
+
self::$instance = new self();
|
32 |
+
}
|
33 |
+
return self::$instance;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Constructor function that initializes required actions and hooks
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
|
41 |
+
require_once CARTFLOWS_WIDGETS_DIR . 'class-cartflows-next-step.php';
|
42 |
+
|
43 |
+
// Register and load the widget.
|
44 |
+
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Register widgets
|
49 |
+
*/
|
50 |
+
public function register_widgets() {
|
51 |
+
register_widget( 'cartflows_next_step' );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Kicking this off by calling 'get_instance()' method
|
57 |
+
*/
|
58 |
+
Cartflows_Widgets::get_instance();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
|
|
4 |
Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.3
|
7 |
-
Stable tag: 1.3.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -125,6 +125,11 @@ Glad you asked! CartFlows Pro is an optional add-on to CartFlows that adds addit
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
128 |
= Version 1.3.2 - Wednesday, 11th December 2019 =
|
129 |
* New: Option added to remove products on the checkout page.
|
130 |
* Fix: Checkout page's login form text was not able to translate.
|
4 |
Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.3
|
7 |
+
Stable tag: 1.3.3
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
125 |
|
126 |
== Changelog ==
|
127 |
|
128 |
+
= Version 1.3.3 - Thursday, 26th December 2019 =
|
129 |
+
* Improvement: Added filter `cartflows_global_checkout_url` for global checkout.
|
130 |
+
* Fix: Thrive's split test option was not displaying in some cases.
|
131 |
+
* Fix: Klarna's payment fields were not displaying due to the wc-ajax endpoint.
|
132 |
+
|
133 |
= Version 1.3.2 - Wednesday, 11th December 2019 =
|
134 |
* New: Option added to remove products on the checkout page.
|
135 |
* Fix: Checkout page's login form text was not able to translate.
|