ClickFunnels - Version 1.1.2

Version Description

Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

Files changed (6) hide show
  1. CF_API.php +12 -4
  2. admin.php +1 -1
  3. clickfunnels.php +9 -7
  4. footer.php +1 -1
  5. geobg.png +0 -0
  6. readme.txt +6 -1
CF_API.php CHANGED
@@ -17,7 +17,7 @@ class CF_API {
17
  }
18
  return $funnels;
19
  }
20
- public function get_page_html( $funnel_id, $position = 0, $meta = "", $title = "", $desc = "", $social = "", $cf_iframe_url = "", $slug = "", $pageid = "" ) {
21
  global $wp_query;
22
  if ($wp_query->is_404) {
23
  $wp_query->is_404 = false;
@@ -30,6 +30,10 @@ class CF_API {
30
  // $position = $splittestkeys[array_rand($splittestkeys)];
31
  // }
32
 
 
 
 
 
33
  $newHTML = '<!DOCTYPE html>
34
  <html>
35
  <head>
@@ -40,7 +44,7 @@ $newHTML = '<!DOCTYPE html>
40
  <meta content="'.$title.'" property="og:title">
41
  <meta content="'.$desc.'" property="og:description">
42
  <meta content="'.$social.'" property="og:image">
43
- <meta property="og:url" content="'.get_option('clickfunnels_siteURL').'/'.get_post_meta( $pageid, "cf_slug" )[0].'">
44
  <meta property="og:type" content="website">
45
  <style>#IntercomDefaultWidget{display:none;}#Intercom{display:none;}</style>
46
  <meta name="nodo-proxy" content="html">
@@ -77,7 +81,7 @@ $newHTML = '<!DOCTYPE html>
77
  return $newHTML;
78
  }
79
 
80
- public function get_page_iframe( $cf_iframe_url, $meta = "", $title = "", $desc = "", $social = "", $pageid = "" ) {
81
  global $wp_query;
82
  if ($wp_query->is_404) {
83
  $wp_query->is_404 = false;
@@ -88,6 +92,10 @@ $newHTML = '<!DOCTYPE html>
88
  // $pageid = $cf_iframe_url;
89
  // }
90
 
 
 
 
 
91
  $iframeVersion = '<!DOCTYPE html>
92
  <html>
93
  <head>
@@ -98,7 +106,7 @@ $iframeVersion = '<!DOCTYPE html>
98
  <meta content="'.$title.'" property="og:title">
99
  <meta content="'.$desc.'" property="og:description">
100
  <meta content="'.$social.'" property="og:image">
101
- <meta property="og:url" content="'.get_option('clickfunnels_siteURL').'/'.get_post_meta( $pageid, "cf_slug" )[0].'">
102
  <meta property="og:type" content="website">
103
  <style>
104
  * {
17
  }
18
  return $funnels;
19
  }
20
+ public function get_page_html( $funnel_id, $position = 0, $meta = "", $title = "", $desc = "", $social = "", $cf_iframe_url = "", $pageid = "",$slug = "" ) {
21
  global $wp_query;
22
  if ($wp_query->is_404) {
23
  $wp_query->is_404 = false;
30
  // $position = $splittestkeys[array_rand($splittestkeys)];
31
  // }
32
 
33
+ if($slug == '') {
34
+ $slug = $cf_iframe_url;
35
+ }
36
+
37
  $newHTML = '<!DOCTYPE html>
38
  <html>
39
  <head>
44
  <meta content="'.$title.'" property="og:title">
45
  <meta content="'.$desc.'" property="og:description">
46
  <meta content="'.$social.'" property="og:image">
47
+ <meta property="og:url" content="'.$slug.'">
48
  <meta property="og:type" content="website">
49
  <style>#IntercomDefaultWidget{display:none;}#Intercom{display:none;}</style>
50
  <meta name="nodo-proxy" content="html">
81
  return $newHTML;
82
  }
83
 
84
+ public function get_page_iframe( $cf_iframe_url, $meta = "", $title = "", $desc = "", $social = "", $pageid = "",$slug = "" ) {
85
  global $wp_query;
86
  if ($wp_query->is_404) {
87
  $wp_query->is_404 = false;
92
  // $pageid = $cf_iframe_url;
93
  // }
94
 
95
+ if($slug == '') {
96
+ $slug = $cf_iframe_url;
97
+ }
98
+
99
  $iframeVersion = '<!DOCTYPE html>
100
  <html>
101
  <head>
106
  <meta content="'.$title.'" property="og:title">
107
  <meta content="'.$desc.'" property="og:description">
108
  <meta content="'.$social.'" property="og:image">
109
+ <meta property="og:url" content="'.$slug.'">
110
  <meta property="og:type" content="website">
111
  <style>
112
  * {
admin.php CHANGED
@@ -1 +1 @@
1
-
2
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
3
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
4
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
5
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
6
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
7
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
8
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
9
 
10
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
11
  $thepage = explode( "{#}", $cf_page );
12
  $savedData = $cf_page;
13
  }
14
  else {
15
  $thepage = explode( "{#}", $cf_page['page_id'] );
16
  $savedData = $cf_page['page_id'];
17
  }
18
  $cf_options = get_option( "cf_options" );
19
  jQuery(document).ready(function(){
20
  // Set Correct Options
21
  var thefunnel = jQuery('#cf_thefunnel').val();
22
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
23
  jQuery('#cf_thepage').find('option').remove().end();
24
  jQuery('#loading').fadeIn();
25
  jQuery.getJSON(specificFunnel, function(data) {
26
  setTimeout(function() {
27
  jQuery('#loading').fadeOut();
28
  }, 2000);
29
  var is_selected = "";
30
  jQuery.each(data.funnel_steps, function() {
31
  if (this.pages != ''){
32
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
33
  is_selected = "selected";
34
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
35
  } else {
36
  is_selected = "";
37
  }
38
  if ( this.wp_friendly == true && this.pages != '' ) {
39
  var baseurl = this.pages[0].published_url.split('.com/');
40
  var baseurlnew = baseurl[0]+'.com/'+this.path;
41
  jQuery('#iframeURL').val(baseurlnew);
42
  // Check if has split tests
43
  var splittestkeys = 'none';
44
  // if (this.pages.length == 2) {
45
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key;
46
  // }
47
  // else if (this.pages.length == 3) {
48
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key+ '{|}' + this.pages[2].key;
49
  // }
50
 
51
  pageKey = this.pages[0].key;
52
 
53
  jQuery('#cf_thepage').append('<option value="' + pageKey + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'" '+is_selected+'>'+ this.name +'</option>');
54
  }
55
  }
56
  });
57
  }).done(function() {
58
  jQuery('#loading').fadeOut();
59
  var savedMeta = jQuery('#cf_thepage').val();
60
  if(savedMeta != undefined || savedMeta != null){
61
  savedMeta = savedMeta.split('{#}');
62
  jQuery('#jsmeta').val(savedMeta[3]);
63
  <?php if ( !empty( $_GET['action'] ) ) { ?>
64
  if (savedMeta[3] != jQuery('#oldmeta').val()){
65
  jQuery('#metaalreadyupdated').hide();
66
  jQuery('#showupdatemetalink').show();
67
  }
68
  <?php } ?>
69
  }
70
  <?php if ( empty( $_GET['action'] ) ) { ?>
71
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
72
  <?php } ?>
73
  })
74
  .fail(function() {
75
  jQuery('#loading').fadeOut();
76
  })
77
  .always(function() {
78
  jQuery('#loading').fadeOut();
79
  });
80
  // Change Funnel Populate Dropdown
81
  jQuery( '#cf_thefunnel' ).change(function() {
82
  jQuery('#loading').fadeIn();
83
  var thefunnel = jQuery(this).val();
84
  var totalPages = 0;
85
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
86
  jQuery('#cf_thepage').find('option').remove().end();
87
  jQuery.getJSON(specificFunnel, function(data) {
88
  setTimeout(function() {
89
  jQuery('#loading').fadeOut();
90
  }, 2000);
91
  // alert( specificFunnel);
92
  jQuery.each(data.funnel_steps, function() {
93
  if( this.wp_friendly == true && this.pages != '' ) {
94
  if (this.pages.length > 1) {
95
  jQuery('#usingSplitTests').show();
96
  } else {
97
  jQuery('#usingSplitTests').hide();
98
  }
99
 
100
  var baseurl = this.pages[0].published_url.split('.com/');
101
  var baseurlnew = baseurl[0]+'.com/'+this.path;
102
  jQuery('#iframeURL').val(baseurlnew);
103
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'">'+ this.name +'</option>');
104
 
105
 
106
  totalPages += 1;
107
  }
108
  });
109
 
110
  }).done(function() {
111
  jQuery('#loading').fadeOut();
112
  var savedMeta = jQuery('#cf_thepage').val();
113
  if(savedMeta != undefined || savedMeta != null){
114
  savedMeta = savedMeta.split('{#}');
115
  jQuery('#previewiframe').attr('src', savedMeta[6]+'?preview=true');
116
  }
117
  jQuery('#cf_thepage').trigger('change');
118
 
119
  if (totalPages == 0) {
120
  jQuery('#noPageWarning').fadeIn();
121
  jQuery('#cf_thepage').fadeOut();
122
  }
123
  else {
124
  jQuery('#noPageWarning').hide();
125
  jQuery('#cf_thepage').fadeIn();
126
  }
127
  var theposition = jQuery('#cf_thepage').val();
128
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
129
  var myString = thefunnel+'{#}'+theposition;
130
  var arr = myString.split('{#}');
131
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
132
  var do_ping = function() {
133
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
134
  }).catch(function(error) {
135
  });
136
  };
137
  do_ping();
138
  })
139
  .fail(function() {
140
  jQuery('#loading').fadeOut();
141
  })
142
  .always(function() {
143
  jQuery('#loading').fadeOut();
144
  });
145
  setTimeout(function() {
146
 
147
  }, 3000);
148
 
149
  });
150
  var request_image = function(url) {
151
  return new Promise(function(resolve, reject) {
152
  var img = new Image();
153
  img.onload = function() { resolve(img); };
154
  img.onerror = function() { reject(url); };
155
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
156
  });
157
  };
158
  /**
159
  * Pings a url.
160
  * @param {String} url
161
  * @return {Promise} promise that resolves to a ping (ms, float).
162
  */
163
  var ping = function(url) {
164
  return new Promise(function(resolve, reject) {
165
  var start = (new Date()).getTime();
166
  var response = function() {
167
  var delta = ((new Date()).getTime() - start);
168
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
169
  delta /= 4;
170
  resolve(delta);
171
  };
172
  request_image(url).then(response).catch(response);
173
  // Set a timeout for max-pings, 5s.
174
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
175
  });
176
  };
177
  function replaceText(inputText, tagName, tagReplace) {
178
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
179
  return inputText.replace(regExp, tagReplace);
180
  }
181
  // Select New Page
182
  jQuery( '#cf_thepage' ).change(function() {
183
  jQuery('#loading').fadeOut();
184
  var thefunnel = jQuery('#cf_thefunnel').val();
185
  var theposition = jQuery(this).val();
186
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
187
  if(theposition != undefined || theposition != null){
188
  var myString = thefunnel+'{#}'+theposition;
189
  var arr = myString.split('{#}');
190
  var arr2 = theposition.split('{#}');
191
  // Iframe
192
  jQuery('#iframeURL').val(arr2[6]);
193
  var myStr = arr2[3];
194
  // Browser title
195
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
196
 
197
  jQuery('#seoTitle').val(subStr[1].replace(/%20/g, ' '));
198
 
199
  // SEO Desc
200
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
201
  jQuery('#seoDesc').val(subStr[1].replace(/%20/g, ' '));
202
  // SEO Share Image
203
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
204
  jQuery('#seosocial').val(subStr[1]);
205
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
206
  var do_ping = function() {
207
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
208
  }).catch(function(error) {
209
  });
210
  };
211
  do_ping();
212
  jQuery('#previewiframe').attr('src', arr[7]+'?preview=true');
213
  }
214
 
215
  });
216
  // Fade Out Message
217
  setTimeout(function() {
218
  jQuery('#message').fadeOut();
219
  }, 3500);
220
  // Savings
221
  jQuery('#publish').click(function() {
222
  jQuery('#saving').fadeIn();
223
  });
224
  jQuery('#delete').on('click', function () {
225
  return confirm('Are you sure you want to delete this page?');
226
  });
227
  jQuery('#cf_slug').bind('keyup keypress blur', function()
228
  {
229
  var myStr = jQuery(this).val()
230
  myStr=myStr.toLowerCase();
231
  myStr=myStr.replace(/\s/g , "-");
232
  jQuery('#cf_slug').val(myStr);
233
  });
234
  // Check Null and Resave v1.0.6
235
  <?php if ($thepage[1] == 'null') { ?>
236
  // jQuery('#autosaving').fadeIn();
237
  // setTimeout(function() {
238
  // jQuery('form').submit();
239
  // }, 2000);
240
  <?php } ?>
241
  jQuery('#showupdatemetalink').click(function() {
242
  jQuery('form').submit();
243
  });
244
 
245
  });
