ClickFunnels - Version 1.0.7

Version Description

Download this release

Release Info

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

Code changes from version 1.0.6 to 1.0.7

Files changed (8) hide show
  1. access.php +1 -1
  2. admin.php +1 -1
  3. clickfunnels.php +36 -4
  4. footer.php +1 -1
  5. js/admin.js +1 -0
  6. js/hidedraft.js +3 -0
  7. readme.txt +14 -7
  8. support.php +1 -1
access.php CHANGED
@@ -195,7 +195,7 @@
195
  <p>To access your Authentication Token go to your ClickFunnels Members area and choose <a href="https://app.clickfunnels.com/users/edit" target="_blank">My Account > Settings</a> and you will find your API information.</p>
196
 
197
  <br><br><hr><br><br>
198
- <p>Change the website URL only if you have wordpress installed in a sub directory.</p>
199
  </div>
200
  <br clear="both">
201
  </div>
195
  <p>To access your Authentication Token go to your ClickFunnels Members area and choose <a href="https://app.clickfunnels.com/users/edit" target="_blank">My Account > Settings</a> and you will find your API information.</p>
196
 
197
  <br><br><hr><br><br>
198
+ <p>Change the website URL only if you have WordPress installed in a sub directory.</p>
199
  </div>
200
  <br clear="both">
201
  </div>
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.in_funnel == true ) {
33
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>" '+is_selected+'>'+ this.name +'</option>');
34
  }
35
 
36
 
37
  });
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.in_funnel == true ) {
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 +'</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
  <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
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
603
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
604
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
605
  $thepage = explode( "{#}", $cf_page );
606
  $savedData = $cf_page;
607
  }
608
  else {
609
  $thepage = explode( "{#}", $cf_page['page_id'] );
610
  $savedData = $cf_page['page_id'];
611
  }
612
  $cf_options = get_option( "cf_options" );
613
  jQuery(document).ready(function(){
614
  // Set Correct Options
615
  var thefunnel = jQuery('#cf_thefunnel').val();
616
  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" ); ?>';
617
  jQuery('#cf_thepage').find('option').remove().end();
618
  jQuery('#loading').fadeIn();
619
  jQuery.getJSON(specificFunnel, function(data) {
620
  setTimeout(function() {
621
  jQuery('#loading').fadeOut();
622
  }, 2000);
623
  var is_selected = "";
624
  jQuery.each(data.funnel_steps, function() {
625
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
626
  is_selected = "selected";
627
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
628
  } else {
629
  is_selected = "";
630
  }
631
 
632
  if ( this.wp_friendly == true && this.pages[0] != '' ) {
633
  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>');
634
  }
635
 
636
 
637
  });
638
  }).done(function() {
639
  jQuery('#loading').fadeOut();
640
  jQuery('#cf_thepage').trigger( "change" );
641
  })
642
  .fail(function() {
643
  jQuery('#loading').fadeOut();
644
  })
645
  .always(function() {
646
  jQuery('#loading').fadeOut();
647
  console.log( "ClickFunnels Rocks!" );
648
  });
649
  // Change Funnel Populate Dropdown
650
  jQuery( '#cf_thefunnel' ).change(function() {
651
  jQuery('#loading').fadeIn();
652
  var thefunnel = jQuery(this).val();
653
  var totalPages = 0;
654
  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" ); ?>';
655
  jQuery('#cf_thepage').find('option').remove().end();
656
  jQuery.getJSON(specificFunnel, function(data) {
657
  setTimeout(function() {
658
  jQuery('#loading').fadeOut();
659
  }, 2000);
660
  // alert( JSON.stringify(data.funnel_steps));
661
  jQuery.each(data.funnel_steps, function() {
662
  if( this.wp_friendly == true && this.pages[0] != '' ) {
663
  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>');
664
  totalPages += 1;
665
  }
666
  });
667
  }).done(function() {
668
  jQuery('#loading').fadeOut();
669
  })
670
  .fail(function() {
671
  jQuery('#loading').fadeOut();
672
  })
673
  .always(function() {
674
  jQuery('#loading').fadeOut();
675
  });
676
  setTimeout(function() {
677
  if (totalPages == 0) {
678
  jQuery('#noPageWarning').fadeIn();
679
  }
680
  else {
681
  jQuery('#noPageWarning').hide();
682
  }
683
  var theposition = jQuery('#cf_thepage').val();
684
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
685
  var myString = thefunnel+'{#}'+theposition;
686
  var arr = myString.split('{#}');
687
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
688
  var do_ping = function() {
689
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
690
 
691
  }).catch(function(error) {
692
 
693
  });
694
  };
695
  do_ping();
696
  }, 3000);
697
  });
698
  var request_image = function(url) {
699
  return new Promise(function(resolve, reject) {
700
  var img = new Image();
701
  img.onload = function() { resolve(img); };
702
  img.onerror = function() { reject(url); };
703
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
704
  });
705
  };
706
  /**
707
  * Pings a url.
708
  * @param {String} url
709
  * @return {Promise} promise that resolves to a ping (ms, float).
710
  */
711
  var ping = function(url) {
712
  return new Promise(function(resolve, reject) {
713
  var start = (new Date()).getTime();
714
  var response = function() {
715
  var delta = ((new Date()).getTime() - start);
716
 
717
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
718
  delta /= 4;
719
 
720
  resolve(delta);
721
  };
722
  request_image(url).then(response).catch(response);
723
 
724
  // Set a timeout for max-pings, 5s.
725
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
726
  });
727
  };
728
  // Select New Page
729
  jQuery( '#cf_thepage' ).change(function() {
730
  jQuery('#loading').fadeOut();
731
  var thefunnel = jQuery('#cf_thefunnel').val();
732
  var theposition = jQuery(this).val();
733
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
734
  var myString = thefunnel+'{#}'+theposition;
735
  var arr = myString.split('{#}');
736
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
737
  var do_ping = function() {
738
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
739
 
740
  }).catch(function(error) {
741
 
742
  });
743
  };
744
  do_ping();
745
  });
746
  // Fade Out Message
747
  setTimeout(function() {
748
  jQuery('#message').fadeOut();
749
  }, 3500);
750
  // Savings
751
  jQuery('#publish').click(function() {
752
  jQuery('#saving').fadeIn();
753
  });
754
  jQuery('#delete').on('click', function () {
755
  return confirm('Are you sure you want to delete this page?');
756
  });
757
  jQuery('#cf_slug').bind('keyup keypress blur', function()
758
  {
759
  var myStr = jQuery(this).val()
760
  myStr=myStr.toLowerCase();
761
  myStr=myStr.replace(/\s/g , "-");
762
  jQuery('#cf_slug').val(myStr);
763
  });
764
  // Check Null and Resave v1.0.6
