ClickFunnels - Version 3.1.0

Version Description

Download this release

Release Info

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

Code changes from version 3.0.6 to 3.1.0

Files changed (5) hide show
  1. clickfunnels.php +52 -8
  2. pages/_footer.php +1 -1
  3. pages/edit.php +1 -1
  4. pages/settings.php +3 -2
  5. readme.txt +6 -1
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.0.6
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
@@ -28,7 +28,7 @@ class ClickFunnels {
28
 
29
  // Let's see if we should do anything about this page request
30
  public function process_page_request() {
31
- if (is_home()) {
32
  if ($this->get_home()) {
33
  status_header(200);
34
  $this->show_post( $this->get_home() );
@@ -55,7 +55,7 @@ class ClickFunnels {
55
  );
56
 
57
  $posts = get_posts($query_args);
58
- $cf_page = $posts[0];
59
 
60
  if ($cf_page) {
61
  status_header(200);
@@ -79,18 +79,62 @@ class ClickFunnels {
79
  $url = get_post_meta( $post_id, "cf_step_url", true );
80
  $method = get_option('clickfunnels_display_method');
81
 
82
- if ($method == 'iframe') {
83
- echo $this->get_page_iframe( $url );
 
 
84
  } else if ($method == 'redirect') {
85
- wp_redirect( $url, 301 );
86
  }
87
 
88
  exit();
89
  }
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  public function get_page_iframe( $cf_step_url ) {
92
  if (has_site_icon() && (get_option('clickfunnels_favicon_method') == 'wordpress')) {
93
  $favicon = '<link class="wp_favicon" href="'.get_site_icon_url().'" rel="shortcut icon"/>';
 
 
94
  }
95
 
96
  $additional_snippet = html_entity_decode(stripslashes(get_option('clickfunnels_additional_snippet')));
@@ -313,7 +357,7 @@ class ClickFunnels {
313
  'view_item' => __( 'View Click Funnels Pages' ),
314
  'search_items' => __( 'Search Click Funnels' ),
315
  'not_found' => __( 'No Funnels Yet <br>
316
- <a href="/wp-admin/post-new.php?post_type=clickfunnels">add a new page</a> or <a href="/wp-admin/edit.php?post_type=clickfunnels&page=cf_api/">finish plugin set-up</a>' ),
317
  'parent_item_colon' => '',
318
  'hide_post_row_actions' => array('trash', 'edit' ,'quick-edit')
319
  );
@@ -335,7 +379,7 @@ class ClickFunnels {
335
 
336
  function clickfunnels_plugin_activated() {
337
  if (!get_option('clickfunnels_display_method')) {
338
- update_option('clickfunnels_display_method', 'iframe');
339
  }
340
  upgrade_existing_posts();
341
  }
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
  */
28
 
29
  // Let's see if we should do anything about this page request
30
  public function process_page_request() {
31
+ if (is_front_page()) {
32
  if ($this->get_home()) {
33
  status_header(200);
34
  $this->show_post( $this->get_home() );
55
  );
56
 
57
  $posts = get_posts($query_args);
58
+ $cf_page = current($posts);
59
 
60
  if ($cf_page) {
61
  status_header(200);
79
  $url = get_post_meta( $post_id, "cf_step_url", true );
80
  $method = get_option('clickfunnels_display_method');
81
 
82
+ if ($method == 'download') {
83
+ echo $this->get_page_content($url);
84
+ } else if ($method == 'iframe') {
85
+ echo $this->get_page_iframe($url);
86
  } else if ($method == 'redirect') {
87
+ wp_redirect($url, 301);
88
  }
89
 
90
  exit();
91
  }
92
 
93
+ public function get_page_content( $url ) {
94
+ $ch = curl_init();
95
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
96
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
97
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
98
+ curl_setopt($ch, CURLOPT_HEADER, 1);
99
+
100
+ // Forward current cookies to curl
101
+ $cookies = array();
102
+ foreach ($_COOKIE as $key => $value) {
103
+ if ($key != 'Array') {
104
+ $cookies[] = $key . '=' . $value;
105
+ }
106
+ }
107
+ curl_setopt( $ch, CURLOPT_COOKIE, implode(';', $cookies) );
108
+
109
+ $destination = $url;
110
+
111
+ while ($destination) {
112
+ session_write_close();
113
+ curl_setopt($ch, CURLOPT_URL, $destination);
114
+ $response = curl_exec($ch);
115
+ $curl_info = curl_getinfo($ch);
116
+ $destination = $curl_info["redirect_url"];
117
+ session_start();
118
+ }
119
+ curl_close($ch);
120
+
121
+ $headers = substr($response, 0, $curl_info["header_size"]);
122
+ $body = substr($response, $curl_info["header_size"]);
123
+
124
+ // Extract cookies from curl and forward them to browser
125
+ preg_match_all('/^(Set-Cookie:\s*[^\n]*)$/mi', $headers, $cookies);
126
+ foreach($cookies[0] AS $cookie) {
127
+ header($cookie, false);
128
+ }
129
+
130
+ return $body;
131
+ }
132
+
133
  public function get_page_iframe( $cf_step_url ) {
134
  if (has_site_icon() && (get_option('clickfunnels_favicon_method') == 'wordpress')) {
135
  $favicon = '<link class="wp_favicon" href="'.get_site_icon_url().'" rel="shortcut icon"/>';
136
+ } else {
137
+ $favicon = '';
138
  }
139
 
140
  $additional_snippet = html_entity_decode(stripslashes(get_option('clickfunnels_additional_snippet')));
357
  'view_item' => __( 'View Click Funnels Pages' ),
358
  'search_items' => __( 'Search Click Funnels' ),
359
  'not_found' => __( 'No Funnels Yet <br>
360
+ <a href="'.get_admin_url().'post-new.php?post_type=clickfunnels">add a new page</a> or <a href="'.get_admin_url().'edit.php?post_type=clickfunnels&page=cf_api/">finish plugin set-up</a>' ),
361
  'parent_item_colon' => '',
362
  'hide_post_row_actions' => array('trash', 'edit' ,'quick-edit')
363
  );
379
 
380
  function clickfunnels_plugin_activated() {
381
  if (!get_option('clickfunnels_display_method')) {
382
+ update_option('clickfunnels_display_method', 'download');
383
  }
384
  upgrade_existing_posts();
385
  }
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.0.6</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.0</strong> Copyright 2016+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
pages/edit.php CHANGED
@@ -220,7 +220,7 @@
220
 
221
  <?php if ( $cf_authorization_email == "" || $cf_authorization_token == "" ) { ?>
222
  <div class="noAPI">
223
- <h4>You haven't setup your API settings. <a href="../wp-admin/edit.php?post_type=clickfunnels&page=cf_api">Click here to setup now.</a></h4>
224
  </div>
225
  <?php } else { ?>
226
 
220
 
221
  <?php if ( $cf_authorization_email == "" || $cf_authorization_token == "" ) { ?>
222
  <div class="noAPI">
223
+ <h4>You haven't setup your API settings. <a href="<?php echo get_admin_url() ?>edit.php?post_type=clickfunnels&page=cf_api">Click here to setup now.</a></h4>
224
  </div>
225
  <?php } else { ?>
226
 
pages/settings.php CHANGED
@@ -69,6 +69,7 @@
69
  <label class="control-label" for="clickfunnels_display_method">Page Display Method:</span> </label>
70
  <div class="controls" style="padding-left: 24px;margin-bottom: 16px;">
71
  <select name="clickfunnels_display_method" id="clickfunnels_display_method" class="input-xlarge" style="height: 30px;">
 
72
  <option value="iframe" <?php if (get_option('clickfunnels_display_method') == 'iframe') { echo "selected";}?>>Embed Full Page iFrame</option>
73
  <option value="redirect" <?php if (get_option('clickfunnels_display_method') == 'redirect') { echo "selected";}?>>Redirect to Clickfunnels</option>
74
  </select>
@@ -88,7 +89,7 @@
88
  <div class="controls" style="padding-left: 24px;margin-bottom: 16px;">
89
  <textarea class="input-xlarge" name="clickfunnels_additional_snippet"><?php echo html_entity_decode(stripslashes(get_option( 'clickfunnels_additional_snippet' ))); ?></textarea>
90
  </div>
91
- <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i>Additional tracking code to be put on full page iFrame embeds</p>
92
  </div>
93
  <button class="action-button shadow animate green" id="publish" style="float: right;margin-top: 10px;"><i class="fa fa-check-circle"></i> Save Settings</button>
94
  </div>
@@ -152,4 +153,4 @@
152
  </div>
153
  </form>
154
  <?php include('_footer.php'); ?>
155
- </div>
69
  <label class="control-label" for="clickfunnels_display_method">Page Display Method:</span> </label>
70
  <div class="controls" style="padding-left: 24px;margin-bottom: 16px;">
71
  <select name="clickfunnels_display_method" id="clickfunnels_display_method" class="input-xlarge" style="height: 30px;">
72
+ <option value="download" <?php if (get_option('clickfunnels_display_method') == 'iframe') { echo "selected";}?>>Download &amp; Display</option>
73
  <option value="iframe" <?php if (get_option('clickfunnels_display_method') == 'iframe') { echo "selected";}?>>Embed Full Page iFrame</option>
74
  <option value="redirect" <?php if (get_option('clickfunnels_display_method') == 'redirect') { echo "selected";}?>>Redirect to Clickfunnels</option>
75
  </select>
89
  <div class="controls" style="padding-left: 24px;margin-bottom: 16px;">
90
  <textarea class="input-xlarge" name="clickfunnels_additional_snippet"><?php echo html_entity_decode(stripslashes(get_option( 'clickfunnels_additional_snippet' ))); ?></textarea>
91
  </div>
92
+ <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i>Additional tracking code to be put on full page iFrame embeds only</p>
93
  </div>
94
  <button class="action-button shadow animate green" id="publish" style="float: right;margin-top: 10px;"><i class="fa fa-check-circle"></i> Save Settings</button>
95
  </div>
153
  </div>
154
  </form>
155
  <?php include('_footer.php'); ?>
156
+ </div>
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.0.6
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
@@ -100,6 +100,11 @@ By re-selecting the page it will ping the server which should refresh your page.
100
 
101
  Stay current with the latest version of the plugin:
102
 
 
 
 
 
 
103
  = Version 3.0.6 =
104
 
105
  * Fix upgrading if metadata was not properly saved in version 2
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
 
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
106
+ * Fix setting of homepage issue
107
+
108
  = Version 3.0.6 =
109
 
110
  * Fix upgrading if metadata was not properly saved in version 2