246
  if ( $cf_page != "" ) {
247
  $json = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ) );
248
  $cf_funnels_pages = json_decode( $json );
249
  }
250
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
251
  <h2>Saving and Reloading...</h2>
252
  <h1><i class="fa fa-cog fa-spin"></i></h1>
253
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
254
  <a href="https://www.app.clickfunnels.com/funnels" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
255
  <br clear="all">
256
  <?php if ( !empty( $_GET['action'] ) ) { ?>
257
  <?php if ( $cf_type=='p' ) {?>
258
  <a style="margin-right: -3px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Open Editor</a>
259
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> View Funnel</a>
260
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> Preview</a>
261
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
262
  <?php if ( $cf_thefunnel == $funnel->id ) { if(strlen($funnel->name) > 30) { echo substr($funnel->name,0,30).'...'; } else { echo $funnel->name;} } } ?></h2>
263
 
264
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank"> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?></a>
265
  <?php }?>
266
  <?php if ( $cf_type=='hp' ) {?>
267
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
268
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
269
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
270
  <h2>Set as Home Page</h2>
271
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?></a>
272
  <?php }?>
273
  <?php if ( $cf_type=='np' ) {?>
274
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
275
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
276
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>/invalid-url-404-testing" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
277
  <h2>Set as 404 Page</h2>
278
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url</a>
279
  <?php }?>
280
  <?php if ( $cf_type=='' ) {?>
281
  <h2>Page Undefined - Try saving your page again.</h2>
282
  <?php }?>
283
  <?php if ( $cf_type=='noapi' ) {?>
284
  <h2>No API Fallback</h2>
285
  <?php }?>
286
  <?php } else { ?>
287
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
288
  <?php } ?>
289
  <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>
290
  <iframe src="<?php echo $cf_iframe_url; ?>" style="width: 1280px;height: 750px;-ms-zoom: 0.20; -moz-transform: scale(0.20); -moz-transform-origin: 0 0; -o-transform: scale(0.20); -o-transform-origin: 0 0; -webkit-transform: scale(0.20); -webkit-transform-origin: 0 0;" frameborder="0" id="previewiframe"></iframe>
291
  </div> -->
292
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
293
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
294
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
295
  <div class="row-fluid form-horizontal">
296
  <br>
297
  <a style="float: right;position:relative;z-index: 999999;margin-right: 8px" class="btn pageSettings">Page Settings</a>
298
 
299
  <div class="control-group" style="margin-left: -10px; margin-bottom: 20px !important">
300
  <div data-target="cf_type" class="btn-group multichoice cf_header">
301
  <a data-value="p" class="btn <?php if ( $cf_type=='p' || $cf_type=='') {?> active btn-selected<?php }?>">Regular Page</a>
302
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
303
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
304
  <!-- <a data-value="shortcode" class="btn <?php if ( $cf_type=='shortcode' ) {?> active btn-selected<?php }?>">Shortcode</a> -->
305
  </div>
306
  <input type="hidden" id="cf_type" name="cf_type"/>
307
  </div>
308
  <div class="control-group cf_uses_api" style="">
309
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-filter"></i></label>
310
  <div class="controls">
311
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
312
  <?php if ( empty( $cf_funnels ) ) { ?>
313
  <option value="0">No Funnels Found</option>
314
  <?php }
315
  else {
316
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
317
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
318
  <?php
319
  }
320
  } ?>
321
  </select>
322
  </div>
323
  </div>
324
  <div id="usingSplitTests" style="display: none">
325
  Using split tests
326
  </div>
327
  <div class="control-group cf_uses_api">
328
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
329
  <div class="controls">
330
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
331
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
332
  <option value="0">No Pages Found</option>
333
  <?php }
334
  else {
335
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
336
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
337
  <?php
338
  }
339
  }
340
  ?>
341
  </select>
342
  <i class="fa fa-spinner fa-spin" id="loading"></i>
343
  </div>
344
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;margin-top: -33px;float: left;padding-top: 10px;display: none;width: 100%; clear: both"><em>No compatible pages found for this funnel.</em></div>
345
  </div>
346
  <div class="control-group cf_no_api" >
347
  <label class="control-label" for="cf_iframe_check"> ClickFunnels URL <i class="fa fa-globe"></i></label>
348
  <div class="controls">
349
  <input type="text" class="input-xlarge" id="iframeURL" style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
350
  </div>
351
  </div>
352
  <div class="control-group cf_no_api" >
353
  <label class="control-label" for="cf_iframe_check"> Website Title <i class="fa fa-globe"></i></label>
354
  <div class="controls">
355
  <input type="text" class="input-xlarge" id="seoTitle" style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
356
  </div>
357
  </div>
358
  <div class="control-group cf_no_api" >
359
  <label class="control-label" for="cf_iframe_check"> Description <i class="fa fa-globe"></i></label>
360
  <div class="controls">
361
  <input type="text" class="input-xlarge" id="seoDesc" style="height: 30px;" value="<?php echo $cf_seo_desc; ?>" name="cf_seo_desc" />
362
  </div>
363
  </div>
364
  <div class="control-group cf_no_api" >
365
  <label class="control-label" for="cf_iframe_check"> Social Image URL <i class="fa fa-globe"></i></label>
366
  <div class="controls">
367
  <input type="text" class="input-xlarge" id="seosocial" style="height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
368
  </div>
369
  </div>
370
 
371
 
372
  <div class="control-group cf_uses_api" >
373
  <label class="control-label" for="cf_iframe_check"> Cookie Split Tests <i class="fa fa-bar-chart"></i></label>
374
  <div class="controls">
375
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
376
  <option value="off">Show random cookied version</option>
377
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Show page in iframe (don't cookie)</option>
378
  </select>
379
  <!-- <small style="float: left;font-size: 11px;padding: 5px;margin-left: 6px"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">What is this?</a></small> -->
380
  </div>
381
  </div>
382
  <?php if ( !empty( $_GET['action'] ) ) { ?>
383
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
384
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
385
  <a href="#" style="margin-left: 20px;margin-top: 5px;display: block;float: left;display: none" id="showupdatemetalink"><i class="fa fa-refresh"></i> Meta Data is Out Dated -- Click to Update</a>
386
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
387
  </div>
388
  <?php } else { ?>
389
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
390
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
391
 
392
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
393
  </div>
394
  <?php } ?>
395
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
396
  <div class="cf_url control-group" style="<?php echo $display;?>" >
397
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-globe"></i></label>
398
  <div id="cf-wp-path" class="controls ">
399
  <div class="input-prepend">
400
  <span class="add-on" style="font-size: 13px;padding: 4px 10px; background: #ECEEEF; color: #777; text-shadow: none; border: 1px solid #ccc"><?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/</span><input style="height:28px;width: 150px !important" type="textbox" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" name="cf_slug" id="cf_slug" class="input-xlarge">
401
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
402
  </div>
403
  </div>
404
  </div>
405
 
406
 
407
 
408
  <style>
409
  #hiddenStuff {display: none}
410
  </style>
411
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block" <?php } ?>>
412
  <div class="controls">
413
  <strong>Funnel ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[0]; ?>" /> <br></strong>
414
  <strong>Page Key: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[1]; ?>" /><br></strong>
415
  <strong>Page ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[2]; ?>" /><br></strong>
416
  <strong>Funnel Step ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[3]; ?>" /><br></strong>
417
  <strong>Saved Meta: <input type="text" style="font-weight: normal;width: 300px;" id="oldmeta" value="<?php echo $thepage[4]; ?>" /><br></strong>
418
  <strong>JS Meta: <input type="text" style="font-weight: normal;width: 300px;" id="jsmeta" value="" /><br></strong>
419
  <strong>Post ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[5]; ?>" /><br></strong>
420
  <strong>Page Name: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[6]; ?>" /><br></strong>
421
  <strong>Use iframe?: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_check; ?>" /><br></strong>
422
  <strong>Iframe URL: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_url; ?>" /><br></strong>
423
  <textarea name="cf_thefunnel" id="cf_data" style="width: 400px;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
424
  </div>
425
  </div>
426
 
427
  <!-- <div style="background: #fafafa;border-top: 1px solid #eee;padding: 10px;text-align: center;margin: 10px 0px;margin-bottom: 20px" >
428
  <strong style="color: #777"> Running split tests or custom code on your page? Check here
429
  <input type="checkbox" id="useIframe" value="on" <?php if( $cf_iframe_check == 'on') { ?>checked <?php } ?> style="margin: 0 3px;width: 18px;height: 18px;" name="cf_iframe_check"> to activate settings.</strong>
430
  <small style="display: block;font-size: 11px;opacity: .5"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Why do you have to activate settings?</a></small>
431
  <input type="text" style="display: none;" id="iframeURL" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
432
  </div> -->
433
  <!-- <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
434
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
435
  <p>Choose any ClickFunnels page to be shown using a custom URL just select any funnel to refresh the list of pages. Create a custom URL and hit 'Save/Publish' to start sending traffic. <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Need more help?</a> </p>
436
  <p style="font-size: 11px;opacity: .7;"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
437
  </div>
438
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
439
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
440
  <p> Replace your homepage with a specific ClickFunnels page. You can show any page that you want, this will replace any other homepage settings you may have.</p>
441
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
442
  </div>
443
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
444
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
445
  <p> Show a specific page to be shown on any "Page not Found" such as a misspelled URL or a deleted blog post. Very good place for a squeeze page to get the most out of your traffic.</p>
446
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
447
  </div> -->
448
  <div class="row-fluid" id="apiFooter">
449
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
450
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right; ">
451
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
452
  </button>
453
  <?php } else { ?>
454
  <button id="publish" name="publish" class="button button-primary " style="float: right; ">
455
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
456
  </button>
457
  <?php } ?>