765
  <?php if ($thepage[1] == 'null') { ?>
766
  jQuery('#autosaving').fadeIn();
767
  setTimeout(function() {
768
  jQuery('form').submit();
769
  }, 2000);
770
  <?php } ?>
771
  });
772
  display: none !important;
773
  }
774
  #side-sortables {
775
  display: none !important;
776
  }
777
  #clickfunnels_meta_box {
778
  width: 780px !important;
779
  border-radius: 5px;
780
  }
781
  .button:active, .button:hover, .button:focus {
782
  outline: none !important;
783
  box-shadow: none !important;
784
  }
785
  #message {
786
  width: 752px;
787
  margin-bottom: 0;
788
  }
789
  .apiHeader {
790
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
791
  border-bottom: 3px solid rgba(0,0,0,0.25);
792
  padding: 10px;
793
  padding-top: 15px;
794
  border-top-left-radius: 5px;
795
  border-top-right-radius: 5px;
796
  clear: both;
797
  }
798
  .apiHeader img {
799
  width: 200px;
800
  float: left;
801
  margin-left: 10px;
802
  }
803
  .apiHeader a {
804
  float: right;
805
  display: block;
806
  color: #fff;
807
  font-size: 13px;
808
  text-decoration: none;
809
  margin-right: 5px !important;
810
  background-color: rgba(0, 0, 0, .3);
811
  border: 2px solid #2b2e30;
812
  color: #afbbc8 !important;
813
  font-weight: 700;
814
  -webkit-border-radius: 4px;
815
  -moz-border-radius: 4px;
816
  border-radius: 4px;
817
  padding: 7px;
818
  padding-left: 12px;
819
  padding-right: 12px;
820
  margin-top: 0px !important;
821
  text-transform: uppercase;
822
  text-decoration: none;
823
  font-size: 14px;
824
  }
825
  .apiHeader a:hover {
826
  border: 2px solid #1D81C8;
827
  background-color: rgba(0, 0, 0, .6);
828
  color: #fff !important;
829
  }
830
  .apiSubHeader {
831
  background-color: #0166AE;
832
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
833
  border-bottom: 3px solid rgba(0,0,0,0.25);
834
  color: #fff;
835
  padding: 15px 18px;
836
  }
837
  .apiSubHeader h2 {
838
  margin: 0 !important;
839
  padding: 0 !important;
840
  color: #fff;
841
  font-weight: bold;
842
  font-size: 17px;
843
  text-shadow: 1px 1px 0 #0367AE;
844
  }
845
  .apiSubHeader a.editThisPage {
846
  float: right;
847
  padding: 5px 10px;
848
  color: #fff;
849
  text-shadow: 1px 1px 0 #0367AE;
850
  text-decoration: none;
851
  padding-top: 15px;
852
  margin-top: 6px;
853
  font-size: 14px;
854
  border: 2px solid #1D81C8;
855
  background-color: #054B7C;
856
  color: #fff !important;
857
  font-weight: 700;
858
  -webkit-border-radius: 4px;
859
  -moz-border-radius: 4px;
860
  border-radius: 4px;
861
  padding: 7px;
862
  padding-left: 12px;
863
  padding-right: 12px;
864
  text-transform: uppercase;
865
  text-decoration: none;
866
  font-size: 12px;
867
  }
868
  .apiSubHeader a.editThisPage i {
869
  margin-right: 4px;
870
  }
871
  .apiSubHeader a.editThisPage:hover {
872
  border: 2px solid #FFB700;
873
  text-shadow: 1px 1px 0 #222;
874
  background-color: rgba(0, 0, 0, .6);
875
  color: #fff !important;
876
  }
877
  .apiSubHeader a{
878
  text-shadow: 1px 1px 0 #0367AE;
879
  color: #fff;
880
  text-decoration: none;
881
  font-size: 12px;
882
  opacity: .8;
883
  }
884
  .apiSubHeader a:hover {
885
  opacity: 1;
886
  }
887
  .inside {
888
  padding: 0 !important;
889
  margin-top: 0 !important;
890
  border-radius: 5px !important;
891
  }
892
  .inside h2 {
893
  display: block !important;
894
  }
895
  #postbox-container-2 {
896
  margin-top: -20px !important;
897
  }
898
  body #poststuff .hndle.ui-sortable-handle {
899
  display: none !important;
900
  }
901
  body #poststuff .handlediv {
902
  display: none !important;
903
  }
904
  #loading {
905
  float: left;
906
  margin-left: 10px;
907
  display: none;
908
  margin-top: 6px;
909
  color: #999;
910
  }
911
  #apiFooter {
912
  background: #F1F1F1;
913
  padding: 20px 0;
914
  padding-bottom: 10px;
915
  }
916
  #apiFooter a:hover {
917
  text-decoration: none;
918
  }
919
  .bootstrap-wp {
920
  overflow: hidden;
921
  border: 10px solid #F1F1F1;
922
  }
923
  .deleteButton {
924
  padding: 5px;
925
  float: left;
926
  color: #777 !important;
927
  font-size: 13px;
928
  }
929
  body .cf_header .btn {
930
  font-size: 13px !important;
931
  padding: 8px 15px;
932
  }
933
  body .btn-selected {
934
  background-color: #0166AE !important;
935
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
936
  text-shadow: 1px 1px 0 #034E82 !important;
937
  font-family: Arial !important;
938
  color: #ffffff !important;
939
  border: solid #1f628d 1px !important;
940
  text-decoration: none !important;
941
  transition: none !important;
942
  }
943
  body label {
944
  font-size: 11px;
945
  opacity: .8;
946
  }
947
  body label i {
948
  padding-left: 10px;
949
  }
950
  .helpinfo {
951
  padding: 20px 40px;
952
  background: #fafafa;
953
  border-top: 1px solid #f2f2f2;
954
  margin: 0 0px;
955
  margin-top: -20px;
956
  margin-bottom: -20px;
957
  }
958
  .helpinfo h4 {
959
  color: #3B474F;
960
  font-size: 15px;
961
  font-weight: 700;
962
  padding-bottom: 10px;
963
  padding-top: 5px;
964
  }
965
  .helpinfo p {
966
  color: #888;
967
  font-weight: 300;
968
  font-size: 12px;
969
  line-height: 19px;
970
  letter-spacing: 1px;
971
  padding-bottom: 0;
972
  }
973
  .helpinfo h4 i {
974
  margin-right: 4px;
975
  }
976
  #message {
977
  width: 758px;
978
  padding: 10px 10px;
979
  display: block;
980
  z-index: 99999;
981
  position: relative;
982
  color: #fff;
983
  border: 1px solid #024D82;
984
  border-bottom: 2px solid #024D82;
985
  text-shadow: 1px 1px 0 #024D82;
986
  padding: 0 10px;
987
  font-size: 16px;
