ClickFunnels - Version 2.0.8

Version Description

Download this release

Release Info

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

Code changes from version 2.0.7 to 2.0.8

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