458
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
459
  <i class="fa fa-spinner fa-spin"></i>
460
  <span>Saving...</span>
461
  </div>
462
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels' );?>"><i class="fa fa-file-text-o"></i> Pages</a>
463
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=cf_api' );?>"><i class="fa fa-cog"></i> Settings</a>
464
  <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>" class="button button-default" style="float: left;margin-right: 10px"><i class="fa fa-life-ring"></i> Support</a>
465
  <?php if ( !empty( $delete_link ) ) {?>
466
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
467
  <?php }?>
468
  </div>
469
  </div>
470
  </div>
471
  (function($) {
472
  setTimeout(function() {
473
  $('#cf_thepage').trigger( "change" );
474
  }, 1500);
475
  })(jQuery);
 
476
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
477
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
478
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
479
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
480
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
481
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
482
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
483
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
484
 
485
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
486
  $thepage = explode( "{#}", $cf_page );
487
  $savedData = $cf_page;
488
  }
489
  else {
490
  $thepage = explode( "{#}", $cf_page['page_id'] );
491
  $savedData = $cf_page['page_id'];
492
  }
493
  $cf_options = get_option( "cf_options" );
494
  jQuery(document).ready(function(){
495
  // Set Correct Options
496
  var thefunnel = jQuery('#cf_thefunnel').val();
497
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
498
  jQuery('#cf_thepage').find('option').remove().end();
499
  jQuery('#loading').fadeIn();
500
  jQuery.getJSON(specificFunnel, function(data) {
501
  setTimeout(function() {
502
  jQuery('#loading').fadeOut();
503
  }, 2000);
504
  var is_selected = "";
505
  jQuery.each(data.funnel_steps, function() {
506
  if (this.pages != ''){
507
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
508
  is_selected = "selected";
509
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
510
  } else {
511
  is_selected = "";
512
  }
513
  if ( this.wp_friendly == true && this.pages != '' ) {
514
  var baseurl = this.pages[0].published_url.split('.com/');
515
  var baseurlnew = baseurl[0]+'.com/'+this.path;
516
  jQuery('#iframeURL').val(baseurlnew);
517
  // Check if has split tests
518
  var splittestkeys = 'none';
519
  // if (this.pages.length == 2) {
520
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key;
521
  // }
522
  // else if (this.pages.length == 3) {
523
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key+ '{|}' + this.pages[2].key;
524
  // }
525
 
526
  pageKey = this.pages[0].key;
527
 
528
  jQuery('#cf_thepage').append('<option value="' + pageKey + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'" '+is_selected+'>'+ this.name +'</option>');
529
  }
530
  }
531
  });
532
  }).done(function() {
533
  jQuery('#loading').fadeOut();
534
  var savedMeta = jQuery('#cf_thepage').val();
535
  if(savedMeta != undefined || savedMeta != null){
536
  savedMeta = savedMeta.split('{#}');
537
  jQuery('#jsmeta').val(savedMeta[3]);
538
  <?php if ( !empty( $_GET['action'] ) ) { ?>
539
  if (savedMeta[3] != jQuery('#oldmeta').val()){
540
  jQuery('#metaalreadyupdated').hide();
541
  jQuery('#showupdatemetalink').show();
542
  }
543
  <?php } ?>
544
  }
545
  <?php if ( empty( $_GET['action'] ) ) { ?>
546
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
547
  <?php } ?>
548
  })
549
  .fail(function() {
550
  jQuery('#loading').fadeOut();
551
  })
552
  .always(function() {
553
  jQuery('#loading').fadeOut();
554
  });
555
  // Change Funnel Populate Dropdown
556
  jQuery( '#cf_thefunnel' ).change(function() {
557
  jQuery('#loading').fadeIn();
558
  var thefunnel = jQuery(this).val();
559
  var totalPages = 0;
560
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
561
  jQuery('#cf_thepage').find('option').remove().end();
562
  jQuery.getJSON(specificFunnel, function(data) {
563
  setTimeout(function() {
564
  jQuery('#loading').fadeOut();
565
  }, 2000);
566
  // alert( specificFunnel);
567
  jQuery.each(data.funnel_steps, function() {
568
  if( this.wp_friendly == true && this.pages != '' ) {
569
  if (this.pages.length > 1) {
570
  jQuery('#usingSplitTests').show();
571
  } else {
572
  jQuery('#usingSplitTests').hide();
573
  }
574
 
575
  var baseurl = this.pages[0].published_url.split('.com/');
576
  var baseurlnew = baseurl[0]+'.com/'+this.path;
577
  jQuery('#iframeURL').val(baseurlnew);
578
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'">'+ this.name +'</option>');
579
 
580
 
581
  totalPages += 1;
582
  }
583
  });
584
 
585
  }).done(function() {
586
  jQuery('#loading').fadeOut();
587
  var savedMeta = jQuery('#cf_thepage').val();
588
  if(savedMeta != undefined || savedMeta != null){
589
  savedMeta = savedMeta.split('{#}');
590
  jQuery('#previewiframe').attr('src', savedMeta[6]+'?preview=true');
591
  }
592
  jQuery('#cf_thepage').trigger('change');
593
 
594
  if (totalPages == 0) {
595
  jQuery('#noPageWarning').fadeIn();
596
  jQuery('#cf_thepage').fadeOut();
597
  }
598
  else {
599
  jQuery('#noPageWarning').hide();
600
  jQuery('#cf_thepage').fadeIn();
601
  }
602
  var theposition = jQuery('#cf_thepage').val();
603
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
604
  var myString = thefunnel+'{#}'+theposition;
605
  var arr = myString.split('{#}');
606
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
607
  var do_ping = function() {
608
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
609
  }).catch(function(error) {
610
  });
611
  };
612
  do_ping();
613
  })
614
  .fail(function() {
615
  jQuery('#loading').fadeOut();
616
  })
617
  .always(function() {
618
  jQuery('#loading').fadeOut();
619
  });
620
  setTimeout(function() {
621
 
622
  }, 3000);
623
 
624
  });
625
  var request_image = function(url) {
626
  return new Promise(function(resolve, reject) {
627
  var img = new Image();
628
  img.onload = function() { resolve(img); };
629
  img.onerror = function() { reject(url); };
630
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
631
  });
632
  };
633
  /**
634
  * Pings a url.
635
  * @param {String} url
636
  * @return {Promise} promise that resolves to a ping (ms, float).
637
  */
638
  var ping = function(url) {
639
  return new Promise(function(resolve, reject) {
640
  var start = (new Date()).getTime();
641
  var response = function() {
642
  var delta = ((new Date()).getTime() - start);
643
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
644
  delta /= 4;
645
  resolve(delta);
646
  };
647
  request_image(url).then(response).catch(response);
648
  // Set a timeout for max-pings, 5s.
649
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
650
  });
651
  };
652
  function replaceText(inputText, tagName, tagReplace) {
653
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
654
  return inputText.replace(regExp, tagReplace);
655
  }
656
  // Select New Page
657
  jQuery( '#cf_thepage' ).change(function() {
658
  jQuery('#loading').fadeOut();
659
  var thefunnel = jQuery('#cf_thefunnel').val();
660
  var theposition = jQuery(this).val();
661
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
662
  if(theposition != undefined || theposition != null){
663
  var myString = thefunnel+'{#}'+theposition;
664
  var arr = myString.split('{#}');
665
  var arr2 = theposition.split('{#}');
666
  // Iframe
667
  jQuery('#iframeURL').val(arr2[6]);
668
  var myStr = arr2[3];
669
  // Browser title
670
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
671
 
672
  jQuery('#seoTitle').val(subStr[1].replace(/%20/g, ' '));
673
 
674
  // SEO Desc
675
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
676
  jQuery('#seoDesc').val(subStr[1].replace(/%20/g, ' '));
677
  // SEO Share Image
678
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
679
  jQuery('#seosocial').val(subStr[1]);
680
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
681
  var do_ping = function() {
682
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
683
  }).catch(function(error) {
684
  });
685
  };
686
  do_ping();
687
  jQuery('#previewiframe').attr('src', arr[7]+'?preview=true');
688
  }
689
 
690
  });
691
  // Fade Out Message
692
  setTimeout(function() {
693
  jQuery('#message').fadeOut();
694
  }, 3500);
695
  // Savings
696
  jQuery('#publish').click(function() {
697
  jQuery('#saving').fadeIn();
698
  });
699
  jQuery('#delete').on('click', function () {
700
  return confirm('Are you sure you want to delete this page?');
701
  });
702
  jQuery('#cf_slug').bind('keyup keypress blur', function()
703
  {
704
  var myStr = jQuery(this).val()
705
  myStr=myStr.toLowerCase();
706
  myStr=myStr.replace(/\s/g , "-");
707
  jQuery('#cf_slug').val(myStr);
708
  });
709
  // Check Null and Resave v1.0.6
710
  <?php if ($thepage[1] == 'null') { ?>
711
  // jQuery('#autosaving').fadeIn();
712
  // setTimeout(function() {
713
  // jQuery('form').submit();
714
  // }, 2000);
715
  <?php } ?>
716
  jQuery('#showupdatemetalink').click(function() {
717
  jQuery('form').submit();
718
  });
719
 
720
  });
721
  if ( $cf_page != "" ) {
722
  $json = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ) );
723
  $cf_funnels_pages = json_decode( $json );
724
  }
725
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
726
  <h2>Saving and Reloading...</h2>
727
  <h1><i class="fa fa-cog fa-spin"></i></h1>
728
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
729
  <a href="https://www.app.clickfunnels.com/funnels" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
730
  <br clear="all">
731
  <?php if ( !empty( $_GET['action'] ) ) { ?>
732
  <?php if ( $cf_type=='p' ) {?>
733
  <a style="margin-right: -3px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Open Editor</a>
734
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> View Funnel</a>
735
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> Preview</a>
736
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
737
  <?php if ( $cf_thefunnel == $funnel->id ) { if(strlen($funnel->name) > 30) { echo substr($funnel->name,0,30).'...'; } else { echo $funnel->name;} } } ?></h2>
738
 
739
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank"> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?></a>
740
  <?php }?>
741
  <?php if ( $cf_type=='hp' ) {?>
742
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
743
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
744
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
745
  <h2>Set as Home Page</h2>
746
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?></a>
747
  <?php }?>
748
  <?php if ( $cf_type=='np' ) {?>
749
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
750
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
751
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>/invalid-url-404-testing" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
752
  <h2>Set as 404 Page</h2>
753
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url</a>
754
  <?php }?>
