ClickFunnels - Version 1.0.4

Version Description

Download this release

Release Info

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

Code changes from version 1.0.3 to 1.0.4

Files changed (7) hide show
  1. CF_API.php +1 -1
  2. access.php +6 -14
  3. admin.php +1 -1
  4. admin_testing.php +85 -0
  5. clickfunnels.php +24 -2
  6. footer.php +1 -1
  7. readme.txt +7 -2
CF_API.php CHANGED
@@ -12,7 +12,7 @@ class CF_API {
12
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
13
  } else {
14
  $new_url = $url.$query;
15
- $content = file_get_contents( $new_url );
16
  $funnels = json_decode( $content );
17
  }
18
  return $funnels;
12
  if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) {
13
  } else {
14
  $new_url = $url.$query;
15
+ $content = cf_get_file_contents( $new_url );
16
  $funnels = json_decode( $content );
17
  }
18
  return $funnels;
access.php CHANGED
@@ -175,6 +175,7 @@
175
  update_option( 'clickfunnels_api_email', $_POST['clickfunnels_api_email'] );
176
  update_option( 'clickfunnels_api_auth', $_POST['clickfunnels_api_auth'] );
177
  update_option( 'clickfunnels_siteURL', $_POST['clickfunnels_siteURL'] );
 
178
  }
179
  }
180
  ?>
@@ -188,6 +189,7 @@
188
  <input type="text" name="clickfunnels_api_auth" id="clickfunnels_api_auth" placeholder="C5c86J28WbxuxxUqN59z5D" value="<?php echo get_option( 'clickfunnels_api_auth' ); ?>" />
189
  <h3>Website URL: <span class="checkSuccess"><i class="fa fa-check successGreen"></i></span></h3>
190
  <input type="text" name="clickfunnels_siteURL" id="clickfunnels_siteURL" placeholder="http://yourdomain.com/" value="<?php if (get_option( 'clickfunnels_siteURL' ) != '') { echo get_option( 'clickfunnels_siteURL' ); } else { echo get_site_url(); } ?>" />
 
191
  </div>
192
  <div class="rightSide">
193
  <p>To access your Authentication Token go to your ClickFunnels Members area and choose <a href="https://app.clickfunnels.com/users/edit" target="_blank">My Account > Settings</a> and you will find your API information.</p>
@@ -206,19 +208,9 @@
206
  </div>
207
  </form>
208
  <?php include('footer.php'); ?>
 
209
  </div>
 
 
 
210
 
211
- <script>
212
- (function($) {
213
- setTimeout(function() {
214
- $('#errorMessage').fadeOut();
215
- }, 1500);
216
- var specificFunnel = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
217
- $.getJSON(specificFunnel, function(data) {
218
- $('.checkSuccess').html('<i class="fa fa-check successGreen"></i>');
219
- }).fail(function(jqXHR) {
220
- $('.checkSuccess').html('<i class="fa fa-times errorRed"></i>');
221
- $('.badAPI').show();
222
- });
223
- })(jQuery);
224
- </script>
175
  update_option( 'clickfunnels_api_email', $_POST['clickfunnels_api_email'] );
176
  update_option( 'clickfunnels_api_auth', $_POST['clickfunnels_api_auth'] );
177
  update_option( 'clickfunnels_siteURL', $_POST['clickfunnels_siteURL'] );
178
+ update_option( 'clickfunnels_404Redirect', $_POST['clickfunnels_404Redirect'] );
179
  }
180
  }
181
  ?>
189
  <input type="text" name="clickfunnels_api_auth" id="clickfunnels_api_auth" placeholder="C5c86J28WbxuxxUqN59z5D" value="<?php echo get_option( 'clickfunnels_api_auth' ); ?>" />
190
  <h3>Website URL: <span class="checkSuccess"><i class="fa fa-check successGreen"></i></span></h3>
191
  <input type="text" name="clickfunnels_siteURL" id="clickfunnels_siteURL" placeholder="http://yourdomain.com/" value="<?php if (get_option( 'clickfunnels_siteURL' ) != '') { echo get_option( 'clickfunnels_siteURL' ); } else { echo get_site_url(); } ?>" />
192
+ <!-- <h3><input type="checkbox" value="yesRedirect" <?php if (get_option( 'clickfunnels_404Redirect' ) != '') { echo 'checked'; } ?> name="clickfunnels_404Redirect" style="width: auto;float: left;margin-top:-2px;margin-right: 8px;" /> 404 Redirect to Homepage (LinkSaver)</h3> -->
193
  </div>
194
  <div class="rightSide">
195
  <p>To access your Authentication Token go to your ClickFunnels Members area and choose <a href="https://app.clickfunnels.com/users/edit" target="_blank">My Account > Settings</a> and you will find your API information.</p>
208
  </div>
209
  </form>
210
  <?php include('footer.php'); ?>
211
+
212
  </div>
213
+ <br clear="all">
214
+ <span style="font-size: 11px; padding-left: 10px;"><a href="#" id="showDataTesting" style="text-decoration: none; color: #999"><i class="fa fa-dashboard"></i> Show Plugin Developer Data</a></span>
215
+ <?php include('admin_testing.php'); ?>
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = file_get_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
  <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"><i class="fa fa-search"></i> <?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
  <h2>Set as Home Page</h2>
422
  <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>
423
  <?php }?>
424
  <?php if ( $cf_type=='np' ) {?>
425
  <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>
426
  <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>
427
  <h2>Set as 404 Page</h2>
428
  <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>
429
  <?php }?>
430
  <?php if ( $cf_type=='' ) {?>
431
  <h2>Page Undefined - Create New Page</h2>
432
  <?php }?>
433
  <?php } else { ?>
434
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
435
  <?php } ?>
436
  <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>
437
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
438
  <div class="row-fluid form-horizontal">
439
  <br>
440
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
441
  <div data-target="cf_type" class="btn-group multichoice cf_header">
442
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
443
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
444
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
445
  </div>
446
  <input type="hidden" id="cf_type" name="cf_type"/>
447
  </div>
448
  <br>
449
  <div class="control-group">
450
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
451
  <div class="controls">
452
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
453
  <?php if ( empty( $cf_funnels ) ) { ?>
454
  <option value="0">No Funnels Found</option>
455
  <?php }
456
  else {
457
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
458
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
459
  <?php
460
  }
461
  } ?>
462
  </select>
463
  </div>
464
  </div>
465
  <div class="control-group">
466
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
467
  <div class="controls">
468
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
469
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
470
  <option value="0">No Pages Found</option>
471
  <?php }
472
  else {
473
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
474
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
475
  <?php
476
  }
477
  }
478
  ?>
479
  </select>
480
  <i class="fa fa-spinner fa-spin" id="loading"></i>
481
  </div>
482
  <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>
483
  </div>
484
  <div class="control-group" id="hiddenStuff" style="display: none">
485
  <div class="controls">
486
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
487
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
488
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
489
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
490
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
491
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
492
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
493
  </div>
