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

Version Description

Download this release

Release Info

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

Code changes from version 1.5.21 to 1.5.22

cartflows.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- /**
3
- * Plugin Name: CartFlows
4
- * Plugin URI: https://cartflows.com/
5
- * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
- * Version: 1.5.21
7
- * Author: CartFlows Inc
8
- * Author URI: https://cartflows.com/
9
- * Text Domain: cartflows
10
- * WC requires at least: 3.0
11
- * WC tested up to: 4.6.1
12
- *
13
- * @package CartFlows
14
- */
15
-
16
- /**
17
- * Set constants.
18
- */
19
- define( 'CARTFLOWS_FILE', __FILE__ );
20
-
21
- /**
22
- * Loader
23
- */
24
- require_once 'classes/class-cartflows-loader.php';
1
+ <?php
2
+ /**
3
+ * Plugin Name: CartFlows
4
+ * Plugin URI: https://cartflows.com/
5
+ * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
+ * Version: 1.5.22
7
+ * Author: CartFlows Inc
8
+ * Author URI: https://cartflows.com/
9
+ * Text Domain: cartflows
10
+ * WC requires at least: 3.0
11
+ * WC tested up to: 4.6.2
12
+ *
13
+ * @package CartFlows
14
+ */
15
+
16
+ /**
17
+ * Set constants.
18
+ */
19
+ define( 'CARTFLOWS_FILE', __FILE__ );
20
+
21
+ /**
22
+ * Loader
23
+ */
24
+ require_once 'classes/class-cartflows-loader.php';
changelog.txt CHANGED
@@ -1,5 +1,8 @@
 
 
 
1
  Version 1.5.21 - Thursday, 5th November 2020
2
- - Fix: Pages showing 404 error due to permalink issue.
3
 
4
  Version 1.5.20 - Thursday, 5th November 2020
5
  - New: Introduced Gutenberg Blocks.
1
+ Version 1.5.22 - Friday, 6th November 2020
2
+ - Fix: LearnDash and Tutor LMS permalink conflict.
3
+
4
  Version 1.5.21 - Thursday, 5th November 2020
5
+ - Fix: Pages was showing 404 error due to permalink issue.
6
 
7
  Version 1.5.20 - Thursday, 5th November 2020
8
  - New: Introduced Gutenberg Blocks.