988
  margin-bottom: 0;
989
  border-radius: 5px;
990
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
991
  }
992
  .noAPI {
993
  padding: 10px;
994
  border-bottom: 2px solid #c93f2b;
995
  background: #E64D37;
996
  }
997
  .noAPI h4 {
998
  margin: 0;
999
  padding: 0;
1000
  color: #fff;
1001
  }
1002
  .noAPI h4 a {
1003
  color: #fff;
1004
  font-weight: normal;
1005
  }
1006
  .input-xlarge {
1007
 
1008
  }
1009
  .control-group {
1010
  padding-left: 25px
1011
  }
1012
  #autosaving {
1013
  display: none;
1014
  width: 780px;
1015
  height: 310px;
1016
  position: absolute;
1017
  z-index: 2222;
1018
  top: 145px;
1019
  color: #fff;
1020
  left: 0;
1021
  padding-top: 160px;
1022
  text-align: center;
1023
  border-bottom-right-radius: 5px;
1024
  border-bottom-left-radius: 5px;
1025
  background: rgba(0, 0, 0, .8);
1026
  }
1027
  #autosaving h2 {
1028
  color: #fff;
1029
  font-weight: 600;
1030
  text-shadow: 0 0 2p
1031
  x #000;
1032
  margin-top: 0;
1033
  }
1034
  #autosaving h4 {
1035
  color: #fff;
1036
  font-size: 13px;
1037
  letter-spacing: 1px;
1038
  font-weight: 300;
1039
  margin-bottom: 5px;
1040
  text-shadow: 0 0 2px #000;
1041
  }
1042
  #autosaving h1 {
1043
  color: #fff;
1044
  margin-top: 0;
1045
  font-size: 58px;
1046
  font-weight: 800;
1047
  text-shadow: 0 0 2px #000;
1048
  }
1049
  if ( $cf_page != "" ) {
1050
  $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' ) );
1051
  $cf_funnels_pages = json_decode( $json );
1052
  }
1053
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
1054
  <h2>Saving and Reloading...</h2>
1055
  <h1><i class="fa fa-cog fa-spin"></i></h1>
1056
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
1057
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
1058
  <br clear="all">
1059
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1060
  <?php if ( $cf_type=='p' ) {?>
1061
  <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>
1062
  <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>
1063
  <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>
1064
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
1065
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
1066
  <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>
1067
  <?php }?>
1068
  <?php if ( $cf_type=='hp' ) {?>
1069
  <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>
1070
  <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>
1071
  <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>
1072
  <h2>Set as Home Page</h2>
1073
  <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>
1074
  <?php }?>
1075
  <?php if ( $cf_type=='np' ) {?>
1076
  <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>
1077
  <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>
1078
  <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>
1079
  <h2>Set as 404 Page</h2>
1080
  <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>
1081
  <?php }?>
1082
  <?php if ( $cf_type=='' ) {?>
1083
  <h2>Page Undefined - Create New Page</h2>
1084
  <?php }?>
1085
  <?php } else { ?>
1086
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
1087
  <?php } ?>
1088
  <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>
1089
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1090
  <div class="row-fluid form-horizontal">
1091
  <br>
1092
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
1093
  <div data-target="cf_type" class="btn-group multichoice cf_header">
1094
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
1095
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
1096
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
1097
  </div>
1098
  <input type="hidden" id="cf_type" name="cf_type"/>
1099
  </div>
1100
  <br>
1101
  <div class="control-group">
1102
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1103
  <div class="controls">
1104
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1105
  <?php if ( empty( $cf_funnels ) ) { ?>
1106
  <option value="0">No Funnels Found</option>
1107
  <?php }
1108
  else {
1109
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1110
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1111
  <?php
1112
  }
1113
  } ?>
1114
  </select>
1115
  </div>
1116
  </div>
1117
  <div class="control-group">
1118
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1119
  <div class="controls">
1120
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1121
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1122
  <option value="0">No Pages Found</option>
1123
  <?php }
1124
  else {
1125
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1126
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1127
  <?php
1128
  }
1129
  }
1130
  ?>
1131
  </select>
1132
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1133
  </div>
1134
  <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>
1135
  </div>
1136
  <div class="control-group" id="hiddenStuff" style="display: none">
1137
  <div class="controls">
1138
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1139
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1140
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1141
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1142
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1143
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1144
  <strong>Page Name: <span style="font-weight: normal"><?php echo $thepage[6]; ?></span><br></strong>
1145
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1146
  </div>
1147
  </div>
1148
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1149
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1150
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1151
  <div id="cf-wp-path" class="controls ">
1152
  <div class="input-prepend">
1153
  <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">
1154
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1155
  </div>
1156
  </div>
1157
  </div>
1158
  <br><br>
1159
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1160
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1161
  <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>
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
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1165
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1166
  <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>
1167
  <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>
1168
  </div>
1169
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1170
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1171
  <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>
1172
  <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>
1173
  </div>
1174
  <br>
1175
  <div class="row-fluid" id="apiFooter">
1176
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1177
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1178
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1179
  </button>
1180
  <?php } else { ?>
1181
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
1182
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1183
  </button>
1184
  <?php } ?>
1185
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1186
  <i class="fa fa-spinner fa-spin"></i>
1187
  <span>Saving...</span>
1188
  </div>
1189
  <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>
1190
  <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>
1191
  <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>
1192
  <?php if ( !empty( $delete_link ) ) {?>
1193
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1194
  <?php }?>
1195
  </div>
1196
  </div>
1197
  </div>
1198
  (function($) {
1199
  setTimeout(function() {
1200
  $('#cf_thepage').trigger( "change" );
1201
  }, 1500);
1202
  })(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.in_funnel == true ) {
32
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>" '+is_selected+'>'+ this.name +'</option>');
33
  }
34
 
35
 
36
  });
37
  }).done(function() {
38
  jQuery('#loading').fadeOut();
39
  jQuery('#cf_thepage').trigger( "change" );
40
  })
41
  .fail(function() {
42
  jQuery('#loading').fadeOut();
43
  })
44
  .always(function() {
45
  jQuery('#loading').fadeOut();
46
  console.log( "ClickFunnels Rocks!" );
47
  });
48
  // Change Funnel Populate Dropdown
