ClickFunnels - Version 2.0.3

Version Description

Download this release

Release Info

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

Code changes from version 2.0.2 to 2.0.3

Files changed (5) hide show
  1. CF_API.php +1 -1
  2. admin.php +1 -1
  3. clickfunnels.php +1 -1
  4. footer.php +1 -1
  5. readme.txt +6 -2
CF_API.php CHANGED
@@ -19,7 +19,7 @@ class CF_API {
19
  $funnels = json_decode( $content );
20
 
21
  if ($funnels == '') {
22
- $response = get_file_content( $new_url );
23
  if( is_array($response) ) {
24
  $content = $response['body'];
25
  }
19
  $funnels = json_decode( $content );
20
 
21
  if ($funnels == '') {
22
+ $response = wp_remote_get( $new_url );
23
  if( is_array($response) ) {
24
  $content = $response['body'];
25
  }
admin.php CHANGED
@@ -1 +1 @@
1
- <style>.hndle {display: none !important}</style>
2
  if(!get_option( 'clickfunnels_api_email')) {
3
  update_option( 'clickfunnels_api_email', '');
4
  }
5
  if(!get_option( 'clickfunnels_api_auth')) {
6
  update_option( 'clickfunnels_api_auth', '');
7
  }
8
  if(!get_option( 'clickfunnels_siteURL')) {
9
  update_option( 'clickfunnels_siteURL', '');
10
  }
11
  if(!get_option( 'clickfunnels_404Redirect')) {
12
  update_option( 'clickfunnels_404Redirect', '');
13
  }
14
  if(!get_option( 'clickfunnels_agency_group_tag')) {
15
  update_option( 'clickfunnels_agency_group_tag', '');
16
  }
17
  if(!get_option( 'clickfunnels_agency_api_details')) {
18
  update_option( 'clickfunnels_agency_api_details', '');
19
  }
20
  if(!get_option( 'clickfunnels_agency_reset_data')) {
21
  update_option( 'clickfunnels_agency_reset_data', '');
22
  }
23
  if(!get_option( 'clickfunnels_agency_hide_settings')) {
24
  update_option( 'clickfunnels_agency_hide_settings', '');
25
  }
26
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
27
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
28
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
29
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
30
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
31
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
32
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
33
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
34
  $cf_favicon = get_post_meta( $_GET['post'], "cf_favicon", true );
35
  $cf_author = get_post_meta( $_GET['post'], "cf_author", true );
36
  $cf_keywords = get_post_meta( $_GET['post'], "cf_keywords", true );
37
  $cf_head_tracking = get_post_meta( $_GET['post'], "cf_head_tracking", true );
38
  $cf_footer_tracking = get_post_meta( $_GET['post'], "cf_footer_tracking", true );
39
  $cf_wptracking_code = get_post_meta( $_GET['post'], "cf_wptracking_code", true );
40
  $cf_favicon_choice = get_post_meta( $_GET['post'], "cf_favicon_choice", true );
41
  $cf_slug= get_post_meta( $_GET['post'], 'cf_slug', true );
42
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
43
  $thepage = explode( "{#}", $cf_page );
44
  $savedData = $cf_page;
45
  }
46
  else {
47
  $thepage = explode( "{#}", $cf_page['page_id'] );
48
  $savedData = $cf_page['page_id'];
49
  }
50
  $cf_options = get_option( "cf_options" );
51
  // populate funnels option field
52
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
53
  }
54
  else {
55
  if ($cf_page != "") {
56
  $response = wp_remote_get( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
57
  if( is_array($response) ) {
58
  $json = $response['body']; // use the content
59
  }
60
  $cf_funnels_pages = json_decode( $json );
61
  }
62
  else if ($cf_funnels == '') {
63
  $response = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
64
  if( is_array($response) ) {
65
  $json = $response['body']; // use the content
66
  }
67
  $cf_funnels_pages = json_decode( $json );
68
  }
69
  }
70
  jQuery(document).ready(function(){
71
  jQuery('.draft').hide();
72
  console.log("%cClickFunnels WordPress Plugin", "background: #0166AE; color: white; font-size: 23px");
73
  console.log("%cEditing anything inside the console is for developers only. Do not paste in any code given to you by anyone. Use with caution. Visit for support: https://support.clickfunnels.com/", "color: #888; font-size: 16px");
74
  // Set Correct Options
75
  var thenewdata = jQuery('#cf_thefunnel').val();
76
  var thenewdata = thenewdata.split('{#}');
77
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
78
  jQuery('#cf_thepage').find('option').remove().end();
79
  // alert(specificFunnel);
80
  // alert(thenewdata);
81
  jQuery('#loading').fadeIn();
82
  var favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
83
  <?php if ( empty( $_GET['action'] ) ) { ?>
84
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
85
  <?php } ?>
86
  jQuery.getJSON(specificFunnel, function(data) {
87
  setTimeout(function() {
88
  jQuery('#loading').fadeOut();
89
  }, 2000);
90
  var is_selected = "";
91
  if (data.favicon){
92
  favicon = data.favicon;
93
  }
94
  else {
95
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
96
  }
97
  jQuery.each(data.funnel_steps, function() {
98
  if (this.pages != ''){
99
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
100
  is_selected = "selected";
101
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
102
  } else {
103
  is_selected = "";
104
  }
105
  if ( this.wp_friendly == true && this.pages != '' ) {
106
  jQuery('#iframeURL').val(this.pages[0].published_url);
107
  if (data.favicon){
108
  jQuery('#cf_favicon').val(favicon);
109
  jQuery('#faviconPreview').attr('src', favicon);
110
  } else {
111
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
112
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
113
  }
114
  // Check if has split tests
115
  var splittestkeys = 'none';
116
  if (this.pages.length == 2) {
117
  splittestkeys = '2';
118
  }
119
  else if (this.pages.length == 3) {
120
  splittestkeys = '3';
121
  }
122
  // Ping All Pages in Funnel (to refresh split tests / api)
123
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
124
  pageKey = this.pages[0].key;
125
  jQuery('#headTracking').val(this.pages[0].head_tag);
126
  jQuery('#footerTracking').val(this.pages[0].body_tag);
127
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
128
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
129
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'" '+is_selected+'>'+ this.name +'</option>');
130
  }
131
  }
132
  });
133
  }).done(function() {
134
  jQuery('#loading').fadeOut();
135
  var savedMeta = jQuery('#cf_thepage').val();
136
  if(savedMeta != undefined || savedMeta != null){
137
  savedMeta = savedMeta.split('{#}');
138
  <?php if ( !empty( $_GET['action'] ) ) { ?>
139
  jQuery('#cf_thepage').trigger('change');
140
  <?php } ?>
141
  }
142
  })
143
  .fail(function(jqXHR) {
144
  jQuery('#loading').fadeOut();
145
  jQuery('.badAPI').show();
146
  })
147
  .always(function() {
148
  jQuery('#loading').fadeOut();
149
  });
150
  // Change Funnel Populate Dropdown
151
  jQuery( '#cf_thefunnel' ).change(function() {
152
  jQuery('.choosePageBox').fadeIn();
153
  jQuery('.cftablink').removeClass('disabledLink');
154
  jQuery('#publish').removeClass('disabledLink');
155
  jQuery('#loading').fadeIn();
156
  var thenewdata = jQuery(this).val();
157
  var thenewdata = thenewdata.split('{#}');
158
  var totalPages = 0;
159
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
160
  // alert(specificFunnel);
161
  jQuery('#cf_thepage').find('option').remove().end();
162
  jQuery.getJSON(specificFunnel, function(data) {
163
  setTimeout(function() {
164
  jQuery('#loading').fadeOut();
165
  }, 2000);
166
  if (data.favicon){
167
  favicon = data.favicon;
168
  }
169
  else {
170
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
171
  }
172
  // alert( specificFunnel);
173
  jQuery.each(data.funnel_steps, function() {
174
  if( this.wp_friendly == true && this.pages != '' ) {
175
  // Ping All Pages in Funnel (to refresh split tests / api)
176
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
177
  // Check if has split tests
178
  var splittestkeys = 'none';
179
  if (this.pages.length == 2) {
180
  splittestkeys = '2';
181
  }
182
  else if (this.pages.length == 3) {
183
  splittestkeys = '3';
184
  }
185
  jQuery('#iframeURL').val(this.pages[0].published_url);
186
  jQuery('#cf_funnelwide_tracking_head').val(favicon);
187
  if (data.favicon){
188
  jQuery('#cf_favicon').val(favicon);
189
  jQuery('#faviconPreview').attr('src', favicon);
190
  } else {
191
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
192
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
193
  }
194
  // Tracking Codes
195
  jQuery('#headTracking').val(this.pages[0].head_tag);
196
  jQuery('#footerTracking').val(this.pages[0].body_tag);
197
  jQuery('#fw_headerTracking').val(thenewdata[1]);
198
  jQuery('#fw_footerTracking').val(thenewdata[2]);
199
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
200
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
201
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'">'+ this.name +'</option>');
202
  totalPages += 1;
203
  }
204
  });
205
  }).done(function() {
206
  jQuery('#loading').fadeOut();
207
  var savedMeta = jQuery('#cf_thepage').val();
208
  jQuery('#cf_thepage').trigger('change');
209
  if (totalPages == 0) {
210
  jQuery('#cf_thepage').hide();
211
  jQuery('#runningSplitTests').hide();
212
  jQuery('#noPageWarning').fadeIn();
213
  }
214
  else {
215
  jQuery('#noPageWarning').hide();
216
  jQuery('#cf_thepage').fadeIn();
217
  }
218
  var theposition = jQuery('#cf_thepage').val();
219
  var thefunnel = jQuery('#cf_thefunnel').val();
220
  thefunnel = thefunnel.split('{#}');
221
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
222
  var myString = thefunnel[0]+'{#}'+theposition;
223
  var arr = myString.split('{#}');
224
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
225
  var do_ping = function() {
226
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {}).catch(function(error) {});
227
  };
228
  do_ping();
229
  })
230
  .fail(function() {
231
  jQuery('#loading').fadeOut();
232
  })
233
  .always(function() {
234
  jQuery('#loading').fadeOut();
235
  });
236
  });
237
  var request_image = function(url) {
238
  return new Promise(function(resolve, reject) {
239
  var img = new Image();
240
  img.onload = function() { resolve(img); };
241
  img.onerror = function() { reject(url); };
242
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
243
  });
244
  };
245
  /**
246
  * Pings a url.
247
  * @param {String} url
248
  * @return {Promise} promise that resolves to a ping (ms, float).
249
  */
250
  var ping = function(url) {
251
  return new Promise(function(resolve, reject) {
252
  var start = (new Date()).getTime();
253
  var response = function() {
254
  var delta = ((new Date()).getTime() - start);
255
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
256
  delta /= 4;
257
  resolve(delta);
258
  };
259
  request_image(url).then(response).catch(response);
260
  // Set a timeout for max-pings, 5s.
261
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
262
  });
263
  };
264
  function replaceText(inputText, tagName, tagReplace) {
265
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
266
  return inputText.replace(regExp, tagReplace);
267
  }
268
  // Select New Page
269
  jQuery( '#cf_thepage' ).change(function() {
270
  jQuery('#loading').fadeOut();
271
  var thefunnel = jQuery('#cf_thefunnel').val();
272
  thefunnel = thefunnel.split('{#}');
273
  var theposition = jQuery(this).val();
274
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
275
  if(theposition != undefined || theposition != null){
276
  var myString = thefunnel[0]+'{#}'+theposition;
277
  var arr = myString.split('{#}');
278
  var arr2 = theposition.split('{#}');
279
  jQuery('#iframeURL').val(arr2[6]);
280
  <?php if ($cf_favicon_choice == '') { ?>
281
  if (arr2[7] !== ''){
282
  jQuery('#cf_favicon').val(arr2[7]);
283
  jQuery('#faviconPreview').attr('src', arr2[7]);
284
  } else {
285
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
286
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
287
  }
288
  <?php } else { ?>
289
  if (arr2[7] !== ''){
290
  jQuery('#cf_favicon').val(arr2[7]);
291
  jQuery('#faviconPreview').hide();
292
  jQuery('#metaPreview strong').hide();
293
  } else {
294
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
295
  jQuery('#faviconPreview').hide();
296
  jQuery('#metaPreview strong').hide();
297
  }
298
  <?php } ?>
299
  // Tracking Code
300
  jQuery('#headTracking').val(decodeURIComponent(arr2[8]));
301
  jQuery('#footerTracking').val(decodeURIComponent(arr2[9]));
302
  var thenewdata = jQuery('#cf_thefunnel').val();
303
  var thenewdata = thenewdata.split('{#}');
304
  jQuery('#fw_headTracking').val(thenewdata[1]);
305
  jQuery('#fw_footerTracking').val(thenewdata[2]);
306
  // Check if has split tests
307
  if (arr2[11] == 2) {
308
  var splittestkeys = '1 Active Split Test';
309
  jQuery('#runningSplitTests').show();
310
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
311
  }
312
  else if (arr2[11] == 3) {
313
  var splittestkeys = '2 Active Split Tests';
314
  jQuery('#runningSplitTests').show();
315
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
316
  }
317
  else {
318
  jQuery('#runningSplitTests').hide();
319
  }
320
  var myStr = arr2[3];
321
  // Browser title
322
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
323
  jQuery('.seoTitle').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
324
  jQuery('#metaPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
325
  jQuery('#opengraphPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
326
  var authorname = myStr.match('author%22%20content=%22(.*)%22%3E%3');
327
  jQuery('#seoAuthor').val(decodeURIComponent(authorname[1].replace(/%20/g, ' ')));
328
  jQuery('#theAuthor').html('| '+authorname[1].replace(/%20/g, ' '));
329
  var keywordsmeta = myStr.match('keywords%22%20content=%22(.*)%22%3E%3');
330
  var keywords = keywordsmeta[1].replace(/%20/g, ' ').split('%');
331
  jQuery('#seoKeywords').val(decodeURIComponent(keywords[0]));
332
  // SEO Desc
333
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
334
  jQuery('.seoDesc').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
335
  jQuery('#metaPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
336
  jQuery('#opengraphPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
337
  // SEO Share Image
338
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
339
  jQuery('#seosocial').val(subStr[1]);
340
  if (subStr[1] != ''){
341
  jQuery('#seosocialimage').show();
342
  jQuery('#seosocialimage').attr('src', subStr[1]);
343
  } else {
344
  jQuery('#seosocialimage').hide();
345
  }
346
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
347
  <?php if ( !empty( $_GET['updatemeta']) ) { ?>
348
  setTimeout(function() {
349
  jQuery('#publish').trigger('click');
350
  }, 4000);
351
  <?php } ?>
352
  }
353
  });
354
  // Savings
355
  jQuery('#publish').click(function(e) {
356
  // e.preventDefault()
357
  // if (jQuery(this).hasClass('disabledLink')=== true) {
358
  //
359
  // }
360
  // else {
361
  // jQuery('#saving').fadeIn();
362
  // if (jQuery('#cf_slug').val() == '' && jQuery('.cf_header').val() == 'p') {
363
  // jQuery('.selectapagelink').trigger('click');
364
  // jQuery('#customurlError').fadeIn();
365
  // jQuery('#cf_slug').focus();
366
  // jQuery('#saving').fadeOut();
367
  // }
368
  // else {
369
  // saveNow = 'yes';
370
  // jQuery('.used_slug').each(function () {
371
  // if (jQuery(this).html() == jQuery('#cf_slug').val()) {
372
  // jQuery('#customurlError_duplicate').fadeIn();
373
  // jQuery('#saving').fadeOut();
374
  // saveNow = 'no!';
375
  // }
376
  //
377
  // });
378
  // if (saveNow == 'yes') {
379
  // jQuery('form').submit();
380
  // }
381
  // }
382
  // }
383
  });
384
  jQuery('.showupdatemetalink').click(function() {
385
  jQuery('form').submit();
386
  });
387
  if (jQuery(this).hasClass('disabledLink')=== true) {
388
  }
389
  else {
390
  jQuery('.cftabs').hide();
391
  jQuery('.cftablink').removeClass('active');
392
  jQuery(this).addClass('active');
393
  var tab = jQuery(this).attr('data-tab');
394
  jQuery('#'+tab).show();
395
  }
396
  str = str.replace(/^\s+|\s+$/g, ''); // trim
397
  str = str.toLowerCase();
398
  // remove accents, swap ñ for n, etc
399
  var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
400
  var to = "aaaaeeeeiiiioooouuuunc------";
401
  for (var i=0, l=from.length ; i<l ; i++) {
402
  str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
403
  }
404
  str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
405
  .replace(/\s+/g, '-') // collapse whitespace and replace by -
406
  .replace(/-+/g, '-'); // collapse dashes
407
  return str;
408
  {
409
  var myStr = jQuery(this).val()
410
  myStr=myStr.toLowerCase();
411
  myStr=myStr.replace(/\s/g , "-");
412
  jQuery('#cf_slug').val(myStr);
413
  slug = jQuery(this).val();
414
  customSlug = slug;
415
  customSlug = string_to_slug(customSlug);
416
  jQuery(this).val(customSlug);
417
  jQuery('.customSlugText').text(customSlug);
418
  newurl = jQuery('#cfslugurl').text();
419
  jQuery('#cfslugurl').attr('href', newurl);
420
  jQuery('#cf_page_url').val('<?php echo get_home_url(); ?>/'+myStr);
421
  jQuery('#customurlError').hide();
422
  jQuery('#customurlError_duplicate').hide();
423
  jQuery('#publish').removeClass('disabledLink');
424
  jQuery('.used_slug').each(function () {
425
  if (jQuery(this).html() == customSlug) {
426
  jQuery('#customurlError_duplicate').fadeIn();
427
  jQuery('#publish').addClass('disabledLink');
428
  }
429
  });
430
  if ('' == customSlug) {
431
  jQuery('#customurlError').fadeIn();
432
  jQuery('#publish').addClass('disabledLink');
433
  }
434
  });
435
  if (jQuery(this).val() == 'clickgate') {
436
  jQuery('.cf_url').hide();
437
  jQuery('.clickgateinfo').show();
438
  jQuery('#publish').removeClass('disabledLink');
439
  }
440
  else if (jQuery(this).val() == 'hp') {
441
  jQuery('.cf_url').hide();
442
  jQuery('#publish').removeClass('disabledLink');
443
  }
444
  else if (jQuery(this).val() == 'np') {
445
  jQuery('.cf_url').hide();
446
  jQuery('#publish').removeClass('disabledLink');
447
  }
448
  else {
449
  jQuery('.cf_url').show();
450
  jQuery('.clickgateinfo').hide();
451
  jQuery('#cf_slug').trigger('keyup');
452
  }
453
  });
454
  <?php
455
  // check all CF page slugs
456
  $posts = get_posts(array(
457
  'post_type' => 'clickfunnels',
458
  'post_status' => 'publish',
459
  'fields' => 'ids'
460
  )
461
  );
462
  foreach($posts as $p){
463
  $slug = get_post_meta($p,"cf_slug",true);
464
  if ($slug != $cf_slug) {
465
  echo "<li class='used_slug'>$slug</li>";
466
  }
467
  }
468
  foreach( get_posts('numberposts=-1') as $post ) {
469
  echo "<li class='used_slug'>$post->post_name</li>";
470
  }
471
  foreach( get_pages('numberposts=-1') as $post ) {
472
  echo "<li class='used_slug'>$post->post_name</li>";
473
  }
474
  ?>
475
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
476
  <?php $hideforUpdateMeta = 'display: none !important'; ?>
477
  <style>.bootstrap-wp, .copyrightInfo {display: none; }</style>
478
  <span style="margin: 10px;" class="compatCheck compatwarning">Updating Your Meta Data... <strong><i class="fa fa-spinner fa-spin"></i> Please wait just a moment.</strong></span>
479
  <input type="hidden" name="meta_redirect" value='yes'>
480
  <?php } else { ?>
481
  <h2>
482
  <?php
483
  if ( !empty( $_GET['action'] ) && $cf_funnels ) {
484
  $blankpage = 'no';
485
  foreach ( $cf_funnels as $key=>$funnel ) {
486
  if ( $cf_thefunnel == $funnel->id ) {
487
  $lengthofheadline = 40;
488
  if ( $cf_type=='hp' || $cf_type=='np' || $cf_type=='clickgate' ) { $lengthofheadline = 19; }
489
  if (strlen($thepage[6]) > $lengthofheadline) {
490
  echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...';
491
  $check = '1';
492
  }
493
  else {
494
  if(strlen($thepage[6]) > $lengthofheadline) { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...'; }
495
  else { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.$thepage[6];}
496
  $check = '1';
497
  }
498
  }
499
  else {
500
  $blankpage = 'yes';
501
  }
502
  }
503
  $cf_options = get_option( "cf_options" );
504
  $homeCheck = $cf_options['home'];
505
  $postid = get_the_ID();
506
  if ($cf_page == '' && $cf_type == '' && $blankpage = 'yes' && $homeCheck['post_id'] != $postid && $cf_thepage != '') {
507
  echo 'Requires Custom URL';
508
  }
509
  } else {
510
  echo '<i class="fa fa-plus-square" style="margin-right: 5px"></i> Add New Page';
511
  }
512
  ?>
513
  <?php if ($cf_type == 'clickgate') { ?>
514
  ClickGate Popup
515
  <?php } ?> -->
516
  </h2>
517
  <?php if ( !empty( $_GET['action'] ) ) { ?>
518
  <a style="margin-right: 0;margin-top: -33px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> EDITOR</a>
519
  <a style="margin-right: 10px;margin-top: -33px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-filter"></i> FUNNEL</a>
520
  <a style="margin-right: 10px;margin-top: -33px;" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> PREVIEW</a>
521
  <?php if ( $cf_type=='p' ) {?>
522
  <?php }?>
523
  <?php if ( $cf_type=='hp' ) {?>
524
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-home"></i> Set as Home Page</span>
525
  <?php }?>
526
  <?php if ( $cf_type=='np' ) {?>
527
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-exclamation-triangle"></i> Set as 404 Page</span>
528
  <?php }?>
529
  <?php if ( $cf_type=='clickgate' ) {?>
530
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-external-link"></i> Set as ClickGate</span>
531
  <?php }?>
532
  <?php }?>
533
  <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>
534
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
535
  <input type="hidden" name="meta_redirect" value='yes'>
536
  <?php } ?>
537
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
538
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
539
  <div class="bootstrap-wp"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
540
  <div id="app_sidebar">
541
  <a href="#" data-tab="tab1" class="cftablink selectapagelink active">Select Page</a>
542
  <a href="#" data-tab="tab2" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Meta Data</a>
543
  <a href="#" data-tab="tab4" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Open Graph</a>
544
  <a href="#" data-tab="tab6" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Tracking Code</a>
545
  <a href="#" data-tab="tab3" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Settings</a>
546
  </div>
547
  <div id="app_main" class="col-sm-7 row-fluid form-horizontal">
548
  <div id="tab6" class="cftabs" style="display: none">
549
  <!-- Tracking Code -->
550
  <h2>Tracking Code</h2>
551
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel.</em></p>
552
  <hr style="margin-left: 51px">
553
  <div class="control-group" >
554
  <label class="control-label" for="cf_iframe_check"> WordPress Only Tracking Code </label>
555
  <div class="controls">
556
  <textarea class="input-xlarge wpfooterTracking" id="wpfooterTracking" style="height: 80px;" name="cf_wptracking_code"><?php echo $cf_wptracking_code; ?></textarea>
557
  </div>
558
  </div>
559
  <hr style="margin-left: 51px">
560
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> You can add your own custom tracking code for only this WordPress page, meaning your original page will not have this tracking code.</em></p>
561
  <hr style="margin-left: 51px">
562
  <div class="control-group" >
563
  <label class="control-label" for="cf_iframe_check"> Header Tracking </label>
564
  <div class="controls">
565
  <textarea class="input-xlarge headTracking" id="headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
566
  </div>
567
  </div>
568
  <div class="control-group" >
569
  <label class="control-label" for="cf_iframe_check"> Footer Tracking </label>
570
  <div class="controls">
571
  <textarea class="input-xlarge footerTracking" id="footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
572
  </div>
573
  </div>
574
  <hr style="margin-left: 51px">
575
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Funnel wide tracking is set inside the Funnel Settings in the ClickFunnels app.</em></p>
576
  <hr style="margin-left: 51px">
577
  <div class="control-group" >
578
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Header Tracking </label>
579
  <div class="controls">
580
  <textarea class="input-xlarge fw_headTracking" id="fw_headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
581
  </div>
582
  </div>
583
  <div class="control-group" >
584
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Footer Tracking </label>
585
  <div class="controls">
586
  <textarea class="input-xlarge fw_footerTracking" id="fw_footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
587
  </div>
588
  </div>
589
  </div>
590
  <div id="tab1" class="cftabs">
591
  <!-- Select a Page / Funnel -->
592
  <h2>Select a Page</h2>
593
  <div class="control-group cf_uses_api clearfix" style="">
594
  <label class="control-label" for="cf_thefunnel"> Choose Funnel </label>
595
  <div class="controls">
596
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
597
  <?php if ( empty( $cf_funnels ) ) { ?>
598
  <option value="0">No Funnels Found</option>
599
  <?php }
600
  else {
601
  // Agency Gate Check
602
  $agency_group_tag = get_option('clickfunnels_agency_group_tag');
603
  foreach ( $cf_funnels as $key=>$funnel ) {
604
  if ($agency_group_tag != 'off') {
605
  if ($funnel->group_tag || $funnel->group_tag != '') {
606
  $group_tag = str_replace("'", '{replace}', $funnel->group_tag);
607
  $group_tag = str_replace("\"", '{replace}', $funnel->group_tag);
608
  if ($agency_group_tag == $group_tag) { ?>
609
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
610
  <?php }
611
  } else {
612
  if ($agency_group_tag == 'ungrouped') { ?>
613
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
614
  <?php }
615
  }
616
  }
617
  else { ?>
618
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
619
  <?php }
620
  }
621
  } ?>
622
  </select>
623
  </div>
624
  </div>
625
  <div class="control-group choosePageBox clearfix" style="<?php if ( empty( $_GET['action'] ) ) { echo "display: none"; } ?>">
626
  <label class="control-label" for="cf_thepage">
627
  Choose Page <span id="loading"><i class="fa fa-spinner"></i> <em style="margin-left: 5px;font-size: 11px;">Loading Pages...</em></span>
628
  <div id="runningSplitTests" style="font-size: 11px;opacity: .8;float: right;padding-top: 5px;color: #555;margin-right: 26px;display: none;clear: both">
629
  <!-- Number of Split Tests -->
630
  </div>
631
  </label>
632
  <div class="controls">
633
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
634
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
635
  <option value="0">No Pages Found</option>
636
  <?php }
