ClickFunnels - Version 1.1.0

Version Description

Download this release

Release Info

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

Code changes from version 1.0.9 to 1.1.0

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