494
  </div>
495
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
496
  <div class="cf_url control-group" style="<?php echo $display;?>" >
497
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
498
  <div id="cf-wp-path" class="controls ">
499
  <div class="input-prepend">
500
  <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">
501
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
502
  </div>
503
  </div>
504
  </div>
505
  <br><br>
506
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
507
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
508
  <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>
509
  <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>
510
  </div>
511
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
512
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
513
  <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>
514
  <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>
515
  </div>
516
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
517
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
518
  <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>
519
  <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>
520
  </div>
521
  <br>
522
  <div class="row-fluid" id="apiFooter">
523
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
524
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
525
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
526
  </button>
527
  <?php } else { ?>
528
  <button id="publish" name="publish" class="button button-primary " style="float: right;">
529
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
530
  </button>
531
  <?php } ?>
532
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
533
  <i class="fa fa-spinner fa-spin"></i>
534
  <span>Saving...</span>
535
  </div>
536
  <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>
537
  <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>
538
  <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>
539
  <?php if ( !empty( $delete_link ) ) {?>
540
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
541
  <?php }?>
542
  </div>
543
  </div>
544
  </div>
545
  (function($) {
546
  setTimeout(function() {
547
  $('#cf_thepage').trigger( "change" );
548
  }, 1500);
549
  })(jQuery);
 
550
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
551
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
552
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
553
  $thepage = explode( "{#}", $cf_page );
554
  $savedData = $cf_page;
555
  }
556
  else {
557
  $thepage = explode( "{#}", $cf_page['page_id'] );
558
  $savedData = $cf_page['page_id'];
559
  }
560
  $cf_options = get_option( "cf_options" );
561
  jQuery(document).ready(function(){
562
  // Set Correct Options
563
  var thefunnel = jQuery('#cf_thefunnel').val();
564
  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" ); ?>';
565
  jQuery('#cf_thepage').find('option').remove().end();
566
  jQuery('#loading').fadeIn();
567
  jQuery.getJSON(specificFunnel, function(data) {
568
  setTimeout(function() {
569
  jQuery('#loading').fadeOut();
570
  }, 2000);
571
  var is_selected = "";
572
  jQuery.each(data.funnel_steps, function() {
573
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
574
  is_selected = "selected";
575
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
576
  } else {
577
  is_selected = "";
578
  }
579
 
580
  if( this.wp_friendly == true) {
581
  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>');
582
  }
583
 
584
  });
585
  }).done(function() {
586
  jQuery('#loading').fadeOut();
587
  jQuery('#cf_thepage').trigger( "change" );
588
  })
589
  .fail(function() {
590
  jQuery('#loading').fadeOut();
591
  })
592
  .always(function() {
593
  jQuery('#loading').fadeOut();
594
  console.log( "ClickFunnels Rocks!" );
595
  });
596
  // Change Funnel Populate Dropdown
597
  jQuery( '#cf_thefunnel' ).change(function() {
598
  jQuery('#loading').fadeIn();
599
  var thefunnel = jQuery(this).val();
600
  var totalPages = 0;
601
  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" ); ?>';
602
  jQuery('#cf_thepage').find('option').remove().end();
603
  jQuery.getJSON(specificFunnel, function(data) {
604
  setTimeout(function() {
605
  jQuery('#loading').fadeOut();
606
  }, 2000);
607
  jQuery.each(data.funnel_steps, function() {
608
  if( this.wp_friendly == true) {
609
  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>');
610
  totalPages += 1;
611
  }
612
  });
613
  }).done(function() {
614
  jQuery('#loading').fadeOut();
615
  })
616
  .fail(function() {
617
  jQuery('#loading').fadeOut();
618
  })
619
  .always(function() {
620
  jQuery('#loading').fadeOut();
621
  });
622
  setTimeout(function() {
623
  if (totalPages == 0) {
624
  jQuery('#noPageWarning').fadeIn();
625
  }
626
  else {
627
  jQuery('#noPageWarning').hide();
628
  }
629
  var theposition = jQuery('#cf_thepage').val();
630
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
631
  var myString = thefunnel+'{#}'+theposition;
632
  var arr = myString.split('{#}');
633
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
634
  var do_ping = function() {
635
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
636
 
637
  }).catch(function(error) {
638
 
639
  });
640
  };
641
  do_ping();
642
  }, 1000);
643
  });
644
  var request_image = function(url) {
645
  return new Promise(function(resolve, reject) {
646
  var img = new Image();
647
  img.onload = function() { resolve(img); };
648
  img.onerror = function() { reject(url); };
649
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
650
  });
651
  };
652
  /**
653
  * Pings a url.
654
  * @param {String} url
655
  * @return {Promise} promise that resolves to a ping (ms, float).
656
  */
657
  var ping = function(url) {
658
  return new Promise(function(resolve, reject) {
659
  var start = (new Date()).getTime();
660
  var response = function() {
661
  var delta = ((new Date()).getTime() - start);
662
 
663
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
664
  delta /= 4;
665
 
666
  resolve(delta);
667
  };
668
  request_image(url).then(response).catch(response);
669
 
670
  // Set a timeout for max-pings, 5s.
671
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
672
  });
673
  };
674
  // Select New Page
675
  jQuery( '#cf_thepage' ).change(function() {
676
  jQuery('#loading').fadeOut();
677
  var thefunnel = jQuery('#cf_thefunnel').val();
678
  var theposition = jQuery(this).val();
679
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
680
  var myString = thefunnel+'{#}'+theposition;
681
  var arr = myString.split('{#}');
682
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
683
  var do_ping = function() {
684
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
685
 
686
  }).catch(function(error) {
687
 
688
  });
689
  };
690
  do_ping();
691
  });
692
  // Fade Out Message
693
  setTimeout(function() {
694
  jQuery('#message').fadeOut();
695
  }, 3500);
696
  // Savings
697
  jQuery('#publish').click(function() {
698
  jQuery('#saving').fadeIn();
699
  });
700
  jQuery('#delete').on('click', function () {
701
  return confirm('Are you sure you want to delete this page?');
702
  });
703
  jQuery('#cf_slug').bind('keyup keypress blur', function()
704
  {
705
  var myStr = jQuery(this).val()
706
  myStr=myStr.toLowerCase();
707
  myStr=myStr.replace(/\s/g , "-");
708
  jQuery('#cf_slug').val(myStr);
709
  });
710
  });
711
  display: none !important;
712
  }
713
  #side-sortables {
714
  display: none !important;
715
  }
716
  #clickfunnels_meta_box {
717
  width: 780px !important;
718
  border-radius: 5px;
719
  }
720
  .button:active, .button:hover, .button:focus {
721
  outline: none !important;
722
  box-shadow: none !important;
723
  }
724
  #message {
725
  width: 752px;
726
  margin-bottom: 0;
727
  }