637
  else {
638
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
639
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
640
  <?php
641
  }
642
  }
643
  ?>
644
  </select>
645
  </div>
646
  <div id="noPageWarning" style="font-size: 11px; margin-left: 28px; margin-top: -13px;float: left;padding-top: 14px;display: none;width: 100%; clear: both">
647
  <strong style="font-size: 13px;display: block;">No compatible pages found. </strong>
648
  <em style="display: block">Membership pages and order pages are not available through plugin.</em>
649
  </div>
650
  <br clear="all">
651
  </div>
652
  <?php if ( $cf_type!="p" && $check == '1') $display ="display:none"; else $display="";?>
653
  <?php if ( $cf_type == '') $display ="display:block"; ?>
654
  <div class="cf_url control-group clearfix" style="<?php echo $display;?>" >
655
  <label class="control-label" for="cf_slug"> Custom Slug</label>
656
  <div id="cf-wp-path" class="controls ">
657
  <input style="padding:10px;"type="text" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" placeholder="your-path-here" name="cf_slug" id="cf_slug" class="input-xlarge">
658
  <?php if ( $cf_type == '' ) $display ="display:block;"; else $display="";?>
659
  <div id="customurlError" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
660
  Add a path before saving.
661
  </div>
662
  <div id="customurlError_duplicate" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
663
  Slug already taken
664
  </div>
665
  </div>
666
  <p class="infoHelp" style="padding-left: 25px;margin-top: 13px;"><span><i class="fa fa-globe" style="margin-right: 3px"></i>
667
  <?php if ( !empty( $_GET['action'] ) ) { ?>
668
  <a style="font-weight: bold;text-decoration: none; padding-bottom: 3px;" id="cfslugurl" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" target="_blank"><?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></a>
669
  <?php } else { ?>
670
  <span style="font-weight: bold;text-decoration: none; padding-bottom: 3px;"> <?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></span>
671
  <?php } ?>
672
  </span></p>
673
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo $cf_page_url; ?>" name="cf_page_url" id="cf_page_url" />
674
  </div>
675
  </div>
676
  <div id="tab2" class="cftabs" style="display: none">
677
  <!-- Meta Data -->
678
  <h2>Meta Data</h2>
679
  <div id="metaPreview">
680
  <h5>PREVIEW</h5>
681
  <img src="<?php echo $cf_favicon; ?>" id="faviconPreview" style="width: 18px;margin-left: 10px;margin-bottom: 5px;float: left;" />
682
  <strong>FAVICON</strong>
683
  <h3><?php echo $cf_seo_title; ?></h3>
684
  <span><?php echo get_home_url() ; ?>/<em style="font-style: normal" class="customSlugText"><?php echo $cf_slug; ?></em></span>
685
  <p><?php echo $cf_seo_desc; ?></p>
686
  </div>
687
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
688
  <hr style="margin-left: 51px">
689
  <div class="control-group" >
690
  <label class="control-label" for="cf_iframe_check"> Website Title </label>
691
  <div class="controls">
692
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
693
  </div>
694
  </div>
695
  <div class="control-group" >
696
  <label class="control-label" for="cf_iframe_check"> Description </label>
697
  <div class="controls">
698
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
699
  </div>
700
  </div>
701
  <div class="control-group" >
702
  <label class="control-label" for="cf_iframe_check"> Keywords </label>
703
  <div class="controls">
704
  <input type="text" class="input-xlarge" id="seoKeywords" readonly="readonly"style="height: 30px;" value="<?php echo $cf_keywords; ?>" name="cf_keywords" />
705
  </div>
706
  </div>
707
  <div class="control-group" >
708
  <label class="control-label" for="cf_iframe_check"> Favicon </label>
709
  <div class="controls">
710
  <input type="text" class="input-xlarge" readonly="readonly"id="cf_favicon" style="height: 30px;" value="<?php echo $cf_favicon; ?>" name="cf_favicon" />
711
  </div>
712
  </div>
713
  <div class="control-group" >
714
  <label class="control-label" for="cf_favicon_choice"> Choose Favicon to Show </label>
715
  <div class="controls">
716
  <select name="cf_favicon_choice" id="cf_favicon_choice" class="cf_favicon_choice" style="width: 100% !important">
717
  <option value="" <?php if($cf_favicon_choice == ''){ echo 'selected'; } ?>>Show ClickFunnels Page Favicon</option>
718
  <option value="default"<?php if($cf_favicon_choice == 'default'){ echo 'selected'; } ?>>Show Default WordPress Favicon</option>
719
  </select>
720
  </div>
721
  </div>
722
  </div>
723
  <div id="tab3" class="cftabs" style="display: none">
724
  <!-- Page Settings -->
725
  <h2>Page Settings</h2>
726
  <div class="innerTab">
727
  <div class="control-group ">
728
  <label class="control-label" for="cf_type"> Choose Page Type</label>
729
  <select name="cf_type" id="cf_type" class="cf_header" style="width: 100% !important">
730
  <option value="p" <?php if($cf_type == 'p'){ echo 'selected'; } ?>>Regular Page</option>
731
  <option value="hp"<?php if($cf_type == 'hp'){ echo 'selected'; } ?>>Set as Home Page</option>
732
  <option value="np"<?php if($cf_type == 'np'){ echo 'selected'; } ?>>Set as 404 Page</option>
733
  <option value="clickgate"<?php if($cf_type == 'clickgate'){ echo 'selected'; } ?>>Set as ClickGate</option>
734
  </select>
735
  </div>
736
  </div>
737
  <?php if ( $cf_type == 'clickgate') $display ="display:block;"; else $display="";?>
738
  <p class="infoHelp clickgateinfo" style="color: #8A6D3B;display: none; <?php echo $display; ?>"><i class="fa fa-star" style="margin-right: 3px"></i> <strong>ClickGate will show this page at the top of any page or post that your visitors land on and will cookie them to show only page only once.</strong></em></p>
739
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Choose to make this a regular page with a path (custom URL) or show this page as the Home Page for your blog. You can also set this page as a 404 page for any old, mispelled or deleted paths. <em>(only one page can be set as a Home, 404 or ClickGate at a time)</em></p>
740
  <hr style="margin-left: 51px">
741
  <div class="control-group cf_uses_api" >
742
  <label class="control-label" for="cf_iframe_check"> Show Page Inside of Iframe</label>
743
  <div class="controls">
744
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
745
  <option value="off">No, show page using ClickFunnels API.</option>
746
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Yes, show page using an iframe.</option>
747
  </select>
748
  </div>
749
  </div>
750
  <br style="clear: both">
751
  <p class="infoHelp" style="margin-top: 15px"><i class="fa fa-question-circle" style="margin-right: 3px"></i> If you have custom code on your page that is not working, choose to show your page inside an iframe to fix any custom code issues. If your page is showing up blank use the iframe option and submit a support ticket.</p>
752
  <hr style="margin-left: 51px">
753
  <div class="control-group" style="display: block">
754
  <label class="control-label" for="cf_iframe_check"> ClickFunnels Page URL <small>(reference only)</small></label>
755
  <div class="controls">
756
  <input type="text" class="input-xlarge" id="iframeURL" readonly="readonly"style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
757
  </div>
758
  </div>
759
  </div>
760
  <div id="tab4" class="cftabs" style="display: none">
761
  <!-- Extra Settings -->
762
  <h2>Open Graph</h2>
763
  <div id="opengraphPreview">
764
  <h5>PREVIEW</h5>
765
  <img style="<?php if ($cf_seo_image == '') { echo 'display: none;'; } ?>" src="<?php echo $cf_seo_image; ?>" id="seosocialimage">
766
  <h3><?php echo $cf_seo_title; ?></h3>
767
  <p><?php echo $cf_seo_desc; ?></p>
768
  <span><?php echo get_home_url() ; ?> <em id="theAuthor"><?php echo '| '.$cf_author; ?></em></span>
769
  </div>
770
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
771
  <hr style="margin-left: 51px">
772
  <div class="control-group" >
773
  <label class="control-label" for="cf_iframe_check"> Title </label>
774
  <div class="controls">
775
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" />
776
  </div>
777
  </div>
778
  <div class="control-group" >
779
  <label class="control-label" for="cf_iframe_check"> Description </label>
780
  <div class="controls">
781
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
782
  </div>
783
  </div>
784
  <div class="control-group" >
785
  <label class="control-label" for="cf_iframe_check"> Author </label>
786
  <div class="controls">
787
  <input type="text" class="input-xlarge" id="seoAuthor" readonly="readonly"style="height: 30px;" value="<?php echo $cf_author; ?>" name="cf_author" />
788
  </div>
789
  </div>
790
  <div class="control-group" >
791
  <label class="control-label" for="cf_iframe_check"> Social Image URL </label>
792
  <div class="controls">
793
  <input type="text" class="input-xlarge" id="seosocial" readonly="readonly" style=" height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
794
  </div>
795
  </div>
796
  </div>
797
  <div id="savePage">
798
  <div style="width: 100%">
799
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
800
  <?php } else { ?>
801
  <input type="submit" name="publish" id="publish" value="Save Page" class="action-button shadow animate green <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>" style="float: right; ">
802
  <?php } ?>
803
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 9px;margin-right: 4px;font-size: 15px;">
804
  <i class="fa fa-spinner fa-spin"></i>
805
  <span>Saving...</span>
806
  </div>
807
  </div>
808
  </div>
809
  <style>
810
  #hiddenStuff {display: none}
811
  </style>
812
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block;clear: both;" <?php } ?>>
813
  <style>
814
  #hiddenStuff input {
815
  display:block;margin-top: 5px;margin-bottom: 5px;font-weight: normal;width: 100%;
816
  }
817
  </style>
818
  <div class="controls">
819
  <br>
820
  <h3>Dev Checks:</h3>
821
  <hr />
822
  <strong>Funnel ID: <input id="checkFunID" type="text" value="<?php echo $thepage[0]; ?>" /></strong>
823
  <strong>Page Key: <input type="text" value="<?php echo $thepage[1]; ?>" /></strong>
824
  <strong>Page ID: <input type="text" value="<?php echo $thepage[2]; ?>" /></strong>
825
  <strong>Funnel Step ID: <input type="text" value="<?php echo $thepage[3]; ?>" /></strong>
826
  <strong>Saved Meta: <input type="text" id="oldmeta" value="<?php echo $thepage[4]; ?>" /></strong>
827
  <strong>JS Meta: <input type="text" id="jsmeta" value="" /></strong>
828
  <strong>Post ID: <input type="text" value="<?php echo $thepage[5]; ?>" /></strong>
829
  <strong>Page Name: <input type="text" value="<?php echo $thepage[6]; ?>" /></strong>
830
  <strong>Use iframe?: <input type="text" value="<?php echo $cf_iframe_check; ?>" /></strong>
831
  <strong>Iframe URL: <input type="text" value="<?php echo $cf_iframe_url; ?>" /></strong>
832
  <textarea name="cf_thefunnel" id="cf_data" style="display:block;margin-top: 5px;margin-bottom: 10px;width: 100%;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
833
  </div>
834
  </div>
835
  </div>
836
  </div>
 
837
  error_reporting(E_ERROR);
838
  if(!get_option( 'clickfunnels_api_email')) {
839
  update_option( 'clickfunnels_api_email', '');
840
  }
841
  if(!get_option( 'clickfunnels_api_auth')) {
842
  update_option( 'clickfunnels_api_auth', '');
843
  }
844
  if(!get_option( 'clickfunnels_siteURL')) {
845
  update_option( 'clickfunnels_siteURL', '');
846
  }
847
  if(!get_option( 'clickfunnels_404Redirect')) {
848
  update_option( 'clickfunnels_404Redirect', '');
849
  }
850
  if(!get_option( 'clickfunnels_agency_group_tag')) {
851
  update_option( 'clickfunnels_agency_group_tag', '');
852
  }
853
  if(!get_option( 'clickfunnels_agency_api_details')) {
854
  update_option( 'clickfunnels_agency_api_details', '');
855
  }
856
  if(!get_option( 'clickfunnels_agency_reset_data')) {
857
  update_option( 'clickfunnels_agency_reset_data', '');
858
  }
859
  if(!get_option( 'clickfunnels_agency_hide_settings')) {
860
  update_option( 'clickfunnels_agency_hide_settings', '');
861
  }
862
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
863
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
864
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
865
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
866
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
867
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
868
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
869
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
870
  $cf_favicon = get_post_meta( $_GET['post'], "cf_favicon", true );
871
  $cf_author = get_post_meta( $_GET['post'], "cf_author", true );
872
  $cf_keywords = get_post_meta( $_GET['post'], "cf_keywords", true );
873
  $cf_head_tracking = get_post_meta( $_GET['post'], "cf_head_tracking", true );
874
  $cf_footer_tracking = get_post_meta( $_GET['post'], "cf_footer_tracking", true );
875
  $cf_wptracking_code = get_post_meta( $_GET['post'], "cf_wptracking_code", true );
876
  $cf_favicon_choice = get_post_meta( $_GET['post'], "cf_favicon_choice", true );
877
  $cf_slug= get_post_meta( $_GET['post'], 'cf_slug', true );
878
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
879
  $thepage = explode( "{#}", $cf_page );
880
  $savedData = $cf_page;
881
  }
882
  else {
883
  $thepage = explode( "{#}", $cf_page['page_id'] );
884
  $savedData = $cf_page['page_id'];
885
  }
886
  $cf_options = get_option( "cf_options" );
887
  // populate funnels option field
888
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
889
  }