49
  jQuery( '#cf_thefunnel' ).change(function() {
50
  jQuery('#loading').fadeIn();
51
  var thefunnel = jQuery(this).val();
52
  var totalPages = 0;
53
  var specificFunnel = 'https://api.clickfunnels.com/funnels/'+thefunnel+'.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
54
  jQuery('#cf_thepage').find('option').remove().end();
55
  jQuery.getJSON(specificFunnel, function(data) {
56
  setTimeout(function() {
57
  jQuery('#loading').fadeOut();
58
  }, 2000);
59
  // alert( JSON.stringify(data.funnel_steps));
60
  jQuery.each(data.funnel_steps, function() {
61
  if( this.wp_friendly == true && this.in_funnel == true ) {
62
  jQuery('#cf_thepage').append('<option value="' + this.pages[0].key + '{#}' + this.pages[0].id + '{#}' + this.pages[0].funnel_step_id + '{#}' + encodeURI(this.pages[0].metatags) + '{#}<?php echo get_the_ID(); ?>">'+ this.name +'</option>');
63
  totalPages += 1;
64
  }
65
  });
66
  }).done(function() {
67
  jQuery('#loading').fadeOut();
68
  })
69
  .fail(function() {
70
  jQuery('#loading').fadeOut();
71
  })
72
  .always(function() {
73
  jQuery('#loading').fadeOut();
74
  });
75
  setTimeout(function() {
76
  if (totalPages == 0) {
77
  jQuery('#noPageWarning').fadeIn();
78
  }
79
  else {
80
  jQuery('#noPageWarning').hide();
81
  }
82
  var theposition = jQuery('#cf_thepage').val();
83
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
84
  var myString = thefunnel+'{#}'+theposition;
85
  var arr = myString.split('{#}');
86
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
87
  var do_ping = function() {
88
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
89
 
90
  }).catch(function(error) {
91
 
92
  });
93
  };
94
  do_ping();
95
  }, 3000);
96
  });
97
  var request_image = function(url) {
98
  return new Promise(function(resolve, reject) {
99
  var img = new Image();
100
  img.onload = function() { resolve(img); };
101
  img.onerror = function() { reject(url); };
102
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
103
  });
104
  };
105
  /**
106
  * Pings a url.
107
  * @param {String} url
108
  * @return {Promise} promise that resolves to a ping (ms, float).
109
  */
110
  var ping = function(url) {
111
  return new Promise(function(resolve, reject) {
112
  var start = (new Date()).getTime();
113
  var response = function() {
114
  var delta = ((new Date()).getTime() - start);
115
 
116
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
117
  delta /= 4;
118
 
119
  resolve(delta);
120
  };
121
  request_image(url).then(response).catch(response);
122
 
123
  // Set a timeout for max-pings, 5s.
124
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
125
  });
126
  };
127
  // Select New Page
128
  jQuery( '#cf_thepage' ).change(function() {
129
  jQuery('#loading').fadeOut();
130
  var thefunnel = jQuery('#cf_thefunnel').val();
131
  var theposition = jQuery(this).val();
132
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
133
  var myString = thefunnel+'{#}'+theposition;
134
  var arr = myString.split('{#}');
135
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
136
  var do_ping = function() {
137
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
138
 
139
  }).catch(function(error) {
140
 
141
  });
142
  };
143
  do_ping();
144
  });
145
  // Fade Out Message
146
  setTimeout(function() {
147
  jQuery('#message').fadeOut();
148
  }, 3500);
149
  // Savings
150
  jQuery('#publish').click(function() {
151
  jQuery('#saving').fadeIn();
152
  });
153
  jQuery('#delete').on('click', function () {
154
  return confirm('Are you sure you want to delete this page?');
155
  });
156
  jQuery('#cf_slug').bind('keyup keypress blur', function()
157
  {
158
  var myStr = jQuery(this).val()
159
  myStr=myStr.toLowerCase();
160
  myStr=myStr.replace(/\s/g , "-");
161
  jQuery('#cf_slug').val(myStr);
162
  });
163
  // 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
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
544
  </div>
545
  </div>
546
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
547
  <div class="cf_url control-group" style="<?php echo $display;?>" >
548
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
549
  <div id="cf-wp-path" class="controls ">
550
  <div class="input-prepend">
551
  <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">
552
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
553
  </div>
554
  </div>
555
  </div>
556
  <br><br>
557
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
558
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
559
  <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>
560
  <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>
561
  </div>
562
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
563
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
564
  <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>
565
  <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>
566
  </div>
567
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
568
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
569
  <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>
570
  <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>
571
  </div>
572
  <br>
573
  <div class="row-fluid" id="apiFooter">
574
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
575
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
576
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
577
  </button>
578
  <?php } else { ?>
579
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
580
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
581
  </button>
582
  <?php } ?>
583
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
584
  <i class="fa fa-spinner fa-spin"></i>
585
  <span>Saving...</span>
586
  </div>
587
  <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>
588
  <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>
589
  <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>
590
  <?php if ( !empty( $delete_link ) ) {?>
591
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
592
  <?php }?>
593
  </div>
594
  </div>
595
  </div>
596
  (function($) {
597
  setTimeout(function() {
598
  $('#cf_thepage').trigger( "change" );
599
  }, 1500);
600
  })(jQuery);
601
+ <?php
602
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
603
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
604
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
605
  $thepage = explode( "{#}", $cf_page );
606
  $savedData = $cf_page;
607
  }
608
  else {
609
  $thepage = explode( "{#}", $cf_page['page_id'] );
610
  $savedData = $cf_page['page_id'];
611
  }
612
  $cf_options = get_option( "cf_options" );
613
  jQuery(document).ready(function(){
614
  // Set Correct Options
615
  var thefunnel = jQuery('#cf_thefunnel').val();
616
  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" ); ?>';
617
  jQuery('#cf_thepage').find('option').remove().end();
618
  jQuery('#loading').fadeIn();
619
  jQuery.getJSON(specificFunnel, function(data) {
620
  setTimeout(function() {
621
  jQuery('#loading').fadeOut();
622
  }, 2000);
623
  var is_selected = "";
624
  jQuery.each(data.funnel_steps, function() {
625
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
626
  is_selected = "selected";
627
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
628
  } else {
629
  is_selected = "";
630
  }
631
 
632
  if ( this.wp_friendly == true && this.pages[0] != '' ) {
633
  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>');
634
  }
635
 
636
 
637
  });
638
  }).done(function() {
639
  jQuery('#loading').fadeOut();
640
  jQuery('#cf_thepage').trigger( "change" );
641
  })
642
  .fail(function() {
643
  jQuery('#loading').fadeOut();
644
  })
645
  .always(function() {
646
  jQuery('#loading').fadeOut();
647
  console.log( "ClickFunnels Rocks!" );
648
  });
649
  // Change Funnel Populate Dropdown
650
  jQuery( '#cf_thefunnel' ).change(function() {
651
  jQuery('#loading').fadeIn();
652
  var thefunnel = jQuery(this).val();
653
  var totalPages = 0;
654
  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" ); ?>';
655
  jQuery('#cf_thepage').find('option').remove().end();
656
  jQuery.getJSON(specificFunnel, function(data) {
657
  setTimeout(function() {
658
  jQuery('#loading').fadeOut();
659
  }, 2000);
660
  // alert( JSON.stringify(data.funnel_steps));
661
  jQuery.each(data.funnel_steps, function() {
662
  if( this.wp_friendly == true && this.pages[0] != '' ) {
663
  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>');
664
  totalPages += 1;
665
  }
666
  });
667
  }).done(function() {
668
  jQuery('#loading').fadeOut();
669
  })
670
  .fail(function() {
671
  jQuery('#loading').fadeOut();
672
  })
673
  .always(function() {
674
  jQuery('#loading').fadeOut();
675
  });
676
  setTimeout(function() {
677
  if (totalPages == 0) {
678
  jQuery('#noPageWarning').fadeIn();
679
  }
680
  else {
681
  jQuery('#noPageWarning').hide();
682
  }
683
  var theposition = jQuery('#cf_thepage').val();
684
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
685
  var myString = thefunnel+'{#}'+theposition;
686
  var arr = myString.split('{#}');
687
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
688
  var do_ping = function() {
689
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
690
 
691
  }).catch(function(error) {
692
 
693
  });
694
  };
695
  do_ping();
696
  }, 3000);
697
  });