755
  <?php if ( $cf_type=='' ) {?>
756
  <h2>Page Undefined - Try saving your page again.</h2>
757
  <?php }?>
758
  <?php if ( $cf_type=='noapi' ) {?>
759
  <h2>No API Fallback</h2>
760
  <?php }?>
761
  <?php } else { ?>
762
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
763
  <?php } ?>
764
  <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>
765
  <iframe src="<?php echo $cf_iframe_url; ?>" style="width: 1280px;height: 750px;-ms-zoom: 0.20; -moz-transform: scale(0.20); -moz-transform-origin: 0 0; -o-transform: scale(0.20); -o-transform-origin: 0 0; -webkit-transform: scale(0.20); -webkit-transform-origin: 0 0;" frameborder="0" id="previewiframe"></iframe>
766
  </div> -->
767
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
768
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
769
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
770
  <div class="row-fluid form-horizontal">
771
  <br>
772
  <a style="float: right;position:relative;z-index: 999999;margin-right: 8px" class="btn pageSettings">Page Settings</a>
773
 
774
  <div class="control-group" style="margin-left: -10px; margin-bottom: 20px !important">
775
  <div data-target="cf_type" class="btn-group multichoice cf_header">
776
  <a data-value="p" class="btn <?php if ( $cf_type=='p' || $cf_type=='') {?> active btn-selected<?php }?>">Regular Page</a>
777
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
778
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
779
  <!-- <a data-value="shortcode" class="btn <?php if ( $cf_type=='shortcode' ) {?> active btn-selected<?php }?>">Shortcode</a> -->
780
  </div>
781
  <input type="hidden" id="cf_type" name="cf_type"/>
782
  </div>
783
  <div class="control-group cf_uses_api" style="">
784
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-filter"></i></label>
785
  <div class="controls">
786
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
787
  <?php if ( empty( $cf_funnels ) ) { ?>
788
  <option value="0">No Funnels Found</option>
789
  <?php }
790
  else {
791
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
792
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
793
  <?php
794
  }
795
  } ?>
796
  </select>
797
  </div>
798
  </div>
799
  <div id="usingSplitTests" style="display: none">
800
  Using split tests
801
  </div>
802
  <div class="control-group cf_uses_api">
803
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
804
  <div class="controls">
805
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
806
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
807
  <option value="0">No Pages Found</option>
808
  <?php }
809
  else {
810
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
811
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
812
  <?php
813
  }
814
  }
815
  ?>
816
  </select>
817
  <i class="fa fa-spinner fa-spin" id="loading"></i>
818
  </div>
819
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;margin-top: -33px;float: left;padding-top: 10px;display: none;width: 100%; clear: both"><em>No compatible pages found for this funnel.</em></div>
820
  </div>
821
  <div class="control-group cf_no_api" >
822
  <label class="control-label" for="cf_iframe_check"> ClickFunnels URL <i class="fa fa-globe"></i></label>
823
  <div class="controls">
824
  <input type="text" class="input-xlarge" id="iframeURL" style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
825
  </div>
826
  </div>
827
  <div class="control-group cf_no_api" >
828
  <label class="control-label" for="cf_iframe_check"> Website Title <i class="fa fa-globe"></i></label>
829
  <div class="controls">
830
  <input type="text" class="input-xlarge" id="seoTitle" style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
831
  </div>
832
  </div>
833
  <div class="control-group cf_no_api" >
834
  <label class="control-label" for="cf_iframe_check"> Description <i class="fa fa-globe"></i></label>
835
  <div class="controls">
836
  <input type="text" class="input-xlarge" id="seoDesc" style="height: 30px;" value="<?php echo $cf_seo_desc; ?>" name="cf_seo_desc" />
837
  </div>
838
  </div>
839
  <div class="control-group cf_no_api" >
840
  <label class="control-label" for="cf_iframe_check"> Social Image URL <i class="fa fa-globe"></i></label>
841
  <div class="controls">
842
  <input type="text" class="input-xlarge" id="seosocial" style="height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
843
  </div>
844
  </div>
845
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" name="cf_page_url" />
846
 
847
 
848
  <div class="control-group cf_uses_api" >
849
  <label class="control-label" for="cf_iframe_check"> Cookie Split Tests <i class="fa fa-bar-chart"></i></label>
850
  <div class="controls">
851
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
852
  <option value="off">Show random cookied version</option>
853
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Show page in iframe (don't cookie)</option>
854
  </select>
855
  <!-- <small style="float: left;font-size: 11px;padding: 5px;margin-left: 6px"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">What is this?</a></small> -->
856
  </div>
857
  </div>
858
  <?php if ( !empty( $_GET['action'] ) ) { ?>
859
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
860
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
861
  <a href="#" style="margin-left: 20px;margin-top: 5px;display: block;float: left;display: none" id="showupdatemetalink"><i class="fa fa-refresh"></i> Meta Data is Out Dated -- Click to Update</a>
862
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
863
  </div>
864
  <?php } else { ?>
865
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
866
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
867
 
868
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
869
  </div>
870
  <?php } ?>
871
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
872
  <div class="cf_url control-group" style="<?php echo $display;?>" >
873
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-globe"></i></label>
874
  <div id="cf-wp-path" class="controls ">
875
  <div class="input-prepend">
876
  <span class="add-on" style="font-size: 13px;padding: 4px 10px; background: #ECEEEF; color: #777; text-shadow: none; border: 1px solid #ccc"><?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/</span><input style="height:28px;width: 150px !important" type="textbox" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" name="cf_slug" id="cf_slug" class="input-xlarge">
877
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
878
  </div>
879
  </div>
880
  </div>
881
 
882
 
883
 
884
  <style>
885
  #hiddenStuff {display: none}
886
  </style>
887
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block" <?php } ?>>
888
  <div class="controls">
889
  <strong>Funnel ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[0]; ?>" /> <br></strong>
890
  <strong>Page Key: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[1]; ?>" /><br></strong>
891
  <strong>Page ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[2]; ?>" /><br></strong>
892
  <strong>Funnel Step ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[3]; ?>" /><br></strong>
893
  <strong>Saved Meta: <input type="text" style="font-weight: normal;width: 300px;" id="oldmeta" value="<?php echo $thepage[4]; ?>" /><br></strong>
894
  <strong>JS Meta: <input type="text" style="font-weight: normal;width: 300px;" id="jsmeta" value="" /><br></strong>
895
  <strong>Post ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[5]; ?>" /><br></strong>
896
  <strong>Page Name: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[6]; ?>" /><br></strong>
897
  <strong>Use iframe?: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_check; ?>" /><br></strong>
898
  <strong>Iframe URL: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_url; ?>" /><br></strong>
899
  <textarea name="cf_thefunnel" id="cf_data" style="width: 400px;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
900
  </div>
901
  </div>
902
 
903
  <!-- <div style="background: #fafafa;border-top: 1px solid #eee;padding: 10px;text-align: center;margin: 10px 0px;margin-bottom: 20px" >
904
  <strong style="color: #777"> Running split tests or custom code on your page? Check here
905
  <input type="checkbox" id="useIframe" value="on" <?php if( $cf_iframe_check == 'on') { ?>checked <?php } ?> style="margin: 0 3px;width: 18px;height: 18px;" name="cf_iframe_check"> to activate settings.</strong>
906
  <small style="display: block;font-size: 11px;opacity: .5"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Why do you have to activate settings?</a></small>
907
  <input type="text" style="display: none;" id="iframeURL" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
908
  </div> -->
909
  <!-- <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
910
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
911
  <p>Choose any ClickFunnels page to be shown using a custom URL just select any funnel to refresh the list of pages. Create a custom URL and hit 'Save/Publish' to start sending traffic. <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Need more help?</a> </p>
912
  <p style="font-size: 11px;opacity: .7;"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
913
  </div>
914
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
915
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
916
  <p> Replace your homepage with a specific ClickFunnels page. You can show any page that you want, this will replace any other homepage settings you may have.</p>
917
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
918
  </div>
919
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
920
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
921
  <p> Show a specific page to be shown on any "Page not Found" such as a misspelled URL or a deleted blog post. Very good place for a squeeze page to get the most out of your traffic.</p>
922
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
923
  </div> -->
924
  <div class="row-fluid" id="apiFooter">
925
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
926
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right; ">
927
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
928
  </button>
929
  <?php } else { ?>
930
  <button id="publish" name="publish" class="button button-primary " style="float: right; ">
931
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
932
  </button>
933
  <?php } ?>
934
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
935
  <i class="fa fa-spinner fa-spin"></i>
936
  <span>Saving...</span>
937
  </div>
938
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels' );?>"><i class="fa fa-file-text-o"></i> Pages</a>
939
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=cf_api' );?>"><i class="fa fa-cog"></i> Settings</a>
940
  <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>" class="button button-default" style="float: left;margin-right: 10px"><i class="fa fa-life-ring"></i> Support</a>
941
  <?php if ( !empty( $delete_link ) ) {?>
942
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
943
  <?php }?>
944
  </div>
945
  </div>
946
  </div>
947
  (function($) {
948
  setTimeout(function() {
949
  $('#cf_thepage').trigger( "change" );
950
  }, 1500);
951
  })(jQuery);
 
1
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
2
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
3
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
4
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
5
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
6
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
7
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
8
 
9
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
10
  $thepage = explode( "{#}", $cf_page );
11
  $savedData = $cf_page;
12
  }
13
  else {
14
  $thepage = explode( "{#}", $cf_page['page_id'] );
15
  $savedData = $cf_page['page_id'];
16
  }
17
  $cf_options = get_option( "cf_options" );