728
  .apiHeader {
729
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
730
  border-bottom: 3px solid rgba(0,0,0,0.25);
731
  padding: 10px;
732
  padding-top: 15px;
733
  border-top-left-radius: 5px;
734
  border-top-right-radius: 5px;
735
  clear: both;
736
  }
737
  .apiHeader img {
738
  width: 200px;
739
  float: left;
740
  margin-left: 10px;
741
  }
742
  .apiHeader a {
743
  float: right;
744
  display: block;
745
  color: #fff;
746
  font-size: 13px;
747
  text-decoration: none;
748
  margin-right: 5px !important;
749
  background-color: rgba(0, 0, 0, .3);
750
  border: 2px solid #2b2e30;
751
  color: #afbbc8 !important;
752
  font-weight: 700;
753
  -webkit-border-radius: 4px;
754
  -moz-border-radius: 4px;
755
  border-radius: 4px;
756
  padding: 7px;
757
  padding-left: 12px;
758
  padding-right: 12px;
759
  margin-top: 0px !important;
760
  text-transform: uppercase;
761
  text-decoration: none;
762
  font-size: 14px;
763
  }
764
  .apiHeader a:hover {
765
  border: 2px solid #1D81C8;
766
  background-color: rgba(0, 0, 0, .6);
767
  color: #fff !important;
768
  }
769
  .apiSubHeader {
770
  background-color: #0166AE;
771
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
772
  border-bottom: 3px solid rgba(0,0,0,0.25);
773
  color: #fff;
774
  padding: 15px 18px;
775
  }
776
  .apiSubHeader h2 {
777
  margin: 0 !important;
778
  padding: 0 !important;
779
  color: #fff;
780
  font-weight: bold;
781
  font-size: 17px;
782
  text-shadow: 1px 1px 0 #0367AE;
783
  }
784
  .apiSubHeader a.editThisPage {
785
  float: right;
786
  padding: 5px 10px;
787
  color: #fff;
788
  text-shadow: 1px 1px 0 #0367AE;
789
  text-decoration: none;
790
  padding-top: 15px;
791
  margin-top: 6px;
792
  font-size: 14px;
793
  border: 2px solid #1D81C8;
794
  background-color: #054B7C;
795
  color: #fff !important;
796
  font-weight: 700;
797
  -webkit-border-radius: 4px;
798
  -moz-border-radius: 4px;
799
  border-radius: 4px;
800
  padding: 7px;
801
  padding-left: 12px;
802
  padding-right: 12px;
803
  text-transform: uppercase;
804
  text-decoration: none;
805
  font-size: 12px;
806
  }
807
  .apiSubHeader a.editThisPage i {
808
  margin-right: 4px;
809
  }
810
  .apiSubHeader a.editThisPage:hover {
811
  border: 2px solid #FFB700;
812
  text-shadow: 1px 1px 0 #222;
813
  background-color: rgba(0, 0, 0, .6);
814
  color: #fff !important;
815
  }
816
  .apiSubHeader a{
817
  text-shadow: 1px 1px 0 #0367AE;
818
  color: #fff;
819
  text-decoration: none;
820
  font-size: 12px;
821
  opacity: .8;
822
  }
823
  .apiSubHeader a:hover {
824
  opacity: 1;
825
  }
826
  .inside {
827
  padding: 0 !important;
828
  margin-top: 0 !important;
829
  border-radius: 5px !important;
830
  }
831
  .inside h2 {
832
  display: block !important;
833
  }
834
  #postbox-container-2 {
835
  margin-top: -20px !important;
836
  }
837
  body #poststuff .hndle.ui-sortable-handle {
838
  display: none !important;
839
  }
840
  body #poststuff .handlediv {
841
  display: none !important;
842
  }
843
  #loading {
844
  float: left;
845
  margin-left: 10px;
846
  display: none;
847
  margin-top: 6px;
848
  color: #999;
849
  }
850
  #apiFooter {
851
  background: #F1F1F1;
852
  padding: 20px 0;
853
  padding-bottom: 10px;
854
  }
855
  #apiFooter a:hover {
856
  text-decoration: none;
857
  }
858
  .bootstrap-wp {
859
  overflow: hidden;
860
  border: 10px solid #F1F1F1;
861
  }
862
  .deleteButton {
863
  padding: 5px;
864
  float: left;
865
  color: #777 !important;
866
  font-size: 13px;
867
  }
868
  body .cf_header .btn {
869
  font-size: 13px !important;
870
  padding: 8px 15px;
871
  }
872
  body .btn-selected {
873
  background-color: #0166AE !important;
874
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
875
  text-shadow: 1px 1px 0 #034E82 !important;
876
  font-family: Arial !important;
877
  color: #ffffff !important;
878
  border: solid #1f628d 1px !important;
879
  text-decoration: none !important;
880
  transition: none !important;
881
  }
882
  body label {
883
  font-size: 11px;
884
  opacity: .8;
885
  }
886
  body label i {
887
  padding-left: 10px;
888
  }
889
  .helpinfo {
890
  padding: 20px 40px;
891
  background: #fafafa;
892
  border-top: 1px solid #f2f2f2;
893
  margin: 0 0px;
894
  margin-top: -20px;
895
  margin-bottom: -20px;
896
  }
897
  .helpinfo h4 {
898
  color: #3B474F;
899
  font-size: 15px;
900
  font-weight: 700;
901
  padding-bottom: 10px;
902
  padding-top: 5px;
903
  }
904
  .helpinfo p {
905
  color: #888;
906
  font-weight: 300;
907
  font-size: 12px;
908
  line-height: 19px;
909
  letter-spacing: 1px;
910
  padding-bottom: 0;
911
  }
912
  .helpinfo h4 i {
913
  margin-right: 4px;
914
  }
915
  #message {
916
  width: 758px;
917
  padding: 10px 10px;
918
  display: block;
919
  z-index: 99999;
920
  position: relative;
921
  color: #fff;
922
  border: 1px solid #024D82;
923
  border-bottom: 2px solid #024D82;
924
  text-shadow: 1px 1px 0 #024D82;
925
  padding: 0 10px;
926
  font-size: 16px;
927
  margin-bottom: 0;
928
  border-radius: 5px;
929
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
930
  }
931
  .noAPI {
932
  padding: 10px;
933
  border-bottom: 2px solid #c93f2b;
934
  background: #E64D37;
935
  }
936
  .noAPI h4 {
937
  margin: 0;
938
  padding: 0;
939
  color: #fff;
940
  }
941
  .noAPI h4 a {
942
  color: #fff;
943
  font-weight: normal;
944
  }
945
  .input-xlarge {
946
 
947
  }
948
  .control-group {
949
  padding-left: 25px
950
  }
951
  if ( $cf_page != "" ) {
952
  $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' ) );
953
  $cf_funnels_pages = json_decode( $json );
954
  }
955
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
956
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
957
  <br clear="all">