890
  else {
891
  if ($cf_page != "") {
892
  $response = wp_remote_get( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
893
  if( is_array($response) ) {
894
  $json = $response['body']; // use the content
895
  }
896
  $cf_funnels_pages = json_decode( $json );
897
  }
898
  else if ($cf_funnels == '') {
899
  $response = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
900
  if( is_array($response) ) {
901
  $json = $response['body']; // use the content
902
  }
903
  $cf_funnels_pages = json_decode( $json );
904
  }
905
  }
906
  jQuery(document).ready(function(){
907
  jQuery('.draft').hide();
908
  console.log("%cClickFunnels WordPress Plugin", "background: #0166AE; color: white; font-size: 23px");
909
  console.log("%cEditing anything inside the console is for developers only. Do not paste in any code given to you by anyone. Use with caution. Visit for support: https://support.clickfunnels.com/", "color: #888; font-size: 16px");
910
  // Set Correct Options
911
  var thenewdata = jQuery('#cf_thefunnel').val();
912
  var checkFunnelID = jQuery('#checkFunID').val();
913
  var checkPageID = jQuery('#checkPageID').val();
914
  if (thenewdata == '0' && checkFunnelID == '') {
915
  var allfunnels = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
916
  jQuery.getJSON(allfunnels, function(data) {
917
  jQuery.each(data, function() {
918
  // Check for Agency
919
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" != 'off') {
920
  if (this.group_tag) {
921
  group_tag = this.group_tag.replace(/(['"])/g, "{replace}");
922
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == group_tag) {
923
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
924
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
925
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
926
  }
927
  } else {
928
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == 'ungrouped') {
929
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
930
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
931
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
932
  }
933
  }
934
  }
935
  // Show All Funnels
936
  else {
937
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
938
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
939
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
940
  }
941
  });
942
  }).fail(function() {
943
  jQuery('.badAPI').show();
944
  });
945
  }
946
  else if (thenewdata == '0' && checkFunnelID != '') {
947
  console.log('has Funnel Id - try to select the funnel ###!#!#!##!!');
948
  var allfunnels = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
949
  jQuery.getJSON(allfunnels, function(data) {
950
  jQuery.each(data, function() {
951
  // Check for Agency
952
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" != 'off') {
953
  if (this.group_tag) {
954
  group_tag = this.group_tag.replace(/(['"])/g, "{replace}");
955
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == group_tag) {
956
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
957
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
958
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
959
  }
960
  } else {
961
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == 'ungrouped') {
962
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
963
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
964
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
965
  }
966
  }
967
  }
968
  // Show All Funnels
969
  else {
970
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
971
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
972
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
973
  }
974
  });
975
  }).fail(function() {
976
  jQuery('.badAPI').show();
977
  });
978
  setTimeout(function() {
979
  jQuery(document).find("#cf_thefunnel option[value='"+checkFunnelID+"']").prop('selected', true).change();
980
 
981
  jQuery(document).find("#cf_thepage option[value='"+checkPageID+"']").prop('selected', true);
982
  jQuery(document).find('.apiSubHeader h2').text(jQuery("#cf_thefunnel option:selected").text())
983
  }, 1500)
984
 
985
  }
986
  else {
987
 
988
  var thenewdata = thenewdata.split('{#}');
989
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
990
  jQuery('#cf_thepage').find('option').remove().end();
991
  // alert(specificFunnel);
992
  // alert(thenewdata);
993
  jQuery('#loading').fadeIn();
994
  var favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
995
  <?php if ( empty( $_GET['action'] ) ) { ?>
996
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
997
  <?php } ?>
998
  jQuery.getJSON(specificFunnel, function(data) {
999
  setTimeout(function() {
1000
  jQuery('#loading').fadeOut();
1001
  }, 2000);
1002
  var is_selected = "";
1003
  if (data.favicon){
1004
  favicon = data.favicon;
1005
  }
1006
  else {
1007
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
1008
  }
1009
  jQuery.each(data.funnel_steps, function() {
1010
  if (this.pages != ''){
1011
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
1012
  is_selected = "selected";
1013
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
1014
  } else {
1015
  is_selected = "";
1016
  }
1017
  if ( this.wp_friendly == true && this.pages != '' ) {
1018
  jQuery('#iframeURL').val(this.pages[0].published_url);
1019
  if (data.favicon){
1020
  jQuery('#cf_favicon').val(favicon);
1021
  jQuery('#faviconPreview').attr('src', favicon);
1022
  } else {
1023
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1024
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1025
  }
1026
  // Check if has split tests
1027
  var splittestkeys = 'none';
1028
  if (this.pages.length == 2) {
1029
  splittestkeys = '2';
1030
  }
1031
  else if (this.pages.length == 3) {
1032
  splittestkeys = '3';
1033
  }
1034
  // Ping All Pages in Funnel (to refresh split tests / api)
1035
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
1036
  pageKey = this.pages[0].key;
1037
  jQuery('#headTracking').val(this.pages[0].head_tag);
1038
  jQuery('#footerTracking').val(this.pages[0].body_tag);
1039
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
1040
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
1041
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'" '+is_selected+'>'+ this.name +'</option>');
1042
  }
1043
  }
1044
  });
1045
  }).done(function() {
1046
  jQuery('#loading').fadeOut();
1047
  var savedMeta = jQuery('#cf_thepage').val();
1048
  if(savedMeta != undefined || savedMeta != null){
1049
  savedMeta = savedMeta.split('{#}');
1050
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1051
  jQuery('#cf_thepage').trigger('change');
1052
  <?php } ?>
1053
  }
1054
  })
1055
  .fail(function(jqXHR) {
1056
  jQuery('#loading').fadeOut();
1057
  // jQuery('.badAPI').show();
1058
  })
1059
  .always(function() {
1060
  jQuery('#loading').fadeOut();
1061
  });
1062
  }
1063
  // Change Funnel Populate Dropdown
1064
  jQuery( '#cf_thefunnel' ).change(function() {
1065
  jQuery('.choosePageBox').fadeIn();
1066
  jQuery('.cftablink').removeClass('disabledLink');
1067
  jQuery('#publish').removeClass('disabledLink');
1068
  jQuery('#loading').fadeIn();
1069
  var thenewdata = jQuery(this).val();
1070
  var thenewdata = thenewdata.split('{#}');
1071
  var totalPages = 0;
1072
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
1073
  // alert(specificFunnel);
1074
  jQuery('#cf_thepage').find('option').remove().end();
1075
  jQuery.getJSON(specificFunnel, function(data) {
1076
  setTimeout(function() {
1077
  jQuery('#loading').fadeOut();
1078
  }, 2000);
1079
  if (data.favicon){
1080
  favicon = data.favicon;
1081
  }
1082
  else {
1083
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
1084
  }
1085
  // alert( specificFunnel);
1086
  jQuery.each(data.funnel_steps, function() {
1087
  if( this.wp_friendly == true && this.pages != '' ) {
1088
  // Ping All Pages in Funnel (to refresh split tests / api)
1089
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
1090
  // Check if has split tests
1091
  var splittestkeys = 'none';
1092
  if (this.pages.length == 2) {
1093
  splittestkeys = '2';
1094
  }
1095
  else if (this.pages.length == 3) {
1096
  splittestkeys = '3';
1097
  }
1098
  jQuery('#iframeURL').val(this.pages[0].published_url);
1099
  jQuery('#cf_funnelwide_tracking_head').val(favicon);
1100
  if (data.favicon){
1101
  jQuery('#cf_favicon').val(favicon);
1102
  jQuery('#faviconPreview').attr('src', favicon);
1103
  } else {
1104
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1105
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1106
  }
1107
  // Tracking Codes
1108
  jQuery('#headTracking').val(this.pages[0].head_tag);
1109
  jQuery('#footerTracking').val(this.pages[0].body_tag);
1110
  jQuery('#fw_headerTracking').val(thenewdata[1]);
1111
  jQuery('#fw_footerTracking').val(thenewdata[2]);
1112
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
1113
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
1114
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'">'+ this.name +'</option>');
1115
  totalPages += 1;
1116
  }
1117
  });
1118
  }).done(function() {
1119
  jQuery('#loading').fadeOut();
1120
  var savedMeta = jQuery('#cf_thepage').val();
1121
  jQuery('#cf_thepage').trigger('change');
1122
  if (totalPages == 0) {
1123
  jQuery('#cf_thepage').hide();
1124
  jQuery('#runningSplitTests').hide();
1125
  jQuery('#noPageWarning').fadeIn();
1126
  }
1127
  else {
1128
  jQuery('#noPageWarning').hide();
1129
  jQuery('#cf_thepage').fadeIn();
1130
  }
1131
  var theposition = jQuery('#cf_thepage').val();
1132
  var thefunnel = jQuery('#cf_thefunnel').val();
1133
  thefunnel = thefunnel.split('{#}');
1134
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
1135
  var myString = thefunnel[0]+'{#}'+theposition;
1136
  var arr = myString.split('{#}');
1137
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
1138
  var do_ping = function() {
1139
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {}).catch(function(error) {});
1140
  };
1141
  do_ping();
1142
  })
1143
  .fail(function() {
1144
  jQuery('#loading').fadeOut();
1145
  })
1146
  .always(function() {
1147
  jQuery('#loading').fadeOut();
1148
  });
1149
  });
1150
  var request_image = function(url) {
1151
  return new Promise(function(resolve, reject) {
1152
  var img = new Image();
1153
  img.onload = function() { resolve(img); };
1154
  img.onerror = function() { reject(url); };
1155
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
1156
  });
1157
  };
1158
  /**
1159
  * Pings a url.
1160
  * @param {String} url
1161
  * @return {Promise} promise that resolves to a ping (ms, float).
1162
  */
1163
  var ping = function(url) {
1164
  return new Promise(function(resolve, reject) {
1165
  var start = (new Date()).getTime();
1166
  var response = function() {
1167
  var delta = ((new Date()).getTime() - start);
1168
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
1169
  delta /= 4;
1170
  resolve(delta);
1171
  };
1172
  request_image(url).then(response).catch(response);
1173
  // Set a timeout for max-pings, 5s.
1174
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
1175
  });
1176
  };
1177
  function replaceText(inputText, tagName, tagReplace) {
1178
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
1179
  return inputText.replace(regExp, tagReplace);
1180
  }
1181
  // Select New Page
1182
  jQuery( '#cf_thepage' ).change(function() {
1183
  jQuery('#loading').fadeOut();
1184
  var thefunnel = jQuery('#cf_thefunnel').val();
1185
  thefunnel = thefunnel.split('{#}');
1186
  var theposition = jQuery(this).val();
1187
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
1188
  if(theposition != undefined || theposition != null){
1189
  var myString = thefunnel[0]+'{#}'+theposition;
1190
  var arr = myString.split('{#}');
1191
  var arr2 = theposition.split('{#}');
1192
  jQuery('#iframeURL').val(arr2[6]);
1193
  <?php if ($cf_favicon_choice == '') { ?>
1194
  if (arr2[7] !== ''){
1195
  jQuery('#cf_favicon').val(arr2[7]);
1196
  jQuery('#faviconPreview').attr('src', arr2[7]);
1197
  } else {
1198
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1199
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1200
  }
1201
  <?php } else { ?>
1202
  if (arr2[7] !== ''){
1203
  jQuery('#cf_favicon').val(arr2[7]);
1204
  jQuery('#faviconPreview').hide();
1205
  jQuery('#metaPreview strong').hide();
1206
  } else {
1207
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1208
  jQuery('#faviconPreview').hide();
1209
  jQuery('#metaPreview strong').hide();
1210
  }
1211
  <?php } ?>
1212
  // Tracking Code
1213
  jQuery('#headTracking').val(decodeURIComponent(arr2[8]));
1214
  jQuery('#footerTracking').val(decodeURIComponent(arr2[9]));
1215
  var thenewdata = jQuery('#cf_thefunnel').val();
1216
  var thenewdata = thenewdata.split('{#}');
1217
  jQuery('#fw_headTracking').val(thenewdata[1]);
1218
  jQuery('#fw_footerTracking').val(thenewdata[2]);
1219
  // Check if has split tests
1220
  if (arr2[11] == 2) {
1221
  var splittestkeys = '1 Active Split Test';
1222
  jQuery('#runningSplitTests').show();
1223
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
1224
  }
1225
  else if (arr2[11] == 3) {
1226
  var splittestkeys = '2 Active Split Tests';
1227
  jQuery('#runningSplitTests').show();
1228
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
1229
  }
1230
  else {
1231
  jQuery('#runningSplitTests').hide();
1232
  }
1233
  var myStr = arr2[3];
1234
  // Browser title
1235
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
1236
  jQuery('.seoTitle').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1237
  jQuery('#metaPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1238
  jQuery('#opengraphPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1239
  var authorname = myStr.match('author%22%20content=%22(.*)%22%3E%3');
1240
  jQuery('#seoAuthor').val(decodeURIComponent(authorname[1].replace(/%20/g, ' ')));
1241
  jQuery('#theAuthor').html('| '+authorname[1].replace(/%20/g, ' '));
1242
  var keywordsmeta = myStr.match('keywords%22%20content=%22(.*)%22%3E%3');
1243
  var keywords = keywordsmeta[1].replace(/%20/g, ' ').split('%');
1244
  jQuery('#seoKeywords').val(decodeURIComponent(keywords[0]));
1245
  // SEO Desc
1246
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
1247
  jQuery('.seoDesc').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1248
  jQuery('#metaPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1249
  jQuery('#opengraphPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1250
  // SEO Share Image
1251
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
1252
  jQuery('#seosocial').val(subStr[1]);
1253
  if (subStr[1] != ''){
1254
  jQuery('#seosocialimage').show();
1255
  jQuery('#seosocialimage').attr('src', subStr[1]);
1256
  } else {
1257
  jQuery('#seosocialimage').hide();
1258
  }
1259
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
1260
  <?php if ( !empty( $_GET['updatemeta']) ) { ?>
1261
  setTimeout(function() {
1262
  jQuery('#publish').trigger('click');
1263
  }, 4000);
1264
  <?php } ?>
1265
  }
1266
  });
1267
  // Savings
1268
  jQuery('#publish').click(function(e) {
1269
  // e.preventDefault()
1270
  // if (jQuery(this).hasClass('disabledLink')=== true) {
1271
  //
1272
  // }
1273
  // else {
1274
  // jQuery('#saving').fadeIn();
1275
  // if (jQuery('#cf_slug').val() == '' && jQuery('.cf_header').val() == 'p') {
1276
  // jQuery('.selectapagelink').trigger('click');
1277
  // jQuery('#customurlError').fadeIn();
1278
  // jQuery('#cf_slug').focus();
1279
  // jQuery('#saving').fadeOut();
1280
  // }
1281
  // else {
1282
  // saveNow = 'yes';
1283
  // jQuery('.used_slug').each(function () {
1284
  // if (jQuery(this).html() == jQuery('#cf_slug').val()) {
1285
  // jQuery('#customurlError_duplicate').fadeIn();
1286
  // jQuery('#saving').fadeOut();
1287
  // saveNow = 'no!';
1288
  // }
1289
  //
1290
  // });
1291
  // if (saveNow == 'yes') {
1292
  // jQuery('form').submit();
1293
  // }
1294
  // }
1295
  // }
1296
  });
1297
  jQuery('.showupdatemetalink').click(function() {
1298
  jQuery('form').submit();
1299
  });
1300
  if (jQuery(this).hasClass('disabledLink')=== true) {
1301
  }
1302
  else {
1303
  jQuery('.cftabs').hide();
1304
  jQuery('.cftablink').removeClass('active');
1305
  jQuery(this).addClass('active');
1306
  var tab = jQuery(this).attr('data-tab');
1307
  jQuery('#'+tab).show();
1308
  }
1309
  str = str.replace(/^\s+|\s+$/g, ''); // trim
1310
  str = str.toLowerCase();
1311
  // remove accents, swap ñ for n, etc
1312
  var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
1313
  var to = "aaaaeeeeiiiioooouuuunc------";
1314
  for (var i=0, l=from.length ; i<l ; i++) {
1315
  str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
1316
  }
1317
  str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
1318
  .replace(/\s+/g, '-') // collapse whitespace and replace by -
1319
  .replace(/-+/g, '-'); // collapse dashes
1320
  return str;
1321
  {
1322
  var myStr = jQuery(this).val()
1323
  myStr=myStr.toLowerCase();
1324
  myStr=myStr.replace(/\s/g , "-");
1325
  jQuery('#cf_slug').val(myStr);
1326
  slug = jQuery(this).val();
1327
  customSlug = slug;
1328
  customSlug = string_to_slug(customSlug);
1329
  jQuery(this).val(customSlug);
1330
  jQuery('.customSlugText').text(customSlug);
1331
  newurl = jQuery('#cfslugurl').text();
1332
  jQuery('#cfslugurl').attr('href', newurl);
1333
  jQuery('#cf_page_url').val('<?php echo get_home_url(); ?>/'+myStr);
1334
  jQuery('#customurlError').hide();
1335
  jQuery('#customurlError_duplicate').hide();
1336
  jQuery('#publish').removeClass('disabledLink');
1337
  jQuery('.used_slug').each(function () {
1338
  if (jQuery(this).html() == customSlug) {
1339
  jQuery('#customurlError_duplicate').fadeIn();
1340
  jQuery('#publish').addClass('disabledLink');
1341
  }
1342
  });
1343
  if ('' == customSlug) {
1344
  jQuery('#customurlError').fadeIn();
1345
  jQuery('#publish').addClass('disabledLink');
1346
  }
1347
  });
1348
  if (jQuery(this).val() == 'clickgate') {
1349
  jQuery('.cf_url').hide();
1350
  jQuery('.clickgateinfo').show();
1351
  jQuery('#publish').removeClass('disabledLink');
1352
  }
1353
  else if (jQuery(this).val() == 'hp') {
1354
  jQuery('.cf_url').hide();
1355
  jQuery('#publish').removeClass('disabledLink');
1356
  }
1357
  else if (jQuery(this).val() == 'np') {
1358
  jQuery('.cf_url').hide();
1359
  jQuery('#publish').removeClass('disabledLink');
1360
  }
1361
  else {
1362
  jQuery('.cf_url').show();
1363
  jQuery('.clickgateinfo').hide();
1364
  jQuery('#cf_slug').trigger('keyup');
1365
  }
1366
  });
1367
  <?php
1368
  // check all CF page slugs
1369
  $posts = get_posts(array(
1370
  'post_type' => 'clickfunnels',
1371
  'post_status' => 'publish',
1372
  'fields' => 'ids'
1373
  )
1374
  );
1375
  foreach($posts as $p){
1376
  $slug = get_post_meta($p,"cf_slug",true);
1377
  if ($slug != $cf_slug) {
1378
  echo "<li class='used_slug'>$slug</li>";
1379
  }
1380
  }
1381
  foreach( get_posts('numberposts=-1') as $post ) {
1382
  echo "<li class='used_slug'>$post->post_name</li>";
1383
  }
1384
  foreach( get_pages('numberposts=-1') as $post ) {
1385
  echo "<li class='used_slug'>$post->post_name</li>";
1386
  }
1387
  ?>
1388
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
1389
  <?php $hideforUpdateMeta = 'display: none !important'; ?>
1390
  <style>.bootstrap-wp, .copyrightInfo {display: none; }</style>
1391
  <span style="margin: 10px;" class="compatCheck compatwarning">Updating Your Meta Data... <strong><i class="fa fa-spinner fa-spin"></i> Please wait just a moment.</strong></span>
1392
  <input type="hidden" name="meta_redirect" value='yes'>
1393
  <?php } else { ?>
1394
  <h2>
1395
  <?php
1396
  if ( !empty( $_GET['action'] ) ) {
1397
  $blankpage = 'no';
1398
  foreach ( $cf_funnels as $key=>$funnel ) {
1399
  if ( $cf_thefunnel == $funnel->id ) {
1400
  $lengthofheadline = 40;
1401
  if ( $cf_type=='hp' || $cf_type=='np' || $cf_type=='clickgate' ) { $lengthofheadline = 19; }
1402
  if (strlen($thepage[6]) > $lengthofheadline) {
1403
  echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...';
1404
  $check = '1';
1405
  }
1406
  else {
1407
  if(strlen($thepage[6]) > $lengthofheadline) { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...'; }
1408
  else { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.$thepage[6];}
1409
  $check = '1';
1410
  }
1411
  }
1412
  else {
1413
  $blankpage = 'yes';
1414
  }
1415
  }
1416
  $cf_options = get_option( "cf_options" );
1417
  $homeCheck = $cf_options['home'];
1418
  $postid = get_the_ID();
1419
  if ($cf_page == '' && $cf_type == '' && $blankpage = 'yes' && $homeCheck['post_id'] != $postid && $cf_thepage != '') {
1420
  echo 'Requires Custom URL';
1421
  }
1422
  } else {
1423
  echo '<i class="fa fa-plus-square" style="margin-right: 5px"></i> Add New Page';
1424
  }
1425
  ?>
1426
  <?php if ($cf_type == 'clickgate') { ?>
1427
  ClickGate Popup
1428
  <?php } ?> -->
1429
  </h2>
1430
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1431
  <a style="margin-right: 0;margin-top: -27px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> EDITOR</a>
1432
  <a style="margin-right: 10px;margin-top: -27px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-filter"></i> FUNNEL</a>
1433
  <a style="margin-right: 10px;margin-top: -27px;" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> PREVIEW</a>
1434
  <?php if ( $cf_type=='p' ) {?>
1435
  <?php }?>
1436
  <?php if ( $cf_type=='hp' ) {?>
1437
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-home"></i> Set as Home Page</span>
1438
  <?php }?>
1439
  <?php if ( $cf_type=='np' ) {?>
1440
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-exclamation-triangle"></i> Set as 404 Page</span>
1441
  <?php }?>
1442
  <?php if ( $cf_type=='clickgate' ) {?>
1443
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-external-link"></i> Set as ClickGate</span>
1444
  <?php }?>
1445
  <?php }?>
1446
  <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>
1447
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
1448
  <input type="hidden" name="meta_redirect" value='yes'>
1449
  <?php } ?>