18
  jQuery(document).ready(function(){
19
  // Set Correct Options
20
  var thefunnel = jQuery('#cf_thefunnel').val();
21
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
22
  jQuery('#cf_thepage').find('option').remove().end();
23
  jQuery('#loading').fadeIn();
24
  jQuery.getJSON(specificFunnel, function(data) {
25
  setTimeout(function() {
26
  jQuery('#loading').fadeOut();
27
  }, 2000);
28
  var is_selected = "";
29
  jQuery.each(data.funnel_steps, function() {
30
  if (this.pages != ''){
31
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
32
  is_selected = "selected";
33
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
34
  } else {
35
  is_selected = "";
36
  }
37
  if ( this.wp_friendly == true && this.pages != '' ) {
38
  var baseurl = this.pages[0].published_url.split('.com/');
39
  var baseurlnew = baseurl[0]+'.com/'+this.path;
40
  jQuery('#iframeURL').val(baseurlnew);
41
  // Check if has split tests
42
  var splittestkeys = 'none';
43
  // if (this.pages.length == 2) {
44
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key;
45
  // }
46
  // else if (this.pages.length == 3) {
47
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key+ '{|}' + this.pages[2].key;
48
  // }
49
 
50
  pageKey = this.pages[0].key;
51
 
52
  jQuery('#cf_thepage').append('<option value="' + pageKey + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'" '+is_selected+'>'+ this.name +'</option>');
53
  }
54
  }
55
  });
56
  }).done(function() {
57
  jQuery('#loading').fadeOut();
58
  var savedMeta = jQuery('#cf_thepage').val();
59
  if(savedMeta != undefined || savedMeta != null){
60
  savedMeta = savedMeta.split('{#}');
61
  jQuery('#jsmeta').val(savedMeta[3]);
62
  <?php if ( !empty( $_GET['action'] ) ) { ?>
63
  if (savedMeta[3] != jQuery('#oldmeta').val()){
64
  jQuery('#metaalreadyupdated').hide();
65
  jQuery('#showupdatemetalink').show();
66
  }
67
  <?php } ?>
68
  }
69
  <?php if ( empty( $_GET['action'] ) ) { ?>
70
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
71
  <?php } ?>
72
  })
73
  .fail(function() {
74
  jQuery('#loading').fadeOut();
75
  })
76
  .always(function() {
77
  jQuery('#loading').fadeOut();
78
  });
79
  // Change Funnel Populate Dropdown
80
  jQuery( '#cf_thefunnel' ).change(function() {
81
  jQuery('#loading').fadeIn();
82
  var thefunnel = jQuery(this).val();
83
  var totalPages = 0;
84
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
85
  jQuery('#cf_thepage').find('option').remove().end();
86
  jQuery.getJSON(specificFunnel, function(data) {
87
  setTimeout(function() {
88
  jQuery('#loading').fadeOut();
89
  }, 2000);
90
  // alert( specificFunnel);
91
  jQuery.each(data.funnel_steps, function() {
92
  if( this.wp_friendly == true && this.pages != '' ) {
93
  if (this.pages.length > 1) {
94
  jQuery('#usingSplitTests').show();
95
  } else {
96
  jQuery('#usingSplitTests').hide();
97
  }
98
 
99
  var baseurl = this.pages[0].published_url.split('.com/');
100
  var baseurlnew = baseurl[0]+'.com/'+this.path;
101
  jQuery('#iframeURL').val(baseurlnew);
102
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'">'+ this.name +'</option>');
103
 
104
 
105
  totalPages += 1;
106
  }
107
  });
108
 
109
  }).done(function() {
110
  jQuery('#loading').fadeOut();
111
  var savedMeta = jQuery('#cf_thepage').val();
112
  if(savedMeta != undefined || savedMeta != null){
113
  savedMeta = savedMeta.split('{#}');
114
  jQuery('#previewiframe').attr('src', savedMeta[6]+'?preview=true');
115
  }
116
  jQuery('#cf_thepage').trigger('change');
117
 
118
  if (totalPages == 0) {
119
  jQuery('#noPageWarning').fadeIn();
120
  jQuery('#cf_thepage').fadeOut();
121
  }
122
  else {
123
  jQuery('#noPageWarning').hide();
124
  jQuery('#cf_thepage').fadeIn();
125
  }
126
  var theposition = jQuery('#cf_thepage').val();
127
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
128
  var myString = thefunnel+'{#}'+theposition;
129
  var arr = myString.split('{#}');
130
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
131
  var do_ping = function() {
132
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
133
  }).catch(function(error) {
134
  });
135
  };
136
  do_ping();
137
  })
138
  .fail(function() {
139
  jQuery('#loading').fadeOut();
140
  })
141
  .always(function() {
142
  jQuery('#loading').fadeOut();
143
  });
144
  setTimeout(function() {
145
 
146
  }, 3000);
147
 
148
  });
149
  var request_image = function(url) {
150
  return new Promise(function(resolve, reject) {
151
  var img = new Image();
152
  img.onload = function() { resolve(img); };
153
  img.onerror = function() { reject(url); };
154
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
155
  });
156
  };
157
  /**
158
  * Pings a url.
159
  * @param {String} url
160
  * @return {Promise} promise that resolves to a ping (ms, float).
161
  */
162
  var ping = function(url) {
163
  return new Promise(function(resolve, reject) {
164
  var start = (new Date()).getTime();
165
  var response = function() {
166
  var delta = ((new Date()).getTime() - start);
167
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
168
  delta /= 4;
169
  resolve(delta);
170
  };
171
  request_image(url).then(response).catch(response);
172
  // Set a timeout for max-pings, 5s.
173
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
174
  });
175
  };
176
  function replaceText(inputText, tagName, tagReplace) {
177
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
178
  return inputText.replace(regExp, tagReplace);
179
  }
180
  // Select New Page
181
  jQuery( '#cf_thepage' ).change(function() {
182
  jQuery('#loading').fadeOut();
183
  var thefunnel = jQuery('#cf_thefunnel').val();
184
  var theposition = jQuery(this).val();
185
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
186
  if(theposition != undefined || theposition != null){
187
  var myString = thefunnel+'{#}'+theposition;
188
  var arr = myString.split('{#}');
189
  var arr2 = theposition.split('{#}');
190
  // Iframe
191
  jQuery('#iframeURL').val(arr2[6]);
192
  var myStr = arr2[3];
193
  // Browser title
194
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
195
 
196
  jQuery('#seoTitle').val(subStr[1].replace(/%20/g, ' '));
197
 
198
  // SEO Desc
199
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
200
  jQuery('#seoDesc').val(subStr[1].replace(/%20/g, ' '));
201
  // SEO Share Image
202
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
203
  jQuery('#seosocial').val(subStr[1]);
204
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
205
  var do_ping = function() {
206
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
207
  }).catch(function(error) {
208
  });
209
  };
210
  do_ping();
211
  jQuery('#previewiframe').attr('src', arr[7]+'?preview=true');
212
  }
213
 
214
  });
215
  // Fade Out Message
216
  setTimeout(function() {
217
  jQuery('#message').fadeOut();
218
  }, 3500);
219
  // Savings
220
  jQuery('#publish').click(function() {
221
  jQuery('#saving').fadeIn();
222
  });
223
  jQuery('#delete').on('click', function () {
224
  return confirm('Are you sure you want to delete this page?');
225
  });
226
  jQuery('#cf_slug').bind('keyup keypress blur', function()
227
  {
228
  var myStr = jQuery(this).val()
229
  myStr=myStr.toLowerCase();
230
  myStr=myStr.replace(/\s/g , "-");
231
  jQuery('#cf_slug').val(myStr);
232
  });
233
  // Check Null and Resave v1.0.6
234
  <?php if ($thepage[1] == 'null') { ?>
235
  // jQuery('#autosaving').fadeIn();
236
  // setTimeout(function() {
237
  // jQuery('form').submit();
238
  // }, 2000);
239
  <?php } ?>
240
  jQuery('#showupdatemetalink').click(function() {
241
  jQuery('form').submit();
242
  });
243
 
244
  });
245
  if ( $cf_page != "" ) {
246
  $json = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ) );
247
  $cf_funnels_pages = json_decode( $json );
248
  }
249
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
250
  <h2>Saving and Reloading...</h2>
251
  <h1><i class="fa fa-cog fa-spin"></i></h1>
252
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
253
  <a href="https://www.app.clickfunnels.com/funnels" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
254
  <br clear="all">
255
  <?php if ( !empty( $_GET['action'] ) ) { ?>
256
  <?php if ( $cf_type=='p' ) {?>
257
  <a style="margin-right: -3px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Open Editor</a>
258
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> View Funnel</a>
259
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> Preview</a>
260
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
261
  <?php if ( $cf_thefunnel == $funnel->id ) { if(strlen($funnel->name) > 30) { echo substr($funnel->name,0,30).'...'; } else { echo $funnel->name;} } } ?></h2>
262
 
263
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank"> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?></a>
264
  <?php }?>
265
  <?php if ( $cf_type=='hp' ) {?>
266
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
267
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
268
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
269
  <h2>Set as Home Page</h2>
270
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?></a>
271
  <?php }?>
272
  <?php if ( $cf_type=='np' ) {?>
273
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
274
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
275
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>/invalid-url-404-testing" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
276
  <h2>Set as 404 Page</h2>
277
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url</a>
278
  <?php }?>
279
  <?php if ( $cf_type=='' ) {?>
280
  <h2>Page Undefined - Try saving your page again.</h2>
281
  <?php }?>
282
  <?php if ( $cf_type=='noapi' ) {?>
283
  <h2>No API Fallback</h2>
284
  <?php }?>
285
  <?php } else { ?>
286
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
287
  <?php } ?>
288
  <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>
289
  <iframe src="<?php echo $cf_iframe_url; ?>" style="width: 1280px;height: 750px;-ms-zoom: 0.20; -moz-transform: scale(0.20); -moz-transform-origin: 0 0; -o-transform: scale(0.20); -o-transform-origin: 0 0; -webkit-transform: scale(0.20); -webkit-transform-origin: 0 0;" frameborder="0" id="previewiframe"></iframe>
290
  </div> -->
291
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
292
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
293
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
294
  <div class="row-fluid form-horizontal">
295
  <br>
296
  <a style="float: right;position:relative;z-index: 999999;margin-right: 8px" class="btn pageSettings">Page Settings</a>
297
 
298
  <div class="control-group" style="margin-left: -10px; margin-bottom: 20px !important">
299
  <div data-target="cf_type" class="btn-group multichoice cf_header">
300
  <a data-value="p" class="btn <?php if ( $cf_type=='p' || $cf_type=='') {?> active btn-selected<?php }?>">Regular Page</a>
301
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
302
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
303
  <!-- <a data-value="shortcode" class="btn <?php if ( $cf_type=='shortcode' ) {?> active btn-selected<?php }?>">Shortcode</a> -->
304
  </div>
305
  <input type="hidden" id="cf_type" name="cf_type"/>
306
  </div>
307
  <div class="control-group cf_uses_api" style="">
308
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-filter"></i></label>
309
  <div class="controls">
310
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
311
  <?php if ( empty( $cf_funnels ) ) { ?>
312
  <option value="0">No Funnels Found</option>
313
  <?php }
314
  else {
315
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
316
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
317
  <?php
318
  }
319
  } ?>
320
  </select>
321
  </div>
322
  </div>
323
  <div id="usingSplitTests" style="display: none">
324
  Using split tests
325
  </div>
326
  <div class="control-group cf_uses_api">
327
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
328
  <div class="controls">
329
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
330
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
331
  <option value="0">No Pages Found</option>
332
  <?php }
333
  else {
334
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
335
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
336
  <?php
337
  }
338
  }
339
  ?>
340
  </select>
341
  <i class="fa fa-spinner fa-spin" id="loading"></i>
342
  </div>
343
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;margin-top: -33px;float: left;padding-top: 10px;display: none;width: 100%; clear: both"><em>No compatible pages found for this funnel.</em></div>
344
  </div>
345
  <div class="control-group cf_no_api" >
346
  <label class="control-label" for="cf_iframe_check"> ClickFunnels URL <i class="fa fa-globe"></i></label>
347
  <div class="controls">
348
  <input type="text" class="input-xlarge" id="iframeURL" style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
349
  </div>
350
  </div>
351
  <div class="control-group cf_no_api" >
352
  <label class="control-label" for="cf_iframe_check"> Website Title <i class="fa fa-globe"></i></label>
353
  <div class="controls">
354
  <input type="text" class="input-xlarge" id="seoTitle" style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
355
  </div>
356
  </div>
357
  <div class="control-group cf_no_api" >
358
  <label class="control-label" for="cf_iframe_check"> Description <i class="fa fa-globe"></i></label>
359
  <div class="controls">