958
  <?php if ( !empty( $_GET['action'] ) ) { ?>
959
  <?php if ( $cf_type=='p' ) {?>
960
  <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>
961
  <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>
962
  <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>
963
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
964
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
965
  <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>
966
  <?php }?>
967
  <?php if ( $cf_type=='hp' ) {?>
968
  <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>
969
  <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>
970
  <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>
971
  <h2>Set as Home Page</h2>
972
  <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>
973
  <?php }?>
974
  <?php if ( $cf_type=='np' ) {?>
975
  <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>
976
  <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>
977
  <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>
978
  <h2>Set as 404 Page</h2>
979
  <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>
980
  <?php }?>
981
  <?php if ( $cf_type=='' ) {?>
982
  <h2>Page Undefined - Create New Page</h2>
983
  <?php }?>
984
  <?php } else { ?>
985
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
986
  <?php } ?>
987
  <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>
988
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
989
  <div class="row-fluid form-horizontal">
990
  <br>
991
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
992
  <div data-target="cf_type" class="btn-group multichoice cf_header">
993
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
994
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
995
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
996
  </div>
997
  <input type="hidden" id="cf_type" name="cf_type"/>
998
  </div>
999
  <br>
1000
  <div class="control-group">
1001
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1002
  <div class="controls">
1003
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1004
  <?php if ( empty( $cf_funnels ) ) { ?>
1005
  <option value="0">No Funnels Found</option>
1006
  <?php }
1007
  else {
1008
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1009
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1010
  <?php
1011
  }
1012
  } ?>
1013
  </select>
1014
  </div>
1015
  </div>
1016
  <div class="control-group">
1017
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1018
  <div class="controls">
1019
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1020
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1021
  <option value="0">No Pages Found</option>
1022
  <?php }
1023
  else {
1024
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1025
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1026
  <?php
1027
  }
1028
  }
1029
  ?>
1030
  </select>
1031
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1032
  </div>
1033
  <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>
1034
  </div>
1035
  <div class="control-group" id="hiddenStuff" style="display: none">
1036
  <div class="controls">
1037
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1038
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1039
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1040
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1041
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1042
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1043
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1044
  </div>
1045
  </div>
1046
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1047
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1048
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1049
  <div id="cf-wp-path" class="controls ">
1050
  <div class="input-prepend">
1051
  <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">
1052
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1053
  </div>
1054
  </div>
1055
  </div>
1056
  <br><br>
1057
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1058
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1059
  <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>
1060
  <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>
1061
  </div>
1062
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1063
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1064
  <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>
1065
  <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>
1066
  </div>
1067
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1068
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1069
  <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>
1070
  <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>
1071
  </div>
1072
  <br>
1073
  <div class="row-fluid" id="apiFooter">
1074
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1075
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1076
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1077
  </button>
1078
  <?php } else { ?>
1079
  <button id="publish" name="publish" 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 } ?>
1083
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1084
  <i class="fa fa-spinner fa-spin"></i>
1085
  <span>Saving...</span>
1086
  </div>
1087
  <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>
1088
  <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>
1089
  <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>
1090
  <?php if ( !empty( $delete_link ) ) {?>
1091
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1092
  <?php }?>
1093
  </div>
1094
  </div>
1095
  </div>
1096
  (function($) {
1097
  setTimeout(function() {
1098
  $('#cf_thepage').trigger( "change" );
1099
  }, 1500);
1100
  })(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 = file_get_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
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
414
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
415
  <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>
416
  <?php }?>
417
  <?php if ( $cf_type=='hp' ) {?>
418
  <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>
419
  <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>
420
  <h2>Set as Home Page</h2>
421
  <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>
422
  <?php }?>
423
  <?php if ( $cf_type=='np' ) {?>
424
  <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>
425
  <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>
426
  <h2>Set as 404 Page</h2>
427
  <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>
428
  <?php }?>
429
  <?php if ( $cf_type=='' ) {?>
430
  <h2>Page Undefined - Create New Page</h2>
431
  <?php }?>
432
  <?php } else { ?>
433
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
434
  <?php } ?>
435
  <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>
436
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
437
  <div class="row-fluid form-horizontal">
438
  <br>
439
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
440
  <div data-target="cf_type" class="btn-group multichoice cf_header">
441
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
442
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
443
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
444
  </div>
445
  <input type="hidden" id="cf_type" name="cf_type"/>
446
  </div>
447
  <br>
448
  <div class="control-group">
449
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
450
  <div class="controls">
451
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
452
  <?php if ( empty( $cf_funnels ) ) { ?>
453
  <option value="0">No Funnels Found</option>
454
  <?php }
455
  else {
456
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
457
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
458
  <?php
459
  }
460
  } ?>
461
  </select>
462
  </div>
463
  </div>
464
  <div class="control-group">
465
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
466
  <div class="controls">
467
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
468
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
469
  <option value="0">No Pages Found</option>
470
  <?php }
471
  else {
472
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
473
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
474
  <?php
475
  }
476
  }
477
  ?>
478
  </select>
479
  <i class="fa fa-spinner fa-spin" id="loading"></i>
480
  </div>
481
  <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>
482
  </div>
483
  <div class="control-group" id="hiddenStuff" style="display: none">
484
  <div class="controls">
485
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
486
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
487
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
488
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
489
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
490
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
491
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
492
  </div>
493
  </div>
494
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
495
  <div class="cf_url control-group" style="<?php echo $display;?>" >
496
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
497
  <div id="cf-wp-path" class="controls ">
498
  <div class="input-prepend">
499
  <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">
500
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
501
  </div>
502
  </div>
503
  </div>
504
  <br><br>
505
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
506
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
507
  <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>
508
  <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>
509
  </div>
510
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
511
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
512
  <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>
513
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
514
  </div>
515
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
516
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
517
  <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>
518
  <p style="font-size: 11px;opacity: .7"><i class="fa fa-exclamation-triangle"></i> Changes made to the page in editor may take up to 30 seconds to appear on Wordpress page.</p>
519
  </div>
520
  <br>
521
  <div class="row-fluid" id="apiFooter">
522
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
523
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
524
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
525
  </button>
526
  <?php } else { ?>
527
  <button id="publish" name="publish" 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 } ?>
531
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
532
  <i class="fa fa-spinner fa-spin"></i>
533
  <span>Saving...</span>
534
  </div>
535
  <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>
536
  <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>
537
  <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>
538
  <?php if ( !empty( $delete_link ) ) {?>
539
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
540
  <?php }?>
541
  </div>
542
  </div>
543
  </div>
544
  (function($) {
545
  setTimeout(function() {
546
  $('#cf_thepage').trigger( "change" );
547
  }, 1500);
548
  })(jQuery);
549
+ <?php
550
  $cf_thefunnel = get_post_meta( $_GET['post'], "cf_thefunnel", true );
551
  $cf_thepage = get_post_meta( $_GET['post'], "cf_thepage", true );
552
  if ( !isset( $cf_page['page_id'] ) || $cf_page['page_id'] < 10 ) {
553
  $thepage = explode( "{#}", $cf_page );
554
  $savedData = $cf_page;
555
  }