1450
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
1451
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
1452
  <div class="bootstrap-wp"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1453
  <div id="app_sidebar">
1454
  <a href="#" data-tab="tab1" class="cftablink selectapagelink active">Select Page</a>
1455
  <a href="#" data-tab="tab2" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Meta Data</a>
1456
  <a href="#" data-tab="tab4" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Open Graph</a>
1457
  <a href="#" data-tab="tab6" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Tracking Code</a>
1458
  <a href="#" data-tab="tab3" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Settings</a>
1459
  </div>
1460
  <div id="app_main" class="col-sm-7 row-fluid form-horizontal">
1461
  <div id="tab6" class="cftabs" style="display: none">
1462
  <!-- Tracking Code -->
1463
  <h2>Tracking Code</h2>
1464
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel.</em></p>
1465
  <hr style="margin-left: 51px">
1466
  <div class="control-group" >
1467
  <label class="control-label" for="cf_iframe_check"> WordPress Only Tracking Code </label>
1468
  <div class="controls">
1469
  <textarea class="input-xlarge wpfooterTracking" id="wpfooterTracking" style="height: 80px;" name="cf_wptracking_code"><?php echo $cf_wptracking_code; ?></textarea>
1470
  </div>
1471
  </div>
1472
  <hr style="margin-left: 51px">
1473
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> You can add your own custom tracking code for only this WordPress page, meaning your original page will not have this tracking code.</em></p>
1474
  <hr style="margin-left: 51px">
1475
  <div class="control-group" >
1476
  <label class="control-label" for="cf_iframe_check"> Header Tracking </label>
1477
  <div class="controls">
1478
  <textarea class="input-xlarge headTracking" id="headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
1479
  </div>
1480
  </div>
1481
  <div class="control-group" >
1482
  <label class="control-label" for="cf_iframe_check"> Footer Tracking </label>
1483
  <div class="controls">
1484
  <textarea class="input-xlarge footerTracking" id="footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
1485
  </div>
1486
  </div>
1487
  <hr style="margin-left: 51px">
1488
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Funnel wide tracking is set inside the Funnel Settings in the ClickFunnels app.</em></p>
1489
  <hr style="margin-left: 51px">
1490
  <div class="control-group" >
1491
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Header Tracking </label>
1492
  <div class="controls">
1493
  <textarea class="input-xlarge fw_headTracking" id="fw_headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
1494
  </div>
1495
  </div>
1496
  <div class="control-group" >
1497
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Footer Tracking </label>
1498
  <div class="controls">
1499
  <textarea class="input-xlarge fw_footerTracking" id="fw_footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
1500
  </div>
1501
  </div>
1502
  </div>
1503
  <div id="tab1" class="cftabs">
1504
  <!-- Select a Page / Funnel -->
1505
  <h2>Select a Page</h2>
1506
  <div class="control-group cf_uses_api clearfix" style="">
1507
  <label class="control-label" for="cf_thefunnel"> Choose Funnel </label>
1508
  <div class="controls">
1509
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1510
  <?php if ( empty( $cf_funnels ) ) { ?>
1511
  <option value="0">Select a Funnel</option>
1512
  <?php }
1513
  else {
1514
  // Agency Gate Check
1515
  $agency_group_tag = get_option('clickfunnels_agency_group_tag');
1516
  foreach ( $cf_funnels as $key=>$funnel ) {
1517
  if ($agency_group_tag != 'off') {
1518
  if ($funnel->group_tag || $funnel->group_tag != '') {
1519
  $group_tag = str_replace("'", '{replace}', $funnel->group_tag);
1520
  $group_tag = str_replace("\"", '{replace}', $funnel->group_tag);
1521
  if ($agency_group_tag == $group_tag) { ?>
1522
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1523
  <?php }
1524
  } else {
1525
  if ($agency_group_tag == 'ungrouped') { ?>
1526
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1527
  <?php }
1528
  }
1529
  }
1530
  else { ?>
1531
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1532
  <?php }
1533
  }
1534
  } ?>
1535
  </select>
1536
  </div>
1537
  </div>
1538
  <div class="control-group choosePageBox clearfix" style="<?php if ( empty( $_GET['action'] ) ) { echo "display: none"; } ?>">
1539
  <label class="control-label" for="cf_thepage">
1540
  Choose Page <span id="loading"><i class="fa fa-spinner"></i> <em style="margin-left: 5px;font-size: 11px;">Loading Pages...</em></span>
1541
  <div id="runningSplitTests" style="font-size: 11px;opacity: .8;float: right;padding-top: 5px;color: #555;margin-right: 26px;display: none;clear: both">
1542
  <!-- Number of Split Tests -->
1543
  </div>
1544
  </label>
1545
  <div class="controls">
1546
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1547
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1548
  <option value="0">No Pages Found</option>
1549
  <?php }
1550
  else {
1551
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1552
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1553
  <?php
1554
  }
1555
  }
1556
  ?>
1557
  </select>
1558
  </div>
1559
  <div id="noPageWarning" style="font-size: 11px; margin-left: 28px; margin-top: -13px;float: left;padding-top: 14px;display: none;width: 100%; clear: both">
1560
  <strong style="font-size: 13px;display: block;">No compatible pages found. </strong>
1561
  <em style="display: block">Membership pages and order pages are not available through plugin.</em>
1562
  </div>
1563
  <br clear="all">
1564
  </div>
1565
  <?php if ( $cf_type!="p" && $check == '1') $display ="display:none"; else $display="";?>
1566
  <?php if ( $cf_type == '') $display ="display:block"; ?>
1567
  <div class="cf_url control-group clearfix" style="<?php echo $display;?>" >
1568
  <label class="control-label" for="cf_slug"> Custom Slug</label>
1569
  <div id="cf-wp-path" class="controls ">
1570
  <input style="padding:10px;"type="text" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" placeholder="your-path-here" name="cf_slug" id="cf_slug" class="input-xlarge">
1571
  <?php if ( $cf_type == '' ) $display ="display:block;"; else $display="";?>
1572
  <div id="customurlError" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
1573
  Add a path before saving.
1574
  </div>
1575
  <div id="customurlError_duplicate" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
1576
  Slug already taken
1577
  </div>
1578
  </div>
1579
  <p class="infoHelp" style="padding-left: 25px;margin-top: 13px;"><span><i class="fa fa-globe" style="margin-right: 3px"></i>
1580
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1581
  <a style="font-weight: bold;text-decoration: none; padding-bottom: 3px;" id="cfslugurl" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" target="_blank"><?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></a>
1582
  <?php } else { ?>
1583
  <span style="font-weight: bold;text-decoration: none; padding-bottom: 3px;"> <?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></span>
1584
  <?php } ?>
1585
  </span></p>
1586
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo $cf_page_url; ?>" name="cf_page_url" id="cf_page_url" />
1587
  </div>
1588
  </div>
1589
  <div id="tab2" class="cftabs" style="display: none">
1590
  <!-- Meta Data -->
1591
  <h2>Meta Data</h2>
1592
  <div id="metaPreview">
1593
  <h5>PREVIEW</h5>
1594
  <img src="<?php echo $cf_favicon; ?>" id="faviconPreview" style="width: 18px;margin-left: 10px;margin-bottom: 5px;float: left;" />
1595
  <strong>FAVICON</strong>
1596
  <h3><?php echo $cf_seo_title; ?></h3>
1597
  <span><?php echo get_home_url() ; ?>/<em style="font-style: normal" class="customSlugText"><?php echo $cf_slug; ?></em></span>
1598
  <p><?php echo $cf_seo_desc; ?></p>
1599
  </div>
1600
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
1601
  <hr style="margin-left: 51px">
1602
  <div class="control-group" >
1603
  <label class="control-label" for="cf_iframe_check"> Website Title </label>
1604
  <div class="controls">
1605
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
1606
  </div>
1607
  </div>
1608
  <div class="control-group" >
1609
  <label class="control-label" for="cf_iframe_check"> Description </label>
1610
  <div class="controls">
1611
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
1612
  </div>
1613
  </div>
1614
  <div class="control-group" >
1615
  <label class="control-label" for="cf_iframe_check"> Keywords </label>
1616
  <div class="controls">
1617
  <input type="text" class="input-xlarge" id="seoKeywords" readonly="readonly"style="height: 30px;" value="<?php echo $cf_keywords; ?>" name="cf_keywords" />
1618
  </div>
1619
  </div>
1620
  <div class="control-group" >
1621
  <label class="control-label" for="cf_iframe_check"> Favicon </label>
1622
  <div class="controls">
1623
  <input type="text" class="input-xlarge" readonly="readonly"id="cf_favicon" style="height: 30px;" value="<?php echo $cf_favicon; ?>" name="cf_favicon" />
1624
  </div>
1625
  </div>
1626
  <div class="control-group" >
1627
  <label class="control-label" for="cf_favicon_choice"> Choose Favicon to Show </label>
1628
  <div class="controls">
1629
  <select name="cf_favicon_choice" id="cf_favicon_choice" class="cf_favicon_choice" style="width: 100% !important">
1630
  <option value="" <?php if($cf_favicon_choice == ''){ echo 'selected'; } ?>>Show ClickFunnels Page Favicon</option>
1631
  <option value="default"<?php if($cf_favicon_choice == 'default'){ echo 'selected'; } ?>>Show Default WordPress Favicon</option>
1632
  </select>
1633
  </div>
1634
  </div>
1635
  </div>
1636
  <div id="tab3" class="cftabs" style="display: none">
1637
  <!-- Page Settings -->
1638
  <h2>Page Settings</h2>
1639
  <div class="innerTab">
1640
  <div class="control-group ">
1641
  <label class="control-label" for="cf_type"> Choose Page Type</label>
1642
  <select name="cf_type" id="cf_type" class="cf_header" style="width: 100% !important">
1643
  <option value="p" <?php if($cf_type == 'p'){ echo 'selected'; } ?>>Regular Page</option>
1644
  <option value="hp"<?php if($cf_type == 'hp'){ echo 'selected'; } ?>>Set as Home Page</option>
1645
  <option value="np"<?php if($cf_type == 'np'){ echo 'selected'; } ?>>Set as 404 Page</option>
1646
  <option value="clickgate"<?php if($cf_type == 'clickgate'){ echo 'selected'; } ?>>Set as ClickGate</option>
1647
  </select>
1648
  </div>
1649
  </div>
1650
  <?php if ( $cf_type == 'clickgate') $display ="display:block;"; else $display="";?>
1651
  <p class="infoHelp clickgateinfo" style="color: #8A6D3B;display: none; <?php echo $display; ?>"><i class="fa fa-star" style="margin-right: 3px"></i> <strong>ClickGate will show this page at the top of any page or post that your visitors land on and will cookie them to show only page only once.</strong></em></p>
1652
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Choose to make this a regular page with a path (custom URL) or show this page as the Home Page for your blog. You can also set this page as a 404 page for any old, mispelled or deleted paths. <em>(only one page can be set as a Home, 404 or ClickGate at a time)</em></p>
1653
  <hr style="margin-left: 51px">
1654
  <div class="control-group cf_uses_api" >
1655
  <label class="control-label" for="cf_iframe_check"> Show Page Inside of Iframe</label>
1656
  <div class="controls">
1657
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
1658
  <option value="off">No, show page using ClickFunnels API.</option>
1659
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Yes, show page using an iframe.</option>
1660
  </select>
1661
  </div>
1662
  </div>
1663
  <br style="clear: both">
1664
  <p class="infoHelp" style="margin-top: 15px"><i class="fa fa-question-circle" style="margin-right: 3px"></i> If you have custom code on your page that is not working, choose to show your page inside an iframe to fix any custom code issues. If your page is showing up blank use the iframe option and submit a support ticket.</p>
1665
  <hr style="margin-left: 51px">
1666
  <div class="control-group" style="display: block">
1667
  <label class="control-label" for="cf_iframe_check"> ClickFunnels Page URL <small>(reference only)</small></label>
1668
  <div class="controls">
1669
  <input type="text" class="input-xlarge" id="iframeURL" readonly="readonly"style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
1670
  </div>
1671
  </div>
1672
  </div>
1673
  <div id="tab4" class="cftabs" style="display: none">
1674
  <!-- Extra Settings -->
1675
  <h2>Open Graph</h2>
1676
  <div id="opengraphPreview">
1677
  <h5>PREVIEW</h5>
1678
  <img style="<?php if ($cf_seo_image == '') { echo 'display: none;'; } ?>" src="<?php echo $cf_seo_image; ?>" id="seosocialimage">
1679
  <h3><?php echo $cf_seo_title; ?></h3>
1680
  <p><?php echo $cf_seo_desc; ?></p>
1681
  <span><?php echo get_home_url() ; ?> <em id="theAuthor"><?php echo '| '.$cf_author; ?></em></span>
1682
  </div>
1683
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
1684
  <hr style="margin-left: 51px">
1685
  <div class="control-group" >
1686
  <label class="control-label" for="cf_iframe_check"> Title </label>
1687
  <div class="controls">
1688
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" />
1689
  </div>
1690
  </div>
1691
  <div class="control-group" >
1692
  <label class="control-label" for="cf_iframe_check"> Description </label>
1693
  <div class="controls">
1694
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
1695
  </div>
1696
  </div>
1697
  <div class="control-group" >
1698
  <label class="control-label" for="cf_iframe_check"> Author </label>
1699
  <div class="controls">
1700
  <input type="text" class="input-xlarge" id="seoAuthor" readonly="readonly"style="height: 30px;" value="<?php echo $cf_author; ?>" name="cf_author" />
1701
  </div>
1702
  </div>
1703
  <div class="control-group" >
1704
  <label class="control-label" for="cf_iframe_check"> Social Image URL </label>
1705
  <div class="controls">
1706
  <input type="text" class="input-xlarge" id="seosocial" readonly="readonly" style=" height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
1707
  </div>
1708
  </div>
1709
  </div>
1710
  <div id="savePage">
1711
  <div style="width: 100%">
1712
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1713
  <?php } else { ?>
1714
  <input type="submit" name="publish" id="publish" value="Save Page" class="action-button shadow animate green <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>" style="float: right; ">
1715
  <?php } ?>
1716
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 9px;margin-right: 4px;font-size: 15px;">
1717
  <i class="fa fa-spinner fa-spin"></i>
1718
  <span>Saving...</span>
1719
  </div>
1720
  </div>
1721
  </div>
1722
  <style>
1723
  #hiddenStuff {display: none}
1724
  </style>
1725
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block;clear: both;" <?php } ?>>
1726
  <style>
1727
  #hiddenStuff input {
1728
  display:block;margin-top: 5px;margin-bottom: 5px;font-weight: normal;width: 100%;
1729
  }
1730
  </style>
1731
  <div class="controls">
1732
  <br>
1733
  <h3>Dev Checks:</h3>
1734
  <hr />
1735
  <strong>Funnel ID: <input id="checkFunID" type="text" value="<?php echo $thepage[0]; ?>" /></strong>
1736
  <strong>Page Key: <input type="text" value="<?php echo $thepage[1]; ?>" /></strong>
1737
  <strong>Page ID: <input type="text" id="checkPageID" value="<?php echo $thepage[2]; ?>" /></strong>
1738
  <strong>Funnel Step ID: <input type="text" value="<?php echo $thepage[3]; ?>" /></strong>
1739
  <strong>Saved Meta: <input type="text" id="oldmeta" value="<?php echo $thepage[4]; ?>" /></strong>
1740
  <strong>JS Meta: <input type="text" id="jsmeta" value="" /></strong>
1741
  <strong>Post ID: <input type="text" value="<?php echo $thepage[5]; ?>" /></strong>
1742
  <strong>Page Name: <input type="text" value="<?php echo $thepage[6]; ?>" /></strong>
1743
  <strong>Use iframe?: <input type="text" value="<?php echo $cf_iframe_check; ?>" /></strong>
1744
  <strong>Iframe URL: <input type="text" value="<?php echo $cf_iframe_url; ?>" /></strong>
1745
  <textarea name="cf_thefunnel" id="cf_data" style="display:block;margin-top: 5px;margin-bottom: 10px;width: 100%;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
1746
  </div>
1747
  </div>
1748
  </div>
1749
  </div>
 
1
  if(!get_option( 'clickfunnels_api_email')) {
2
  update_option( 'clickfunnels_api_email', '');
3
  }
4
  if(!get_option( 'clickfunnels_api_auth')) {
5
  update_option( 'clickfunnels_api_auth', '');
6
  }
7
  if(!get_option( 'clickfunnels_siteURL')) {
8
  update_option( 'clickfunnels_siteURL', '');
9
  }
10
  if(!get_option( 'clickfunnels_404Redirect')) {
11
  update_option( 'clickfunnels_404Redirect', '');
12
  }
13
  if(!get_option( 'clickfunnels_agency_group_tag')) {
14
  update_option( 'clickfunnels_agency_group_tag', '');
15
  }
16
  if(!get_option( 'clickfunnels_agency_api_details')) {
17
  update_option( 'clickfunnels_agency_api_details', '');
18
  }
19
  if(!get_option( 'clickfunnels_agency_reset_data')) {
20
  update_option( 'clickfunnels_agency_reset_data', '');
21
  }
22
  if(!get_option( 'clickfunnels_agency_hide_settings')) {
23
  update_option( 'clickfunnels_agency_hide_settings', '');
24
  }
25
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
26
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
27
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
28
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
29
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
30
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
31
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
32
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
33
  $cf_favicon = get_post_meta( $_GET['post'], "cf_favicon", true );
34
  $cf_author = get_post_meta( $_GET['post'], "cf_author", true );
35
  $cf_keywords = get_post_meta( $_GET['post'], "cf_keywords", true );
36
  $cf_head_tracking = get_post_meta( $_GET['post'], "cf_head_tracking", true );
37
  $cf_footer_tracking = get_post_meta( $_GET['post'], "cf_footer_tracking", true );
38
  $cf_wptracking_code = get_post_meta( $_GET['post'], "cf_wptracking_code", true );
39
  $cf_favicon_choice = get_post_meta( $_GET['post'], "cf_favicon_choice", true );
40
  $cf_slug= get_post_meta( $_GET['post'], 'cf_slug', true );
41
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
42
  $thepage = explode( "{#}", $cf_page );
43
  $savedData = $cf_page;
44
  }
45
  else {
46
  $thepage = explode( "{#}", $cf_page['page_id'] );
47
  $savedData = $cf_page['page_id'];
48
  }
49
  $cf_options = get_option( "cf_options" );
50
  // populate funnels option field
51
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
52
  }