698
  var request_image = function(url) {
699
  return new Promise(function(resolve, reject) {
700
  var img = new Image();
701
  img.onload = function() { resolve(img); };
702
  img.onerror = function() { reject(url); };
703
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
704
  });
705
  };
706
  /**
707
  * Pings a url.
708
  * @param {String} url
709
  * @return {Promise} promise that resolves to a ping (ms, float).
710
  */
711
  var ping = function(url) {
712
  return new Promise(function(resolve, reject) {
713
  var start = (new Date()).getTime();
714
  var response = function() {
715
  var delta = ((new Date()).getTime() - start);
716
 
717
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
718
  delta /= 4;
719
 
720
  resolve(delta);
721
  };
722
  request_image(url).then(response).catch(response);
723
 
724
  // Set a timeout for max-pings, 5s.
725
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
726
  });
727
  };
728
  // Select New Page
729
  jQuery( '#cf_thepage' ).change(function() {
730
  jQuery('#loading').fadeOut();
731
  var thefunnel = jQuery('#cf_thefunnel').val();
732
  var theposition = jQuery(this).val();
733
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
734
  var myString = thefunnel+'{#}'+theposition;
735
  var arr = myString.split('{#}');
736
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
737
  var do_ping = function() {
738
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
739
 
740
  }).catch(function(error) {
741
 
742
  });
743
  };
744
  do_ping();
745
  });
746
  // Fade Out Message
747
  setTimeout(function() {
748
  jQuery('#message').fadeOut();
749
  }, 3500);
750
  // Savings
751
  jQuery('#publish').click(function() {
752
  jQuery('#saving').fadeIn();
753
  });
754
  jQuery('#delete').on('click', function () {
755
  return confirm('Are you sure you want to delete this page?');
756
  });
757
  jQuery('#cf_slug').bind('keyup keypress blur', function()
758
  {
759
  var myStr = jQuery(this).val()
760
  myStr=myStr.toLowerCase();
761
  myStr=myStr.replace(/\s/g , "-");
762
  jQuery('#cf_slug').val(myStr);
763
  });
764
  // Check Null and Resave v1.0.6
765
  <?php if ($thepage[1] == 'null') { ?>
766
  jQuery('#autosaving').fadeIn();
767
  setTimeout(function() {
768
  jQuery('form').submit();
769
  }, 2000);
770
  <?php } ?>
771
  });
772
  display: none !important;
773
  }
774
  #side-sortables {
775
  display: none !important;
776
  }
777
  #clickfunnels_meta_box {
778
  width: 780px !important;
779
  border-radius: 5px;
780
  }
781
  .button:active, .button:hover, .button:focus {
782
  outline: none !important;
783
  box-shadow: none !important;
784
  }
785
  #message {
786
  width: 752px;
787
  margin-bottom: 0;
788
  }
789
  .apiHeader {
790
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
791
  border-bottom: 3px solid rgba(0,0,0,0.25);
792
  padding: 10px;
793
  padding-top: 15px;
794
  border-top-left-radius: 5px;
795
  border-top-right-radius: 5px;
796
  clear: both;
797
  }
798
  .apiHeader img {
799
  width: 200px;
800
  float: left;
801
  margin-left: 10px;
802
  }
803
  .apiHeader a {
804
  float: right;
805
  display: block;
806
  color: #fff;
807
  font-size: 13px;
808
  text-decoration: none;
809
  margin-right: 5px !important;
810
  background-color: rgba(0, 0, 0, .3);
811
  border: 2px solid #2b2e30;
812
  color: #afbbc8 !important;
813
  font-weight: 700;
814
  -webkit-border-radius: 4px;
815
  -moz-border-radius: 4px;
816
  border-radius: 4px;
817
  padding: 7px;
818
  padding-left: 12px;
819
  padding-right: 12px;
820
  margin-top: 0px !important;
821
  text-transform: uppercase;
822
  text-decoration: none;
823
  font-size: 14px;
824
  }
825
  .apiHeader a:hover {
826
  border: 2px solid #1D81C8;
827
  background-color: rgba(0, 0, 0, .6);
828
  color: #fff !important;
829
  }
830
  .apiSubHeader {
831
  background-color: #0166AE;
832
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
833
  border-bottom: 3px solid rgba(0,0,0,0.25);
834
  color: #fff;
835
  padding: 15px 18px;
836
  }
837
  .apiSubHeader h2 {
838
  margin: 0 !important;
839
  padding: 0 !important;
840
  color: #fff;
841
  font-weight: bold;
842
  font-size: 17px;
843
  text-shadow: 1px 1px 0 #0367AE;
844
  }
845
  .apiSubHeader a.editThisPage {
846
  float: right;
847
  padding: 5px 10px;
848
  color: #fff;
849
  text-shadow: 1px 1px 0 #0367AE;
850
  text-decoration: none;
851
  padding-top: 15px;
852
  margin-top: 6px;
853
  font-size: 14px;
854
  border: 2px solid #1D81C8;
855
  background-color: #054B7C;
856
  color: #fff !important;
857
  font-weight: 700;
858
  -webkit-border-radius: 4px;
859
  -moz-border-radius: 4px;
860
  border-radius: 4px;
861
  padding: 7px;
862
  padding-left: 12px;
863
  padding-right: 12px;
864
  text-transform: uppercase;
865
  text-decoration: none;
866
  font-size: 12px;
867
  }
868
  .apiSubHeader a.editThisPage i {
869
  margin-right: 4px;
870
  }
871
  .apiSubHeader a.editThisPage:hover {
872
  border: 2px solid #FFB700;
873
  text-shadow: 1px 1px 0 #222;
874
  background-color: rgba(0, 0, 0, .6);
875
  color: #fff !important;
876
  }