556
  else {
557
  $thepage = explode( "{#}", $cf_page['page_id'] );
558
  $savedData = $cf_page['page_id'];
559
  }
560
  $cf_options = get_option( "cf_options" );
561
  jQuery(document).ready(function(){
562
  // Set Correct Options
563
  var thefunnel = jQuery('#cf_thefunnel').val();
564
  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" ); ?>';
565
  jQuery('#cf_thepage').find('option').remove().end();
566
  jQuery('#loading').fadeIn();
567
  jQuery.getJSON(specificFunnel, function(data) {
568
  setTimeout(function() {
569
  jQuery('#loading').fadeOut();
570
  }, 2000);
571
  var is_selected = "";
572
  jQuery.each(data.funnel_steps, function() {
573
  if (this.pages[0].id == "<?php echo $thepage[2] ?>") {
574
  is_selected = "selected";
575
  jQuery('#cf_seo_tags').val(this.pages[0].metatags);
576
  } else {
577
  is_selected = "";
578
  }
579
 
580
  if( this.wp_friendly == true) {
581
  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>');
582
  }
583
 
584
  });
585
  }).done(function() {
586
  jQuery('#loading').fadeOut();
587
  jQuery('#cf_thepage').trigger( "change" );
588
  })
589
  .fail(function() {
590
  jQuery('#loading').fadeOut();
591
  })
592
  .always(function() {
593
  jQuery('#loading').fadeOut();
594
  console.log( "ClickFunnels Rocks!" );
595
  });
596
  // Change Funnel Populate Dropdown
597
  jQuery( '#cf_thefunnel' ).change(function() {
598
  jQuery('#loading').fadeIn();
599
  var thefunnel = jQuery(this).val();
600
  var totalPages = 0;
601
  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" ); ?>';
602
  jQuery('#cf_thepage').find('option').remove().end();
603
  jQuery.getJSON(specificFunnel, function(data) {
604
  setTimeout(function() {
605
  jQuery('#loading').fadeOut();
606
  }, 2000);
607
  jQuery.each(data.funnel_steps, function() {
608
  if( this.wp_friendly == true) {
609
  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>');
610
  totalPages += 1;
611
  }
612
  });
613
  }).done(function() {
614
  jQuery('#loading').fadeOut();
615
  })
616
  .fail(function() {
617
  jQuery('#loading').fadeOut();
618
  })
619
  .always(function() {
620
  jQuery('#loading').fadeOut();
621
  });
622
  setTimeout(function() {
623
  if (totalPages == 0) {
624
  jQuery('#noPageWarning').fadeIn();
625
  }
626
  else {
627
  jQuery('#noPageWarning').hide();
628
  }
629
  var theposition = jQuery('#cf_thepage').val();
630
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
631
  var myString = thefunnel+'{#}'+theposition;
632
  var arr = myString.split('{#}');
633
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
634
  var do_ping = function() {
635
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
636
 
637
  }).catch(function(error) {
638
 
639
  });
640
  };
641
  do_ping();
642
  }, 1000);
643
  });
644
  var request_image = function(url) {
645
  return new Promise(function(resolve, reject) {
646
  var img = new Image();
647
  img.onload = function() { resolve(img); };
648
  img.onerror = function() { reject(url); };
649
  img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
650
  });
651
  };
652
  /**
653
  * Pings a url.
654
  * @param {String} url
655
  * @return {Promise} promise that resolves to a ping (ms, float).
656
  */
657
  var ping = function(url) {
658
  return new Promise(function(resolve, reject) {
659
  var start = (new Date()).getTime();
660
  var response = function() {
661
  var delta = ((new Date()).getTime() - start);
662
 
663
  // HACK: Use a fudge factor to correct the ping for HTTP bulk.
664
  delta /= 4;
665
 
666
  resolve(delta);
667
  };
668
  request_image(url).then(response).catch(response);
669
 
670
  // Set a timeout for max-pings, 5s.
671
  setTimeout(function() { reject(Error('Timeout')); }, 5000);
672
  });
673
  };
674
  // Select New Page
675
  jQuery( '#cf_thepage' ).change(function() {
676
  jQuery('#loading').fadeOut();
677
  var thefunnel = jQuery('#cf_thefunnel').val();
678
  var theposition = jQuery(this).val();
679
  jQuery('#cf_data').val(thefunnel+'{#}'+theposition);
680
  var myString = thefunnel+'{#}'+theposition;
681
  var arr = myString.split('{#}');
682
  // jQuery('#loadPageforUpdate').attr('src', 'https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true');
683
  var do_ping = function() {
684
  ping('https://api.clickfunnels.com/s3_proxy/'+arr[1]+'?preview=true').then(function(delta) {
685
 
686
  }).catch(function(error) {
687
 
688
  });
689
  };
690
  do_ping();
691
  });
692
  // Fade Out Message
693
  setTimeout(function() {
694
  jQuery('#message').fadeOut();
695
  }, 3500);
696
  // Savings
697
  jQuery('#publish').click(function() {
698
  jQuery('#saving').fadeIn();
699
  });
700
  jQuery('#delete').on('click', function () {
701
  return confirm('Are you sure you want to delete this page?');
702
  });
703
  jQuery('#cf_slug').bind('keyup keypress blur', function()
704
  {
705
  var myStr = jQuery(this).val()
706
  myStr=myStr.toLowerCase();
707
  myStr=myStr.replace(/\s/g , "-");
708
  jQuery('#cf_slug').val(myStr);
709
  });
710
  });
711
  display: none !important;
712
  }
713
  #side-sortables {
714
  display: none !important;
715
  }
716
  #clickfunnels_meta_box {
717
  width: 780px !important;
718
  border-radius: 5px;
719
  }
720
  .button:active, .button:hover, .button:focus {
721
  outline: none !important;
722
  box-shadow: none !important;
723
  }
724
  #message {
725
  width: 752px;
726
  margin-bottom: 0;
727
  }
728
  .apiHeader {
729
  background: #39464E url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
730
  border-bottom: 3px solid rgba(0,0,0,0.25);
731
  padding: 10px;
732
  padding-top: 15px;
733
  border-top-left-radius: 5px;
734
  border-top-right-radius: 5px;
735
  clear: both;
736
  }
737
  .apiHeader img {
738
  width: 200px;
739
  float: left;
740
  margin-left: 10px;
741
  }
742
  .apiHeader a {
743
  float: right;
744
  display: block;
745
  color: #fff;
746
  font-size: 13px;
747
  text-decoration: none;
748
  margin-right: 5px !important;
749
  background-color: rgba(0, 0, 0, .3);
750
  border: 2px solid #2b2e30;
751
  color: #afbbc8 !important;
752
  font-weight: 700;
753
  -webkit-border-radius: 4px;
754
  -moz-border-radius: 4px;
755
  border-radius: 4px;
756
  padding: 7px;
757
  padding-left: 12px;
758
  padding-right: 12px;
759
  margin-top: 0px !important;
760
  text-transform: uppercase;
761
  text-decoration: none;
762
  font-size: 14px;
763
  }