360
  <input type="text" class="input-xlarge" id="seoDesc" style="height: 30px;" value="<?php echo $cf_seo_desc; ?>" name="cf_seo_desc" />
361
  </div>
362
  </div>
363
  <div class="control-group cf_no_api" >
364
  <label class="control-label" for="cf_iframe_check"> Social Image URL <i class="fa fa-globe"></i></label>
365
  <div class="controls">
366
  <input type="text" class="input-xlarge" id="seosocial" style="height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
367
  </div>
368
  </div>
369
 
370
 
371
  <div class="control-group cf_uses_api" >
372
  <label class="control-label" for="cf_iframe_check"> Cookie Split Tests <i class="fa fa-bar-chart"></i></label>
373
  <div class="controls">
374
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
375
  <option value="off">Show random cookied version</option>
376
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Show page in iframe (don't cookie)</option>
377
  </select>
378
  <!-- <small style="float: left;font-size: 11px;padding: 5px;margin-left: 6px"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">What is this?</a></small> -->
379
  </div>
380
  </div>
381
  <?php if ( !empty( $_GET['action'] ) ) { ?>
382
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
383
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
384
  <a href="#" style="margin-left: 20px;margin-top: 5px;display: block;float: left;display: none" id="showupdatemetalink"><i class="fa fa-refresh"></i> Meta Data is Out Dated -- Click to Update</a>
385
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
386
  </div>
387
  <?php } else { ?>
388
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
389
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
390
 
391
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
392
  </div>
393
  <?php } ?>
394
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
395
  <div class="cf_url control-group" style="<?php echo $display;?>" >
396
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-globe"></i></label>
397
  <div id="cf-wp-path" class="controls ">
398
  <div class="input-prepend">
399
  <span class="add-on" style="font-size: 13px;padding: 4px 10px; background: #ECEEEF; color: #777; text-shadow: none; border: 1px solid #ccc"><?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/</span><input style="height:28px;width: 150px !important" type="textbox" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" name="cf_slug" id="cf_slug" class="input-xlarge">
400
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
401
  </div>
402
  </div>
403
  </div>
404
 
405
 
406
 
407
  <style>
408
  #hiddenStuff {display: none}
409
  </style>
410
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block" <?php } ?>>
411
  <div class="controls">
412
  <strong>Funnel ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[0]; ?>" /> <br></strong>
413
  <strong>Page Key: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[1]; ?>" /><br></strong>
414
  <strong>Page ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[2]; ?>" /><br></strong>
415
  <strong>Funnel Step ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[3]; ?>" /><br></strong>
416
  <strong>Saved Meta: <input type="text" style="font-weight: normal;width: 300px;" id="oldmeta" value="<?php echo $thepage[4]; ?>" /><br></strong>
417
  <strong>JS Meta: <input type="text" style="font-weight: normal;width: 300px;" id="jsmeta" value="" /><br></strong>
418
  <strong>Post ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[5]; ?>" /><br></strong>
419
  <strong>Page Name: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[6]; ?>" /><br></strong>
420
  <strong>Use iframe?: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_check; ?>" /><br></strong>
421
  <strong>Iframe URL: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_url; ?>" /><br></strong>
422
  <textarea name="cf_thefunnel" id="cf_data" style="width: 400px;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
423
  </div>
424
  </div>
425
 
426
  <!-- <div style="background: #fafafa;border-top: 1px solid #eee;padding: 10px;text-align: center;margin: 10px 0px;margin-bottom: 20px" >
427
  <strong style="color: #777"> Running split tests or custom code on your page? Check here
428
  <input type="checkbox" id="useIframe" value="on" <?php if( $cf_iframe_check == 'on') { ?>checked <?php } ?> style="margin: 0 3px;width: 18px;height: 18px;" name="cf_iframe_check"> to activate settings.</strong>
429
  <small style="display: block;font-size: 11px;opacity: .5"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Why do you have to activate settings?</a></small>
430
  <input type="text" style="display: none;" id="iframeURL" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
431
  </div> -->
432
  <!-- <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
433
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
434
  <p>Choose any ClickFunnels page to be shown using a custom URL just select any funnel to refresh the list of pages. Create a custom URL and hit 'Save/Publish' to start sending traffic. <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Need more help?</a> </p>
435
  <p style="font-size: 11px;opacity: .7;"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
436
  </div>
437
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
438
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
439
  <p> Replace your homepage with a specific ClickFunnels page. You can show any page that you want, this will replace any other homepage settings you may have.</p>
440
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
441
  </div>
442
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
443
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
444
  <p> Show a specific page to be shown on any "Page not Found" such as a misspelled URL or a deleted blog post. Very good place for a squeeze page to get the most out of your traffic.</p>
445
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
446
  </div> -->
447
  <div class="row-fluid" id="apiFooter">
448
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
449
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right; ">
450
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
451
  </button>
452
  <?php } else { ?>
453
  <button id="publish" name="publish" class="button button-primary " style="float: right; ">
454
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
455
  </button>
456
  <?php } ?>
457
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
458
  <i class="fa fa-spinner fa-spin"></i>
459
  <span>Saving...</span>
460
  </div>
461
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels' );?>"><i class="fa fa-file-text-o"></i> Pages</a>
462
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=cf_api' );?>"><i class="fa fa-cog"></i> Settings</a>
463
  <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>" class="button button-default" style="float: left;margin-right: 10px"><i class="fa fa-life-ring"></i> Support</a>
464
  <?php if ( !empty( $delete_link ) ) {?>
465
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
466
  <?php }?>
467
  </div>
468
  </div>
469
  </div>
470
  (function($) {
471
  setTimeout(function() {
472
  $('#cf_thepage').trigger( "change" );
473
  }, 1500);
474
  })(jQuery);
475
+
476
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
477
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
478
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
479
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
480
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
481
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
482
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
483
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
484
 
485
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
486
  $thepage = explode( "{#}", $cf_page );
487
  $savedData = $cf_page;
488
  }
489
  else {
490
  $thepage = explode( "{#}", $cf_page['page_id'] );
491
  $savedData = $cf_page['page_id'];
492
  }
493
  $cf_options = get_option( "cf_options" );
494
  jQuery(document).ready(function(){
495
  // Set Correct Options
496
  var thefunnel = jQuery('#cf_thefunnel').val();
497
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
498
  jQuery('#cf_thepage').find('option').remove().end();
499
  jQuery('#loading').fadeIn();
500
  jQuery.getJSON(specificFunnel, function(data) {
501
  setTimeout(function() {
502
  jQuery('#loading').fadeOut();
503
  }, 2000);
504
  var is_selected = "";
505
  jQuery.each(data.funnel_steps, function() {
506
  if (this.pages != ''){
507
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
508
  is_selected = "selected";
509
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
510
  } else {
511
  is_selected = "";
512
  }
513
  if ( this.wp_friendly == true && this.pages != '' ) {
514
  var baseurl = this.pages[0].published_url.split('.com/');
515
  var baseurlnew = baseurl[0]+'.com/'+this.path;
516
  jQuery('#iframeURL').val(baseurlnew);
517
  // Check if has split tests
518
  var splittestkeys = 'none';
519
  // if (this.pages.length == 2) {
520
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key;
521
  // }
522
  // else if (this.pages.length == 3) {
523
  // splittestkeys = this.pages[0].key + '{|}' + this.pages[1].key+ '{|}' + this.pages[2].key;
524
  // }
525
 
526
  pageKey = this.pages[0].key;
527
 
528
  jQuery('#cf_thepage').append('<option value="' + pageKey + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'" '+is_selected+'>'+ this.name +'</option>');
529
  }
530
  }
531
  });
532
  }).done(function() {
533
  jQuery('#loading').fadeOut();
534
  var savedMeta = jQuery('#cf_thepage').val();
535
  if(savedMeta != undefined || savedMeta != null){
536
  savedMeta = savedMeta.split('{#}');
537
  jQuery('#jsmeta').val(savedMeta[3]);
538
  <?php if ( !empty( $_GET['action'] ) ) { ?>
539
  if (savedMeta[3] != jQuery('#oldmeta').val()){
540
  jQuery('#metaalreadyupdated').hide();
541
  jQuery('#showupdatemetalink').show();
542
  }
543
  <?php } ?>
544
  }
545
  <?php if ( empty( $_GET['action'] ) ) { ?>
546
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
547
  <?php } ?>
548
  })
549
  .fail(function() {
550
  jQuery('#loading').fadeOut();
551
  })
552
  .always(function() {
553
  jQuery('#loading').fadeOut();
554
  });
555
  // Change Funnel Populate Dropdown
556
  jQuery( '#cf_thefunnel' ).change(function() {
557
  jQuery('#loading').fadeIn();
558
  var thefunnel = jQuery(this).val();
559
  var totalPages = 0;
560
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
561
  jQuery('#cf_thepage').find('option').remove().end();
562
  jQuery.getJSON(specificFunnel, function(data) {
563
  setTimeout(function() {
564
  jQuery('#loading').fadeOut();
565
  }, 2000);
566
  // alert( specificFunnel);
567
  jQuery.each(data.funnel_steps, function() {
568
  if( this.wp_friendly == true && this.pages != '' ) {
569
  if (this.pages.length > 1) {
570
  jQuery('#usingSplitTests').show();
571
  } else {
572
  jQuery('#usingSplitTests').hide();
573
  }
574
 
575
  var baseurl = this.pages[0].published_url.split('.com/');
576
  var baseurlnew = baseurl[0]+'.com/'+this.path;
577
  jQuery('#iframeURL').val(baseurlnew);
578
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>{#}' + this.name +'{#}'+baseurlnew+'">'+ this.name +'</option>');
579
 
580
 
581
  totalPages += 1;
582
  }
583
  });
584
 
585
  }).done(function() {
586
  jQuery('#loading').fadeOut();
587
  var savedMeta = jQuery('#cf_thepage').val();
588
  if(savedMeta != undefined || savedMeta != null){
589
  savedMeta = savedMeta.split('{#}');
590
  jQuery('#previewiframe').attr('src', savedMeta[6]+'?preview=true');
591
  }
592
  jQuery('#cf_thepage').trigger('change');
593
 
594
  if (totalPages == 0) {
595
  jQuery('#noPageWarning').fadeIn();
596
  jQuery('#cf_thepage').fadeOut();
597
  }
598
  else {
599
  jQuery('#noPageWarning').hide();
600
  jQuery('#cf_thepage').fadeIn();
601
  }
602
  var theposition = jQuery('#cf_thepage').val();
603
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
604
  var myString = thefunnel+'{#}'+theposition;
605
  var arr = myString.split('{#}');
606
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
607
  var do_ping = function() {
608
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
609
  }).catch(function(error) {
610
  });
611
  };
612
  do_ping();
613
  })
614
  .fail(function() {
615
  jQuery('#loading').fadeOut();
616
  })
617
  .always(function() {
618
  jQuery('#loading').fadeOut();
619
  });
620
  setTimeout(function() {
621
 
622
  }, 3000);
623
 
624
  });
625
  var request_image = function(url) {
626
  return new Promise(function(resolve, reject) {
627
  var img = new Image();
628
  img.onload = function() { resolve(img); };
629
  img.onerror = function() { reject(url); };
630
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
631
  });
632
  };