53
  else {
54
  if ($cf_page != "") {
55
  $response = wp_remote_get( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
56
  if( is_array($response) ) {
57
  $json = $response['body']; // use the content
58
  }
59
  $cf_funnels_pages = json_decode( $json );
60
  }
61
  else if ($cf_funnels == '') {
62
  $response = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
63
  if( is_array($response) ) {
64
  $json = $response['body']; // use the content
65
  }
66
  $cf_funnels_pages = json_decode( $json );
67
  }
68
  }
69
  jQuery(document).ready(function(){
70
  jQuery('.draft').hide();
71
  console.log("%cClickFunnels WordPress Plugin", "background: #0166AE; color: white; font-size: 23px");
72
  console.log("%cEditing anything inside the console is for developers only. Do not paste in any code given to you by anyone. Use with caution. Visit for support: https://support.clickfunnels.com/", "color: #888; font-size: 16px");
73
  // Set Correct Options
74
  var thenewdata = jQuery('#cf_thefunnel').val();
75
  var thenewdata = thenewdata.split('{#}');
76
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
77
  jQuery('#cf_thepage').find('option').remove().end();
78
  // alert(specificFunnel);
79
  // alert(thenewdata);
80
  jQuery('#loading').fadeIn();
81
  var favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
82
  <?php if ( empty( $_GET['action'] ) ) { ?>
83
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
84
  <?php } ?>
85
  jQuery.getJSON(specificFunnel, function(data) {
86
  setTimeout(function() {
87
  jQuery('#loading').fadeOut();
88
  }, 2000);
89
  var is_selected = "";
90
  if (data.favicon){
91
  favicon = data.favicon;
92
  }
93
  else {
94
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
95
  }
96
  jQuery.each(data.funnel_steps, function() {
97
  if (this.pages != ''){
98
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
99
  is_selected = "selected";
100
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
101
  } else {
102
  is_selected = "";
103
  }
104
  if ( this.wp_friendly == true && this.pages != '' ) {
105
  jQuery('#iframeURL').val(this.pages[0].published_url);
106
  if (data.favicon){
107
  jQuery('#cf_favicon').val(favicon);
108
  jQuery('#faviconPreview').attr('src', favicon);
109
  } else {
110
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
111
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
112
  }
113
  // Check if has split tests
114
  var splittestkeys = 'none';
115
  if (this.pages.length == 2) {
116
  splittestkeys = '2';
117
  }
118
  else if (this.pages.length == 3) {
119
  splittestkeys = '3';
120
  }
121
  // Ping All Pages in Funnel (to refresh split tests / api)
122
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
123
  pageKey = this.pages[0].key;
124
  jQuery('#headTracking').val(this.pages[0].head_tag);
125
  jQuery('#footerTracking').val(this.pages[0].body_tag);
126
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
127
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
128
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'" '+is_selected+'>'+ this.name +'</option>');
129
  }
130
  }
131
  });
132
  }).done(function() {
133
  jQuery('#loading').fadeOut();
134
  var savedMeta = jQuery('#cf_thepage').val();
135
  if(savedMeta != undefined || savedMeta != null){
136
  savedMeta = savedMeta.split('{#}');
137
  <?php if ( !empty( $_GET['action'] ) ) { ?>
138
  jQuery('#cf_thepage').trigger('change');
139
  <?php } ?>
140
  }
141
  })
142
  .fail(function(jqXHR) {
143
  jQuery('#loading').fadeOut();
144
  jQuery('.badAPI').show();
145
  })
146
  .always(function() {
147
  jQuery('#loading').fadeOut();
148
  });
149
  // Change Funnel Populate Dropdown
150
  jQuery( '#cf_thefunnel' ).change(function() {
151
  jQuery('.choosePageBox').fadeIn();
152
  jQuery('.cftablink').removeClass('disabledLink');
153
  jQuery('#publish').removeClass('disabledLink');
154
  jQuery('#loading').fadeIn();
155
  var thenewdata = jQuery(this).val();
156
  var thenewdata = thenewdata.split('{#}');
157
  var totalPages = 0;
158
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
159
  // alert(specificFunnel);
160
  jQuery('#cf_thepage').find('option').remove().end();
161
  jQuery.getJSON(specificFunnel, function(data) {
162
  setTimeout(function() {
163
  jQuery('#loading').fadeOut();
164
  }, 2000);
165
  if (data.favicon){
166
  favicon = data.favicon;
167
  }
168
  else {
169
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
170
  }
171
  // alert( specificFunnel);
172
  jQuery.each(data.funnel_steps, function() {
173
  if( this.wp_friendly == true && this.pages != '' ) {
174
  // Ping All Pages in Funnel (to refresh split tests / api)
175
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
176
  // Check if has split tests
177
  var splittestkeys = 'none';
178
  if (this.pages.length == 2) {
179
  splittestkeys = '2';
180
  }
181
  else if (this.pages.length == 3) {
182
  splittestkeys = '3';
183
  }
184
  jQuery('#iframeURL').val(this.pages[0].published_url);
185
  jQuery('#cf_funnelwide_tracking_head').val(favicon);
186
  if (data.favicon){
187
  jQuery('#cf_favicon').val(favicon);
188
  jQuery('#faviconPreview').attr('src', favicon);
189
  } else {
190
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
191
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
192
  }
193
  // Tracking Codes
194
  jQuery('#headTracking').val(this.pages[0].head_tag);
195
  jQuery('#footerTracking').val(this.pages[0].body_tag);
196
  jQuery('#fw_headerTracking').val(thenewdata[1]);
197
  jQuery('#fw_footerTracking').val(thenewdata[2]);
198
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
199
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
200
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'">'+ this.name +'</option>');
201
  totalPages += 1;
202
  }
203
  });
204
  }).done(function() {
205
  jQuery('#loading').fadeOut();
206
  var savedMeta = jQuery('#cf_thepage').val();
207
  jQuery('#cf_thepage').trigger('change');
208
  if (totalPages == 0) {
209
  jQuery('#cf_thepage').hide();
210
  jQuery('#runningSplitTests').hide();
211
  jQuery('#noPageWarning').fadeIn();
212
  }
213
  else {
214
  jQuery('#noPageWarning').hide();
215
  jQuery('#cf_thepage').fadeIn();
216
  }
217
  var theposition = jQuery('#cf_thepage').val();
218
  var thefunnel = jQuery('#cf_thefunnel').val();
219
  thefunnel = thefunnel.split('{#}');
220
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
221
  var myString = thefunnel[0]+'{#}'+theposition;
222
  var arr = myString.split('{#}');
223
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
224
  var do_ping = function() {
225
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {}).catch(function(error) {});
226
  };
227
  do_ping();
228
  })
229
  .fail(function() {
230
  jQuery('#loading').fadeOut();
231
  })
232
  .always(function() {
233
  jQuery('#loading').fadeOut();
234
  });
235
  });
236
  var request_image = function(url) {
237
  return new Promise(function(resolve, reject) {
238
  var img = new Image();
239
  img.onload = function() { resolve(img); };
240
  img.onerror = function() { reject(url); };
241
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
242
  });
243
  };
244
  /**
245
  * Pings a url.
246
  * @param {String} url
247
  * @return {Promise} promise that resolves to a ping (ms, float).
248
  */
249
  var ping = function(url) {
250
  return new Promise(function(resolve, reject) {
251
  var start = (new Date()).getTime();
252
  var response = function() {
253
  var delta = ((new Date()).getTime() - start);
254
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
255
  delta /= 4;
256
  resolve(delta);
257
  };
258
  request_image(url).then(response).catch(response);
259
  // Set a timeout for max-pings, 5s.
260
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
261
  });
262
  };
263
  function replaceText(inputText, tagName, tagReplace) {
264
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
265
  return inputText.replace(regExp, tagReplace);
266
  }
267
  // Select New Page
268
  jQuery( '#cf_thepage' ).change(function() {
269
  jQuery('#loading').fadeOut();
270
  var thefunnel = jQuery('#cf_thefunnel').val();
271
  thefunnel = thefunnel.split('{#}');
272
  var theposition = jQuery(this).val();
273
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
274
  if(theposition != undefined || theposition != null){
275
  var myString = thefunnel[0]+'{#}'+theposition;
276
  var arr = myString.split('{#}');
277
  var arr2 = theposition.split('{#}');
278
  jQuery('#iframeURL').val(arr2[6]);
279
  <?php if ($cf_favicon_choice == '') { ?>
280
  if (arr2[7] !== ''){
281
  jQuery('#cf_favicon').val(arr2[7]);
282
  jQuery('#faviconPreview').attr('src', arr2[7]);
283
  } else {
284
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
285
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
286
  }
287
  <?php } else { ?>
288
  if (arr2[7] !== ''){
289
  jQuery('#cf_favicon').val(arr2[7]);
290
  jQuery('#faviconPreview').hide();
291
  jQuery('#metaPreview strong').hide();
292
  } else {
293
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
294
  jQuery('#faviconPreview').hide();
295
  jQuery('#metaPreview strong').hide();
296
  }
297
  <?php } ?>
298
  // Tracking Code
299
  jQuery('#headTracking').val(decodeURIComponent(arr2[8]));
300
  jQuery('#footerTracking').val(decodeURIComponent(arr2[9]));
301
  var thenewdata = jQuery('#cf_thefunnel').val();
302
  var thenewdata = thenewdata.split('{#}');
303
  jQuery('#fw_headTracking').val(thenewdata[1]);
304
  jQuery('#fw_footerTracking').val(thenewdata[2]);
305
  // Check if has split tests
306
  if (arr2[11] == 2) {
307
  var splittestkeys = '1 Active Split Test';
308
  jQuery('#runningSplitTests').show();
309
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
310
  }
311
  else if (arr2[11] == 3) {
312
  var splittestkeys = '2 Active Split Tests';
313
  jQuery('#runningSplitTests').show();
314
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
315
  }
316
  else {
317
  jQuery('#runningSplitTests').hide();
318
  }
319
  var myStr = arr2[3];
320
  // Browser title
321
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
322
  jQuery('.seoTitle').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
323
  jQuery('#metaPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
324
  jQuery('#opengraphPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
325
  var authorname = myStr.match('author%22%20content=%22(.*)%22%3E%3');
326
  jQuery('#seoAuthor').val(decodeURIComponent(authorname[1].replace(/%20/g, ' ')));
327
  jQuery('#theAuthor').html('| '+authorname[1].replace(/%20/g, ' '));
328
  var keywordsmeta = myStr.match('keywords%22%20content=%22(.*)%22%3E%3');
329
  var keywords = keywordsmeta[1].replace(/%20/g, ' ').split('%');
330
  jQuery('#seoKeywords').val(decodeURIComponent(keywords[0]));
331
  // SEO Desc
332
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
333
  jQuery('.seoDesc').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
334
  jQuery('#metaPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
335
  jQuery('#opengraphPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
336
  // SEO Share Image
337
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
338
  jQuery('#seosocial').val(subStr[1]);
339
  if (subStr[1] != ''){
340
  jQuery('#seosocialimage').show();
341
  jQuery('#seosocialimage').attr('src', subStr[1]);
342
  } else {
343
  jQuery('#seosocialimage').hide();
344
  }
345
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
346
  <?php if ( !empty( $_GET['updatemeta']) ) { ?>
347
  setTimeout(function() {
348
  jQuery('#publish').trigger('click');
349
  }, 4000);
350
  <?php } ?>
351
  }
352
  });
353
  // Savings
354
  jQuery('#publish').click(function(e) {
355
  // e.preventDefault()
356
  // if (jQuery(this).hasClass('disabledLink')=== true) {
357
  //
358
  // }
359
  // else {
360
  // jQuery('#saving').fadeIn();
361
  // if (jQuery('#cf_slug').val() == '' && jQuery('.cf_header').val() == 'p') {
362
  // jQuery('.selectapagelink').trigger('click');
363
  // jQuery('#customurlError').fadeIn();
364
  // jQuery('#cf_slug').focus();
365
  // jQuery('#saving').fadeOut();
366
  // }
367
  // else {
368
  // saveNow = 'yes';
369
  // jQuery('.used_slug').each(function () {
370
  // if (jQuery(this).html() == jQuery('#cf_slug').val()) {
371
  // jQuery('#customurlError_duplicate').fadeIn();
372
  // jQuery('#saving').fadeOut();
373
  // saveNow = 'no!';
374
  // }
375
  //
376
  // });
377
  // if (saveNow == 'yes') {
378
  // jQuery('form').submit();
379
  // }
380
  // }
381
  // }
382
  });
383
  jQuery('.showupdatemetalink').click(function() {
384
  jQuery('form').submit();
385
  });
386
  if (jQuery(this).hasClass('disabledLink')=== true) {
387
  }
388
  else {
389
  jQuery('.cftabs').hide();
390
  jQuery('.cftablink').removeClass('active');
391
  jQuery(this).addClass('active');
392
  var tab = jQuery(this).attr('data-tab');
393
  jQuery('#'+tab).show();
394
  }
395
  str = str.replace(/^\s+|\s+$/g, ''); // trim
396
  str = str.toLowerCase();
397
  // remove accents, swap ñ for n, etc
398
  var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
399
  var to = "aaaaeeeeiiiioooouuuunc------";
400
  for (var i=0, l=from.length ; i<l ; i++) {
401
  str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
402
  }
403
  str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
404
  .replace(/\s+/g, '-') // collapse whitespace and replace by -
405
  .replace(/-+/g, '-'); // collapse dashes
406
  return str;
407
  {
408
  var myStr = jQuery(this).val()
409
  myStr=myStr.toLowerCase();
410
  myStr=myStr.replace(/\s/g , "-");
411
  jQuery('#cf_slug').val(myStr);
412
  slug = jQuery(this).val();
413
  customSlug = slug;
414
  customSlug = string_to_slug(customSlug);
415
  jQuery(this).val(customSlug);
416
  jQuery('.customSlugText').text(customSlug);
417
  newurl = jQuery('#cfslugurl').text();
418
  jQuery('#cfslugurl').attr('href', newurl);
419
  jQuery('#cf_page_url').val('<?php echo get_home_url(); ?>/'+myStr);
420
  jQuery('#customurlError').hide();
421
  jQuery('#customurlError_duplicate').hide();
422
  jQuery('#publish').removeClass('disabledLink');
423
  jQuery('.used_slug').each(function () {
424
  if (jQuery(this).html() == customSlug) {
425
  jQuery('#customurlError_duplicate').fadeIn();
426
  jQuery('#publish').addClass('disabledLink');
427
  }
428
  });
429
  if ('' == customSlug) {
430
  jQuery('#customurlError').fadeIn();
431
  jQuery('#publish').addClass('disabledLink');
432
  }
433
  });
434
  if (jQuery(this).val() == 'clickgate') {
435
  jQuery('.cf_url').hide();
436
  jQuery('.clickgateinfo').show();
437
  jQuery('#publish').removeClass('disabledLink');
438
  }
439
  else if (jQuery(this).val() == 'hp') {
440
  jQuery('.cf_url').hide();
441
  jQuery('#publish').removeClass('disabledLink');
442
  }
443
  else if (jQuery(this).val() == 'np') {
444
  jQuery('.cf_url').hide();
445
  jQuery('#publish').removeClass('disabledLink');
446
  }
447
  else {
448
  jQuery('.cf_url').show();
449
  jQuery('.clickgateinfo').hide();
450
  jQuery('#cf_slug').trigger('keyup');
451
  }
452
  });
453
  <?php
454
  // check all CF page slugs
455
  $posts = get_posts(array(
456
  'post_type' => 'clickfunnels',
457
  'post_status' => 'publish',
458
  'fields' => 'ids'
459
  )
460
  );
461
  foreach($posts as $p){
462
  $slug = get_post_meta($p,"cf_slug",true);
463
  if ($slug != $cf_slug) {
464
  echo "<li class='used_slug'>$slug</li>";
465
  }
466
  }
467
  foreach( get_posts('numberposts=-1') as $post ) {
468
  echo "<li class='used_slug'>$post->post_name</li>";
469
  }
470
  foreach( get_pages('numberposts=-1') as $post ) {
471
  echo "<li class='used_slug'>$post->post_name</li>";
472
  }
473
  ?>
474
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
475
  <?php $hideforUpdateMeta = 'display: none !important'; ?>
476
  <style>.bootstrap-wp, .copyrightInfo {display: none; }</style>
477
  <span style="margin: 10px;" class="compatCheck compatwarning">Updating Your Meta Data... <strong><i class="fa fa-spinner fa-spin"></i> Please wait just a moment.</strong></span>
478
  <input type="hidden" name="meta_redirect" value='yes'>
479
  <?php } else { ?>
480
  <h2>
481
  <?php
482
  if ( !empty( $_GET['action'] ) && $cf_funnels ) {
483
  $blankpage = 'no';
484
  foreach ( $cf_funnels as $key=>$funnel ) {
485
  if ( $cf_thefunnel == $funnel->id ) {
486
  $lengthofheadline = 40;
487
  if ( $cf_type=='hp' || $cf_type=='np' || $cf_type=='clickgate' ) { $lengthofheadline = 19; }
488
  if (strlen($thepage[6]) > $lengthofheadline) {
489
  echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...';
490
  $check = '1';
491
  }
492
  else {
493
  if(strlen($thepage[6]) > $lengthofheadline) { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...'; }
494
  else { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.$thepage[6];}
495
  $check = '1';
496
  }
497
  }
498
  else {
499
  $blankpage = 'yes';
500
  }
501
  }
502
  $cf_options = get_option( "cf_options" );
503
  $homeCheck = $cf_options['home'];
504
  $postid = get_the_ID();
505
  if ($cf_page == '' && $cf_type == '' && $blankpage = 'yes' && $homeCheck['post_id'] != $postid && $cf_thepage != '') {
506
  echo 'Requires Custom URL';
507
  }
508
  } else {
509
  echo '<i class="fa fa-plus-square" style="margin-right: 5px"></i> Add New Page';
510
  }
511
  ?>
512
  <?php if ($cf_type == 'clickgate') { ?>
513
  ClickGate Popup
514
  <?php } ?> -->
515
  </h2>
516
  <?php if ( !empty( $_GET['action'] ) ) { ?>
517
  <a style="margin-right: 0;margin-top: -33px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> EDITOR</a>
518
  <a style="margin-right: 10px;margin-top: -33px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-filter"></i> FUNNEL</a>
519
  <a style="margin-right: 10px;margin-top: -33px;" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> PREVIEW</a>
520
  <?php if ( $cf_type=='p' ) {?>
521
  <?php }?>
522
  <?php if ( $cf_type=='hp' ) {?>
523
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-home"></i> Set as Home Page</span>
524
  <?php }?>
525
  <?php if ( $cf_type=='np' ) {?>
526
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-exclamation-triangle"></i> Set as 404 Page</span>
527
  <?php }?>
528
  <?php if ( $cf_type=='clickgate' ) {?>
529
  <span style="margin-right: 10px;margin-top: -33px;" class="editThisPage2"><i class="fa fa-external-link"></i> Set as ClickGate</span>
530
  <?php }?>
531
  <?php }?>
532
  <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>
533
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
534
  <input type="hidden" name="meta_redirect" value='yes'>
535
  <?php } ?>
536
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
537
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
538
  <div class="bootstrap-wp"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
539
  <div id="app_sidebar">
540
  <a href="#" data-tab="tab1" class="cftablink selectapagelink active">Select Page</a>
541
  <a href="#" data-tab="tab2" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Meta Data</a>
542
  <a href="#" data-tab="tab4" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Open Graph</a>
543
  <a href="#" data-tab="tab6" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Tracking Code</a>
544
  <a href="#" data-tab="tab3" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Settings</a>
545
  </div>
546
  <div id="app_main" class="col-sm-7 row-fluid form-horizontal">
547
  <div id="tab6" class="cftabs" style="display: none">
548
  <!-- Tracking Code -->
549
  <h2>Tracking Code</h2>
550
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel.</em></p>
551
  <hr style="margin-left: 51px">
552
  <div class="control-group" >
553
  <label class="control-label" for="cf_iframe_check"> WordPress Only Tracking Code </label>
554
  <div class="controls">
555
  <textarea class="input-xlarge wpfooterTracking" id="wpfooterTracking" style="height: 80px;" name="cf_wptracking_code"><?php echo $cf_wptracking_code; ?></textarea>
556
  </div>
557
  </div>
558
  <hr style="margin-left: 51px">
559
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> You can add your own custom tracking code for only this WordPress page, meaning your original page will not have this tracking code.</em></p>
560
  <hr style="margin-left: 51px">
561
  <div class="control-group" >
562
  <label class="control-label" for="cf_iframe_check"> Header Tracking </label>
563
  <div class="controls">
564
  <textarea class="input-xlarge headTracking" id="headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
565
  </div>
566
  </div>
567
  <div class="control-group" >
568
  <label class="control-label" for="cf_iframe_check"> Footer Tracking </label>
569
  <div class="controls">
570
  <textarea class="input-xlarge footerTracking" id="footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
571
  </div>
572
  </div>
573
  <hr style="margin-left: 51px">
574
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Funnel wide tracking is set inside the Funnel Settings in the ClickFunnels app.</em></p>
575
  <hr style="margin-left: 51px">
576
  <div class="control-group" >
577
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Header Tracking </label>
578
  <div class="controls">
579
  <textarea class="input-xlarge fw_headTracking" id="fw_headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
580
  </div>
581
  </div>
582
  <div class="control-group" >
583
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Footer Tracking </label>
584
  <div class="controls">
585
  <textarea class="input-xlarge fw_footerTracking" id="fw_footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
586
  </div>
587
  </div>
588
  </div>
589
  <div id="tab1" class="cftabs">
590
  <!-- Select a Page / Funnel -->
591
  <h2>Select a Page</h2>
592
  <div class="control-group cf_uses_api clearfix" style="">
593
  <label class="control-label" for="cf_thefunnel"> Choose Funnel </label>
594
  <div class="controls">
595
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
596
  <?php if ( empty( $cf_funnels ) ) { ?>
597
  <option value="0">No Funnels Found</option>
598
  <?php }
599
  else {
600
  // Agency Gate Check
601
  $agency_group_tag = get_option('clickfunnels_agency_group_tag');
602
  foreach ( $cf_funnels as $key=>$funnel ) {
603
  if ($agency_group_tag != 'off') {
604
  if ($funnel->group_tag || $funnel->group_tag != '') {
605
  $group_tag = str_replace("'", '{replace}', $funnel->group_tag);
606
  $group_tag = str_replace("\"", '{replace}', $funnel->group_tag);
607
  if ($agency_group_tag == $group_tag) { ?>
608
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
609
  <?php }
610
  } else {
611
  if ($agency_group_tag == 'ungrouped') { ?>
612
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
613
  <?php }
614
  }
615
  }
616
  else { ?>
617
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
618
  <?php }
619
  }
620
  } ?>
621
  </select>
622
  </div>
623
  </div>
624
  <div class="control-group choosePageBox clearfix" style="<?php if ( empty( $_GET['action'] ) ) { echo "display: none"; } ?>">
625
  <label class="control-label" for="cf_thepage">
626
  Choose Page <span id="loading"><i class="fa fa-spinner"></i> <em style="margin-left: 5px;font-size: 11px;">Loading Pages...</em></span>
627
  <div id="runningSplitTests" style="font-size: 11px;opacity: .8;float: right;padding-top: 5px;color: #555;margin-right: 26px;display: none;clear: both">
628
  <!-- Number of Split Tests -->
629
  </div>
630
  </label>
631
  <div class="controls">
632
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
633
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
634
  <option value="0">No Pages Found</option>
635
  <?php }
