ClickFunnels - Version 3.1.1

Version Description

Download this release

Release Info

Developer clickfunnels.com
Plugin Icon 128x128 ClickFunnels
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0 to 3.1.1

Files changed (5) hide show
  1. clickfunnels.php +44 -25
  2. pages/_footer.php +1 -1
  3. pages/edit.php +7 -32
  4. readme.txt +9 -7
  5. uninstall.php +15 -12
clickfunnels.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ClickFunnels
4
  * Plugin URI: https://www.clickfunnels.com
5
  * Description: Connect to your ClickFunnels account with simple authorization key and show any ClickFunnels page as your homepage or as 404 error pages or simply choose any of your pages and make clean URLs to your ClickFunnels pages. Don't have an account? <a target="_blank" href="https://www.clickfunnels.com">Sign up for your 2 week <em>free</em> trial now.</a>
6
- * Version: 3.1.0
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
@@ -12,6 +12,7 @@ define( "CF_API_URL", "https://api.clickfunnels.com/" );
12
  class ClickFunnels {
13
  public function __construct() {
14
  add_action( "init", array( $this, "create_custom_post_type" ) );
 
15
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
16
  add_filter( 'manage_edit-clickfunnels_columns', array( $this, 'add_columns' ) );
17
  add_action( 'save_post', array( $this, 'save_meta' ), 10, 1 );
@@ -54,8 +55,8 @@ class ClickFunnels {
54
  'compare' => '='
55
  );
56
 
57
- $posts = get_posts($query_args);
58
- $cf_page = current($posts);
59
 
60
  if ($cf_page) {
61
  status_header(200);
@@ -191,17 +192,17 @@ class ClickFunnels {
191
  public function save_meta( $post_id ) {
192
  global $_POST;
193
 
194
- if ($_POST['post_type'] != 'clickfunnels') {
195
  return;
196
  }
197
 
198
- $cf_slug = $_POST['cf_slug'];
199
- $cf_page_type = $_POST['cf_page_type'];
200
- $cf_step_id = $_POST['cf_step_id'];
201
- $cf_step_name = $_POST['cf_step_name'];
202
- $cf_funnel_id = $_POST['cf_funnel_id'];
203
- $cf_funnel_name = $_POST['cf_funnel_name'];
204
- $cf_step_url = $_POST['cf_step_url'];
205
 
206
  if (isset($cf_slug)) {
207
  update_post_meta( $post_id, "cf_slug", $cf_slug );
@@ -331,9 +332,7 @@ class ClickFunnels {
331
  }
332
 
333
  public function show_meta_box( $post ) {
334
- ob_start();
335
  include 'pages/edit.php';
336
- echo ob_get_clean();
337
  }
338
 
339
  public function remove_save_box() {
@@ -384,16 +383,32 @@ function clickfunnels_plugin_activated() {
384
  upgrade_existing_posts();
385
  }
386
 
 
 
 
 
 
 
 
 
 
387
  function upgrade_existing_posts() {
 
 
 
 
 
 
388
  $args = array(
389
  'posts_per_page' => -1,
390
- 'post_type' =>'clickfunnels'
 
 
391
  );
392
- $posts = get_posts( $args );
393
-
394
- if (is_array($posts)) {
395
- foreach ($posts as $post) {
396
- $id = $post->ID;
397
  $sep = '{#}';
398
 
399
  $url = get_post_meta($id, 'cf_iframe_url', true);
@@ -410,7 +425,6 @@ function upgrade_existing_posts() {
410
  $page_name = $page_parts[5];
411
  } else {
412
  // Otherwise scour cf_options for the data
413
- $cf_options = get_option( "cf_options" );
414
  if (isset($cf_options)) {
415
  foreach ($cf_options['pages'] as $key => $value) {
416
  $parts = explode($sep, $value);
@@ -428,7 +442,7 @@ function upgrade_existing_posts() {
428
 
429
  // We have all the data we need to create a page
430
  // Homepage/404 set in cf_options will not be upgraded
431
- if ($url && $funnel_id && $funnel_name && $page_name && $slug) {
432
  if (!get_post_meta($id, 'cf_slug', true)){
433
  update_post_meta($id, 'cf_slug', $slug);
434
  }
@@ -447,11 +461,15 @@ function upgrade_existing_posts() {
447
 
448
  $page_type = get_post_meta($id, 'cf_type', true);
449
 
450
- if ($page_type == 'hp') {
451
- update_option( 'clickfunnels_homepage_post_id', $id);
 
 
452
  update_post_meta($id, 'cf_page_type', 'homepage');
453
- } else if ($page_type == 'np') {
454
- update_option( 'clickfunnels_404_post_id', $id);
 
 
455
  update_post_meta($id, 'cf_page_type', '404');
456
  } else {
457
  update_post_meta($id, 'cf_page_type', 'page');
@@ -459,6 +477,7 @@ function upgrade_existing_posts() {
459
  }
460
  }
461
  }
 
462
  }
463
 
464
  register_activation_hook( __FILE__, 'clickfunnels_plugin_activated' );
3
  * Plugin Name: ClickFunnels
4
  * Plugin URI: https://www.clickfunnels.com
5
  * Description: Connect to your ClickFunnels account with simple authorization key and show any ClickFunnels page as your homepage or as 404 error pages or simply choose any of your pages and make clean URLs to your ClickFunnels pages. Don't have an account? <a target="_blank" href="https://www.clickfunnels.com">Sign up for your 2 week <em>free</em> trial now.</a>
6
+ * Version: 3.1.1
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
12
  class ClickFunnels {
13
  public function __construct() {
14
  add_action( "init", array( $this, "create_custom_post_type" ) );
15
+ add_action( 'plugins_loaded', 'upgrade_existing_posts' );
16
  add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
17
  add_filter( 'manage_edit-clickfunnels_columns', array( $this, 'add_columns' ) );
18
  add_action( 'save_post', array( $this, 'save_meta' ), 10, 1 );
55
  'compare' => '='
56
  );
57
 
58
+ $the_posts = get_posts($query_args);
59
+ $cf_page = current($the_posts);
60
 
61
  if ($cf_page) {
62
  status_header(200);
192
  public function save_meta( $post_id ) {
193
  global $_POST;
194
 
195
+ if (@$_POST['post_type'] != 'clickfunnels') {
196
  return;
197
  }
198
 
199
+ $cf_slug = @$_POST['cf_slug'];
200
+ $cf_page_type = @$_POST['cf_page_type'];
201
+ $cf_step_id = @$_POST['cf_step_id'];
202
+ $cf_step_name = @$_POST['cf_step_name'];
203
+ $cf_funnel_id = @$_POST['cf_funnel_id'];
204
+ $cf_funnel_name = @$_POST['cf_funnel_name'];
205
+ $cf_step_url = @$_POST['cf_step_url'];
206
 
207
  if (isset($cf_slug)) {
208
  update_post_meta( $post_id, "cf_slug", $cf_slug );
332
  }
333
 
334
  public function show_meta_box( $post ) {
 
335
  include 'pages/edit.php';
 
336
  }
337
 
338
  public function remove_save_box() {
383
  upgrade_existing_posts();
384
  }
385
 
386
+ function upgrading_clickfunnels_posts() {
387
+ ?>
388
+ <div class="error notice">
389
+ <p>Your Clickfunnels posts have been upgraded to a new version.</p>
390
+ <p>In order to conform to the new format, you may need to recreate your homepage and 404 page manually.</p>
391
+ </div>
392
+ <?php
393
+ }
394
+
395
  function upgrade_existing_posts() {
396
+ if (get_option('clickfunnels_posts_schema_version') == 3) {
397
+ return;
398
+ }
399
+ add_action( 'admin_notices', 'upgrading_clickfunnels_posts' );
400
+
401
+ $cf_options = get_option( "cf_options" );
402
  $args = array(
403
  'posts_per_page' => -1,
404
+ 'post_type' =>'clickfunnels',
405
+ 'post_status' => 'any',
406
+ 'fields' => 'id'
407
  );
408
+ $the_posts = get_posts( $args );
409
+ if (is_array($the_posts)) {
410
+ foreach ($the_posts as $the_post) {
411
+ $id = $the_post->ID;
 
412
  $sep = '{#}';
413
 
414
  $url = get_post_meta($id, 'cf_iframe_url', true);
425
  $page_name = $page_parts[5];
426
  } else {
427
  // Otherwise scour cf_options for the data
 
428
  if (isset($cf_options)) {
429
  foreach ($cf_options['pages'] as $key => $value) {
430
  $parts = explode($sep, $value);
442
 
443
  // We have all the data we need to create a page
444
  // Homepage/404 set in cf_options will not be upgraded
445
+ if ($url && $funnel_id && $slug) {
446
  if (!get_post_meta($id, 'cf_slug', true)){
447
  update_post_meta($id, 'cf_slug', $slug);
448
  }
461
 
462
  $page_type = get_post_meta($id, 'cf_type', true);
463
 
464
+ if ($page_type == 'hp' || $page_type == 'homepage') {
465
+ if (!get_option('clickfunnels_homepage_post_id')) {
466
+ update_option( 'clickfunnels_homepage_post_id', $id);
467
+ }
468
  update_post_meta($id, 'cf_page_type', 'homepage');
469
+ } else if ($page_type == 'np' || $page_type == '404') {
470
+ if (!get_option('clickfunnels_404_post_id')) {
471
+ update_option( 'clickfunnels_404_post_id', $id);
472
+ }
473
  update_post_meta($id, 'cf_page_type', '404');
474
  } else {
475
  update_post_meta($id, 'cf_page_type', 'page');
477
  }
478
  }
479
  }
480
+ update_option('clickfunnels_posts_schema_version', 3);
481
  }
482
 
483
  register_activation_hook( __FILE__, 'clickfunnels_plugin_activated' );
pages/_footer.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="copyrightInfo">
2
- <p><strong style="float: right;font-weight: 600;font-size: 11px;text-align: right;">Running Version 3.1.0</strong> Copyright 2016+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
1
  <div class="copyrightInfo">
2
+ <p><strong style="float: right;font-weight: 600;font-size: 11px;text-align: right;">Running Version 3.1.1</strong> Copyright 2016+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
pages/edit.php CHANGED
@@ -1,14 +1,13 @@
1
  <style>.hndle {display: none !important}</style>
2
  <?php
3
- error_reporting(E_ERROR);
4
  $post_id = get_the_ID();
5
- $cf_page_type = get_post_meta( $_GET['post'], "cf_page_type", true );
6
- $cf_funnel_id = get_post_meta( $_GET['post'], "cf_funnel_id", true );
7
- $cf_funnel_name = get_post_meta( $_GET['post'], "cf_funnel_name", true );
8
- $cf_step_id = get_post_meta( $_GET['post'], "cf_step_id", true );
9
- $cf_step_name = get_post_meta( $_GET['post'], "cf_step_name", true );
10
- $cf_step_url = get_post_meta( $_GET['post'], "cf_step_url", true );
11
- $cf_slug = get_post_meta( $_GET['post'], 'cf_slug', true );
12
  $cf_authorization_email = get_option( 'clickfunnels_api_email' );
13
  $cf_authorization_token = get_option( 'clickfunnels_api_auth' );
14
  $cf_homepage = get_option( "clickfunnels_homepage_post_id" );
@@ -171,30 +170,6 @@
171
 
172
  <link href="<?php echo plugins_url( '../css/font-awesome.css', __FILE__ ); ?>" rel="stylesheet">
173
  <link href="<?php echo plugins_url( '../css/admin.css', __FILE__ ); ?>" rel="stylesheet">
174
- <div style="display: none;font-size: 15px;line-height: 19px;">
175
- <?php
176
- // check all CF page slugs
177
- $posts = get_posts(array(
178
- 'post_type' => 'clickfunnels',
179
- 'post_status' => 'publish',
180
- 'fields' => 'ids'
181
- )
182
- );
183
-
184
- foreach($posts as $p){
185
- $slug = get_post_meta($p,"cf_slug",true);
186
- if ($slug != $cf_slug) {
187
- echo "<li class='used_slug'>$slug</li>";
188
- }
189
- }
190
- foreach( get_posts('numberposts=-1') as $post ) {
191
- echo "<li class='used_slug'>$post->post_name</li>";
192
- }
193
- foreach( get_pages('numberposts=-1') as $post ) {
194
- echo "<li class='used_slug'>$post->post_name</li>";
195
- }
196
- ?>
197
- </div>
198
 
199
  <div id="no-funnels-error" class="badAPI error notice" style="display: none; width: 733px;padding: 10px 12px;font-weight: bold"><i class="fa fa-times" style="margin-right: 5px;"></i>There are no Funnels in your ClickFunnels account! Head over to <a href="https://app.clickfunnels.com/" target="_blank">ClickFunnels</a> to get started!</div>
200
 
1
  <style>.hndle {display: none !important}</style>
2
  <?php
 
3
  $post_id = get_the_ID();
4
+ $cf_page_type = get_post_meta( @$_GET['post'], "cf_page_type", true );
5
+ $cf_funnel_id = get_post_meta( @$_GET['post'], "cf_funnel_id", true );
6
+ $cf_funnel_name = get_post_meta( @$_GET['post'], "cf_funnel_name", true );
7
+ $cf_step_id = get_post_meta( @$_GET['post'], "cf_step_id", true );
8
+ $cf_step_name = get_post_meta( @$_GET['post'], "cf_step_name", true );
9
+ $cf_step_url = get_post_meta( @$_GET['post'], "cf_step_url", true );
10
+ $cf_slug = get_post_meta( @$_GET['post'], 'cf_slug', true );
11
  $cf_authorization_email = get_option( 'clickfunnels_api_email' );
12
  $cf_authorization_token = get_option( 'clickfunnels_api_auth' );
13
  $cf_homepage = get_option( "clickfunnels_homepage_post_id" );
170
 
171
  <link href="<?php echo plugins_url( '../css/font-awesome.css', __FILE__ ); ?>" rel="stylesheet">
172
  <link href="<?php echo plugins_url( '../css/admin.css', __FILE__ ); ?>" rel="stylesheet">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  <div id="no-funnels-error" class="badAPI error notice" style="display: none; width: 733px;padding: 10px 12px;font-weight: bold"><i class="fa fa-times" style="margin-right: 5px;"></i>There are no Funnels in your ClickFunnels account! Head over to <a href="https://app.clickfunnels.com/" target="_blank">ClickFunnels</a> to get started!</div>
175
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Author URI: https://profiles.wordpress.org/clickfunnelscom
6
  Tags: landing pages, clickfunnels, funnels, sales funnel, optin, internet marketing
7
  Requires at least: 4.3
8
  Tested up to: 4.5.2
9
- Stable tag: 3.1.0
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
@@ -88,18 +88,19 @@ To set a page to show as the home page just select any of your ClickFunnels page
88
 
89
  **Yes.** A clickfunnels account is required to use this plugin. If you are not already a member you can sign up for your account and transform the way you run your online business.
90
 
91
- = Special Characters Displaying Incorrectly? =
92
 
93
- The error for displaying special characters incorrectly has been fixed for all newly created pages.
94
-
95
- For older pages you will need to open the page in the editor and hit save. Or you can re-select your page in the WordPress plugin. Screenshot here: http://cl.ly/0n2H0v220e1U
96
-
97
- By re-selecting the page it will ping the server which should refresh your page.
98
 
99
  == Changelog ==
100
 
101
  Stay current with the latest version of the plugin:
102
 
 
 
 
 
 
103
  = Version 3.1.0 =
104
 
105
  * Adds option to download page content instead of displaying it in an iframe
@@ -124,6 +125,7 @@ Stay current with the latest version of the plugin:
124
  = Version 3.0.1 =
125
 
126
  * Leaner, meaner, more productive wordpress plugin
 
127
 
128
  = Version 2.0.10 =
129
 
6
  Tags: landing pages, clickfunnels, funnels, sales funnel, optin, internet marketing
7
  Requires at least: 4.3
8
  Tested up to: 4.5.2
9
+ Stable tag: 3.1.1
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
88
 
89
  **Yes.** A clickfunnels account is required to use this plugin. If you are not already a member you can sign up for your account and transform the way you run your online business.
90
 
91
+ = Blank Pages? =
92
 
93
+ The version 3 upgrade changed the structure of how we store pages. Bugs in previous versions made this a difficult transition. New pages store all their data in a much more reliable format. Pages created before this had to be upgraded, but all the data we want for them might not have been present. You may need to edit and resave old pages to get them working again.
 
 
 
 
94
 
95
  == Changelog ==
96
 
97
  Stay current with the latest version of the plugin:
98
 
99
+ = Version 3.1.1 =
100
+
101
+ * More efficient queries to support more hosting environments
102
+ * Automatically upgrade posts, rather than require an activation/deactivation cycle.
103
+
104
  = Version 3.1.0 =
105
 
106
  * Adds option to download page content instead of displaying it in an iframe
125
  = Version 3.0.1 =
126
 
127
  * Leaner, meaner, more productive wordpress plugin
128
+ * Support A/B testing
129
 
130
  = Version 2.0.10 =
131
 
uninstall.php CHANGED
@@ -1,16 +1,19 @@
1
  <?php
2
- $args = array(
3
- 'posts_per_page' => -1,
4
- 'post_type' =>'clickfunnels'
5
- );
6
- $posts = get_posts( $args );
7
- $total = count($posts);
8
- $current = 0;
9
- if (is_array($posts) && $total) {
10
- foreach ($posts as $post) {
11
- wp_delete_post( $post->ID, true);
12
- }
13
- }
 
 
 
14
  delete_option('clickfunnels_api_email');
15
  delete_option('clickfunnels_api_auth');
16
  delete_option('clickfunnels_display_method');
1
  <?php
2
+ // Don't delete posts, this was causing issues where people wanted to be able to
3
+ // Uninstall and reinstall. Reset data is available for a true uninstall
4
+
5
+ // $args = array(
6
+ // 'posts_per_page' => -1,
7
+ // 'post_type' =>'clickfunnels'
8
+ // );
9
+ // $posts = get_posts( $args );
10
+ // $total = count($posts);
11
+ // $current = 0;
12
+ // if (is_array($posts) && $total) {
13
+ // foreach ($posts as $post) {
14
+ // wp_delete_post( $post->ID, true);
15
+ // }
16
+ // }
17
  delete_option('clickfunnels_api_email');
18
  delete_option('clickfunnels_api_auth');
19
  delete_option('clickfunnels_display_method');