764
  .apiHeader a:hover {
765
  border: 2px solid #1D81C8;
766
  background-color: rgba(0, 0, 0, .6);
767
  color: #fff !important;
768
  }
769
  .apiSubHeader {
770
  background-color: #0166AE;
771
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
772
  border-bottom: 3px solid rgba(0,0,0,0.25);
773
  color: #fff;
774
  padding: 15px 18px;
775
  }
776
  .apiSubHeader h2 {
777
  margin: 0 !important;
778
  padding: 0 !important;
779
  color: #fff;
780
  font-weight: bold;
781
  font-size: 17px;
782
  text-shadow: 1px 1px 0 #0367AE;
783
  }
784
  .apiSubHeader a.editThisPage {
785
  float: right;
786
  padding: 5px 10px;
787
  color: #fff;
788
  text-shadow: 1px 1px 0 #0367AE;
789
  text-decoration: none;
790
  padding-top: 15px;
791
  margin-top: 6px;
792
  font-size: 14px;
793
  border: 2px solid #1D81C8;
794
  background-color: #054B7C;
795
  color: #fff !important;
796
  font-weight: 700;
797
  -webkit-border-radius: 4px;
798
  -moz-border-radius: 4px;
799
  border-radius: 4px;
800
  padding: 7px;
801
  padding-left: 12px;
802
  padding-right: 12px;
803
  text-transform: uppercase;
804
  text-decoration: none;
805
  font-size: 12px;
806
  }
807
  .apiSubHeader a.editThisPage i {
808
  margin-right: 4px;
809
  }
810
  .apiSubHeader a.editThisPage:hover {
811
  border: 2px solid #FFB700;
812
  text-shadow: 1px 1px 0 #222;
813
  background-color: rgba(0, 0, 0, .6);
814
  color: #fff !important;
815
  }
816
  .apiSubHeader a{
817
  text-shadow: 1px 1px 0 #0367AE;
818
  color: #fff;
819
  text-decoration: none;
820
  font-size: 12px;
821
  opacity: .8;
822
  }
823
  .apiSubHeader a:hover {
824
  opacity: 1;
825
  }
826
  .inside {
827
  padding: 0 !important;
828
  margin-top: 0 !important;
829
  border-radius: 5px !important;
830
  }
831
  .inside h2 {
832
  display: block !important;
833
  }
834
  #postbox-container-2 {
835
  margin-top: -20px !important;
836
  }
837
  body #poststuff .hndle.ui-sortable-handle {
838
  display: none !important;
839
  }
840
  body #poststuff .handlediv {
841
  display: none !important;
842
  }
843
  #loading {
844
  float: left;
845
  margin-left: 10px;
846
  display: none;
847
  margin-top: 6px;
848
  color: #999;
849
  }
850
  #apiFooter {
851
  background: #F1F1F1;
852
  padding: 20px 0;
853
  padding-bottom: 10px;
854
  }
855
  #apiFooter a:hover {
856
  text-decoration: none;
857
  }
858
  .bootstrap-wp {
859
  overflow: hidden;
860
  border: 10px solid #F1F1F1;
861
  }
862
  .deleteButton {
863
  padding: 5px;
864
  float: left;
865
  color: #777 !important;
866
  font-size: 13px;
867
  }
868
  body .cf_header .btn {
869
  font-size: 13px !important;
870
  padding: 8px 15px;
871
  }
872
  body .btn-selected {
873
  background-color: #0166AE !important;
874
  background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) !important;
875
  text-shadow: 1px 1px 0 #034E82 !important;
876
  font-family: Arial !important;
877
  color: #ffffff !important;
878
  border: solid #1f628d 1px !important;
879
  text-decoration: none !important;
880
  transition: none !important;
881
  }
882
  body label {
883
  font-size: 11px;
884
  opacity: .8;
885
  }
886
  body label i {
887
  padding-left: 10px;
888
  }
889
  .helpinfo {
890
  padding: 20px 40px;
891
  background: #fafafa;
892
  border-top: 1px solid #f2f2f2;
893
  margin: 0 0px;
894
  margin-top: -20px;
895
  margin-bottom: -20px;
896
  }
897
  .helpinfo h4 {
898
  color: #3B474F;
899
  font-size: 15px;
900
  font-weight: 700;
901
  padding-bottom: 10px;
902
  padding-top: 5px;
903
  }
904
  .helpinfo p {
905
  color: #888;
906
  font-weight: 300;
907
  font-size: 12px;
908
  line-height: 19px;
909
  letter-spacing: 1px;
910
  padding-bottom: 0;
911
  }
912
  .helpinfo h4 i {
913
  margin-right: 4px;
914
  }
915
  #message {
916
  width: 758px;
917
  padding: 10px 10px;
918
  display: block;
919
  z-index: 99999;
920
  position: relative;
921
  color: #fff;
922
  border: 1px solid #024D82;
923
  border-bottom: 2px solid #024D82;
924
  text-shadow: 1px 1px 0 #024D82;
925
  padding: 0 10px;
926
  font-size: 16px;
927
  margin-bottom: 0;
928
  border-radius: 5px;
929
  background: #1069AC url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>) repeat;
930
  }
931
  .noAPI {
932
  padding: 10px;
933
  border-bottom: 2px solid #c93f2b;
934
  background: #E64D37;
935
  }
936
  .noAPI h4 {
937
  margin: 0;
938
  padding: 0;
939
  color: #fff;
940
  }
941
  .noAPI h4 a {
942
  color: #fff;
943
  font-weight: normal;
944
  }
945
  .input-xlarge {
946
 
947
  }
948
  .control-group {
949
  padding-left: 25px
950
  }
951
  if ( $cf_page != "" ) {
952
  $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' ) );
953
  $cf_funnels_pages = json_decode( $json );
954
  }
955
  <img src="<?php echo plugins_url( 'logo.png', __FILE__ ); ?>" alt="">
956
  <a href="https://www.clickfunnels.com/users/sign_in" target="_blank" class=""><i class="fa fa-bars"></i> My Account</a>
957
  <br clear="all">
958
  <?php if ( !empty( $_GET['action'] ) ) { ?>
959
  <?php if ( $cf_type=='p' ) {?>
960
  <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>
961
  <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>
962
  <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>
963
  <h2><?php foreach ( $cf_funnels as $key=>$funnel ) { ?>
964
  <?php if ( $cf_thefunnel == $funnel->id ) { echo $funnel->name; } } ?></h2>
965
  <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>
966
  <?php }?>
967
  <?php if ( $cf_type=='hp' ) {?>
968
  <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>
969
  <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>
970
  <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>
971
  <h2>Set as Home Page</h2>
972
  <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>
973
  <?php }?>
974
  <?php if ( $cf_type=='np' ) {?>
975
  <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>
976
  <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>
977
  <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>
978
  <h2>Set as 404 Page</h2>
979
  <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>
980
  <?php }?>
981
  <?php if ( $cf_type=='' ) {?>
982
  <h2>Page Undefined - Create New Page</h2>
983
  <?php }?>
984
  <?php } else { ?>
985
  <h2 style="font-size: 17px;">Add ClickFunnels Page to Your Blog</h2>
986
  <?php } ?>