877
  .apiSubHeader a{
878
  text-shadow: 1px 1px 0 #0367AE;
879
  color: #fff;
880
  text-decoration: none;
881
  font-size: 12px;
882
  opacity: .8;
883
  }
884
  .apiSubHeader a:hover {
885
  opacity: 1;
886
  }
887
  .inside {
888
  padding: 0 !important;
889
  margin-top: 0 !important;
890
  border-radius: 5px !important;
891
  }
892
  .inside h2 {
893
  display: block !important;
894
  }
895
  #postbox-container-2 {
896
  margin-top: -20px !important;
897
  }
898
  body #poststuff .hndle.ui-sortable-handle {
899
  display: none !important;
900
  }
901
  body #poststuff .handlediv {
902
  display: none !important;
903
  }
904
  #loading {
905
  float: left;
906
  margin-left: 10px;
907
  display: none;
908
  margin-top: 6px;
909
  color: #999;
910
  }
911
  #apiFooter {
912
  background: #F1F1F1;
913
  padding: 20px 0;
914
  padding-bottom: 10px;
915
  }
916
  #apiFooter a:hover {
917
  text-decoration: none;
918
  }
919
  .bootstrap-wp {
920
  overflow: hidden;
921
  border: 10px solid #F1F1F1;
922
  }
923
  .deleteButton {
924
  padding: 5px;
925
  float: left;
926
  color: #777 !important;
927
  font-size: 13px;
928
  }
929
  body .cf_header .btn {
930
  font-size: 13px !important;
931
  padding: 8px 15px;
932
  }
933
  body .btn-selected {
934
  background-color: #0166AE !important;
935
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
936
  text-shadow: 1px 1px 0 #034E82 !important;
937
  font-family: Arial !important;
938
  color: #ffffff !important;
939
  border: solid #1f628d 1px !important;
940
  text-decoration: none !important;
941
  transition: none !important;
942
  }
943
  body label {
944
  font-size: 11px;
945
  opacity: .8;
946
  }
947
  body label i {
948
  padding-left: 10px;
949
  }
950
  .helpinfo {
951
  padding: 20px 40px;
952
  background: #fafafa;
953
  border-top: 1px solid #f2f2f2;
954
  margin: 0 0px;
955
  margin-top: -20px;
956
  margin-bottom: -20px;
957
  }
958
  .helpinfo h4 {
959
  color: #3B474F;
960
  font-size: 15px;
961
  font-weight: 700;
962
  padding-bottom: 10px;
963
  padding-top: 5px;
964
  }
965
  .helpinfo p {
966
  color: #888;
967
  font-weight: 300;
968
  font-size: 12px;
969
  line-height: 19px;
970
  letter-spacing: 1px;
971
  padding-bottom: 0;
972
  }
973
  .helpinfo h4 i {
974
  margin-right: 4px;
975
  }
976
  #message {
977
  width: 758px;
978
  padding: 10px 10px;
979
  display: block;
980
  z-index: 99999;
981
  position: relative;
982
  color: #fff;
983
  border: 1px solid #024D82;
984
  border-bottom: 2px solid #024D82;
985
  text-shadow: 1px 1px 0 #024D82;
986
  padding: 0 10px;
987
  font-size: 16px;
988
  margin-bottom: 0;
989
  border-radius: 5px;
990
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
991
  }
992
  .noAPI {
993
  padding: 10px;
994
  border-bottom: 2px solid #c93f2b;
995
  background: #E64D37;
996
  }
997
  .noAPI h4 {
998
  margin: 0;
999
  padding: 0;
1000
  color: #fff;
1001
  }
1002
  .noAPI h4 a {
1003
  color: #fff;
1004
  font-weight: normal;
1005
  }
1006
  .input-xlarge {
1007
 
1008
  }
1009
  .control-group {
1010
  padding-left: 25px
1011
  }
1012
  #autosaving {
1013
  display: none;
1014
  width: 780px;
1015
  height: 310px;
1016
  position: absolute;
1017
  z-index: 2222;
1018
  top: 145px;
1019
  color: #fff;
1020
  left: 0;
1021
  padding-top: 160px;
1022
  text-align: center;
1023
  border-bottom-right-radius: 5px;
1024
  border-bottom-left-radius: 5px;
1025
  background: rgba(0, 0, 0, .8);
1026
  }
1027
  #autosaving h2 {
1028
  color: #fff;
1029
  font-weight: 600;
1030
  text-shadow: 0 0 2p
1031
  x #000;
1032
  margin-top: 0;
1033
  }
1034
  #autosaving h4 {
1035
  color: #fff;
1036
  font-size: 13px;
1037
  letter-spacing: 1px;
1038
  font-weight: 300;
1039
  margin-bottom: 5px;
1040
  text-shadow: 0 0 2px #000;
1041
  }
1042
  #autosaving h1 {
1043
  color: #fff;
1044
  margin-top: 0;
1045
  font-size: 58px;
1046
  font-weight: 800;
1047
  text-shadow: 0 0 2px #000;
1048
  }
1049
  if ( $cf_page != "" ) {
1050
  $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' ) );
1051
  $cf_funnels_pages = json_decode( $json );
1052
  }
1053
  <h4><i class="fa fa-times"></i> Uh oh, your page did not save correctly.</h4>
1054
  <h2>Saving and Reloading...</h2>
1055
  <h1><i class="fa fa-cog fa-spin"></i></h1>
1056
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
1057
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
1058
  <br clear="all">
1059
  <?php if ( !empty( $_GET['action'] ) ) { ?>
1060
  <?php if ( $cf_type=='p' ) {?>
1061
  <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>
1062
  <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>
1063
  <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>
1064
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
1065
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
1066
  <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>
1067
  <?php }?>
1068
  <?php if ( $cf_type=='hp' ) {?>
1069
  <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>
1070
  <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>
1071
  <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>
1072
  <h2>Set as Home Page</h2>
1073
  <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>
1074
  <?php }?>
1075
  <?php if ( $cf_type=='np' ) {?>
1076
  <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>
1077
  <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>
1078
  <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>
1079
  <h2>Set as 404 Page</h2>
1080
  <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>
1081
  <?php }?>
1082
  <?php if ( $cf_type=='' ) {?>
1083
  <h2>Page Undefined - Create New Page</h2>
1084
  <?php }?>
1085
  <?php } else { ?>
1086
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
1087
  <?php } ?>
1088
  <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>
1089
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
1090
  <div class="row-fluid form-horizontal">
1091
  <br>
1092
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
1093
  <div data-target="cf_type" class="btn-group multichoice cf_header">
1094
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
1095
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
1096
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
1097
  </div>
1098
  <input type="hidden" id="cf_type" name="cf_type"/>
1099
  </div>