636
  else {
637
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
638
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
639
  <?php
640
  }
641
  }
642
  ?>
643
  </select>
644
  </div>
645
  <div id="noPageWarning" style="font-size: 11px; margin-left: 28px; margin-top: -13px;float: left;padding-top: 14px;display: none;width: 100%; clear: both">
646
  <strong style="font-size: 13px;display: block;">No compatible pages found. </strong>
647
  <em style="display: block">Membership pages and order pages are not available through plugin.</em>
648
  </div>
649
  <br clear="all">
650
  </div>
651
  <?php if ( $cf_type!="p" && $check == '1') $display ="display:none"; else $display="";?>
652
  <?php if ( $cf_type == '') $display ="display:block"; ?>
653
  <div class="cf_url control-group clearfix" style="<?php echo $display;?>" >
654
  <label class="control-label" for="cf_slug"> Custom Slug</label>
655
  <div id="cf-wp-path" class="controls ">
656
  <input style="padding:10px;"type="text" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" placeholder="your-path-here" name="cf_slug" id="cf_slug" class="input-xlarge">
657
  <?php if ( $cf_type == '' ) $display ="display:block;"; else $display="";?>
658
  <div id="customurlError" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
659
  Add a path before saving.
660
  </div>
661
  <div id="customurlError_duplicate" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
662
  Slug already taken
663
  </div>
664
  </div>
665
  <p class="infoHelp" style="padding-left: 25px;margin-top: 13px;"><span><i class="fa fa-globe" style="margin-right: 3px"></i>
666
  <?php if ( !empty( $_GET['action'] ) ) { ?>
667
  <a style="font-weight: bold;text-decoration: none; padding-bottom: 3px;" id="cfslugurl" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" target="_blank"><?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></a>
668
  <?php } else { ?>
669
  <span style="font-weight: bold;text-decoration: none; padding-bottom: 3px;"> <?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></span>
670
  <?php } ?>
671
  </span></p>
672
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo $cf_page_url; ?>" name="cf_page_url" id="cf_page_url" />
673
  </div>
674
  </div>
675
  <div id="tab2" class="cftabs" style="display: none">
676
  <!-- Meta Data -->
677
  <h2>Meta Data</h2>
678
  <div id="metaPreview">
679
  <h5>PREVIEW</h5>
680
  <img src="<?php echo $cf_favicon; ?>" id="faviconPreview" style="width: 18px;margin-left: 10px;margin-bottom: 5px;float: left;" />
681
  <strong>FAVICON</strong>
682
  <h3><?php echo $cf_seo_title; ?></h3>
683
  <span><?php echo get_home_url() ; ?>/<em style="font-style: normal" class="customSlugText"><?php echo $cf_slug; ?></em></span>
684
  <p><?php echo $cf_seo_desc; ?></p>
685
  </div>
686
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
687
  <hr style="margin-left: 51px">
688
  <div class="control-group" >
689
  <label class="control-label" for="cf_iframe_check"> Website Title </label>
690
  <div class="controls">
691
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
692
  </div>
693
  </div>
694
  <div class="control-group" >
695
  <label class="control-label" for="cf_iframe_check"> Description </label>
696
  <div class="controls">
697
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
698
  </div>
699
  </div>
700
  <div class="control-group" >
701
  <label class="control-label" for="cf_iframe_check"> Keywords </label>
702
  <div class="controls">
703
  <input type="text" class="input-xlarge" id="seoKeywords" readonly="readonly"style="height: 30px;" value="<?php echo $cf_keywords; ?>" name="cf_keywords" />
704
  </div>
705
  </div>
706
  <div class="control-group" >
707
  <label class="control-label" for="cf_iframe_check"> Favicon </label>
708
  <div class="controls">
709
  <input type="text" class="input-xlarge" readonly="readonly"id="cf_favicon" style="height: 30px;" value="<?php echo $cf_favicon; ?>" name="cf_favicon" />
710
  </div>
711
  </div>
712
  <div class="control-group" >
713
  <label class="control-label" for="cf_favicon_choice"> Choose Favicon to Show </label>
714
  <div class="controls">
715
  <select name="cf_favicon_choice" id="cf_favicon_choice" class="cf_favicon_choice" style="width: 100% !important">
716
  <option value="" <?php if($cf_favicon_choice == ''){ echo 'selected'; } ?>>Show ClickFunnels Page Favicon</option>
717
  <option value="default"<?php if($cf_favicon_choice == 'default'){ echo 'selected'; } ?>>Show Default WordPress Favicon</option>
718
  </select>
719
  </div>
720
  </div>
721
  </div>
722
  <div id="tab3" class="cftabs" style="display: none">
723
  <!-- Page Settings -->
724
  <h2>Page Settings</h2>
725
  <div class="innerTab">
726
  <div class="control-group ">
727
  <label class="control-label" for="cf_type"> Choose Page Type</label>
728
  <select name="cf_type" id="cf_type" class="cf_header" style="width: 100% !important">
729
  <option value="p" <?php if($cf_type == 'p'){ echo 'selected'; } ?>>Regular Page</option>
730
  <option value="hp"<?php if($cf_type == 'hp'){ echo 'selected'; } ?>>Set as Home Page</option>
731
  <option value="np"<?php if($cf_type == 'np'){ echo 'selected'; } ?>>Set as 404 Page</option>
732
  <option value="clickgate"<?php if($cf_type == 'clickgate'){ echo 'selected'; } ?>>Set as ClickGate</option>
733
  </select>
734
  </div>
735
  </div>
736
  <?php if ( $cf_type == 'clickgate') $display ="display:block;"; else $display="";?>
737
  <p class="infoHelp clickgateinfo" style="color: #8A6D3B;display: none; <?php echo $display; ?>"><i class="fa fa-star" style="margin-right: 3px"></i> <strong>ClickGate will show this page at the top of any page or post that your visitors land on and will cookie them to show only page only once.</strong></em></p>
738
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Choose to make this a regular page with a path (custom URL) or show this page as the Home Page for your blog. You can also set this page as a 404 page for any old, mispelled or deleted paths. <em>(only one page can be set as a Home, 404 or ClickGate at a time)</em></p>
739
  <hr style="margin-left: 51px">
740
  <div class="control-group cf_uses_api" >
741
  <label class="control-label" for="cf_iframe_check"> Show Page Inside of Iframe</label>
742
  <div class="controls">
743
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
744
  <option value="off">No, show page using ClickFunnels API.</option>
745
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Yes, show page using an iframe.</option>
746
  </select>
747
  </div>
748
  </div>
749
  <br style="clear: both">
750
  <p class="infoHelp" style="margin-top: 15px"><i class="fa fa-question-circle" style="margin-right: 3px"></i> If you have custom code on your page that is not working, choose to show your page inside an iframe to fix any custom code issues. If your page is showing up blank use the iframe option and submit a support ticket.</p>
751
  <hr style="margin-left: 51px">
752
  <div class="control-group" style="display: block">
753
  <label class="control-label" for="cf_iframe_check"> ClickFunnels Page URL <small>(reference only)</small></label>
754
  <div class="controls">
755
  <input type="text" class="input-xlarge" id="iframeURL" readonly="readonly"style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
756
  </div>
757
  </div>
758
  </div>
759
  <div id="tab4" class="cftabs" style="display: none">
760
  <!-- Extra Settings -->
761
  <h2>Open Graph</h2>
762
  <div id="opengraphPreview">
763
  <h5>PREVIEW</h5>
764
  <img style="<?php if ($cf_seo_image == '') { echo 'display: none;'; } ?>" src="<?php echo $cf_seo_image; ?>" id="seosocialimage">
765
  <h3><?php echo $cf_seo_title; ?></h3>
766
  <p><?php echo $cf_seo_desc; ?></p>
767
  <span><?php echo get_home_url() ; ?> <em id="theAuthor"><?php echo '| '.$cf_author; ?></em></span>
768
  </div>
769
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
770
  <hr style="margin-left: 51px">
771
  <div class="control-group" >
772
  <label class="control-label" for="cf_iframe_check"> Title </label>
773
  <div class="controls">
774
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" />
775
  </div>
776
  </div>
777
  <div class="control-group" >
778
  <label class="control-label" for="cf_iframe_check"> Description </label>
779
  <div class="controls">
780
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
781
  </div>
782
  </div>
783
  <div class="control-group" >
784
  <label class="control-label" for="cf_iframe_check"> Author </label>
785
  <div class="controls">
786
  <input type="text" class="input-xlarge" id="seoAuthor" readonly="readonly"style="height: 30px;" value="<?php echo $cf_author; ?>" name="cf_author" />
787
  </div>
788
  </div>
789
  <div class="control-group" >
790
  <label class="control-label" for="cf_iframe_check"> Social Image URL </label>
791
  <div class="controls">
792
  <input type="text" class="input-xlarge" id="seosocial" readonly="readonly" style=" height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
793
  </div>
794
  </div>
795
  </div>
796
  <div id="savePage">
797
  <div style="width: 100%">
798
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
799
  <?php } else { ?>
800
  <input type="submit" name="publish" id="publish" value="Save Page" class="action-button shadow animate green <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>" style="float: right; ">
801
  <?php } ?>
802
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 9px;margin-right: 4px;font-size: 15px;">
803
  <i class="fa fa-spinner fa-spin"></i>
804
  <span>Saving...</span>
805
  </div>
806
  </div>
807
  </div>
808
  <style>
809
  #hiddenStuff {display: none}
810
  </style>
811
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block;clear: both;" <?php } ?>>
812
  <style>
813
  #hiddenStuff input {
814
  display:block;margin-top: 5px;margin-bottom: 5px;font-weight: normal;width: 100%;
815
  }
816
  </style>
817
  <div class="controls">
818
  <br>
819
  <h3>Dev Checks:</h3>
820
  <hr />
821
  <strong>Funnel ID: <input id="checkFunID" type="text" value="<?php echo $thepage[0]; ?>" /></strong>
822
  <strong>Page Key: <input type="text" value="<?php echo $thepage[1]; ?>" /></strong>
823
  <strong>Page ID: <input type="text" value="<?php echo $thepage[2]; ?>" /></strong>
824
  <strong>Funnel Step ID: <input type="text" value="<?php echo $thepage[3]; ?>" /></strong>
825
  <strong>Saved Meta: <input type="text" id="oldmeta" value="<?php echo $thepage[4]; ?>" /></strong>
826
  <strong>JS Meta: <input type="text" id="jsmeta" value="" /></strong>
827
  <strong>Post ID: <input type="text" value="<?php echo $thepage[5]; ?>" /></strong>
828
  <strong>Page Name: <input type="text" value="<?php echo $thepage[6]; ?>" /></strong>
829
  <strong>Use iframe?: <input type="text" value="<?php echo $cf_iframe_check; ?>" /></strong>
830
  <strong>Iframe URL: <input type="text" value="<?php echo $cf_iframe_url; ?>" /></strong>
831
  <textarea name="cf_thefunnel" id="cf_data" style="display:block;margin-top: 5px;margin-bottom: 10px;width: 100%;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
832
  </div>
833
  </div>
834
  </div>
835
  </div>
836
+ <style>.hndle {display: none !important}</style>
837
  error_reporting(E_ERROR);
838
  if(!get_option( 'clickfunnels_api_email')) {
839
  update_option( 'clickfunnels_api_email', '');
840
  }
841
  if(!get_option( 'clickfunnels_api_auth')) {
842
  update_option( 'clickfunnels_api_auth', '');
843
  }
844
  if(!get_option( 'clickfunnels_siteURL')) {
845
  update_option( 'clickfunnels_siteURL', '');
846
  }
847
  if(!get_option( 'clickfunnels_404Redirect')) {
848
  update_option( 'clickfunnels_404Redirect', '');
849
  }
850
  if(!get_option( 'clickfunnels_agency_group_tag')) {
851
  update_option( 'clickfunnels_agency_group_tag', '');
852
  }
853
  if(!get_option( 'clickfunnels_agency_api_details')) {
854
  update_option( 'clickfunnels_agency_api_details', '');
855
  }
856
  if(!get_option( 'clickfunnels_agency_reset_data')) {
857
  update_option( 'clickfunnels_agency_reset_data', '');
858
  }
859
  if(!get_option( 'clickfunnels_agency_hide_settings')) {
860
  update_option( 'clickfunnels_agency_hide_settings', '');
861
  }
862
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
863
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
864
  $cf_iframe_check = get_post_meta( $_GET['post'], "cf_iframe_check", true );
865
  $cf_iframe_url = get_post_meta( $_GET['post'], "cf_iframe_url", true );
866
  $cf_seo_title = get_post_meta( $_GET['post'], "cf_seo_title", true );
867
  $cf_seo_desc = get_post_meta( $_GET['post'], "cf_seo_desc", true );
868
  $cf_seo_image = get_post_meta( $_GET['post'], "cf_seo_image", true );
869
  $cf_page_url = get_post_meta( $_GET['post'], "cf_page_url", true );
870
  $cf_favicon = get_post_meta( $_GET['post'], "cf_favicon", true );
871
  $cf_author = get_post_meta( $_GET['post'], "cf_author", true );
872
  $cf_keywords = get_post_meta( $_GET['post'], "cf_keywords", true );
873
  $cf_head_tracking = get_post_meta( $_GET['post'], "cf_head_tracking", true );
874
  $cf_footer_tracking = get_post_meta( $_GET['post'], "cf_footer_tracking", true );
875
  $cf_wptracking_code = get_post_meta( $_GET['post'], "cf_wptracking_code", true );
876
  $cf_favicon_choice = get_post_meta( $_GET['post'], "cf_favicon_choice", true );
877
  $cf_slug= get_post_meta( $_GET['post'], 'cf_slug', true );
878
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
879
  $thepage = explode( "{#}", $cf_page );
880
  $savedData = $cf_page;
881
  }
882
  else {
883
  $thepage = explode( "{#}", $cf_page['page_id'] );
884
  $savedData = $cf_page['page_id'];
885
  }
886
  $cf_options = get_option( "cf_options" );
887
  // populate funnels option field
888
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
889
  }