987
  <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>
988
  <div class="bootstrap-wp" style=" border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;"><?php wp_nonce_field( "save_clickfunnel", "clickfunnel_nonce" ); ?>
989
  <div class="row-fluid form-horizontal">
990
  <br>
991
  <div class="control-group" style="margin-left: 0px; margin-bottom: 20px;">
992
  <div data-target="cf_type" class="btn-group multichoice cf_header">
993
  <a data-value="p" class="btn <?php if ( $cf_type=='p' ) {?> active btn-selected<?php }?>">Regular Page</a>
994
  <a data-value="hp" class="btn <?php if ( $cf_type=='hp' ) {?> active btn-selected<?php }?>">Home Page</a>
995
  <a data-value="np" class="btn <?php if ( $cf_type=='np' ) {?> active btn-selected<?php }?>">404 Page</a>
996
  </div>
997
  <input type="hidden" id="cf_type" name="cf_type"/>
998
  </div>
999
  <br>
1000
  <div class="control-group">
1001
  <label class="control-label" for="cf_thefunnel"> Choose Funnel <i class="fa fa-caret-square-o-down"></i></label>
1002
  <div class="controls">
1003
  <select class="input-xlarge" id="cf_thefunnel" name="cf_thefunnel_backup">
1004
  <?php if ( empty( $cf_funnels ) ) { ?>
1005
  <option value="0">No Funnels Found</option>
1006
  <?php }
1007
  else {
1008
  foreach ( $cf_funnels as $key=>$funnel ) { ?>
1009
  <option value="<?php echo $funnel->id;?>" <?php if ( $cf_thefunnel == $funnel->id ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1010
  <?php
1011
  }
1012
  } ?>
1013
  </select>
1014
  </div>
1015
  </div>
1016
  <div class="control-group">
1017
  <label class="control-label" for="cf_thepage"> Choose Page <i class="fa fa-file-o"></i></label>
1018
  <div class="controls">
1019
  <select class="input-xlarge" id="cf_thepage" name="cf_thepage" style="float: left;">
1020
  <?php if ( empty( $cf_funnels_pages ) ) { ?>
1021
  <option value="0">No Pages Found</option>
1022
  <?php }
1023
  else {
1024
  foreach ( $cf_funnels_pages->funnel_steps as $key => $funnel ) { ?>
1025
  <option value="<?php echo $funnel->position;?>" <?php if ( $cf_thepage == $funnel->position ) { echo "selected"; } ?>><?php echo $funnel->name;?></option>
1026
  <?php
1027
  }
1028
  }
1029
  ?>
1030
  </select>
1031
  <i class="fa fa-spinner fa-spin" id="loading"></i>
1032
  </div>
1033
  <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>
1034
  </div>
1035
  <div class="control-group" id="hiddenStuff" style="display: none">
1036
  <div class="controls">
1037
  <strong>Funnel ID: <span style="font-weight: normal"><?php echo $thepage[0]; ?></span> <br></strong>
1038
  <strong>Page Key: <span style="font-weight: normal"><?php echo $thepage[1]; ?></span><br></strong>
1039
  <strong>Page ID: <span style="font-weight: normal"><?php echo $thepage[2]; ?></span><br></strong>
1040
  <strong>Funnel Step ID: <span style="font-weight: normal"><?php echo $thepage[3]; ?></span><br></strong>
1041
  <strong>Meta: <span style="font-weight: normal"><?php echo $thepage[4]; ?></span><br></strong>
1042
  <strong>Post ID: <span style="font-weight: normal"><?php echo $thepage[5]; ?></span><br></strong>
1043
  <input type="text" name="cf_thefunnel" id="cf_data" value="<?php echo $savedData; ?>" style="width: 400px; padding: 7px; height: 50px; font-size: 18px;" />
1044
  </div>
1045
  </div>
1046
  <?php if ( $cf_type!="p" ) $display ="display:none"; else $display="";?>
1047
  <div class="cf_url control-group" style="<?php echo $display;?>" >
1048
  <label class="control-label" for="cf_slug"> Custom URL <i class="fa fa-external-link"></i></label>
1049
  <div id="cf-wp-path" class="controls ">
1050
  <div class="input-prepend">
1051
  <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">
1052
  <div style="color:red; display:none" id="cf_invalid_slug" style="width: 90%" >You must enter an URL</div>
1053
  </div>
1054
  </div>
1055
  </div>
1056
  <br><br>
1057
  <div class="p_text helpinfo" <?php if ( $cf_type!='p' ) {?> style="display: none" <?php }?>>
1058
  <h4><i class="fa fa-question-circle"></i> Set as a Page</h4>
1059
  <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>
1060
  <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>
1061
  </div>
1062
  <div class="hp_text helpinfo" <?php if ( $cf_type!='hp' ) {?> style="display: none" <?php }?>>
1063
  <h4><i class="fa fa-question-circle"></i> Set as Home Page</h4>
1064
  <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>
1065
  <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>
1066
  </div>
1067
  <div class="np_text helpinfo" <?php if ( $cf_type!='np' ) {?> style="display: none" <?php }?>>
1068
  <h4><i class="fa fa-question-circle"></i> Set as 404 Page</h4>
1069
  <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>
1070
  <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>
1071
  </div>
1072
  <br>
1073
  <div class="row-fluid" id="apiFooter">
1074
  <?php if ( get_option( 'clickfunnels_api_email' ) == "" || get_option( 'clickfunnels_api_auth' ) == "" ) { ?>
1075
  <button id="publish" name="publish" disabled class="button button-primary " style="float: right;">
1076
  <?php if ( !empty( $_GET['action'] ) ) { echo "<i class='fa fa-save'></i> Save Changes"; } else { echo "<i class='fa fa-save'></i> Publish Page"; } ?>
1077
  </button>
1078
  <?php } else { ?>
1079
  <button id="publish" name="publish" 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 } ?>
1083
  <div id="saving" style="float: right;display: none; padding-right: 10px;opacity: .6;padding-top: 5px;">
1084
  <i class="fa fa-spinner fa-spin"></i>
1085
  <span>Saving...</span>
1086
  </div>
1087
  <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>
1088
  <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>
1089
  <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>
1090
  <?php if ( !empty( $delete_link ) ) {?>
1091
  <a class="button button-secondary" id="delete" type="submit" href="<?php echo $delete_link;?>"><i class="fa fa-trash"></i> Delete Page</a>
1092
  <?php }?>
1093
  </div>
1094
  </div>
1095
  </div>
1096
  (function($) {
1097
  setTimeout(function() {
1098
  $('#cf_thepage').trigger( "change" );
1099
  }, 1500);
1100
  })(jQuery);
admin_testing.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <script>
3
+ (function($) {
4
+ setTimeout(function() {
5
+ $('#errorMessage').fadeOut();
6
+ }, 1500);
7
+ var specificFunnel = 'https://api.clickfunnels.com/funnels.json?email=<?php echo get_option( "clickfunnels_api_email" ); ?>&auth_token=<?php echo get_option( "clickfunnels_api_auth" ); ?>';
8
+ $.getJSON(specificFunnel, function(data) {
9
+ $('.checkSuccess').html('<i class="fa fa-check successGreen"></i>');
10
+ $('.checkSuccessDev').html('<i class="fa fa-check"> Connected</i>');
11
+
12
+ }).fail(function(jqXHR) {
13
+ $('.checkSuccess').html('<i class="fa fa-times errorRed"></i>');
14
+ $('.checkSuccessDev').html('<i class="fa fa-times"> Not Connected</i>');
15
+ $('.badAPI').show();
16
+ });
17
+ $('#showDataTesting').click(function() {
18
+ $('#devShowTesting').toggle();
19
+ });
20
+ })(jQuery);
21
+ </script>
22
+ <style>
23
+ #checkPHPStuff {
24
+ padding: 10px 15px;
25
+ background: #272822;
26
+ background-image: url(<?php echo plugins_url( 'geobg.png', __FILE__ ); ?>);
27
+ border-bottom: 3px solid rgba(0,0,0,0.25);
28
+ color: #D3D3C9;
29
+ border-radius: 5px;
30
+ margin:30px 10px;
31
+ float: left;
32
+ margin-left: 195px;
33
+ width: 340px;
34
+ }
35
+ #checkPHPStuff span {
36
+ display: block;
37
+ line-height: 1.6em;
38
+ padding: 4px 0;
39
+ border-bottom: 1px solid rgba(255, 255, 255, .3);
40
+ }
41
+ #checkPHPStuff span strong {
42
+ float: right;
43
+ }
44
+ #checkPHPStuff span strong i.fa-check {
45
+ font-weight: bold;
46
+ color: #8FC742;
47
+ }
48
+ #checkPHPStuff span strong i.fa-times {
49
+ font-weight: bold;
50
+ color: #E34E3D;
51
+ }
52
+ #checkPHPStuff span:last-child {
53
+ border-bottom: none;
54
+ }
55
+
56
+
57
+
58
+ #checkJSONStuff h3, #checkPHPStuff h3 {
59
+ color: #D3D3C9;
60
+ margin: 10px 0;
61
+ font-weight: 200;
62
+ opacity: .5;
63
+ }
64
+
65
+ #adminTesting h2 {
66
+ text-align: center;
67
+ margin: 10px 0;
68
+ margin-bottom: 0;
69
+ width: 760px;
70
+ }
71
+ </style>
72
+ <div id="devShowTesting" style="display: none">
73
+ <br clear="both"><br>
74
+ <div id="adminTesting">
75
+ <h2><i class="fa fa-dashboard"></i> Developer Testing Check PHP and JSON</h2>
76
+ </div>
77
+ <div id="checkPHPStuff" >
78
+ <h3>Test PHP Server Details</h3>
79
+ <span>CURL: <strong><?php echo function_exists('curl_version') ? '<i class="fa fa-check"> Enabled</i>' : '<i class="fa fa-times">Disabled</i>' ?></strong></span>
80
+ <span>File Get Contents: <strong><?php echo file_get_contents(__FILE__) ? '<i class="fa fa-check"> Enabled</i>' : '<i class="fa fa-times">Disabled</i>' ; ?> </strong></span>
81
+ <span>Allow URL fopen: <strong><?php echo ini_get('allow_url_fopen') ? '<i class="fa fa-check"> Enabled</i>' : '<i class="fa fa-times">Disabled</i>' ; ?> </strong></span>
82
+ <span>PHP Version: <strong><?php echo PHP_VERSION; ?> </strong></span>
83
+ <span>API Authorization Connection: <strong class='checkSuccessDev'></strong></span>
84
+ </div>
85
+ </div>
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.3
7
  * Author: Etison, LLC
