ClickFunnels - Version 1.0.6

Version Description

Download this release

Release Info

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

Code changes from version 1.0.5 to 1.0.6

Files changed (5) hide show
  1. CF_API.php +5 -0
  2. admin.php +1 -1
  3. clickfunnels.php +1 -1
  4. footer.php +1 -1
  5. readme.txt +6 -1
CF_API.php CHANGED
@@ -18,6 +18,11 @@ class CF_API {
18
  return $funnels;
19
  }
20
  public function get_page_html( $funnel_id, $position = 0, $meta = "" ) {
 
 
 
 
 
21
  $newHTML = '<!DOCTYPE html>
22
  <html>
23
  <head>
18
  return $funnels;
19
  }
20
  public function get_page_html( $funnel_id, $position = 0, $meta = "" ) {
21
+ global $wp_query;
22
+ if ($wp_query->is_404) {
23
+ $wp_query->is_404 = false;
24
+ }
25
+ header("HTTP/1.1 200 OK");
26
  $newHTML = '<!DOCTYPE html>
27
  <html>
28
  <head>
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
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
5
  $thepage = explode( "{#}", $cf_page );
6
  $savedData = $cf_page;
7
  }
8
  else {
9
  $thepage = explode( "{#}", $cf_page['page_id'] );
10
  $savedData = $cf_page['page_id'];
11
  }
12
  $cf_options = get_option( "cf_options" );
13
  jQuery(document).ready(function(){
14
  // Set Correct Options
15
  var thefunnel = jQuery('#cf_thefunnel').val();
16
  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" ); ?>';
17
  jQuery('#cf_thepage').find('option').remove().end();
18
  jQuery('#loading').fadeIn();
19
  jQuery.getJSON(specificFunnel, function(data) {
20
  setTimeout(function() {
21
  jQuery('#loading').fadeOut();
22
  }, 2000);
23
  var is_selected = "";
24
  jQuery.each(data.funnel_steps, function() {
25
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
26
  is_selected = "selected";
27
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
28
  } else {
29
  is_selected = "";
30
  }
31
 
32
  if( this.wp_friendly == true) {
33
  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(); ?>" '+is_selected+'>'+ this.name +'</option>');
34
  }
35
 
36
  });
37
  }).done(function() {
38
  jQuery('#loading').fadeOut();
39
  jQuery('#cf_thepage').trigger( "change" );
40
  })
41
  .fail(function() {
42
  jQuery('#loading').fadeOut();
43
  })
44
  .always(function() {
45
  jQuery('#loading').fadeOut();
46
  console.log( "ClickFunnels Rocks!" );
47
  });
48
  // Change Funnel Populate Dropdown
49
  jQuery( '#cf_thefunnel' ).change(function() {
50
  jQuery('#loading').fadeIn();
51
  var thefunnel = jQuery(this).val();
52
  var totalPages = 0;
53
  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" ); ?>';
54
  jQuery('#cf_thepage').find('option').remove().end();
55
  jQuery.getJSON(specificFunnel, function(data) {
56
  setTimeout(function() {
57
  jQuery('#loading').fadeOut();
58
  }, 2000);
59
  // alert( JSON.stringify(data.funnel_steps));
60
  jQuery.each(data.funnel_steps, function() {
61
  if( this.wp_friendly == true && this.in_funnel == true ) {
62
  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 +'</option>');
63
  totalPages += 1;
64
  }
65
  });
66
  }).done(function() {
67
  jQuery('#loading').fadeOut();
68
  })
69
  .fail(function() {
70
  jQuery('#loading').fadeOut();
71
  })
72
  .always(function() {
73
  jQuery('#loading').fadeOut();
74
  });
75
  setTimeout(function() {
76
  if (totalPages == 0) {
77
  jQuery('#noPageWarning').fadeIn();
78
  }
79
  else {
80
  jQuery('#noPageWarning').hide();
81
  }
82
  var theposition = jQuery('#cf_thepage').val();
83
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
84
  var myString = thefunnel+'{#}'+theposition;
85
  var arr = myString.split('{#}');
86
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
87
  var do_ping = function() {
88
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
89
 
90
  }).catch(function(error) {
91
 
92
  });
93
  };
94
  do_ping();
95
  }, 3000);
96
  });
97
  var request_image = function(url) {
98
  return new Promise(function(resolve, reject) {
99
  var img = new Image();
100
  img.onload = function() { resolve(img); };
101
  img.onerror = function() { reject(url); };
102
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
103
  });
104
  };
105
  /**
106
  * Pings a url.
107
  * @param {String} url
108
  * @return {Promise} promise that resolves to a ping (ms, float).
109
  */
110
  var ping = function(url) {
111
  return new Promise(function(resolve, reject) {
112
  var start = (new Date()).getTime();
113
  var response = function() {
114
  var delta = ((new Date()).getTime() - start);
115
 
116
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
117
  delta /= 4;
118
 
119
  resolve(delta);
120
  };
121
  request_image(url).then(response).catch(response);
122
 
123
  // Set a timeout for max-pings, 5s.
124
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
125
  });
126
  };
127
  // Select New Page
128
  jQuery( '#cf_thepage' ).change(function() {
129
  jQuery('#loading').fadeOut();
130
  var thefunnel = jQuery('#cf_thefunnel').val();
131
  var theposition = jQuery(this).val();
132
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
133
  var myString = thefunnel+'{#}'+theposition;
134
  var arr = myString.split('{#}');
135
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
136
  var do_ping = function() {
137
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
138
 
139
  }).catch(function(error) {
140
 
141
  });
142
  };
143
  do_ping();
144
  });
145
  // Fade Out Message
146
  setTimeout(function() {
147
  jQuery('#message').fadeOut();
148
  }, 3500);
149
  // Savings
150
  jQuery('#publish').click(function() {
151
  jQuery('#saving').fadeIn();
152
  });
153
  jQuery('#delete').on('click', function () {
154
  return confirm('Are you sure you want to delete this page?');
155
  });
156
  jQuery('#cf_slug').bind('keyup keypress blur', function()
157
  {
158
  var myStr = jQuery(this).val()
159
  myStr=myStr.toLowerCase();
160
  myStr=myStr.replace(/\s/g , "-");
161
  jQuery('#cf_slug').val(myStr);
162
  });
163
  });
164
  display: none !important;
165
  }
166
  #side-sortables {
167
  display: none !important;
168
  }
169
  #clickfunnels_meta_box {
170
  width: 780px !important;
171
  border-radius: 5px;
172
  }
173
  .button:active, .button:hover, .button:focus {
174
  outline: none !important;
175
  box-shadow: none !important;
176
  }
177
  #message {
178
  width: 752px;
179
  margin-bottom: 0;
180
  }
181
  .apiHeader {
182
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
183
  border-bottom: 3px solid rgba(0,0,0,0.25);
184
  padding: 10px;
185
  padding-top: 15px;
186
  border-top-left-radius: 5px;
187
  border-top-right-radius: 5px;
188
  clear: both;
189
  }
190
  .apiHeader img {
191
  width: 200px;
192
  float: left;
193
  margin-left: 10px;
194
  }
195
  .apiHeader a {
196
  float: right;
197
  display: block;
198
  color: #fff;
199
  font-size: 13px;
200
  text-decoration: none;
201
  margin-right: 5px !important;
202
  background-color: rgba(0, 0, 0, .3);
203
  border: 2px solid #2b2e30;
204
  color: #afbbc8 !important;
205
  font-weight: 700;
206
  -webkit-border-radius: 4px;
207
  -moz-border-radius: 4px;
208
  border-radius: 4px;
209
  padding: 7px;
210
  padding-left: 12px;
211
  padding-right: 12px;
212
  margin-top: 0px !important;
213
  text-transform: uppercase;
214
  text-decoration: none;
215
  font-size: 14px;
216
  }
217
  .apiHeader a:hover {
218
  border: 2px solid #1D81C8;
219
  background-color: rgba(0, 0, 0, .6);
220
  color: #fff !important;
221
  }
222
  .apiSubHeader {
223
  background-color: #0166AE;
224
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
225
  border-bottom: 3px solid rgba(0,0,0,0.25);
226
  color: #fff;
227
  padding: 15px 18px;
228
  }
229
  .apiSubHeader h2 {
230
  margin: 0 !important;
231
  padding: 0 !important;
232
  color: #fff;
233
  font-weight: bold;
234
  font-size: 17px;
235
  text-shadow: 1px 1px 0 #0367AE;
236
  }