890
  else {
891
  if ($cf_page != "") {
892
  $response = wp_remote_get( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
893
  if( is_array($response) ) {
894
  $json = $response['body']; // use the content
895
  }
896
  $cf_funnels_pages = json_decode( $json );
897
  }
898
  else if ($cf_funnels == '') {
899
  $response = get_file_content( 'https://api.clickfunnels.com/funnels/'.$cf_thefunnel.'.json?email='.get_option( 'clickfunnels_api_email' ).'&auth_token='.get_option( 'clickfunnels_api_auth' ));
900
  if( is_array($response) ) {
901
  $json = $response['body']; // use the content
902
  }
903
  $cf_funnels_pages = json_decode( $json );
904
  }
905
  }
906
  jQuery(document).ready(function(){
907
  jQuery('.draft').hide();
908
  console.log("%cClickFunnels WordPress Plugin", "background: #0166AE; color: white; font-size: 23px");
909
  console.log("%cEditing anything inside the console is for developers only. Do not paste in any code given to you by anyone. Use with caution. Visit for support: https://support.clickfunnels.com/", "color: #888; font-size: 16px");
910
  // Set Correct Options
911
  var thenewdata = jQuery('#cf_thefunnel').val();
912
  var checkFunnelID = jQuery('#checkFunID').val();
913
  var checkPageID = jQuery('#checkPageID').val();
914
  if (thenewdata == '0' && checkFunnelID == '') {
915
  var allfunnels = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
916
  jQuery.getJSON(allfunnels, function(data) {
917
  jQuery.each(data, function() {
918
  // Check for Agency
919
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" != 'off') {
920
  if (this.group_tag) {
921
  group_tag = this.group_tag.replace(/(['"])/g, "{replace}");
922
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == group_tag) {
923
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
924
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
925
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
926
  }
927
  } else {
928
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == 'ungrouped') {
929
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
930
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
931
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
932
  }
933
  }
934
  }
935
  // Show All Funnels
936
  else {
937
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
938
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
939
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
940
  }
941
  });
942
  }).fail(function() {
943
  jQuery('.badAPI').show();
944
  });
945
  }
946
  else if (thenewdata == '0' && checkFunnelID != '') {
947
  console.log('has Funnel Id - try to select the funnel ###!#!#!##!!');
948
  var allfunnels = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
949
  jQuery.getJSON(allfunnels, function(data) {
950
  jQuery.each(data, function() {
951
  // Check for Agency
952
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" != 'off') {
953
  if (this.group_tag) {
954
  group_tag = this.group_tag.replace(/(['"])/g, "{replace}");
955
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == group_tag) {
956
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
957
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
958
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
959
  }
960
  } else {
961
  if ("<?php echo get_option( 'clickfunnels_agency_group_tag'); ?>" == 'ungrouped') {
962
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
963
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
964
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
965
  }
966
  }
967
  }
968
  // Show All Funnels
969
  else {
970
  jQuery('#cf_thefunnel').append('<option value="' + this.id + '">' + this.name + '</option>');
971
  jQuery('#cf_thefunnel_clickpop').append('<option value="' + this.id + '">' + this.name + '</option>');
972
  jQuery('#cf_thefunnel_clickoptin').append('<option value="' + this.id + '">' + this.name + '</option>');
973
  }
974
  });
975
  }).fail(function() {
976
  jQuery('.badAPI').show();
977
  });
978
  setTimeout(function() {
979
  jQuery(document).find("#cf_thefunnel option[value='"+checkFunnelID+"']").prop('selected', true).change();
980
 
981
  jQuery(document).find("#cf_thepage option[value='"+checkPageID+"']").prop('selected', true);
982
  jQuery(document).find('.apiSubHeader h2').text(jQuery("#cf_thefunnel option:selected").text())
983
  }, 1500)
984
 
985
  }
986
  else {
987
 
988
  var thenewdata = thenewdata.split('{#}');
989
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
990
  jQuery('#cf_thepage').find('option').remove().end();
991
  // alert(specificFunnel);
992
  // alert(thenewdata);
993
  jQuery('#loading').fadeIn();
994
  var favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
995
  <?php if ( empty( $_GET['action'] ) ) { ?>
996
  jQuery('#cf_thefunnel').prepend('<option value="" disabled selected>Select a Funnel</option>');
997
  <?php } ?>
998
  jQuery.getJSON(specificFunnel, function(data) {
999
  setTimeout(function() {
1000
  jQuery('#loading').fadeOut();
1001
  }, 2000);
1002
  var is_selected = "";
1003
  if (data.favicon){
1004
  favicon = data.favicon;
1005
  }
1006
  else {
1007
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
1008
  }
1009
  jQuery.each(data.funnel_steps, function() {
1010
  if (this.pages != ''){
1011
  if(this.pages[0].id == "<?php echo $thepage[2] ?>" && this.pages != '' ) {
1012
  is_selected = "selected";
1013
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
1014
  } else {
1015
  is_selected = "";
1016
  }
1017
  if ( this.wp_friendly == true && this.pages != '' ) {
1018
  jQuery('#iframeURL').val(this.pages[0].published_url);
1019
  if (data.favicon){
1020
  jQuery('#cf_favicon').val(favicon);
1021
  jQuery('#faviconPreview').attr('src', favicon);
1022
  } else {
1023
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1024
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1025
  }
1026
  // Check if has split tests
1027
  var splittestkeys = 'none';
1028
  if (this.pages.length == 2) {
1029
  splittestkeys = '2';
1030
  }
1031
  else if (this.pages.length == 3) {
1032
  splittestkeys = '3';
1033
  }
1034
  // Ping All Pages in Funnel (to refresh split tests / api)
1035
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
1036
  pageKey = this.pages[0].key;
1037
  jQuery('#headTracking').val(this.pages[0].head_tag);
1038
  jQuery('#footerTracking').val(this.pages[0].body_tag);
1039
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
1040
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
1041
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'" '+is_selected+'>'+ this.name +'</option>');
1042
  }
1043
  }
1044
  });
1045
  }).done(function() {
1046
  jQuery('#loading').fadeOut();
1047
  var savedMeta = jQuery('#cf_thepage').val();
1048
  if(savedMeta != undefined || savedMeta != null){
1049
  savedMeta = savedMeta.split('{#}');
1050
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1051
  jQuery('#cf_thepage').trigger('change');
1052
  <?php } ?>
1053
  }
1054
  })
1055
  .fail(function(jqXHR) {
1056
  jQuery('#loading').fadeOut();
1057
  // jQuery('.badAPI').show();
1058
  })
1059
  .always(function() {
1060
  jQuery('#loading').fadeOut();
1061
  });
1062
  }
1063
  // Change Funnel Populate Dropdown
1064
  jQuery( '#cf_thefunnel' ).change(function() {
1065
  jQuery('.choosePageBox').fadeIn();
1066
  jQuery('.cftablink').removeClass('disabledLink');
1067
  jQuery('#publish').removeClass('disabledLink');
1068
  jQuery('#loading').fadeIn();
1069
  var thenewdata = jQuery(this).val();
1070
  var thenewdata = thenewdata.split('{#}');
1071
  var totalPages = 0;
1072
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thenewdata[0]+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
1073
  // alert(specificFunnel);
1074
  jQuery('#cf_thepage').find('option').remove().end();
1075
  jQuery.getJSON(specificFunnel, function(data) {
1076
  setTimeout(function() {
1077
  jQuery('#loading').fadeOut();
1078
  }, 2000);
1079
  if (data.favicon){
1080
  favicon = data.favicon;
1081
  }
1082
  else {
1083
  favicon = 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png';
1084
  }
1085
  // alert( specificFunnel);
1086
  jQuery.each(data.funnel_steps, function() {
1087
  if( this.wp_friendly == true && this.pages != '' ) {
1088
  // Ping All Pages in Funnel (to refresh split tests / api)
1089
  ping('https://api.clickfunnels.com/s3_proxy/'+this.pages[0].key+'?preview=true');
1090
  // Check if has split tests
1091
  var splittestkeys = 'none';
1092
  if (this.pages.length == 2) {
1093
  splittestkeys = '2';
1094
  }
1095
  else if (this.pages.length == 3) {
1096
  splittestkeys = '3';
1097
  }
1098
  jQuery('#iframeURL').val(this.pages[0].published_url);
1099
  jQuery('#cf_funnelwide_tracking_head').val(favicon);
1100
  if (data.favicon){
1101
  jQuery('#cf_favicon').val(favicon);
1102
  jQuery('#faviconPreview').attr('src', favicon);
1103
  } else {
1104
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1105
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1106
  }
1107
  // Tracking Codes
1108
  jQuery('#headTracking').val(this.pages[0].head_tag);
1109
  jQuery('#footerTracking').val(this.pages[0].body_tag);
1110
  jQuery('#fw_headerTracking').val(thenewdata[1]);
1111
  jQuery('#fw_footerTracking').val(thenewdata[2]);
1112
  if(this.pages[0].head_tag) { head_tag = encodeURIComponent(this.pages[0].head_tag); } else { head_tag = ''; }
1113
  if(this.pages[0].body_tag) { body_tag = encodeURIComponent(this.pages[0].body_tag); } else { body_tag = ''; }
1114
  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 +'{#}'+this.pages[0].published_url+'{#}'+favicon+'{#}'+head_tag+'{#}'+body_tag+'{#}'+data.name+'{#}'+splittestkeys+'">'+ this.name +'</option>');
1115
  totalPages += 1;
1116
  }
1117
  });
1118
  }).done(function() {
1119
  jQuery('#loading').fadeOut();
1120
  var savedMeta = jQuery('#cf_thepage').val();
1121
  jQuery('#cf_thepage').trigger('change');
1122
  if (totalPages == 0) {
1123
  jQuery('#cf_thepage').hide();
1124
  jQuery('#runningSplitTests').hide();
1125
  jQuery('#noPageWarning').fadeIn();
1126
  }
1127
  else {
1128
  jQuery('#noPageWarning').hide();
1129
  jQuery('#cf_thepage').fadeIn();
1130
  }
1131
  var theposition = jQuery('#cf_thepage').val();
1132
  var thefunnel = jQuery('#cf_thefunnel').val();
1133
  thefunnel = thefunnel.split('{#}');
1134
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
1135
  var myString = thefunnel[0]+'{#}'+theposition;
1136
  var arr = myString.split('{#}');
1137
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
1138
  var do_ping = function() {
1139
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {}).catch(function(error) {});
1140
  };
1141
  do_ping();
1142
  })
1143
  .fail(function() {
1144
  jQuery('#loading').fadeOut();
1145
  })
1146
  .always(function() {
1147
  jQuery('#loading').fadeOut();
1148
  });
1149
  });
1150
  var request_image = function(url) {
1151
  return new Promise(function(resolve, reject) {
1152
  var img = new Image();
1153
  img.onload = function() { resolve(img); };
1154
  img.onerror = function() { reject(url); };
1155
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
1156
  });
1157
  };
1158
  /**
1159
  * Pings a url.
1160
  * @param {String} url
1161
  * @return {Promise} promise that resolves to a ping (ms, float).
1162
  */
1163
  var ping = function(url) {
1164
  return new Promise(function(resolve, reject) {
1165
  var start = (new Date()).getTime();
1166
  var response = function() {
1167
  var delta = ((new Date()).getTime() - start);
1168
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
1169
  delta /= 4;
1170
  resolve(delta);
1171
  };
1172
  request_image(url).then(response).catch(response);
1173
  // Set a timeout for max-pings, 5s.
1174
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
1175
  });
1176
  };
1177
  function replaceText(inputText, tagName, tagReplace) {
1178
  var regExp = new RegExp('\\[' + tagName+ '\\]([^\\[]*)\\[\/' + tagName + '\\]', 'g');
1179
  return inputText.replace(regExp, tagReplace);
1180
  }
1181
  // Select New Page
1182
  jQuery( '#cf_thepage' ).change(function() {
1183
  jQuery('#loading').fadeOut();
1184
  var thefunnel = jQuery('#cf_thefunnel').val();
1185
  thefunnel = thefunnel.split('{#}');
1186
  var theposition = jQuery(this).val();
1187
  jQuery('#cf_data').val(thefunnel[0]+'{#}'+theposition);
1188
  if(theposition != undefined || theposition != null){
1189
  var myString = thefunnel[0]+'{#}'+theposition;
1190
  var arr = myString.split('{#}');
1191
  var arr2 = theposition.split('{#}');
1192
  jQuery('#iframeURL').val(arr2[6]);
1193
  <?php if ($cf_favicon_choice == '') { ?>
1194
  if (arr2[7] !== ''){
1195
  jQuery('#cf_favicon').val(arr2[7]);
1196
  jQuery('#faviconPreview').attr('src', arr2[7]);
1197
  } else {
1198
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1199
  jQuery('#faviconPreview').attr('src', 'https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1200
  }
1201
  <?php } else { ?>
1202
  if (arr2[7] !== ''){
1203
  jQuery('#cf_favicon').val(arr2[7]);
1204
  jQuery('#faviconPreview').hide();
1205
  jQuery('#metaPreview strong').hide();
1206
  } else {
1207
  jQuery('#cf_favicon').val('https://appassets3.clickfunnels.com/assets/favicon-8c74cad77e4e123f7dbb46b33e6de10c.png');
1208
  jQuery('#faviconPreview').hide();
1209
  jQuery('#metaPreview strong').hide();
1210
  }
1211
  <?php } ?>
1212
  // Tracking Code
1213
  jQuery('#headTracking').val(decodeURIComponent(arr2[8]));
1214
  jQuery('#footerTracking').val(decodeURIComponent(arr2[9]));
1215
  var thenewdata = jQuery('#cf_thefunnel').val();
1216
  var thenewdata = thenewdata.split('{#}');
1217
  jQuery('#fw_headTracking').val(thenewdata[1]);
1218
  jQuery('#fw_footerTracking').val(thenewdata[2]);
1219
  // Check if has split tests
1220
  if (arr2[11] == 2) {
1221
  var splittestkeys = '1 Active Split Test';
1222
  jQuery('#runningSplitTests').show();
1223
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
1224
  }
1225
  else if (arr2[11] == 3) {
1226
  var splittestkeys = '2 Active Split Tests';
1227
  jQuery('#runningSplitTests').show();
1228
  jQuery('#runningSplitTests').html('<em style="display: block"><i class="fa fa-bar-chart" style="margin-right: 2px"></i> '+splittestkeys+'</em>');
1229
  }
1230
  else {
1231
  jQuery('#runningSplitTests').hide();
1232
  }
1233
  var myStr = arr2[3];
1234
  // Browser title
1235
  var subStr = myStr.match("%3Ctitle%3E(.*)%3C/title%3E");
1236
  jQuery('.seoTitle').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1237
  jQuery('#metaPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1238
  jQuery('#opengraphPreview h3').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1239
  var authorname = myStr.match('author%22%20content=%22(.*)%22%3E%3');
1240
  jQuery('#seoAuthor').val(decodeURIComponent(authorname[1].replace(/%20/g, ' ')));
1241
  jQuery('#theAuthor').html('| '+authorname[1].replace(/%20/g, ' '));
1242
  var keywordsmeta = myStr.match('keywords%22%20content=%22(.*)%22%3E%3');
1243
  var keywords = keywordsmeta[1].replace(/%20/g, ' ').split('%');
1244
  jQuery('#seoKeywords').val(decodeURIComponent(keywords[0]));
1245
  // SEO Desc
1246
  var subStr = myStr.match("description%22%20content=%22(.*)%22%3E%3Cmeta%20class=%22metaTagTop%22%20name=%22keywo");
1247
  jQuery('.seoDesc').val(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1248
  jQuery('#metaPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1249
  jQuery('#opengraphPreview p').text(decodeURIComponent(subStr[1].replace(/%20/g, ' ')));
1250
  // SEO Share Image
1251
  var subStr = myStr.match("rty=%22og:image%22%20content=%22(.*)%22%20id=%22social-image%22%3E");
1252
  jQuery('#seosocial').val(subStr[1]);
1253
  if (subStr[1] != ''){
1254
  jQuery('#seosocialimage').show();
1255
  jQuery('#seosocialimage').attr('src', subStr[1]);
1256
  } else {
1257
  jQuery('#seosocialimage').hide();
1258
  }
1259
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
1260
  <?php if ( !empty( $_GET['updatemeta']) ) { ?>
1261
  setTimeout(function() {
1262
  jQuery('#publish').trigger('click');
1263
  }, 4000);
1264
  <?php } ?>
1265
  }
1266
  });
1267
  // Savings
1268
  jQuery('#publish').click(function(e) {
1269
  // e.preventDefault()
1270
  // if (jQuery(this).hasClass('disabledLink')=== true) {
1271
  //
1272
  // }
1273
  // else {
1274
  // jQuery('#saving').fadeIn();
1275
  // if (jQuery('#cf_slug').val() == '' && jQuery('.cf_header').val() == 'p') {
1276
  // jQuery('.selectapagelink').trigger('click');
1277
  // jQuery('#customurlError').fadeIn();
1278
  // jQuery('#cf_slug').focus();
1279
  // jQuery('#saving').fadeOut();
1280
  // }
1281
  // else {
1282
  // saveNow = 'yes';
1283
  // jQuery('.used_slug').each(function () {
1284
  // if (jQuery(this).html() == jQuery('#cf_slug').val()) {
1285
  // jQuery('#customurlError_duplicate').fadeIn();
1286
  // jQuery('#saving').fadeOut();
1287
  // saveNow = 'no!';
1288
  // }
1289
  //
1290
  // });
1291
  // if (saveNow == 'yes') {
1292
  // jQuery('form').submit();
1293
  // }
1294
  // }
1295
  // }
1296
  });
1297
  jQuery('.showupdatemetalink').click(function() {
1298
  jQuery('form').submit();
1299
  });
1300
  if (jQuery(this).hasClass('disabledLink')=== true) {
1301
  }
1302
  else {
1303
  jQuery('.cftabs').hide();
1304
  jQuery('.cftablink').removeClass('active');
1305
  jQuery(this).addClass('active');
1306
  var tab = jQuery(this).attr('data-tab');
1307
  jQuery('#'+tab).show();
1308
  }
1309
  str = str.replace(/^\s+|\s+$/g, ''); // trim
1310
  str = str.toLowerCase();
1311
  // remove accents, swap ñ for n, etc
1312
  var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
1313
  var to = "aaaaeeeeiiiioooouuuunc------";
1314
  for (var i=0, l=from.length ; i<l ; i++) {
1315
  str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
1316
  }
1317
  str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
1318
  .replace(/\s+/g, '-') // collapse whitespace and replace by -
1319
  .replace(/-+/g, '-'); // collapse dashes
1320
  return str;
1321
  {
1322
  var myStr = jQuery(this).val()
1323
  myStr=myStr.toLowerCase();
1324
  myStr=myStr.replace(/\s/g , "-");
1325
  jQuery('#cf_slug').val(myStr);
1326
  slug = jQuery(this).val();
1327
  customSlug = slug;
1328
  customSlug = string_to_slug(customSlug);
1329
  jQuery(this).val(customSlug);
1330
  jQuery('.customSlugText').text(customSlug);
1331
  newurl = jQuery('#cfslugurl').text();
1332
  jQuery('#cfslugurl').attr('href', newurl);
1333
  jQuery('#cf_page_url').val('<?php echo get_home_url(); ?>/'+myStr);
1334
  jQuery('#customurlError').hide();
1335
  jQuery('#customurlError_duplicate').hide();
1336
  jQuery('#publish').removeClass('disabledLink');
1337
  jQuery('.used_slug').each(function () {
1338
  if (jQuery(this).html() == customSlug) {
1339
  jQuery('#customurlError_duplicate').fadeIn();
1340
  jQuery('#publish').addClass('disabledLink');
1341
  }
1342
  });
1343
  if ('' == customSlug) {
1344
  jQuery('#customurlError').fadeIn();
1345
  jQuery('#publish').addClass('disabledLink');
1346
  }
1347
  });
1348
  if (jQuery(this).val() == 'clickgate') {
1349
  jQuery('.cf_url').hide();
1350
  jQuery('.clickgateinfo').show();
1351
  jQuery('#publish').removeClass('disabledLink');
1352
  }
1353
  else if (jQuery(this).val() == 'hp') {
1354
  jQuery('.cf_url').hide();
1355
  jQuery('#publish').removeClass('disabledLink');
1356
  }
1357
  else if (jQuery(this).val() == 'np') {
1358
  jQuery('.cf_url').hide();
1359
  jQuery('#publish').removeClass('disabledLink');
1360
  }
1361
  else {
1362
  jQuery('.cf_url').show();
1363
  jQuery('.clickgateinfo').hide();
1364
  jQuery('#cf_slug').trigger('keyup');
1365
  }
1366
  });
1367
  <?php
1368
  // check all CF page slugs
1369
  $posts = get_posts(array(
1370
  'post_type' => 'clickfunnels',
1371
  'post_status' => 'publish',
1372
  'fields' => 'ids'
1373
  )
1374
  );
1375
  foreach($posts as $p){
1376
  $slug = get_post_meta($p,"cf_slug",true);
1377
  if ($slug != $cf_slug) {
1378
  echo "<li class='used_slug'>$slug</li>";
1379
  }
1380
  }
1381
  foreach( get_posts('numberposts=-1') as $post ) {
1382
  echo "<li class='used_slug'>$post->post_name</li>";
1383
  }
1384
  foreach( get_pages('numberposts=-1') as $post ) {
1385
  echo "<li class='used_slug'>$post->post_name</li>";
1386
  }
1387
  ?>
1388
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
1389
  <?php $hideforUpdateMeta = 'display: none !important'; ?>
1390
  <style>.bootstrap-wp, .copyrightInfo {display: none; }</style>
1391
  <span style="margin: 10px;" class="compatCheck compatwarning">Updating Your Meta Data... <strong><i class="fa fa-spinner fa-spin"></i> Please wait just a moment.</strong></span>
1392
  <input type="hidden" name="meta_redirect" value='yes'>
1393
  <?php } else { ?>
1394
  <h2>
1395
  <?php
1396
  if ( !empty( $_GET['action'] ) ) {
1397
  $blankpage = 'no';
1398
  foreach ( $cf_funnels as $key=>$funnel ) {
1399
  if ( $cf_thefunnel == $funnel->id ) {
1400
  $lengthofheadline = 40;
1401
  if ( $cf_type=='hp' || $cf_type=='np' || $cf_type=='clickgate' ) { $lengthofheadline = 19; }
1402
  if (strlen($thepage[6]) > $lengthofheadline) {
1403
  echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...';
1404
  $check = '1';
1405
  }
1406
  else {
1407
  if(strlen($thepage[6]) > $lengthofheadline) { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.trim(substr($thepage[6],0,$lengthofheadline)).' ...'; }
1408
  else { echo '<i class="fa fa-edit" style="margin-right: 5px"></i> '.$thepage[6];}
1409
  $check = '1';
1410
  }
1411
  }
1412
  else {
1413
  $blankpage = 'yes';
1414
  }
1415
  }
1416
  $cf_options = get_option( "cf_options" );
1417
  $homeCheck = $cf_options['home'];
1418
  $postid = get_the_ID();
1419
  if ($cf_page == '' && $cf_type == '' && $blankpage = 'yes' && $homeCheck['post_id'] != $postid && $cf_thepage != '') {
1420
  echo 'Requires Custom URL';
1421
  }
1422
  } else {
1423
  echo '<i class="fa fa-plus-square" style="margin-right: 5px"></i> Add New Page';
1424
  }
1425
  ?>
1426
  <?php if ($cf_type == 'clickgate') { ?>
1427
  ClickGate Popup
1428
  <?php } ?> -->
1429
  </h2>
1430
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1431
  <a style="margin-right: 0;margin-top: -27px;" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>" target="_blank" class="editThisPage"><i class="fa fa-edit"></i> EDITOR</a>
1432
  <a style="margin-right: 10px;margin-top: -27px;" href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>#<?php echo $thepage[3]; ?>" target="_blank" class="editThisPage"><i class="fa fa-filter"></i> FUNNEL</a>
1433
  <a style="margin-right: 10px;margin-top: -27px;" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" title="View Page" target="_blank" class="editThisPage"><i class="fa fa-search"></i> PREVIEW</a>
1434
  <?php if ( $cf_type=='p' ) {?>
1435
  <?php }?>
1436
  <?php if ( $cf_type=='hp' ) {?>
1437
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-home"></i> Set as Home Page</span>
1438
  <?php }?>
1439
  <?php if ( $cf_type=='np' ) {?>
1440
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-exclamation-triangle"></i> Set as 404 Page</span>
1441
  <?php }?>
1442
  <?php if ( $cf_type=='clickgate' ) {?>
1443
  <span style="margin-right: 10px;margin-top: -27px;" class="editThisPage2"><i class="fa fa-external-link"></i> Set as ClickGate</span>
1444
  <?php }?>
1445
  <?php }?>
