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

Version Description

Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

assets/js/frontend.js CHANGED
@@ -4,7 +4,9 @@
4
  var remove_oceanwp_custom_style = function(){
5
  if( 'OceanWP' == cartflows.current_theme ){
6
  var style = document.getElementById("oceanwp-style-css");
7
- style.remove();
 
 
8
  }
9
  }
10
 
4
  var remove_oceanwp_custom_style = function(){
5
  if( 'OceanWP' == cartflows.current_theme ){
6
  var style = document.getElementById("oceanwp-style-css");
7
+ if( null != style ){
8
+ style.remove();
9
+ }
10
  }
11
  }
12
 
cartflows.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
- * Version: 1.1.1
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
3
  * Plugin Name: CartFlows
4
  * Plugin URI: https://cartflows.com/
5
  * Description: Create beautiful checkout pages & sales flows for WooCommerce.
6
+ * Version: 1.1.2
7
  * Author: CartFlows Inc
8
  * Author URI: https://cartflows.com/
9
  * Text Domain: cartflows
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  Version 1.1.1 - Wednesday, 2nd January 2019
2
  - Improvement: Added compatibility for a future release of CartFlows Pro.
3
  - Improvement: Minor CSS and HTML changes.
1
+ Version 1.1.2 - Friday, 4th January 2019
2
+ - Fix: Import Cloud Template option not visible in thrive visual editor.
3
+ - Fix: Oceanwp css conflict with checkout layout.
4
+ - Fix: WC error notice in elementor preview mode when Elementor pro is not active/installed.
5
+
6
  Version 1.1.1 - Wednesday, 2nd January 2019
7
  - Improvement: Added compatibility for a future release of CartFlows Pro.
8
  - Improvement: Minor CSS and HTML changes.
classes/class-cartflows-compatibility.php CHANGED
@@ -53,6 +53,10 @@ if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
53
  if ( $this->is_divi_enabled() ) {
54
  require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
  }
 
 
 
 
56
  }
57
 