237
  .apiSubHeader a.editThisPage {
238
  float: right;
239
  padding: 5px 10px;
240
  color: #fff;
241
  text-shadow: 1px 1px 0 #0367AE;
242
  text-decoration: none;
243
  padding-top: 15px;
244
  margin-top: 6px;
245
  font-size: 14px;
246
  border: 2px solid #1D81C8;
247
  background-color: #054B7C;
248
  color: #fff !important;
249
  font-weight: 700;
250
  -webkit-border-radius: 4px;
251
  -moz-border-radius: 4px;
252
  border-radius: 4px;
253
  padding: 7px;
254
  padding-left: 12px;
255
  padding-right: 12px;
256
  text-transform: uppercase;
257
  text-decoration: none;
258
  font-size: 12px;
259
  }
260
  .apiSubHeader a.editThisPage i {
261
  margin-right: 4px;
262
  }
263
  .apiSubHeader a.editThisPage:hover {
264
  border: 2px solid #FFB700;
265
  text-shadow: 1px 1px 0 #222;
266
  background-color: rgba(0, 0, 0, .6);
267
  color: #fff !important;
268
  }
269
  .apiSubHeader a{
270
  text-shadow: 1px 1px 0 #0367AE;
271
  color: #fff;
272
  text-decoration: none;
273
  font-size: 12px;
274
  opacity: .8;
275
  }
276
  .apiSubHeader a:hover {
277
  opacity: 1;
278
  }
279
  .inside {
280
  padding: 0 !important;
281
  margin-top: 0 !important;
282
  border-radius: 5px !important;
283
  }
284
  .inside h2 {
285
  display: block !important;
286
  }
287
  #postbox-container-2 {
288
  margin-top: -20px !important;
289
  }
290
  body #poststuff .hndle.ui-sortable-handle {
291
  display: none !important;
292
  }
293
  body #poststuff .handlediv {
294
  display: none !important;
295
  }
296
  #loading {
297
  float: left;
298
  margin-left: 10px;
299
  display: none;
300
  margin-top: 6px;
301
  color: #999;
302
  }
303
  #apiFooter {
304
  background: #F1F1F1;
305
  padding: 20px 0;
306
  padding-bottom: 10px;
307
  }
308
  #apiFooter a:hover {
309
  text-decoration: none;
310
  }
311
  .bootstrap-wp {
312
  overflow: hidden;
313
  border: 10px solid #F1F1F1;
314
  }
315
  .deleteButton {
316
  padding: 5px;
317
  float: left;
318
  color: #777 !important;
319
  font-size: 13px;
320
  }
321
  body .cf_header .btn {
322
  font-size: 13px !important;
323
  padding: 8px 15px;
324
  }
325
  body .btn-selected {
326
  background-color: #0166AE !important;
327
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
328
  text-shadow: 1px 1px 0 #034E82 !important;
329
  font-family: Arial !important;
330
  color: #ffffff !important;
331
  border: solid #1f628d 1px !important;
332
  text-decoration: none !important;
333
  transition: none !important;
334
  }
335
  body label {
336
  font-size: 11px;
337
  opacity: .8;
338
  }
339
  body label i {
340
  padding-left: 10px;
341
  }
342
  .helpinfo {
343
  padding: 20px 40px;
344
  background: #fafafa;
345
  border-top: 1px solid #f2f2f2;
346
  margin: 0 0px;
347
  margin-top: -20px;
348
  margin-bottom: -20px;
349
  }
350
  .helpinfo h4 {
351
  color: #3B474F;
352
  font-size: 15px;
353
  font-weight: 700;
354
  padding-bottom: 10px;
355
  padding-top: 5px;
356
  }
357
  .helpinfo p {
358
  color: #888;
359
  font-weight: 300;
360
  font-size: 12px;
361
  line-height: 19px;
362
  letter-spacing: 1px;
363
  padding-bottom: 0;
364
  }
365
  .helpinfo h4 i {
366
  margin-right: 4px;
367
  }
368
  #message {
369
  width: 758px;
370
  padding: 10px 10px;
371
  display: block;
372
  z-index: 99999;
373
  position: relative;
374
  color: #fff;
375
  border: 1px solid #024D82;
376
  border-bottom: 2px solid #024D82;
377
  text-shadow: 1px 1px 0 #024D82;
378
  padding: 0 10px;
379
  font-size: 16px;
380
  margin-bottom: 0;
381
  border-radius: 5px;
382
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
383
  }
384
  .noAPI {
385
  padding: 10px;
386
  border-bottom: 2px solid #c93f2b;
387
  background: #E64D37;
388
  }
389
  .noAPI h4 {
390
  margin: 0;
391
  padding: 0;
392
  color: #fff;
393
  }
394
  .noAPI h4 a {
395
  color: #fff;
396
  font-weight: normal;
397
  }
398
  .input-xlarge {
399
 
400
  }
401
  .control-group {
402
  padding-left: 25px
403
  }
404
  if ( $cf_page != "" ) {
405
  $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' ) );
406
  $cf_funnels_pages = json_decode( $json );
407
  }
408
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
409
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
410
  <br clear="all">
411
  <?php if ( !empty( $_GET['action'] ) ) { ?>
412
  <?php if ( $cf_type=='p' ) {?>
413
  <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> Launch in Editor</a>
414
  <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>
415
  <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>
416
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
417
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
418
  <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>
419
  <?php }?>
420
  <?php if ( $cf_type=='hp' ) {?>
421
  <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>
422
  <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>
423
  <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>
424
  <h2>Set as Home Page</h2>
425
  <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>
426
  <?php }?>
427
  <?php if ( $cf_type=='np' ) {?>
428
  <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>
429
  <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>
430
  <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>
431
  <h2>Set as 404 Page</h2>
432
  <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>
433
  <?php }?>
434
  <?php if ( $cf_type=='' ) {?>
435
  <h2>Page Undefined - Create New Page</h2>
436
  <?php }?>
437
  <?php } else { ?>
438
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
439
  <?php } ?>
440
  <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>
441
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
442
  <div class="row-fluid form-horizontal">
443
  <br>
444
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
445
  <div data-target="cf_type" class="btn-group multichoice cf_header">
446
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
447
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
448
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
449
  </div>
450
  <input type="hidden" id="cf_type" name="cf_type"/>
451
  </div>
452
  <br>
453
  <div class="control-group">
454
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
455
  <div class="controls">
456
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
457
  <?php if ( empty( $cf_funnels ) ) { ?>
458
  <option value="0">No Funnels Found</option>
459
  <?php }
460
  else {
461
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
462
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
463
  <?php
464
  }
465
  } ?>
466
  </select>
467
  </div>
468
  </div>
469
  <div class="control-group">
470
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
471
  <div class="controls">
472
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
473
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
474
  <option value="0">No Pages Found</option>
475
  <?php }
476
  else {
477
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
478
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
479
  <?php
480
  }
481
  }
482
  ?>
483
  </select>
484
  <i class="fa fa-spinner fa-spin" id="loading"></i>
485
  </div>
486
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;padding-top: 10px;display: none;width: 100%; clear: both"><em>You have no pages for this funnel. <a href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>" target="_blank">Click to add new page.</a></em></div>
487
  </div>
488
  <div class="control-group" id="hiddenStuff" style="display: none">
489
  <div class="controls">
490
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
491
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
492
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
493
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
494
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
495
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
496
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
497
  </div>
498
  </div>
499
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
500
  <div class="cf_url control-group" style="<?php echo $display;?>" >
501
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
502
  <div id="cf-wp-path" class="controls ">
503
  <div class="input-prepend">
504
  <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">
505
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
506
  </div>
507
  </div>
508
  </div>
509
  <br><br>
510
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
511
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
512
  <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>
513
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
514
  </div>
515
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
516
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
517
  <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>
518
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
519
  </div>
520
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
521
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
522
  <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>
523
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
524
  </div>
525
  <br>
526
  <div class="row-fluid" id="apiFooter">
527
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
528
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
529
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
530
  </button>
531
  <?php } else { ?>
532
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
533
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
534
  </button>
535
  <?php } ?>
536
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
537
  <i class="fa fa-spinner fa-spin"></i>
538
  <span>Saving...</span>
539
  </div>
540
  <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>
541
  <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>
542
  <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>
543
  <?php if ( !empty( $delete_link ) ) {?>
544
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
545
  <?php }?>
546
  </div>
547
  </div>
548
  </div>
549
  (function($) {
550
  setTimeout(function() {
551
  $('#cf_thepage').trigger( "change" );
552
  }, 1500);
553
  })(jQuery);
 
554
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
555
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
556
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
557
  $thepage = explode( "{#}", $cf_page );
558
  $savedData = $cf_page;
559
  }
560
  else {
561
  $thepage = explode( "{#}", $cf_page['page_id'] );
562
  $savedData = $cf_page['page_id'];
563
  }
564
  $cf_options = get_option( "cf_options" );