633
  /**
634
  * Pings a url.
635
  * @param {String} url
636
  * @return {Promise} promise that resolves to a ping (ms, float).
637
  */
638
  var ping = function(url) {
639
  return new Promise(function(resolve, reject) {
640
  var start = (new Date()).getTime();
641
  var response = function() {
642
  var delta = ((new Date()).getTime() - start);
643
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
644
  delta /= 4;
645
  resolve(delta);
646
  };
647
  request_image(url).then(response).catch(response);
648
  // Set a timeout for max-pings, 5s.
649
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
650
  });
651
  };
652
  function replaceText(inputText, tagName, tagReplace) {
653
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
654
  return inputText.replace(regExp, tagReplace);
655
  }
656
  // Select New Page
657
  jQuery( '#cf_thepage' ).change(function() {
658
  jQuery('#loading').fadeOut();
659
  var thefunnel = jQuery('#cf_thefunnel').val();
660
  var theposition = jQuery(this).val();
661
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
662
  if(theposition != undefined || theposition != null){
663
  var myString = thefunnel+'{#}'+theposition;
664
  var arr = myString.split('{#}');
665
  var arr2 = theposition.split('{#}');
666
  // Iframe
667
  jQuery('#iframeURL').val(arr2[6]);
668
  var myStr = arr2[3];
669
  // Browser title
670
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
671
 
672
  jQuery('#seoTitle').val(subStr[1].replace(/%20/g, ' '));
673
 
674
  // SEO Desc
675
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
676
  jQuery('#seoDesc').val(subStr[1].replace(/%20/g, ' '));
677
  // SEO Share Image
678
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
679
  jQuery('#seosocial').val(subStr[1]);
680
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
681
  var do_ping = function() {
682
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
683
  }).catch(function(error) {
684
  });
685
  };
686
  do_ping();
687
  jQuery('#previewiframe').attr('src', arr[7]+'?preview=true');
688
  }
689
 
690
  });
691
  // Fade Out Message
692
  setTimeout(function() {
693
  jQuery('#message').fadeOut();
694
  }, 3500);
695
  // Savings
696
  jQuery('#publish').click(function() {
697
  jQuery('#saving').fadeIn();
698
  });
699
  jQuery('#delete').on('click', function () {
700
  return confirm('Are you sure you want to delete this page?');
701
  });
702
  jQuery('#cf_slug').bind('keyup keypress blur', function()
703
  {
704
  var myStr = jQuery(this).val()
705
  myStr=myStr.toLowerCase();
706
  myStr=myStr.replace(/\s/g , "-");
707
  jQuery('#cf_slug').val(myStr);
708
  });
709
  // Check Null and Resave v1.0.6
710
  <?php if ($thepage[1] == 'null') { ?>
711
  // jQuery('#autosaving').fadeIn();
712
  // setTimeout(function() {
713
  // jQuery('form').submit();
714
  // }, 2000);
715
  <?php } ?>
716
  jQuery('#showupdatemetalink').click(function() {
717
  jQuery('form').submit();
718
  });
719
 
720
  });
721
  if ( $cf_page != "" ) {
722
  $json = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ) );
723
  $cf_funnels_pages = json_decode( $json );
724
  }
725
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
726
  <h2>Saving and Reloading...</h2>
727
  <h1><i class="fa fa-cog fa-spin"></i></h1>
728
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
729
  <a href="https://www.app.clickfunnels.com/funnels" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
730
  <br clear="all">
731
  <?php if ( !empty( $_GET['action'] ) ) { ?>
732
  <?php if ( $cf_type=='p' ) {?>
733
  <a style="margin-right: -3px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Open Editor</a>
734
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> View Funnel</a>
735
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> Preview</a>
736
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
737
  <?php if ( $cf_thefunnel == $funnel->id ) { if(strlen($funnel->name) > 30) { echo substr($funnel->name,0,30).'...'; } else { echo $funnel->name;} } } ?></h2>
738
 
739
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank"> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?></a>
740
  <?php }?>
741
  <?php if ( $cf_type=='hp' ) {?>
742
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
743
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
744
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
745
  <h2>Set as Home Page</h2>
746
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?></a>
747
  <?php }?>
748
  <?php if ( $cf_type=='np' ) {?>
749
  <a href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> Launch in Editor</a>
750
  <a style="margin-right: 10px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-cogs"></i> Edit Funnel</a>
751
  <a style="margin-right: 10px;" href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>/invalid-url-404-testing" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> View Page</a>
752
  <h2>Set as 404 Page</h2>
753
  <a href="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url" title="View Page" target="_blank"><i class="fa fa-search"></i> <?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/invalid-url</a>
754
  <?php }?>
755
  <?php if ( $cf_type=='' ) {?>
756
  <h2>Page Undefined - Try saving your page again.</h2>
757
  <?php }?>
758
  <?php if ( $cf_type=='noapi' ) {?>
759
  <h2>No API Fallback</h2>
760
  <?php }?>
761
  <?php } else { ?>
762
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
763
  <?php } ?>
764
  <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>
765
  <iframe src="<?php echo $cf_iframe_url; ?>" style="width: 1280px;height: 750px;-ms-zoom: 0.20; -moz-transform: scale(0.20); -moz-transform-origin: 0 0; -o-transform: scale(0.20); -o-transform-origin: 0 0; -webkit-transform: scale(0.20); -webkit-transform-origin: 0 0;" frameborder="0" id="previewiframe"></iframe>
766
  </div> -->
767
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
768
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
769
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
770
  <div class="row-fluid form-horizontal">
771
  <br>
772
  <a style="float: right;position:relative;z-index: 999999;margin-right: 8px" class="btn pageSettings">Page Settings</a>
773
 
774
  <div class="control-group" style="margin-left: -10px; margin-bottom: 20px !important">
775
  <div data-target="cf_type" class="btn-group multichoice cf_header">
776
  <a data-value="p" class="btn <?php if ( $cf_type=='p' || $cf_type=='') {?> active btn-selected<?php }?>">Regular Page</a>
777
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
778
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
779
  <!-- <a data-value="shortcode" class="btn <?php if ( $cf_type=='shortcode' ) {?> active btn-selected<?php }?>">Shortcode</a> -->
780
  </div>
781
  <input type="hidden" id="cf_type" name="cf_type"/>
782
  </div>
783
  <div class="control-group cf_uses_api" style="">
784
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-filter"></i></label>
785
  <div class="controls">
786
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
787
  <?php if ( empty( $cf_funnels ) ) { ?>
788
  <option value="0">No Funnels Found</option>
789
  <?php }
790
  else {
791
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
792
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
793
  <?php
794
  }
795
  } ?>
796
  </select>
797
  </div>
798
  </div>
799
  <div id="usingSplitTests" style="display: none">
800
  Using split tests
801
  </div>
802
  <div class="control-group cf_uses_api">
803
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
804
  <div class="controls">
805
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
806
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
807
  <option value="0">No Pages Found</option>
808
  <?php }
809
  else {
810
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
811
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
812
  <?php
813
  }
814
  }
815
  ?>
816
  </select>
817
  <i class="fa fa-spinner fa-spin" id="loading"></i>
818
  </div>
819
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;margin-top: -33px;float: left;padding-top: 10px;display: none;width: 100%; clear: both"><em>No compatible pages found for this funnel.</em></div>
820
  </div>
821
  <div class="control-group cf_no_api" >
822
  <label class="control-label" for="cf_iframe_check"> ClickFunnels URL <i class="fa fa-globe"></i></label>
823
  <div class="controls">
824
  <input type="text" class="input-xlarge" id="iframeURL" style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
825
  </div>
826
  </div>
827
  <div class="control-group cf_no_api" >
828
  <label class="control-label" for="cf_iframe_check"> Website Title <i class="fa fa-globe"></i></label>
829
  <div class="controls">
830
  <input type="text" class="input-xlarge" id="seoTitle" style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
831
  </div>
832
  </div>
833
  <div class="control-group cf_no_api" >
834
  <label class="control-label" for="cf_iframe_check"> Description <i class="fa fa-globe"></i></label>
835
  <div class="controls">
836
  <input type="text" class="input-xlarge" id="seoDesc" style="height: 30px;" value="<?php echo $cf_seo_desc; ?>" name="cf_seo_desc" />
837
  </div>
838
  </div>
839
  <div class="control-group cf_no_api" >
840
  <label class="control-label" for="cf_iframe_check"> Social Image URL <i class="fa fa-globe"></i></label>
841
  <div class="controls">
842
  <input type="text" class="input-xlarge" id="seosocial" style="height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
843
  </div>
844
  </div>
845
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/<?php echo $cf_slug; ?>" name="cf_page_url" />
846
 
847
 
848
  <div class="control-group cf_uses_api" >
849
  <label class="control-label" for="cf_iframe_check"> Cookie Split Tests <i class="fa fa-bar-chart"></i></label>
850
  <div class="controls">
851
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
852
  <option value="off">Show random cookied version</option>