1446
  <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>
1447
  <?php if ( !empty( $_GET['updatemeta'] ) ) { ?>
1448
  <input type="hidden" name="meta_redirect" value='yes'>
1449
  <?php } ?>
1450
  <input type="hidden" name="post_title" size="30" tabindex="1" value="ClickFunnels Page" id="title" autocomplete="off" />
1451
  <input type="hidden" name="post_status" size="30" tabindex="1" value="publish" id="title" autocomplete="off" />
1452
  <div class="bootstrap-wp"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1453
  <div id="app_sidebar">
1454
  <a href="#" data-tab="tab1" class="cftablink selectapagelink active">Select Page</a>
1455
  <a href="#" data-tab="tab2" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Meta Data</a>
1456
  <a href="#" data-tab="tab4" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Open Graph</a>
1457
  <a href="#" data-tab="tab6" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Tracking Code</a>
1458
  <a href="#" data-tab="tab3" class="cftablink <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>">Settings</a>
1459
  </div>
1460
  <div id="app_main" class="col-sm-7 row-fluid form-horizontal">
1461
  <div id="tab6" class="cftabs" style="display: none">
1462
  <!-- Tracking Code -->
1463
  <h2>Tracking Code</h2>
1464
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel.</em></p>
1465
  <hr style="margin-left: 51px">
1466
  <div class="control-group" >
1467
  <label class="control-label" for="cf_iframe_check"> WordPress Only Tracking Code </label>
1468
  <div class="controls">
1469
  <textarea class="input-xlarge wpfooterTracking" id="wpfooterTracking" style="height: 80px;" name="cf_wptracking_code"><?php echo $cf_wptracking_code; ?></textarea>
1470
  </div>
1471
  </div>
1472
  <hr style="margin-left: 51px">
1473
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> You can add your own custom tracking code for only this WordPress page, meaning your original page will not have this tracking code.</em></p>
1474
  <hr style="margin-left: 51px">
1475
  <div class="control-group" >
1476
  <label class="control-label" for="cf_iframe_check"> Header Tracking </label>
1477
  <div class="controls">
1478
  <textarea class="input-xlarge headTracking" id="headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
1479
  </div>
1480
  </div>
1481
  <div class="control-group" >
1482
  <label class="control-label" for="cf_iframe_check"> Footer Tracking </label>
1483
  <div class="controls">
1484
  <textarea class="input-xlarge footerTracking" id="footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
1485
  </div>
1486
  </div>
1487
  <hr style="margin-left: 51px">
1488
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Funnel wide tracking is set inside the Funnel Settings in the ClickFunnels app.</em></p>
1489
  <hr style="margin-left: 51px">
1490
  <div class="control-group" >
1491
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Header Tracking </label>
1492
  <div class="controls">
1493
  <textarea class="input-xlarge fw_headTracking" id="fw_headTracking" readonly="readonly"style="height: 80px;" name="cf_head_tracking"><?php echo $cf_head_tracking; ?></textarea>
1494
  </div>
1495
  </div>
1496
  <div class="control-group" >
1497
  <label class="control-label" for="cf_iframe_check"> Funnel Wide Footer Tracking </label>
1498
  <div class="controls">
1499
  <textarea class="input-xlarge fw_footerTracking" id="fw_footerTracking" readonly="readonly"style="height: 80px;" name="cf_footer_tracking"><?php echo $cf_footer_tracking; ?></textarea>
1500
  </div>
1501
  </div>
1502
  </div>
1503
  <div id="tab1" class="cftabs">
1504
  <!-- Select a Page / Funnel -->
1505
  <h2>Select a Page</h2>
1506
  <div class="control-group cf_uses_api clearfix" style="">
1507
  <label class="control-label" for="cf_thefunnel"> Choose Funnel </label>
1508
  <div class="controls">
1509
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1510
  <?php if ( empty( $cf_funnels ) ) { ?>
1511
  <option value="0">Select a Funnel</option>
1512
  <?php }
1513
  else {
1514
  // Agency Gate Check
1515
  $agency_group_tag = get_option('clickfunnels_agency_group_tag');
1516
  foreach ( $cf_funnels as $key=>$funnel ) {
1517
  if ($agency_group_tag != 'off') {
1518
  if ($funnel->group_tag || $funnel->group_tag != '') {
1519
  $group_tag = str_replace("'", '{replace}', $funnel->group_tag);
1520
  $group_tag = str_replace("\"", '{replace}', $funnel->group_tag);
1521
  if ($agency_group_tag == $group_tag) { ?>
1522
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1523
  <?php }
1524
  } else {
1525
  if ($agency_group_tag == 'ungrouped') { ?>
1526
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1527
  <?php }
1528
  }
1529
  }
1530
  else { ?>
1531
  <option value="<?php echo $funnel->id;?>{#}<?php echo htmlentities($funnel->head_tracking_code, ENT_QUOTES);?>{#}<?php echo htmlentities($funnel->body_tracking_code, ENT_QUOTES);?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1532
  <?php }
1533
  }
1534
  } ?>
1535
  </select>
1536
  </div>
1537
  </div>
1538
  <div class="control-group choosePageBox clearfix" style="<?php if ( empty( $_GET['action'] ) ) { echo "display: none"; } ?>">
1539
  <label class="control-label" for="cf_thepage">
1540
  Choose Page <span id="loading"><i class="fa fa-spinner"></i> <em style="margin-left: 5px;font-size: 11px;">Loading Pages...</em></span>
1541
  <div id="runningSplitTests" style="font-size: 11px;opacity: .8;float: right;padding-top: 5px;color: #555;margin-right: 26px;display: none;clear: both">
1542
  <!-- Number of Split Tests -->
1543
  </div>
1544
  </label>
1545
  <div class="controls">
1546
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1547
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1548
  <option value="0">No Pages Found</option>
1549
  <?php }
1550
  else {
1551
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1552
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1553
  <?php
1554
  }
1555
  }
1556
  ?>
1557
  </select>
1558
  </div>
1559
  <div id="noPageWarning" style="font-size: 11px; margin-left: 28px; margin-top: -13px;float: left;padding-top: 14px;display: none;width: 100%; clear: both">
1560
  <strong style="font-size: 13px;display: block;">No compatible pages found. </strong>
1561
  <em style="display: block">Membership pages and order pages are not available through plugin.</em>
1562
  </div>
1563
  <br clear="all">
1564
  </div>
1565
  <?php if ( $cf_type!="p" && $check == '1') $display ="display:none"; else $display="";?>
1566
  <?php if ( $cf_type == '') $display ="display:block"; ?>
1567
  <div class="cf_url control-group clearfix" style="<?php echo $display;?>" >
1568
  <label class="control-label" for="cf_slug"> Custom Slug</label>
1569
  <div id="cf-wp-path" class="controls ">
1570
  <input style="padding:10px;"type="text" value="<?php if ( isset( $cf_slug ) ) echo $cf_slug;?>" placeholder="your-path-here" name="cf_slug" id="cf_slug" class="input-xlarge">
1571
  <?php if ( $cf_type == '' ) $display ="display:block;"; else $display="";?>
1572
  <div id="customurlError" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
1573
  Add a path before saving.
1574
  </div>
1575
  <div id="customurlError_duplicate" style="display: none; <?php echo $display; ?> color: #E54F3F; font-weight: bold;margin-top: 4px;">
1576
  Slug already taken
1577
  </div>
1578
  </div>
1579
  <p class="infoHelp" style="padding-left: 25px;margin-top: 13px;"><span><i class="fa fa-globe" style="margin-right: 3px"></i>
1580
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1581
  <a style="font-weight: bold;text-decoration: none; padding-bottom: 3px;" id="cfslugurl" href="<?php echo get_home_url() ; ?>/<?php echo $cf_slug; ?>" target="_blank"><?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></a>
1582
  <?php } else { ?>
1583
  <span style="font-weight: bold;text-decoration: none; padding-bottom: 3px;"> <?php echo get_home_url() ; ?>/<span class="customSlugText"><?php echo $cf_slug; ?></span></span>
1584
  <?php } ?>
1585
  </span></p>
1586
  <input type="text" style="display: none" class="input-xlarge" style="height: 30px;" value="<?php echo $cf_page_url; ?>" name="cf_page_url" id="cf_page_url" />
1587
  </div>
1588
  </div>
1589
  <div id="tab2" class="cftabs" style="display: none">
1590
  <!-- Meta Data -->
1591
  <h2>Meta Data</h2>
1592
  <div id="metaPreview">
1593
  <h5>PREVIEW</h5>
1594
  <img src="<?php echo $cf_favicon; ?>" id="faviconPreview" style="width: 18px;margin-left: 10px;margin-bottom: 5px;float: left;" />
1595
  <strong>FAVICON</strong>
1596
  <h3><?php echo $cf_seo_title; ?></h3>
1597
  <span><?php echo get_home_url() ; ?>/<em style="font-style: normal" class="customSlugText"><?php echo $cf_slug; ?></em></span>
1598
  <p><?php echo $cf_seo_desc; ?></p>
1599
  </div>
1600
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
1601
  <hr style="margin-left: 51px">
1602
  <div class="control-group" >
1603
  <label class="control-label" for="cf_iframe_check"> Website Title </label>
1604
  <div class="controls">
1605
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" name="cf_seo_title" />
1606
  </div>
1607
  </div>
1608
  <div class="control-group" >
1609
  <label class="control-label" for="cf_iframe_check"> Description </label>
1610
  <div class="controls">
1611
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
1612
  </div>
1613
  </div>
1614
  <div class="control-group" >
1615
  <label class="control-label" for="cf_iframe_check"> Keywords </label>
1616
  <div class="controls">
1617
  <input type="text" class="input-xlarge" id="seoKeywords" readonly="readonly"style="height: 30px;" value="<?php echo $cf_keywords; ?>" name="cf_keywords" />
1618
  </div>
1619
  </div>
1620
  <div class="control-group" >
1621
  <label class="control-label" for="cf_iframe_check"> Favicon </label>
1622
  <div class="controls">
1623
  <input type="text" class="input-xlarge" readonly="readonly"id="cf_favicon" style="height: 30px;" value="<?php echo $cf_favicon; ?>" name="cf_favicon" />
1624
  </div>
1625
  </div>
1626
  <div class="control-group" >
1627
  <label class="control-label" for="cf_favicon_choice"> Choose Favicon to Show </label>
1628
  <div class="controls">
1629
  <select name="cf_favicon_choice" id="cf_favicon_choice" class="cf_favicon_choice" style="width: 100% !important">
1630
  <option value="" <?php if($cf_favicon_choice == ''){ echo 'selected'; } ?>>Show ClickFunnels Page Favicon</option>
1631
  <option value="default"<?php if($cf_favicon_choice == 'default'){ echo 'selected'; } ?>>Show Default WordPress Favicon</option>
1632
  </select>
1633
  </div>
1634
  </div>
1635
  </div>
1636
  <div id="tab3" class="cftabs" style="display: none">
1637
  <!-- Page Settings -->
1638
  <h2>Page Settings</h2>
1639
  <div class="innerTab">
1640
  <div class="control-group ">
1641
  <label class="control-label" for="cf_type"> Choose Page Type</label>
1642
  <select name="cf_type" id="cf_type" class="cf_header" style="width: 100% !important">
1643
  <option value="p" <?php if($cf_type == 'p'){ echo 'selected'; } ?>>Regular Page</option>
1644
  <option value="hp"<?php if($cf_type == 'hp'){ echo 'selected'; } ?>>Set as Home Page</option>
1645
  <option value="np"<?php if($cf_type == 'np'){ echo 'selected'; } ?>>Set as 404 Page</option>
1646
  <option value="clickgate"<?php if($cf_type == 'clickgate'){ echo 'selected'; } ?>>Set as ClickGate</option>
1647
  </select>
1648
  </div>
1649
  </div>
1650
  <?php if ( $cf_type == 'clickgate') $display ="display:block;"; else $display="";?>
1651
  <p class="infoHelp clickgateinfo" style="color: #8A6D3B;display: none; <?php echo $display; ?>"><i class="fa fa-star" style="margin-right: 3px"></i> <strong>ClickGate will show this page at the top of any page or post that your visitors land on and will cookie them to show only page only once.</strong></em></p>
1652
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> Choose to make this a regular page with a path (custom URL) or show this page as the Home Page for your blog. You can also set this page as a 404 page for any old, mispelled or deleted paths. <em>(only one page can be set as a Home, 404 or ClickGate at a time)</em></p>
1653
  <hr style="margin-left: 51px">
1654
  <div class="control-group cf_uses_api" >
1655
  <label class="control-label" for="cf_iframe_check"> Show Page Inside of Iframe</label>
1656
  <div class="controls">
1657
  <select class="input-xlarge" id="cf_iframe_check" name="cf_iframe_check" style="float: left;">
1658
  <option value="off">No, show page using ClickFunnels API.</option>
1659
  <option value="on" <?php if( $cf_iframe_check == 'on') { ?>selected <?php } ?>>Yes, show page using an iframe.</option>
1660
  </select>
1661
  </div>
1662
  </div>
1663
  <br style="clear: both">
1664
  <p class="infoHelp" style="margin-top: 15px"><i class="fa fa-question-circle" style="margin-right: 3px"></i> If you have custom code on your page that is not working, choose to show your page inside an iframe to fix any custom code issues. If your page is showing up blank use the iframe option and submit a support ticket.</p>
1665
  <hr style="margin-left: 51px">
1666
  <div class="control-group" style="display: block">
1667
  <label class="control-label" for="cf_iframe_check"> ClickFunnels Page URL <small>(reference only)</small></label>
1668
  <div class="controls">
1669
  <input type="text" class="input-xlarge" id="iframeURL" readonly="readonly"style="height: 30px;" value="<?php echo $cf_iframe_url; ?>" name="cf_iframe_url" />
1670
  </div>
1671
  </div>
1672
  </div>
1673
  <div id="tab4" class="cftabs" style="display: none">
1674
  <!-- Extra Settings -->
1675
  <h2>Open Graph</h2>
1676
  <div id="opengraphPreview">
1677
  <h5>PREVIEW</h5>
1678
  <img style="<?php if ($cf_seo_image == '') { echo 'display: none;'; } ?>" src="<?php echo $cf_seo_image; ?>" id="seosocialimage">
1679
  <h3><?php echo $cf_seo_title; ?></h3>
1680
  <p><?php echo $cf_seo_desc; ?></p>
1681
  <span><?php echo get_home_url() ; ?> <em id="theAuthor"><?php echo '| '.$cf_author; ?></em></span>
1682
  </div>
1683
  <p class="infoHelp"><i class="fa fa-question-circle" style="margin-right: 3px"></i> To edit your meta data settings <a target="_blank" href="https://www.clickfunnels.com/pages/<?php echo $thepage[2]; ?>">click to open this page inside the editor</a> and edit meta data inside the settings panel. To update this page with new changes, re-save this page to keep your meta data up-to-date.</em></p>
1684
  <hr style="margin-left: 51px">
1685
  <div class="control-group" >
1686
  <label class="control-label" for="cf_iframe_check"> Title </label>
1687
  <div class="controls">
1688
  <input type="text" class="input-xlarge seoTitle" id="seoTitle" readonly="readonly"style="height: 30px;" value="<?php echo $cf_seo_title; ?>" />
1689
  </div>
1690
  </div>
1691
  <div class="control-group" >
1692
  <label class="control-label" for="cf_iframe_check"> Description </label>
1693
  <div class="controls">
1694
  <textarea class="input-xlarge seoDesc" id="seoDesc" readonly="readonly"style="height: 80px;" name="cf_seo_desc"><?php echo $cf_seo_desc; ?></textarea>
1695
  </div>
1696
  </div>
1697
  <div class="control-group" >
1698
  <label class="control-label" for="cf_iframe_check"> Author </label>
1699
  <div class="controls">
1700
  <input type="text" class="input-xlarge" id="seoAuthor" readonly="readonly"style="height: 30px;" value="<?php echo $cf_author; ?>" name="cf_author" />
1701
  </div>
1702
  </div>
1703
  <div class="control-group" >
1704
  <label class="control-label" for="cf_iframe_check"> Social Image URL </label>
1705
  <div class="controls">
1706
  <input type="text" class="input-xlarge" id="seosocial" readonly="readonly" style=" height: 30px;" value="<?php echo $cf_seo_image; ?>" name="cf_seo_image" />
1707
  </div>
1708
  </div>
1709
  </div>
1710
  <div id="savePage">
1711
  <div style="width: 100%">
1712
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1713
  <?php } else { ?>
1714
  <input type="submit" name="publish" id="publish" value="Save Page" class="action-button shadow animate green <?php if ( empty( $_GET['action'] ) ) { echo 'disabledLink'; } ?>" style="float: right; ">
1715
  <?php } ?>
1716
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 9px;margin-right: 4px;font-size: 15px;">
1717
  <i class="fa fa-spinner fa-spin"></i>
1718
  <span>Saving...</span>
1719
  </div>
1720
  </div>
1721
  </div>
1722
  <style>
1723
  #hiddenStuff {display: none}
1724
  </style>
1725
  <div class="control-group" id="hiddenStuff" <?php if ( !empty( $_GET['cf'] ) ) { ?>style="display: block;clear: both;" <?php } ?>>
1726
  <style>
1727
  #hiddenStuff input {
1728
  display:block;margin-top: 5px;margin-bottom: 5px;font-weight: normal;width: 100%;
1729
  }
1730
  </style>
1731
  <div class="controls">
1732
  <br>
1733
  <h3>Dev Checks:</h3>
1734
  <hr />
1735
  <strong>Funnel ID: <input id="checkFunID" type="text" value="<?php echo $thepage[0]; ?>" /></strong>
1736
  <strong>Page Key: <input type="text" value="<?php echo $thepage[1]; ?>" /></strong>
1737
  <strong>Page ID: <input type="text" id="checkPageID" value="<?php echo $thepage[2]; ?>" /></strong>
1738
  <strong>Funnel Step ID: <input type="text" value="<?php echo $thepage[3]; ?>" /></strong>
1739
  <strong>Saved Meta: <input type="text" id="oldmeta" value="<?php echo $thepage[4]; ?>" /></strong>
1740
  <strong>JS Meta: <input type="text" id="jsmeta" value="" /></strong>
1741
  <strong>Post ID: <input type="text" value="<?php echo $thepage[5]; ?>" /></strong>
1742
  <strong>Page Name: <input type="text" value="<?php echo $thepage[6]; ?>" /></strong>
1743
  <strong>Use iframe?: <input type="text" value="<?php echo $cf_iframe_check; ?>" /></strong>
1744
  <strong>Iframe URL: <input type="text" value="<?php echo $cf_iframe_url; ?>" /></strong>
1745
  <textarea name="cf_thefunnel" id="cf_data" style="display:block;margin-top: 5px;margin-bottom: 10px;width: 100%;height: 300px; font-size: 13px;"><?php echo $savedData; ?></textarea>
1746
  </div>
1747
  </div>
1748
  </div>
1749
  </div>
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: 2.0.2
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
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: 2.0.3
7
  * Author: Etison, LLC
8
  * Author URI: https://www.clickfunnels.com
9
  */
footer.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="copyrightInfo">
2
- <p><strong style="float: right;font-weight: 600;font-size: 11px;text-align: right;">Running Version 2.0.2</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
1
  <div class="copyrightInfo">
2
+ <p><strong style="float: right;font-weight: 600;font-size: 11px;text-align: right;">Running Version 2.0.3</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://clickfunnels.com/
5
  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: 2.0.2
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
@@ -100,6 +100,10 @@ By re-selecting the page it will ping the server which should refresh your page.
100
 
101
  Stay current with the latest version of the plugin:
102
 
 
 
 
 
103
  = Version 2.0.2 =
104
 
105
  * fix conflict with other plugins when saving/updating
5
  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.4.1
9
+ Stable tag: 2.0.3
10
 
11
  Connect your ClickFunnels pages to your WordPress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
100
 
101
  Stay current with the latest version of the plugin:
102
 
103
+ = Version 2.0.3 =
104
+
105
+ * API Not Connected Issue Fix
106
+
107
  = Version 2.0.2 =
108
 
109
  * fix conflict with other plugins when saving/updating