565
  jQuery(document).ready(function(){
566
  // Set Correct Options
567
  var thefunnel = jQuery('#cf_thefunnel').val();
568
  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" ); ?>';
569
  jQuery('#cf_thepage').find('option').remove().end();
570
  jQuery('#loading').fadeIn();
571
  jQuery.getJSON(specificFunnel, function(data) {
572
  setTimeout(function() {
573
  jQuery('#loading').fadeOut();
574
  }, 2000);
575
  var is_selected = "";
576
  jQuery.each(data.funnel_steps, function() {
577
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
578
  is_selected = "selected";
579
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
580
  } else {
581
  is_selected = "";
582
  }
583
 
584
  if ( this.wp_friendly == true && this.in_funnel == true ) {
585
  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(); ?>" '+is_selected+'>'+ this.name +'</option>');
586
  }
587
 
588
 
589
  });
590
  }).done(function() {
591
  jQuery('#loading').fadeOut();
592
  jQuery('#cf_thepage').trigger( "change" );
593
  })
594
  .fail(function() {
595
  jQuery('#loading').fadeOut();
596
  })
597
  .always(function() {
598
  jQuery('#loading').fadeOut();
599
  console.log( "ClickFunnels Rocks!" );
600
  });
601
  // Change Funnel Populate Dropdown
602
  jQuery( '#cf_thefunnel' ).change(function() {
603
  jQuery('#loading').fadeIn();
604
  var thefunnel = jQuery(this).val();
605
  var totalPages = 0;
606
  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" ); ?>';
607
  jQuery('#cf_thepage').find('option').remove().end();
608
  jQuery.getJSON(specificFunnel, function(data) {
609
  setTimeout(function() {
610
  jQuery('#loading').fadeOut();
611
  }, 2000);
612
  // alert( JSON.stringify(data.funnel_steps));
613
  jQuery.each(data.funnel_steps, function() {
614
  if( this.wp_friendly == true && this.in_funnel == true ) {
615
  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 +'</option>');
616
  totalPages += 1;
617
  }
618
  });
619
  }).done(function() {
620
  jQuery('#loading').fadeOut();
621
  })
622
  .fail(function() {
623
  jQuery('#loading').fadeOut();
624
  })
625
  .always(function() {
626
  jQuery('#loading').fadeOut();
627
  });
628
  setTimeout(function() {
629
  if (totalPages == 0) {
630
  jQuery('#noPageWarning').fadeIn();
631
  }
632
  else {
633
  jQuery('#noPageWarning').hide();
634
  }
635
  var theposition = jQuery('#cf_thepage').val();
636
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
637
  var myString = thefunnel+'{#}'+theposition;
638
  var arr = myString.split('{#}');
639
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
640
  var do_ping = function() {
641
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
642
 
643
  }).catch(function(error) {
644
 
645
  });
646
  };
647
  do_ping();
648
  }, 3000);
649
  });
650
  var request_image = function(url) {
651
  return new Promise(function(resolve, reject) {
652
  var img = new Image();
653
  img.onload = function() { resolve(img); };
654
  img.onerror = function() { reject(url); };
655
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
656
  });
657
  };
658
  /**
659
  * Pings a url.
660
  * @param {String} url
661
  * @return {Promise} promise that resolves to a ping (ms, float).
662
  */
663
  var ping = function(url) {
664
  return new Promise(function(resolve, reject) {
665
  var start = (new Date()).getTime();
666
  var response = function() {
667
  var delta = ((new Date()).getTime() - start);
668
 
669
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
670
  delta /= 4;
671
 
672
  resolve(delta);
673
  };
674
  request_image(url).then(response).catch(response);
675
 
676
  // Set a timeout for max-pings, 5s.
677
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
678
  });
679
  };
680
  // Select New Page
681
  jQuery( '#cf_thepage' ).change(function() {
682
  jQuery('#loading').fadeOut();
683
  var thefunnel = jQuery('#cf_thefunnel').val();
684
  var theposition = jQuery(this).val();
685
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
686
  var myString = thefunnel+'{#}'+theposition;
687
  var arr = myString.split('{#}');
688
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
689
  var do_ping = function() {
690
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
691
 
692
  }).catch(function(error) {
693
 
694
  });
695
  };
696
  do_ping();
697
  });
698
  // Fade Out Message
699
  setTimeout(function() {
700
  jQuery('#message').fadeOut();
701
  }, 3500);
702
  // Savings
703
  jQuery('#publish').click(function() {
704
  jQuery('#saving').fadeIn();
705
  });
706
  jQuery('#delete').on('click', function () {
707
  return confirm('Are you sure you want to delete this page?');
708
  });
709
  jQuery('#cf_slug').bind('keyup keypress blur', function()
710
  {
711
  var myStr = jQuery(this).val()
712
  myStr=myStr.toLowerCase();
713
  myStr=myStr.replace(/\s/g , "-");
714
  jQuery('#cf_slug').val(myStr);
715
  });
716
  // Check Null and Resave v1.0.6
717
  <?php if ($thepage[1] == 'null') { ?>
718
  jQuery('#autosaving').fadeIn();
719
  setTimeout(function() {
720
  jQuery('form').submit();
721
  }, 2000);
722
  <?php } ?>
723
  });
724
  display: none !important;
725
  }
726
  #side-sortables {
727
  display: none !important;
728
  }
729
  #clickfunnels_meta_box {
730
  width: 780px !important;
731
  border-radius: 5px;
732
  }
733
  .button:active, .button:hover, .button:focus {
734
  outline: none !important;
735
  box-shadow: none !important;
736
  }
737
  #message {
738
  width: 752px;
739
  margin-bottom: 0;
740
  }
741
  .apiHeader {
742
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
743
  border-bottom: 3px solid rgba(0,0,0,0.25);
744
  padding: 10px;
745
  padding-top: 15px;
746
  border-top-left-radius: 5px;
747
  border-top-right-radius: 5px;
748
  clear: both;
749
  }
750
  .apiHeader img {
751
  width: 200px;
752
  float: left;
753
  margin-left: 10px;
754
  }
755
  .apiHeader a {
756
  float: right;
757
  display: block;
758
  color: #fff;
759
  font-size: 13px;
760
  text-decoration: none;
761
  margin-right: 5px !important;
762
  background-color: rgba(0, 0, 0, .3);
763
  border: 2px solid #2b2e30;
764
  color: #afbbc8 !important;
765
  font-weight: 700;
766
  -webkit-border-radius: 4px;
767
  -moz-border-radius: 4px;
768
  border-radius: 4px;
769
  padding: 7px;
770
  padding-left: 12px;
771
  padding-right: 12px;
772
  margin-top: 0px !important;
773
  text-transform: uppercase;
774
  text-decoration: none;
775
  font-size: 14px;
776
  }
777
  .apiHeader a:hover {
778
  border: 2px solid #1D81C8;
779
  background-color: rgba(0, 0, 0, .6);
780
  color: #fff !important;
781
  }
782
  .apiSubHeader {
783
  background-color: #0166AE;
784
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
785
  border-bottom: 3px solid rgba(0,0,0,0.25);
786
  color: #fff;
787
  padding: 15px 18px;
788
  }
789
  .apiSubHeader h2 {
790
  margin: 0 !important;
791
  padding: 0 !important;
792
  color: #fff;
793
  font-weight: bold;
794
  font-size: 17px;
795
  text-shadow: 1px 1px 0 #0367AE;
796
  }
797
  .apiSubHeader a.editThisPage {
798
  float: right;
799
  padding: 5px 10px;
800
  color: #fff;
801
  text-shadow: 1px 1px 0 #0367AE;
802
  text-decoration: none;
803
  padding-top: 15px;
804
  margin-top: 6px;
805
  font-size: 14px;
806
  border: 2px solid #1D81C8;
807
  background-color: #054B7C;
808
  color: #fff !important;
809
  font-weight: 700;
810
  -webkit-border-radius: 4px;
811
  -moz-border-radius: 4px;
812
  border-radius: 4px;
813
  padding: 7px;
814
  padding-left: 12px;
815
  padding-right: 12px;
816
  text-transform: uppercase;
817
  text-decoration: none;
818
  font-size: 12px;
819
  }
820
  .apiSubHeader a.editThisPage i {
821
  margin-right: 4px;
822
  }
823
  .apiSubHeader a.editThisPage:hover {
824
  border: 2px solid #FFB700;
825
  text-shadow: 1px 1px 0 #222;
826
  background-color: rgba(0, 0, 0, .6);
827
  color: #fff !important;
828
  }
829
  .apiSubHeader a{
830
  text-shadow: 1px 1px 0 #0367AE;
831
  color: #fff;
832
  text-decoration: none;
833
  font-size: 12px;
834
  opacity: .8;
835
  }
836
  .apiSubHeader a:hover {
837
  opacity: 1;
838
  }
839
  .inside {
840
  padding: 0 !important;
841
  margin-top: 0 !important;
842
  border-radius: 5px !important;
843
  }
