ClickFunnels - Version 1.0.8

Version Description

Download this release

Release Info

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

Code changes from version 1.0.7 to 1.0.8

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