ClickFunnels - Version 1.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

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