844
  .inside h2 {
845
  display: block !important;
846
  }
847
  #postbox-container-2 {
848
  margin-top: -20px !important;
849
  }
850
  body #poststuff .hndle.ui-sortable-handle {
851
  display: none !important;
852
  }
853
  body #poststuff .handlediv {
854
  display: none !important;
855
  }
856
  #loading {
857
  float: left;
858
  margin-left: 10px;
859
  display: none;
860
  margin-top: 6px;
861
  color: #999;
862
  }
863
  #apiFooter {
864
  background: #F1F1F1;
865
  padding: 20px 0;
866
  padding-bottom: 10px;
867
  }
868
  #apiFooter a:hover {
869
  text-decoration: none;
870
  }
871
  .bootstrap-wp {
872
  overflow: hidden;
873
  border: 10px solid #F1F1F1;
874
  }
875
  .deleteButton {
876
  padding: 5px;
877
  float: left;
878
  color: #777 !important;
879
  font-size: 13px;
880
  }
881
  body .cf_header .btn {
882
  font-size: 13px !important;
883
  padding: 8px 15px;
884
  }
885
  body .btn-selected {
886
  background-color: #0166AE !important;
887
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
888
  text-shadow: 1px 1px 0 #034E82 !important;
889
  font-family: Arial !important;
890
  color: #ffffff !important;
891
  border: solid #1f628d 1px !important;
892
  text-decoration: none !important;
893
  transition: none !important;
894
  }
895
  body label {
896
  font-size: 11px;
897
  opacity: .8;
898
  }
899
  body label i {
900
  padding-left: 10px;
901
  }
902
  .helpinfo {
903
  padding: 20px 40px;
904
  background: #fafafa;
905
  border-top: 1px solid #f2f2f2;
906
  margin: 0 0px;
907
  margin-top: -20px;
908
  margin-bottom: -20px;
909
  }
910
  .helpinfo h4 {
911
  color: #3B474F;
912
  font-size: 15px;
913
  font-weight: 700;
914
  padding-bottom: 10px;
915
  padding-top: 5px;
916
  }
917
  .helpinfo p {
918
  color: #888;
919
  font-weight: 300;
920
  font-size: 12px;
921
  line-height: 19px;
922
  letter-spacing: 1px;
923
  padding-bottom: 0;
924
  }
925
  .helpinfo h4 i {
926
  margin-right: 4px;
927
  }
928
  #message {
929
  width: 758px;
930
  padding: 10px 10px;
931
  display: block;
932
  z-index: 99999;
933
  position: relative;
934
  color: #fff;
935
  border: 1px solid #024D82;
936
  border-bottom: 2px solid #024D82;
937
  text-shadow: 1px 1px 0 #024D82;
938
  padding: 0 10px;
939
  font-size: 16px;
940
  margin-bottom: 0;
941
  border-radius: 5px;
942
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
943
  }
944
  .noAPI {
945
  padding: 10px;
946
  border-bottom: 2px solid #c93f2b;
947
  background: #E64D37;
948
  }
949
  .noAPI h4 {
950
  margin: 0;
951
  padding: 0;
952
  color: #fff;
953
  }
954
  .noAPI h4 a {
955
  color: #fff;
956
  font-weight: normal;
957
  }
958
  .input-xlarge {
959
 
960
  }
961
  .control-group {
962
  padding-left: 25px
963
  }
964
  #autosaving {
965
  display: none;
966
  width: 780px;
967
  height: 310px;
968
  position: absolute;
969
  z-index: 2222;
970
  top: 145px;
971
  color: #fff;
972
  left: 0;
973
  padding-top: 160px;
974
  text-align: center;
975
  border-bottom-right-radius: 5px;
976
  border-bottom-left-radius: 5px;
977
  background: rgba(0, 0, 0, .8);
978
  }
979
  #autosaving h2 {
980
  color: #fff;
981
  font-weight: 600;
982
  text-shadow: 0 0 2p
983
  x #000;
984
  margin-top: 0;
985
  }
986
  #autosaving h4 {
987
  color: #fff;
988
  font-size: 13px;
989
  letter-spacing: 1px;
990
  font-weight: 300;
991
  margin-bottom: 5px;
992
  text-shadow: 0 0 2px #000;
993
  }
994
  #autosaving h1 {
995
  color: #fff;
996
  margin-top: 0;
997
  font-size: 58px;
998
  font-weight: 800;
999
  text-shadow: 0 0 2px #000;
1000
  }
1001
  if ( $cf_page != "" ) {
1002
  $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' ) );
1003
  $cf_funnels_pages = json_decode( $json );
1004
  }
1005
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
1006
  <h2>Saving and Reloading...</h2>
1007
  <h1><i class="fa fa-cog fa-spin"></i></h1>
1008
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
1009
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
1010
  <br clear="all">
1011
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1012
  <?php if ( $cf_type=='p' ) {?>
1013
  <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> Launch in Editor</a>
1014
  <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>
1015
  <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>
1016
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
1017
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
1018
  <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>
1019
  <?php }?>
1020
  <?php if ( $cf_type=='hp' ) {?>
1021
  <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>
1022
  <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>
1023
  <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>
1024
  <h2>Set as Home Page</h2>
1025
  <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>
1026
  <?php }?>
1027
  <?php if ( $cf_type=='np' ) {?>
1028
  <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>
1029
  <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>
1030
  <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>
1031
  <h2>Set as 404 Page</h2>
1032
  <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>
1033
  <?php }?>
1034
  <?php if ( $cf_type=='' ) {?>
1035
  <h2>Page Undefined - Create New Page</h2>
1036
  <?php }?>
1037
  <?php } else { ?>
1038
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
1039
  <?php } ?>
1040
  <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>
1041
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1042
  <div class="row-fluid form-horizontal">
1043
  <br>
1044
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
1045
  <div data-target="cf_type" class="btn-group multichoice cf_header">
1046
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
1047
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
1048
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
1049
  </div>
1050
  <input type="hidden" id="cf_type" name="cf_type"/>
1051
  </div>
1052
  <br>
1053
  <div class="control-group">
1054
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1055
  <div class="controls">
1056
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1057
  <?php if ( empty( $cf_funnels ) ) { ?>
1058
  <option value="0">No Funnels Found</option>
1059
  <?php }
1060
  else {
1061
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1062
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1063
  <?php
1064
  }
1065
  } ?>
1066
  </select>
1067
  </div>
1068
  </div>
1069
  <div class="control-group">
1070
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1071
  <div class="controls">
1072
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1073
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1074
  <option value="0">No Pages Found</option>
1075
  <?php }
1076
  else {
1077
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1078
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1079
  <?php
1080
  }
1081
  }
1082
  ?>
1083
  </select>
1084
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1085
  </div>
1086
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;padding-top: 10px;display: none;width: 100%; clear: both"><em>You have no pages for this funnel. <a href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>" target="_blank">Click to add new page.</a></em></div>
1087
  </div>
1088
  <div class="control-group" id="hiddenStuff" style="display: none">
1089
  <div class="controls">
1090
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1091
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1092
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1093
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1094
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1095
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1096
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1097
  </div>
1098
  </div>
1099
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1100
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1101
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1102
  <div id="cf-wp-path" class="controls ">
1103
  <div class="input-prepend">
1104
  <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">
1105
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1106
  </div>
1107
  </div>
1108
  </div>
1109
  <br><br>
1110
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1111
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1112
  <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>
1113
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1114
  </div>
1115
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1116
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1117
  <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>
1118
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1119
  </div>
1120
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1121
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1122
  <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>
1123
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1124
  </div>
1125
  <br>
1126
  <div class="row-fluid" id="apiFooter">
1127
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1128
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1129
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1130
  </button>
1131
  <?php } else { ?>
1132
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
1133
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1134
  </button>
1135
  <?php } ?>
1136
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1137
  <i class="fa fa-spinner fa-spin"></i>
1138
  <span>Saving...</span>
1139
  </div>
1140
  <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>
1141
  <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>
1142
  <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>
1143
  <?php if ( !empty( $delete_link ) ) {?>
1144
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1145
  <?php }?>
1146
  </div>
1147
  </div>
1148
  </div>
1149
  (function($) {
1150
  setTimeout(function() {
1151
  $('#cf_thepage').trigger( "change" );
1152
  }, 1500);
1153
  })(jQuery);
 
1
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
2
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
3
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
4
  $thepage = explode( "{#}", $cf_page );
5
  $savedData = $cf_page;
6
  }
7
  else {
8
  $thepage = explode( "{#}", $cf_page['page_id'] );
9
  $savedData = $cf_page['page_id'];
10
  }
11
  $cf_options = get_option( "cf_options" );