853
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Show page in iframe (don't cookie)</option>
854
  </select>
855
  <!-- <small style="float: left;font-size: 11px;padding: 5px;margin-left: 6px"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">What is this?</a></small> -->
856
  </div>
857
  </div>
858
  <?php if ( !empty( $_GET['action'] ) ) { ?>
859
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
860
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
861
  <a href="#" style="margin-left: 20px;margin-top: 5px;display: block;float: left;display: none" id="showupdatemetalink"><i class="fa fa-refresh"></i> Meta Data is Out Dated -- Click to Update</a>
862
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
863
  </div>
864
  <?php } else { ?>
865
  <div class="control-group cf_uses_api" style="margin-bottom: 20px">
866
  <label class="control-label" for="cf_iframe_check"> Meta Data <i class="fa fa-info"></i></label>
867
 
868
  <span style="margin-left: 20px;margin-top: 5px;display: block;float: left" id="metaalreadyupdated"><i class="fa fa-check"></i> Meta Data is Up to Date</span>
869
  </div>
870
  <?php } ?>
871
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
872
  <div class="cf_url control-group" style="<?php echo $display;?>" >
873
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-globe"></i></label>
874
  <div id="cf-wp-path" class="controls ">
875
  <div class="input-prepend">
876
  <span class="add-on" style="font-size: 13px;padding: 4px 10px; background: #ECEEEF; color: #777; text-shadow: none; border: 1px solid #ccc"><?php echo get_option( 'clickfunnels_siteURL' ) ; ?>/</span><input style="height:28px;width: 150px !important" type="textbox" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" name="cf_slug" id="cf_slug" class="input-xlarge">
877
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
878
  </div>
879
  </div>
880
  </div>
881
 
882
 
883
 
884
  <style>
885
  #hiddenStuff {display: none}
886
  </style>
887
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block" <?php } ?>>
888
  <div class="controls">
889
  <strong>Funnel ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[0]; ?>" /> <br></strong>
890
  <strong>Page Key: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[1]; ?>" /><br></strong>
891
  <strong>Page ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[2]; ?>" /><br></strong>
892
  <strong>Funnel Step ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[3]; ?>" /><br></strong>
893
  <strong>Saved Meta: <input type="text" style="font-weight: normal;width: 300px;" id="oldmeta" value="<?php echo $thepage[4]; ?>" /><br></strong>
894
  <strong>JS Meta: <input type="text" style="font-weight: normal;width: 300px;" id="jsmeta" value="" /><br></strong>
895
  <strong>Post ID: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[5]; ?>" /><br></strong>
896
  <strong>Page Name: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $thepage[6]; ?>" /><br></strong>
897
  <strong>Use iframe?: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_check; ?>" /><br></strong>
898
  <strong>Iframe URL: <input type="text" style="font-weight: normal;width: 300px;" value="<?php echo $cf_iframe_url; ?>" /><br></strong>
899
  <textarea name="cf_thefunnel" id="cf_data" style="width: 400px;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
900
  </div>
901
  </div>
902
 
903
  <!-- <div style="background: #fafafa;border-top: 1px solid #eee;padding: 10px;text-align: center;margin: 10px 0px;margin-bottom: 20px" >
904
  <strong style="color: #777"> Running split tests or custom code on your page? Check here
905
  <input type="checkbox" id="useIframe" value="on" <?php if( $cf_iframe_check == 'on') { ?>checked <?php } ?> style="margin: 0 3px;width: 18px;height: 18px;" name="cf_iframe_check"> to activate settings.</strong>
906
  <small style="display: block;font-size: 11px;opacity: .5"><a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Why do you have to activate settings?</a></small>
907
  <input type="text" style="display: none;" id="iframeURL" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
908
  </div> -->
909
  <!-- <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
910
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
911
  <p>Choose any ClickFunnels page to be shown using a custom URL just select any funnel to refresh the list of pages. Create a custom URL and hit 'Save/Publish' to start sending traffic. <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>">Need more help?</a> </p>
912
  <p style="font-size: 11px;opacity: .7;"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
913
  </div>
914
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
915
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
916
  <p> Replace your homepage with a specific ClickFunnels page. You can show any page that you want, this will replace any other homepage settings you may have.</p>
917
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
918
  </div>
919
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
920
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
921
  <p> Show a specific page to be shown on any "Page not Found" such as a misspelled URL or a deleted blog post. Very good place for a squeeze page to get the most out of your traffic.</p>
922
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> If you change META data in editor, refresh page and hit 'Save Changes' to update meta data.</p>
923
  </div> -->
924
  <div class="row-fluid" id="apiFooter">
925
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
926
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right; ">
927
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
928
  </button>
929
  <?php } else { ?>
930
  <button id="publish" name="publish" class="button button-primary " style="float: right; ">
931
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
932
  </button>
933
  <?php } ?>
934
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
935
  <i class="fa fa-spinner fa-spin"></i>
936
  <span>Saving...</span>
937
  </div>
938
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels' );?>"><i class="fa fa-file-text-o"></i> Pages</a>
939
  <a class="button button-secondary" style="float: left; margin-right: 10px" type="submit" href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=cf_api' );?>"><i class="fa fa-cog"></i> Settings</a>
940
  <a href="<?php echo admin_url( 'edit.php?post_type=clickfunnels&page=clickfunnels_support' );?>" class="button button-default" style="float: left;margin-right: 10px"><i class="fa fa-life-ring"></i> Support</a>
941
  <?php if ( !empty( $delete_link ) ) {?>
942
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
943
  <?php }?>
944
  </div>
945
  </div>
946
  </div>
947
  (function($) {
948
  setTimeout(function() {
949
  $('#cf_thepage').trigger( "change" );
950
  }, 1500);
951
  })(jQuery);
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: 1.1.1
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
@@ -72,13 +72,13 @@ class ClickFunnels {
72
  // echo $thepage[0] . "<br/> position:"; // funnel ID
73
  // echo $thepage[1]; // page position
74
 
75
- echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $socialurl,$thepage[0] );
76
  exit();
77
  } else if ( is_404() ) {
78
  $page = $this->get_404();
79
  if ( !empty( $page['post_id'] ) ) {
80
  $thepage = explode( "{#}", $page['page_id'] );
81
- echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $socialurl,$thepage[0] );
82
  exit();
83
  }
84
  else if (get_option( 'clickfunnels_404Redirect' ) == 'yesRedirect') {
@@ -89,7 +89,7 @@ class ClickFunnels {
89
  $page = $this->get_home();
90
  if ( !empty( $page['post_id'] ) ) {
91
  $thepage = explode( "{#}", $page['page_id'] );
92
- echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $socialurl,$thepage[0] );
93
  exit();
94
  }
95
  }
@@ -194,10 +194,10 @@ class ClickFunnels {
194
  return $cf_funnels;
195
  }
196
  }
197
- public function get_page_html( $funnel_id, $position, $meta, $postid, $socialurl,$thepage ) {
198
  $page_html = get_transient( "cf_page_html_{$funnel_id}" );
199
  if (get_post_meta( $postid, "cf_iframe_check", true ) == 'on') {
200
- $page_html = $this->api->get_page_iframe( get_post_meta( $postid, "cf_iframe_url", true ), $meta, get_post_meta( $postid, "cf_seo_title", true ), get_post_meta( $postid, "cf_seo_desc", true ), get_post_meta( $postid, "cf_seo_image", true ), $postid );
201
  return $page_html;
202
  }
203
  else {
@@ -205,7 +205,7 @@ class ClickFunnels {
205
  return $page_html;
206
  }
207
  else {
208
- $page_html = $this->api->get_page_html( $funnel_id, $position, $meta, get_post_meta( $postid, "cf_seo_title", true ), get_post_meta( $postid, "cf_seo_desc", true), get_post_meta( $postid, "cf_seo_image", true ), get_post_meta( $postid, "cf_iframe_url", true ), $socialurl,$thepage );
209
  return $page_html;
210
  }
211
  }
@@ -228,6 +228,7 @@ class ClickFunnels {
228
  $cf_seo_title = $_POST['cf_seo_title'];
229
  $cf_seo_desc = $_POST['cf_seo_desc'];
230
  $cf_seo_image = $_POST['cf_seo_image'];
 
231
  update_post_meta( $post_id, "cf_type", $cf_type );
232
  update_post_meta( $post_id, "cf_page", $cf_page );
233
  update_post_meta( $post_id, "cf_thepage", $cf_thepage );
@@ -239,6 +240,7 @@ class ClickFunnels {
239
  update_post_meta( $post_id, "cf_seo_title", $cf_seo_title );
240
  update_post_meta( $post_id, "cf_seo_desc", $cf_seo_desc );
241
  update_post_meta( $post_id, "cf_seo_image", $cf_seo_image );
 
242
  $cf_options = get_option( "cf_options" );
243
  unset( $cf_options['pages'][$cf_slug] );
244
  update_option( "cf_options", $cf_options );
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: 1.1.2
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
72
  // echo $thepage[0] . "<br/> position:"; // funnel ID
73
  // echo $thepage[1]; // page position
74
 
75
+ echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $thepage[0] );
76
  exit();
77
  } else if ( is_404() ) {
78
  $page = $this->get_404();
79
  if ( !empty( $page['post_id'] ) ) {
80
  $thepage = explode( "{#}", $page['page_id'] );
81
+ echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $thepage[0] );
82
  exit();
83
  }
84
  else if (get_option( 'clickfunnels_404Redirect' ) == 'yesRedirect') {
89
  $page = $this->get_home();
90
  if ( !empty( $page['post_id'] ) ) {
91
  $thepage = explode( "{#}", $page['page_id'] );
92
+ echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4], $thepage[5], $thepage[0] );
93
  exit();
94
  }
95
  }
194
  return $cf_funnels;
195
  }
196
  }
197
+ public function get_page_html( $funnel_id, $position, $meta, $postid, $thepage ) {
198
  $page_html = get_transient( "cf_page_html_{$funnel_id}" );
199
  if (get_post_meta( $postid, "cf_iframe_check", true ) == 'on') {
200
+ $page_html = $this->api->get_page_iframe( get_post_meta( $postid, "cf_iframe_url", true ), $meta, get_post_meta( $postid, "cf_seo_title", true ), get_post_meta( $postid, "cf_seo_desc", true ), get_post_meta( $postid, "cf_seo_image", true ), $postid, get_post_meta( $postid, "cf_page_url", true ) );
201
  return $page_html;
202
  }
203
  else {
205
  return $page_html;
206
  }
207
  else {
208
+ $page_html = $this->api->get_page_html( $funnel_id, $position, $meta, get_post_meta( $postid, "cf_seo_title", true ), get_post_meta( $postid, "cf_seo_desc", true), get_post_meta( $postid, "cf_seo_image", true ), get_post_meta( $postid, "cf_iframe_url", true ), $thepage, get_post_meta( $postid, "cf_page_url", true ) );
209
  return $page_html;
210
  }
211
  }
228
  $cf_seo_title = $_POST['cf_seo_title'];
229
  $cf_seo_desc = $_POST['cf_seo_desc'];
230
  $cf_seo_image = $_POST['cf_seo_image'];
231
+ $cf_page_url = $_POST['cf_page_url'];
232
  update_post_meta( $post_id, "cf_type", $cf_type );
233
  update_post_meta( $post_id, "cf_page", $cf_page );
234
  update_post_meta( $post_id, "cf_thepage", $cf_thepage );
240
  update_post_meta( $post_id, "cf_seo_title", $cf_seo_title );
241
  update_post_meta( $post_id, "cf_seo_desc", $cf_seo_desc );
242
  update_post_meta( $post_id, "cf_seo_image", $cf_seo_image );
243
+ update_post_meta( $post_id, "cf_page_url", $cf_page_url );
244
  $cf_options = get_option( "cf_options" );
245
  unset( $cf_options['pages'][$cf_slug] );
246
  update_option( "cf_options", $cf_options );
footer.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="copyrightInfo">
2
- <p><strong style="float: right;margin-right: 20px;font-weight: 200">Running version 1.1.1</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
1
  <div class="copyrightInfo">
2
+ <p><strong style="float: right;margin-right: 20px;font-weight: 200">Running version 1.1.2</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
geobg.png ADDED
Binary file
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: 3.0
8
  Tested up to: 4.3.1
9
- Stable tag: 1.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
 
@@ -98,6 +98,11 @@ By re-selecting the page it will ping the server which should refresh your page.
98
 
99
  Stay current with the latest version of the plugin:
100
 
 
 
 
 
 
101
  = Version 1.1.1 =
102
 
103
  * Added WordPress URL to social meta data (facebook open graph)
6
  Tags: landing pages, clickfunnels, funnels, sales funnel, optin, internet marketing
7
  Requires at least: 3.0
8
  Tested up to: 4.3.1
9
+ Stable tag: 1.1.2
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
98
 
99
  Stay current with the latest version of the plugin:
100
 
101
+ = Version 1.1.2 =
102
+
103
+ * Error caused by array improperly formatted.
104
+ (to update meta tag for URL when sharing on Facebook, please save and update old pages to get proper WordPress page url)
105
+
106
  = Version 1.1.1 =
107
 
108
  * Added WordPress URL to social meta data (facebook open graph)