1100
  <br>
1101
  <div class="control-group">
1102
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1103
  <div class="controls">
1104
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1105
  <?php if ( empty( $cf_funnels ) ) { ?>
1106
  <option value="0">No Funnels Found</option>
1107
  <?php }
1108
  else {
1109
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1110
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1111
  <?php
1112
  }
1113
  } ?>
1114
  </select>
1115
  </div>
1116
  </div>
1117
  <div class="control-group">
1118
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1119
  <div class="controls">
1120
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1121
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1122
  <option value="0">No Pages Found</option>
1123
  <?php }
1124
  else {
1125
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1126
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1127
  <?php
1128
  }
1129
  }
1130
  ?>
1131
  </select>
1132
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1133
  </div>
1134
  <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>
1135
  </div>
1136
  <div class="control-group" id="hiddenStuff" style="display: none">
1137
  <div class="controls">
1138
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1139
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1140
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1141
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1142
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1143
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1144
  <strong>Page Name: <span style="font-weight: normal"><?php echo $thepage[6]; ?></span><br></strong>
1145
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1146
  </div>
1147
  </div>
1148
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1149
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1150
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1151
  <div id="cf-wp-path" class="controls ">
1152
  <div class="input-prepend">
1153
  <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">
1154
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1155
  </div>
1156
  </div>
1157
  </div>
1158
  <br><br>
1159
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1160
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1161
  <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>
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
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1165
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1166
  <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>
1167
  <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>
1168
  </div>
1169
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1170
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1171
  <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>
1172
  <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>
1173
  </div>
1174
  <br>
1175
  <div class="row-fluid" id="apiFooter">
1176
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1177
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1178
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1179
  </button>
1180
  <?php } else { ?>
1181
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
1182
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1183
  </button>
1184
  <?php } ?>
1185
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1186
  <i class="fa fa-spinner fa-spin"></i>
1187
  <span>Saving...</span>
1188
  </div>
1189
  <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>
1190
  <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>
1191
  <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>
1192
  <?php if ( !empty( $delete_link ) ) {?>
1193
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1194
  <?php }?>
1195
  </div>
1196
  </div>
1197
  </div>
1198
  (function($) {
1199
  setTimeout(function() {
1200
  $('#cf_thepage').trigger( "change" );
1201
  }, 1500);
1202
  })(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.6
7
  * Author: Etison, LLC
8
  * Author URI: http://clickfunnels.com
9
  */
@@ -97,6 +97,7 @@ class ClickFunnels {
97
  $id = get_the_ID();
98
  $cf_type = get_post_meta( $id, 'cf_type', true );
99
  $cf_slug= get_post_meta( $id, 'cf_slug', true );
 
100
  $cf_thefunnel= get_post_meta( $id, 'cf_thefunnel', true );
101
  if ( $cf_type =="hp" && !$this->is_home( $id ) ) {
102
  $cf_type = "notype";
@@ -113,6 +114,15 @@ class ClickFunnels {
113
  echo '<strong><a href="' . $url .'">' . $this->get_funnel_name( $funnel_id ) . '</a></strong>' ;
114
  }
115
  }
 
 
 
 
 
 
 
 
 
116
  switch ( $cf_type ) {
117
  case "p":
118
  $post_type = "Page";
@@ -135,7 +145,7 @@ class ClickFunnels {
135
  }
136
  if ( 'cf_path' == $column ) {
137
  if ( !empty( $url ) ) {
138
- echo " <a href='$url' target='_blank'>$url</a>";
139
  }
140
  }
141
  }
@@ -266,8 +276,11 @@ class ClickFunnels {
266
  $new_columns = array();
267
  $new_columns['cb'] = $columns['cb'];
268
  $new_columns['cf_post_name'] = "Funnel";
 
 
 
 
269
  $new_columns['cf_type'] = 'Type';
270
- $new_columns['cf_path'] = 'URL';
271
  $new_columns['date'] = $columns['date'];
272
  return $new_columns;
273
  }
@@ -384,8 +397,14 @@ class ClickFunnels {
384
  'search_items' => __( 'Search Click Funnels' ),
385
  'not_found' => __( 'Nothing found' ),
386
  'not_found_in_trash' => __( 'Nothing found in Trash' ),
387
- 'parent_item_colon' => ''
 
 
 
 
 
388
  );
 
389
  register_post_type( 'clickfunnels',
390
  array(
391
  'labels' => $labels,
@@ -394,12 +413,25 @@ class ClickFunnels {
394
  'has_archive' => true,
395
  'supports' => array( '' ),
396
  'rewrite' => array( 'slug' => 'clickfunnels' ),
 
397
  'register_meta_box_cb' => array( $this, "remove_save_box" )
 
398
  )
399
  );
400
  }
401
  }
402
  add_action( 'admin_menu', 'cf_plugin_submenu' );
 
 
 
 
 
 
 
 
 
 
 
403
  function cf_plugin_submenu() {
404
  add_submenu_page( 'edit.php?post_type=clickfunnels', __( 'Settings', 'menu-test' ), __( 'Settings', 'menu-test' ), 'manage_options', 'cf_api', 'cf_api_settings_page' );
405
  add_submenu_page( 'edit.php?post_type=clickfunnels', __( 'How to Use ClickFunnels Plugin', 'menu-test' ), __( 'Support', 'menu-test' ), 'manage_options', 'clickfunnels_support', 'support_clickfunnels' );
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
  */
97
  $id = get_the_ID();
98
  $cf_type = get_post_meta( $id, 'cf_type', true );
99
  $cf_slug= get_post_meta( $id, 'cf_slug', true );
100
+ $cf_thepage= get_post_meta( $id, 'cf_thepage', true );
101
  $cf_thefunnel= get_post_meta( $id, 'cf_thefunnel', true );
102
  if ( $cf_type =="hp" && !$this->is_home( $id ) ) {
103
  $cf_type = "notype";
114
  echo '<strong><a href="' . $url .'">' . $this->get_funnel_name( $funnel_id ) . '</a></strong>' ;
115
  }
116
  }
117
+ if ( 'cf_thepage' == $column ) {
118
+ $pagename = explode("{#}", $cf_thepage);
119
+ echo $pagename[5];
120
+ }
121
+ if ( 'cf_openinEditor' == $column ) {
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";
145
  }
146
  if ( 'cf_path' == $column ) {
147
  if ( !empty( $url ) ) {
148
+ echo " <a href='$url' target='_blank'>View Page</a>";
149
  }
150
  }
151
  }
276
  $new_columns = array();
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';
 
284
  $new_columns['date'] = $columns['date'];
285
  return $new_columns;
286
  }
397
  'search_items' => __( 'Search Click Funnels' ),
398
  'not_found' => __( 'Nothing found' ),