12
  jQuery(document).ready(function(){
13
  // Set Correct Options
14
  var thefunnel = jQuery('#cf_thefunnel').val();
15
  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" ); ?>';
16
  jQuery('#cf_thepage').find('option').remove().end();
17
  jQuery('#loading').fadeIn();
18
  jQuery.getJSON(specificFunnel, function(data) {
19
  setTimeout(function() {
20
  jQuery('#loading').fadeOut();
21
  }, 2000);
22
  var is_selected = "";
23
  jQuery.each(data.funnel_steps, function() {
24
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
25
  is_selected = "selected";
26
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
27
  } else {
28
  is_selected = "";
29
  }
30
 
31
  if( this.wp_friendly == true) {
32
  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(); ?>" '+is_selected+'>'+ this.name +'</option>');
33
  }
34
 
35
  });
36
  }).done(function() {
37
  jQuery('#loading').fadeOut();
38
  jQuery('#cf_thepage').trigger( "change" );
39
  })
40
  .fail(function() {
41
  jQuery('#loading').fadeOut();
42
  })
43
  .always(function() {
44
  jQuery('#loading').fadeOut();
45
  console.log( "ClickFunnels Rocks!" );
46
  });
47
  // Change Funnel Populate Dropdown
48
  jQuery( '#cf_thefunnel' ).change(function() {
49
  jQuery('#loading').fadeIn();
50
  var thefunnel = jQuery(this).val();
51
  var totalPages = 0;
52
  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" ); ?>';
53
  jQuery('#cf_thepage').find('option').remove().end();
54
  jQuery.getJSON(specificFunnel, function(data) {
55
  setTimeout(function() {
56
  jQuery('#loading').fadeOut();
57
  }, 2000);
58
  // alert( JSON.stringify(data.funnel_steps));
59
  jQuery.each(data.funnel_steps, function() {
60
  if( this.wp_friendly == true && this.in_funnel == true ) {
61
  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 +'</option>');
62
  totalPages += 1;
63
  }
64
  });
65
  }).done(function() {
66
  jQuery('#loading').fadeOut();
67
  })
68
  .fail(function() {
69
  jQuery('#loading').fadeOut();
70
  })
71
  .always(function() {
72
  jQuery('#loading').fadeOut();
73
  });
74
  setTimeout(function() {
75
  if (totalPages == 0) {
76
  jQuery('#noPageWarning').fadeIn();
77
  }
78
  else {
79
  jQuery('#noPageWarning').hide();
80
  }
81
  var theposition = jQuery('#cf_thepage').val();
82
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
83
  var myString = thefunnel+'{#}'+theposition;
84
  var arr = myString.split('{#}');
85
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
86
  var do_ping = function() {
87
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
88
 
89
  }).catch(function(error) {
90
 
91
  });
92
  };
93
  do_ping();
94
  }, 3000);
95
  });
96
  var request_image = function(url) {
97
  return new Promise(function(resolve, reject) {
98
  var img = new Image();
99
  img.onload = function() { resolve(img); };
100
  img.onerror = function() { reject(url); };
101
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
102
  });
103
  };
104
  /**
105
  * Pings a url.
106
  * @param {String} url
107
  * @return {Promise} promise that resolves to a ping (ms, float).
108
  */
109
  var ping = function(url) {
110
  return new Promise(function(resolve, reject) {
111
  var start = (new Date()).getTime();
112
  var response = function() {
113
  var delta = ((new Date()).getTime() - start);
114
 
115
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
116
  delta /= 4;
117
 
118
  resolve(delta);
119
  };
120
  request_image(url).then(response).catch(response);
121
 
122
  // Set a timeout for max-pings, 5s.
123
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
124
  });
125
  };
126
  // Select New Page
127
  jQuery( '#cf_thepage' ).change(function() {
128
  jQuery('#loading').fadeOut();
129
  var thefunnel = jQuery('#cf_thefunnel').val();
130
  var theposition = jQuery(this).val();
131
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
132
  var myString = thefunnel+'{#}'+theposition;
133
  var arr = myString.split('{#}');
134
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
135
  var do_ping = function() {
136
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
137
 
138
  }).catch(function(error) {
139
 
140
  });
141
  };
142
  do_ping();
143
  });
144
  // Fade Out Message
145
  setTimeout(function() {
146
  jQuery('#message').fadeOut();
147
  }, 3500);
148
  // Savings
149
  jQuery('#publish').click(function() {
150
  jQuery('#saving').fadeIn();
151
  });
152
  jQuery('#delete').on('click', function () {
153
  return confirm('Are you sure you want to delete this page?');
154
  });
155
  jQuery('#cf_slug').bind('keyup keypress blur', function()
156
  {
157
  var myStr = jQuery(this).val()
158
  myStr=myStr.toLowerCase();
159
  myStr=myStr.replace(/\s/g , "-");
160
  jQuery('#cf_slug').val(myStr);
161
  });
162
  });
163
  display: none !important;
164
  }
165
  #side-sortables {
166
  display: none !important;
167
  }
168
  #clickfunnels_meta_box {
169
  width: 780px !important;
170
  border-radius: 5px;
171
  }
172
  .button:active, .button:hover, .button:focus {
173
  outline: none !important;
174
  box-shadow: none !important;
175
  }
176
  #message {
177
  width: 752px;
178
  margin-bottom: 0;
179
  }
180
  .apiHeader {
181
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
182
  border-bottom: 3px solid rgba(0,0,0,0.25);
183
  padding: 10px;
184
  padding-top: 15px;
185
  border-top-left-radius: 5px;
186
  border-top-right-radius: 5px;
187
  clear: both;
188
  }
189
  .apiHeader img {
190
  width: 200px;
191
  float: left;
192
  margin-left: 10px;
193
  }
194
  .apiHeader a {
195
  float: right;
196
  display: block;
197
  color: #fff;
198
  font-size: 13px;
199
  text-decoration: none;
200
  margin-right: 5px !important;
201
  background-color: rgba(0, 0, 0, .3);
202
  border: 2px solid #2b2e30;
203
  color: #afbbc8 !important;
204
  font-weight: 700;
205
  -webkit-border-radius: 4px;
206
  -moz-border-radius: 4px;
207
  border-radius: 4px;
208
  padding: 7px;
209
  padding-left: 12px;
210
  padding-right: 12px;
211
  margin-top: 0px !important;
212
  text-transform: uppercase;
213
  text-decoration: none;
214
  font-size: 14px;
215
  }
216
  .apiHeader a:hover {
217
  border: 2px solid #1D81C8;
218
  background-color: rgba(0, 0, 0, .6);
219
  color: #fff !important;
220
  }
221
  .apiSubHeader {
222
  background-color: #0166AE;
223
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
224
  border-bottom: 3px solid rgba(0,0,0,0.25);
225
  color: #fff;
226
  padding: 15px 18px;
227
  }
228
  .apiSubHeader h2 {
229
  margin: 0 !important;
230
  padding: 0 !important;
231
  color: #fff;
232
  font-weight: bold;
233
  font-size: 17px;
234
  text-shadow: 1px 1px 0 #0367AE;
235
  }
236
  .apiSubHeader a.editThisPage {
237
  float: right;
238
  padding: 5px 10px;
239
  color: #fff;
240
  text-shadow: 1px 1px 0 #0367AE;
241
  text-decoration: none;
242
  padding-top: 15px;
243
  margin-top: 6px;
244
  font-size: 14px;
245
  border: 2px solid #1D81C8;
246
  background-color: #054B7C;
247
  color: #fff !important;
248
  font-weight: 700;
249
  -webkit-border-radius: 4px;
250
  -moz-border-radius: 4px;
251
  border-radius: 4px;
252
  padding: 7px;
253
  padding-left: 12px;
254
  padding-right: 12px;
255
  text-transform: uppercase;
256
  text-decoration: none;
257
  font-size: 12px;
258
  }
259
  .apiSubHeader a.editThisPage i {
260
  margin-right: 4px;
261
  }
262
  .apiSubHeader a.editThisPage:hover {
263
  border: 2px solid #FFB700;
264
  text-shadow: 1px 1px 0 #222;
265
  background-color: rgba(0, 0, 0, .6);
266
  color: #fff !important;
267
  }
268
  .apiSubHeader a{
269
  text-shadow: 1px 1px 0 #0367AE;
270
  color: #fff;
271
  text-decoration: none;
272
  font-size: 12px;
273
  opacity: .8;
274
  }
275
  .apiSubHeader a:hover {
276
  opacity: 1;
277
  }
278
  .inside {
279
  padding: 0 !important;
280
  margin-top: 0 !important;
281
  border-radius: 5px !important;
282
  }
283
  .inside h2 {
284
  display: block !important;
285
  }
286
  #postbox-container-2 {
287
  margin-top: -20px !important;
288
  }
289
  body #poststuff .hndle.ui-sortable-handle {
290
  display: none !important;