58
  /**
@@ -136,7 +140,7 @@ if ( ! class_exists( 'Cartflows_Compatibility' ) ) {
136
 
137
  $theme = wp_get_theme();
138
 
139
- if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) || $this->is_oceanwp_enabled( $theme ) ) {
140
 
141
  return true;
142
  }
53
  if ( $this->is_divi_enabled() ) {
54
  require_once CARTFLOWS_DIR . 'classes/class-cartflows-divi-compatibility.php';
55
  }
56
+
57
+ if ( class_exists( 'TCB_Post' ) ) {
58
+ require_once CARTFLOWS_DIR . 'classes/class-cartflows-thrive-compatibility.php';
59
+ }
60
  }
61
 
62
  /**
140
 
141
  $theme = wp_get_theme();
142
 
143
+ if ( $this->is_divi_enabled( $theme ) || $this->is_flatsome_enabled( $theme ) ) {
144
 
145
  return true;
146
  }
classes/class-cartflows-loader.php CHANGED
@@ -115,7 +115,7 @@ if ( ! class_exists( 'Cartflows_Loader' ) ) {
115
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
116
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
117
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
118
- define( 'CARTFLOWS_VER', '1.1.1' );
119
  define( 'CARTFLOWS_SLUG', 'cartflows' );
120
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
121
 
115
  define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
116
  define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
117
  define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
118
+ define( 'CARTFLOWS_VER', '1.1.2' );
119
  define( 'CARTFLOWS_SLUG', 'cartflows' );
120
  define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
121
 
classes/class-cartflows-thrive-compatibility.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Thrive Visual Editor Compatibility
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Class for Thrive Visual Editor Compatibility
10
+ */
11
+ class Cartflows_Thrive_Compatibility {
12
+
13
+ /**
14
+ * Member Variable
15
+ *
16
+ * @var instance
17
+ */
18
+ private static $instance;
19
+
20
+ /**
21
+ * Initiator
22
+ */
23
+ public static function get_instance() {
24
+ if ( ! isset( self::$instance ) ) {
25
+ self::$instance = new self;
26
+ }
27
+ return self::$instance;
28
+ }
29
+
30
+ /**
31
+ * Constructor
32
+ */
33
+ public function __construct() {
34
+
35
+ // Add CartFlows post type in the thrive page editor.
36
+ add_filter( 'tve_landing_page_post_types', array( $this, 'send_post_type_to_thrive' ) );
37
+
38
+ add_filter( 'tcb_can_use_landing_pages', array( $this, 'send_post_type_to_thrive' ) );
39
+
40
+ add_filter( 'tcb_has_templates_tab', array( $this, 'send_post_type_to_thrive' ) );
41
+ }
42
+
43
+ /**
44
+ * Return step post type for Thrive Architect.
45
+ *
46
+ * @since 1.0.0
47
+ * @param array $post_type_pt the current step post type.
48
+ * @return array $post_type_pt current step post type.
49
+ */
50
+ function send_post_type_to_thrive( $post_type_pt ) {
51
+
52
+ $post_type_pt = array();
53
+
54
+ $post_type_pt[] = CARTFLOWS_STEP_POST_TYPE;
55
+
56
+ return $post_type_pt;
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Kicking this off by calling 'get_instance()' method
62
+ */
63
+ Cartflows_Thrive_Compatibility::get_instance();
modules/checkout/classes/class-cartflows-checkout-markup.php CHANGED
@@ -145,6 +145,10 @@ class Cartflows_Checkout_Markup {
145
  */
146
  function checkout_shortcode_markup( $atts ) {
147
 
 
 
 
 
148
  $atts = shortcode_atts(
149
  array(
150
  'id' => 0,
145
  */
146
  function checkout_shortcode_markup( $atts ) {
147
 
148
+ if ( ! function_exists( 'wc_print_notices' ) ) {
149
+ return '<p class="woocommerce-notice">' . __( 'WooCommerce functions not exists. If you are in iframe, please reload the iframe', 'cartflows' ) . '</p>';
150
+ }
151
+
152
  $atts = shortcode_atts(
153
  array(
154
  'id' => 0,
modules/flow/classes/class-cartflows-step-post-type.php CHANGED
@@ -1,449 +1,450 @@
1
- <?php
2
- /**
3
- * Step post type.
4
- *
5
- * @package CartFlows
6
- */
7
-
8
- /**
9
- * Initialization
10
- *
11
- * @since 1.0.0
12
- */
13
- class Cartflows_Step_Post_Type {
14
-
15
-
16
- /**
17
- * Member Variable
18
- *
19
- * @var instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * Member Variable
25
- *
26
- * @var body_classes
27
- */
28
- private $body_classes = array();
29
-
30
- /**
31
- * Initiator
32
- */
33
- public static function get_instance() {
34
- if ( ! isset( self::$instance ) ) {
35
- self::$instance = new self;
36
- }
37
- return self::$instance;
38
- }
39
-
40
- /**
41
- * Constructor
42
- */
43
- public function __construct() {
44
-
45
- add_action( 'init', array( $this, 'step_post_type' ) );
46
- add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
- add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
- add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
- add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
- add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ) );
51
-
52
- add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
- }
54
-
55
- /**
56
- * Trys to load page.php for a header, footer or part theme layout.
57
- *
58
- * @since 1.0.0
59
- * @param string $template The current template to be loaded.
60
- * @return string
61
- */
62
- function load_page_template( $template ) {
63
-
64
- global $post;
65
-
66
- if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
67
-
68
- /**
69
- * Remove Next/Prev Navigation
70
- * add_filter('next_post_link', '__return_empty_string');
71
- * add_filter('previous_post_link', '__return_empty_string');
72
- *
73
- * $page = locate_template( array( 'page.php' ) );
74
- *
75
- * if ( ! empty( $page ) ) {
76
- * return $page;
77
- * }
78
- */
79
-
80
- $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
81
-
82
- $page_template = apply_filters( 'cartflows_page_template', $page_template );
83
-
84
- $file = '';
85
-
86
- switch ( $page_template ) {
87
-
88
- case 'cartflows-default':
89
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
90
- $this->body_classes[] = $page_template;
91
- break;
92
- case 'cartflows-canvas':
93
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
94
- $this->body_classes[] = $page_template;
95
- break;
96
- default:
97
- $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
98
- $this->body_classes[] = 'cartflows-default';
99
- break;
100
- }
101
-
102
- // Just to be safe, we check if the file exist first.
103
- if ( file_exists( $file ) ) {
104
-
105
- /* Add Body Class */
106
- add_filter( 'body_class', [ $this, 'body_class' ] );
107
-
108
- return $file;
109
- } else {
110
- echo $file;
111
- }
112
- }
113
-
114
- return $template;
115
- }
116
-
117
- /**
118
- * Body classes.
119
- *
120
- * @since 1.0.0
121
- * @param array $classes Body classes.
122
- * @return array
123
- */
124
- function body_class( $classes = [] ) {
125
-
126
- $classes = array_merge( $classes, $this->body_classes );
127
-
128
- return $classes;
129
- }
130
-
131
- /**
132
- * Create custom post type
133
- */
134
- function step_post_type() {
135
-
136
- $labels = array(
137
- 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
138
- 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
139
- 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
140
- 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
141
- 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
142
- 'view_item' => esc_html__( 'View Step', 'cartflows' ),
143
- 'add_new' => esc_html__( 'Add New', 'cartflows' ),
144
- 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
145
- 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
146
- 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
147
- );
148
-
149
- $args = array(
150
- 'labels' => $labels,
151
- 'public' => true,
152
- 'query_var' => true,
153
- 'can_export' => true,
154
- 'exclude_from_search' => true,
155
- 'show_ui' => true,
156
- 'show_in_menu' => false,
157
- 'show_in_admin_bar' => true,
158
- 'supports' => array( 'title', 'editor', 'elementor' ),
159
- 'capability_type' => 'post',
160
- 'capabilities' => array(
161
- 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
162
- ),
163
- 'map_meta_cap' => true,
164
- );
165
-
166
- register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
167
-
168
- $args = array(
169
- 'label' => __( 'Step Type', 'cartflows' ),
170
- 'public' => false,
171
- 'rewrite' => false,
172
- 'hierarchical' => false,
173
- );
174
-
175
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
176
-
177
- $args = array(
178
- 'label' => __( 'Step Flow', 'cartflows' ),
179
- 'public' => false,
180
- 'rewrite' => false,
181
- 'hierarchical' => false,
182
- );
183
-
184
- register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
185
-
186
- /**
187
- * Register 'Elementor' & 'Beaver Builder' site types.
188
- *
189
- * @see self::add_terms();
190
- */
191
- $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
192
-
193
- $terms = array(
194
- array(
195
- 'name' => __( 'Landing', 'cartflows' ),
196
- 'args' => array(
197
- 'slug' => 'landing',
198
- ),
199
- ),
200
- array(
201
- 'name' => __( 'Checkout', 'cartflows' ),
202
- 'args' => array(
203
- 'slug' => 'checkout',
204
- ),
205
- ),
206
- array(
207
- 'name' => __( 'Thank You', 'cartflows' ),
208
- 'args' => array(
209
- 'slug' => 'thankyou',
210
- ),
211
- ),
212
- array(
213
- 'name' => __( 'Upsell', 'cartflows' ),
214
- 'args' => array(
215
- 'slug' => 'upsell',
216
- ),
217
- ),
218
- array(
219
- 'name' => __( 'Downsell', 'cartflows' ),
220
- 'args' => array(
221
- 'slug' => 'downsell',
222
- ),
223
- ),
224
- );
225
-
226
- $this->add_terms( $taxonomy, $terms );
227
- }
228
-
229
- /**
230
- * Add WordPress templates.
231
- *
232
- * Adds Cartflows templates to steps
233
- *
234
- * @since 1.0.0
235
- * @access public
236
- */
237
- function add_wp_templates_support() {
238
- add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
239
- }
240
-
241
- /**
242
- * Add page templates.
243
- *
244
- * @since 1.0.0
245
- * @access public
246
- *
247
- * @param array $page_templates Array of page templates.
248
- *
249
- * @param object $wp_theme wp theme.
250
- * @param object $post post.
251
- *
252
- * @return array Page templates.
253
- */
254
- function add_page_templates( $page_templates, $wp_theme, $post ) {
255
-
256
- $page_templates = array(
257
- 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
258
- );
259
-
260
- return $page_templates;
261
- }
262
-
263
- /**
264
- * Have WordPress match postname to any of our public post types.
265
- * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
266
- * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
267
- *
268
- * @param string $query query statement.
269
- */
270
- function add_cpt_post_names_to_main_query( $query ) {
271
-
272
- // Bail if this is not the main query.
273
- if ( ! $query->is_main_query() ) {
274
- return;
275
- }
276
- // Bail if this query doesn't match our very specific rewrite rule.
277
- if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
278
- return;
279
- }
280
- // Bail if we're not querying based on the post name.
281
- if ( empty( $query->query['name'] ) ) {
282
- return;
283
- }
284
- // Add CPT to the list of post types WP will include when it queries based on the post name.
285
- $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
286
- }
287
-
288
- /**
289
- * Modify permalink
290
- *
291
- * @param string $post_link post link.
292
- * @param array $post post data.
293
- * @param string $leavename leave name.
294
- * @return string
295
- */
296
- function post_type_permalinks( $post_link, $post, $leavename ) {
297
-
298
- // If elementor page preview, return post link as it is.
299
- if ( isset( $_REQUEST['elementor-preview'] ) ) {
300
- return $post_link;
301
- }
302
-
303
- $structure = get_option( 'permalink_structure' );
304
-
305
- if ( '/%postname%/' === $structure ) {
306
-
307
- if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
308
-
309
- $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
310
- }
311
- }
312
-
313
- return $post_link;
314
- }
315
-
316
- /**
317
- * Prevent slug duplicated
318
- *
319
- * @param string $slug post slug.
320
- * @param int $post_ID post id.
321
- * @param string $post_status post status.
322
- * @param string $post_type post type.
323
- * @param int $post_parent post parent id.
324
- * @param string $original_slug original slug.
325
- * @return string
326
- */
327
- function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
328
-
329
- $check_post_types = array(
330
- 'post',
331
- 'page',
332
- CARTFLOWS_STEP_POST_TYPE,
333
- );
334
-
335
- if ( ! in_array( $post_type, $check_post_types ) ) {
336
- return $slug;
337
- }
338
-
339
- if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
340
- // Saving a post, check for duplicates in POST or PAGE post types.
341
- $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
342
- $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
343
-
344
- if ( $post_match || $page_match ) {
345
- $slug .= '-2';
346
- }
347
- } else {
348
-
349
- // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
350
- $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
351
-
352
- if ( $custom_post_type_match ) {
353
- $slug .= '-2';
354
- }
355
- }
356
-
357
- return $slug;
358
- }
359
-
360
- /**
361
- * Add Update messages for any custom post type
362
- *
363
- * @param array $messages Array of default messages.
364
- */
365
- function post_update_messages( $messages ) {
366
-
367
- $custom_post_type = get_post_type( get_the_ID() );
368
-
369
- if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
370
-
371
- $obj = get_post_type_object( $custom_post_type );
372
- $singular_name = $obj->labels->singular_name;
373
- $messages[ $custom_post_type ] = array(
374
- 0 => '', // Unused. Messages start at index 1.
375
- /* translators: %s: singular custom post type name */
376
- 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
377
- /* translators: %s: singular custom post type name */
378
- 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
379
- /* translators: %s: singular custom post type name */
380
- 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
381
- /* translators: %s: singular custom post type name */
382
- 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
383
- /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
384
- 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,
385
- /* translators: %s: singular custom post type name */
386
- 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
387
- /* translators: %s: singular custom post type name */
388
- 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
389
- /* translators: %s: singular custom post type name */
390
- 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
391
- /* translators: %s: singular custom post type name */
392
- 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
393
- /* translators: %s: singular custom post type name */
394
- 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
395
- );
396
- }
397
-
398
- return $messages;
399
- }
400
-
401
- /**
402
- * Add Terms for Taxonomy.
403
- *
404
- * => Example.
405
- *
406
- * $taxonomy = '{taxonomy}';
407
- * $terms = array(
408
- * array(
409
- * 'name' => 'Free',
410
- * ),
411
- * array(
412
- * 'name' => 'Premium',
413
- * ),
414
- * );
415
- *
416
- * self::add_terms( $taxonomy, $terms );
417
- *
418
- * @since 1.0.0
419
- * @param string $taxonomy Taxonomy Name.
420
- * @param array $terms Terms list.
421
- * @return void
422
- */
423
- function add_terms( $taxonomy = '', $terms = array() ) {
424
-
425
- foreach ( $terms as $key => $term ) {
426
-
427
- $term_exist = term_exists( $term['name'], $taxonomy );
428
-
429
- if ( empty( $term_exist ) ) {
430
-
431
- /**
432
- * Add additional args if passed from request.
433
- *
434
- * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
435
- */
436
- if ( array_key_exists( 'args', $term ) ) {
437
- wp_insert_term( $term['name'], $taxonomy, $term['args'] );
438
- } else {
439
- wp_insert_term( $term['name'], $taxonomy );
440
- }
441
- }
442
- }
443
- }
444
- }
445
-
446
- /**
447
- * Kicking this off by calling 'get_instance()' method
448
- */
449
- Cartflows_Step_Post_Type::get_instance();
 
1
+ <?php
2
+ /**
3
+ * Step post type.
4
+ *
5
+ * @package CartFlows
6
+ */
7
+
8
+ /**
9
+ * Initialization
10
+ *
11
+ * @since 1.0.0
12
+ */
13
+ class Cartflows_Step_Post_Type {
14
+
15
+
16
+ /**
17
+ * Member Variable
18
+ *
19
+ * @var instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * Member Variable
25
+ *
26
+ * @var body_classes
27
+ */
28
+ private $body_classes = array();
29
+
30
+ /**
31
+ * Initiator
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self;
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ */
43
+ public function __construct() {
44
+
45
+ add_action( 'init', array( $this, 'step_post_type' ) );
46
+ add_action( 'init', array( $this, 'add_wp_templates_support' ) );
47
+ add_filter( 'post_updated_messages', array( $this, 'post_update_messages' ) );
48
+ add_filter( 'post_type_link', array( $this, 'post_type_permalinks' ), 10, 3 );
49
+ add_filter( 'wp_unique_post_slug', array( $this, 'prevent_slug_duplicates' ), 10, 6 );
50
+ add_action( 'pre_get_posts', array( $this, 'add_cpt_post_names_to_main_query' ) );
51
+
52
+ add_filter( 'template_include', array( $this, 'load_page_template' ), 99 );
53
+ }
54
+
55
+
56
+ /**
57
+ * Trys to load page.php for a header, footer or part theme layout.
58
+ *
59
+ * @since 1.0.0
60
+ * @param string $template The current template to be loaded.
61
+ * @return string
62
+ */
63
+ function load_page_template( $template ) {
64
+
65
+ global $post;
66
+
67
+ if ( 'string' == gettype( $template ) && is_object( $post ) && CARTFLOWS_STEP_POST_TYPE === $post->post_type ) {
68
+
69
+ /**
70
+ * Remove Next/Prev Navigation
71
+ * add_filter('next_post_link', '__return_empty_string');
72
+ * add_filter('previous_post_link', '__return_empty_string');
73
+ *
74
+ * $page = locate_template( array( 'page.php' ) );
75
+ *
76
+ * if ( ! empty( $page ) ) {
77
+ * return $page;
78
+ * }
79
+ */
80
+
81
+ $page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
82
+
83
+ $page_template = apply_filters( 'cartflows_page_template', $page_template );
84
+
85
+ $file = '';
86
+
87
+ switch ( $page_template ) {
88
+
89
+ case 'cartflows-default':
90
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
91
+ $this->body_classes[] = $page_template;
92
+ break;
93
+ case 'cartflows-canvas':
94
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-canvas.php';
95
+ $this->body_classes[] = $page_template;
96
+ break;
97
+ default:
98
+ $file = CARTFLOWS_FLOW_DIR . 'templates/template-default.php';
99
+ $this->body_classes[] = 'cartflows-default';
100
+ break;
101
+ }
102
+
103
+ // Just to be safe, we check if the file exist first.
104
+ if ( file_exists( $file ) ) {
105
+
106
+ /* Add Body Class */
107
+ add_filter( 'body_class', [ $this, 'body_class' ] );
108
+
109
+ return $file;
110
+ } else {
111
+ echo $file;
112
+ }
113
+ }
114
+
115
+ return $template;
116
+ }
117
+
118
+ /**
119
+ * Body classes.
120
+ *
121
+ * @since 1.0.0
122
+ * @param array $classes Body classes.
123
+ * @return array
124
+ */
125
+ function body_class( $classes = [] ) {
126
+
127
+ $classes = array_merge( $classes, $this->body_classes );
128
+
129
+ return $classes;
130
+ }
131
+
132
+ /**
133
+ * Create custom post type
134
+ */
135
+ function step_post_type() {
136
+
137
+ $labels = array(
138
+ 'name' => esc_html_x( 'Steps', 'flow step general name', 'cartflows' ),
139
+ 'singular_name' => esc_html_x( 'Step', 'flow step singular name', 'cartflows' ),
140
+ 'search_items' => esc_html__( 'Search Steps', 'cartflows' ),
141
+ 'all_items' => esc_html__( 'All Steps', 'cartflows' ),
142
+ 'edit_item' => esc_html__( 'Edit Step', 'cartflows' ),
143
+ 'view_item' => esc_html__( 'View Step', 'cartflows' ),
144
+ 'add_new' => esc_html__( 'Add New', 'cartflows' ),
145
+ 'update_item' => esc_html__( 'Update Step', 'cartflows' ),
146
+ 'add_new_item' => esc_html__( 'Add New', 'cartflows' ),
147
+ 'new_item_name' => esc_html__( 'New Step Name', 'cartflows' ),
148
+ );
149
+
150
+ $args = array(
151
+ 'labels' => $labels,
152
+ 'public' => true,
153
+ 'query_var' => true,
154
+ 'can_export' => true,
155
+ 'exclude_from_search' => true,
156
+ 'show_ui' => true,
157
+ 'show_in_menu' => false,
158
+ 'show_in_admin_bar' => true,
159
+ 'supports' => array( 'title', 'editor', 'elementor' ),
160
+ 'capability_type' => 'post',
161
+ 'capabilities' => array(
162
+ 'create_posts' => 'do_not_allow', // Prior to Wordpress 4.5, this was false.
163
+ ),
164
+ 'map_meta_cap' => true,
165
+ );
166
+
167
+ register_post_type( CARTFLOWS_STEP_POST_TYPE, $args );
168
+
169
+ $args = array(
170
+ 'label' => __( 'Step Type', 'cartflows' ),
171
+ 'public' => false,
172
+ 'rewrite' => false,
173
+ 'hierarchical' => false,
174
+ );
175
+
176
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_TYPE, CARTFLOWS_STEP_POST_TYPE, $args );
177
+
178
+ $args = array(
179
+ 'label' => __( 'Step Flow', 'cartflows' ),
180
+ 'public' => false,
181
+ 'rewrite' => false,
182
+ 'hierarchical' => false,
183
+ );
184
+
185
+ register_taxonomy( CARTFLOWS_TAXONOMY_STEP_FLOW, CARTFLOWS_STEP_POST_TYPE, $args );
186
+
187
+ /**
188
+ * Register 'Elementor' & 'Beaver Builder' site types.
189
+ *
190
+ * @see self::add_terms();
191
+ */
192
+ $taxonomy = CARTFLOWS_TAXONOMY_STEP_TYPE;
193
+
194
+ $terms = array(
195
+ array(
196
+ 'name' => __( 'Landing', 'cartflows' ),
197
+ 'args' => array(
198
+ 'slug' => 'landing',
199
+ ),
200
+ ),
201
+ array(
202
+ 'name' => __( 'Checkout', 'cartflows' ),
203
+ 'args' => array(
204
+ 'slug' => 'checkout',
205
+ ),
206
+ ),
207
+ array(
208
+ 'name' => __( 'Thank You', 'cartflows' ),
209
+ 'args' => array(
210
+ 'slug' => 'thankyou',
211
+ ),
212
+ ),
213
+ array(
214
+ 'name' => __( 'Upsell', 'cartflows' ),
215
+ 'args' => array(
216
+ 'slug' => 'upsell',
217
+ ),
218
+ ),
219
+ array(
220
+ 'name' => __( 'Downsell', 'cartflows' ),
221
+ 'args' => array(
222
+ 'slug' => 'downsell',
223
+ ),
224
+ ),
225
+ );
226
+
227
+ $this->add_terms( $taxonomy, $terms );
228
+ }
229
+
230
+ /**
231
+ * Add WordPress templates.
232
+ *
233
+ * Adds Cartflows templates to steps
234
+ *
235
+ * @since 1.0.0
236
+ * @access public
237
+ */
238
+ function add_wp_templates_support() {
239
+ add_filter( 'theme_' . CARTFLOWS_STEP_POST_TYPE . '_templates', array( $this, 'add_page_templates' ), 99, 4 );
240
+ }
241
+
242
+ /**
243
+ * Add page templates.
244
+ *
245
+ * @since 1.0.0
246
+ * @access public
247
+ *
248
+ * @param array $page_templates Array of page templates.
249
+ *
250
+ * @param object $wp_theme wp theme.
251
+ * @param object $post post.
252
+ *
253
+ * @return array Page templates.
254
+ */
255
+ function add_page_templates( $page_templates, $wp_theme, $post ) {
256
+
257
+ $page_templates = array(
258
+ 'cartflows-canvas' => _x( 'Template for Page Builders', 'cartflows' ),
259
+ );
260
+
261
+ return $page_templates;
262
+ }
263
+
264
+ /**
265
+ * Have WordPress match postname to any of our public post types.
266
+ * All of our public post types can have /post-name/ as the slug, so they need to be unique across all posts.
267
+ * By default, WordPress only accounts for posts and pages where the slug is /post-name/.
268
+ *
269
+ * @param string $query query statement.
270
+ */
271
+ function add_cpt_post_names_to_main_query( $query ) {
272
+
273
+ // Bail if this is not the main query.
274
+ if ( ! $query->is_main_query() ) {
275
+ return;
276
+ }
277
+ // Bail if this query doesn't match our very specific rewrite rule.
278
+ if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) {
279
+ return;
280
+ }
281
+ // Bail if we're not querying based on the post name.
282
+ if ( empty( $query->query['name'] ) ) {
283
+ return;
284
+ }
285
+ // Add CPT to the list of post types WP will include when it queries based on the post name.
286
+ $query->set( 'post_type', array( 'post', 'page', CARTFLOWS_STEP_POST_TYPE ) );
287
+ }
288
+
289
+ /**
290
+ * Modify permalink
291
+ *
292
+ * @param string $post_link post link.
293
+ * @param array $post post data.
294
+ * @param string $leavename leave name.
295
+ * @return string
296
+ */
297
+ function post_type_permalinks( $post_link, $post, $leavename ) {
298
+
299
+ // If elementor page preview, return post link as it is.
300
+ if ( isset( $_REQUEST['elementor-preview'] ) ) {
301
+ return $post_link;
302
+ }
303
+
304
+ $structure = get_option( 'permalink_structure' );
305
+
306
+ if ( '/%postname%/' === $structure ) {
307
+
308
+ if ( isset( $post->post_type ) && CARTFLOWS_STEP_POST_TYPE == $post->post_type ) {
309
+
310
+ $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
311
+ }
312
+ }
313
+
314
+ return $post_link;
315
+ }
316
+
317
+ /**
318
+ * Prevent slug duplicated
319
+ *
320
+ * @param string $slug post slug.
321
+ * @param int $post_ID post id.
322
+ * @param string $post_status post status.
323
+ * @param string $post_type post type.
324
+ * @param int $post_parent post parent id.
325
+ * @param string $original_slug original slug.
326
+ * @return string
327
+ */
328
+ function prevent_slug_duplicates( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
329
+
330
+ $check_post_types = array(
331
+ 'post',
332
+ 'page',
333
+ CARTFLOWS_STEP_POST_TYPE,
334
+ );
335
+
336
+ if ( ! in_array( $post_type, $check_post_types ) ) {
337
+ return $slug;
338
+ }
339
+
340
+ if ( CARTFLOWS_STEP_POST_TYPE == $post_type ) {
341
+ // Saving a post, check for duplicates in POST or PAGE post types.
342
+ $post_match = get_page_by_path( $slug, 'OBJECT', 'post' );
343
+ $page_match = get_page_by_path( $slug, 'OBJECT', 'page' );
344
+
345
+ if ( $post_match || $page_match ) {
346
+ $slug .= '-2';
347
+ }
348
+ } else {
349
+
350
+ // Saving a POST or PAGE, check for duplicates in CARTFLOWS_STEP_POST_TYPE post type.
351
+ $custom_post_type_match = get_page_by_path( $slug, 'OBJECT', CARTFLOWS_STEP_POST_TYPE );
352
+
353
+ if ( $custom_post_type_match ) {
354
+ $slug .= '-2';
355
+ }
356
+ }
357
+
358
+ return $slug;
359
+ }
360
+
361
+ /**
362
+ * Add Update messages for any custom post type
363
+ *
364
+ * @param array $messages Array of default messages.
365
+ */
366
+ function post_update_messages( $messages ) {
367
+
368
+ $custom_post_type = get_post_type( get_the_ID() );
369
+
370
+ if ( CARTFLOWS_STEP_POST_TYPE == $custom_post_type ) {
371
+
372
+ $obj = get_post_type_object( $custom_post_type );
373
+ $singular_name = $obj->labels->singular_name;
374
+ $messages[ $custom_post_type ] = array(
375
+ 0 => '', // Unused. Messages start at index 1.
376
+ /* translators: %s: singular custom post type name */
377
+ 1 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
378
+ /* translators: %s: singular custom post type name */
379
+ 2 => sprintf( __( 'Custom %s updated.', 'cartflows' ), $singular_name ),
380
+ /* translators: %s: singular custom post type name */
381
+ 3 => sprintf( __( 'Custom %s deleted.', 'cartflows' ), $singular_name ),
382
+ /* translators: %s: singular custom post type name */
383
+ 4 => sprintf( __( '%s updated.', 'cartflows' ), $singular_name ),
384
+ /* translators: %1$s: singular custom post type name ,%2$s: date and time of the revision */
385
+ 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,
386
+ /* translators: %s: singular custom post type name */
387
+ 6 => sprintf( __( '%s published.', 'cartflows' ), $singular_name ),
388
+ /* translators: %s: singular custom post type name */
389
+ 7 => sprintf( __( '%s saved.', 'cartflows' ), $singular_name ),
390
+ /* translators: %s: singular custom post type name */
391
+ 8 => sprintf( __( '%s submitted.', 'cartflows' ), $singular_name ),
392
+ /* translators: %s: singular custom post type name */
393
+ 9 => sprintf( __( '%s scheduled for.', 'cartflows' ), $singular_name ),
394
+ /* translators: %s: singular custom post type name */
395
+ 10 => sprintf( __( '%s draft updated.', 'cartflows' ), $singular_name ),
396
+ );
397
+ }
398
+
399
+ return $messages;
400
+ }
401
+
402
+ /**
403
+ * Add Terms for Taxonomy.
404
+ *
405
+ * => Example.
406
+ *
407
+ * $taxonomy = '{taxonomy}';
408
+ * $terms = array(
409
+ * array(
410
+ * 'name' => 'Free',
411
+ * ),
412
+ * array(
413
+ * 'name' => 'Premium',
414
+ * ),
415
+ * );
416
+ *
417
+ * self::add_terms( $taxonomy, $terms );
418
+ *
419
+ * @since 1.0.0
420
+ * @param string $taxonomy Taxonomy Name.
421
+ * @param array $terms Terms list.
422
+ * @return void
423
+ */
424
+ function add_terms( $taxonomy = '', $terms = array() ) {
425
+
426
+ foreach ( $terms as $key => $term ) {
427
+
428
+ $term_exist = term_exists( $term['name'], $taxonomy );
429
+
430
+ if ( empty( $term_exist ) ) {
431
+
432
+ /**
433
+ * Add additional args if passed from request.
434
+ *
435
+ * @see https://codex.wordpress.org/Function_Reference/wp_insert_term
436
+ */
437
+ if ( array_key_exists( 'args', $term ) ) {
438
+ wp_insert_term( $term['name'], $taxonomy, $term['args'] );
439
+ } else {
440
+ wp_insert_term( $term['name'], $taxonomy );
441
+ }
442
+ }
443
+ }
444
+ }
445
+ }
446
+
447
+ /**
448
+ * Kicking this off by calling 'get_instance()' method
449
+ */
450
+ Cartflows_Step_Post_Type::get_instance();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: woocommerce, cart
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.0.2
8
- Stable tag: 1.1.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -13,7 +13,79 @@ Create beautiful checkout pages & sales flows for WooCommerce.
13
 