8
  * Author URI: http://clickfunnels.com
9
  */
@@ -80,6 +80,9 @@ class ClickFunnels {
80
  echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4] );
81
  exit();
82
  }
 
 
 
83
  }
84
  else if ( is_home() ) {
85
  $page = $this->get_home();
@@ -415,4 +418,23 @@ function clickfunnels_loadjquery($hook) {
415
  }
416
  add_action('admin_enqueue_scripts', 'clickfunnels_loadjquery');
417
  $api = new CF_API();
418
- $click = new ClickFunnels( $api );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  */
80
  echo $this->get_page_html( $thepage[0], $thepage[1], $thepage[4] );
81
  exit();
82
  }
83
+ else if (get_option( 'clickfunnels_404Redirect' ) == 'yesRedirect') {
84
+ wp_redirect( get_bloginfo( 'siteurl' ) , 301 );
85
+ }
86
  }
87
  else if ( is_home() ) {
88
  $page = $this->get_home();
418
  }
419
  add_action('admin_enqueue_scripts', 'clickfunnels_loadjquery');
420
  $api = new CF_API();
421
+ $click = new ClickFunnels( $api );
422
+
423
+ function cf_get_file_contents ($url) {
424
+ if (function_exists('curl_exec')){
425
+ $conn = curl_init($url);
426
+ curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, true);
427
+ curl_setopt($conn, CURLOPT_FRESH_CONNECT, true);
428
+ curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
429
+ $url_get_contents_data = (curl_exec($conn));
430
+ curl_close($conn);
431
+ }elseif(function_exists('file_get_contents')){
432
+ $url_get_contents_data = file_get_contents($url);
433
+ }elseif(function_exists('fopen') && function_exists('stream_get_contents')){
434
+ $handle = fopen ($url, "r");
435
+ $url_get_contents_data = stream_get_contents($handle);
436
+ }else{
437
+ $url_get_contents_data = false;
438
+ }
439
+ return $url_get_contents_data;
440
+ }
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.3</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.4</strong> Copyright 2015+ &copy; Eitson, LLC</p>
3
  </div>
4
  <style>
5
  .copyrightInfo {
readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://clickfunnels.com/
5
  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.3
10
 
11
  Connect your ClickFunnels pages to your Wordpress blog. Create custom pages, set as homepage or 404 page with easy setup.
12
 
@@ -94,6 +94,11 @@ By re-selecting the page it will ping the server which should refresh your page.
94
 
95
  Stay current with the latest version of the plugin:
96
 
 
 
 
 
 
97
  = Version: 1.0.3 =
98
 
99
  * Fix Blank Homepage (caused by template_include)
5
  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
 
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
100
+ * Added developer testing for easier error reporting
101
+
102
  = Version: 1.0.3 =
103
 
104
  * Fix Blank Homepage (caused by template_include)