291
  }
292
  body #poststuff .handlediv {
293
  display: none !important;
294
  }
295
  #loading {
296
  float: left;
297
  margin-left: 10px;
298
  display: none;
299
  margin-top: 6px;
300
  color: #999;
301
  }
302
  #apiFooter {
303
  background: #F1F1F1;
304
  padding: 20px 0;
305
  padding-bottom: 10px;
306
  }
307
  #apiFooter a:hover {
308
  text-decoration: none;
309
  }
310
  .bootstrap-wp {
311
  overflow: hidden;
312
  border: 10px solid #F1F1F1;
313
  }
314
  .deleteButton {
315
  padding: 5px;
316
  float: left;
317
  color: #777 !important;
318
  font-size: 13px;
319
  }
320
  body .cf_header .btn {
321
  font-size: 13px !important;
322
  padding: 8px 15px;
323
  }
324
  body .btn-selected {
325
  background-color: #0166AE !important;
326
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
327
  text-shadow: 1px 1px 0 #034E82 !important;
328
  font-family: Arial !important;
329
  color: #ffffff !important;
330
  border: solid #1f628d 1px !important;
331
  text-decoration: none !important;
332
  transition: none !important;
333
  }
334
  body label {
335
  font-size: 11px;
336
  opacity: .8;
337
  }
338
  body label i {
339
  padding-left: 10px;
340
  }
341
  .helpinfo {
342
  padding: 20px 40px;
343
  background: #fafafa;
344
  border-top: 1px solid #f2f2f2;
345
  margin: 0 0px;
346
  margin-top: -20px;
347
  margin-bottom: -20px;
348
  }
349
  .helpinfo h4 {
350
  color: #3B474F;
351
  font-size: 15px;
352
  font-weight: 700;
353
  padding-bottom: 10px;
354
  padding-top: 5px;
355
  }
356
  .helpinfo p {
357
  color: #888;
358
  font-weight: 300;
359
  font-size: 12px;
360
  line-height: 19px;
361
  letter-spacing: 1px;
362
  padding-bottom: 0;
363
  }
364
  .helpinfo h4 i {
365
  margin-right: 4px;
366
  }
367
  #message {
368
  width: 758px;
369
  padding: 10px 10px;
370
  display: block;
371
  z-index: 99999;
372
  position: relative;
373
  color: #fff;
374
  border: 1px solid #024D82;
375
  border-bottom: 2px solid #024D82;
376
  text-shadow: 1px 1px 0 #024D82;
377
  padding: 0 10px;
378
  font-size: 16px;
379
  margin-bottom: 0;
380
  border-radius: 5px;
381
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
382
  }
383
  .noAPI {
384
  padding: 10px;
385
  border-bottom: 2px solid #c93f2b;
386
  background: #E64D37;
387
  }
388
  .noAPI h4 {
389
  margin: 0;
390
  padding: 0;
391
  color: #fff;
392
  }
393
  .noAPI h4 a {
394
  color: #fff;
395
  font-weight: normal;
396
  }
397
  .input-xlarge {
398
 
399
  }
400
  .control-group {
401
  padding-left: 25px
402
  }
403
  if ( $cf_page != "" ) {
404
  $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' ) );
405
  $cf_funnels_pages = json_decode( $json );
406
  }
407
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
408
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
409
  <br clear="all">
410
  <?php if ( !empty( $_GET['action'] ) ) { ?>
411
  <?php if ( $cf_type=='p' ) {?>
412
  <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> Launch in Editor</a>
413
  <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>
414
  <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>
415
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
416
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
417
  <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>
418
  <?php }?>
419
  <?php if ( $cf_type=='hp' ) {?>
420
  <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>
421
  <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>
422
  <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>
423
  <h2>Set as Home Page</h2>
424
  <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>
425
  <?php }?>
426
  <?php if ( $cf_type=='np' ) {?>
427
  <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>
428
  <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>
429
  <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>
430
  <h2>Set as 404 Page</h2>
431
  <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>
432
  <?php }?>
433
  <?php if ( $cf_type=='' ) {?>
434
  <h2>Page Undefined - Create New Page</h2>
435
  <?php }?>
436
  <?php } else { ?>
437
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
438
  <?php } ?>
439
  <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>
440
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
441
  <div class="row-fluid form-horizontal">
442
  <br>
443
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
444
  <div data-target="cf_type" class="btn-group multichoice cf_header">
445
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
446
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
447
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
448
  </div>
449
  <input type="hidden" id="cf_type" name="cf_type"/>
450
  </div>
451
  <br>
452
  <div class="control-group">
453
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
454
  <div class="controls">
455
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
456
  <?php if ( empty( $cf_funnels ) ) { ?>
457
  <option value="0">No Funnels Found</option>
458
  <?php }
459
  else {
460
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
461
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
462
  <?php
463
  }
464
  } ?>
465
  </select>
466
  </div>
467
  </div>
468
  <div class="control-group">
469
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
470
  <div class="controls">
471
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
472
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
473
  <option value="0">No Pages Found</option>
474
  <?php }
475
  else {
476
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
477
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
478
  <?php
479
  }
480
  }
481
  ?>
482
  </select>
483
  <i class="fa fa-spinner fa-spin" id="loading"></i>
484
  </div>
485
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;padding-top: 10px;display: none;width: 100%; clear: both"><em>You have no pages for this funnel. <a href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>" target="_blank">Click to add new page.</a></em></div>
486
  </div>
487
  <div class="control-group" id="hiddenStuff" style="display: none">
488
  <div class="controls">
489
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
490
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
491
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
492
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
493
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
494
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
495
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
496
  </div>
497
  </div>
498
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
499
  <div class="cf_url control-group" style="<?php echo $display;?>" >
500
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
501
  <div id="cf-wp-path" class="controls ">
502
  <div class="input-prepend">
503
  <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">
504
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
505
  </div>
506
  </div>
507
  </div>
508
  <br><br>
509
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
510
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
511
  <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>
512
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
513
  </div>
514
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
515
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
516
  <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>
517
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
518
  </div>
519
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
520
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
521
  <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>
522
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
523
  </div>
524
  <br>
525
  <div class="row-fluid" id="apiFooter">
526
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
527
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
528
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
529
  </button>
530
  <?php } else { ?>
531
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
532
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
533
  </button>
534
  <?php } ?>
535
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
536
  <i class="fa fa-spinner fa-spin"></i>
537
  <span>Saving...</span>
538
  </div>
539
  <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>
540
  <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>
541
  <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>
542
  <?php if ( !empty( $delete_link ) ) {?>
543
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
544
  <?php }?>
545
  </div>
546
  </div>
547
  </div>
548
  (function($) {
549
  setTimeout(function() {
550
  $('#cf_thepage').trigger( "change" );
551
  }, 1500);
552
  })(jQuery);
553
+ <?php
554
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
555
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
556
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
557
  $thepage = explode( "{#}", $cf_page );
558
  $savedData = $cf_page;
559
  }
560
  else {
561
  $thepage = explode( "{#}", $cf_page['page_id'] );
562
  $savedData = $cf_page['page_id'];
563
  }
564
  $cf_options = get_option( "cf_options" );
565
  jQuery(document).ready(function(){
566
  // Set Correct Options
567
  var thefunnel = jQuery('#cf_thefunnel').val();
568
  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" ); ?>';
569
  jQuery('#cf_thepage').find('option').remove().end();
570
  jQuery('#loading').fadeIn();
571
  jQuery.getJSON(specificFunnel, function(data) {
572
  setTimeout(function() {
573
  jQuery('#loading').fadeOut();
574
  }, 2000);
575
  var is_selected = "";
576
  jQuery.each(data.funnel_steps, function() {
577
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
578
  is_selected = "selected";
579
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
580
  } else {
581
  is_selected = "";
582
  }
583
 
584
  if ( this.wp_friendly == true && this.in_funnel == true ) {
585
  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(); ?>" '+is_selected+'>'+ this.name +'</option>');
586
  }
587
 
588
 
589
  });
590
  }).done(function() {
591
  jQuery('#loading').fadeOut();
592
  jQuery('#cf_thepage').trigger( "change" );
593
  })
594
  .fail(function() {
595
  jQuery('#loading').fadeOut();
596
  })
597
  .always(function() {
598
  jQuery('#loading').fadeOut();
599
  console.log( "ClickFunnels Rocks!" );
600
  });
601
  // Change Funnel Populate Dropdown
602
  jQuery( '#cf_thefunnel' ).change(function() {
603
  jQuery('#loading').fadeIn();
604
  var thefunnel = jQuery(this).val();
605
  var totalPages = 0;
606
  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" ); ?>';
607
  jQuery('#cf_thepage').find('option').remove().end();
608
  jQuery.getJSON(specificFunnel, function(data) {
609
  setTimeout(function() {
610
  jQuery('#loading').fadeOut();
611
  }, 2000);
612
  // alert( JSON.stringify(data.funnel_steps));
613
  jQuery.each(data.funnel_steps, function() {
614
  if( this.wp_friendly == true && this.in_funnel == true ) {
615
  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 +'</option>');
616
  totalPages += 1;
617
  }
618
  });
619
  }).done(function() {
620
  jQuery('#loading').fadeOut();
621
  })
622
  .fail(function() {
623
  jQuery('#loading').fadeOut();
624
  })
625
  .always(function() {
626
  jQuery('#loading').fadeOut();
627
  });
628
  setTimeout(function() {
629
  if (totalPages == 0) {
630
  jQuery('#noPageWarning').fadeIn();
631
  }
632
  else {
633
  jQuery('#noPageWarning').hide();
634
  }
635
  var theposition = jQuery('#cf_thepage').val();
636
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
637
  var myString = thefunnel+'{#}'+theposition;
638
  var arr = myString.split('{#}');
639
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
640
  var do_ping = function() {
641
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
642
 
643
  }).catch(function(error) {
644
 
645
  });
646
  };
647
  do_ping();
648
  }, 3000);