399
  'not_found_in_trash' => __( 'Nothing found in Trash' ),
400
+ 'parent_item_colon' => '',
401
+ 'hide_post_row_actions' => array(
402
+ 'trash'
403
+ ,'edit'
404
+ ,'quick-edit'
405
+ )
406
  );
407
+
408
  register_post_type( 'clickfunnels',
409
  array(
410
  'labels' => $labels,
413
  'has_archive' => true,
414
  'supports' => array( '' ),
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
  }
422
  }
423
  add_action( 'admin_menu', 'cf_plugin_submenu' );
424
+ function wpc_add_admin_cpt_script( $hook ) {
425
+
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
+ }
433
+ }
434
+ add_action( 'admin_enqueue_scripts', 'wpc_add_admin_cpt_script', 10, 1 );
435
  function cf_plugin_submenu() {
436
  add_submenu_page( 'edit.php?post_type=clickfunnels', __( 'Settings', 'menu-test' ), __( 'Settings', 'menu-test' ), 'manage_options', 'cf_api', 'cf_api_settings_page' );
437
  add_submenu_page( 'edit.php?post_type=clickfunnels', __( 'How to Use ClickFunnels Plugin', 'menu-test' ), __( 'Support', 'menu-test' ), 'manage_options', 'clickfunnels_support', 'support_clickfunnels' );
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.6</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
1
  <div class="copyrightInfo">
2
+ <p><strong style="float: right;margin-right: 20px;font-weight: 200">Running version 1.0.7</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
js/admin.js CHANGED
@@ -1,4 +1,5 @@
1
  jQuery(document).ready(function(){
 
2
  jQuery("#cf_type").val(jQuery(".btn.active").data("value"));
3
  jQuery(".cf_header .btn").click(function(){
4
  jQuery(".cf_header .btn").removeClass().addClass('btn');
1
  jQuery(document).ready(function(){
2
+ jQuery('.draft').hide();
3
  jQuery("#cf_type").val(jQuery(".btn.active").data("value"));
4
  jQuery(".cf_header .btn").click(function(){
5
  jQuery(".cf_header .btn").removeClass().addClass('btn');
js/hidedraft.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ jQuery(document).ready(function(){
2
+ jQuery('.draft').hide();
3
+ });
readme.txt CHANGED
@@ -6,14 +6,14 @@ 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.6
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
 
@@ -28,7 +28,7 @@ Want to show an order page of one of your Webinar funnels? Easy, just select the
28
 
29
  Example: "http://yourblog.com/ordernow" can be connected to your order page from any funnel within your ClickFunnels account.
30
 
31
- **Don't have a ClickFunnels account?** You can sign up now to transform the way you run your business online. The Wordpress plugin is free to all members.
32
 
33
  **Need more help?** Check out the installation, FAQ and screenshots for more information or check out the Support Desk.
34
 
@@ -38,7 +38,7 @@ ClickFunnels.com is the premier service for building complete funnels for any ma
38
 
39
  The power is in your hands with the **Editor** allows you to design and change your pages in your web browser. Choose from a huge array of templates and edit on the fly.
40
 
41
- *Complete with hosting and free Wordpress plugin.*
42
 
43
  **Sign up for ClickFunnels Now:**
44
  <https://clickfunnels.com/>
@@ -46,11 +46,11 @@ The power is in your hands with the **Editor** allows you to design and change y
46
 
47
  == Installation ==
48
 
49
- **Easy Installation**: In your Wordpress dashboard go to Plugins > Add New and search for "clickfunnels" and you will be able to quickly install the latest version of the plugin.
50
 
51
  *Updates will be ready automatically and you will be notified in your dashboard.*
52
 
53
- **Manual Installation**: Download the ClickFunnels Wordpress plugin .zip file. Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation via a FTP and then activate the Plugin from Plugins page.
54
 
55
  **How to Setup Authenication Key**
56
 
@@ -94,6 +94,13 @@ 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.6 =
98
 
99
  * Auto save if page id = null (fixes some blank page issues)
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
 
28
 
29
  Example: "http://yourblog.com/ordernow" can be connected to your order page from any funnel within your ClickFunnels account.
30
 
31
+ **Don't have a ClickFunnels account?** You can sign up now to transform the way you run your business online. The WordPress plugin is free to all members.
32
 
33
  **Need more help?** Check out the installation, FAQ and screenshots for more information or check out the Support Desk.
34
 
38
 
39
  The power is in your hands with the **Editor** allows you to design and change your pages in your web browser. Choose from a huge array of templates and edit on the fly.
40
 
41
+ *Complete with hosting and free WordPress plugin.*
42
 
43
  **Sign up for ClickFunnels Now:**
44
  <https://clickfunnels.com/>
46
 
47
  == Installation ==
48
 
49
+ **Easy Installation**: In your WordPress dashboard go to Plugins > Add New and search for "clickfunnels" and you will be able to quickly install the latest version of the plugin.
50
 
51
  *Updates will be ready automatically and you will be notified in your dashboard.*
52
 
53
+ **Manual Installation**: Download the ClickFunnels WordPress plugin .zip file. Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation via a FTP and then activate the Plugin from Plugins page.
54
 
55
  **How to Setup Authenication Key**
56
 
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
100
+ * Better page management screen
101
+ * Small copy changes.
102
+ * Now display the chosen Funnel with Page name
103
+
104
  = Version 1.0.6 =
105
 
106
  * Auto save if page id = null (fixes some blank page issues)
support.php CHANGED
@@ -188,7 +188,7 @@
188
  </div>
189
  <div id="apiSettings">
190
  <h2 style="margin-top: 10px"><strong>Frequently Asked Questions</strong></h2>
191
- <p style="opacity: .7">Quickly find out about all the features to get the most out of using Wordpress to show your ClickFunnels pages. You can also go to the <a href="https://support.clickfunnels.com/support/home" target="_blank">knowledge base</a> to learn more about ClickFunnels.</p>
192
  <hr style="border: none; border-bottom: 1px solid #ECEEEF; margin: 20px 0">
193
  <div id="faq">
194
  <h4><i class="fa fa-question-circle"></i> How and where do I get Authentication Key?</h4>
188
  </div>
189
  <div id="apiSettings">
190
  <h2 style="margin-top: 10px"><strong>Frequently Asked Questions</strong></h2>
191
+ <p style="opacity: .7">Quickly find out about all the features to get the most out of using WordPress to show your ClickFunnels pages. You can also go to the <a href="https://support.clickfunnels.com/support/home" target="_blank">knowledge base</a> to learn more about ClickFunnels.</p>
192
  <hr style="border: none; border-bottom: 1px solid #ECEEEF; margin: 20px 0">
193
  <div id="faq">
194
  <h4><i class="fa fa-question-circle"></i> How and where do I get Authentication Key?</h4>