ClickFunnels - Version 1.0.5

Version Description

Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.5

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