649
  });
650
  var request_image = function(url) {
651
  return new Promise(function(resolve, reject) {
652
  var img = new Image();
653
  img.onload = function() { resolve(img); };
654
  img.onerror = function() { reject(url); };
655
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
656
  });
657
  };
658
  /**
659
  * Pings a url.
660
  * @param {String} url
661
  * @return {Promise} promise that resolves to a ping (ms, float).
662
  */
663
  var ping = function(url) {
664
  return new Promise(function(resolve, reject) {
665
  var start = (new Date()).getTime();
666
  var response = function() {
667
  var delta = ((new Date()).getTime() - start);
668
 
669
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
670
  delta /= 4;
671
 
672
  resolve(delta);
673
  };
674
  request_image(url).then(response).catch(response);
675
 
676
  // Set a timeout for max-pings, 5s.
677
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
678
  });
679
  };
680
  // Select New Page
681
  jQuery( '#cf_thepage' ).change(function() {
682
  jQuery('#loading').fadeOut();
683
  var thefunnel = jQuery('#cf_thefunnel').val();
684
  var theposition = jQuery(this).val();
685
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
686
  var myString = thefunnel+'{#}'+theposition;
687
  var arr = myString.split('{#}');
688
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
689
  var do_ping = function() {
690
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
691
 
692
  }).catch(function(error) {
693
 
694
  });
695
  };
696
  do_ping();
697
  });
698
  // Fade Out Message
699
  setTimeout(function() {
700
  jQuery('#message').fadeOut();
701
  }, 3500);
702
  // Savings
703
  jQuery('#publish').click(function() {
704
  jQuery('#saving').fadeIn();
705
  });
706
  jQuery('#delete').on('click', function () {
707
  return confirm('Are you sure you want to delete this page?');
708
  });
709
  jQuery('#cf_slug').bind('keyup keypress blur', function()
710
  {
711
  var myStr = jQuery(this).val()
712
  myStr=myStr.toLowerCase();
713
  myStr=myStr.replace(/\s/g , "-");
714
  jQuery('#cf_slug').val(myStr);
715
  });
716
  // Check Null and Resave v1.0.6
717
  <?php if ($thepage[1] == 'null') { ?>
718
  jQuery('#autosaving').fadeIn();
719
  setTimeout(function() {
720
  jQuery('form').submit();
721
  }, 2000);
722
  <?php } ?>
723
  });
724
  display: none !important;
725
  }
726
  #side-sortables {
727
  display: none !important;
728
  }
729
  #clickfunnels_meta_box {
730
  width: 780px !important;
731
  border-radius: 5px;
732
  }
733
  .button:active, .button:hover, .button:focus {
734
  outline: none !important;
735
  box-shadow: none !important;
736
  }
737
  #message {
738
  width: 752px;
739
  margin-bottom: 0;
740
  }
741
  .apiHeader {
742
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
743
  border-bottom: 3px solid rgba(0,0,0,0.25);
744
  padding: 10px;
745
  padding-top: 15px;
746
  border-top-left-radius: 5px;
747
  border-top-right-radius: 5px;
748
  clear: both;
749
  }
750
  .apiHeader img {
751
  width: 200px;
752
  float: left;
753
  margin-left: 10px;
754
  }
755
  .apiHeader a {
756
  float: right;
757
  display: block;
758
  color: #fff;
759
  font-size: 13px;
760
  text-decoration: none;
761
  margin-right: 5px !important;
762
  background-color: rgba(0, 0, 0, .3);
763
  border: 2px solid #2b2e30;
764
  color: #afbbc8 !important;
765
  font-weight: 700;
766
  -webkit-border-radius: 4px;
767
  -moz-border-radius: 4px;
768
  border-radius: 4px;
769
  padding: 7px;
770
  padding-left: 12px;
771
  padding-right: 12px;
772
  margin-top: 0px !important;
773
  text-transform: uppercase;
774
  text-decoration: none;
775
  font-size: 14px;
776
  }
777
  .apiHeader a:hover {
778
  border: 2px solid #1D81C8;
779
  background-color: rgba(0, 0, 0, .6);
780
  color: #fff !important;
781
  }
782
  .apiSubHeader {
783
  background-color: #0166AE;
784
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
785
  border-bottom: 3px solid rgba(0,0,0,0.25);
786
  color: #fff;
787
  padding: 15px 18px;
788
  }
789
  .apiSubHeader h2 {
790
  margin: 0 !important;
791
  padding: 0 !important;
792
  color: #fff;
793
  font-weight: bold;
794
  font-size: 17px;
795
  text-shadow: 1px 1px 0 #0367AE;
796
  }
797
  .apiSubHeader a.editThisPage {
798
  float: right;
799
  padding: 5px 10px;
800
  color: #fff;
801
  text-shadow: 1px 1px 0 #0367AE;
802
  text-decoration: none;
803
  padding-top: 15px;
804
  margin-top: 6px;
805
  font-size: 14px;
806
  border: 2px solid #1D81C8;
807
  background-color: #054B7C;
808
  color: #fff !important;
809
  font-weight: 700;
810
  -webkit-border-radius: 4px;
811
  -moz-border-radius: 4px;
812
  border-radius: 4px;
813
  padding: 7px;
814
  padding-left: 12px;
815
  padding-right: 12px;
816
  text-transform: uppercase;
817
  text-decoration: none;
818
  font-size: 12px;
819
  }
820
  .apiSubHeader a.editThisPage i {
821
  margin-right: 4px;
822
  }
823
  .apiSubHeader a.editThisPage:hover {
824
  border: 2px solid #FFB700;
825
  text-shadow: 1px 1px 0 #222;
826
  background-color: rgba(0, 0, 0, .6);
827
  color: #fff !important;
828
  }
829
  .apiSubHeader a{
830
  text-shadow: 1px 1px 0 #0367AE;
831
  color: #fff;
832
  text-decoration: none;
833
  font-size: 12px;
834
  opacity: .8;
835
  }
836
  .apiSubHeader a:hover {
837
  opacity: 1;
838
  }
839
  .inside {
840
  padding: 0 !important;
841
  margin-top: 0 !important;
842
  border-radius: 5px !important;
843
  }
844
  .inside h2 {
845
  display: block !important;
846
  }
847
  #postbox-container-2 {
848
  margin-top: -20px !important;
849
  }
850
  body #poststuff .hndle.ui-sortable-handle {
851
  display: none !important;
852
  }
853
  body #poststuff .handlediv {
854
  display: none !important;
855
  }
856
  #loading {
857
  float: left;
858
  margin-left: 10px;
859
  display: none;
860
  margin-top: 6px;
861
  color: #999;
862
  }
863
  #apiFooter {
864
  background: #F1F1F1;
865
  padding: 20px 0;
866
  padding-bottom: 10px;
867
  }
868
  #apiFooter a:hover {
869
  text-decoration: none;
870
  }
871
  .bootstrap-wp {
872
  overflow: hidden;
873
  border: 10px solid #F1F1F1;
874
  }
875
  .deleteButton {
876
  padding: 5px;
877
  float: left;
878
  color: #777 !important;
879
  font-size: 13px;
880
  }
881
  body .cf_header .btn {
882
  font-size: 13px !important;
883
  padding: 8px 15px;
884
  }
885
  body .btn-selected {
886
  background-color: #0166AE !important;
887
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
888
  text-shadow: 1px 1px 0 #034E82 !important;
889
  font-family: Arial !important;
890
  color: #ffffff !important;
891
  border: solid #1f628d 1px !important;
892
  text-decoration: none !important;
893
  transition: none !important;
894
  }