14
  == Description ==
15
 
16
- Create beautiful checkout pages & sales flows for WooCommerce.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  == Installation ==
19
 
@@ -21,6 +93,11 @@ Create beautiful checkout pages & sales flows for WooCommerce.
21
  2. Activate the plugin through the 'Plugins' menu in WordPress
22
 
23
  == Changelog ==
 
 
 
 
 
24
  Version 1.1.1 - Wednesday, 2nd January 2019
25
  * Improvement: Added compatibility for a future release of CartFlows Pro.
26
  * Improvement: Minor CSS and HTML changes.
5
  Requires at least: 4.4
6
  Requires PHP: 5.6
7
  Tested up to: 5.0.2
8
+ Stable tag: 1.1.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
13
 
14
  == Description ==
15
 
16
+ **#1 Funnel Builder For WordPress**
17
+ ★★★★★<br>
18
+
19
+ **Funnels are the most effective way to sell products & services.** We created <a href="https://cartflows.com" target="_blank">**CartFlows, a WordPress Funnel Builder**</a>, to help every website owner start using funnels to grow their business, generate more reveue, and have full control over their buyers journey.
20
+ ## <center><a href="https://demos.cartflows.com/" target="_blank">Try The Demo</a></center> ##
21
+
22
+ [youtube https://www.youtube.com/watch?v=SlE0moPKjMY]
23
+
24
+ Turn your WooCommerce website into a selling machine using one-click sales funnels with frictionless checkout, custom thank you pages, global checkout replacement, and more…
25
+
26
+ CartFlows is the best and easiest way to sell product and services on your website. With our library of done for you, one-click sales funnels, that literally sell your products and services for you.
27
+
28
+ ## CARTFLOWS IS PERFECT FOR ##
29
+
30
+ * **Selling Online Courses**
31
+ * **Selling Event Tickets**
32
+ * **Selling Services**
33
+ * **Selling Info Product**
34
+ * **Selling Physical Products**
35
+ * **Selling Via Dropshipping**
36
+ * **Selling Anything Really**
37
+
38
+ CartFlows is the perfect <a href="https://cartflows.com/clickfunnels-alternative" target="_blank">ClickFunnels Alternative</a> because its built on the worlds most open platform, WordPress.
39
+
40
+ ### CARTFLOWS GAME-CHANGING FEATURES ###
41
+
42
+ See the features that make CartFlows the **Best Funnel Builder for WordPress**.
43
+
44
+ * **Ready to Import Templates:**
45
+ Choose from a wide variety of high converting templates. You can add a professionally crafted, multistep funnel, with one mouse click or you can build your own funnel and choose individual templates.
46
+
47
+ * **Use Your Page Builder Or Gutenberg:**
48
+ CartFlows will work with all popular page builders including Gutenberg. Initially we will offer templates for Beaver Builder, Elementor with Brizy and Divi coming soon. However you can use CartFlows with your own templates.
49
+
50
+ * **Conversion Tested Checkout:**
51
+ CartFlows replaces your complicated checkout process with our optimized checkout that instantly increases conversions, making you more money.
52
+
53
+ * **Custom Next Step Thank You Pages:**
54
+ Your buyers journey doesnt end after checkout. With CartFlows and our custom thank you page feautre, you can guild your new customer on their next steps.
55
+
56
+ * **WooCommerce Checkout Page Replacement**
57
+ Say goodby to using the same ridgid checkout page that everyone else is using. Create the perfect WooCommerce checkout page and assign it to be the default WooCommerce checkout template.
58
+
59
+ ### Why is CartFlows such a game-changer? ###
60
+
61
+ * **Sales Funnel Tools Are Expensive** — Most sales funnel tools carry a hefty monthly fee from $97 - $297 per month and they are worth every penny because funnels work. With CartFlows you can unleash the power of funnels for free.
62
+
63
+ * **Sales Funnel Tools Are Complicated** — Most sales funnel tools are frustrating to use. You are stuck using their clunky page builer and have to go through an entirely new learnign curve. Who has time for that? With CartFlows you will feel right at home.
64
+
65
+ * **Sales Funnel Tools Are Closed** — Perhaps the worst part of using other funnel builder tools is they are based on a closed platform which limits you in every way. CartFlows is open and sits on top of WordPress and WooCommerce.
66
+
67
+ * **Sales Funnel Tools Lock You In** — We believe in using a platform where everything is on your domain and you control all your data. CartFlows puts you in control and in the drivers seat.
68
+
69
+ ### Who Can Benefit From CartFlows? ###
70
+
71
+ #### CartFlows Funnel Builder Plugin is perfect for: ####
72
+ ✔ Bloggers
73
+ ✔ Course Creators
74
+ ✔ Coaches / Trainers
75
+ ✔ Dropshippers
76
+ ✔ eCommerce Store Owners
77
+ ✔ Niche Sites
78
+ ✔ Businesses
79
+ ✔ Local Businesses
80
+ ✔ Startups
81
+ ✔ Personal Brands
82
+ ✔ Real Estate Agents
83
+ ✔ Artists & Photographers
84
+ ✔ All WordPress Websites
85
+
86
+ ## JOIN THE CARTFLOWS INNER CIRCLE ##
87
+
88
+ **<a href="https://www.facebook.com/groups/cartflows/" target="_blank">JOIN OUR FACEBOOK GROUP COMMUNITY</a>**: Learn the tactics and techniques that other CartFlows users are doing to grow their businesses. Also get exciting insider information on upcoming feature releases.
89
 
90
  == Installation ==
91
 
93
  2. Activate the plugin through the 'Plugins' menu in WordPress
94
 
95
  == Changelog ==
96
+ Version 1.1.2 - Friday, 4th January 2019
97
+ * Fix: Import Cloud Template option not visible in thrive visual editor.
98
+ * Fix: Oceanwp css conflict with checkout layout.
99
+ * Fix: WC error notice in elementor preview mode when Elementor pro is not active/installed.
100
+
101
  Version 1.1.1 - Wednesday, 2nd January 2019
102
  * Improvement: Added compatibility for a future release of CartFlows Pro.
103
  * Improvement: Minor CSS and HTML changes.