classes/class-cartflows-loader.php CHANGED
@@ -1,612 +1,612 @@
1
- <?php
2
- /**
3
- * CartFlows Loader.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- if ( ! class_exists( 'Cartflows_Loader' ) ) {
9
-
10
- /**
11
- * Class Cartflows_Loader.
12
- */
13
- final class Cartflows_Loader {
14
-
15
- /**
16
- * Member Variable
17
- *
18
- * @var instance
19
- */
20
- private static $instance = null;
21
-
22
- /**
23
- * Member Variable
24
- *
25
- * @var utils
26
- */
27
- public $utils = null;
28
-
29
- /**
30
- * Member Variable
31
- *
32
- * @var logger
33
- */
34
- public $logger = null;
35
-
36
- /**
37
- * Member Variable
38
- *
39
- * @var options
40
- */
41
- public $options = null;
42
-
43
- /**
44
- * Member Variable
45
- *
46
- * @var meta
47
- */
48
- public $meta = null;
49
-
50
- /**
51
- * Member Variable
52
- *
53
- * @var Tracking_Data
54
- */
55
- public $alldata;
56
-
57
- /**
58
- * Member Variable
59
- *
60
- * @var flow
61
- */
62
- public $flow = null;
63
-
64
- /**
65
- * Member Variable
66
- *
67
- * @var wcf_step_objs
68
- */
69
-
70
- public $wcf_step_objs = array();
71
-
72
- /**
73
- * Member Variable
74
- *
75
- * @var assets_vars
76
- */
77
- public $assets_vars = null;
78
-
79
- /**
80
- * Member Variable
81
- *
82
- * @var assets_vars
83
- */
84
-
85
- public $is_woo_active = true;
86
-
87
- /**
88
- * Initiator
89
- */
90
- public static function get_instance() {
91
-
92
- if ( is_null( self::$instance ) ) {
93
-
94
- self::$instance = new self();
95
-
96
- /**
97
- * CartFlows loaded.
98
- *
99
- * Fires when Cartflows was fully loaded and instantiated.
100
- *
101
- * @since 1.0.0
102
- */
103
- do_action( 'cartflows_loaded' );
104
- }
105
-
106
- return self::$instance;
107
- }
108
-
109
- /**
110
- * Constructor
111
- */
112
- public function __construct() {
113
-
114
- $this->define_constants();
115
-
116
- // Activation hook.
117
- register_activation_hook( CARTFLOWS_FILE, array( $this, 'activation_reset' ) );
118
-
119
- // deActivation hook.
120
- register_deactivation_hook( CARTFLOWS_FILE, array( $this, 'deactivation_reset' ) );
121
-
122
- add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
123
- add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
124
-
125
- }
126
-
127
- /**
128
- * Defines all constants
129
- *
130
- * @since 1.0.0
131
- */
132
- public function define_constants() {
133
-
134
- define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
135
- define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
136
- define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
137
- define( 'CARTFLOWS_VER', '1.5.21' );
138
- define( 'CARTFLOWS_SLUG', 'cartflows' );
139
- define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
140
-
141
- define( 'CARTFLOWS_FLOW_POST_TYPE', 'cartflows_flow' );
142
- define( 'CARTFLOWS_STEP_POST_TYPE', 'cartflows_step' );
143
-
144
- if ( ! defined( 'CARTFLOWS_SERVER_URL' ) ) {
145
- define( 'CARTFLOWS_SERVER_URL', 'https://my.cartflows.com/' );
146
- }
147
- define( 'CARTFLOWS_DOMAIN_URL', 'https://cartflows.com/' );
148
- define( 'CARTFLOWS_TEMPLATES_URL', 'https://templates.cartflows.com/' );
149
- define( 'CARTFLOWS_TAXONOMY_STEP_TYPE', 'cartflows_step_type' );
150
- define( 'CARTFLOWS_TAXONOMY_STEP_FLOW', 'cartflows_step_flow' );
151
-
152
- if ( ! defined( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER' ) ) {
153
- define( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER', 'cartflows_step_page_builder' );
154
- }
155
- if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER' ) ) {
156
- define( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER', 'cartflows_flow_page_builder' );
157
- }
158
- if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY' ) ) {
159
- define( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY', 'cartflows_flow_category' );
160
- }
161
-
162
- if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
163
-
164
- $upload_dir = wp_upload_dir( null, false );
165
-
166
- define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
167
- }
168
-
169
- $GLOBALS['wcf_step'] = null;
170
- }
171
-
172
- /**
173
- * Loads plugin files.
174
- *
175
- * @since 1.0.0
176
- *
177
- * @return void
178
- */
179
- public function load_plugin() {
180
-
181
- $this->load_helper_files_components();
182
- $this->load_core_files();
183
- $this->load_core_components();
184
-
185
- add_action( 'wp_loaded', array( $this, 'initialize' ) );
186
- add_action( 'cartflows_pro_init', array( $this, 'after_cartflows_pro_init' ) );
187
-
188
- if ( ! $this->is_woo_active ) {
189
- add_action( 'admin_notices', array( $this, 'fails_to_load' ) );
190
- }
191
-
192
- /**
193
- * CartFlows Init.
194
- *
195
- * Fires when Cartflows is instantiated.
196
- *
197
- * @since 1.0.0
198
- */
199
- do_action( 'cartflows_init' );
200
- }
201
-
202
- /**
203
- * After CartFlows Pro init.
204
- *
205
- * @since 1.1.19
206
- *
207
- * @return void
208
- */
209
- public function after_cartflows_pro_init() {
210
-
211
- if ( ! is_admin() ) {
212
- return;
213
- }
214
-
215
- if ( version_compare( CARTFLOWS_PRO_VER, '1.5.8', '<' ) ) {
216
- add_action( 'admin_notices', array( $this, 'required_cartflows_pro_notice' ) );
217
- }
218
- }
219
-
220
- /**
221
- * Required CartFlows Pro Notice.
222
- *
223
- * @since 1.1.19
224
- *
225
- * @return void
226
- */
227
- public function required_cartflows_pro_notice() {
228
-
229
- $required_pro_version = '1.5.8';
230
-
231
- $class = 'notice notice-warning';
232
- /* translators: %s: html tags */
233
- $message = sprintf( __( 'You are using an older version of %1$sCartFlows Pro%2$s. Please update %1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher.', 'cartflows' ), '<strong>', '</strong>', $required_pro_version );
234
-
235
- printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
236
- }
237
-
238
- /**
239
- * Load Helper Files and Components.
240
- *
241
- * @since 1.0.0
242
- *
243
- * @return void
244
- */
245
- public function load_helper_files_components() {
246
-
247
- $this->is_woo_active = function_exists( 'WC' );
248
-
249
- /* Public Utils */
250
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-utils.php';
251
-
252
- /* Public Global Namespace Function */
253
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
254
-
255
- /* Admin Helper */
256
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
257
-
258
- /* Factory objects */
259
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-step-factory.php';
260
-
261
- /* Meta Default Values */
262
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-default-meta.php';
263
-
264
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-tracking.php';
265
-
266
- if ( is_admin() ) {
267
- require_once CARTFLOWS_DIR . 'classes/lib/notices/class-astra-notices.php';
268
- }
269
-
270
- if ( ! class_exists( 'BSF_Analytics_Loader' ) ) {
271
- require_once CARTFLOWS_DIR . '/admin/bsf-analytics/class-bsf-analytics-loader.php';
272
- }
273
-
274
- $bsf_analytics = BSF_Analytics_Loader::get_instance();
275
-
276
- $bsf_analytics->set_entity(
277
- array(
278
- 'cf' => array(
279
- 'product_name' => 'CartFlows',
280
- 'usage_doc_link' => 'https://my.cartflows.com/usage-tracking/',
281
- 'path' => CARTFLOWS_DIR . 'admin/bsf-analytics',
282
- 'author' => 'CartFlows Inc',
283
- ),
284
- )
285
- );
286
-
287
- $this->utils = Cartflows_Utils::get_instance();
288
- $this->options = Cartflows_Default_Meta::get_instance();
289
- $this->alldata = Cartflows_Tracking::get_instance();
290
- }
291
-
292
- /**
293
- * Init hooked function.
294
- *
295
- * @since 1.0.0
296
- *
297
- * @return void
298
- */
299
- public function initialize() {
300
- $this->assets_vars = $this->utils->get_assets_path();
301
- }
302
-
303
- /**
304
- * Load Core Files.
305
- *
306
- * @since 1.0.0
307
- *
308
- * @return void
309
- */
310
- public function load_core_files() {
311
-
312
- /* Update compatibility. */
313
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-update.php';
314
-
315
- /* Page builder compatibilty class */
316
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-compatibility.php';
317
-
318
- /* Theme support */
319
- if ( $this->is_woo_active ) {
320
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-theme-support.php';
321
-
322
- /* Woo hooks */
323
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-woo-hooks.php';
324
- }
325
-
326
- /* Admin Meta Fields*/
327
- include_once CARTFLOWS_DIR . 'classes/fields/typography/class-cartflows-font-families.php';
328
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta-fields.php';
329
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta.php';
330
-
331
- if ( is_admin() ) {
332
- /* Cloning */
333
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-cloning.php';
334
-
335
- /* Admin Settings */
336
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin.php';
337
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-stats.php';
338
- }
339
-
340
- /* Logger */
341
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-interface.php';
342
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler.php';
343
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-file.php';
344
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-levels.php';
345
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-logger-interface.php';
346
- include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-wc-logger.php';
347
-
348
- /* Core Modules */
349
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-logger.php';
350
-
351
- /* Frontend Global */
352
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-frontend.php';
353
- require_once CARTFLOWS_DIR . 'classes/class-cartflows-flow-frontend.php';
354
-
355
- /* Modules */
356
- include_once CARTFLOWS_DIR . 'modules/flow/class-cartflows-flow.php';
357
- include_once CARTFLOWS_DIR . 'modules/landing/class-cartflows-landing.php';
358
-
359
- if ( $this->is_woo_active ) {
360
- include_once CARTFLOWS_DIR . 'modules/checkout/class-cartflows-checkout.php';
361
- include_once CARTFLOWS_DIR . 'modules/thankyou/class-cartflows-thankyou.php';
362
- include_once CARTFLOWS_DIR . 'modules/optin/class-cartflows-optin.php';
363
- }
364
-
365
- if ( class_exists( '\Elementor\Plugin' ) ) {
366
- // Load the widgets.
367
- include_once CARTFLOWS_DIR . 'modules/elementor/class-cartflows-el-widgets-loader.php';
368
- }
369
-
370
- if ( class_exists( 'FLBuilder' ) ) {
371
-
372
- include_once CARTFLOWS_DIR . 'modules/beaver-builder/class-cartflows-bb-modules-loader.php';
373
- }
374
-
375
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-api.php';
376
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer-core.php';
377
-
378
- include_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-batch-process.php';
379
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer.php';
380
-
381
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-wizard.php';
382
-
383
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-metabox.php';
384
-
385
- include_once CARTFLOWS_DIR . 'classes/deprecated/deprecated-hooks.php';
386
-
387
- include_once CARTFLOWS_DIR . 'modules/gutenberg/classes/class-cartflows-block-loader.php';
388
- }
389
-
390
- /**
391
- * Load Core Components.
392
- *
393
- * @since 1.0.0
394
- *
395
- * @return void
396
- */
397
- public function load_core_components() {
398
-
399
- $this->meta = Cartflows_Meta_Fields::get_instance();
400
- $this->logger = Cartflows_Logger::get_instance();
401
- $this->flow = Cartflows_Flow_Frontend::get_instance();
402
- }
403
-
404
- /**
405
- * Create files/directories.
406
- */
407
- public function create_files() {
408
-
409
- // Install files and folders for uploading files and prevent hotlinking.
410
- $upload_dir = wp_upload_dir();
411
-
412
- $files = array(
413
- array(
414
- 'base' => CARTFLOWS_LOG_DIR,
415
- 'file' => '.htaccess',
416
- 'content' => 'deny from all',
417
- ),
418
- array(
419
- 'base' => CARTFLOWS_LOG_DIR,
420
- 'file' => 'index.html',
421
- 'content' => '',
422
- ),
423
- );
424
-
425
- foreach ( $files as $file ) {
426
- if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
427
- $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore
428
- if ( $file_handle ) {
429
- fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
430
- fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
431
- }
432
- }
433
- }
434
- }
435
-
436
- /**
437
- * Load CartFlows Pro Text Domain.
438
- * This will load the translation textdomain depending on the file priorities.
439
- * 1. Global Languages /wp-content/languages/cartflows/ folder
440
- * 2. Local dorectory /wp-content/plugins/cartflows/languages/ folder
441
- *
442
- * @since 1.0.3
443
- * @return void
444
- */
445
- public function load_cf_textdomain() {
446
-
447
- // Default languages directory for CartFlows Pro.
448
- $lang_dir = CARTFLOWS_DIR . 'languages/';
449
-
450
- /**
451
- * Filters the languages directory path to use for CartFlows Pro.
452
- *
453
- * @param string $lang_dir The languages directory path.
454
- */
455
- $lang_dir = apply_filters( 'cartflows_languages_directory', $lang_dir );
456
-
457
- // Traditional WordPress plugin locale filter.
458
- global $wp_version;
459
-
460
- $get_locale = get_locale();
461
-
462
- if ( $wp_version >= 4.7 ) {
463
- $get_locale = get_user_locale();
464
- }
465
-
466
- /**
467
- * Language Locale for CartFlows Pro
468
- *
469
- * @var $get_locale The locale to use.
470
- * Uses get_user_locale()` in WordPress 4.7 or greater,
471
- * otherwise uses `get_locale()`.
472
- */
473
- $locale = apply_filters( 'plugin_locale', $get_locale, 'cartflows' );
474
- $mofile = sprintf( '%1$s-%2$s.mo', 'cartflows', $locale );
475
-
476
- // Setup paths to current locale file.
477
- $mofile_local = $lang_dir . $mofile;
478
- $mofile_global = WP_LANG_DIR . '/plugins/' . $mofile;
479
-
480
- if ( file_exists( $mofile_global ) ) {
481
- // Look in global /wp-content/languages/cartflows/ folder.
482
- load_textdomain( 'cartflows', $mofile_global );
483
- } elseif ( file_exists( $mofile_local ) ) {
484
- // Look in local /wp-content/plugins/cartflows/languages/ folder.
485
- load_textdomain( 'cartflows', $mofile_local );
486
- } else {
487
- // Load the default language files.
488
- load_plugin_textdomain( 'cartflows', false, $lang_dir );
489
- }
490
- }
491
-
492
- /**
493
- * Fires admin notice when Elementor is not installed and activated.
494
- *
495
- * @since 1.0.0
496
- *
497
- * @return void
498
- */
499
- public function fails_to_load() {
500
-
501
- $screen = get_current_screen();
502
-
503
- if ( ! wcf()->utils->is_step_post_type() ) {
504
- return;
505
- }
506
-
507
- if ( ! wcf()->utils->check_is_woo_required_page() ) {
508
- return;
509
- }
510
-
511
- $skip_notice = false;
512
-
513
- wp_localize_script( 'wcf-global-admin', 'cartflows_woo', array( 'show_update_post' => $skip_notice ) );
514
-
515
- $class = 'notice notice-warning';
516
- /* translators: %s: html tags */
517
- $message = sprintf( __( 'This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & activated.', 'cartflows' ), '<strong>', '</strong>' );
518
-
519
- $plugin = 'woocommerce/woocommerce.php';
520
-
521
- if ( _is_woo_installed() ) {
522
- if ( ! current_user_can( 'activate_plugins' ) ) {
523
- return;
524
- }
525
-
526
- $action_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
527
- $button_label = __( 'Activate WooCommerce', 'cartflows' );
528
-
529
- } else {
530
- if ( ! current_user_can( 'install_plugins' ) ) {
531
- return;
532
- }
533
-
534
- $action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
535
- $button_label = __( 'Install WooCommerce', 'cartflows' );
536
- }
537
-
538
- $button = '<p><a href="' . $action_url . '" class="button-primary">' . $button_label . '</a></p><p></p>';
539
-
540
- printf( '<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr( $class ), $message, $button );
541
- }
542
-
543
- /**
544
- * Activation Reset
545
- */
546
- public function activation_reset() {
547
-
548
- if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
549
-
550
- $upload_dir = wp_upload_dir( null, false );
551
-
552
- define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
553
- }
554
-
555
- $this->create_files();
556
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
557
- include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
558
- include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-flow-post-type.php';
559
- include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-step-post-type.php';
560
-
561
- Cartflows_Flow_Post_Type::get_instance()->flow_post_type();
562
- Cartflows_Step_Post_Type::get_instance()->step_post_type();
563
- flush_rewrite_rules();
564
- }
565
-
566
- /**
567
- * Deactivation Reset
568
- */
569
- public function deactivation_reset() {
570
- }
571
-
572
- /**
573
- * Logger Class Instance
574
- */
575
- public function logger() {
576
- return Cartflows_Logger::get_instance();
577
- }
578
- }
579
-
580
- /**
581
- * Prepare if class 'Cartflows_Loader' exist.
582
- * Kicking this off by calling 'get_instance()' method
583
- */
584
- Cartflows_Loader::get_instance();
585
- }
586
-
587
- /**
588
- * Get global class.
589
- *
590
- * @return object
591
- */
592
- function wcf() {
593
- return Cartflows_Loader::get_instance();
594
- }
595
-
596
- if ( ! function_exists( '_is_woo_installed' ) ) {
597
-
598
- /**
599
- * Is woocommerce plugin installed.
600
- *
601
- * @since 1.0.0
602
- *
603
- * @access public
604
- */
605
- function _is_woo_installed() {
606
-
607
- $path = 'woocommerce/woocommerce.php';
608
- $plugins = get_plugins();
609
-
610
- return isset( $plugins[ $path ] );
611
- }
612
- }
1
+ <?php
2
+ /**
3
+ * CartFlows Loader.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ if ( ! class_exists( 'Cartflows_Loader' ) ) {
9
+
10
+ /**
11
+ * Class Cartflows_Loader.
12
+ */
13
+ final class Cartflows_Loader {
14
+
15
+ /**
16
+ * Member Variable
17
+ *
18
+ * @var instance
19
+ */
20
+ private static $instance = null;
21
+
22
+ /**
23
+ * Member Variable
24
+ *
25
+ * @var utils
26
+ */
27
+ public $utils = null;
28
+
29
+ /**
30
+ * Member Variable
31
+ *
32
+ * @var logger
33
+ */
34
+ public $logger = null;
35
+
36
+ /**
37
+ * Member Variable
38
+ *
39
+ * @var options
40
+ */
41
+ public $options = null;
42
+
43
+ /**
44
+ * Member Variable
45
+ *
46
+ * @var meta
47
+ */
48
+ public $meta = null;
49
+
50
+ /**
51
+ * Member Variable
52
+ *
53
+ * @var Tracking_Data
54
+ */
55
+ public $alldata;
56
+
57
+ /**
58
+ * Member Variable
59
+ *
60
+ * @var flow
61
+ */
62
+ public $flow = null;
63
+
64
+ /**
65
+ * Member Variable
66
+ *
67
+ * @var wcf_step_objs
68
+ */
69
+
70
+ public $wcf_step_objs = array();
71
+
72
+ /**
73
+ * Member Variable
74
+ *
75
+ * @var assets_vars
76
+ */
77
+ public $assets_vars = null;
78
+
79
+ /**
80
+ * Member Variable
81
+ *
82
+ * @var assets_vars
83
+ */
84
+
85
+ public $is_woo_active = true;
86
+
87
+ /**
88
+ * Initiator
89
+ */
90
+ public static function get_instance() {
91
+
92
+ if ( is_null( self::$instance ) ) {
93
+
94
+ self::$instance = new self();
95
+
96
+ /**
97
+ * CartFlows loaded.
98
+ *
99
+ * Fires when Cartflows was fully loaded and instantiated.
100
+ *
101
+ * @since 1.0.0
102
+ */
103
+ do_action( 'cartflows_loaded' );
104
+ }
105
+
106
+ return self::$instance;
107
+ }
108
+
109
+ /**
110
+ * Constructor
111
+ */
112
+ public function __construct() {
113
+
114
+ $this->define_constants();
115
+
116
+ // Activation hook.
117
+ register_activation_hook( CARTFLOWS_FILE, array( $this, 'activation_reset' ) );
118
+
119
+ // deActivation hook.
120
+ register_deactivation_hook( CARTFLOWS_FILE, array( $this, 'deactivation_reset' ) );
121
+
122
+ add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
123
+ add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
124
+
125
+ }
126
+
127
+ /**
128
+ * Defines all constants
129
+ *
130
+ * @since 1.0.0
131
+ */
132
+ public function define_constants() {
133
+
134
+ define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
135
+ define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
136
+ define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
137
+ define( 'CARTFLOWS_VER', '1.5.22' );
138
+ define( 'CARTFLOWS_SLUG', 'cartflows' );
139
+ define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
140
+
141
+ define( 'CARTFLOWS_FLOW_POST_TYPE', 'cartflows_flow' );
142
+ define( 'CARTFLOWS_STEP_POST_TYPE', 'cartflows_step' );
143
+
144
+ if ( ! defined( 'CARTFLOWS_SERVER_URL' ) ) {
145
+ define( 'CARTFLOWS_SERVER_URL', 'https://my.cartflows.com/' );
146
+ }
147
+ define( 'CARTFLOWS_DOMAIN_URL', 'https://cartflows.com/' );
148
+ define( 'CARTFLOWS_TEMPLATES_URL', 'https://templates.cartflows.com/' );
149
+ define( 'CARTFLOWS_TAXONOMY_STEP_TYPE', 'cartflows_step_type' );
150
+ define( 'CARTFLOWS_TAXONOMY_STEP_FLOW', 'cartflows_step_flow' );
151
+
152
+ if ( ! defined( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER' ) ) {
153
+ define( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER', 'cartflows_step_page_builder' );
154
+ }
155
+ if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER' ) ) {
156
+ define( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER', 'cartflows_flow_page_builder' );
157
+ }
158
+ if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY' ) ) {
159
+ define( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY', 'cartflows_flow_category' );
160
+ }
161
+
162
+ if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
163
+
164
+ $upload_dir = wp_upload_dir( null, false );
165
+
166
+ define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
167
+ }
168
+
169
+ $GLOBALS['wcf_step'] = null;
170
+ }
171
+
172
+ /**
173
+ * Loads plugin files.
174
+ *
175
+ * @since 1.0.0
176
+ *
177
+ * @return void
178
+ */
179
+ public function load_plugin() {
180
+
181
+ $this->load_helper_files_components();
182
+ $this->load_core_files();
183
+ $this->load_core_components();
184
+
185
+ add_action( 'wp_loaded', array( $this, 'initialize' ) );
186
+ add_action( 'cartflows_pro_init', array( $this, 'after_cartflows_pro_init' ) );
187
+
188
+ if ( ! $this->is_woo_active ) {
189
+ add_action( 'admin_notices', array( $this, 'fails_to_load' ) );
190
+ }
191
+
192
+ /**
193
+ * CartFlows Init.
194
+ *
195
+ * Fires when Cartflows is instantiated.
196
+ *
197
+ * @since 1.0.0
198
+ */
199
+ do_action( 'cartflows_init' );
200
+ }
201
+
202
+ /**
203
+ * After CartFlows Pro init.
204
+ *
205
+ * @since 1.1.19
206
+ *
207
+ * @return void
208
+ */
209
+ public function after_cartflows_pro_init() {
210
+
211
+ if ( ! is_admin() ) {
212
+ return;
213
+ }
214
+
215
+ if ( version_compare( CARTFLOWS_PRO_VER, '1.5.8', '<' ) ) {
216
+ add_action( 'admin_notices', array( $this, 'required_cartflows_pro_notice' ) );
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Required CartFlows Pro Notice.
222
+ *
223
+ * @since 1.1.19
224
+ *
225
+ * @return void
226
+ */
227
+ public function required_cartflows_pro_notice() {
228
+
229
+ $required_pro_version = '1.5.8';
230
+
231
+ $class = 'notice notice-warning';
232
+ /* translators: %s: html tags */
233
+ $message = sprintf( __( 'You are using an older version of %1$sCartFlows Pro%2$s. Please update %1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher.', 'cartflows' ), '<strong>', '</strong>', $required_pro_version );
234
+
235
+ printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
236
+ }
237
+
238
+ /**
239
+ * Load Helper Files and Components.
240
+ *
241
+ * @since 1.0.0
242
+ *
243
+ * @return void
244
+ */
245
+ public function load_helper_files_components() {
246
+
247
+ $this->is_woo_active = function_exists( 'WC' );
248
+
249
+ /* Public Utils */
250
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-utils.php';
251
+
252
+ /* Public Global Namespace Function */
253
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
254
+
255
+ /* Admin Helper */
256
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
257
+
258
+ /* Factory objects */
259
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-step-factory.php';
260
+
261
+ /* Meta Default Values */
262
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-default-meta.php';
263
+
264
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-tracking.php';
265
+
266
+ if ( is_admin() ) {
267
+ require_once CARTFLOWS_DIR . 'classes/lib/notices/class-astra-notices.php';
268
+ }
269
+
270
+ if ( ! class_exists( 'BSF_Analytics_Loader' ) ) {
271
+ require_once CARTFLOWS_DIR . '/admin/bsf-analytics/class-bsf-analytics-loader.php';
272
+ }
273
+
274
+ $bsf_analytics = BSF_Analytics_Loader::get_instance();
275
+
276
+ $bsf_analytics->set_entity(
277
+ array(
278
+ 'cf' => array(
279
+ 'product_name' => 'CartFlows',
280
+ 'usage_doc_link' => 'https://my.cartflows.com/usage-tracking/',
281
+ 'path' => CARTFLOWS_DIR . 'admin/bsf-analytics',
282
+ 'author' => 'CartFlows Inc',
283
+ ),
284
+ )
285
+ );
286
+
287
+ $this->utils = Cartflows_Utils::get_instance();
288
+ $this->options = Cartflows_Default_Meta::get_instance();
289
+ $this->alldata = Cartflows_Tracking::get_instance();
290
+ }
291
+
292
+ /**
293
+ * Init hooked function.
294
+ *
295
+ * @since 1.0.0
296
+ *
297
+ * @return void
298
+ */
299
+ public function initialize() {
300
+ $this->assets_vars = $this->utils->get_assets_path();
301
+ }
302
+
303
+ /**
304
+ * Load Core Files.
305
+ *
306
+ * @since 1.0.0
307
+ *
308
+ * @return void
309
+ */
310
+ public function load_core_files() {
311
+
312
+ /* Update compatibility. */
313
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-update.php';
314
+
315
+ /* Page builder compatibilty class */
316
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-compatibility.php';
317
+
318
+ /* Theme support */
319
+ if ( $this->is_woo_active ) {
320
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-theme-support.php';
321
+
322
+ /* Woo hooks */
323
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-woo-hooks.php';
324
+ }
325
+
326
+ /* Admin Meta Fields*/
327
+ include_once CARTFLOWS_DIR . 'classes/fields/typography/class-cartflows-font-families.php';
328
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta-fields.php';
329
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta.php';
330
+
331
+ if ( is_admin() ) {
332
+ /* Cloning */
333
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-cloning.php';
334
+
335
+ /* Admin Settings */
336
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin.php';
337
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-stats.php';
338
+ }
339
+
340
+ /* Logger */
341
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-interface.php';
342
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler.php';
343
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-file.php';
344
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-levels.php';
345
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-logger-interface.php';
346
+ include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-wc-logger.php';
347
+
348
+ /* Core Modules */
349
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-logger.php';
350
+
351
+ /* Frontend Global */
352
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-frontend.php';
353
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-flow-frontend.php';
354
+
355
+ /* Modules */
356
+ include_once CARTFLOWS_DIR . 'modules/flow/class-cartflows-flow.php';
357
+ include_once CARTFLOWS_DIR . 'modules/landing/class-cartflows-landing.php';
358
+
359
+ if ( $this->is_woo_active ) {
360
+ include_once CARTFLOWS_DIR . 'modules/checkout/class-cartflows-checkout.php';
361
+ include_once CARTFLOWS_DIR . 'modules/thankyou/class-cartflows-thankyou.php';
362
+ include_once CARTFLOWS_DIR . 'modules/optin/class-cartflows-optin.php';
363
+ }
364
+
365
+ if ( class_exists( '\Elementor\Plugin' ) ) {
366
+ // Load the widgets.
367
+ include_once CARTFLOWS_DIR . 'modules/elementor/class-cartflows-el-widgets-loader.php';
368
+ }
369
+
370
+ if ( class_exists( 'FLBuilder' ) ) {
371
+
372
+ include_once CARTFLOWS_DIR . 'modules/beaver-builder/class-cartflows-bb-modules-loader.php';
373
+ }
374
+
375
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-api.php';
376
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer-core.php';
377
+
378
+ include_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-batch-process.php';
379
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer.php';
380
+
381
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-wizard.php';
382
+
383
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-metabox.php';
384
+
385
+ include_once CARTFLOWS_DIR . 'classes/deprecated/deprecated-hooks.php';
386
+
387
+ include_once CARTFLOWS_DIR . 'modules/gutenberg/classes/class-cartflows-block-loader.php';
388
+ }
389
+
390
+ /**
391
+ * Load Core Components.
392
+ *
393
+ * @since 1.0.0
394
+ *
395
+ * @return void
396
+ */
397
+ public function load_core_components() {
398
+
399
+ $this->meta = Cartflows_Meta_Fields::get_instance();
400
+ $this->logger = Cartflows_Logger::get_instance();
401
+ $this->flow = Cartflows_Flow_Frontend::get_instance();
402
+ }
403
+
404
+ /**
405
+ * Create files/directories.
406
+ */
407
+ public function create_files() {
408
+
409
+ // Install files and folders for uploading files and prevent hotlinking.
410
+ $upload_dir = wp_upload_dir();
411
+
412
+ $files = array(
413
+ array(
414
+ 'base' => CARTFLOWS_LOG_DIR,
415
+ 'file' => '.htaccess',
416
+ 'content' => 'deny from all',
417
+ ),
418
+ array(
419
+ 'base' => CARTFLOWS_LOG_DIR,
420
+ 'file' => 'index.html',
421
+ 'content' => '',
422
+ ),
423
+ );
424
+
425
+ foreach ( $files as $file ) {
426
+ if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
427
+ $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore
428
+ if ( $file_handle ) {
429
+ fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
430
+ fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Load CartFlows Pro Text Domain.
438
+ * This will load the translation textdomain depending on the file priorities.
439
+ * 1. Global Languages /wp-content/languages/cartflows/ folder
440
+ * 2. Local dorectory /wp-content/plugins/cartflows/languages/ folder
441
+ *
442
+ * @since 1.0.3
443
+ * @return void
444
+ */
445
+ public function load_cf_textdomain() {
446
+
447
+ // Default languages directory for CartFlows Pro.
448
+ $lang_dir = CARTFLOWS_DIR . 'languages/';
449
+
450
+ /**
451
+ * Filters the languages directory path to use for CartFlows Pro.
452
+ *
453
+ * @param string $lang_dir The languages directory path.
454
+ */
455
+ $lang_dir = apply_filters( 'cartflows_languages_directory', $lang_dir );
456
+
457
+ // Traditional WordPress plugin locale filter.
458
+ global $wp_version;
459
+
460
+ $get_locale = get_locale();
461
+
462
+ if ( $wp_version >= 4.7 ) {
463
+ $get_locale = get_user_locale();
464
+ }
465
+
466
+ /**
467
+ * Language Locale for CartFlows Pro
468
+ *
469
+ * @var $get_locale The locale to use.
470
+ * Uses get_user_locale()` in WordPress 4.7 or greater,
471
+ * otherwise uses `get_locale()`.
472
+ */
473
+ $locale = apply_filters( 'plugin_locale', $get_locale, 'cartflows' );
474
+ $mofile = sprintf( '%1$s-%2$s.mo', 'cartflows', $locale );
475
+
476
+ // Setup paths to current locale file.
477
+ $mofile_local = $lang_dir . $mofile;
478
+ $mofile_global = WP_LANG_DIR . '/plugins/' . $mofile;
479
+
480
+ if ( file_exists( $mofile_global ) ) {
481
+ // Look in global /wp-content/languages/cartflows/ folder.
482
+ load_textdomain( 'cartflows', $mofile_global );
483
+ } elseif ( file_exists( $mofile_local ) ) {
484
+ // Look in local /wp-content/plugins/cartflows/languages/ folder.
485
+ load_textdomain( 'cartflows', $mofile_local );
486
+ } else {
487
+ // Load the default language files.
488
+ load_plugin_textdomain( 'cartflows', false, $lang_dir );
489
+ }
490
+ }
491
+
492
+ /**
493
+ * Fires admin notice when Elementor is not installed and activated.
494
+ *
495
+ * @since 1.0.0
496
+ *
497
+ * @return void
498
+ */
499
+ public function fails_to_load() {
500
+
501
+ $screen = get_current_screen();
502
+
503
+ if ( ! wcf()->utils->is_step_post_type() ) {
504
+ return;
505
+ }
506
+
507
+ if ( ! wcf()->utils->check_is_woo_required_page() ) {
508
+ return;
509
+ }
510
+
511
+ $skip_notice = false;
512
+
513
+ wp_localize_script( 'wcf-global-admin', 'cartflows_woo', array( 'show_update_post' => $skip_notice ) );
514
+
515
+ $class = 'notice notice-warning';
516
+ /* translators: %s: html tags */
517
+ $message = sprintf( __( 'This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & activated.', 'cartflows' ), '<strong>', '</strong>' );
518
+
519
+ $plugin = 'woocommerce/woocommerce.php';
520
+
521
+ if ( _is_woo_installed() ) {
522
+ if ( ! current_user_can( 'activate_plugins' ) ) {
523
+ return;
524
+ }
525
+
526
+ $action_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
527
+ $button_label = __( 'Activate WooCommerce', 'cartflows' );
528
+
529
+ } else {
530
+ if ( ! current_user_can( 'install_plugins' ) ) {
531
+ return;
532
+ }
533
+
534
+ $action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
535
+ $button_label = __( 'Install WooCommerce', 'cartflows' );
536
+ }
537
+
538
+ $button = '<p><a href="' . $action_url . '" class="button-primary">' . $button_label . '</a></p><p></p>';
539
+
540
+ printf( '<div class="%1$s"><p>%2$s</p>%3$s</div>', esc_attr( $class ), $message, $button );
541
+ }
542
+
543
+ /**
544
+ * Activation Reset
545
+ */
546
+ public function activation_reset() {
547
+
548
+ if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
549
+
550
+ $upload_dir = wp_upload_dir( null, false );
551
+
552
+ define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
553
+ }
554
+
555
+ $this->create_files();
556
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
557
+ include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
558
+ include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-flow-post-type.php';
559
+ include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-step-post-type.php';
560
+
561
+ Cartflows_Flow_Post_Type::get_instance()->flow_post_type();
562
+ Cartflows_Step_Post_Type::get_instance()->step_post_type();
563
+ flush_rewrite_rules();
564
+ }
565
+
566
+ /**
567
+ * Deactivation Reset
568
+ */
569
+ public function deactivation_reset() {
570
+ }
571
+
572
+ /**
573
+ * Logger Class Instance
574
+ */
575
+ public function logger() {
576
+ return Cartflows_Logger::get_instance();
577
+ }
578
+ }
579
+
580
+ /**
581
+ * Prepare if class 'Cartflows_Loader' exist.
582
+ * Kicking this off by calling 'get_instance()' method
583
+ */
584
+ Cartflows_Loader::get_instance();
585
+ }
586
+
587
+ /**
588
+ * Get global class.
589
+ *
590
+ * @return object
591
+ */
592
+ function wcf() {
593
+ return Cartflows_Loader::get_instance();
594
+ }
595
+
596
+ if ( ! function_exists( '_is_woo_installed' ) ) {
597
+
598
+ /**
599
+ * Is woocommerce plugin installed.
600
+ *
601
+ * @since 1.0.0
602
+ *
603
+ * @access public
604
+ */
605
+ function _is_woo_installed() {
606
+
607
+ $path = 'woocommerce/woocommerce.php';
608
+ $plugins = get_plugins();
609
+
610
+ return isset( $plugins[ $path ] );
611
+ }
612
+ }
languages/cartflows.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: CartFlows 1.5.21\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
- "POT-Creation-Date: 2020-11-05 12:33:23+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
2
  # This file is distributed under the same license as the CartFlows package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: CartFlows 1.5.22\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cartflows\n"
7
+ "POT-Creation-Date: 2020-11-06 14:22:00+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
modules/flow/classes/class-cartflows-permalink.php CHANGED
@@ -1,175 +1,187 @@
1
- <?php
2
- /**
3
- * Step post type.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Permalink {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Initiator
25
- */
26
- public static function get_instance() {
27
- if ( ! isset( self::$instance ) ) {
28
- self::$instance = new self();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- /**
34
- * Constructor
35
- */
36
- public function __construct() {
37
-
38
- add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
39
- add_action( 'init', array( $this, 'rewrite_step_rule' ) );
40
-
41
- if ( ! is_admin() ) {
42
-
43
- add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
44
- }
45
- }
46
-
47
- /**
48
- * Modify permalink
49
- *
50
- * @param string $post_link post link.
51
- * @param array $post post data.
52
- * @param string $leavename leave name.
53
- * @return string
54
- */
55
- public function post_type_permalinks( $post_link, $post, $leavename ) {
56
-
57
- if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
58
-
59
- $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
60
- $flow_name = get_post_field( 'post_name', $flow_id );
61
- $cf_permalink = Cartflows_Helper::get_permalink_settings();
62
-
63
- if ( isset( $cf_permalink['permalink_structure'] ) && ! empty( $cf_permalink['permalink_structure'] ) ) {
64
-
65
- $sep = '/';
66
- $search = array( $sep . 'cartflows_flow', $sep . '%flowname%', $sep . 'cartflows_step' );
67
- $replace = array( $sep . $cf_permalink['permalink_flow_base'], $sep . $flow_name, $sep . $cf_permalink['permalink'] );
68
- $post_link = str_replace( $search, $replace, $post_link );
69
- } else {
70
-
71
- // If elementor page preview, return post link as it is.
72
- if ( isset( $_REQUEST['elementor-preview'] ) ) { //phpcs:ignore
73
- return $post_link;
74
- }
75
-
76
- $structure = get_option( 'permalink_structure' );
77
-
78
- if ( '/%postname%/' === $structure ) {
79
-
80
- $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
81
-
82
- }
83
- }
84
- }
85
-
86
- return $post_link;
87
- }
88
-
89
- /**
90
- * Reqrite rules for acrtflows step.
91
- */
92
- public function rewrite_step_rule() {
93
-
94
- $cf_permalink = Cartflows_Helper::get_permalink_settings();
95
-
96
- if ( isset( $cf_permalink['permalink_structure'] ) ) {
97
- switch ( $cf_permalink['permalink_structure'] ) {
98
- case '/cartflows_flow/%flowname%/cartflows_step':
99
- add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
100
- break;
101
-
102
- case '/cartflows_flow/%flowname%':
103
- add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/([^/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
104
- break;
105
-
106
- case '/%flowname%/cartflows_step':
107
- add_rewrite_rule( '([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
108
-
109
- break;
110
-
111
- default:
112
- break;
113
- }
114
- }
115
-
116
- }
117
-
118
- /**
119
- * Have WordPress match postname to any of our public post types.
120
- * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
121
- * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
122
- *
123
- * @param string $query query statement.
124
- */
125
- public function add_cpt_post_names_to_main_query( $query ) {
126
-
127
- // Bail if this is not the main query.
128
- if ( ! $query->is_main_query() ) {
129
- return;
130
- }
131
-
132
- // Bail if this query doesn't match our very specific rewrite rule.
133
- if ( ! isset( $query->query['thrive-variations'] )
134
- && ! isset( $query->query['page'] )
135
- && ! isset( $query->query_vars['page_id'] )
136
- ) {
137
- return;
138
- }
139
-
140
- // Bail if we're not querying based on the post name.
141
- if ( empty( $query->query['name'] ) && empty( $query->query_vars['page_id'] ) ) {
142
- return;
143
- }
144
-
145
- // Bail if name is set and query cout is not 2.
146
- if ( ! empty( $query->query['name'] ) && 2 !== count( $query->query ) ) {
147
- return;
148
- }
149
-
150
- // Bail if page_id is set but page is not true. Added when step is set as homepage.
151
- if ( ! empty( $query->query_vars['page_id'] ) && empty( $query->is_page ) ) {
152
- return;
153
- }
154
-
155
- // Add cartflows step post type to existing post type array.
156
- if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
157
-
158
- $post_types = $query->query_vars['post_type'];
159
-
160
- $post_types[] = CARTFLOWS_STEP_POST_TYPE;
161
-
162
- $query->set( 'post_type', $post_types );
163
-
164
- } else {
165
-
166
- // Add CPT to the list of post types WP will include when it queries based on the post name.
167
- $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
168
- }
169
- }
170
- }
171
-
172
- /**
173
- * Kicking this off by calling 'get_instance()' method
174
- */
175
- Cartflows_Permalink::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Step post type.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Permalink {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Initiator
25
+ */
26
+ public static function get_instance() {
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new self();
29
+ }
30
+ return self::$instance;
31
+ }
32
+
33
+ /**
34
+ * Constructor
35
+ */
36
+ public function __construct() {
37
+
38
+ add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
39
+ add_action( 'init', array( $this, 'rewrite_step_rule' ) );
40
+
41
+ if ( ! is_admin() ) {
42
+
43
+ add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ), 20 );
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Modify permalink
49
+ *
50
+ * @param string $post_link post link.
51
+ * @param array $post post data.
52
+ * @param string $leavename leave name.
53
+ * @return string
54
+ */
55
+ public function post_type_permalinks( $post_link, $post, $leavename ) {
56
+
57
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
58
+
59
+ $flow_id = get_post_meta( $post->ID, 'wcf-flow-id', true );
60
+ $flow_name = get_post_field( 'post_name', $flow_id );
61
+ $cf_permalink = Cartflows_Helper::get_permalink_settings();
62
+
63
+ if ( isset( $cf_permalink['permalink_structure'] ) && ! empty( $cf_permalink['permalink_structure'] ) ) {
64
+
65
+ $sep = '/';
66
+ $search = array( $sep . 'cartflows_flow', $sep . '%flowname%', $sep . 'cartflows_step' );
67
+ $replace = array( $sep . $cf_permalink['permalink_flow_base'], $sep . $flow_name, $sep . $cf_permalink['permalink'] );
68
+ $post_link = str_replace( $search, $replace, $post_link );
69
+ } else {
70
+
71
+ // If elementor page preview, return post link as it is.
72
+ if ( isset( $_REQUEST['elementor-preview'] ) ) { //phpcs:ignore
73
+ return $post_link;
74
+ }
75
+
76
+ $structure = get_option( 'permalink_structure' );
77
+
78
+ if ( '/%postname%/' === $structure ) {
79
+
80
+ $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
81
+
82
+ }
83
+ }
84
+ }
85
+
86
+ return $post_link;
87
+ }
88
+
89
+ /**
90
+ * Reqrite rules for acrtflows step.
91
+ */
92
+ public function rewrite_step_rule() {
93
+
94
+ $cf_permalink = Cartflows_Helper::get_permalink_settings();
95
+
96
+ if ( isset( $cf_permalink['permalink_structure'] ) ) {
97
+ switch ( $cf_permalink['permalink_structure'] ) {
98
+ case '/cartflows_flow/%flowname%/cartflows_step':
99
+ add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
100
+ break;
101
+
102
+ case '/cartflows_flow/%flowname%':
103
+ add_rewrite_rule( '^' . $cf_permalink['permalink_flow_base'] . '/([^/]*)/([^/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
104
+ break;
105
+
106
+ case '/%flowname%/cartflows_step':
107
+ add_rewrite_rule( '([^/]*)/' . $cf_permalink['permalink'] . '/([^\/]*)/?', 'index.php?cartflows_step=$matches[2]', 'top' );
108
+
109
+ break;
110
+
111
+ default:
112
+ break;
113
+ }
114
+ }
115
+
116
+ }
117
+
118
+ /**
119
+ * Have WordPress match postname to any of our public post types.
120
+ * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
121
+ * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
122
+ *
123
+ * @param string $query query statement.
124
+ */
125
+ public function add_cpt_post_names_to_main_query( $query ) {
126
+
127
+ // Bail if this is not the main query.
128
+ if ( ! $query->is_main_query() ) {
129
+ return;
130
+ }
131
+
132
+ // Bail if post_type is already set in query.
133
+ if ( isset( $query->query['post_type'] ) ) {
134
+ return;
135
+ }
136
+
137
+ // Bail if this query doesn't match our very specific rewrite rule.
138
+ if ( ! isset( $query->query['thrive-variations'] )
139
+ && ! isset( $query->query['page'] )
140
+ && ! isset( $query->query_vars['page_id'] )
141
+ ) {
142
+ return;
143
+ }
144
+
145
+ // Bail if we're not querying based on the post name.
146
+ if ( empty( $query->query['name'] ) && empty( $query->query_vars['page_id'] ) ) {
147
+ return;
148
+ }
149
+
150
+ // Bail if name is set and query coutt is not 2 and page is not set.
151
+ if ( ! empty( $query->query['name'] ) ) {
152
+
153
+ if ( 2 !== count( $query->query ) ) {
154
+ return;
155
+ } else {
156
+ if ( ! isset( $query->query['page'] ) ) {
157
+ return;
158
+ }
159
+ }
160
+ }
161
+
162
+ // Bail if page_id is set but page is not true. Added when step is set as homepage.
163
+ if ( ! empty( $query->query_vars['page_id'] ) && empty( $query->is_page ) && ! empty( $query->query['name'] ) ) {
164
+ return;
165
+ }
166
+
167
+ // Add cartflows step post type to existing post type array.
168
+ if ( isset( $query->query_vars['post_type'] ) && is_array( $query->query_vars['post_type'] ) ) {
169
+
170
+ $post_types = $query->query_vars['post_type'];
171
+
172
+ $post_types[] = CARTFLOWS_STEP_POST_TYPE;
173
+
174
+ $query->set( 'post_type', $post_types );
175
+
176
+ } else {
177
+
178
+ // Add CPT to the list of post types WP will include when it queries based on the post name.
179
+ $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
180
+ }
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Kicking this off by calling 'get_instance()' method
186
+ */
187
+ Cartflows_Permalink::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.5.3
7
- Stable tag: 1.5.21
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -127,8 +127,11 @@ Glad you asked! Most normal users have less than 3 funnels on a single website,
127
 
128
  == Changelog ==
129
 
 
 
 
130
  = Version 1.5.21 - Thursday, 5th November 2020 =
131
- * Fix: Pages showing 404 error due to permalink issue.
132
 
133
  = Version 1.5.20 - Thursday, 5th November 2020 =
134
  * New: Introduced [Gutenberg Blocks](https://cartflows.com/docs/cartflows-gutenberg-blocks/).
4
  Tags: woocommerce, funnel builder, sales funnels, elementor, beaver builder
5
  Requires at least: 4.4
6
  Tested up to: 5.5.3
7
+ Stable tag: 1.5.22
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
127
 
128
  == Changelog ==
129
 
130
+ = Version 1.5.22 - Friday, 6th November 2020 =
131
+ * Fix: LearnDash and Tutor LMS permalink conflict.
132
+
133
  = Version 1.5.21 - Thursday, 5th November 2020 =
134
+ * Fix: Pages was showing 404 error due to permalink issue.
135
 
136
  = Version 1.5.20 - Thursday, 5th November 2020 =
137
  * New: Introduced [Gutenberg Blocks](https://cartflows.com/docs/cartflows-gutenberg-blocks/).