895
  body label {
896
  font-size: 11px;
897
  opacity: .8;
898
  }
899
  body label i {
900
  padding-left: 10px;
901
  }
902
  .helpinfo {
903
  padding: 20px 40px;
904
  background: #fafafa;
905
  border-top: 1px solid #f2f2f2;
906
  margin: 0 0px;
907
  margin-top: -20px;
908
  margin-bottom: -20px;
909
  }
910
  .helpinfo h4 {
911
  color: #3B474F;
912
  font-size: 15px;
913
  font-weight: 700;
914
  padding-bottom: 10px;
915
  padding-top: 5px;
916
  }
917
  .helpinfo p {
918
  color: #888;
919
  font-weight: 300;
920
  font-size: 12px;
921
  line-height: 19px;
922
  letter-spacing: 1px;
923
  padding-bottom: 0;
924
  }
925
  .helpinfo h4 i {
926
  margin-right: 4px;
927
  }
928
  #message {
929
  width: 758px;
930
  padding: 10px 10px;
931
  display: block;
932
  z-index: 99999;
933
  position: relative;
934
  color: #fff;
935
  border: 1px solid #024D82;
936
  border-bottom: 2px solid #024D82;
937
  text-shadow: 1px 1px 0 #024D82;
938
  padding: 0 10px;
939
  font-size: 16px;
940
  margin-bottom: 0;
941
  border-radius: 5px;
942
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
943
  }
944
  .noAPI {
945
  padding: 10px;
946
  border-bottom: 2px solid #c93f2b;
947
  background: #E64D37;
948
  }
949
  .noAPI h4 {
950
  margin: 0;
951
  padding: 0;
952
  color: #fff;
953
  }
954
  .noAPI h4 a {
955
  color: #fff;
956
  font-weight: normal;
957
  }
958
  .input-xlarge {
959
 
960
  }
961
  .control-group {
962
  padding-left: 25px
963
  }
964
  #autosaving {
965
  display: none;
966
  width: 780px;
967
  height: 310px;
968
  position: absolute;
969
  z-index: 2222;
970
  top: 145px;
971
  color: #fff;
972
  left: 0;
973
  padding-top: 160px;
974
  text-align: center;
975
  border-bottom-right-radius: 5px;
976
  border-bottom-left-radius: 5px;
977
  background: rgba(0, 0, 0, .8);
978
  }
979
  #autosaving h2 {
980
  color: #fff;
981
  font-weight: 600;
982
  text-shadow: 0 0 2p
983
  x #000;
984
  margin-top: 0;
985
  }
986
  #autosaving h4 {
987
  color: #fff;
988
  font-size: 13px;
989
  letter-spacing: 1px;
990
  font-weight: 300;
991
  margin-bottom: 5px;
992
  text-shadow: 0 0 2px #000;
993
  }
994
  #autosaving h1 {
995
  color: #fff;
996
  margin-top: 0;
997
  font-size: 58px;
998
  font-weight: 800;
999
  text-shadow: 0 0 2px #000;
1000
  }
1001
  if ( $cf_page != "" ) {
1002
  $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' ) );
1003
  $cf_funnels_pages = json_decode( $json );
1004
  }
1005
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
1006
  <h2>Saving and Reloading...</h2>
1007
  <h1><i class="fa fa-cog fa-spin"></i></h1>
1008
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
1009
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
1010
  <br clear="all">
1011
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1012
  <?php if ( $cf_type=='p' ) {?>
1013
  <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> Launch in Editor</a>
1014
  <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>
1015
  <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>
1016
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
1017
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
1018
  <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>
1019
  <?php }?>
1020
  <?php if ( $cf_type=='hp' ) {?>
1021
  <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>
1022
  <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>
1023
  <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>
1024
  <h2>Set as Home Page</h2>
1025
  <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>
1026
  <?php }?>
1027
  <?php if ( $cf_type=='np' ) {?>
1028
  <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>
1029
  <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>
1030
  <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>
1031
  <h2>Set as 404 Page</h2>
1032
  <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>
1033
  <?php }?>
1034
  <?php if ( $cf_type=='' ) {?>
1035
  <h2>Page Undefined - Create New Page</h2>
1036
  <?php }?>
1037
  <?php } else { ?>
1038
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
1039
  <?php } ?>
1040
  <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>
1041
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1042
  <div class="row-fluid form-horizontal">
1043
  <br>
1044
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
1045
  <div data-target="cf_type" class="btn-group multichoice cf_header">
1046
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
1047
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
1048
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
1049
  </div>
1050
  <input type="hidden" id="cf_type" name="cf_type"/>
1051
  </div>
1052
  <br>
1053
  <div class="control-group">
1054
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1055
  <div class="controls">
1056
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1057
  <?php if ( empty( $cf_funnels ) ) { ?>
1058
  <option value="0">No Funnels Found</option>
1059
  <?php }
1060
  else {
1061
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1062
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1063
  <?php
1064
  }
1065
  } ?>
1066
  </select>
1067
  </div>
1068
  </div>
1069
  <div class="control-group">
1070
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1071
  <div class="controls">
1072
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1073
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1074
  <option value="0">No Pages Found</option>
1075
  <?php }
1076
  else {
1077
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1078
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1079
  <?php
1080
  }
1081
  }
1082
  ?>
1083
  </select>
1084
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1085
  </div>
1086
  <div id="noPageWarning" style="font-size: 11px; margin-left: 160px;padding-top: 10px;display: none;width: 100%; clear: both"><em>You have no pages for this funnel. <a href="https://www.clickfunnels.com/funnels/<?php echo $thepage[0]; ?>" target="_blank">Click to add new page.</a></em></div>
1087
  </div>
1088
  <div class="control-group" id="hiddenStuff" style="display: none">
1089
  <div class="controls">
1090
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1091
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1092
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1093
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1094
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1095
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1096
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1097
  </div>
1098
  </div>
1099
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1100
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1101
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1102
  <div id="cf-wp-path" class="controls ">
1103
  <div class="input-prepend">
1104
  <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">
1105
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1106
  </div>
1107
  </div>
1108
  </div>
1109
  <br><br>
1110
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1111
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1112
  <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>
1113
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1114
  </div>
1115
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1116
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1117
  <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>
1118
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1119
  </div>
1120
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1121
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1122
  <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>
1123
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
1124
  </div>
1125
  <br>
1126
  <div class="row-fluid" id="apiFooter">
1127
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1128
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1129
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1130
  </button>
1131
  <?php } else { ?>
1132
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
1133
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1134
  </button>
1135
  <?php } ?>
1136
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1137
  <i class="fa fa-spinner fa-spin"></i>
1138
  <span>Saving...</span>
1139
  </div>
1140
  <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>
1141
  <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>
1142
  <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>
1143
  <?php if ( !empty( $delete_link ) ) {?>
1144
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1145
  <?php }?>
1146
  </div>
1147
  </div>
1148
  </div>
1149
  (function($) {
1150
  setTimeout(function() {
1151
  $('#cf_thepage').trigger( "change" );
1152
  }, 1500);
1153
  })(jQuery);
clickfunnels.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: ClickFunnels
4
  * Plugin URI: http://clickfunnels.com
5
  * Description: Connect your ClickFunnel pages to your blog. Create new pages, connect to homepage or 404 pages.
6
- * Version: 1.0.5
7
  * Author: Etison, LLC
8
  * Author URI: http://clickfunnels.com
9
  */
3
  * Plugin Name: ClickFunnels
4
  * Plugin URI: http://clickfunnels.com
5
  * Description: Connect your ClickFunnel pages to your blog. Create new pages, connect to homepage or 404 pages.
6
+ * Version: 1.0.6
7
  * Author: Etison, LLC
8
  * Author URI: http://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.5</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.0.6</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.2
9
- Stable tag: 1.0.5
10
 
11
  Connect your ClickFunnels pages to your Wordpress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
@@ -94,6 +94,11 @@ By re-selecting the page it will ping the server which should refresh your page.
94
 
95
  Stay current with the latest version of the plugin:
96
 
 
 
 
 
 
97
  = Version 1.0.5 =
98
 
99
  * Fixed funnels showing no pages (caused by pages with template selected)
6
  Tags: landing pages, clickfunnels, funnels, sales funnel, optin, internet marketing
7
  Requires at least: 3.0
8
  Tested up to: 4.2
9
+ Stable tag: 1.0.6
10
 
11
  Connect your ClickFunnels pages to your Wordpress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
94
 
95
  Stay current with the latest version of the plugin:
96
 
97
+ = Version 1.0.6 =
98
+
99
+ * Auto save if page id = null (fixes some blank page issues)
100
+ * 404 No Page Found Error fixed to 200 OK
101
+
102
  = Version 1.0.5 =
103
 
104
  * Fixed funnels showing no pages (caused by pages with template selected)