WordPress Landing Pages - Version 1.8.3

Version Description

  • Fixing white screen of death issues with other plugin conflicts
  • Improvements on NoConflict jQuery Class
Download this release

Release Info

Developer adbox
Plugin Icon 128x128 WordPress Landing Pages
Version 1.8.3
Comparing to
See all releases

Code changes from version 1.8.2 to 1.8.3

js/admin/admin.landing-page-list.js CHANGED
@@ -1,86 +1,86 @@
1
- InboundQuery(document).ready(function($) {
2
  // Code for landing page list view
3
- var cats = InboundQuery("#landing_page_category option").length;
4
  if ( cats === 0 ){
5
- InboundQuery("#landing_page_category").hide();
6
  }
7
 
8
- InboundQuery('.lp-letter').each(function(){
9
- var draft = InboundQuery(this).text();
10
  if ( draft === "" ){
11
- InboundQuery(this).parent().parent().hide();
12
  }
13
  });
14
 
15
- InboundQuery(".lp-impress-num").each(function(){
16
- var empty = InboundQuery(this).text();
17
  if ( empty === "" || empty === "0" ){
18
- InboundQuery(this).parent().parent().find(".lp-letter").css("color", "#ccc");
19
- InboundQuery(this).parent().html("<span class='lp-no-stats'>no stats yet</span>");
20
  }
21
  });
22
  /* List tour */
23
  var tourbutton = '<a class="" id="lp-tour" style="font-size:13px;">Need help? Take the tour</a>';
24
- InboundQuery(tourbutton).appendTo("h2:eq(0)");
25
- InboundQuery("body").on('click', '#lp-tour', function () {
26
- var tour = InboundQuery("#lp-tour-style").length;
27
  if ( tour === 0 ) {
28
- InboundQuery('head').append("<link rel='stylesheet' id='lp-tour-style' href='/wp-content/plugins/landing-pages/css/admin-tour.css' type='text/css' /><script type='text/javascript' src='/wp-content/plugins/landing-pages/js/admin/tour/tour.post-list.js'></script><script type='text/javascript' src='/wp-content/plugins/landing-pages/js/admin/intro.js'></script>");
29
  }
30
  setTimeout(function() {
31
  introJs().start(); // start tour
32
  }, 300);
33
 
34
  });
35
- /*InboundQuery(".lp-varation-stat-ul").each(function(){
36
- var length = InboundQuery(this).find("li").length;
37
  if ( length < 3 ){
38
- InboundQuery(this).find("li").first().css("padding-top", "18px");
39
  }
40
  });
41
  */
42
- InboundQuery("body").on('mouseenter', 'tr.type-landing-page', function () {
43
- InboundQuery(this).find(".no-stats-yet").show();
44
  });
45
- InboundQuery("body").on('mouseleave', 'tr.type-landing-page', function () {
46
- InboundQuery(this).find(".no-stats-yet").hide();
47
  });
48
- InboundQuery(".variation-winner-is").each(function(){
49
- var target = InboundQuery(this).text();
50
- InboundQuery("." + target).addClass("winner-lp").attr("data-lp", "Current Winner");
51
  });
52
 
53
  var hidestats = "<span id='hide-stats'>(Hide Stats)</span><span class='show-stats show-stats-top'>Show Stats</span>";
54
- InboundQuery("#stats").append(hidestats);
55
 
56
- InboundQuery("body").on('click', '#hide-stats', function () {
57
- InboundQuery(".lp-varation-stat-ul").each(function(){
58
- InboundQuery(this).hide();
59
  });
60
- InboundQuery(".show-stats").show();
61
- InboundQuery("#hide-stats").hide();
62
  });
63
 
64
- InboundQuery("body").on('click', '.show-stats-top', function () {
65
- InboundQuery(".lp-varation-stat-ul").each(function(){
66
- InboundQuery(this).show();
67
  });
68
- InboundQuery(".show-stats").hide();
69
- InboundQuery("#hide-stats").show();
70
  });
71
 
72
- InboundQuery("body").on('click', '.show-stats', function () {
73
- InboundQuery(this).hide();
74
- InboundQuery(this).parent().find(".lp-varation-stat-ul").show();
75
  });
76
 
77
- InboundQuery('.lp-letter, .cr-number, .qtip').on('mouseenter', function(event) {
78
  // Bind the qTip within the event handler
79
- var text_in_tip = InboundQuery(this).attr("data-notes");
80
- var letter = InboundQuery(this).attr("data-letter");
81
- var status = "<span class='lp-paused'>" + InboundQuery(this).parent().attr("rel") + "</span>";
82
- var winner = "<span class='lp-win'>" + InboundQuery(this).parent().attr("data-lp") + "</span>";
83
- InboundQuery(this).qtip({
84
  overwrite: false, // Make sure the tooltip won't be overridden once created
85
  content: {
86
  text: text_in_tip,
@@ -91,7 +91,7 @@ InboundQuery("body").on('mouseleave', 'tr.type-landing-page', function () {
91
  position: {
92
  my: 'bottom center', // Use the corner...
93
  at: 'top center', // ...and opposite corner
94
- viewport: InboundQuery(window)
95
  },
96
  style: {
97
  classes: 'qtip-shadow qtip-jtools',
@@ -106,21 +106,21 @@ InboundQuery("body").on('mouseleave', 'tr.type-landing-page', function () {
106
  }, event); // Pass through our original event to qTip
107
  })
108
 
109
- InboundQuery('.lp-letter').on('mouseleave', function(event) {
110
 
111
 
112
  });
113
 
114
- InboundQuery("body").on("click", ".lp-pop-close", function(event) {
115
- InboundQuery(this).parent().parent().parent().hide();
116
  });
117
 
118
- InboundQuery("body").on("click", ".lp-pop-preview a", function(event) {
119
- InboundQuery(this).parent().parent().parent().parent().hide();
120
  });
121
 
122
  // Fix Thickbox width/hieght
123
- InboundQuery(function($) {
124
  tb_position = function() {
125
  var tbWindow = $('#TB_window');
126
  var width = $(window).width();
@@ -146,7 +146,7 @@ InboundQuery("body").on('mouseleave', 'tr.type-landing-page', function () {
146
 
147
  };
148
 
149
- InboundQuery('a.thickbox').click(function(){
150
  if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
151
  tinyMCE.get('content').focus();
152
  tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
1
+ jQuery(document).ready(function($) {
2
  // Code for landing page list view
3
+ var cats = jQuery("#landing_page_category option").length;
4
  if ( cats === 0 ){
5
+ jQuery("#landing_page_category").hide();
6
  }
7
 
8
+ jQuery('.lp-letter').each(function(){
9
+ var draft = jQuery(this).text();
10
  if ( draft === "" ){
11
+ jQuery(this).parent().parent().hide();
12
  }
13
  });
14
 
15
+ jQuery(".lp-impress-num").each(function(){
16
+ var empty = jQuery(this).text();
17
  if ( empty === "" || empty === "0" ){
18
+ jQuery(this).parent().parent().find(".lp-letter").css("color", "#ccc");
19
+ jQuery(this).parent().html("<span class='lp-no-stats'>no stats yet</span>");
20
  }
21
  });
22
  /* List tour */
23
  var tourbutton = '<a class="" id="lp-tour" style="font-size:13px;">Need help? Take the tour</a>';
24
+ jQuery(tourbutton).appendTo("h2:eq(0)");
25
+ jQuery("body").on('click', '#lp-tour', function () {
26
+ var tour = jQuery("#lp-tour-style").length;
27
  if ( tour === 0 ) {
28
+ jQuery('head').append("<link rel='stylesheet' id='lp-tour-style' href='/wp-content/plugins/landing-pages/css/admin-tour.css' type='text/css' /><script type='text/javascript' src='/wp-content/plugins/landing-pages/js/admin/tour/tour.post-list.js'></script><script type='text/javascript' src='/wp-content/plugins/landing-pages/js/admin/intro.js'></script>");
29
  }
30
  setTimeout(function() {
31
  introJs().start(); // start tour
32
  }, 300);
33
 
34
  });
35
+ /*jQuery(".lp-varation-stat-ul").each(function(){
36
+ var length = jQuery(this).find("li").length;
37
  if ( length < 3 ){
38
+ jQuery(this).find("li").first().css("padding-top", "18px");
39
  }
40
  });
41
  */
42
+ jQuery("body").on('mouseenter', 'tr.type-landing-page', function () {
43
+ jQuery(this).find(".no-stats-yet").show();
44
  });
45
+ jQuery("body").on('mouseleave', 'tr.type-landing-page', function () {
46
+ jQuery(this).find(".no-stats-yet").hide();
47
  });
48
+ jQuery(".variation-winner-is").each(function(){
49
+ var target = jQuery(this).text();
50
+ jQuery("." + target).addClass("winner-lp").attr("data-lp", "Current Winner");
51
  });
52
 
53
  var hidestats = "<span id='hide-stats'>(Hide Stats)</span><span class='show-stats show-stats-top'>Show Stats</span>";
54
+ jQuery("#stats").append(hidestats);
55
 
56
+ jQuery("body").on('click', '#hide-stats', function () {
57
+ jQuery(".lp-varation-stat-ul").each(function(){
58
+ jQuery(this).hide();
59
  });
60
+ jQuery(".show-stats").show();
61
+ jQuery("#hide-stats").hide();
62
  });
63
 
64
+ jQuery("body").on('click', '.show-stats-top', function () {
65
+ jQuery(".lp-varation-stat-ul").each(function(){
66
+ jQuery(this).show();
67
  });
68
+ jQuery(".show-stats").hide();
69
+ jQuery("#hide-stats").show();
70
  });
71
 
72
+ jQuery("body").on('click', '.show-stats', function () {
73
+ jQuery(this).hide();
74
+ jQuery(this).parent().find(".lp-varation-stat-ul").show();
75
  });
76
 
77
+ jQuery('.lp-letter, .cr-number, .qtip').on('mouseenter', function(event) {
78
  // Bind the qTip within the event handler
79
+ var text_in_tip = jQuery(this).attr("data-notes");
80
+ var letter = jQuery(this).attr("data-letter");
81
+ var status = "<span class='lp-paused'>" + jQuery(this).parent().attr("rel") + "</span>";
82
+ var winner = "<span class='lp-win'>" + jQuery(this).parent().attr("data-lp") + "</span>";
83
+ jQuery(this).qtip({
84
  overwrite: false, // Make sure the tooltip won't be overridden once created
85
  content: {
86
  text: text_in_tip,
91
  position: {
92
  my: 'bottom center', // Use the corner...
93
  at: 'top center', // ...and opposite corner
94
+ viewport: jQuery(window)
95
  },
96
  style: {
97
  classes: 'qtip-shadow qtip-jtools',
106
  }, event); // Pass through our original event to qTip
107
  })
108
 
109
+ jQuery('.lp-letter').on('mouseleave', function(event) {
110
 
111
 
112
  });
113
 
114
+ jQuery("body").on("click", ".lp-pop-close", function(event) {
115
+ jQuery(this).parent().parent().parent().hide();
116
  });
117
 
118
+ jQuery("body").on("click", ".lp-pop-preview a", function(event) {
119
+ jQuery(this).parent().parent().parent().parent().hide();
120
  });
121
 
122
  // Fix Thickbox width/hieght
123
+ jQuery(function($) {
124
  tb_position = function() {
125
  var tbWindow = $('#TB_window');
126
  var width = $(window).width();
146
 
147
  };
148
 
149
+ jQuery('a.thickbox').click(function(){
150
  if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
151
  tinyMCE.get('content').focus();
152
  tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
landing-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Landing Pages
4
  Plugin URI: http://www.inboundnow.com/landing-pages/
5
  Description: The first true all-in-one Landing Page solution for WordPress, including ongoing conversion metrics, a/b split testing, unlimited design options and so much more!
6
- Version: 1.8.2
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
  Text Domain: landing-pages
@@ -105,7 +105,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
105
  */
106
  private static function load_constants() {
107
 
108
- define('LANDINGPAGES_CURRENT_VERSION', '1.8.2' );
109
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
110
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
111
  define('LANDINGPAGES_PLUGIN_SLUG', plugin_basename( dirname(__FILE__) ) );
3
  Plugin Name: Landing Pages
4
  Plugin URI: http://www.inboundnow.com/landing-pages/
5
  Description: The first true all-in-one Landing Page solution for WordPress, including ongoing conversion metrics, a/b split testing, unlimited design options and so much more!
6
+ Version: 1.8.3
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
  Text Domain: landing-pages
105
  */
106
  private static function load_constants() {
107
 
108
+ define('LANDINGPAGES_CURRENT_VERSION', '1.8.3' );
109
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
110
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
111
  define('LANDINGPAGES_PLUGIN_SLUG', plugin_basename( dirname(__FILE__) ) );
modules/module.click-tracking.php CHANGED
@@ -3,47 +3,60 @@ add_action('wp_footer', 'lp_click_callback');
3
 
4
  function lp_click_callback() {
5
  global $post;
6
- if (!isset($post))
 
7
  return;
 
 
8
  $id = $post->ID;
 
9
  if(get_post_type( $id ) == 'landing-page'){
10
- $variation = (isset($_GET['lp-variation-id'])) ? $_GET['lp-variation-id'] : 0;
11
- $variation = preg_replace('/[^-a-zA-Z0-9_]/', '', $variation);
12
- // Footer script for link rewrites ?>
13
- <script type="text/javascript">
14
- InboundQuery(document).ready(function($) {
15
- var lead_cpt_id = _inbound.Utils.readCookie("wp_lead_id");
16
- var lead_email = _inbound.Utils.readCookie("wp_lead_email");
17
- var lead_unique_key = _inbound.Utils.readCookie("wp_lead_uid");
 
 
 
18
 
19
- if (typeof (lead_cpt_id) != "undefined" && lead_cpt_id !== null) {
20
- string = "&wpl_id=" + lead_cpt_id + "&l_type=wplid";
21
- } else if (typeof (lead_email) != "undefined" && lead_email !== null && lead_email !== "") {
22
- string = "&wpl_id=" + lead_email + "&l_type=wplemail";
23
- } else if (typeof (lead_unique_key) != "undefined" && lead_unique_key !== null && lead_unique_key !== "") {
24
- string = "&wpl_id=" + lead_unique_key + "&l_type=wpluid";
25
- } else {
26
- string = "";
27
- }
28
- var external = RegExp('^((f|ht)tps?:)?//(?!' + location.host + ')');
29
- InboundQuery('.link-click-tracking a, .inbound-special-class').not("#wpadminbar a").each(function () {
30
- InboundQuery(this).attr("data-event-id", '<?php echo $id; ?>').attr("data-cta-varation", '<?php echo $variation;?>');
31
- var orignalurl = InboundQuery(this).attr("href");
32
- //InboundQuery("a[href*='http://']:not([href*='"+window.location.hostname+"'])"); // rewrite external links
33
- var link_is = external.test(orignalurl);
34
- if (link_is === true) {
35
- base_url = window.location.origin;
36
- } else {
37
- base_url = orignalurl;
38
- }
39
- var cta_variation = "&wp-cta-v=" + InboundQuery(this).attr("data-cta-varation");
40
- var this_id = InboundQuery(this).attr("data-event-id");
41
- var newurl = base_url + "?lp_redirect_" + this_id + "=" + orignalurl + cta_variation + string;
42
- InboundQuery(this).attr("href", newurl);
43
- });
44
- });
 
 
 
 
 
45
  </script>
46
- <?php }
 
47
  }
48
 
49
  // Register CTA Clicks
@@ -110,6 +123,7 @@ function lp_click_track_redirect() {
110
  $link = preg_replace('/(?<=wpl_id)(.*)(?=&)/s', '', $link); // clean url
111
  $link = preg_replace('/&wpl_id&l_type=(\D*)/', '', $link); // clean url2
112
  $link = preg_replace('/&wp-cta-v=(\d*)/', '', $link); // clean url3
 
113
  // Redirect
114
  header("HTTP/1.1 302 Temporary Redirect");
115
  header("Location:" . $link);
@@ -197,4 +211,3 @@ function lp_store_click_data_to_lead($landing_page_id, $lead_ID, $lp_variation)
197
  }
198
  }
199
 
200
- ?>
3
 
4
  function lp_click_callback() {
5
  global $post;
6
+
7
+ if (!isset($post)) {
8
  return;
9
+ }
10
+
11
  $id = $post->ID;
12
+
13
  if(get_post_type( $id ) == 'landing-page'){
14
+
15
+ $variation = (isset($_GET['lp-variation-id'])) ? $_GET['lp-variation-id'] : 0;
16
+ $variation = preg_replace('/[^-a-zA-Z0-9_]/', '', $variation);
17
+ // Footer script for link rewrites
18
+ ?>
19
+ <script type="text/javascript">
20
+ jQuery(document).ready(function($) {
21
+
22
+ var lead_cpt_id = _inbound.Utils.readCookie("wp_lead_id");
23
+ var lead_email = _inbound.Utils.readCookie("wp_lead_email");
24
+ var lead_unique_key = _inbound.Utils.readCookie("wp_lead_uid");
25
 
26
+ if (typeof (lead_cpt_id) != "undefined" && lead_cpt_id !== null) {
27
+ string = "&wpl_id=" + lead_cpt_id + "&l_type=wplid";
28
+ } else if (typeof (lead_email) != "undefined" && lead_email !== null && lead_email !== "") {
29
+ string = "&wpl_id=" + lead_email + "&l_type=wplemail";
30
+ } else if (typeof (lead_unique_key) != "undefined" && lead_unique_key !== null && lead_unique_key !== "") {
31
+ string = "&wpl_id=" + lead_unique_key + "&l_type=wpluid";
32
+ } else {
33
+ string = "";
34
+ }
35
+
36
+ var external = RegExp('^((f|ht)tps?:)?//(?!' + location.host + ')');
37
+ jQuery('.link-click-tracking a, .inbound-special-class').not("#wpadminbar a").each(function () {
38
+ jQuery(this).attr("data-event-id", '<?php echo $id; ?>').attr("data-cta-varation", '<?php echo $variation;?>');
39
+
40
+ var orignalurl = jQuery(this).attr("href");
41
+
42
+ //jQuery("a[href*='http://']:not([href*='"+window.location.hostname+"'])"); // rewrite external links
43
+ var link_is = external.test(orignalurl);
44
+
45
+ if (link_is === true) {
46
+ base_url = window.location.origin;
47
+ } else {
48
+ base_url = orignalurl;
49
+ }
50
+
51
+ var cta_variation = "&wp-cta-v=" + jQuery(this).attr("data-cta-varation");
52
+ var this_id = jQuery(this).attr("data-event-id");
53
+ var newurl = base_url + "?lp_redirect_" + this_id + "=" + encodeURIComponent( orignalurl ) + cta_variation + string;
54
+ jQuery(this).attr("href", newurl);
55
+ });
56
+ });
57
  </script>
58
+ <?php
59
+ }
60
  }
61
 
62
  // Register CTA Clicks
123
  $link = preg_replace('/(?<=wpl_id)(.*)(?=&)/s', '', $link); // clean url
124
  $link = preg_replace('/&wpl_id&l_type=(\D*)/', '', $link); // clean url2
125
  $link = preg_replace('/&wp-cta-v=(\d*)/', '', $link); // clean url3
126
+ $link = urldecode( $link );
127
  // Redirect
128
  header("HTTP/1.1 302 Temporary Redirect");
129
  header("Location:" . $link);
211
  }
212
  }
213
 
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
  Requires at least: 3.8
9
  Tested up to: 4.1
10
- Stable Tag: 1.8.2
11
 
12
  Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
13
 
@@ -73,6 +73,10 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 1.8.2 =
77
  * Debugging release issues with 1.8.1
78
  * Security Update
7
  Tags: landing pages, inbound marketing, conversion pages, split testing, a b test, a b testing, a/b test, a/b testing, coming soon page, email list, landing page, list building, maintenance page, squeeze page, inbound now, landing-pages, splash pages, cpa, click tracking, goal tracking, analytics, free landing page templates
8
  Requires at least: 3.8
9
  Tested up to: 4.1
10
+ Stable Tag: 1.8.3
11
 
12
  Create landing pages for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own templates and more.
13
 
73
 
74
  == Changelog ==
75
 
76
+ = 1.8.3 =
77
+ * Fixing white screen of death issues with other plugin conflicts
78
+ * Improvements on NoConflict jQuery Class
79
+
80
  = 1.8.2 =
81
  * Debugging release issues with 1.8.1
82
  * Security Update
shared/assets/js/frontend/analytics-src/analytics.events.js CHANGED
@@ -87,10 +87,10 @@ var _inboundEvents = (function(_inbound) {
87
  }
88
 
89
  function triggerJQueryEvent(eventName, data) {
90
- if (window.InboundQuery) {
91
  var data = data || {};
92
  /*! try catch here */
93
- InboundQuery(document).trigger(eventName, data);
94
  }
95
  };
96
 
87
  }
88
 
89
  function triggerJQueryEvent(eventName, data) {
90
+ if (window.jQuery) {
91
  var data = data || {};
92
  /*! try catch here */
93
+ jQuery(document).trigger(eventName, data);
94
  }
95
  };
96
 
shared/assets/js/frontend/analytics-src/analytics.utils.js CHANGED
@@ -382,7 +382,7 @@ var _inboundUtils = (function(_inbound) {
382
  result = localStorage.getItem(mod) === mod.toString();
383
  localStorage.removeItem(mod);
384
  return result;
385
- } catch (_error) {}
386
  };
387
  */
388
  },
382
  result = localStorage.getItem(mod) === mod.toString();
383
  localStorage.removeItem(mod);
384
  return result;
385
+ } catch (_error) {}
386
  };
387
  */
388
  },
shared/assets/js/frontend/analytics/inboundAnalytics.js CHANGED
@@ -917,7 +917,7 @@ var _inboundUtils = (function(_inbound) {
917
  result = localStorage.getItem(mod) === mod.toString();
918
  localStorage.removeItem(mod);
919
  return result;
920
- } catch (_error) {}
921
  };
922
  */
923
  },
@@ -2395,10 +2395,10 @@ var _inboundEvents = (function(_inbound) {
2395
  }
2396
 
2397
  function triggerJQueryEvent(eventName, data) {
2398
- if (window.InboundQuery) {
2399
  var data = data || {};
2400
  /*! try catch here */
2401
- InboundQuery(document).trigger(eventName, data);
2402
  }
2403
  };
2404
 
917
  result = localStorage.getItem(mod) === mod.toString();
918
  localStorage.removeItem(mod);
919
  return result;
920
+ } catch (_error) {}
921
  };
922
  */
923
  },
2395
  }
2396
 
2397
  function triggerJQueryEvent(eventName, data) {
2398
+ if (window.jQuery) {
2399
  var data = data || {};
2400
  /*! try catch here */
2401
+ jQuery(document).trigger(eventName, data);
2402
  }
2403
  };
2404
 
shared/assets/js/frontend/analytics/inboundAnalytics.min.js CHANGED
@@ -1,3 +1,3 @@
1
  /*! Inbound Analyticsv1.0.0 | (c) 2015 Inbound Now | https://github.com/inboundnow/cta */
2
- var inbound_data=inbound_data||{},_inboundOptions=_inboundOptions||{},_gaq=_gaq||[],_inbound=function(e){var t={timeout:3e4,formAutoTracking:!0,formAutoPopulation:!0},n={init:function(){_inbound.Utils.init(),_inbound.Utils.domReady(window,function(){_inbound.DomLoaded()})},DomLoaded:function(){_inbound.PageTracking.init(),_inbound.Forms.init(),_inbound.Utils.setUrlParams(),_inbound.LeadsAPI.init(),setTimeout(function(){_inbound.Forms.init()},2e3),_inbound.trigger("analytics_ready")},extend:function(e,t){var n,i={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i},debug:function(){},deBugger:function(e,t,n){if(console){var i,o,a,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(r=r.split("-"),a=r[1]),o="true"===_inbound.Utils.readCookie("inbound_debug")?!0:!1,i="true"===_inbound.Utils.readCookie("inbound_debug_"+e)?!0:!1,(i||s||o)&&(t&&"string"==typeof t&&(o||"all"===a?console.log('logAll "'+e+'" =>',t):i?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},i=n.extend(t,e);return n.Settings=i||{},n}(_inboundOptions),_inboundHooks=function(e){var t=function(){function e(e,t,n,i){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("actions",e,t,n,i)),c}function t(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&u("actions",t,e),c}function n(e,t){return"string"==typeof e&&r("actions",e,t),c}function i(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),c}function o(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?u("filters",t,e):c}function a(e,t){return"string"==typeof e&&r("filters",e,t),c}function r(e,t,n,i){if(d[e][t])if(n){var o,a=d[e][t];if(i)for(o=a.length;o--;){var r=a[o];r.callback===n&&r.context===i&&a.splice(o,1)}else for(o=a.length;o--;)a[o].callback===n&&a.splice(o,1)}else d[e][t]=[]}function s(e,t,n,i,o){var a={callback:n,priority:i,context:o},r=d[e][t];r?(r.push(a),r=l(r)):r=[a],d[e][t]=r}function l(e){for(var t,n,i,o=1,a=e.length;a>o;o++){for(t=e[o],n=o;(i=e[n-1])&&i.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function u(e,t,n){var i=d[e][t];if(!i)return"filters"===e?n[0]:!1;var o=0,a=i.length;if("filters"===e)for(;a>o;o++)n[0]=i[o].callback.apply(i[o].context,n);else for(;a>o;o++)i[o].callback.apply(i[o].context,n);return"filters"===e?n[0]:!0}var c={removeFilter:a,applyFilters:o,addFilter:i,removeAction:n,doAction:t,addAction:e},d={actions:{},filters:{}};return c};return e.hooks=new t,e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,i=(Object.prototype.toString,("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,"")),o={api_host:i,track_pageview:!0,track_links_timeout:300,cookie_name:"_sp",cookie_expiration:365,cookie_domain:(host=location.hostname.match(/[a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6}$/i))?host[0]:""};return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||!function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(n){this.CustomEvent=function(e,t){function n(n,o){var a=document.createEvent(e);return null!==n?i.call(a,n,(o||(o=t)).bubbles,o.cancelable,o.detail):a.initCustomEvent=i,a}function i(t,n,i,o){this["init"+e](t,n,i,o),"detail"in this||(this.detail=o)}return n}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),i=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)t=document._qsa.shift(),t.style.removeAttribute("x-qsa"),i.push(t);return document._qsa=null,i}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],i=0;i<t.rangeCount;i++)n[i]=t.getRangeAt(i);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(var i=0;i<n.length;i++)t.addRange(n[i]);return e})},createCookie:function(e,t,n){var i="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),i="; expires="+o.toGMTString()}document.cookie=e+"="+t+i+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null},eraseCookie:function(e){this.createCookie(e,"",-1)},getAllCookies:function(){var t={};if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i].split("=");o[0]=o[0].replace(/^ /,""),t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},i=window.location.search.substring(1),o=/([^&=]+)=?([^&]*)/g;e=o.exec(i);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var a=e[1].indexOf("["),r=e[1].slice(a+1,e[1].indexOf("]",a)),s=t(e[1].slice(0,a));"object"!=typeof n[s]&&(n[t(s)]={},n[t(s)].length=0),r?n[t(s)][t(r)]=t(e[2]):Array.prototype.push.call(n[t(s)],t(e[2]))}}();for(var i in n)if("object"==typeof n[i])for(var o in n[i])this.createCookie(o,n[i][o],30);else this.createCookie(i,n[i],30);if(t){var a=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(a,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){var n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof ls||"undefined"==typeof window.JSON?!1:!0}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}function n(t){return{name:t,size:e(localStorage[t])}}function i(e){return e.size=t(e.size).toFixed(2)+" MB",e}var o=Object.keys(localStorage).map(n).map(i);console.table(o)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=10>t?"0":"",i=e.getFullYear(),o=e.getHours(),a=10>o?"0":"",r=e.getMinutes(),s=10>r?"0":"",l=e.getSeconds(),u=10>l?"0":"",c=e.getMonth()+1,d=10>c?"0":"",m=i+"/"+d+c+"/"+n+t+" "+a+o+":"+s+r+":"+u+l;return m},SetSessionTimeout:function(){var e=(this.readCookie("lead_session_expire"),new Date);e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",i=e.Utils.readCookie("inbound_referral_site"),o=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),i||this.createCookie("inbound_referral_site",n,t),o||e.totalStorage("inbound_original_referral",o)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var i=0;e>i;i++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n},hasClass:function(e,t){var n;if("classList"in document.documentElement)var n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(i){}return e},ajaxSendData:function(e,t,n,i){var o=this.ajaxPolyFill();setTimeout(function(){o.open(n,e,!0),o.onreadystatechange=function(){4==o.readyState&&t(o.responseText)},"POST"==n&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.send(i)},100)},ajaxGet:function(e,t,n,i){var o=[];for(var a in t)o.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+o.join("&"),n,"GET",null,i)},ajaxPost:function(e,t,n,i){var o=[];for(var a in t)o.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",o.join("&"),i)},sendEvent:function(e,t,i){t=t||{},async=!0;var a=getCookie();if(a){var r;for(r in a)t[r]=a[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var c=document.createElement("script");c.type="text/javascript",c.async=async,c.defer=async,c.src=l;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d)}return action(i),self},domReady:function(e,t){var n=!1,i=!0,o=e.document,a=o.documentElement,r=o.addEventListener?"addEventListener":"attachEvent",s=o.addEventListener?"removeEventListener":"detachEvent",l=o.addEventListener?"":"on",u=function(i){("readystatechange"!=i.type||"complete"==o.readyState)&&(("load"==i.type?e:o)[s](l+i.type,u,!1),!n&&(n=!0)&&t.call(e,i.type||i))},c=function(){try{a.doScroll("left")}catch(e){return setTimeout(c,50),void 0}u("poll")};if("complete"==o.readyState)t.call(e,"lazy");else{if(o.createEventObject&&a.doScroll){try{i=!e.frameElement}catch(d){}i&&c()}o[r](l+"DOMContentLoaded",u,!1),o[r](l+"readystatechange",u,!1),e[r](l+"load",u,!1)}},addListener:function(e,t,n){e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},removeListener:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},throttle:function(e,t){var n,i,o,a=null,r=0,s=function(){r=new Date,a=null,o=e.apply(n,i)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,i=arguments,0>=u?(clearTimeout(a),a=null,r=l,o=e.apply(n,i)):a||(a=setTimeout(s,u)),o}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)}},e}(_inbound||{}),InboundForms=function(e){var t=!1,n=e.Utils,o=[],a=[],r=[],s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.assignTrackClass(),e.Forms.formTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,n){if(t&&console){var e=e||!1;e&&"string"==typeof e&&console.log(e),n&&n instanceof Function&&n()}},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=!1,n=window.document.forms[e];n.dataset.formProcessed||(n.dataset.formProcessed=!0,t=this.checkTrackStatus(n),t&&(this.attachFormSubmitEvent(n),this.initFormMapping(n)))}},checkTrackStatus:function(t){var n=t.getAttribute("class");return""!==n&&null!==n?n.toLowerCase().indexOf("wpl-track-me")>-1?!0:n.toLowerCase().indexOf("inbound-track")>-1?!0:(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1):void 0},assignTrackClass:function(){if(window.inbound_settings){if(inbound_settings.inbound_track_include){var t=inbound_settings.inbound_track_include.split(","),n="add selectors "+inbound_settings.inbound_track_include;e.deBugger("forms",n),this.loopClassSelectors(t,"add")}if(inbound_settings.inbound_track_exclude){var t=inbound_settings.inbound_track_exclude.split(","),n="remove selectors "+inbound_settings.inbound_track_exclude;e.deBugger("forms",n),this.loopClassSelectors(t,"remove")}}},loopClassSelectors:function(t,i){for(var o=t.length-1;o>=0;o--){var a=n.trim(t[o]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),a=document.querySelector(a),a&&("add"===i?(e.Utils.addClass("wpl-track-me",a),e.Utils.addClass("inbound-track",a)):(e.Utils.removeClass("wpl-track-me",a),e.Utils.removeClass("inbound-track",a)))}},initFormMapping:function(t){for(var n=[],i=0;i<t.elements.length;i++)formInput=t.elements[i],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&!e.Utils.hasClass("nopopulate",t)&&this.fillInputValues(formInput)):n.push(formInput);for(var o=n.length-1;o>=0;o--)formInput=n[o],this.mapField(formInput)},mapField:function(t){var a=t.id||!1,r=t.name||!1,s=this.getInputLabel(t);if(s){var u=this.ignoreFieldByLabel(s[0].innerText);if(u)return t.dataset.ignoreFormField=!0,!1}for(i=0;i<l.length;i++){var c=!1,d=l[i],m=n.trim(d),f=m.replace(/ /g,"_");r&&r.toLowerCase().indexOf(m)>-1?(c=!0,e.deBugger("forms","Found matching name attribute for -> "+m)):a&&a.toLowerCase().indexOf(m)>-1?(c=!0,e.deBugger("forms","Found matching ID attribute for ->"+m)):s?s[0].innerText.toLowerCase().indexOf(m)>-1&&(c=!0,e.deBugger("forms","Found matching sibling label for -> "+m)):o.push(m),c&&(this.addDataAttr(t,f),this.removeArrayItem(l,m),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},attachFormSubmitEvent:function(e){n.addListener(e,"submit",this.formListener);var t=document.querySelector(".inbound-email");n.addListener(t,"blur",this.mailCheck)},ignoreFieldByLabel:function(t){var n=!1;return t?((-1!=t.toLowerCase().indexOf("credit card")||-1!=t.toLowerCase().indexOf("card number"))&&(n=!0),(-1!=t.toLowerCase().indexOf("expiration")||-1!=t.toLowerCase().indexOf("expiry"))&&(n=!0),("month"==t.toLowerCase()||"mm"==t.toLowerCase()||"yy"==t.toLowerCase()||"yyyy"==t.toLowerCase()||"year"==t.toLowerCase())&&(n=!0),(-1!=t.toLowerCase().indexOf("cvv")||-1!=t.toLowerCase().indexOf("cvc")||-1!=t.toLowerCase().indexOf("secure code")||-1!=t.toLowerCase().indexOf("security code"))&&(n=!0),n&&e.deBugger("forms","ignore "+t),n):!1},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;("visa"==e.toLowerCase()||"mastercard"==e.toLowerCase()||"american express"==e.toLowerCase()||"amex"==e.toLowerCase()||"discover"==e.toLowerCase())&&(t=!0);var n=new RegExp("/^[0-9]+$/");if(n.test(e)){var i=e.replace(" ","");this.isInt(i)&&i.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1===0},releaseFormSubmit:function(e){document.body.style.cursor="default",n.removeClass("wpl-track-me",e),n.removeListener(e,"submit",this.formListener);var t=e.getAttribute("class");return""!==t&&null!==t&&-1!=t.toLowerCase().indexOf("wpcf7-form")?(setTimeout(function(){document.body.style.cursor="default"},300),!0):(e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3),void 0)},saveFormData:function(t){for(var i=i||{},o=0;o<t.elements.length;o++)if(formInput=t.elements[o],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(l=this.getInputValue(formInput),l===!1)continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var c=i[u].value,d=i[u].map;if("undefined"!=typeof c&&null!=c&&""!=c&&a.push(u+"="+i[u].value.join(",")),"undefined"!=typeof d&&null!=d&&i[u].value&&(r.push(d+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=a.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=r.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g);var m=n.getParameterVal("email",g)||n.readCookie("wp_lead_email");m||(m=n.getParameterVal("wpleads_email_address",g));var p=n.getParameterVal("name",g),v=n.getParameterVal("first_name",g),h=n.getParameterVal("last_name",g);if(!h&&v){var _=decodeURI(v).split(" ");_.length>0&&(v=_[0],h=_[1])}if(p&&!h&&!v){var _=decodeURI(p).split(" ");_.length>0&&(v=_[0],h=_[1])}p=v&&h?v+" "+h:p,v||(v=""),h||(h=""),e.deBugger("forms","fName = "+v),e.deBugger("forms","lName = "+h),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{};if("undefined"!=typeof landing_path_info)var w=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)var w=cta_path_info.variation;else var w=0;var k=inbound_settings.post_type||"page",C=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:v,last_name:h,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:k,page_id:C,variation:w,source:n.readCookie("inbound_referral_site")},callback=function(i){e.deBugger("forms","Lead Created with ID: "+i),i=parseInt(i,10),formData.leadID=i,i&&(n.createCookie("wp_lead_id",i),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(t)},e.trigger("form_before_submission",formData),n.ajaxPost(inbound_settings.admin_url,formData,callback)},rememberInputValues:function(t){var i=(t.name?"inbound_"+t.name:"",t.type?t.type:"text");return"submit"===i||"hidden"===i||"file"===i||"password"===i||t.dataset.ignoreFormField?!1:(n.addListener(t,"change",function(t){if(t.target.name){if("checkbox"!==i)var o=t.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+t.target.name+'"]'),s=0;s<r.length;s++){var l=r[s].checked;l&&a.push(r[s].value),o=a.join(",")}inputData={name:t.target.name,node:t.target.nodeName.toLowerCase(),type:i,value:o,mapping:t.target.dataset.mapFormField},e.trigger("form_input_change",inputData),n.createCookie("inbound_"+t.target.name,encodeURIComponent(o))}}),void 0)},fillInputValues:function(e){var t=e.name?"inbound_"+e.name:"",i=e.type?e.type:"text";if("submit"===i||"hidden"===i||"file"===i||"password"===i)return!1;if(n.readCookie(t)&&"comment"!=t)if(value=decodeURIComponent(n.readCookie(t)),"checkbox"===i||"radio"===i)for(var o=value.split(","),a=0;a<o.length;a++)e.value.indexOf(o[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:(t=this.CheckParentForLabel(e))?t:!1},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),i=n.length-1;i>=0;i--)e.dataset.mapFormField||(n[i].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],i=t.length-1;i>=0;i--)"label"===t[i].nodeName.toLowerCase()&&n.push(t[i]);return n.length>0&&n.length<2?n:!1},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(n.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(t){var i=document.querySelector(".email_suggestion");i&&n.removeElement(i);var o=document.createElement("span");o.innerHTML="<span class=\"email_suggestion\">Did you mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+t.full+"</b></i>?</span>",e.parentNode.insertBefore(o,e.nextSibling);var a=document.getElementById("email_correction");n.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},"undefined"==typeof u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,i=e.empty||t,o=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return o?n(o):i()},suggest:function(e,t,n,i){e=e.toLowerCase();var o=this.splitEmail(e),a=this.findClosestDomain(o.domain,t,i,this.domainThreshold);if(a){if(a!=o.domain)return{address:o.address,domain:a,full:o.address+"@"+a}}else{var r=this.findClosestDomain(o.topLevelDomain,n,i,this.topLevelThreshold);if(o.domain&&r&&r!=o.topLevelDomain){var s=o.domain;return a=s.substring(0,s.lastIndexOf(o.topLevelDomain))+r,{address:o.address,domain:a,full:o.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,i){i=i||this.topLevelThreshold;var o,a=99,r=null;if(!e||!t)return!1;n||(n=this.sift3Distance);for(var s=0;s<t.length;s++){if(e===t[s])return e;o=n(e,t[s]),a>o&&(a=o,r=t[s])}return i>=a&&null!==r?r:!1},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,i=0,o=0,a=0,r=5;n+i<e.length&&n+o<t.length;){if(e.charAt(n+i)==t.charAt(n+o))a++;else{i=0,o=0;for(var s=0;r>s;s++){if(n+s<e.length&&e.charAt(n+s)==t.charAt(n)){i=s;break}if(n+s<t.length&&e.charAt(n)==t.charAt(n+s)){o=s;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(var n=0;n<t.length;n++)if(""===t[n])return!1;var i=t.pop(),o=i.split("."),a="";if(0===o.length)return!1;if(1==o.length)a=o[0];else{for(var n=1;n<o.length;n++)a+=o[n]+".";o.length>=2&&(a=a.substring(0,a.length-1))}return{topLevelDomain:a,domain:i,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,i,o){var i=i||{};o=o||{},o.bubbles=o.bubbles||!0,o.cancelable=o.cancelable||!0,i=e.apply_filters("filter_"+t,i);!window.ActiveXObject&&"ActiveXObject"in window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:i,bubbles:o.bubbles,cancelable:o.cancelable});else{var a=document.createEvent("Event");a.initEvent(t,!0,!0)}window.dispatchEvent(a),e.do_action(t,i),n(t,i)}function n(e,t){if(window.InboundQuery){var t=t||{};InboundQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){var e={opt1:!0},n={data:"xyxy"};t("analytics_ready",n,e)},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){var n={clock:e,leadData:InboundLeadData};t("session_heartbeat",n)},page_visit:function(e){t("page_view",e)},page_first_visit:function(){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);var i=function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")};e.deBugger("pages",status,i)},tab_hidden:function(){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){var i=function(){console.log(n)};e.deBugger("forms","inputData change. Data=",i),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},analyticsError:function(e,t,n){var i=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(i),console.log("Page Save Error")}},e}(_inbound||{}),InboundTotalStorage=function(e){var t,n,i="_inbound";if("localStorage"in window)try{n="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof n||"undefined"==typeof window.JSON?!1:!0,window.localStorage.setItem(i,"1"),window.localStorage.removeItem(i)}catch(o){t=!1}e.totalStorage=function(t,n){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return"undefined"!=typeof t?this.setItem(e,t):this.getItem(e)},setItem:function(i,o){if(!t)try{return e.Utils.createCookie(i,o),o}catch(a){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var r=JSON.stringify(o);return n.setItem(i,r),this.parseResult(r)},getItem:function(i){if(!t)try{return this.parseResult(e.Utils.readCookie(i))}catch(o){return null}var a=n.getItem(i);return this.parseResult(a)},deleteItem:function(i){if(!t)try{return e.Utils.eraseCookie(i,null),!0}catch(o){return!1}return n.removeItem(i),!0},getAll:function(){var i=[];if(t)for(var o in n)o.length&&i.push({key:o,value:this.parseResult(n.getItem(o))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("="),l=s[0];i.push({key:l,value:this.parseResult(e.Utils.readCookie(l))})}}catch(u){return null}return i},parseResult:function(e){var t;try{t=JSON.parse(e),"undefined"==typeof t&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id")),i=t.readCookie("lead_session_expire");i||(e.deBugger("leads","expired vistor. Run Processes"),n&&(e.LeadsAPI.getAllLeadData(),e.LeadsAPI.getLeadLists()))},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.totalStorage("inbound_lead_data"),i=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:t},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var i=new Date;i.setTime(i.getTime()+18e5);var o=e.Utils.addDays(i,3);e.Utils.createCookie("lead_data_expire",!0,o)},n?(e.LeadsAPI.setGlobalLeadData(n),e.deBugger("lead","Set Global Lead Data from Localstorage"),i||(e.Utils.ajaxPost(inbound_settings.admin_url,data,success),e.deBugger("lead","localized data old. Pull new from DB"))):e.Utils.ajaxPost(inbound_settings.admin_url,data,success)},getLeadLists:function(){var t=e.Utils.readCookie("wp_lead_id"),n={action:"wpl_check_lists",wp_lead_id:t},i=function(){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")};e.Utils.ajaxPost(inbound_settings.admin_url,n,i)}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,i=!1,o=!1,a=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,c=null,d=e.Utils,m=e.Utils.GetDate(),f="undefined"!=typeof wp?"admin_page_views":"page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,v=e.Settings.timeout||3e4;return e.PageTracking={init:function(i){return"page_views"!==f?!1:(this.CheckTimeOut(),i=i||{},t=parseInt(i.reportInterval,10)||10,n=parseInt(i.idleTimeout,10)||3,d.addListener(document,"keydown",d.throttle(e.PageTracking.pingSession,1e3)),d.addListener(document,"click",d.throttle(e.PageTracking.pingSession,1e3)),d.addListener(window,"mousemove",d.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession(),void 0)},setIdle:function(t){var t=t||"No Movement",n="Session IDLE. Activity Timeout due to "+t;
3
  e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n,i;"undefined"!=typeof document.hidden?(t="hidden",i="visibilitychange",n="visibilityState"):"undefined"!=typeof document.mozHidden?(t="mozHidden",i="mozvisibilitychange",n="mozVisibilityState"):"undefined"!=typeof document.msHidden?(t="msHidden",i="msvisibilitychange",n="msVisibilityState"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",i="webkitvisibilitychange",n="webkitVisibilityState");var o=document[t];e.Utils.addListener(document,i,function(){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){r+=1;var n=r/60,i="Total time spent on Page in this Session: "+n.toFixed(2)+" min";if(e.deBugger("pages",i),r>0&&r%t===0){var o=new Date;o.setTime(o.getTime()+18e5),d.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){s+=1;var t=(1800-s)/60,n="Time until Session Timeout: "+t.toFixed(2)+" min";e.deBugger("pages",n),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){o=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){o=!1,e.trigger("session_resume"),e.deBugger("pages","Activity resumed. Session Active"),clearTimeout(l),s=0,clearTimeout(u),l=setInterval(e.PageTracking.clock,1e3)},turnOff:function(){e.PageTracking.setIdle(),a=!0},turnOn:function(){a=!1},startSession:function(){new Date;i=!0,l=setInterval(e.PageTracking.clock,1e3);var t=d.readCookie("lead_session");if(t)e.trigger("session_active");else{e.trigger("session_start");var n=new Date;n.setTime(n.getTime()+18e5),e.Utils.createCookie("lead_session",1,n)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(i||e.PageTracking.startSession(),o&&e.PageTracking.restartClock(),clearTimeout(c),c=setTimeout(e.PageTracking.setIdle,1e3*n+100),"undefined"!=typeof t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){var t=e.Utils.checkLocalStorage();if(t){var n=localStorage.getItem(f),i=JSON.parse(n);return i}},isRevisit:function(e){var t=!1,e=e||{},n=e[p];return"undefined"!=typeof n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g),this.storePageView()},CheckTimeOut:function(){var t,n,i=this.isRevisit(g);if(i){var o=g[p].length-1,a=g[p][o],r=Math.abs(new Date(a).getTime()-new Date(m).getTime());n=r>v,n?(t="Timeout Happened. Page view fired",this.triggerPageView(i)):(time_left=.001*Math.abs(v-r),t=v/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(i);e.deBugger("pages",t)},storePageView:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.Utils.readCookie("wp_lead_uid");if(t){var i={action:"wpl_track_user",wp_lead_uid:n,wp_lead_id:t,page_id:inbound_settings.post_id,current_url:window.location.href,json:"0"},o=function(){};e.Utils.ajaxPost(inbound_settings.admin_url,i,o)}}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
1
  /*! Inbound Analyticsv1.0.0 | (c) 2015 Inbound Now | https://github.com/inboundnow/cta */
2
+ var inbound_data=inbound_data||{},_inboundOptions=_inboundOptions||{},_gaq=_gaq||[],_inbound=function(e){var t={timeout:3e4,formAutoTracking:!0,formAutoPopulation:!0},n={init:function(){_inbound.Utils.init(),_inbound.Utils.domReady(window,function(){_inbound.DomLoaded()})},DomLoaded:function(){_inbound.PageTracking.init(),_inbound.Forms.init(),_inbound.Utils.setUrlParams(),_inbound.LeadsAPI.init(),setTimeout(function(){_inbound.Forms.init()},2e3),_inbound.trigger("analytics_ready")},extend:function(e,t){var n,i={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n]);return i},debug:function(){},deBugger:function(e,t,n){if(console){var i,o,a,r=document.location.hash?document.location.hash:"",s=r.indexOf("#debug")>-1,t=t||!1;r&&r.match(/debug/)&&(r=r.split("-"),a=r[1]),o="true"===_inbound.Utils.readCookie("inbound_debug")?!0:!1,i="true"===_inbound.Utils.readCookie("inbound_debug_"+e)?!0:!1,(i||s||o)&&(t&&"string"==typeof t&&(o||"all"===a?console.log('logAll "'+e+'" =>',t):i?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},i=n.extend(t,e);return n.Settings=i||{},n}(_inboundOptions),_inboundHooks=function(e){var t=function(){function e(e,t,n,i){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("actions",e,t,n,i)),c}function t(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&u("actions",t,e),c}function n(e,t){return"string"==typeof e&&r("actions",e,t),c}function i(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),c}function o(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?u("filters",t,e):c}function a(e,t){return"string"==typeof e&&r("filters",e,t),c}function r(e,t,n,i){if(d[e][t])if(n){var o,a=d[e][t];if(i)for(o=a.length;o--;){var r=a[o];r.callback===n&&r.context===i&&a.splice(o,1)}else for(o=a.length;o--;)a[o].callback===n&&a.splice(o,1)}else d[e][t]=[]}function s(e,t,n,i,o){var a={callback:n,priority:i,context:o},r=d[e][t];r?(r.push(a),r=l(r)):r=[a],d[e][t]=r}function l(e){for(var t,n,i,o=1,a=e.length;a>o;o++){for(t=e[o],n=o;(i=e[n-1])&&i.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function u(e,t,n){var i=d[e][t];if(!i)return"filters"===e?n[0]:!1;var o=0,a=i.length;if("filters"===e)for(;a>o;o++)n[0]=i[o].callback.apply(i[o].context,n);else for(;a>o;o++)i[o].callback.apply(i[o].context,n);return"filters"===e?n[0]:!0}var c={removeFilter:a,applyFilters:o,addFilter:i,removeAction:n,doAction:t,addAction:e},d={actions:{},filters:{}};return c};return e.hooks=new t,e.add_action=function(){var t=arguments[0].split(" ");for(k in t)arguments[0]="inbound."+t[k],e.hooks.addAction.apply(this,arguments);return this},e.remove_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeAction.apply(this,arguments),this},e.do_action=function(){return arguments[0]="inbound."+arguments[0],e.hooks.doAction.apply(this,arguments),this},e.add_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.addFilter.apply(this,arguments),this},e.remove_filter=function(){return arguments[0]="inbound."+arguments[0],e.hooks.removeFilter.apply(this,arguments),this},e.apply_filters=function(){return arguments[0]="inbound."+arguments[0],e.hooks.applyFilters.apply(this,arguments)},e}(_inbound||{}),_inboundUtils=function(e){var t,n=window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,i=(Object.prototype.toString,("https:"==location.protocol?"https://":"http://")+location.hostname+location.pathname.replace(/\/$/,"")),o={api_host:i,track_pageview:!0,track_links_timeout:300,cookie_name:"_sp",cookie_expiration:365,cookie_domain:(host=location.hostname.match(/[a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6}$/i))?host[0]:""};return e.Utils={init:function(){this.polyFills(),this.checkLocalStorage(),this.SetUID(),this.storeReferralData()},polyFills:function(){window.console||(window.console={});for(var e=["log","info","warn","error","debug","trace","dir","group","groupCollapsed","groupEnd","time","timeEnd","profile","profileEnd","dirxml","assert","count","markTimeline","timeStamp","clear"],t=0;t<e.length;t++)window.console[e[t]]||(window.console[e[t]]=function(){});Date.prototype.toISOString||!function(){function e(e){var t=String(e);return 1===t.length&&(t="0"+t),t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+e(this.getUTCMonth()+1)+"-"+e(this.getUTCDate())+"T"+e(this.getUTCHours())+":"+e(this.getUTCMinutes())+":"+e(this.getUTCSeconds())+"."+String((this.getUTCMilliseconds()/1e3).toFixed(3)).slice(2,5)+"Z"}}();try{new CustomEvent("?")}catch(n){this.CustomEvent=function(e,t){function n(n,o){var a=document.createEvent(e);return null!==n?i.call(a,n,(o||(o=t)).bubbles,o.cancelable,o.detail):a.initCustomEvent=i,a}function i(t,n,i,o){this["init"+e](t,n,i,o),"detail"in this||(this.detail=o)}return n}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),i=[];for(document.documentElement.firstChild.appendChild(n),document._qsa=[],n.styleSheet.cssText=e+"{x-qsa:expression(document._qsa && document._qsa.push(this))}",window.scrollBy(0,0),n.parentNode.removeChild(n);document._qsa.length;)t=document._qsa.shift(),t.style.removeAttribute("x-qsa"),i.push(t);return document._qsa=null,i}),document.querySelector||(document.querySelector=function(e){var t=document.querySelectorAll(e);return t.length?t[0]:null}),!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var e,t=window.getSelection(),n=[],i=0;i<t.rangeCount;i++)n[i]=t.getRangeAt(i);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(var i=0;i<n.length;i++)t.addRange(n[i]);return e})},createCookie:function(e,t,n){var i="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),i="; expires="+o.toGMTString()}document.cookie=e+"="+t+i+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null},eraseCookie:function(e){this.createCookie(e,"",-1)},getAllCookies:function(){var t={};if(document.cookie&&""!==document.cookie)for(var n=document.cookie.split(";"),i=0;i<n.length;i++){var o=n[i].split("=");o[0]=o[0].replace(/^ /,""),t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},i=window.location.search.substring(1),o=/([^&=]+)=?([^&]*)/g;e=o.exec(i);)if("-1"==e[1].indexOf("["))n[t(e[1])]=t(e[2]);else{var a=e[1].indexOf("["),r=e[1].slice(a+1,e[1].indexOf("]",a)),s=t(e[1].slice(0,a));"object"!=typeof n[s]&&(n[t(s)]={},n[t(s)].length=0),r?n[t(s)][t(r)]=t(e[2]):Array.prototype.push.call(n[t(s)],t(e[2]))}}();for(var i in n)if("object"==typeof n[i])for(var o in n[i])this.createCookie(o,n[i][o],30);else this.createCookie(i,n[i],30);if(t){var a=e.totalStorage("inbound_url_params")||{},r=this.mergeObjs(a,n);e.totalStorage("inbound_url_params",r)}var s={option1:"yo",option2:"woooo"};e.trigger("url_parameters",n,s)},getAllUrlParams:function(){var n={};if(t)var n=e.totalStorage("inbound_url_params");return n},getParameterVal:function(e,t){return(RegExp(e+"=(.+?)(&|$)").exec(t)||[,!1])[1]},checkLocalStorage:function(){if("localStorage"in window)try{ls="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof ls||"undefined"==typeof window.JSON?!1:!0}catch(e){t=!1}return t},showLocalStorageSize:function(){function e(e){return 2*e.length}function t(e){return e/1024/1024}function n(t){return{name:t,size:e(localStorage[t])}}function i(e){return e.size=t(e.size).toFixed(2)+" MB",e}var o=Object.keys(localStorage).map(n).map(i);console.table(o)},addDays:function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},GetDate:function(){var e=new Date,t=e.getDate(),n=10>t?"0":"",i=e.getFullYear(),o=e.getHours(),a=10>o?"0":"",r=e.getMinutes(),s=10>r?"0":"",l=e.getSeconds(),u=10>l?"0":"",c=e.getMonth()+1,d=10>c?"0":"",m=i+"/"+d+c+"/"+n+t+" "+a+o+":"+s+r+":"+u+l;return m},SetSessionTimeout:function(){var e=(this.readCookie("lead_session_expire"),new Date);e.setTime(e.getTime()+18e5),this.createCookie("lead_session_expire",!0,e)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",i=e.Utils.readCookie("inbound_referral_site"),o=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),i||this.createCookie("inbound_referral_site",n,t),o||e.totalStorage("inbound_original_referral",o)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var i=0;e>i;i++)n+=t[Math.floor(Math.random()*t.length)];return n},generateGUID:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,guid)},SetUID:function(e){if(!this.readCookie("wp_lead_uid")){var t=e||this.CreateUID(35);this.createCookie("wp_lead_uid",t)}},countProperties:function(e){var t=0;for(var n in e)e.hasOwnProperty(n)&&++t;return t},mergeObjs:function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n},hasClass:function(e,t){var n;if("classList"in document.documentElement)var n=t.classList.contains(e);else var n=new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className);return n},addClass:function(e,t){"classList"in document.documentElement?t.classList.add(e):this.hasClass(t,e)||(t.className+=(t.className?" ":"")+e)},removeClass:function(e,t){"classList"in document.documentElement?t.classList.remove(e):this.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)*"+e+"(\\s|$)*","g"),""))},removeElement:function(e){e.parentNode.removeChild(e)},trim:function(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,"\n")},ajaxPolyFill:function(){if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;for(var e,t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"],n=0;n<t.length;n++)try{e=new ActiveXObject(t[n]);break}catch(i){}return e},ajaxSendData:function(e,t,n,i){var o=this.ajaxPolyFill();setTimeout(function(){o.open(n,e,!0),o.onreadystatechange=function(){4==o.readyState&&t(o.responseText)},"POST"==n&&o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.send(i)},100)},ajaxGet:function(e,t,n,i){var o=[];for(var a in t)o.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+o.join("&"),n,"GET",null,i)},ajaxPost:function(e,t,n,i){var o=[];for(var a in t)o.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",o.join("&"),i)},sendEvent:function(e,t,i){t=t||{},async=!0;var a=getCookie();if(a){var r;for(r in a)t[r]=a[r]}t.id||(t.id=getId());var s={e:e,t:(new Date).toISOString(),kv:t},l=o.api_host+"/track?data="+encodeURIComponent(JSON.stringify(s));if(n){var u=new XMLHttpRequest;u.open("GET",l,async),u.withCredentials=async,u.send(null)}else{var c=document.createElement("script");c.type="text/javascript",c.async=async,c.defer=async,c.src=l;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d)}return action(i),self},domReady:function(e,t){var n=!1,i=!0,o=e.document,a=o.documentElement,r=o.addEventListener?"addEventListener":"attachEvent",s=o.addEventListener?"removeEventListener":"detachEvent",l=o.addEventListener?"":"on",u=function(i){("readystatechange"!=i.type||"complete"==o.readyState)&&(("load"==i.type?e:o)[s](l+i.type,u,!1),!n&&(n=!0)&&t.call(e,i.type||i))},c=function(){try{a.doScroll("left")}catch(e){return setTimeout(c,50),void 0}u("poll")};if("complete"==o.readyState)t.call(e,"lazy");else{if(o.createEventObject&&a.doScroll){try{i=!e.frameElement}catch(d){}i&&c()}o[r](l+"DOMContentLoaded",u,!1),o[r](l+"readystatechange",u,!1),e[r](l+"load",u,!1)}},addListener:function(e,t,n){e&&(e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n)},removeListener:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},throttle:function(e,t){var n,i,o,a=null,r=0,s=function(){r=new Date,a=null,o=e.apply(n,i)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,i=arguments,0>=u?(clearTimeout(a),a=null,r=l,o=e.apply(n,i)):a||(a=setTimeout(s,u)),o}},checkTypeofGA:function(){"function"==typeof ga&&(universalGA=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(classicGA=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(googleTagManager=!0)}},e}(_inbound||{}),InboundForms=function(e){var t=!1,n=e.Utils,o=[],a=[],r=[],s=e.Settings,l=["first name","last name","name","email","e-mail","phone","website","job title","your favorite food","company","tele","address","comment"];if(e.Forms={init:function(){e.Forms.runFieldMappingFilters(),e.Forms.assignTrackClass(),e.Forms.formTrackInit()},runFieldMappingFilters:function(){l=e.hooks.applyFilters("forms.field_map",l)},debug:function(e,n){if(t&&console){var e=e||!1;e&&"string"==typeof e&&console.log(e),n&&n instanceof Function&&n()}},formTrackInit:function(){for(var e=0;e<window.document.forms.length;e++){var t=!1,n=window.document.forms[e];n.dataset.formProcessed||(n.dataset.formProcessed=!0,t=this.checkTrackStatus(n),t&&(this.attachFormSubmitEvent(n),this.initFormMapping(n)))}},checkTrackStatus:function(t){var n=t.getAttribute("class");return""!==n&&null!==n?n.toLowerCase().indexOf("wpl-track-me")>-1?!0:n.toLowerCase().indexOf("inbound-track")>-1?!0:(cb=function(){console.log(t)},e.deBugger("forms","This form not tracked. Please assign on in settings...",cb),!1):void 0},assignTrackClass:function(){if(window.inbound_settings){if(inbound_settings.inbound_track_include){var t=inbound_settings.inbound_track_include.split(","),n="add selectors "+inbound_settings.inbound_track_include;e.deBugger("forms",n),this.loopClassSelectors(t,"add")}if(inbound_settings.inbound_track_exclude){var t=inbound_settings.inbound_track_exclude.split(","),n="remove selectors "+inbound_settings.inbound_track_exclude;e.deBugger("forms",n),this.loopClassSelectors(t,"remove")}}},loopClassSelectors:function(t,i){for(var o=t.length-1;o>=0;o--){var a=n.trim(t[o]);-1===a.indexOf("#")&&-1===a.indexOf(".")&&(a="#"+a),a=document.querySelector(a),a&&("add"===i?(e.Utils.addClass("wpl-track-me",a),e.Utils.addClass("inbound-track",a)):(e.Utils.removeClass("wpl-track-me",a),e.Utils.removeClass("inbound-track",a)))}},initFormMapping:function(t){for(var n=[],i=0;i<t.elements.length;i++)formInput=t.elements[i],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&!e.Utils.hasClass("nopopulate",t)&&this.fillInputValues(formInput)):n.push(formInput);for(var o=n.length-1;o>=0;o--)formInput=n[o],this.mapField(formInput)},mapField:function(t){var a=t.id||!1,r=t.name||!1,s=this.getInputLabel(t);if(s){var u=this.ignoreFieldByLabel(s[0].innerText);if(u)return t.dataset.ignoreFormField=!0,!1}for(i=0;i<l.length;i++){var c=!1,d=l[i],m=n.trim(d),f=m.replace(/ /g,"_");r&&r.toLowerCase().indexOf(m)>-1?(c=!0,e.deBugger("forms","Found matching name attribute for -> "+m)):a&&a.toLowerCase().indexOf(m)>-1?(c=!0,e.deBugger("forms","Found matching ID attribute for ->"+m)):s?s[0].innerText.toLowerCase().indexOf(m)>-1&&(c=!0,e.deBugger("forms","Found matching sibling label for -> "+m)):o.push(m),c&&(this.addDataAttr(t,f),this.removeArrayItem(l,m),i--)}return inbound_data},formListener:function(t){t.preventDefault(),e.Forms.saveFormData(t.target),document.body.style.cursor="wait"},attachFormSubmitEvent:function(e){n.addListener(e,"submit",this.formListener);var t=document.querySelector(".inbound-email");n.addListener(t,"blur",this.mailCheck)},ignoreFieldByLabel:function(t){var n=!1;return t?((-1!=t.toLowerCase().indexOf("credit card")||-1!=t.toLowerCase().indexOf("card number"))&&(n=!0),(-1!=t.toLowerCase().indexOf("expiration")||-1!=t.toLowerCase().indexOf("expiry"))&&(n=!0),("month"==t.toLowerCase()||"mm"==t.toLowerCase()||"yy"==t.toLowerCase()||"yyyy"==t.toLowerCase()||"year"==t.toLowerCase())&&(n=!0),(-1!=t.toLowerCase().indexOf("cvv")||-1!=t.toLowerCase().indexOf("cvc")||-1!=t.toLowerCase().indexOf("secure code")||-1!=t.toLowerCase().indexOf("security code"))&&(n=!0),n&&e.deBugger("forms","ignore "+t),n):!1},ignoreFieldByValue:function(e){var t=!1;if(!e)return!1;("visa"==e.toLowerCase()||"mastercard"==e.toLowerCase()||"american express"==e.toLowerCase()||"amex"==e.toLowerCase()||"discover"==e.toLowerCase())&&(t=!0);var n=new RegExp("/^[0-9]+$/");if(n.test(e)){var i=e.replace(" ","");this.isInt(i)&&i.length>=16&&(t=!0)}return t},isInt:function(e){return"number"==typeof e&&isFinite(e)&&e%1===0},releaseFormSubmit:function(e){document.body.style.cursor="default",n.removeClass("wpl-track-me",e),n.removeListener(e,"submit",this.formListener);var t=e.getAttribute("class");return""!==t&&null!==t&&-1!=t.toLowerCase().indexOf("wpcf7-form")?(setTimeout(function(){document.body.style.cursor="default"},300),!0):(e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&"submit"===formInput.name&&e.elements[t].click()},2e3),void 0)},saveFormData:function(t){for(var i=i||{},o=0;o<t.elements.length;o++)if(formInput=t.elements[o],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),i[inputName]||(i[inputName]={}),formInput.type&&(i[inputName].type=formInput.type),i[inputName].name||(i[inputName].name=formInput.name),formInput.dataset.mapFormField&&(i[inputName].map=formInput.dataset.mapFormField),formInput.nodeName){case"INPUT":if(l=this.getInputValue(formInput),l===!1)continue;break;case"TEXTAREA":l=formInput.value;break;case"SELECT":if(formInput.multiple){values=[],multiple=!0;for(var s=0;s<formInput.length;s++)formInput[s].selected&&values.push(encodeURIComponent(formInput[s].value))}else l=formInput.value}if(e.deBugger("forms","Input Value = "+l),l){i[inputName].value||(i[inputName].value=[]),i[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",i);for(var u in i){var c=i[u].value,d=i[u].map;if("undefined"!=typeof c&&null!=c&&""!=c&&a.push(u+"="+i[u].value.join(",")),"undefined"!=typeof d&&null!=d&&i[u].value&&(r.push(d+"="+i[u].value.join(",")),"email"===u))var m=i[u].value.join(",")}var f=a.join("&");e.deBugger("forms","Stringified Raw Form PARAMS: "+f);var g=r.join("&");e.deBugger("forms","Stringified Mapped PARAMS"+g);var m=n.getParameterVal("email",g)||n.readCookie("wp_lead_email");m||(m=n.getParameterVal("wpleads_email_address",g));var p=n.getParameterVal("name",g),v=n.getParameterVal("first_name",g),h=n.getParameterVal("last_name",g);if(!h&&v){var _=decodeURI(v).split(" ");_.length>0&&(v=_[0],h=_[1])}if(p&&!h&&!v){var _=decodeURI(p).split(" ");_.length>0&&(v=_[0],h=_[1])}p=v&&h?v+" "+h:p,v||(v=""),h||(h=""),e.deBugger("forms","fName = "+v),e.deBugger("forms","lName = "+h),e.deBugger("forms","fullName = "+p);var b=e.totalStorage("page_views")||{},y=e.totalStorage("inbound_url_params")||{};if("undefined"!=typeof landing_path_info)var w=landing_path_info.variation;else if("undefined"!=typeof cta_path_info)var w=cta_path_info.variation;else var w=0;var k=inbound_settings.post_type||"page",C=inbound_settings.post_id||0;search_data={},formData={action:"inbound_lead_store",email:m,full_name:p,first_name:v,last_name:h,raw_params:f,mapped_params:g,url_params:JSON.stringify(y),search_data:"test",page_views:JSON.stringify(b),post_type:k,page_id:C,variation:w,source:n.readCookie("inbound_referral_site")},callback=function(i){e.deBugger("forms","Lead Created with ID: "+i),i=parseInt(i,10),formData.leadID=i,i&&(n.createCookie("wp_lead_id",i),e.totalStorage.deleteItem("page_views"),e.totalStorage.deleteItem("tracking_events")),e.trigger("form_after_submission",formData),e.Forms.releaseFormSubmit(t)},e.trigger("form_before_submission",formData),n.ajaxPost(inbound_settings.admin_url,formData,callback)},rememberInputValues:function(t){var i=(t.name?"inbound_"+t.name:"",t.type?t.type:"text");return"submit"===i||"hidden"===i||"file"===i||"password"===i||t.dataset.ignoreFormField?!1:(n.addListener(t,"change",function(t){if(t.target.name){if("checkbox"!==i)var o=t.target.value;else for(var a=[],r=document.querySelectorAll('input[name="'+t.target.name+'"]'),s=0;s<r.length;s++){var l=r[s].checked;l&&a.push(r[s].value),o=a.join(",")}inputData={name:t.target.name,node:t.target.nodeName.toLowerCase(),type:i,value:o,mapping:t.target.dataset.mapFormField},e.trigger("form_input_change",inputData),n.createCookie("inbound_"+t.target.name,encodeURIComponent(o))}}),void 0)},fillInputValues:function(e){var t=e.name?"inbound_"+e.name:"",i=e.type?e.type:"text";if("submit"===i||"hidden"===i||"file"===i||"password"===i)return!1;if(n.readCookie(t)&&"comment"!=t)if(value=decodeURIComponent(n.readCookie(t)),"checkbox"===i||"radio"===i)for(var o=value.split(","),a=0;a<o.length;a++)e.value.indexOf(o[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},getInputLabel:function(e){var t;return(t=this.siblingsIsLabel(e))?t:(t=this.CheckParentForLabel(e))?t:!1},getInputValue:function(e){var t=!1;switch(e.type){case"radio":case"checkbox":e.checked&&(t=e.value);break;case"text":case"hidden":default:t=e.value}return t},addDataAttr:function(e,t){for(var n=document.getElementsByName(e.name),i=n.length-1;i>=0;i--)e.dataset.mapFormField||(n[i].dataset.mapFormField=t)},removeArrayItem:function(e,t){if(e.indexOf)index=e.indexOf(t);else for(index=e.length-1;index>=0&&e[index]!==t;--index);index>=0&&e.splice(index,1)},siblingsIsLabel:function(e){for(var t=this.getSiblings(e),n=[],i=t.length-1;i>=0;i--)"label"===t[i].nodeName.toLowerCase()&&n.push(t[i]);return n.length>0&&n.length<2?n:!1},getChildren:function(e,t){for(var n=[];e;e=e.nextSibling)1==e.nodeType&&e!=t&&n.push(e);return n},getSiblings:function(e){return this.getChildren(e.parentNode.firstChild,e)},CheckParentForLabel:function(e){if("FORM"===e.nodeName)return null;do{var t=e.getElementsByTagName("label");if(t.length>0&&t.length<2)return e.getElementsByTagName("label")}while(e=e.parentNode);return null},mailCheck:function(){var e=document.querySelector(".inbound-email");e&&(n.addListener(e,"blur",this.mailCheck),u.run({email:document.querySelector(".inbound-email").value,suggested:function(t){var i=document.querySelector(".email_suggestion");i&&n.removeElement(i);var o=document.createElement("span");o.innerHTML="<span class=\"email_suggestion\">Did you mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+t.full+"</b></i>?</span>",e.parentNode.insertBefore(o,e.nextSibling);var a=document.getElementById("email_correction");n.addListener(a,"click",function(){e.value=a.innerHTML,a.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}},"undefined"==typeof u)var u={domainThreshold:1,topLevelThreshold:3,defaultDomains:["yahoo.com","google.com","hotmail.com","gmail.com","me.com","aol.com","mac.com","live.com","comcast.net","googlemail.com","msn.com","hotmail.co.uk","yahoo.co.uk","facebook.com","verizon.net","sbcglobal.net","att.net","gmx.com","mail.com","outlook.com","icloud.com"],defaultTopLevelDomains:["co.jp","co.uk","com","net","org","info","edu","gov","mil","ca","de"],run:function(e){e.domains=e.domains||u.defaultDomains,e.topLevelDomains=e.topLevelDomains||u.defaultTopLevelDomains,e.distanceFunction=e.distanceFunction||u.sift3Distance;var t=function(e){return e},n=e.suggested||t,i=e.empty||t,o=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return o?n(o):i()},suggest:function(e,t,n,i){e=e.toLowerCase();var o=this.splitEmail(e),a=this.findClosestDomain(o.domain,t,i,this.domainThreshold);if(a){if(a!=o.domain)return{address:o.address,domain:a,full:o.address+"@"+a}}else{var r=this.findClosestDomain(o.topLevelDomain,n,i,this.topLevelThreshold);if(o.domain&&r&&r!=o.topLevelDomain){var s=o.domain;return a=s.substring(0,s.lastIndexOf(o.topLevelDomain))+r,{address:o.address,domain:a,full:o.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,i){i=i||this.topLevelThreshold;var o,a=99,r=null;if(!e||!t)return!1;n||(n=this.sift3Distance);for(var s=0;s<t.length;s++){if(e===t[s])return e;o=n(e,t[s]),a>o&&(a=o,r=t[s])}return i>=a&&null!==r?r:!1},sift3Distance:function(e,t){if(null===e||0===e.length)return null===t||0===t.length?0:t.length;if(null===t||0===t.length)return e.length;for(var n=0,i=0,o=0,a=0,r=5;n+i<e.length&&n+o<t.length;){if(e.charAt(n+i)==t.charAt(n+o))a++;else{i=0,o=0;for(var s=0;r>s;s++){if(n+s<e.length&&e.charAt(n+s)==t.charAt(n)){i=s;break}if(n+s<t.length&&e.charAt(n)==t.charAt(n+s)){o=s;break}}}n++}return(e.length+t.length)/2-a},splitEmail:function(e){var t=e.trim().split("@");if(t.length<2)return!1;for(var n=0;n<t.length;n++)if(""===t[n])return!1;var i=t.pop(),o=i.split("."),a="";if(0===o.length)return!1;if(1==o.length)a=o[0];else{for(var n=1;n<o.length;n++)a+=o[n]+".";o.length>=2&&(a=a.substring(0,a.length-1))}return{topLevelDomain:a,domain:i,address:t.join("@")}},encodeEmail:function(e){var t=encodeURI(e);return t=t.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return e}(_inbound||{}),_inboundEvents=function(e){function t(t,i,o){var i=i||{};o=o||{},o.bubbles=o.bubbles||!0,o.cancelable=o.cancelable||!0,i=e.apply_filters("filter_"+t,i);!window.ActiveXObject&&"ActiveXObject"in window;if("function"==typeof CustomEvent)var a=new CustomEvent(t,{detail:i,bubbles:o.bubbles,cancelable:o.cancelable});else{var a=document.createEvent("Event");a.initEvent(t,!0,!0)}window.dispatchEvent(a),e.do_action(t,i),n(t,i)}function n(e,t){if(window.jQuery){var t=t||{};jQuery(document).trigger(e,t)}}e.trigger=function(t,n){e.Events[t](n)};return e.Events={analytics_ready:function(){var e={opt1:!0},n={data:"xyxy"};t("analytics_ready",n,e)},url_parameters:function(e){t("url_parameters",e)},session_start:function(){console.log(""),t("session_start")},session_end:function(e){t("session_end",e),console.log("Session End")},session_active:function(){t("session_active")},session_idle:function(e){t("session_idle",e)},session_resume:function(){t("session_resume")},session_heartbeat:function(e){var n={clock:e,leadData:InboundLeadData};t("session_heartbeat",n)},page_visit:function(e){t("page_view",e)},page_first_visit:function(){t("page_first_visit"),e.deBugger("pages","First Ever Page View of this Page")},page_revisit:function(n){t("page_revisit",n);var i=function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")};e.deBugger("pages",status,i)},tab_hidden:function(){e.deBugger("pages","Tab Hidden"),t("tab_hidden")},tab_visible:function(){e.deBugger("pages","Tab Visible"),t("tab_visible")},tab_mouseout:function(){e.deBugger("pages","Tab Mouseout"),t("tab_mouseout")},form_input_change:function(n){var i=function(){console.log(n)};e.deBugger("forms","inputData change. Data=",i),t("form_input_change",n)},form_before_submission:function(e){t("form_before_submission",e)},form_after_submission:function(e){t("form_after_submission",e)},analyticsError:function(e,t,n){var i=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(i),console.log("Page Save Error")}},e}(_inbound||{}),InboundTotalStorage=function(e){var t,n,i="_inbound";if("localStorage"in window)try{n="undefined"==typeof window.localStorage?void 0:window.localStorage,t="undefined"==typeof n||"undefined"==typeof window.JSON?!1:!0,window.localStorage.setItem(i,"1"),window.localStorage.removeItem(i)}catch(o){t=!1}e.totalStorage=function(t,n){return e.totalStorage.impl.init(t,n)},e.totalStorage.setItem=function(t,n){return e.totalStorage.impl.setItem(t,n)},e.totalStorage.getItem=function(t){return e.totalStorage.impl.getItem(t)},e.totalStorage.getAll=function(){return e.totalStorage.impl.getAll()},e.totalStorage.deleteItem=function(t){return e.totalStorage.impl.deleteItem(t)},e.totalStorage.impl={init:function(e,t){return"undefined"!=typeof t?this.setItem(e,t):this.getItem(e)},setItem:function(i,o){if(!t)try{return e.Utils.createCookie(i,o),o}catch(a){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var r=JSON.stringify(o);return n.setItem(i,r),this.parseResult(r)},getItem:function(i){if(!t)try{return this.parseResult(e.Utils.readCookie(i))}catch(o){return null}var a=n.getItem(i);return this.parseResult(a)},deleteItem:function(i){if(!t)try{return e.Utils.eraseCookie(i,null),!0}catch(o){return!1}return n.removeItem(i),!0},getAll:function(){var i=[];if(t)for(var o in n)o.length&&i.push({key:o,value:this.parseResult(n.getItem(o))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("="),l=s[0];i.push({key:l,value:this.parseResult(e.Utils.readCookie(l))})}}catch(u){return null}return i},parseResult:function(e){var t;try{t=JSON.parse(e),"undefined"==typeof t&&(t=e),"true"==t&&(t=!0),"false"==t&&(t=!1),parseFloat(t)==t&&"object"!=typeof t&&(t=parseFloat(t))}catch(n){t=e}return t}}}(_inbound||{}),_inboundLeadsAPI=function(e){return e.LeadsAPI={init:function(){var t=e.Utils,n=(t.readCookie("wp_lead_uid"),t.readCookie("wp_lead_id")),i=t.readCookie("lead_session_expire");i||(e.deBugger("leads","expired vistor. Run Processes"),n&&(e.LeadsAPI.getAllLeadData(),e.LeadsAPI.getLeadLists()))},setGlobalLeadData:function(e){InboundLeadData=e},getAllLeadData:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.totalStorage("inbound_lead_data"),i=e.Utils.readCookie("lead_data_expire");data={action:"inbound_get_all_lead_data",wp_lead_id:t},success=function(t){var n=JSON.parse(t);e.LeadsAPI.setGlobalLeadData(n),e.totalStorage("inbound_lead_data",n);var i=new Date;i.setTime(i.getTime()+18e5);var o=e.Utils.addDays(i,3);e.Utils.createCookie("lead_data_expire",!0,o)},n?(e.LeadsAPI.setGlobalLeadData(n),e.deBugger("lead","Set Global Lead Data from Localstorage"),i||(e.Utils.ajaxPost(inbound_settings.admin_url,data,success),e.deBugger("lead","localized data old. Pull new from DB"))):e.Utils.ajaxPost(inbound_settings.admin_url,data,success)},getLeadLists:function(){var t=e.Utils.readCookie("wp_lead_id"),n={action:"wpl_check_lists",wp_lead_id:t},i=function(){e.Utils.createCookie("lead_session_list_check",!0,{path:"/",expires:1}),e.deBugger("lead","Lists checked")};e.Utils.ajaxPost(inbound_settings.admin_url,n,i)}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,i=!1,o=!1,a=!1,r=parseInt(e.Utils.readCookie("lead_session"),10)||0,s=0,l=(new Date,null),u=null,c=null,d=e.Utils,m=e.Utils.GetDate(),f="undefined"!=typeof wp?"admin_page_views":"page_views",g=e.totalStorage(f)||{},p=inbound_settings.post_id||window.location.pathname,v=e.Settings.timeout||3e4;return e.PageTracking={init:function(i){return"page_views"!==f?!1:(this.CheckTimeOut(),i=i||{},t=parseInt(i.reportInterval,10)||10,n=parseInt(i.idleTimeout,10)||3,d.addListener(document,"keydown",d.throttle(e.PageTracking.pingSession,1e3)),d.addListener(document,"click",d.throttle(e.PageTracking.pingSession,1e3)),d.addListener(window,"mousemove",d.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession(),void 0)},setIdle:function(t){var t=t||"No Movement",n="Session IDLE. Activity Timeout due to "+t;
3
  e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n,i;"undefined"!=typeof document.hidden?(t="hidden",i="visibilitychange",n="visibilityState"):"undefined"!=typeof document.mozHidden?(t="mozHidden",i="mozvisibilitychange",n="mozVisibilityState"):"undefined"!=typeof document.msHidden?(t="msHidden",i="msvisibilitychange",n="msVisibilityState"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",i="webkitvisibilitychange",n="webkitVisibilityState");var o=document[t];e.Utils.addListener(document,i,function(){o!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),o=document[t])})},clock:function(){r+=1;var n=r/60,i="Total time spent on Page in this Session: "+n.toFixed(2)+" min";if(e.deBugger("pages",i),r>0&&r%t===0){var o=new Date;o.setTime(o.getTime()+18e5),d.createCookie("lead_session",r,o),e.trigger("session_heartbeat",r)}},inactiveClock:function(){s+=1;var t=(1800-s)/60,n="Time until Session Timeout: "+t.toFixed(2)+" min";e.deBugger("pages",n),s>1800&&(e.trigger("session_end",InboundLeadData),e.Utils.eraseCookie("lead_session"),s=0,clearTimeout(u))},stopClock:function(){o=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){o=!1,e.trigger("session_resume"),e.deBugger("pages","Activity resumed. Session Active"),clearTimeout(l),s=0,clearTimeout(u),l=setInterval(e.PageTracking.clock,1e3)},turnOff:function(){e.PageTracking.setIdle(),a=!0},turnOn:function(){a=!1},startSession:function(){new Date;i=!0,l=setInterval(e.PageTracking.clock,1e3);var t=d.readCookie("lead_session");if(t)e.trigger("session_active");else{e.trigger("session_start");var n=new Date;n.setTime(n.getTime()+18e5),e.Utils.createCookie("lead_session",1,n)}this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(i||e.PageTracking.startSession(),o&&e.PageTracking.restartClock(),clearTimeout(c),c=setTimeout(e.PageTracking.setIdle,1e3*n+100),"undefined"!=typeof t&&"mousemove"===t.type&&e.PageTracking.mouseEvents(t))},mouseEvents:function(t){t.pageY<=5&&e.trigger("tab_mouseout")},getPageViews:function(){var t=e.Utils.checkLocalStorage();if(t){var n=localStorage.getItem(f),i=JSON.parse(n);return i}},isRevisit:function(e){var t=!1,e=e||{},n=e[p];return"undefined"!=typeof n&&null!==n&&(t=!0),t},triggerPageView:function(t){var n={title:document.title,url:document.location.href,path:document.location.pathname,count:1};t?(g[p].push(m),n.count=g[p].length,e.trigger("page_revisit",n)):(g[p]=[],g[p].push(m),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage(f,g),this.storePageView()},CheckTimeOut:function(){var t,n,i=this.isRevisit(g);if(i){var o=g[p].length-1,a=g[p][o],r=Math.abs(new Date(a).getTime()-new Date(m).getTime());n=r>v,n?(t="Timeout Happened. Page view fired",this.triggerPageView(i)):(time_left=.001*Math.abs(v-r),t=v/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(i);e.deBugger("pages",t)},storePageView:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.Utils.readCookie("wp_lead_uid");if(t){var i={action:"wpl_track_user",wp_lead_uid:n,wp_lead_id:t,page_id:inbound_settings.post_id,current_url:window.location.href,json:"0"},o=function(){};e.Utils.ajaxPost(inbound_settings.admin_url,i,o)}}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
shared/classes/class.form.php CHANGED
@@ -1,1192 +1,1215 @@
1
- <?php
2
- /**
3
- * Creates Inbound Form Shortcode
4
- */
5
-
6
- if (!class_exists('Inbound_Forms')) {
7
- class Inbound_Forms {
8
- static $add_script;
9
- //=============================================
10
- // Hooks and Filters
11
- //=============================================
12
- static function init() {
13
-
14
- add_shortcode('inbound_form', array(__CLASS__, 'inbound_forms_create'));
15
- add_shortcode('inbound_forms', array(__CLASS__, 'inbound_short_form_create'));
16
- add_action('init', array(__CLASS__, 'register_script'));
17
- add_action('wp_footer', array(__CLASS__, 'print_script'));
18
- add_action('wp_footer', array(__CLASS__, 'inline_my_script'));
19
- add_action( 'init', array(__CLASS__, 'do_actions'));
20
- add_filter( 'inbound_replace_email_tokens' , array( __CLASS__ , 'replace_tokens' ) , 10 , 3 );
21
-
22
- }
23
-
24
- /* Create Longer shortcode for [inbound_form] */
25
- static function inbound_forms_create( $atts, $content = null ) {
26
-
27
- global $post;
28
-
29
- self::$add_script = true;
30
-
31
- $email = get_option('admin_email');
32
-
33
- extract(shortcode_atts(array(
34
- 'id' => '',
35
- 'name' => '',
36
- 'layout' => '',
37
- 'notify' => $email,
38
- 'notify_subject' => '{{site-name}} {{form-name}} - New Lead Conversion',
39
- 'labels' => '',
40
- 'font_size' => '', // set default from CSS
41
- 'width' => '',
42
- 'redirect' => '',
43
- 'icon' => '',
44
- 'lists' => '',
45
- 'submit' => 'Submit',
46
- 'submit_colors' => '',
47
- 'submit_text_color' => '',
48
- 'submit_bg_color' => ''
49
- ), $atts));
50
-
51
-
52
- if ( !$id && isset($_GET['post']) ) {
53
- $id = $_GET['post'];
54
- }
55
-
56
-
57
- $form_name = $name;
58
- //$form_name = strtolower(str_replace(array(' ','_', '"', "'"),'-',$form_name));
59
- $form_layout = $layout;
60
- $form_labels = $labels;
61
- $form_labels_class = (isset($form_labels)) ? "inbound-label-".$form_labels : 'inbound-label-inline';
62
- $submit_button = ($submit != "") ? $submit : 'Submit';
63
- $icon_insert = ($icon != "" && $icon != 'none') ? '<i class="fa-'. $icon . '" font-awesome fa"></i>' : '';
64
-
65
- // Set submit button colors
66
- if(isset($submit_colors) && $submit_colors === 'on'){
67
- $submit_bg = " background:" . $submit_bg_color . "; border: 5px solid ".$submit_bg_color."; border-radius: 3px;";
68
- $submit_color = " color:" . $submit_text_color . ";";
69
-
70
- } else {
71
- $submit_bg = "";
72
- $submit_color = "";
73
- }
74
-
75
- if (preg_match("/px/", $font_size)){
76
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
77
- } else if (preg_match("/%/", $font_size)) {
78
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
79
- } else if (preg_match("/em/", $font_size)) {
80
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
81
- } else if ($font_size == "") {
82
- $font_size = '';
83
- } else {
84
- $font_size = (isset($font_size)) ? " font-size:" . $font_size . "px;" : '';
85
- }
86
-
87
- // Check for image in submit button option
88
- if (preg_match('/\.(jpg|jpeg|png|gif)(?:[\?\#].*)?$/i',$submit_button)) {
89
- $image_button = ' color: rgba(0, 0, 0, 0);border: none;box-shadow: none;background: transparent; border-radius:0px;padding: 0px;';
90
- $inner_button = "<img src='$submit_button' width='100%'>";
91
- $icon_insert = '';
92
- $submit_button = '';
93
- } else {
94
- $image_button = '';
95
- $inner_button = '';
96
-
97
- }
98
-
99
- /* Sanitize width input */
100
- if (preg_match('/px/i',$width)) {
101
- $fixed_width = str_replace("px", "", $width);
102
- $width_output = "width:" . $fixed_width . "px;";
103
- } elseif (preg_match('/%/i',$width)) {
104
- $fixed_width_perc = str_replace("%", "", $width);
105
- $width_output = "width:" . $fixed_width_perc . "%;";
106
- } else {
107
- $width_output = "width:" . $width . "px;";
108
- }
109
-
110
- $form_width = ($width != "") ? $width_output : '';
111
-
112
- //if (!preg_match_all("/(.?)\[(inbound_field)\b(.*?)(?:(\/))?\](?:(.+?)\[\/inbound_field\])?(.?)/s", $content, $matches)) {
113
- if (!preg_match_all('/(.?)\[(inbound_field)(.*?)\]/s',$content, $matches)) {
114
-
115
- return '';
116
-
117
- } else {
118
-
119
- for($i = 0; $i < count($matches[0]); $i++) {
120
- $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
121
- }
122
- //print_r($matches[3]);
123
- // matches are $matches[3][$i]['label']
124
- $clean_form_id = preg_replace("/[^A-Za-z0-9 ]/", '', trim($name));
125
- $form_id = strtolower(str_replace(array(' ','_'),'-',$clean_form_id));
126
-
127
-
128
- $form = '<div id="inbound-form-wrapper" class="">';
129
- $form .= '<form class="inbound-now-form wpl-track-me inbound-track" method="post" id="'.$form_id.'" action="" style="'.$form_width.'">';
130
- $main_layout = ($form_layout != "") ? 'inbound-'.$form_layout : 'inbound-normal';
131
- for($i = 0; $i < count($matches[0]); $i++)
132
- {
133
-
134
- $label = (isset($matches[3][$i]['label'])) ? $matches[3][$i]['label'] : '';
135
-
136
-
137
- $clean_label = preg_replace("/[^A-Za-z0-9 ]/", '', trim($label));
138
- $formatted_label = strtolower(str_replace(array(' ','_'),'-',$clean_label));
139
- $field_placeholder = (isset($matches[3][$i]['placeholder'])) ? $matches[3][$i]['placeholder'] : '';
140
-
141
- $placeholder_use = ($field_placeholder != "") ? $field_placeholder : $label;
142
-
143
- if ($field_placeholder != "") {
144
- $form_placeholder = "placeholder='".$placeholder_use."'";
145
- } else if (isset($form_labels) && $form_labels === "placeholder") {
146
- $form_placeholder = "placeholder='".$placeholder_use."'";
147
- } else {
148
- $form_placeholder = "";
149
- }
150
-
151
- $description_block = (isset($matches[3][$i]['description'])) ? $matches[3][$i]['description'] : '';
152
- $field_container_class = (isset($matches[3][$i]['field_container_class'])) ? $matches[3][$i]['field_container_class'] : '';
153
- $field_input_class = (isset($matches[3][$i]['field_input_class'])) ? $matches[3][$i]['field_input_class'] : '';
154
- $required = (isset($matches[3][$i]['required'])) ? $matches[3][$i]['required'] : '0';
155
- $req = ($required === '1') ? 'required' : '';
156
- $exclude_tracking = (isset($matches[3][$i]['exclude_tracking'])) ? $matches[3][$i]['exclude_tracking'] : '0';
157
- $et_output = ($exclude_tracking === '1') ? ' data-ignore-form-field="true"' : '';
158
- $req_label = ($required === '1') ? '<span class="inbound-required">*</span>' : '';
159
- $map_field = (isset($matches[3][$i]['map_to'])) ? $matches[3][$i]['map_to'] : '';
160
- if ($map_field != "") {
161
- $field_name = $map_field;
162
- } else {
163
- //$label = self::santize_inputs($label);
164
- $field_name = strtolower(str_replace(array(' ','_'),'-',$label));
165
- }
166
-
167
- $data_mapping_attr = ($map_field != "") ? ' data-map-form-field="'.$map_field.'" ' : '';
168
-
169
- /* Map Common Fields */
170
- (preg_match( '/Email|e-mail|email/i', $label, $email_input)) ? $email_input = " inbound-email" : $email_input = "";
171
-
172
- // Match Phone
173
- (preg_match( '/Phone|phone number|telephone/i', $label, $phone_input)) ? $phone_input = " inbound-phone" : $phone_input = "";
174
-
175
- // match name or first name. (minus: name=, last name, last_name,)
176
- (preg_match( '/(?<!((last |last_)))name(?!\=)/im', $label, $first_name_input)) ? $first_name_input = " inbound-first-name" : $first_name_input = "";
177
-
178
- // Match Last Name
179
- (preg_match( '/(?<!((first)))(last name|last_name|last)(?!\=)/im', $label, $last_name_input)) ? $last_name_input = " inbound-last-name" : $last_name_input = "";
180
-
181
- $input_classes = $email_input . $first_name_input . $last_name_input . $phone_input;
182
-
183
- $type = (isset($matches[3][$i]['type'])) ? $matches[3][$i]['type'] : '';
184
- $show_labels = true;
185
-
186
- if ($type === "hidden" || $type === "honeypot" || $type === "html-block" || $type === "divider") {
187
- $show_labels = false;
188
- }
189
-
190
- // added by kirit dholakiya for validation of multiple checkbox
191
- $div_chk_req = '';
192
- if($type=='checkbox' && $required=='1') {
193
- $div_chk_req =' checkbox-required ';
194
- }
195
-
196
- $form .= '<div class="inbound-field '.$div_chk_req.$main_layout.' label-'.$form_labels_class.' '.$form_labels_class.' '.$field_container_class.'">';
197
-
198
- if ($show_labels && $form_labels != "bottom" || $type === "radio") {
199
- $form .= '<label for="'. $field_name .'" class="inbound-label '.$formatted_label.' '.$form_labels_class.' inbound-input-'.$type.'" style="'.$font_size.'">' . html_entity_decode($matches[3][$i]['label']) . $req_label . '</label>';
200
- }
201
-
202
- if ($type === 'textarea') {
203
- $form .= '<textarea placeholder="'.$placeholder_use.'" class="inbound-input inbound-input-textarea '.$field_input_class.'" name="'.$field_name.'" id="'.$field_name.'" '.$data_mapping_attr.$et_output.' '.$req.'/></textarea>';
204
-
205
- } else if ($type === 'dropdown') {
206
-
207
- $dropdown_fields = array();
208
- $dropdown = $matches[3][$i]['dropdown'];
209
- $dropdown_fields = explode(",", $dropdown);
210
-
211
- $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'"'.$data_mapping_attr.$et_output.' '.$req.'>';
212
-
213
- if ($placeholder_use) {
214
- $form .= '<option value="" disabled selected>'.str_replace( '%3F' , '?' , $placeholder_use).'</option>';
215
- }
216
-
217
- foreach ($dropdown_fields as $key => $value) {
218
- $drop_val_trimmed = trim($value);
219
- $dropdown_val = strtolower(str_replace(array(' ','_'),'-',$drop_val_trimmed));
220
-
221
- //check for label-value separator (pipe)
222
- $pos = strrpos($value, "|");
223
-
224
- //if not found, use standard replacement (lowercase and spaces become dashes)
225
- if ($pos === false) {
226
- $form .= '<option value="'. trim(str_replace('"', '\"' , $dropdown_val)) .'">'. $drop_val_trimmed .'</option>';
227
- } else {
228
- //otherwise left side of separator is label, right side is value
229
- $option = explode("|", $value);
230
- $form .= '<option value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'">'. trim($option[0]) .'</option>';
231
- }
232
- }
233
- $form .= '</select>';
234
-
235
- } else if ($type === 'dropdown_countries') {
236
-
237
- $dropdown_fields = self::get_countries_array();
238
-
239
- $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'" '.$req.'>';
240
-
241
- if ($field_placeholder) {
242
- $form .= '<option value="" disabled selected>'.$field_placeholder.'</option>';
243
- }
244
-
245
- foreach ($dropdown_fields as $key => $value) {
246
- $form .= '<option value="'.$key.'">'. utf8_encode($value) .'</option>';
247
- }
248
- $form .= '</select>';
249
-
250
- } else if ($type === 'date-selector') {
251
-
252
- $m = date('m');
253
- $d = date('d');
254
- $y = date('Y');
255
-
256
- $months = self::get_date_selectons('months');
257
- $days = self::get_date_selectons('days');
258
- $years = self::get_date_selectons('years');
259
-
260
- $form .= '<div class="dateSelector">';
261
- $form .= ' <select id="formletMonth" name="'. $field_name .'[month]" >';
262
- foreach ($months as $key => $value) {
263
- ( $m == $key ) ? $sel = 'selected="selected"' : $sel = '';
264
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
265
- }
266
- $form .= ' </select>';
267
- $form .= ' <select id="formletDays" name="'. $field_name .'[day]" >';
268
- foreach ($days as $key => $value) {
269
- ( $d == $key ) ? $sel = 'selected="selected"' : $sel = '';
270
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
271
- }
272
- $form .= ' </select>';
273
- $form .= ' <select id="formletYears" name="'. $field_name .'[year]" >';
274
- foreach ($years as $key => $value) {
275
- ( $y == $key ) ? $sel = 'selected="selected"' : $sel = '';
276
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
277
- }
278
- $form .= ' </select>';
279
- $form .= '</div>';
280
-
281
- } else if ($type === 'radio') {
282
-
283
- $radio_fields = array();
284
- $radio = $matches[3][$i]['radio'];
285
- $radio_fields = explode(",", $radio);
286
- // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
287
-
288
- foreach ($radio_fields as $key => $value) {
289
- $radio_val_trimmed = trim($value);
290
- $radio_val = strtolower(str_replace(array(' ','_'),'-',$radio_val_trimmed));
291
-
292
- //check for label-value separator (pipe)
293
- $pos = strrpos($value, "|");
294
-
295
- //if not found, use standard replacement (lowercase and spaces become dashes)
296
- if ($pos === false) {
297
- $form .= '<span class="radio-'.$main_layout.' radio-'.$form_labels_class.' '.$field_input_class.'"><input type="radio" name="'. $field_name .'" value="'. $radio_val .'">'. $radio_val_trimmed .'</span>';
298
- } else {
299
- //otherwise left side of separator is label, right side is value
300
- $option = explode("|", $value);
301
- $form .= '<span class="radio-'.$main_layout.' radio-'.$form_labels_class.' '.$field_input_class.'"><input type="radio" name="'. $field_name .'" value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'">'. trim($option[0]) .'</span>';
302
- }
303
-
304
- }
305
-
306
- } else if ($type === 'checkbox') {
307
-
308
- $checkbox_fields = array();
309
-
310
- $checkbox = $matches[3][$i]['checkbox'];
311
- $checkbox_fields = explode(",", $checkbox);
312
- foreach ($checkbox_fields as $key => $value) {
313
- $value = html_entity_decode($value);
314
- $checkbox_val_trimmed = strip_tags(trim($value));
315
- $checkbox_val = strtolower(str_replace(array(' ','_'),'-',$checkbox_val_trimmed));
316
-
317
- //check for label-value separator (pipe)
318
- $pos = strrpos($value, "|");
319
-
320
- //if not found, use standard replacement (lowercase and spaces become dashes)
321
- if ($pos === false) {
322
- $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. $checkbox_val .'" >'.$checkbox_val_trimmed.'<br>';
323
- } else {
324
- //otherwise left side of separator is label, right side is value
325
- $option = explode("|", $value);
326
- $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'" >'. trim($option[0]) .'<br>';
327
- }
328
- }
329
- } else if ($type === 'html-block') {
330
-
331
- $html = $matches[3][$i]['html'];
332
- //echo $html;
333
- $form .= "<div class={$field_input_class}>";
334
- $form .= do_shortcode(html_entity_decode($html));
335
- $form .= "</div>";
336
-
337
- } else if ($type === 'divider') {
338
-
339
- $divider = $matches[3][$i]['divider_options'];
340
- //echo $html;
341
- $form .= "<div class='inbound-form-divider {$field_input_class}'>" . $divider . "<hr></div>";
342
-
343
- } else if ($type === 'editor') {
344
- //wp_editor(); // call wp editor
345
- } else if ($type === 'honeypot') {
346
-
347
- $form .= '<input type="hidden" name="stop_dirty_subs" class="stop_dirty_subs" value="">';
348
-
349
- } else {
350
- $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
351
- $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
352
- $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
353
- if ($type === 'hidden' && $dynamic_value != "") {
354
- $fill_value = $dynamic_value;
355
- }
356
-
357
- $input_type = ( $email_input ) ? 'email' : 'text';
358
- $form .= '<input type="'.$input_type .'" class="inbound-input inbound-input-text '.$formatted_label . $input_classes.' '.$field_input_class.'" name="'.$field_name.'" '.$form_placeholder.' id="'.$field_name.'" value="'.$fill_value.'" '.$data_mapping_attr.$et_output.' '.$req.'/>';
359
- }
360
-
361
- if ($show_labels && $form_labels === "bottom" && $type != "radio") {
362
- $form .= '<label for="'. $field_name .'" class="inbound-label '.$formatted_label.' '.$form_labels_class.' inbound-input-'.$type.'" style="'.$font_size.'">' . $matches[3][$i]['label'] . $req_label . '</label>';
363
- }
364
-
365
- if ($description_block != "" && $type != 'hidden'){
366
- $form .= "<div class='inbound-description'>".$description_block."</div>";
367
- }
368
-
369
- $form .= '</div>';
370
- }
371
- // End Loop
372
-
373
- $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
374
- $form .= '<div class="inbound-field '.$main_layout.' inbound-submit-area"><button type="submit" class="inbound-button-submit inbound-submit-action" value="'.$submit_button.'" name="send" id="inbound_form_submit" data-ignore-form-field="true" style="'.$submit_bg.$submit_color.$image_button.'">
375
- '.$icon_insert.''.$submit_button.$inner_button.'</button></div><input data-ignore-form-field="true" type="hidden" name="inbound_submitted" value="1">';
376
- // <!--<input type="submit" '.$submit_button_type.' class="button" value="'.$submit_button.'" name="send" id="inbound_form_submit" />-->
377
-
378
- $form .= '<input type="hidden" name="inbound_form_n" class="inbound_form_n" value="'.$form_name.'"><input type="hidden" name="inbound_form_lists" id="inbound_form_lists" value="'.$lists.'" data-map-form-field="inbound_form_lists"><input type="hidden" name="inbound_form_id" class="inbound_form_id" value="'.$id.'"><input type="hidden" name="inbound_current_page_url" value="'.$current_page.'"><input type="hidden" name="inbound_furl" value="'. base64_encode($redirect) .'"><input type="hidden" name="inbound_notify" value="'. base64_encode($notify) .'"><input type="hidden" class="inbound_params" name="inbound_params" value=""></form></div>';
379
- $form .= "<style type='text/css'>.inbound-button-submit{ {$font_size} }</style>";
380
- $form = preg_replace('/<br class="inbr".\/>/', '', $form); // remove editor br tags
381
-
382
- return $form;
383
- }
384
- }
385
-
386
- /**
387
- * Sanitizes form inputs
388
- */
389
- static function santize_inputs($content) {
390
- // Strip HTML Tags
391
- $clear = strip_tags($content);
392
- // Clean up things like &amp;
393
- $clear = html_entity_decode($clear);
394
- // Strip out any url-encoded stuff
395
- $clear = urldecode($clear);
396
- // Replace non-AlNum characters with space
397
- $clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear);
398
- // Replace Multiple spaces with single space
399
- $clear = preg_replace('/ +/', ' ', $clear);
400
- // Trim the string of leading/trailing space
401
- $clear = trim($clear);
402
- return $clear;
403
- }
404
-
405
- /**
406
- * Create shorter shortcode for [inbound_forms]
407
- */
408
- static function inbound_short_form_create( $atts, $content = null ) {
409
- extract(shortcode_atts(array(
410
- 'id' => '',
411
- ), $atts));
412
-
413
- $shortcode = get_post_meta( $id, 'inbound_shortcode', TRUE );
414
-
415
- // If form id missing add it
416
- if (!preg_match('/id="/', $shortcode)) {
417
- $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $id . "\"", $shortcode);
418
- }
419
- if ($id === 'default_3'){
420
- $shortcode = '[inbound_form name="Form Name" layout="vertical" labels="top" submit="Submit" ][inbound_field label="Email" type="text" required="1" ][/inbound_form]';
421
- }
422
- if ($id === 'default_1'){
423
- $shortcode = '[inbound_form name="3 Field Form" layout="vertical" labels="top" submit="Submit" ][inbound_field label="First Name" type="text" required="0" ][inbound_field label="Last Name" type="text" required="0" ][inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ][/inbound_form]';
424
- }
425
- if ($id === 'default_2'){
426
- $shortcode = '[inbound_form name="Standard Company Form" layout="vertical" labels="top" submit="Submit" ]
427
-
428
- [inbound_field label="First Name" type="text" required="0" placeholder="Enter Your First Name" ]
429
-
430
- [inbound_field label="Last Name" type="text" required="0" placeholder="Enter Your Last Name" ]
431
-
432
- [inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ]
433
-
434
- [inbound_field label="Company Name" type="text" required="0" placeholder="Enter Your Company Name" ]
435
-
436
- [inbound_field label="Job Title" type="text" required="0" placeholder="Enter Your Job Title" ]
437
-
438
- [/inbound_form]';
439
- }
440
- if (empty($shortcode)) {
441
- $shortcode = "Form ID: " . $id . " Not Found";
442
- }
443
- if ($id === 'none'){
444
- $shortcode = "";
445
- }
446
-
447
- return do_shortcode( $shortcode );
448
- }
449
-
450
- /**
451
- * Enqueue JS & CSS
452
- */
453
- static function register_script() {
454
- wp_enqueue_style( 'inbound-shortcodes' );
455
- }
456
-
457
- /**
458
- * Needs more documentation
459
- */
460
- static function print_script() {
461
- if ( ! self::$add_script ) {
462
- return;
463
- }
464
- wp_enqueue_style( 'inbound-shortcodes' );
465
- }
466
-
467
- /**
468
- * Needs more documentation
469
- */
470
- static function inline_my_script() {
471
- if ( ! self::$add_script ) {
472
- return;
473
- }
474
- /* TODO remove this */
475
- echo '<script type="text/javascript">
476
-
477
- InboundQuery(document).ready(function($){
478
-
479
- InboundQuery("form").submit(function(e) {
480
-
481
- // added below condition for check any of checkbox checked or not by kirit dholakiya
482
- if( InboundQuery(\'.checkbox-required\')[0] && InboundQuery(\'.checkbox-required input[type=checkbox]:checked\').length==0)
483
- {
484
- InboundQuery(\'.checkbox-required input[type=checkbox]:first\').focus();
485
- alert("' . __( 'Oops! Looks like you have not filled out all of the required fields!' , 'inbound-pro' ) .'");
486
- e.preventDefault();
487
- e.stopImmediatePropagation();
488
- }
489
- InboundQuery(this).find("input").each(function(){
490
- if(!InboundQuery(this).prop("required")){
491
- } else if (!InboundQuery(this).val()) {
492
- alert("' . __( 'Oops! Looks like you have not filled out all of the required fields!' , 'inbound-pro' ) .'");
493
-
494
- e.preventDefault();
495
- e.stopImmediatePropagation();
496
- return false;
497
- }
498
- });
499
- });
500
-
501
- InboundQuery("#inbound_form_submit br").remove(); // remove br tags
502
- function validateEmail(email) {
503
-
504
- var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
505
- return re.test(email);
506
- }
507
- var parent_redirect = parent.window.location.href;
508
- InboundQuery("#inbound_parent_page").val(parent_redirect);
509
-
510
-
511
- // validate email
512
- InboundQuery("input.inbound-email").on("change keyup", function (e) {
513
- var $this = InboundQuery(this);
514
- var email = $this.val();
515
- InboundQuery(".inbound_email_suggestion").remove();
516
- if (validateEmail(email)) {
517
- $this.css("color", "green");
518
- $this.addClass("inbound-valid-email");
519
- $this.removeClass("inbound-invalid-email");
520
- } else {
521
- $this.css("color", "red");
522
- $this.addClass("inbound-invalid-email");
523
- $this.removeClass("inbound-valid-email");
524
- }
525
- if($this.hasClass("inbound-valid-email")) {
526
- $this.parent().parent().find("#inbound_form_submit").removeAttr("disabled");
527
- }
528
- });
529
-
530
- /* Trims whitespace on advancing to the next input */
531
- InboundQuery("input[type=\'text\']").on("blur" , function() {
532
- var value = InboundQuery.trim( $(this).val() );
533
- InboundQuery(this).val( value );
534
- })
535
-
536
-
537
- });
538
- </script>';
539
-
540
- }
541
-
542
- /**
543
- * Replaces tokens in automated email
544
- */
545
- public static function replace_tokens( $content , $form_data = null , $form_meta_data = null ) {
546
-
547
- /* replace core tokens */
548
- $content = str_replace('{{site-name}}', get_bloginfo( 'name' ) , $content);
549
- //$content = str_replace('{{form-name}}', $form_data['inbound_form_n'] , $content);
550
-
551
- foreach ($form_data as $key => $value) {
552
- $token_key = str_replace('_','-', $key);
553
- $token_key = str_replace('inbound-','', $token_key);
554
-
555
- $content = str_replace( '{{'.trim($token_key).'}}' , $value , $content );
556
- }
557
-
558
- return $content;
559
- }
560
-
561
- /**
562
- * Stores conversion activity into form metadata
563
- */
564
- static function store_form_stats($form_id, $email) {
565
-
566
- //$time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
567
- // $wordpress_date_time = date("Y-m-d G:i:s", $time);
568
- $form_conversion_num = get_post_meta($form_id, 'inbound_form_conversion_count', true);
569
- $form_conversion_num++;
570
- update_post_meta( $form_id, 'inbound_form_conversion_count', $form_conversion_num );
571
-
572
- // Add Lead Email to Conversions List
573
- $lead_conversion_list = get_post_meta( $form_id, 'lead_conversion_list', TRUE );
574
- $lead_conversion_list = json_decode($lead_conversion_list,true);
575
- if (is_array($lead_conversion_list)) {
576
- $lead_count = count($lead_conversion_list);
577
- $lead_conversion_list[$lead_count]['email'] = $email;
578
- // $lead_conversion_list[$lead_count]['date'] = $wordpress_date_time;
579
- $lead_conversion_list = json_encode($lead_conversion_list);
580
- update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
581
- } else {
582
- $lead_conversion_list = array();
583
- $lead_conversion_list[0]['email'] = $email;
584
- // $lead_conversion_list[0]['date'] = $wordpress_date_time;
585
- $lead_conversion_list = json_encode($lead_conversion_list);
586
- update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
587
- }
588
-
589
- }
590
-
591
- /**
592
- * Perform Actions After a Form Submit
593
- */
594
- static function do_actions(){
595
-
596
- if(isset($_POST['inbound_submitted']) && $_POST['inbound_submitted'] === '1') {
597
- $form_post_data = array();
598
- if(isset($_POST['stop_dirty_subs']) && $_POST['stop_dirty_subs'] != "") {
599
- wp_die( $message = 'Die You spam bastard' );
600
- return false;
601
- }
602
- /* get form submitted form's meta data */
603
- $form_meta_data = get_post_meta( $_POST['inbound_form_id'] );
604
-
605
- if(isset($_POST['inbound_furl']) && $_POST['inbound_furl'] != "") {
606
- $redirect = base64_decode($_POST['inbound_furl']);
607
- } else if (isset($_POST['inbound_current_page_url'])) {
608
- $redirect = $_POST['inbound_current_page_url'];
609
- }
610
-
611
-
612
-
613
- //print_r($_POST);
614
- foreach ( $_POST as $field => $value ) {
615
-
616
- if ( get_magic_quotes_gpc() && is_string($value) ) {
617
- $value = stripslashes( $value );
618
- }
619
-
620
- $field = strtolower($field);
621
-
622
- if (preg_match( '/Email|e-mail|email/i', $field)) {
623
- $field = "wpleads_email_address";
624
- if(isset($_POST['inbound_form_id']) && $_POST['inbound_form_id'] != "") {
625
- self::store_form_stats($_POST['inbound_form_id'], $value);
626
- }
627
- }
628
-
629
-
630
- $form_post_data[$field] = (!is_array($value)) ? strip_tags( $value ) : $value;
631
-
632
- }
633
-
634
- $form_meta_data['post_id'] = $_POST['inbound_form_id']; // pass in form id
635
-
636
- /* Send emails if passes spam check returns false */
637
- if ( !apply_filters( 'inbound_check_if_spam' , false , $form_post_data ) ) {
638
- self::send_conversion_admin_notification($form_post_data , $form_meta_data);
639
- self::send_conversion_lead_notification($form_post_data , $form_meta_data);
640
- }
641
-
642
- /* hook runs after form actions are completed and before page redirect */
643
- do_action('inboundnow_form_submit_actions', $form_post_data, $form_meta_data);
644
-
645
- /* redirect now */
646
- if ($redirect != "") {
647
- wp_redirect( $redirect );
648
- exit();
649
- }
650
-
651
- }
652
-
653
- }
654
-
655
- /**
656
- * Sends Notification of New Lead Conversion to Admin & Others Listed on the Form Notification List
657
- */
658
- public static function send_conversion_admin_notification( $form_post_data , $form_meta_data ) {
659
-
660
- if ( $template = self::get_new_lead_email_template()) {
661
-
662
- add_filter( 'wp_mail_content_type', 'inbound_set_html_content_type' );
663
- function inbound_set_html_content_type() {
664
- return 'text/html';
665
- }
666
-
667
- /* Rebuild Form Meta Data to Load Single Values */
668
- foreach( $form_meta_data as $key => $value ) {
669
- if ( isset($value[0]) ) {
670
- $form_meta_data[$key] = $value[0];
671
- }
672
- }
673
-
674
- /* If there's no notification email in place then bail */
675
- if ( !isset($form_meta_data['inbound_notify_email']) ) {
676
- return;
677
- }
678
-
679
- /* Get Email We Should Send Notifications To */
680
- $email_to = $form_meta_data['inbound_notify_email'];
681
-
682
- /* Check for Multiple Email Addresses */
683
- $addresses = explode(",", $email_to);
684
- if(is_array($addresses) && count($addresses) > 1) {
685
- $to_address = $addresses;
686
- } else {
687
- $to_address[] = $email_to;
688
- }
689
-
690
- /* Look for Custom Subject Line , Fall Back on Default */
691
- $subject = (isset($form_meta_data['inbound_notify_email_subject'])) ? $form_meta_data['inbound_notify_email_subject'] : $template['subject'];
692
-
693
- /* Discover From Email Address */
694
- foreach ($form_post_data as $key => $value) {
695
- if (preg_match('/email|e-mail/i', $key)) {
696
- $reply_to_email = $form_post_data[$key];
697
- }
698
- }
699
- $domain = get_option( 'siteurl');
700
- $domain = str_replace('http://', '', $domain);
701
- $domain = str_replace('https://', '', $domain);
702
- $domain = str_replace('www', '', $domain);
703
- $email_default = 'wordpress@' . $domain;
704
-
705
- /* Leave here for now
706
- switch( get_option('inbound_forms_enable_akismet' , 'noreply' ) ) {
707
- case 'noreply':
708
- BREAK;
709
-
710
- case 'lead':
711
-
712
- BREAK;
713
- }
714
- */
715
-
716
- $from_email = get_option( 'admin_email' , $email_default );
717
- $from_email = apply_filters( 'inbound_admin_notification_from_email' , $from_email );
718
- $reply_to_email = (isset($reply_to_email)) ? $reply_to_email : $from_email;
719
- /* Prepare Additional Data For Token Engine */
720
- $form_post_data['redirect_message'] = (isset($form_post_data['inbound_redirect']) && $form_post_data['inbound_redirect'] != "") ? "They were redirected to " . $form_post_data['inbound_redirect'] : '';
721
-
722
- /* Discover From Name */
723
- $from_name = get_option( 'blogname' , '' );
724
- $from_name = apply_filters( 'inbound_admin_notification_from_name', $from_name );
725
-
726
- $Inbound_Templating_Engine = Inbound_Templating_Engine();
727
- $subject = $Inbound_Templating_Engine->replace_tokens( $subject, array($form_post_data, $form_meta_data));
728
- $body = $Inbound_Templating_Engine->replace_tokens( $template['body'] , array($form_post_data, $form_meta_data ) );
729
-
730
-
731
- $headers = 'From: '. $from_name .' <'. $from_email .'>' . "\r\n";
732
- $headers = "Reply-To: ".$reply_to_email . "\r\n";
733
- $headers = apply_filters( 'inbound_lead_notification_email_headers' , $headers );
734
-
735
- foreach ($to_address as $key => $recipient) {
736
- $result = wp_mail( $recipient , $subject , $body , $headers );
737
- }
738
-
739
- }
740
-
741
- }
742
-
743
- /**
744
- * Sends An Email to Lead After Conversion
745
- */
746
- public static function send_conversion_lead_notification( $form_post_data , $form_meta_data ) {
747
-
748
-
749
- /* If Notifications Are Off Then Exit */
750
- if ( !isset($form_meta_data['inbound_email_send_notification'][0]) || $form_meta_data['inbound_email_send_notification'][0] != 'on' ){
751
- return;
752
- }
753
-
754
- /* Get Lead Email Address */
755
- $lead_email = false;
756
- foreach ($form_post_data as $key => $value) {
757
- if (preg_match('/email|e-mail/i', $key)) {
758
- $lead_email = $form_post_data[$key];
759
- }
760
- }
761
-
762
- /* Redundancy */
763
- if (!$lead_email) {
764
- if (isset($form_post_data['email'])) {
765
- $lead_email = $form_post_data['email'];
766
- } else if (isset($form_post_data['e-mail'])) {
767
- $lead_email = $form_post_data['e-mail'];
768
- } else if (isset($form_post_data['wpleads_email_address'])) {
769
- $lead_email = $form_post_data['wpleads_email_address'];
770
- } else {
771
- $lead_email = 'null map email field';
772
- }
773
- }
774
-
775
- if ( !$lead_email ) {
776
- return;
777
- }
778
-
779
-
780
- $Inbound_Templating_Engine = Inbound_Templating_Engine();
781
- $form_id = $form_meta_data['post_id']; //This is page id or post id
782
- $template_id = $form_meta_data['inbound_email_send_notification_template'][0];
783
-
784
- /* Rebuild Form Meta Data to Load Single Values */
785
- foreach( $form_meta_data as $key => $value ) {
786
- $form_meta_data[$key] = $value[0];
787
- }
788
-
789
- /* If Email Template Selected Use That */
790
- if ( $template_id && $template_id != 'custom' ) {
791
-
792
- $template_array = self::get_email_template( $template_id );
793
- $confirm_subject = $template_array['subject'];
794
- $confirm_email_message = $template_array['body'];
795
-
796
- /* Else Use Custom Template */
797
- } else {
798
-
799
- $template = get_post($form_id);
800
- $content = $template->post_content;
801
- $confirm_subject = get_post_meta( $form_id, 'inbound_confirmation_subject', TRUE );
802
- $content = apply_filters('the_content', $content);
803
- $content = str_replace(']]>', ']]&gt;', $content);
804
-
805
- $confirm_email_message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html;' . get_option('blog_charset') . '" /></head><body style="margin: 0px; background-color: #F4F3F4; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#F4F3F4" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0"><table cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff" border="0"><tr>';
806
- $confirm_email_message .= $content;
807
- $confirm_email_message .= '</tr></table></body></html>';
808
- }
809
-
810
-
811
-
812
- $confirm_subject = $Inbound_Templating_Engine->replace_tokens( $confirm_subject, array($form_post_data, $form_meta_data ));
813
-
814
- /* add default subject if empty */
815
- if (!$confirm_subject) {
816
- $confirm_subject = __( 'Thank you!' , 'inbound-pro' );
817
- }
818
-
819
- $confirm_email_message = $Inbound_Templating_Engine->replace_tokens( $confirm_email_message , array( $form_post_data, $form_meta_data ) );
820
-
821
-
822
- $from_name = get_option( 'blogname' , '' );
823
- $from_email = get_option( 'admin_email' );
824
-
825
- $headers = "From: " . $from_name . " <" . $from_email . ">\n";
826
- $headers .= 'Content-type: text/html';
827
-
828
- wp_mail( $lead_email, $confirm_subject , $confirm_email_message, $headers );
829
-
830
- }
831
-
832
- /**
833
- * Get Email Template for New Lead Notification
834
- */
835
- static function get_new_lead_email_template( ) {
836
-
837
- $email_template = array();
838
-
839
- $templates = get_posts(array(
840
- 'post_type' => 'email-template',
841
- 'posts_per_page' => 1,
842
- 'meta_key' => '_inbound_template_id',
843
- 'meta_value' => 'inbound-new-lead-notification'
844
- ));
845
-
846
- foreach ( $templates as $template ) {
847
- $email_template['ID'] = $template->ID;
848
- $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
849
- $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
850
- }
851
-
852
- return $email_template;
853
- }
854
-
855
- /**
856
- * Get Email Template by ID
857
- */
858
- public static function get_email_template( $ID ) {
859
-
860
- $email_template = array();
861
-
862
- $template = get_post($ID);
863
-
864
- $email_template['ID'] = $template->ID;
865
- $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
866
- $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
867
-
868
- return $email_template;
869
- }
870
-
871
- /**
872
- * Prepare an array of days, months, years. Make i18n ready
873
- * @param STRING $case lets us know which array to return
874
- *
875
- * @returns ARRAY of data
876
- */
877
- public static function get_date_selectons( $case ) {
878
-
879
- switch( $case ) {
880
-
881
- case 'months':
882
- return array(
883
- '01' => __( 'Jan' , 'inbound-pro' ),
884
- '02' => __( 'Feb' , 'inbound-pro' ),
885
- '03' => __( 'Mar' , 'inbound-pro' ),
886
- '04' => __( 'Apr' , 'inbound-pro' ),
887
- '05' => __( 'May' , 'inbound-pro' ),
888
- '06' => __( 'Jun' , 'inbound-pro' ),
889
- '07' => __( 'Jul' , 'inbound-pro' ),
890
- '08' => __( 'Aug' , 'inbound-pro' ),
891
- '09' => __( 'Sep' , 'inbound-pro' ),
892
- '10' => __( 'Oct' , 'inbound-pro' ),
893
- '11' => __( 'Nov' , 'inbound-pro' ),
894
- '12' => __( 'Dec' , 'inbound-pro' )
895
- );
896
- break;
897
- case 'days' :
898
- return array (
899
- '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05',
900
- '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10',
901
- '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15',
902
- '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20',
903
- '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25',
904
- '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30',
905
- '31' => '31'
906
- );
907
- break;
908
- case 'years' :
909
-
910
- for ($i=1920;$i<2101;$i++) {
911
- $years[$i] = $i;
912
- }
913
-
914
- return $years;
915
- break;
916
- }
917
- }
918
-
919
- /**
920
- * Prepare an array of country codes and country names. Make i18n ready
921
- */
922
- public static function get_countries_array() {
923
- return array (
924
- __( 'AF' , 'leads') => __( 'Afghanistan' , 'inbound-pro' ) ,
925
- __( 'AX' , 'leads') => __( 'Aland Islands' , 'inbound-pro' ) ,
926
- __( 'AL' , 'leads') => __( 'Albania' , 'inbound-pro' ) ,
927
- __( 'DZ' , 'leads') => __( 'Algeria' , 'inbound-pro' ) ,
928
- __( 'AS' , 'leads') => __( 'American Samoa' , 'inbound-pro' ) ,
929
- __( 'AD' , 'leads') => __( 'Andorra' , 'inbound-pro' ) ,
930
- __( 'AO' , 'leads') => __( 'Angola' , 'inbound-pro' ) ,
931
- __( 'AI' , 'leads') => __( 'Anguilla' , 'inbound-pro' ) ,
932
- __( 'AQ' , 'leads') => __( 'Antarctica' , 'inbound-pro' ) ,
933
- __( 'AG' , 'leads') => __( 'Antigua and Barbuda' , 'inbound-pro' ) ,
934
- __( 'AR' , 'leads') => __( 'Argentina' , 'inbound-pro' ) ,
935
- __( 'AM' , 'leads') => __( 'Armenia' , 'inbound-pro' ) ,
936
- __( 'AW' , 'leads') => __( 'Aruba' , 'inbound-pro' ) ,
937
- __( 'AU' , 'leads') => __( 'Australia' , 'inbound-pro' ) ,
938
- __( 'AT' , 'leads') => __( 'Austria' , 'inbound-pro' ) ,
939
- __( 'AZ' , 'leads') => __( 'Azerbaijan' , 'inbound-pro' ) ,
940
- __( 'BS' , 'leads') => __( 'Bahamas' , 'inbound-pro' ) ,
941
- __( 'BH' , 'leads') => __( 'Bahrain' , 'inbound-pro' ) ,
942
- __( 'BD' , 'leads') => __( 'Bangladesh' , 'inbound-pro' ) ,
943
- __( 'BB' , 'leads') => __( 'Barbados' , 'inbound-pro' ) ,
944
- __( 'BY' , 'leads') => __( 'Belarus' , 'inbound-pro' ) ,
945
- __( 'BE' , 'leads') => __( 'Belgium' , 'inbound-pro' ) ,
946
- __( 'BZ' , 'leads') => __( 'Belize' , 'inbound-pro' ) ,
947
- __( 'BJ' , 'leads') => __( 'Benin' , 'inbound-pro' ) ,
948
- __( 'BM' , 'leads') => __( 'Bermuda' , 'inbound-pro' ) ,
949
- __( 'BT' , 'leads') => __( 'Bhutan' , 'inbound-pro' ) ,
950
- __( 'BO' , 'leads') => __( 'Bolivia' , 'inbound-pro' ) ,
951
- __( 'BA' , 'leads') => __( 'Bosnia and Herzegovina' , 'inbound-pro' ) ,
952
- __( 'BW' , 'leads') => __( 'Botswana' , 'inbound-pro' ) ,
953
- __( 'BV' , 'leads') => __( 'Bouvet Island' , 'inbound-pro' ) ,
954
- __( 'BR' , 'leads') => __( 'Brazil' , 'inbound-pro' ) ,
955
- __( 'IO' , 'leads') => __( 'British Indian Ocean Territory' , 'inbound-pro' ) ,
956
- __( 'BN' , 'leads') => __( 'Brunei Darussalam' , 'inbound-pro' ) ,
957
- __( 'BG' , 'leads') => __( 'Bulgaria' , 'inbound-pro' ) ,
958
- __( 'BF' , 'leads') => __( 'Burkina Faso' , 'inbound-pro' ) ,
959
- __( 'BI' , 'leads') => __( 'Burundi' , 'inbound-pro' ) ,
960
- __( 'KH' , 'leads') => __( 'Cambodia' , 'inbound-pro' ) ,
961
- __( 'CM' , 'leads') => __( 'Cameroon' , 'inbound-pro' ) ,
962
- __( 'CA' , 'leads') => __( 'Canada' , 'inbound-pro' ) ,
963
- __( 'CV' , 'leads') => __( 'Cape Verde' , 'inbound-pro' ) ,
964
- __( 'BQ' , 'leads') => __( 'Caribbean Netherlands ' , 'inbound-pro' ) ,
965
- __( 'KY' , 'leads') => __( 'Cayman Islands' , 'inbound-pro' ) ,
966
- __( 'CF' , 'leads') => __( 'Central African Republic' , 'inbound-pro' ) ,
967
- __( 'TD' , 'leads') => __( 'Chad' , 'inbound-pro' ) ,
968
- __( 'CL' , 'leads') => __( 'Chile' , 'inbound-pro' ) ,
969
- __( 'CN' , 'leads') => __( 'China' , 'inbound-pro' ) ,
970
- __( 'CX' , 'leads') => __( 'Christmas Island' , 'inbound-pro' ) ,
971
- __( 'CC' , 'leads') => __( 'Cocos (Keeling) Islands' , 'inbound-pro' ) ,
972
- __( 'CO' , 'leads') => __( 'Colombia' , 'inbound-pro' ) ,
973
- __( 'KM' , 'leads') => __( 'Comoros' , 'inbound-pro' ) ,
974
- __( 'CG' , 'leads') => __( 'Congo' , 'inbound-pro' ) ,
975
- __( 'CD' , 'leads') => __( 'Congo, Democratic Republic of' , 'inbound-pro' ) ,
976
- __( 'CK' , 'leads') => __( 'Cook Islands' , 'inbound-pro' ) ,
977
- __( 'CR' , 'leads') => __( 'Costa Rica' , 'inbound-pro' ) ,
978
- __( 'CI' , 'leads') => __( 'Cote d\'Ivoire' , 'inbound-pro' ) ,
979
- __( 'HR' , 'leads') => __( 'Croatia' , 'inbound-pro' ) ,
980
- __( 'CU' , 'leads') => __( 'Cuba' , 'inbound-pro' ) ,
981
- __( 'CW' , 'leads') => __( 'Curacao' , 'inbound-pro' ) ,
982
- __( 'CY' , 'leads') => __( 'Cyprus' , 'inbound-pro' ) ,
983
- __( 'CZ' , 'leads') => __( 'Czech Republic' , 'inbound-pro' ) ,
984
- __( 'DK' , 'leads') => __( 'Denmark' , 'inbound-pro' ) ,
985
- __( 'DJ' , 'leads') => __( 'Djibouti' , 'inbound-pro' ) ,
986
- __( 'DM' , 'leads') => __( 'Dominica' , 'inbound-pro' ) ,
987
- __( 'DO' , 'leads') => __( 'Dominican Republic' , 'inbound-pro' ) ,
988
- __( 'EC' , 'leads') => __( 'Ecuador' , 'inbound-pro' ) ,
989
- __( 'EG' , 'leads') => __( 'Egypt' , 'inbound-pro' ) ,
990
- __( 'SV' , 'leads') => __( 'El Salvador' , 'inbound-pro' ) ,
991
- __( 'GQ' , 'leads') => __( 'Equatorial Guinea' , 'inbound-pro' ) ,
992
- __( 'ER' , 'leads') => __( 'Eritrea' , 'inbound-pro' ) ,
993
- __( 'EE' , 'leads') => __( 'Estonia' , 'inbound-pro' ) ,
994
- __( 'ET' , 'leads') => __( 'Ethiopia' , 'inbound-pro' ) ,
995
- __( 'FK' , 'leads') => __( 'Falkland Islands' , 'inbound-pro' ) ,
996
- __( 'FO' , 'leads') => __( 'Faroe Islands' , 'inbound-pro' ) ,
997
- __( 'FJ' , 'leads') => __( 'Fiji' , 'inbound-pro' ) ,
998
- __( 'FI' , 'leads') => __( 'Finland' , 'inbound-pro' ) ,
999
- __( 'FR' , 'leads') => __( 'France' , 'inbound-pro' ) ,
1000
- __( 'GF' , 'leads') => __( 'French Guiana' , 'inbound-pro' ) ,
1001
- __( 'PF' , 'leads') => __( 'French Polynesia' , 'inbound-pro' ) ,
1002
- __( 'TF' , 'leads') => __( 'French Southern Territories' , 'inbound-pro' ) ,
1003
- __( 'GA' , 'leads') => __( 'Gabon' , 'inbound-pro' ) ,
1004
- __( 'GM' , 'leads') => __( 'Gambia' , 'inbound-pro' ) ,
1005
- __( 'GE' , 'leads') => __( 'Georgia' , 'inbound-pro' ) ,
1006
- __( 'DE' , 'leads') => __( 'Germany' , 'inbound-pro' ) ,
1007
- __( 'GH' , 'leads') => __( 'Ghana' , 'inbound-pro' ) ,
1008
- __( 'GI' , 'leads') => __( 'Gibraltar' , 'inbound-pro' ) ,
1009
- __( 'GR' , 'leads') => __( 'Greece' , 'inbound-pro' ) ,
1010
- __( 'GL' , 'leads') => __( 'Greenland' , 'inbound-pro' ) ,
1011
- __( 'GD' , 'leads') => __( 'Grenada' , 'inbound-pro' ) ,
1012
- __( 'GP' , 'leads') => __( 'Guadeloupe' , 'inbound-pro' ) ,
1013
- __( 'GU' , 'leads') => __( 'Guam' , 'inbound-pro' ) ,
1014
- __( 'GT' , 'leads') => __( 'Guatemala' , 'inbound-pro' ) ,
1015
- __( 'GG' , 'leads') => __( 'Guernsey' , 'inbound-pro' ) ,
1016
- __( 'GN' , 'leads') => __( 'Guinea' , 'inbound-pro' ) ,
1017
- __( 'GW' , 'leads') => __( 'Guinea-Bissau' , 'inbound-pro' ) ,
1018
- __( 'GY' , 'leads') => __( 'Guyana' , 'inbound-pro' ) ,
1019
- __( 'HT' , 'leads') => __( 'Haiti' , 'inbound-pro' ) ,
1020
- __( 'HM' , 'leads') => __( 'Heard and McDonald Islands' , 'inbound-pro' ) ,
1021
- __( 'HN' , 'leads') => __( 'Honduras' , 'inbound-pro' ) ,
1022
- __( 'HK' , 'leads') => __( 'Hong Kong' , 'inbound-pro' ) ,
1023
- __( 'HU' , 'leads') => __( 'Hungary' , 'inbound-pro' ) ,
1024
- __( 'IS' , 'leads') => __( 'Iceland' , 'inbound-pro' ) ,
1025
- __( 'IN' , 'leads') => __( 'India' , 'inbound-pro' ) ,
1026
- __( 'ID' , 'leads') => __( 'Indonesia' , 'inbound-pro' ) ,
1027
- __( 'IR' , 'leads') => __( 'Iran' , 'inbound-pro' ) ,
1028
- __( 'IQ' , 'leads') => __( 'Iraq' , 'inbound-pro' ) ,
1029
- __( 'IE' , 'leads') => __( 'Ireland' , 'inbound-pro' ) ,
1030
- __( 'IM' , 'leads') => __( 'Isle of Man' , 'inbound-pro' ) ,
1031
- __( 'IL' , 'leads') => __( 'Israel' , 'inbound-pro' ) ,
1032
- __( 'IT' , 'leads') => __( 'Italy' , 'inbound-pro' ) ,
1033
- __( 'JM' , 'leads') => __( 'Jamaica' , 'inbound-pro' ) ,
1034
- __( 'JP' , 'leads') => __( 'Japan' , 'inbound-pro' ) ,
1035
- __( 'JE' , 'leads') => __( 'Jersey' , 'inbound-pro' ) ,
1036
- __( 'JO' , 'leads') => __( 'Jordan' , 'inbound-pro' ) ,
1037
- __( 'KZ' , 'leads') => __( 'Kazakhstan' , 'inbound-pro' ) ,
1038
- __( 'KE' , 'leads') => __( 'Kenya' , 'inbound-pro' ) ,
1039
- __( 'KI' , 'leads') => __( 'Kiribati' , 'inbound-pro' ) ,
1040
- __( 'KW' , 'leads') => __( 'Kuwait' , 'inbound-pro' ) ,
1041
- __( 'KG' , 'leads') => __( 'Kyrgyzstan' , 'inbound-pro' ) ,
1042
- __( 'LA' , 'leads') => __( 'Lao People\'s Democratic Republic' , 'inbound-pro' ) ,
1043
- __( 'LV' , 'leads') => __( 'Latvia' , 'inbound-pro' ) ,
1044
- __( 'LB' , 'leads') => __( 'Lebanon' , 'inbound-pro' ) ,
1045
- __( 'LS' , 'leads') => __( 'Lesotho' , 'inbound-pro' ) ,
1046
- __( 'LR' , 'leads') => __( 'Liberia' , 'inbound-pro' ) ,
1047
- __( 'LY' , 'leads') => __( 'Libya' , 'inbound-pro' ) ,
1048
- __( 'LI' , 'leads') => __( 'Liechtenstein' , 'inbound-pro' ) ,
1049
- __( 'LT' , 'leads') => __( 'Lithuania' , 'inbound-pro' ) ,
1050
- __( 'LU' , 'leads') => __( 'Luxembourg' , 'inbound-pro' ) ,
1051
- __( 'MO' , 'leads') => __( 'Macau' , 'inbound-pro' ) ,
1052
- __( 'MK' , 'leads') => __( 'Macedonia' , 'inbound-pro' ) ,
1053
- __( 'MG' , 'leads') => __( 'Madagascar' , 'inbound-pro' ) ,
1054
- __( 'MW' , 'leads') => __( 'Malawi' , 'inbound-pro' ) ,
1055
- __( 'MY' , 'leads') => __( 'Malaysia' , 'inbound-pro' ) ,
1056
- __( 'MV' , 'leads') => __( 'Maldives' , 'inbound-pro' ) ,
1057
- __( 'ML' , 'leads') => __( 'Mali' , 'inbound-pro' ) ,
1058
- __( 'MT' , 'leads') => __( 'Malta' , 'inbound-pro' ) ,
1059
- __( 'MH' , 'leads') => __( 'Marshall Islands' , 'inbound-pro' ) ,
1060
- __( 'MQ' , 'leads') => __( 'Martinique' , 'inbound-pro' ) ,
1061
- __( 'MR' , 'leads') => __( 'Mauritania' , 'inbound-pro' ) ,
1062
- __( 'MU' , 'leads') => __( 'Mauritius' , 'inbound-pro' ) ,
1063
- __( 'YT' , 'leads') => __( 'Mayotte' , 'inbound-pro' ) ,
1064
- __( 'MX' , 'leads') => __( 'Mexico' , 'inbound-pro' ) ,
1065
- __( 'FM' , 'leads') => __( 'Micronesia, Federated States of' , 'inbound-pro' ) ,
1066
- __( 'MD' , 'leads') => __( 'Moldova' , 'inbound-pro' ) ,
1067
- __( 'MC' , 'leads') => __( 'Monaco' , 'inbound-pro' ) ,
1068
- __( 'MN' , 'leads') => __( 'Mongolia' , 'inbound-pro' ) ,
1069
- __( 'ME' , 'leads') => __( 'Montenegro' , 'inbound-pro' ) ,
1070
- __( 'MS' , 'leads') => __( 'Montserrat' , 'inbound-pro' ) ,
1071
- __( 'MA' , 'leads') => __( 'Morocco' , 'inbound-pro' ) ,
1072
- __( 'MZ' , 'leads') => __( 'Mozambique' , 'inbound-pro' ) ,
1073
- __( 'MM' , 'leads') => __( 'Myanmar' , 'inbound-pro' ) ,
1074
- __( 'NA' , 'leads') => __( 'Namibia' , 'inbound-pro' ) ,
1075
- __( 'NR' , 'leads') => __( 'Nauru' , 'inbound-pro' ) ,
1076
- __( 'NP' , 'leads') => __( 'Nepal' , 'inbound-pro' ) ,
1077
- __( 'NC' , 'leads') => __( 'New Caledonia' , 'inbound-pro' ) ,
1078
- __( 'NZ' , 'leads') => __( 'New Zealand' , 'inbound-pro' ) ,
1079
- __( 'NI' , 'leads') => __( 'Nicaragua' , 'inbound-pro' ) ,
1080
- __( 'NE' , 'leads') => __( 'Niger' , 'inbound-pro' ) ,
1081
- __( 'NG' , 'leads') => __( 'Nigeria' , 'inbound-pro' ) ,
1082
- __( 'NU' , 'leads') => __( 'Niue' , 'inbound-pro' ) ,
1083
- __( 'NF' , 'leads') => __( 'Norfolk Island' , 'inbound-pro' ) ,
1084
- __( 'KP' , 'leads') => __( 'North Korea' , 'inbound-pro' ) ,
1085
- __( 'MP' , 'leads') => __( 'Northern Mariana Islands' , 'inbound-pro' ) ,
1086
- __( 'NO' , 'leads') => __( 'Norway' , 'inbound-pro' ) ,
1087
- __( 'OM' , 'leads') => __( 'Oman' , 'inbound-pro' ) ,
1088
- __( 'PK' , 'leads') => __( 'Pakistan' , 'inbound-pro' ) ,
1089
- __( 'PW' , 'leads') => __( 'Palau' , 'inbound-pro' ) ,
1090
- __( 'PS' , 'leads') => __( 'Palestinian Territory, Occupied' , 'inbound-pro' ) ,
1091
- __( 'PA' , 'leads') => __( 'Panama' , 'inbound-pro' ) ,
1092
- __( 'PG' , 'leads') => __( 'Papua New Guinea' , 'inbound-pro' ) ,
1093
- __( 'PY' , 'leads') => __( 'Paraguay' , 'inbound-pro' ) ,
1094
- __( 'PE' , 'leads') => __( 'Peru' , 'inbound-pro' ) ,
1095
- __( 'PH' , 'leads') => __( 'Philippines' , 'inbound-pro' ) ,
1096
- __( 'PN' , 'leads') => __( 'Pitcairn' , 'inbound-pro' ) ,
1097
- __( 'PL' , 'leads') => __( 'Poland' , 'inbound-pro' ) ,
1098
- __( 'PT' , 'leads') => __( 'Portugal' , 'inbound-pro' ) ,
1099
- __( 'PR' , 'leads') => __( 'Puerto Rico' , 'inbound-pro' ) ,
1100
- __( 'QA' , 'leads') => __( 'Qatar' , 'inbound-pro' ) ,
1101
- __( 'RE' , 'leads') => __( 'Reunion' , 'inbound-pro' ) ,
1102
- __( 'RO' , 'leads') => __( 'Romania' , 'inbound-pro' ) ,
1103
- __( 'RU' , 'leads') => __( 'Russian Federation' , 'inbound-pro' ) ,
1104
- __( 'RW' , 'leads') => __( 'Rwanda' , 'inbound-pro' ) ,
1105
- __( 'BL' , 'leads') => __( 'Saint Barthelemy' , 'inbound-pro' ) ,
1106
- __( 'SH' , 'leads') => __( 'Saint Helena' , 'inbound-pro' ) ,
1107
- __( 'KN' , 'leads') => __( 'Saint Kitts and Nevis' , 'inbound-pro' ) ,
1108
- __( 'LC' , 'leads') => __( 'Saint Lucia' , 'inbound-pro' ) ,
1109
- __( 'VC' , 'leads') => __( 'Saint Vincent and the Grenadines' , 'inbound-pro' ) ,
1110
- __( 'MF' , 'leads') => __( 'Saint-Martin (France)' , 'inbound-pro' ) ,
1111
- __( 'SX' , 'leads') => __( 'Saint-Martin (Pays-Bas)' , 'inbound-pro' ) ,
1112
- __( 'WS' , 'leads') => __( 'Samoa' , 'inbound-pro' ) ,
1113
- __( 'SM' , 'leads') => __( 'San Marino' , 'inbound-pro' ) ,
1114
- __( 'ST' , 'leads') => __( 'Sao Tome and Principe' , 'inbound-pro' ) ,
1115
- __( 'SA' , 'leads') => __( 'Saudi Arabia' , 'inbound-pro' ) ,
1116
- __( 'SN' , 'leads') => __( 'Senegal' , 'inbound-pro' ) ,
1117
- __( 'RS' , 'leads') => __( 'Serbia' , 'inbound-pro' ) ,
1118
- __( 'SC' , 'leads') => __( 'Seychelles' , 'inbound-pro' ) ,
1119
- __( 'SL' , 'leads') => __( 'Sierra Leone' , 'inbound-pro' ) ,
1120
- __( 'SG' , 'leads') => __( 'Singapore' , 'inbound-pro' ) ,
1121
- __( 'SK' , 'leads') => __( 'Slovakia (Slovak Republic)' , 'inbound-pro' ) ,
1122
- __( 'SI' , 'leads') => __( 'Slovenia' , 'inbound-pro' ) ,
1123
- __( 'SB' , 'leads') => __( 'Solomon Islands' , 'inbound-pro' ) ,
1124
- __( 'SO' , 'leads') => __( 'Somalia' , 'inbound-pro' ) ,
1125
- __( 'ZA' , 'leads') => __( 'South Africa' , 'inbound-pro' ) ,
1126
- __( 'GS' , 'leads') => __( 'South Georgia and the South Sandwich Islands' , 'inbound-pro' ) ,
1127
- __( 'KR' , 'leads') => __( 'South Korea' , 'inbound-pro' ) ,
1128
- __( 'SS' , 'leads') => __( 'South Sudan' , 'inbound-pro' ) ,
1129
- __( 'ES' , 'leads') => __( 'Spain' , 'inbound-pro' ) ,
1130
- __( 'LK' , 'leads') => __( 'Sri Lanka' , 'inbound-pro' ) ,
1131
- __( 'PM' , 'leads') => __( 'St. Pierre and Miquelon' , 'inbound-pro' ) ,
1132
- __( 'SD' , 'leads') => __( 'Sudan' , 'inbound-pro' ) ,
1133
- __( 'SR' , 'leads') => __( 'Suriname' , 'inbound-pro' ) ,
1134
- __( 'SJ' , 'leads') => __( 'Svalbard and Jan Mayen Islands' , 'inbound-pro' ) ,
1135
- __( 'SZ' , 'leads') => __( 'Swaziland' , 'inbound-pro' ) ,
1136
- __( 'SE' , 'leads') => __( 'Sweden' , 'inbound-pro' ) ,
1137
- __( 'CH' , 'leads') => __( 'Switzerland' , 'inbound-pro' ) ,
1138
- __( 'SY' , 'leads') => __( 'Syria' , 'inbound-pro' ) ,
1139
- __( 'TW' , 'leads') => __( 'Taiwan' , 'inbound-pro' ) ,
1140
- __( 'TJ' , 'leads') => __( 'Tajikistan' , 'inbound-pro' ) ,
1141
- __( 'TZ' , 'leads') => __( 'Tanzania' , 'inbound-pro' ) ,
1142
- __( 'TH' , 'leads') => __( 'Thailand' , 'inbound-pro' ) ,
1143
- __( 'NL' , 'leads') => __( 'The Netherlands' , 'inbound-pro' ) ,
1144
- __( 'TL' , 'leads') => __( 'Timor-Leste' , 'inbound-pro' ) ,
1145
- __( 'TG' , 'leads') => __( 'Togo' , 'inbound-pro' ) ,
1146
- __( 'TK' , 'leads') => __( 'Tokelau' , 'inbound-pro' ) ,
1147
- __( 'TO' , 'leads') => __( 'Tonga' , 'inbound-pro' ) ,
1148
- __( 'TT' , 'leads') => __( 'Trinidad and Tobago' , 'inbound-pro' ) ,
1149
- __( 'TN' , 'leads') => __( 'Tunisia' , 'inbound-pro' ) ,
1150
- __( 'TR' , 'leads') => __( 'Turkey' , 'inbound-pro' ) ,
1151
- __( 'TM' , 'leads') => __( 'Turkmenistan' , 'inbound-pro' ) ,
1152
- __( 'TC' , 'leads') => __( 'Turks and Caicos Islands' , 'inbound-pro' ) ,
1153
- __( 'TV' , 'leads') => __( 'Tuvalu' , 'inbound-pro' ) ,
1154
- __( 'UG' , 'leads') => __( 'Uganda' , 'inbound-pro' ) ,
1155
- __( 'UA' , 'leads') => __( 'Ukraine' , 'inbound-pro' ) ,
1156
- __( 'AE' , 'leads') => __( 'United Arab Emirates' , 'inbound-pro' ) ,
1157
- __( 'GB' , 'leads') => __( 'United Kingdom' , 'inbound-pro' ) ,
1158
- __( 'US' , 'leads') => __( 'United States' , 'inbound-pro' ) ,
1159
- __( 'UM' , 'leads') => __( 'United States Minor Outlying Islands' , 'inbound-pro' ) ,
1160
- __( 'UY' , 'leads') => __( 'Uruguay' , 'inbound-pro' ) ,
1161
- __( 'UZ' , 'leads') => __( 'Uzbekistan' , 'inbound-pro' ) ,
1162
- __( 'VU' , 'leads') => __( 'Vanuatu' , 'inbound-pro' ) ,
1163
- __( 'VA' , 'leads') => __( 'Vatican' , 'inbound-pro' ) ,
1164
- __( 'VE' , 'leads') => __( 'Venezuela' , 'inbound-pro' ) ,
1165
- __( 'VN' , 'leads') => __( 'Vietnam' , 'inbound-pro' ) ,
1166
- __( 'VG' , 'leads') => __( 'Virgin Islands (British)' , 'inbound-pro' ) ,
1167
- __( 'VI' , 'leads') => __( 'Virgin Islands (U.S.)' , 'inbound-pro' ) ,
1168
- __( 'WF' , 'leads') => __( 'Wallis and Futuna Islands' , 'inbound-pro' ) ,
1169
- __( 'EH' , 'leads') => __( 'Western Sahara' , 'inbound-pro' ) ,
1170
- __( 'YE' , 'leads') => __( 'Yemen' , 'inbound-pro' ) ,
1171
- __( 'ZM' , 'leads') => __( 'Zambia' , 'inbound-pro' ) ,
1172
- __( 'ZW' , 'leads') => __( 'Zimbabwe' , 'inbound-pro' )
1173
- );
1174
- }
1175
-
1176
- /**
1177
- * Gets dataset of form settings by form id
1178
- */
1179
- public static function get_form_settings( $form_id ) {
1180
-
1181
- $meta = get_post_meta( $form_id );
1182
-
1183
- foreach ($meta as $key => $value ) {
1184
- $meta[ $key ] = $value[0];
1185
- }
1186
-
1187
- return $meta;
1188
- }
1189
- }
1190
-
1191
- Inbound_Forms::init();
1192
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Creates Inbound Form Shortcode
4
+ */
5
+
6
+ if (!class_exists('Inbound_Forms')) {
7
+ class Inbound_Forms {
8
+ static $add_script;
9
+ //=============================================
10
+ // Hooks and Filters
11
+ //=============================================
12
+ static function init() {
13
+
14
+ add_shortcode('inbound_form', array(__CLASS__, 'inbound_forms_create'));
15
+ add_shortcode('inbound_forms', array(__CLASS__, 'inbound_short_form_create'));
16
+ add_action('init', array(__CLASS__, 'register_script'));
17
+ add_action('wp_footer', array(__CLASS__, 'print_script'));
18
+ add_action('wp_footer', array(__CLASS__, 'inline_my_script'));
19
+ add_action( 'init', array(__CLASS__, 'do_actions'));
20
+ add_filter( 'inbound_replace_email_tokens' , array( __CLASS__ , 'replace_tokens' ) , 10 , 3 );
21
+
22
+ }
23
+
24
+ /* Create Longer shortcode for [inbound_form] */
25
+ static function inbound_forms_create( $atts, $content = null ) {
26
+
27
+ global $post;
28
+
29
+ self::$add_script = true;
30
+
31
+ $email = get_option('admin_email');
32
+
33
+ extract(shortcode_atts(array(
34
+ 'id' => '',
35
+ 'name' => '',
36
+ 'layout' => '',
37
+ 'notify' => $email,
38
+ 'notify_subject' => '{{site-name}} {{form-name}} - New Lead Conversion',
39
+ 'labels' => '',
40
+ 'font_size' => '', // set default from CSS
41
+ 'width' => '',
42
+ 'redirect' => '',
43
+ 'icon' => '',
44
+ 'lists' => '',
45
+ 'submit' => 'Submit',
46
+ 'submit_colors' => '',
47
+ 'submit_text_color' => '',
48
+ 'submit_bg_color' => ''
49
+ ), $atts));
50
+
51
+
52
+ if ( !$id && isset($_GET['post']) ) {
53
+ $id = $_GET['post'];
54
+ }
55
+
56
+
57
+ $form_name = $name;
58
+ //$form_name = strtolower(str_replace(array(' ','_', '"', "'"),'-',$form_name));
59
+ $form_layout = $layout;
60
+ $form_labels = $labels;
61
+ $form_labels_class = (isset($form_labels)) ? "inbound-label-".$form_labels : 'inbound-label-inline';
62
+ $submit_button = ($submit != "") ? $submit : 'Submit';
63
+ $icon_insert = ($icon != "" && $icon != 'none') ? '<i class="fa-'. $icon . '" font-awesome fa"></i>' : '';
64
+
65
+ // Set submit button colors
66
+ if(isset($submit_colors) && $submit_colors === 'on'){
67
+ $submit_bg = " background:" . $submit_bg_color . "; border: 5px solid ".$submit_bg_color."; border-radius: 3px;";
68
+ $submit_color = " color:" . $submit_text_color . ";";
69
+
70
+ } else {
71
+ $submit_bg = "";
72
+ $submit_color = "";
73
+ }
74
+
75
+ if (preg_match("/px/", $font_size)){
76
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
77
+ } else if (preg_match("/%/", $font_size)) {
78
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
79
+ } else if (preg_match("/em/", $font_size)) {
80
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
81
+ } else if ($font_size == "") {
82
+ $font_size = '';
83
+ } else {
84
+ $font_size = (isset($font_size)) ? " font-size:" . $font_size . "px;" : '';
85
+ }
86
+
87
+ // Check for image in submit button option
88
+ if (preg_match('/\.(jpg|jpeg|png|gif)(?:[\?\#].*)?$/i',$submit_button)) {
89
+ $image_button = ' color: rgba(0, 0, 0, 0);border: none;box-shadow: none;background: transparent; border-radius:0px;padding: 0px;';
90
+ $inner_button = "<img src='$submit_button' width='100%'>";
91
+ $icon_insert = '';
92
+ $submit_button = '';
93
+ } else {
94
+ $image_button = '';
95
+ $inner_button = '';
96
+
97
+ }
98
+
99
+ /* Sanitize width input */
100
+ if (preg_match('/px/i',$width)) {
101
+ $fixed_width = str_replace("px", "", $width);
102
+ $width_output = "width:" . $fixed_width . "px;";
103
+ } elseif (preg_match('/%/i',$width)) {
104
+ $fixed_width_perc = str_replace("%", "", $width);
105
+ $width_output = "width:" . $fixed_width_perc . "%;";
106
+ } else {
107
+ $width_output = "width:" . $width . "px;";
108
+ }
109
+
110
+ $form_width = ($width != "") ? $width_output : '';
111
+
112
+ //if (!preg_match_all("/(.?)\[(inbound_field)\b(.*?)(?:(\/))?\](?:(.+?)\[\/inbound_field\])?(.?)/s", $content, $matches)) {
113
+ if (!preg_match_all('/(.?)\[(inbound_field)(.*?)\]/s',$content, $matches)) {
114
+
115
+ return '';
116
+
117
+ } else {
118
+
119
+ for($i = 0; $i < count($matches[0]); $i++) {
120
+ $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
121
+ }
122
+ //print_r($matches[3]);
123
+ // matches are $matches[3][$i]['label']
124
+ $clean_form_id = preg_replace("/[^A-Za-z0-9 ]/", '', trim($name));
125
+ $form_id = strtolower(str_replace(array(' ','_'),'-',$clean_form_id));
126
+
127
+
128
+ $form = '<div id="inbound-form-wrapper" class="">';
129
+ $form .= '<form class="inbound-now-form wpl-track-me inbound-track" method="post" id="'.$form_id.'" action="" style="'.$form_width.'">';
130
+ $main_layout = ($form_layout != "") ? 'inbound-'.$form_layout : 'inbound-normal';
131
+
132
+ for($i = 0; $i < count($matches[0]); $i++) {
133
+
134
+ $label = (isset($matches[3][$i]['label'])) ? $matches[3][$i]['label'] : '';
135
+
136
+
137
+ $clean_label = preg_replace("/[^A-Za-z0-9 ]/", '', trim($label));
138
+ $formatted_label = strtolower(str_replace(array(' ','_'),'-',$clean_label));
139
+ $field_placeholder = (isset($matches[3][$i]['placeholder'])) ? $matches[3][$i]['placeholder'] : '';
140
+
141
+ $placeholder_use = ($field_placeholder != "") ? $field_placeholder : $label;
142
+
143
+ if ($field_placeholder != "") {
144
+ $form_placeholder = "placeholder='".$placeholder_use."'";
145
+ } else if (isset($form_labels) && $form_labels === "placeholder") {
146
+ $form_placeholder = "placeholder='".$placeholder_use."'";
147
+ } else {
148
+ $form_placeholder = "";
149
+ }
150
+
151
+ $description_block = (isset($matches[3][$i]['description'])) ? $matches[3][$i]['description'] : '';
152
+ $field_container_class = (isset($matches[3][$i]['field_container_class'])) ? $matches[3][$i]['field_container_class'] : '';
153
+ $field_input_class = (isset($matches[3][$i]['field_input_class'])) ? $matches[3][$i]['field_input_class'] : '';
154
+ $required = (isset($matches[3][$i]['required'])) ? $matches[3][$i]['required'] : '0';
155
+ $req = ($required === '1') ? 'required' : '';
156
+ $exclude_tracking = (isset($matches[3][$i]['exclude_tracking'])) ? $matches[3][$i]['exclude_tracking'] : '0';
157
+ $et_output = ($exclude_tracking === '1') ? ' data-ignore-form-field="true"' : '';
158
+ $req_label = ($required === '1') ? '<span class="inbound-required">*</span>' : '';
159
+ $map_field = (isset($matches[3][$i]['map_to'])) ? $matches[3][$i]['map_to'] : '';
160
+ if ($map_field != "") {
161
+ $field_name = $map_field;
162
+ } else {
163
+ //$label = self::santize_inputs($label);
164
+ $field_name = strtolower(str_replace(array(' ','_'),'-',$label));
165
+ }
166
+
167
+ $data_mapping_attr = ($map_field != "") ? ' data-map-form-field="'.$map_field.'" ' : '';
168
+
169
+ /* Map Common Fields */
170
+ (preg_match( '/Email|e-mail|email/i', $label, $email_input)) ? $email_input = " inbound-email" : $email_input = "";
171
+
172
+ // Match Phone
173
+ (preg_match( '/Phone|phone number|telephone/i', $label, $phone_input)) ? $phone_input = " inbound-phone" : $phone_input = "";
174
+
175
+ // match name or first name. (minus: name=, last name, last_name,)
176
+ (preg_match( '/(?<!((last |last_)))name(?!\=)/im', $label, $first_name_input)) ? $first_name_input = " inbound-first-name" : $first_name_input = "";
177
+
178
+ // Match Last Name
179
+ (preg_match( '/(?<!((first)))(last name|last_name|last)(?!\=)/im', $label, $last_name_input)) ? $last_name_input = " inbound-last-name" : $last_name_input = "";
180
+
181
+ $input_classes = $email_input . $first_name_input . $last_name_input . $phone_input;
182
+
183
+ $type = (isset($matches[3][$i]['type'])) ? $matches[3][$i]['type'] : '';
184
+ $show_labels = true;
185
+
186
+ if ($type === "hidden" || $type === "honeypot" || $type === "html-block" || $type === "divider") {
187
+ $show_labels = false;
188
+ }
189
+
190
+ // added by kirit dholakiya for validation of multiple checkbox
191
+ $div_chk_req = '';
192
+ if($type=='checkbox' && $required=='1') {
193
+ $div_chk_req =' checkbox-required ';
194
+ }
195
+
196
+ $form .= '<div class="inbound-field '.$div_chk_req.$main_layout.' label-'.$form_labels_class.' '.$form_labels_class.' '.$field_container_class.'">';
197
+
198
+ if ($show_labels && $form_labels != "bottom" || $type === "radio") {
199
+ $form .= '<label for="'. $field_name .'" class="inbound-label '.$formatted_label.' '.$form_labels_class.' inbound-input-'.$type.'" style="'.$font_size.'">' . html_entity_decode($matches[3][$i]['label']) . $req_label . '</label>';
200
+ }
201
+
202
+ if ($type === 'textarea') {
203
+ $form .= '<textarea placeholder="'.$placeholder_use.'" class="inbound-input inbound-input-textarea '.$field_input_class.'" name="'.$field_name.'" id="'.$field_name.'" '.$data_mapping_attr.$et_output.' '.$req.'/></textarea>';
204
+
205
+ } else if ($type === 'dropdown') {
206
+
207
+ $dropdown_fields = array();
208
+ $dropdown = $matches[3][$i]['dropdown'];
209
+ $dropdown_fields = explode(",", $dropdown);
210
+
211
+ $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'"'.$data_mapping_attr.$et_output.' '.$req.'>';
212
+
213
+ if ($placeholder_use) {
214
+ $form .= '<option value="" disabled selected>'.str_replace( '%3F' , '?' , $placeholder_use).'</option>';
215
+ }
216
+
217
+ foreach ($dropdown_fields as $key => $value) {
218
+ $drop_val_trimmed = trim($value);
219
+ $dropdown_val = strtolower(str_replace(array(' ','_'),'-',$drop_val_trimmed));
220
+
221
+ //check for label-value separator (pipe)
222
+ $pos = strrpos($value, "|");
223
+
224
+ //if not found, use standard replacement (lowercase and spaces become dashes)
225
+ if ($pos === false) {
226
+ $form .= '<option value="'. trim(str_replace('"', '\"' , $dropdown_val)) .'">'. $drop_val_trimmed .'</option>';
227
+ } else {
228
+ //otherwise left side of separator is label, right side is value
229
+ $option = explode("|", $value);
230
+ $form .= '<option value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'">'. trim($option[0]) .'</option>';
231
+ }
232
+ }
233
+ $form .= '</select>';
234
+
235
+ } else if ($type === 'dropdown_countries') {
236
+
237
+ $dropdown_fields = self::get_countries_array();
238
+
239
+ $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'" '.$req.'>';
240
+
241
+ if ($field_placeholder) {
242
+ $form .= '<option value="" disabled selected>'.$field_placeholder.'</option>';
243
+ }
244
+
245
+ foreach ($dropdown_fields as $key => $value) {
246
+ $form .= '<option value="'.$key.'">'. utf8_encode($value) .'</option>';
247
+ }
248
+ $form .= '</select>';
249
+
250
+ } else if ($type === 'date-selector') {
251
+
252
+ $m = date('m');
253
+ $d = date('d');
254
+ $y = date('Y');
255
+
256
+ $months = self::get_date_selectons('months');
257
+ $days = self::get_date_selectons('days');
258
+ $years = self::get_date_selectons('years');
259
+
260
+ $form .= '<div class="dateSelector">';
261
+ $form .= ' <select id="formletMonth" name="'. $field_name .'[month]" >';
262
+ foreach ($months as $key => $value) {
263
+ ( $m == $key ) ? $sel = 'selected="selected"' : $sel = '';
264
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
265
+ }
266
+ $form .= ' </select>';
267
+ $form .= ' <select id="formletDays" name="'. $field_name .'[day]" >';
268
+ foreach ($days as $key => $value) {
269
+ ( $d == $key ) ? $sel = 'selected="selected"' : $sel = '';
270
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
271
+ }
272
+ $form .= ' </select>';
273
+ $form .= ' <select id="formletYears" name="'. $field_name .'[year]" >';
274
+ foreach ($years as $key => $value) {
275
+ ( $y == $key ) ? $sel = 'selected="selected"' : $sel = '';
276
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
277
+ }
278
+ $form .= ' </select>';
279
+ $form .= '</div>';
280
+
281
+ } else if ($type === 'date') {
282
+
283
+ $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
284
+ $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
285
+ $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
286
+ if ($type === 'hidden' && $dynamic_value != "") {
287
+ $fill_value = $dynamic_value;
288
+ }
289
+ $form .= '<input class="inbound-input inbound-input-text '.$formatted_label . $input_classes.' '.$field_input_class.'" name="'.$field_name.'" '.$form_placeholder.' id="'.$field_name.'" value="'.$fill_value.'" type="'.$type.'"'.$data_mapping_attr.$et_output.' '.$req.'/>';
290
+
291
+ } else if ($type === 'time') {
292
+
293
+ $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
294
+ $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
295
+ $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
296
+ if ($type === 'hidden' && $dynamic_value != "") {
297
+ $fill_value = $dynamic_value;
298
+ }
299
+ $form .= '<input class="inbound-input inbound-input-text '.$formatted_label . $input_classes.' '.$field_input_class.'" name="'.$field_name.'" '.$form_placeholder.' id="'.$field_name.'" value="'.$fill_value.'" type="'.$type.'"'.$data_mapping_attr.$et_output.' '.$req.'/>';
300
+
301
+ } else if ($type === 'radio') {
302
+
303
+ $radio_fields = array();
304
+ $radio = $matches[3][$i]['radio'];
305
+ $radio_fields = explode(",", $radio);
306
+ // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
307
+
308
+ foreach ($radio_fields as $key => $value) {
309
+ $radio_val_trimmed = trim($value);
310
+ $radio_val = strtolower(str_replace(array(' ','_'),'-',$radio_val_trimmed));
311
+
312
+ //check for label-value separator (pipe)
313
+ $pos = strrpos($value, "|");
314
+
315
+ //if not found, use standard replacement (lowercase and spaces become dashes)
316
+ if ($pos === false) {
317
+ $form .= '<span class="radio-'.$main_layout.' radio-'.$form_labels_class.' '.$field_input_class.'"><input type="radio" name="'. $field_name .'" value="'. $radio_val .'">'. $radio_val_trimmed .'</span>';
318
+ } else {
319
+ //otherwise left side of separator is label, right side is value
320
+ $option = explode("|", $value);
321
+ $form .= '<span class="radio-'.$main_layout.' radio-'.$form_labels_class.' '.$field_input_class.'"><input type="radio" name="'. $field_name .'" value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'">'. trim($option[0]) .'</span>';
322
+ }
323
+
324
+ }
325
+
326
+ } else if ($type === 'checkbox') {
327
+
328
+ $checkbox_fields = array();
329
+
330
+ $checkbox = $matches[3][$i]['checkbox'];
331
+ $checkbox_fields = explode(",", $checkbox);
332
+ foreach ($checkbox_fields as $key => $value) {
333
+
334
+ $value = html_entity_decode($value);
335
+ $checkbox_val_trimmed = trim($value);
336
+ $checkbox_val = strtolower(str_replace(array(' ','_'),'-',$checkbox_val_trimmed));
337
+
338
+ //check for label-value separator (pipe)
339
+ $pos = strrpos($value, "|");
340
+
341
+ //if not found, use standard replacement (lowercase and spaces become dashes)
342
+ if ($pos === false) {
343
+ $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. $checkbox_val .'" >'.$checkbox_val_trimmed.'<br>';
344
+ } else {
345
+ //otherwise left side of separator is label, right side is value
346
+ $option = explode("|", $value);
347
+ $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. trim(str_replace('"', '\"' , trim($option[1]))) .'" >'. trim($option[0]) .'<br>';
348
+ }
349
+ }
350
+ } else if ($type === 'html-block') {
351
+
352
+ $html = $matches[3][$i]['html'];
353
+ //echo $html;
354
+ $form .= "<div class={$field_input_class}>";
355
+ $form .= do_shortcode(html_entity_decode($html));
356
+ $form .= "</div>";
357
+
358
+ } else if ($type === 'divider') {
359
+
360
+ $divider = $matches[3][$i]['divider_options'];
361
+ //echo $html;
362
+ $form .= "<div class='inbound-form-divider {$field_input_class}'>" . $divider . "<hr></div>";
363
+
364
+ } else if ($type === 'editor') {
365
+ //wp_editor(); // call wp editor
366
+ } else if ($type === 'honeypot') {
367
+
368
+ $form .= '<input type="hidden" name="stop_dirty_subs" class="stop_dirty_subs" value="">';
369
+
370
+ } else if ($type === 'text') {
371
+ $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
372
+ $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
373
+ $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
374
+ if ($type === 'hidden' && $dynamic_value != "") {
375
+ $fill_value = $dynamic_value;
376
+ }
377
+
378
+ $input_type = ( $email_input ) ? 'email' : 'text';
379
+ $form .= '<input type="'.$input_type .'" class="inbound-input inbound-input-text '.$formatted_label . $input_classes.' '.$field_input_class.'" name="'.$field_name.'" '.$form_placeholder.' id="'.$field_name.'" value="'.$fill_value.'" '.$data_mapping_attr.$et_output.' '.$req.'/>';
380
+ } else {
381
+ do_action('inbound_form_custom_field' , $matches[3][$i] );
382
+ }
383
+
384
+ if ($show_labels && $form_labels === "bottom" && $type != "radio") {
385
+ $form .= '<label for="'. $field_name .'" class="inbound-label '.$formatted_label.' '.$form_labels_class.' inbound-input-'.$type.'" style="'.$font_size.'">' . $matches[3][$i]['label'] . $req_label . '</label>';
386
+ }
387
+
388
+ if ($description_block != "" && $type != 'hidden'){
389
+ $form .= "<div class='inbound-description'>".$description_block."</div>";
390
+ }
391
+
392
+ $form .= '</div>';
393
+ }
394
+ // End Loop
395
+
396
+ $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
397
+ $form .= '<div class="inbound-field '.$main_layout.' inbound-submit-area"><button type="submit" class="inbound-button-submit inbound-submit-action" value="'.$submit_button.'" name="send" id="inbound_form_submit" data-ignore-form-field="true" style="'.$submit_bg.$submit_color.$image_button.'">
398
+ '.$icon_insert.''.$submit_button.$inner_button.'</button></div><input data-ignore-form-field="true" type="hidden" name="inbound_submitted" value="1">';
399
+ // <!--<input type="submit" '.$submit_button_type.' class="button" value="'.$submit_button.'" name="send" id="inbound_form_submit" />-->
400
+
401
+ $form .= '<input type="hidden" name="inbound_form_n" class="inbound_form_n" value="'.$form_name.'"><input type="hidden" name="inbound_form_lists" id="inbound_form_lists" value="'.$lists.'" data-map-form-field="inbound_form_lists"><input type="hidden" name="inbound_form_id" class="inbound_form_id" value="'.$id.'"><input type="hidden" name="inbound_current_page_url" value="'.$current_page.'"><input type="hidden" name="inbound_furl" value="'. base64_encode($redirect) .'"><input type="hidden" name="inbound_notify" value="'. base64_encode($notify) .'"><input type="hidden" class="inbound_params" name="inbound_params" value=""></form></div>';
402
+ $form .= "<style type='text/css'>.inbound-button-submit{ {$font_size} }</style>";
403
+ $form = preg_replace('/<br class="inbr".\/>/', '', $form); // remove editor br tags
404
+
405
+ return $form;
406
+ }
407
+ }
408
+
409
+ /**
410
+ * Sanitizes form inputs
411
+ */
412
+ static function santize_inputs($content) {
413
+ // Strip HTML Tags
414
+ $clear = strip_tags($content);
415
+ // Clean up things like &amp;
416
+ $clear = html_entity_decode($clear);
417
+ // Strip out any url-encoded stuff
418
+ $clear = urldecode($clear);
419
+ // Replace non-AlNum characters with space
420
+ $clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear);
421
+ // Replace Multiple spaces with single space
422
+ $clear = preg_replace('/ +/', ' ', $clear);
423
+ // Trim the string of leading/trailing space
424
+ $clear = trim($clear);
425
+ return $clear;
426
+ }
427
+
428
+ /**
429
+ * Create shorter shortcode for [inbound_forms]
430
+ */
431
+ static function inbound_short_form_create( $atts, $content = null ) {
432
+ extract(shortcode_atts(array(
433
+ 'id' => '',
434
+ ), $atts));
435
+
436
+ $shortcode = get_post_meta( $id, 'inbound_shortcode', TRUE );
437
+
438
+ // If form id missing add it
439
+ if (!preg_match('/id="/', $shortcode)) {
440
+ $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $id . "\"", $shortcode);
441
+ }
442
+ if ($id === 'default_3'){
443
+ $shortcode = '[inbound_form name="Form Name" layout="vertical" labels="top" submit="Submit" ][inbound_field label="Email" type="text" required="1" ][/inbound_form]';
444
+ }
445
+ if ($id === 'default_1'){
446
+ $shortcode = '[inbound_form name="3 Field Form" layout="vertical" labels="top" submit="Submit" ][inbound_field label="First Name" type="text" required="0" ][inbound_field label="Last Name" type="text" required="0" ][inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ][/inbound_form]';
447
+ }
448
+ if ($id === 'default_2'){
449
+ $shortcode = '[inbound_form name="Standard Company Form" layout="vertical" labels="top" submit="Submit" ]
450
+
451
+ [inbound_field label="First Name" type="text" required="0" placeholder="Enter Your First Name" ]
452
+
453
+ [inbound_field label="Last Name" type="text" required="0" placeholder="Enter Your Last Name" ]
454
+
455
+ [inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ]
456
+
457
+ [inbound_field label="Company Name" type="text" required="0" placeholder="Enter Your Company Name" ]
458
+
459
+ [inbound_field label="Job Title" type="text" required="0" placeholder="Enter Your Job Title" ]
460
+
461
+ [/inbound_form]';
462
+ }
463
+ if (empty($shortcode)) {
464
+ $shortcode = "Form ID: " . $id . " Not Found";
465
+ }
466
+ if ($id === 'none'){
467
+ $shortcode = "";
468
+ }
469
+
470
+ return do_shortcode( $shortcode );
471
+ }
472
+
473
+ /**
474
+ * Enqueue JS & CSS
475
+ */
476
+ static function register_script() {
477
+ wp_enqueue_style( 'inbound-shortcodes' );
478
+ }
479
+
480
+ /**
481
+ * Needs more documentation
482
+ */
483
+ static function print_script() {
484
+ if ( ! self::$add_script ) {
485
+ return;
486
+ }
487
+ wp_enqueue_style( 'inbound-shortcodes' );
488
+ }
489
+
490
+ /**
491
+ * Needs more documentation
492
+ */
493
+ static function inline_my_script() {
494
+ if ( ! self::$add_script ) {
495
+ return;
496
+ }
497
+ /* TODO remove this */
498
+ echo '<script type="text/javascript">
499
+
500
+ jQuery(document).ready(function($){
501
+
502
+ jQuery("form").submit(function(e) {
503
+
504
+ // added below condition for check any of checkbox checked or not by kirit dholakiya
505
+ if( jQuery(\'.checkbox-required\')[0] && jQuery(\'.checkbox-required input[type=checkbox]:checked\').length==0)
506
+ {
507
+ jQuery(\'.checkbox-required input[type=checkbox]:first\').focus();
508
+ alert("' . __( 'Oops! Looks like you have not filled out all of the required fields!' , 'inbound-pro' ) .'");
509
+ e.preventDefault();
510
+ e.stopImmediatePropagation();
511
+ }
512
+ jQuery(this).find("input").each(function(){
513
+ if(!jQuery(this).prop("required")){
514
+ } else if (!jQuery(this).val()) {
515
+ alert("' . __( 'Oops! Looks like you have not filled out all of the required fields!' , 'inbound-pro' ) .'");
516
+
517
+ e.preventDefault();
518
+ e.stopImmediatePropagation();
519
+ return false;
520
+ }
521
+ });
522
+ });
523
+
524
+ jQuery("#inbound_form_submit br").remove(); // remove br tags
525
+ function validateEmail(email) {
526
+
527
+ var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
528
+ return re.test(email);
529
+ }
530
+ var parent_redirect = parent.window.location.href;
531
+ jQuery("#inbound_parent_page").val(parent_redirect);
532
+
533
+
534
+ // validate email
535
+ jQuery("input.inbound-email").on("change keyup", function (e) {
536
+ var $this = jQuery(this);
537
+ var email = $this.val();
538
+ jQuery(".inbound_email_suggestion").remove();
539
+ if (validateEmail(email)) {
540
+ $this.css("color", "green");
541
+ $this.addClass("inbound-valid-email");
542
+ $this.removeClass("inbound-invalid-email");
543
+ } else {
544
+ $this.css("color", "red");
545
+ $this.addClass("inbound-invalid-email");
546
+ $this.removeClass("inbound-valid-email");
547
+ }
548
+ if($this.hasClass("inbound-valid-email")) {
549
+ $this.parent().parent().find("#inbound_form_submit").removeAttr("disabled");
550
+ }
551
+ });
552
+
553
+ /* Trims whitespace on advancing to the next input */
554
+ jQuery("input[type=\'text\']").on("blur" , function() {
555
+ var value = jQuery.trim( $(this).val() );
556
+ jQuery(this).val( value );
557
+ })
558
+
559
+
560
+ });
561
+ </script>';
562
+
563
+ }
564
+
565
+ /**
566
+ * Replaces tokens in automated email
567
+ */
568
+ public static function replace_tokens( $content , $form_data = null , $form_meta_data = null ) {
569
+
570
+ /* replace core tokens */
571
+ $content = str_replace('{{site-name}}', get_bloginfo( 'name' ) , $content);
572
+ //$content = str_replace('{{form-name}}', $form_data['inbound_form_n'] , $content);
573
+
574
+ foreach ($form_data as $key => $value) {
575
+ $token_key = str_replace('_','-', $key);
576
+ $token_key = str_replace('inbound-','', $token_key);
577
+
578
+ $content = str_replace( '{{'.trim($token_key).'}}' , $value , $content );
579
+ }
580
+
581
+ return $content;
582
+ }
583
+
584
+ /**
585
+ * Stores conversion activity into form metadata
586
+ */
587
+ static function store_form_stats($form_id, $email) {
588
+
589
+ //$time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
590
+ // $wordpress_date_time = date("Y-m-d G:i:s", $time);
591
+ $form_conversion_num = get_post_meta($form_id, 'inbound_form_conversion_count', true);
592
+ $form_conversion_num++;
593
+ update_post_meta( $form_id, 'inbound_form_conversion_count', $form_conversion_num );
594
+
595
+ // Add Lead Email to Conversions List
596
+ $lead_conversion_list = get_post_meta( $form_id, 'lead_conversion_list', TRUE );
597
+ $lead_conversion_list = json_decode($lead_conversion_list,true);
598
+ if (is_array($lead_conversion_list)) {
599
+ $lead_count = count($lead_conversion_list);
600
+ $lead_conversion_list[$lead_count]['email'] = $email;
601
+ // $lead_conversion_list[$lead_count]['date'] = $wordpress_date_time;
602
+ $lead_conversion_list = json_encode($lead_conversion_list);
603
+ update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
604
+ } else {
605
+ $lead_conversion_list = array();
606
+ $lead_conversion_list[0]['email'] = $email;
607
+ // $lead_conversion_list[0]['date'] = $wordpress_date_time;
608
+ $lead_conversion_list = json_encode($lead_conversion_list);
609
+ update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
610
+ }
611
+
612
+ }
613
+
614
+ /**
615
+ * Perform Actions After a Form Submit
616
+ */
617
+ static function do_actions(){
618
+
619
+ if(isset($_POST['inbound_submitted']) && $_POST['inbound_submitted'] === '1') {
620
+ $form_post_data = array();
621
+ if(isset($_POST['stop_dirty_subs']) && $_POST['stop_dirty_subs'] != "") {
622
+ wp_die( $message = 'Die You spam bastard' );
623
+ return false;
624
+ }
625
+ /* get form submitted form's meta data */
626
+ $form_meta_data = get_post_meta( $_POST['inbound_form_id'] );
627
+
628
+ if(isset($_POST['inbound_furl']) && $_POST['inbound_furl'] != "") {
629
+ $redirect = base64_decode($_POST['inbound_furl']);
630
+ } else if (isset($_POST['inbound_current_page_url'])) {
631
+ $redirect = $_POST['inbound_current_page_url'];
632
+ }
633
+
634
+
635
+
636
+ //print_r($_POST);
637
+ foreach ( $_POST as $field => $value ) {
638
+
639
+ if ( get_magic_quotes_gpc() && is_string($value) ) {
640
+ $value = stripslashes( $value );
641
+ }
642
+
643
+ $field = strtolower($field);
644
+
645
+ if (preg_match( '/Email|e-mail|email/i', $field)) {
646
+ $field = "wpleads_email_address";
647
+ if(isset($_POST['inbound_form_id']) && $_POST['inbound_form_id'] != "") {
648
+ self::store_form_stats($_POST['inbound_form_id'], $value);
649
+ }
650
+ }
651
+
652
+
653
+ $form_post_data[$field] = (!is_array($value)) ? strip_tags( $value ) : $value;
654
+
655
+ }
656
+
657
+ $form_meta_data['post_id'] = $_POST['inbound_form_id']; // pass in form id
658
+
659
+ /* Send emails if passes spam check returns false */
660
+ if ( !apply_filters( 'inbound_check_if_spam' , false , $form_post_data ) ) {
661
+ self::send_conversion_admin_notification($form_post_data , $form_meta_data);
662
+ self::send_conversion_lead_notification($form_post_data , $form_meta_data);
663
+ }
664
+
665
+ /* hook runs after form actions are completed and before page redirect */
666
+ do_action('inboundnow_form_submit_actions', $form_post_data, $form_meta_data);
667
+
668
+ /* redirect now */
669
+ if ($redirect != "") {
670
+ wp_redirect( $redirect );
671
+ exit();
672
+ }
673
+
674
+ }
675
+
676
+ }
677
+
678
+ /**
679
+ * Sends Notification of New Lead Conversion to Admin & Others Listed on the Form Notification List
680
+ */
681
+ public static function send_conversion_admin_notification( $form_post_data , $form_meta_data ) {
682
+
683
+ if ( $template = self::get_new_lead_email_template()) {
684
+
685
+ add_filter( 'wp_mail_content_type', 'inbound_set_html_content_type' );
686
+ function inbound_set_html_content_type() {
687
+ return 'text/html';
688
+ }
689
+
690
+ /* Rebuild Form Meta Data to Load Single Values */
691
+ foreach( $form_meta_data as $key => $value ) {
692
+ if ( isset($value[0]) ) {
693
+ $form_meta_data[$key] = $value[0];
694
+ }
695
+ }
696
+
697
+ /* If there's no notification email in place then bail */
698
+ if ( !isset($form_meta_data['inbound_notify_email']) ) {
699
+ return;
700
+ }
701
+
702
+ /* Get Email We Should Send Notifications To */
703
+ $email_to = $form_meta_data['inbound_notify_email'];
704
+
705
+ /* Check for Multiple Email Addresses */
706
+ $addresses = explode(",", $email_to);
707
+ if(is_array($addresses) && count($addresses) > 1) {
708
+ $to_address = $addresses;
709
+ } else {
710
+ $to_address[] = $email_to;
711
+ }
712
+
713
+ /* Look for Custom Subject Line , Fall Back on Default */
714
+ $subject = (isset($form_meta_data['inbound_notify_email_subject'])) ? $form_meta_data['inbound_notify_email_subject'] : $template['subject'];
715
+
716
+ /* Discover From Email Address */
717
+ foreach ($form_post_data as $key => $value) {
718
+ if (preg_match('/email|e-mail/i', $key)) {
719
+ $reply_to_email = $form_post_data[$key];
720
+ }
721
+ }
722
+ $domain = get_option( 'siteurl');
723
+ $domain = str_replace('http://', '', $domain);
724
+ $domain = str_replace('https://', '', $domain);
725
+ $domain = str_replace('www', '', $domain);
726
+ $email_default = 'wordpress@' . $domain;
727
+
728
+ /* Leave here for now
729
+ switch( get_option('inbound_forms_enable_akismet' , 'noreply' ) ) {
730
+ case 'noreply':
731
+ BREAK;
732
+
733
+ case 'lead':
734
+
735
+ BREAK;
736
+ }
737
+ */
738
+
739
+ $from_email = get_option( 'admin_email' , $email_default );
740
+ $from_email = apply_filters( 'inbound_admin_notification_from_email' , $from_email );
741
+ $reply_to_email = (isset($reply_to_email)) ? $reply_to_email : $from_email;
742
+ /* Prepare Additional Data For Token Engine */
743
+ $form_post_data['redirect_message'] = (isset($form_post_data['inbound_redirect']) && $form_post_data['inbound_redirect'] != "") ? "They were redirected to " . $form_post_data['inbound_redirect'] : '';
744
+
745
+ /* Discover From Name */
746
+ $from_name = get_option( 'blogname' , '' );
747
+ $from_name = apply_filters( 'inbound_admin_notification_from_name', $from_name );
748
+
749
+ $Inbound_Templating_Engine = Inbound_Templating_Engine();
750
+ $subject = $Inbound_Templating_Engine->replace_tokens( $subject, array($form_post_data, $form_meta_data));
751
+ $body = $Inbound_Templating_Engine->replace_tokens( $template['body'] , array($form_post_data, $form_meta_data ) );
752
+
753
+
754
+ $headers = 'From: '. $from_name .' <'. $from_email .'>' . "\r\n";
755
+ $headers = "Reply-To: ".$reply_to_email . "\r\n";
756
+ $headers = apply_filters( 'inbound_lead_notification_email_headers' , $headers );
757
+
758
+ foreach ($to_address as $key => $recipient) {
759
+ $result = wp_mail( $recipient , $subject , $body , $headers );
760
+ }
761
+
762
+ }
763
+
764
+ }
765
+
766
+ /**
767
+ * Sends An Email to Lead After Conversion
768
+ */
769
+ public static function send_conversion_lead_notification( $form_post_data , $form_meta_data ) {
770
+
771
+
772
+ /* If Notifications Are Off Then Exit */
773
+ if ( !isset($form_meta_data['inbound_email_send_notification'][0]) || $form_meta_data['inbound_email_send_notification'][0] != 'on' ){
774
+ return;
775
+ }
776
+
777
+ /* Get Lead Email Address */
778
+ $lead_email = false;
779
+ foreach ($form_post_data as $key => $value) {
780
+ if (preg_match('/email|e-mail/i', $key)) {
781
+ $lead_email = $form_post_data[$key];
782
+ }
783
+ }
784
+
785
+ /* Redundancy */
786
+ if (!$lead_email) {
787
+ if (isset($form_post_data['email'])) {
788
+ $lead_email = $form_post_data['email'];
789
+ } else if (isset($form_post_data['e-mail'])) {
790
+ $lead_email = $form_post_data['e-mail'];
791
+ } else if (isset($form_post_data['wpleads_email_address'])) {
792
+ $lead_email = $form_post_data['wpleads_email_address'];
793
+ } else {
794
+ $lead_email = 'null map email field';
795
+ }
796
+ }
797
+
798
+ if ( !$lead_email ) {
799
+ return;
800
+ }
801
+
802
+
803
+ $Inbound_Templating_Engine = Inbound_Templating_Engine();
804
+ $form_id = $form_meta_data['post_id']; //This is page id or post id
805
+ $template_id = $form_meta_data['inbound_email_send_notification_template'][0];
806
+
807
+ /* Rebuild Form Meta Data to Load Single Values */
808
+ foreach( $form_meta_data as $key => $value ) {
809
+ $form_meta_data[$key] = $value[0];
810
+ }
811
+
812
+ /* If Email Template Selected Use That */
813
+ if ( $template_id && $template_id != 'custom' ) {
814
+
815
+ $template_array = self::get_email_template( $template_id );
816
+ $confirm_subject = $template_array['subject'];
817
+ $confirm_email_message = $template_array['body'];
818
+
819
+ /* Else Use Custom Template */
820
+ } else {
821
+
822
+ $template = get_post($form_id);
823
+ $content = $template->post_content;
824
+ $confirm_subject = get_post_meta( $form_id, 'inbound_confirmation_subject', TRUE );
825
+ $content = apply_filters('the_content', $content);
826
+ $content = str_replace(']]>', ']]&gt;', $content);
827
+
828
+ $confirm_email_message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html;' . get_option('blog_charset') . '" /></head><body style="margin: 0px; background-color: #F4F3F4; font-family: Helvetica, Arial, sans-serif; font-size:12px;" text="#444444" bgcolor="#F4F3F4" link="#21759B" alink="#21759B" vlink="#21759B" marginheight="0" topmargin="0" marginwidth="0" leftmargin="0"><table cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff" border="0"><tr>';
829
+ $confirm_email_message .= $content;
830
+ $confirm_email_message .= '</tr></table></body></html>';
831
+ }
832
+
833
+
834
+
835
+ $confirm_subject = $Inbound_Templating_Engine->replace_tokens( $confirm_subject, array($form_post_data, $form_meta_data ));
836
+
837
+ /* add default subject if empty */
838
+ if (!$confirm_subject) {
839
+ $confirm_subject = __( 'Thank you!' , 'inbound-pro' );
840
+ }
841
+
842
+ $confirm_email_message = $Inbound_Templating_Engine->replace_tokens( $confirm_email_message , array( $form_post_data, $form_meta_data ) );
843
+
844
+
845
+ $from_name = get_option( 'blogname' , '' );
846
+ $from_email = get_option( 'admin_email' );
847
+
848
+ $headers = "From: " . $from_name . " <" . $from_email . ">\n";
849
+ $headers .= 'Content-type: text/html';
850
+
851
+ wp_mail( $lead_email, $confirm_subject , $confirm_email_message, $headers );
852
+
853
+ }
854
+
855
+ /**
856
+ * Get Email Template for New Lead Notification
857
+ */
858
+ static function get_new_lead_email_template( ) {
859
+
860
+ $email_template = array();
861
+
862
+ $templates = get_posts(array(
863
+ 'post_type' => 'email-template',
864
+ 'posts_per_page' => 1,
865
+ 'meta_key' => '_inbound_template_id',
866
+ 'meta_value' => 'inbound-new-lead-notification'
867
+ ));
868
+
869
+ foreach ( $templates as $template ) {
870
+ $email_template['ID'] = $template->ID;
871
+ $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
872
+ $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
873
+ }
874
+
875
+ return $email_template;
876
+ }
877
+
878
+ /**
879
+ * Get Email Template by ID
880
+ */
881
+ public static function get_email_template( $ID ) {
882
+
883
+ $email_template = array();
884
+
885
+ $template = get_post($ID);
886
+
887
+ $email_template['ID'] = $template->ID;
888
+ $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
889
+ $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
890
+
891
+ return $email_template;
892
+ }
893
+
894
+ /**
895
+ * Prepare an array of days, months, years. Make i18n ready
896
+ * @param STRING $case lets us know which array to return
897
+ *
898
+ * @returns ARRAY of data
899
+ */
900
+ public static function get_date_selectons( $case ) {
901
+
902
+ switch( $case ) {
903
+
904
+ case 'months':
905
+ return array(
906
+ '01' => __( 'Jan' , 'inbound-pro' ),
907
+ '02' => __( 'Feb' , 'inbound-pro' ),
908
+ '03' => __( 'Mar' , 'inbound-pro' ),
909
+ '04' => __( 'Apr' , 'inbound-pro' ),
910
+ '05' => __( 'May' , 'inbound-pro' ),
911
+ '06' => __( 'Jun' , 'inbound-pro' ),
912
+ '07' => __( 'Jul' , 'inbound-pro' ),
913
+ '08' => __( 'Aug' , 'inbound-pro' ),
914
+ '09' => __( 'Sep' , 'inbound-pro' ),
915
+ '10' => __( 'Oct' , 'inbound-pro' ),
916
+ '11' => __( 'Nov' , 'inbound-pro' ),
917
+ '12' => __( 'Dec' , 'inbound-pro' )
918
+ );
919
+ break;
920
+ case 'days' :
921
+ return array (
922
+ '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05',
923
+ '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10',
924
+ '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15',
925
+ '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20',
926
+ '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25',
927
+ '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30',
928
+ '31' => '31'
929
+ );
930
+ break;
931
+ case 'years' :
932
+
933
+ for ($i=1920;$i<2101;$i++) {
934
+ $years[$i] = $i;
935
+ }
936
+
937
+ return $years;
938
+ break;
939
+ }
940
+ }
941
+
942
+ /**
943
+ * Prepare an array of country codes and country names. Make i18n ready
944
+ */
945
+ public static function get_countries_array() {
946
+ return array (
947
+ __( 'AF' , 'leads') => __( 'Afghanistan' , 'inbound-pro' ) ,
948
+ __( 'AX' , 'leads') => __( 'Aland Islands' , 'inbound-pro' ) ,
949
+ __( 'AL' , 'leads') => __( 'Albania' , 'inbound-pro' ) ,
950
+ __( 'DZ' , 'leads') => __( 'Algeria' , 'inbound-pro' ) ,
951
+ __( 'AS' , 'leads') => __( 'American Samoa' , 'inbound-pro' ) ,
952
+ __( 'AD' , 'leads') => __( 'Andorra' , 'inbound-pro' ) ,
953
+ __( 'AO' , 'leads') => __( 'Angola' , 'inbound-pro' ) ,
954
+ __( 'AI' , 'leads') => __( 'Anguilla' , 'inbound-pro' ) ,
955
+ __( 'AQ' , 'leads') => __( 'Antarctica' , 'inbound-pro' ) ,
956
+ __( 'AG' , 'leads') => __( 'Antigua and Barbuda' , 'inbound-pro' ) ,
957
+ __( 'AR' , 'leads') => __( 'Argentina' , 'inbound-pro' ) ,
958
+ __( 'AM' , 'leads') => __( 'Armenia' , 'inbound-pro' ) ,
959
+ __( 'AW' , 'leads') => __( 'Aruba' , 'inbound-pro' ) ,
960
+ __( 'AU' , 'leads') => __( 'Australia' , 'inbound-pro' ) ,
961
+ __( 'AT' , 'leads') => __( 'Austria' , 'inbound-pro' ) ,
962
+ __( 'AZ' , 'leads') => __( 'Azerbaijan' , 'inbound-pro' ) ,
963
+ __( 'BS' , 'leads') => __( 'Bahamas' , 'inbound-pro' ) ,
964
+ __( 'BH' , 'leads') => __( 'Bahrain' , 'inbound-pro' ) ,
965
+ __( 'BD' , 'leads') => __( 'Bangladesh' , 'inbound-pro' ) ,
966
+ __( 'BB' , 'leads') => __( 'Barbados' , 'inbound-pro' ) ,
967
+ __( 'BY' , 'leads') => __( 'Belarus' , 'inbound-pro' ) ,
968
+ __( 'BE' , 'leads') => __( 'Belgium' , 'inbound-pro' ) ,
969
+ __( 'BZ' , 'leads') => __( 'Belize' , 'inbound-pro' ) ,
970
+ __( 'BJ' , 'leads') => __( 'Benin' , 'inbound-pro' ) ,
971
+ __( 'BM' , 'leads') => __( 'Bermuda' , 'inbound-pro' ) ,
972
+ __( 'BT' , 'leads') => __( 'Bhutan' , 'inbound-pro' ) ,
973
+ __( 'BO' , 'leads') => __( 'Bolivia' , 'inbound-pro' ) ,
974
+ __( 'BA' , 'leads') => __( 'Bosnia and Herzegovina' , 'inbound-pro' ) ,
975
+ __( 'BW' , 'leads') => __( 'Botswana' , 'inbound-pro' ) ,
976
+ __( 'BV' , 'leads') => __( 'Bouvet Island' , 'inbound-pro' ) ,
977
+ __( 'BR' , 'leads') => __( 'Brazil' , 'inbound-pro' ) ,
978
+ __( 'IO' , 'leads') => __( 'British Indian Ocean Territory' , 'inbound-pro' ) ,
979
+ __( 'BN' , 'leads') => __( 'Brunei Darussalam' , 'inbound-pro' ) ,
980
+ __( 'BG' , 'leads') => __( 'Bulgaria' , 'inbound-pro' ) ,
981
+ __( 'BF' , 'leads') => __( 'Burkina Faso' , 'inbound-pro' ) ,
982
+ __( 'BI' , 'leads') => __( 'Burundi' , 'inbound-pro' ) ,
983
+ __( 'KH' , 'leads') => __( 'Cambodia' , 'inbound-pro' ) ,
984
+ __( 'CM' , 'leads') => __( 'Cameroon' , 'inbound-pro' ) ,
985
+ __( 'CA' , 'leads') => __( 'Canada' , 'inbound-pro' ) ,
986
+ __( 'CV' , 'leads') => __( 'Cape Verde' , 'inbound-pro' ) ,
987
+ __( 'BQ' , 'leads') => __( 'Caribbean Netherlands ' , 'inbound-pro' ) ,
988
+ __( 'KY' , 'leads') => __( 'Cayman Islands' , 'inbound-pro' ) ,
989
+ __( 'CF' , 'leads') => __( 'Central African Republic' , 'inbound-pro' ) ,
990
+ __( 'TD' , 'leads') => __( 'Chad' , 'inbound-pro' ) ,
991
+ __( 'CL' , 'leads') => __( 'Chile' , 'inbound-pro' ) ,
992
+ __( 'CN' , 'leads') => __( 'China' , 'inbound-pro' ) ,
993
+ __( 'CX' , 'leads') => __( 'Christmas Island' , 'inbound-pro' ) ,
994
+ __( 'CC' , 'leads') => __( 'Cocos (Keeling) Islands' , 'inbound-pro' ) ,
995
+ __( 'CO' , 'leads') => __( 'Colombia' , 'inbound-pro' ) ,
996
+ __( 'KM' , 'leads') => __( 'Comoros' , 'inbound-pro' ) ,
997
+ __( 'CG' , 'leads') => __( 'Congo' , 'inbound-pro' ) ,
998
+ __( 'CD' , 'leads') => __( 'Congo, Democratic Republic of' , 'inbound-pro' ) ,
999
+ __( 'CK' , 'leads') => __( 'Cook Islands' , 'inbound-pro' ) ,
1000
+ __( 'CR' , 'leads') => __( 'Costa Rica' , 'inbound-pro' ) ,
1001
+ __( 'CI' , 'leads') => __( 'Cote d\'Ivoire' , 'inbound-pro' ) ,
1002
+ __( 'HR' , 'leads') => __( 'Croatia' , 'inbound-pro' ) ,
1003
+ __( 'CU' , 'leads') => __( 'Cuba' , 'inbound-pro' ) ,
1004
+ __( 'CW' , 'leads') => __( 'Curacao' , 'inbound-pro' ) ,
1005
+ __( 'CY' , 'leads') => __( 'Cyprus' , 'inbound-pro' ) ,
1006
+ __( 'CZ' , 'leads') => __( 'Czech Republic' , 'inbound-pro' ) ,
1007
+ __( 'DK' , 'leads') => __( 'Denmark' , 'inbound-pro' ) ,
1008
+ __( 'DJ' , 'leads') => __( 'Djibouti' , 'inbound-pro' ) ,
1009
+ __( 'DM' , 'leads') => __( 'Dominica' , 'inbound-pro' ) ,
1010
+ __( 'DO' , 'leads') => __( 'Dominican Republic' , 'inbound-pro' ) ,
1011
+ __( 'EC' , 'leads') => __( 'Ecuador' , 'inbound-pro' ) ,
1012
+ __( 'EG' , 'leads') => __( 'Egypt' , 'inbound-pro' ) ,
1013
+ __( 'SV' , 'leads') => __( 'El Salvador' , 'inbound-pro' ) ,
1014
+ __( 'GQ' , 'leads') => __( 'Equatorial Guinea' , 'inbound-pro' ) ,
1015
+ __( 'ER' , 'leads') => __( 'Eritrea' , 'inbound-pro' ) ,
1016
+ __( 'EE' , 'leads') => __( 'Estonia' , 'inbound-pro' ) ,
1017
+ __( 'ET' , 'leads') => __( 'Ethiopia' , 'inbound-pro' ) ,
1018
+ __( 'FK' , 'leads') => __( 'Falkland Islands' , 'inbound-pro' ) ,
1019
+ __( 'FO' , 'leads') => __( 'Faroe Islands' , 'inbound-pro' ) ,
1020
+ __( 'FJ' , 'leads') => __( 'Fiji' , 'inbound-pro' ) ,
1021
+ __( 'FI' , 'leads') => __( 'Finland' , 'inbound-pro' ) ,
1022
+ __( 'FR' , 'leads') => __( 'France' , 'inbound-pro' ) ,
1023
+ __( 'GF' , 'leads') => __( 'French Guiana' , 'inbound-pro' ) ,
1024
+ __( 'PF' , 'leads') => __( 'French Polynesia' , 'inbound-pro' ) ,
1025
+ __( 'TF' , 'leads') => __( 'French Southern Territories' , 'inbound-pro' ) ,
1026
+ __( 'GA' , 'leads') => __( 'Gabon' , 'inbound-pro' ) ,
1027
+ __( 'GM' , 'leads') => __( 'Gambia' , 'inbound-pro' ) ,
1028
+ __( 'GE' , 'leads') => __( 'Georgia' , 'inbound-pro' ) ,
1029
+ __( 'DE' , 'leads') => __( 'Germany' , 'inbound-pro' ) ,
1030
+ __( 'GH' , 'leads') => __( 'Ghana' , 'inbound-pro' ) ,
1031
+ __( 'GI' , 'leads') => __( 'Gibraltar' , 'inbound-pro' ) ,
1032
+ __( 'GR' , 'leads') => __( 'Greece' , 'inbound-pro' ) ,
1033
+ __( 'GL' , 'leads') => __( 'Greenland' , 'inbound-pro' ) ,
1034
+ __( 'GD' , 'leads') => __( 'Grenada' , 'inbound-pro' ) ,
1035
+ __( 'GP' , 'leads') => __( 'Guadeloupe' , 'inbound-pro' ) ,
1036
+ __( 'GU' , 'leads') => __( 'Guam' , 'inbound-pro' ) ,
1037
+ __( 'GT' , 'leads') => __( 'Guatemala' , 'inbound-pro' ) ,
1038
+ __( 'GG' , 'leads') => __( 'Guernsey' , 'inbound-pro' ) ,
1039
+ __( 'GN' , 'leads') => __( 'Guinea' , 'inbound-pro' ) ,
1040
+ __( 'GW' , 'leads') => __( 'Guinea-Bissau' , 'inbound-pro' ) ,
1041
+ __( 'GY' , 'leads') => __( 'Guyana' , 'inbound-pro' ) ,
1042
+ __( 'HT' , 'leads') => __( 'Haiti' , 'inbound-pro' ) ,
1043
+ __( 'HM' , 'leads') => __( 'Heard and McDonald Islands' , 'inbound-pro' ) ,
1044
+ __( 'HN' , 'leads') => __( 'Honduras' , 'inbound-pro' ) ,
1045
+ __( 'HK' , 'leads') => __( 'Hong Kong' , 'inbound-pro' ) ,
1046
+ __( 'HU' , 'leads') => __( 'Hungary' , 'inbound-pro' ) ,
1047
+ __( 'IS' , 'leads') => __( 'Iceland' , 'inbound-pro' ) ,
1048
+ __( 'IN' , 'leads') => __( 'India' , 'inbound-pro' ) ,
1049
+ __( 'ID' , 'leads') => __( 'Indonesia' , 'inbound-pro' ) ,
1050
+ __( 'IR' , 'leads') => __( 'Iran' , 'inbound-pro' ) ,
1051
+ __( 'IQ' , 'leads') => __( 'Iraq' , 'inbound-pro' ) ,
1052
+ __( 'IE' , 'leads') => __( 'Ireland' , 'inbound-pro' ) ,
1053
+ __( 'IM' , 'leads') => __( 'Isle of Man' , 'inbound-pro' ) ,
1054
+ __( 'IL' , 'leads') => __( 'Israel' , 'inbound-pro' ) ,
1055
+ __( 'IT' , 'leads') => __( 'Italy' , 'inbound-pro' ) ,
1056
+ __( 'JM' , 'leads') => __( 'Jamaica' , 'inbound-pro' ) ,
1057
+ __( 'JP' , 'leads') => __( 'Japan' , 'inbound-pro' ) ,
1058
+ __( 'JE' , 'leads') => __( 'Jersey' , 'inbound-pro' ) ,
1059
+ __( 'JO' , 'leads') => __( 'Jordan' , 'inbound-pro' ) ,
1060
+ __( 'KZ' , 'leads') => __( 'Kazakhstan' , 'inbound-pro' ) ,
1061
+ __( 'KE' , 'leads') => __( 'Kenya' , 'inbound-pro' ) ,
1062
+ __( 'KI' , 'leads') => __( 'Kiribati' , 'inbound-pro' ) ,
1063
+ __( 'KW' , 'leads') => __( 'Kuwait' , 'inbound-pro' ) ,
1064
+ __( 'KG' , 'leads') => __( 'Kyrgyzstan' , 'inbound-pro' ) ,
1065
+ __( 'LA' , 'leads') => __( 'Lao People\'s Democratic Republic' , 'inbound-pro' ) ,
1066
+ __( 'LV' , 'leads') => __( 'Latvia' , 'inbound-pro' ) ,
1067
+ __( 'LB' , 'leads') => __( 'Lebanon' , 'inbound-pro' ) ,
1068
+ __( 'LS' , 'leads') => __( 'Lesotho' , 'inbound-pro' ) ,
1069
+ __( 'LR' , 'leads') => __( 'Liberia' , 'inbound-pro' ) ,
1070
+ __( 'LY' , 'leads') => __( 'Libya' , 'inbound-pro' ) ,
1071
+ __( 'LI' , 'leads') => __( 'Liechtenstein' , 'inbound-pro' ) ,
1072
+ __( 'LT' , 'leads') => __( 'Lithuania' , 'inbound-pro' ) ,
1073
+ __( 'LU' , 'leads') => __( 'Luxembourg' , 'inbound-pro' ) ,
1074
+ __( 'MO' , 'leads') => __( 'Macau' , 'inbound-pro' ) ,
1075
+ __( 'MK' , 'leads') => __( 'Macedonia' , 'inbound-pro' ) ,
1076
+ __( 'MG' , 'leads') => __( 'Madagascar' , 'inbound-pro' ) ,
1077
+ __( 'MW' , 'leads') => __( 'Malawi' , 'inbound-pro' ) ,
1078
+ __( 'MY' , 'leads') => __( 'Malaysia' , 'inbound-pro' ) ,
1079
+ __( 'MV' , 'leads') => __( 'Maldives' , 'inbound-pro' ) ,
1080
+ __( 'ML' , 'leads') => __( 'Mali' , 'inbound-pro' ) ,
1081
+ __( 'MT' , 'leads') => __( 'Malta' , 'inbound-pro' ) ,
1082
+ __( 'MH' , 'leads') => __( 'Marshall Islands' , 'inbound-pro' ) ,
1083
+ __( 'MQ' , 'leads') => __( 'Martinique' , 'inbound-pro' ) ,
1084
+ __( 'MR' , 'leads') => __( 'Mauritania' , 'inbound-pro' ) ,
1085
+ __( 'MU' , 'leads') => __( 'Mauritius' , 'inbound-pro' ) ,
1086
+ __( 'YT' , 'leads') => __( 'Mayotte' , 'inbound-pro' ) ,
1087
+ __( 'MX' , 'leads') => __( 'Mexico' , 'inbound-pro' ) ,
1088
+ __( 'FM' , 'leads') => __( 'Micronesia, Federated States of' , 'inbound-pro' ) ,
1089
+ __( 'MD' , 'leads') => __( 'Moldova' , 'inbound-pro' ) ,
1090
+ __( 'MC' , 'leads') => __( 'Monaco' , 'inbound-pro' ) ,
1091
+ __( 'MN' , 'leads') => __( 'Mongolia' , 'inbound-pro' ) ,
1092
+ __( 'ME' , 'leads') => __( 'Montenegro' , 'inbound-pro' ) ,
1093
+ __( 'MS' , 'leads') => __( 'Montserrat' , 'inbound-pro' ) ,
1094
+ __( 'MA' , 'leads') => __( 'Morocco' , 'inbound-pro' ) ,
1095
+ __( 'MZ' , 'leads') => __( 'Mozambique' , 'inbound-pro' ) ,
1096
+ __( 'MM' , 'leads') => __( 'Myanmar' , 'inbound-pro' ) ,
1097
+ __( 'NA' , 'leads') => __( 'Namibia' , 'inbound-pro' ) ,
1098
+ __( 'NR' , 'leads') => __( 'Nauru' , 'inbound-pro' ) ,
1099
+ __( 'NP' , 'leads') => __( 'Nepal' , 'inbound-pro' ) ,
1100
+ __( 'NC' , 'leads') => __( 'New Caledonia' , 'inbound-pro' ) ,
1101
+ __( 'NZ' , 'leads') => __( 'New Zealand' , 'inbound-pro' ) ,
1102
+ __( 'NI' , 'leads') => __( 'Nicaragua' , 'inbound-pro' ) ,
1103
+ __( 'NE' , 'leads') => __( 'Niger' , 'inbound-pro' ) ,
1104
+ __( 'NG' , 'leads') => __( 'Nigeria' , 'inbound-pro' ) ,
1105
+ __( 'NU' , 'leads') => __( 'Niue' , 'inbound-pro' ) ,
1106
+ __( 'NF' , 'leads') => __( 'Norfolk Island' , 'inbound-pro' ) ,
1107
+ __( 'KP' , 'leads') => __( 'North Korea' , 'inbound-pro' ) ,
1108
+ __( 'MP' , 'leads') => __( 'Northern Mariana Islands' , 'inbound-pro' ) ,
1109
+ __( 'NO' , 'leads') => __( 'Norway' , 'inbound-pro' ) ,
1110
+ __( 'OM' , 'leads') => __( 'Oman' , 'inbound-pro' ) ,
1111
+ __( 'PK' , 'leads') => __( 'Pakistan' , 'inbound-pro' ) ,
1112
+ __( 'PW' , 'leads') => __( 'Palau' , 'inbound-pro' ) ,
1113
+ __( 'PS' , 'leads') => __( 'Palestinian Territory, Occupied' , 'inbound-pro' ) ,
1114
+ __( 'PA' , 'leads') => __( 'Panama' , 'inbound-pro' ) ,
1115
+ __( 'PG' , 'leads') => __( 'Papua New Guinea' , 'inbound-pro' ) ,
1116
+ __( 'PY' , 'leads') => __( 'Paraguay' , 'inbound-pro' ) ,
1117
+ __( 'PE' , 'leads') => __( 'Peru' , 'inbound-pro' ) ,
1118
+ __( 'PH' , 'leads') => __( 'Philippines' , 'inbound-pro' ) ,
1119
+ __( 'PN' , 'leads') => __( 'Pitcairn' , 'inbound-pro' ) ,
1120
+ __( 'PL' , 'leads') => __( 'Poland' , 'inbound-pro' ) ,
1121
+ __( 'PT' , 'leads') => __( 'Portugal' , 'inbound-pro' ) ,
1122
+ __( 'PR' , 'leads') => __( 'Puerto Rico' , 'inbound-pro' ) ,
1123
+ __( 'QA' , 'leads') => __( 'Qatar' , 'inbound-pro' ) ,
1124
+ __( 'RE' , 'leads') => __( 'Reunion' , 'inbound-pro' ) ,
1125
+ __( 'RO' , 'leads') => __( 'Romania' , 'inbound-pro' ) ,
1126
+ __( 'RU' , 'leads') => __( 'Russian Federation' , 'inbound-pro' ) ,
1127
+ __( 'RW' , 'leads') => __( 'Rwanda' , 'inbound-pro' ) ,
1128
+ __( 'BL' , 'leads') => __( 'Saint Barthelemy' , 'inbound-pro' ) ,
1129
+ __( 'SH' , 'leads') => __( 'Saint Helena' , 'inbound-pro' ) ,
1130
+ __( 'KN' , 'leads') => __( 'Saint Kitts and Nevis' , 'inbound-pro' ) ,
1131
+ __( 'LC' , 'leads') => __( 'Saint Lucia' , 'inbound-pro' ) ,
1132
+ __( 'VC' , 'leads') => __( 'Saint Vincent and the Grenadines' , 'inbound-pro' ) ,
1133
+ __( 'MF' , 'leads') => __( 'Saint-Martin (France)' , 'inbound-pro' ) ,
1134
+ __( 'SX' , 'leads') => __( 'Saint-Martin (Pays-Bas)' , 'inbound-pro' ) ,
1135
+ __( 'WS' , 'leads') => __( 'Samoa' , 'inbound-pro' ) ,
1136
+ __( 'SM' , 'leads') => __( 'San Marino' , 'inbound-pro' ) ,
1137
+ __( 'ST' , 'leads') => __( 'Sao Tome and Principe' , 'inbound-pro' ) ,
1138
+ __( 'SA' , 'leads') => __( 'Saudi Arabia' , 'inbound-pro' ) ,
1139
+ __( 'SN' , 'leads') => __( 'Senegal' , 'inbound-pro' ) ,
1140
+ __( 'RS' , 'leads') => __( 'Serbia' , 'inbound-pro' ) ,
1141
+ __( 'SC' , 'leads') => __( 'Seychelles' , 'inbound-pro' ) ,
1142
+ __( 'SL' , 'leads') => __( 'Sierra Leone' , 'inbound-pro' ) ,
1143
+ __( 'SG' , 'leads') => __( 'Singapore' , 'inbound-pro' ) ,
1144
+ __( 'SK' , 'leads') => __( 'Slovakia (Slovak Republic)' , 'inbound-pro' ) ,
1145
+ __( 'SI' , 'leads') => __( 'Slovenia' , 'inbound-pro' ) ,
1146
+ __( 'SB' , 'leads') => __( 'Solomon Islands' , 'inbound-pro' ) ,
1147
+ __( 'SO' , 'leads') => __( 'Somalia' , 'inbound-pro' ) ,
1148
+ __( 'ZA' , 'leads') => __( 'South Africa' , 'inbound-pro' ) ,
1149
+ __( 'GS' , 'leads') => __( 'South Georgia and the South Sandwich Islands' , 'inbound-pro' ) ,
1150
+ __( 'KR' , 'leads') => __( 'South Korea' , 'inbound-pro' ) ,
1151
+ __( 'SS' , 'leads') => __( 'South Sudan' , 'inbound-pro' ) ,
1152
+ __( 'ES' , 'leads') => __( 'Spain' , 'inbound-pro' ) ,
1153
+ __( 'LK' , 'leads') => __( 'Sri Lanka' , 'inbound-pro' ) ,
1154
+ __( 'PM' , 'leads') => __( 'St. Pierre and Miquelon' , 'inbound-pro' ) ,
1155
+ __( 'SD' , 'leads') => __( 'Sudan' , 'inbound-pro' ) ,
1156
+ __( 'SR' , 'leads') => __( 'Suriname' , 'inbound-pro' ) ,
1157
+ __( 'SJ' , 'leads') => __( 'Svalbard and Jan Mayen Islands' , 'inbound-pro' ) ,
1158
+ __( 'SZ' , 'leads') => __( 'Swaziland' , 'inbound-pro' ) ,
1159
+ __( 'SE' , 'leads') => __( 'Sweden' , 'inbound-pro' ) ,
1160
+ __( 'CH' , 'leads') => __( 'Switzerland' , 'inbound-pro' ) ,
1161
+ __( 'SY' , 'leads') => __( 'Syria' , 'inbound-pro' ) ,
1162
+ __( 'TW' , 'leads') => __( 'Taiwan' , 'inbound-pro' ) ,
1163
+ __( 'TJ' , 'leads') => __( 'Tajikistan' , 'inbound-pro' ) ,
1164
+ __( 'TZ' , 'leads') => __( 'Tanzania' , 'inbound-pro' ) ,
1165
+ __( 'TH' , 'leads') => __( 'Thailand' , 'inbound-pro' ) ,
1166
+ __( 'NL' , 'leads') => __( 'The Netherlands' , 'inbound-pro' ) ,
1167
+ __( 'TL' , 'leads') => __( 'Timor-Leste' , 'inbound-pro' ) ,
1168
+ __( 'TG' , 'leads') => __( 'Togo' , 'inbound-pro' ) ,
1169
+ __( 'TK' , 'leads') => __( 'Tokelau' , 'inbound-pro' ) ,
1170
+ __( 'TO' , 'leads') => __( 'Tonga' , 'inbound-pro' ) ,
1171
+ __( 'TT' , 'leads') => __( 'Trinidad and Tobago' , 'inbound-pro' ) ,
1172
+ __( 'TN' , 'leads') => __( 'Tunisia' , 'inbound-pro' ) ,
1173
+ __( 'TR' , 'leads') => __( 'Turkey' , 'inbound-pro' ) ,
1174
+ __( 'TM' , 'leads') => __( 'Turkmenistan' , 'inbound-pro' ) ,
1175
+ __( 'TC' , 'leads') => __( 'Turks and Caicos Islands' , 'inbound-pro' ) ,
1176
+ __( 'TV' , 'leads') => __( 'Tuvalu' , 'inbound-pro' ) ,
1177
+ __( 'UG' , 'leads') => __( 'Uganda' , 'inbound-pro' ) ,
1178
+ __( 'UA' , 'leads') => __( 'Ukraine' , 'inbound-pro' ) ,
1179
+ __( 'AE' , 'leads') => __( 'United Arab Emirates' , 'inbound-pro' ) ,
1180
+ __( 'GB' , 'leads') => __( 'United Kingdom' , 'inbound-pro' ) ,
1181
+ __( 'US' , 'leads') => __( 'United States' , 'inbound-pro' ) ,
1182
+ __( 'UM' , 'leads') => __( 'United States Minor Outlying Islands' , 'inbound-pro' ) ,
1183
+ __( 'UY' , 'leads') => __( 'Uruguay' , 'inbound-pro' ) ,
1184
+ __( 'UZ' , 'leads') => __( 'Uzbekistan' , 'inbound-pro' ) ,
1185
+ __( 'VU' , 'leads') => __( 'Vanuatu' , 'inbound-pro' ) ,
1186
+ __( 'VA' , 'leads') => __( 'Vatican' , 'inbound-pro' ) ,
1187
+ __( 'VE' , 'leads') => __( 'Venezuela' , 'inbound-pro' ) ,
1188
+ __( 'VN' , 'leads') => __( 'Vietnam' , 'inbound-pro' ) ,
1189
+ __( 'VG' , 'leads') => __( 'Virgin Islands (British)' , 'inbound-pro' ) ,
1190
+ __( 'VI' , 'leads') => __( 'Virgin Islands (U.S.)' , 'inbound-pro' ) ,
1191
+ __( 'WF' , 'leads') => __( 'Wallis and Futuna Islands' , 'inbound-pro' ) ,
1192
+ __( 'EH' , 'leads') => __( 'Western Sahara' , 'inbound-pro' ) ,
1193
+ __( 'YE' , 'leads') => __( 'Yemen' , 'inbound-pro' ) ,
1194
+ __( 'ZM' , 'leads') => __( 'Zambia' , 'inbound-pro' ) ,
1195
+ __( 'ZW' , 'leads') => __( 'Zimbabwe' , 'inbound-pro' )
1196
+ );
1197
+ }
1198
+
1199
+ /**
1200
+ * Gets dataset of form settings by form id
1201
+ */
1202
+ public static function get_form_settings( $form_id ) {
1203
+
1204
+ $meta = get_post_meta( $form_id );
1205
+
1206
+ foreach ($meta as $key => $value ) {
1207
+ $meta[ $key ] = $value[0];
1208
+ }
1209
+
1210
+ return $meta;
1211
+ }
1212
+ }
1213
+
1214
+ Inbound_Forms::init();
1215
+ }
shared/classes/class.lead-storage.php CHANGED
@@ -53,7 +53,7 @@ if (!class_exists('LeadStorage')) {
53
  if(isset($_POST)){
54
  $args = array_merge( $args, $_POST );
55
  }
56
-
57
  $lead = array();
58
  if(isset($user_ID)){
59
  $lead['user_ID'] = $user_ID;
@@ -228,12 +228,12 @@ if (!class_exists('LeadStorage')) {
228
  */
229
  static function store_mapped_data($lead, $mappedData){
230
  foreach ($mappedData as $key => $value) {
231
-
232
- /* sanitise inputs */
233
- if (is_string($value)) {
234
- $value = strip_tags( $value , '<p><br><b><span><i><strong>');
235
- }
236
-
237
  update_post_meta($lead['id'], $key, $value);
238
  /* Old convention with wpleads_ prefix */
239
  if( !strstr($key,'wpleads_') ) {
@@ -271,7 +271,7 @@ if (!class_exists('LeadStorage')) {
271
  $search_data = json_encode($search_data);
272
  update_post_meta($lead['id'], 'wpleads_search_data', $search_data); // Store search object
273
  }
274
-
275
  /**
276
  * updates conversion data object
277
  */
@@ -628,12 +628,12 @@ if (!function_exists('inbound_store_lead')) {
628
  } else {
629
  $Leads->set_mode('ajax');
630
  }
631
-
632
  /* prepare lead lists as array */
633
  if (isset($args['lead_lists']) && !is_array($args['lead_lists'])) {
634
- $args['lead_lists'] = explode(',',$args['lead_lists']);
635
- }
636
-
637
  $lead_id = $Leads::inbound_lead_store( $args );
638
 
639
  return $lead_id;
53
  if(isset($_POST)){
54
  $args = array_merge( $args, $_POST );
55
  }
56
+
57
  $lead = array();
58
  if(isset($user_ID)){
59
  $lead['user_ID'] = $user_ID;
228
  */
229
  static function store_mapped_data($lead, $mappedData){
230
  foreach ($mappedData as $key => $value) {
231
+
232
+ /* sanitise inputs */
233
+ if (is_string($value)) {
234
+ $value = strip_tags( $value );
235
+ }
236
+
237
  update_post_meta($lead['id'], $key, $value);
238
  /* Old convention with wpleads_ prefix */
239
  if( !strstr($key,'wpleads_') ) {
271
  $search_data = json_encode($search_data);
272
  update_post_meta($lead['id'], 'wpleads_search_data', $search_data); // Store search object
273
  }
274
+
275
  /**
276
  * updates conversion data object
277
  */
628
  } else {
629
  $Leads->set_mode('ajax');
630
  }
631
+
632
  /* prepare lead lists as array */
633
  if (isset($args['lead_lists']) && !is_array($args['lead_lists'])) {
634
+ $args['lead_lists'] = explode(',',$args['lead_lists']);
635
+ }
636
+
637
  $lead_id = $Leads::inbound_lead_store( $args );
638
 
639
  return $lead_id;
shared/classes/class.load-shared.php CHANGED
@@ -74,7 +74,7 @@ if (!class_exists('Inbound_Load_Shared')) {
74
  // Load Notifications
75
  include_once( INBOUDNOW_SHARED_PATH . 'classes/class.notifications.php');
76
  // Load Magic
77
- include_once( INBOUDNOW_SHARED_PATH . 'classes/class.magic.php');
78
 
79
 
80
  self::load_legacy_elements();
74
  // Load Notifications
75
  include_once( INBOUDNOW_SHARED_PATH . 'classes/class.notifications.php');
76
  // Load Magic
77
+ //include_once( INBOUDNOW_SHARED_PATH . 'classes/class.magic.php');
78
 
79
 
80
  self::load_legacy_elements();
shared/classes/class.magic.php CHANGED
@@ -1,92 +1,105 @@
1
- <?php
2
- /**
3
- * Fixes jQuery and Javascript issues from popping up
4
- *
5
- * Usage: When using jQuery: use InboundQuery instead of jQuery / $
6
- *
7
- */
8
-
9
- if ( ! class_exists( 'Inbound_Magic' ) ) {
10
-
11
- class Inbound_Magic {
12
- static $end_buffer_fired;
13
-
14
- static function init() {
15
- /* determines if in ajax mode */
16
- if(is_admin()) {
17
- add_action( 'admin_enqueue_scripts', array( __CLASS__ , 'start_buffer'), -9999 );
18
- add_action( 'admin_head', array( __CLASS__ , 'end_buffer'), -9999 );
19
- } else {
20
- add_action( 'wp_enqueue_scripts', array( __CLASS__ , 'start_buffer'), -9999 );
21
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
22
- // check for plugin using plugin name
23
- if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) ) {
24
- //plugin is activated
25
- add_action( 'wp_footer', array( __CLASS__ , 'end_buffer'), -9999 );
26
- } else {
27
- add_action( 'wp_head', array( __CLASS__ , 'end_buffer'), -9999 );
28
- }
29
-
30
- }
31
-
32
- }
33
-
34
- /* Fix JavaScript Conflicts in WordPress */
35
- public static function start_buffer() {
36
- ob_start( array( 'Inbound_Magic', 'buffer_callback' ) );
37
- }
38
- /**
39
- * Collects the buffer, and injects a `jQueryWP` JS object as a
40
- * copy of `jQuery`, so that dumb themes and plugins can't hurt it
41
- */
42
- public static function buffer_callback( $content ) {
43
-
44
- $patternFrontEnd = "#wp-includes/js/jquery/jquery\.js\?ver=([^']+)'></script>#";
45
- $patternFrontTwo = "#wp-includes/js/jquery/jquery\.js'></script>#";
46
- $externalPattern = "#/jquery.min.js'></script>#";
47
- $patternAdmin = "#load-scripts.php\?([^']+)'></script>#";
48
- $content = "<!-- /* This Site's marketing is powered by InboundNow.com */ -->" . $content;
49
- //window.onerror=function(o,n,l){return console.log(o),console.log(n),console.log(l),!0};
50
-
51
- if ( preg_match( $patternFrontEnd, $content ) ) {
52
- //InboundQuery = (typeof jQuery !== "undefined") ? jQuery : false;
53
- $content = preg_replace( $patternFrontEnd, '$0<script>InboundQuery = jQuery;</script>', $content );
54
- return $content;
55
-
56
- } else if ( preg_match( $patternFrontTwo, $content ) ) {
57
- //InboundQuery = (typeof jQuery !== "undefined") ? jQuery : false;
58
- $content = preg_replace( $patternFrontTwo, '$0<script>InboundQuery = jQuery;</script>', $content );
59
- return $content;
60
-
61
- } else if ( preg_match( $externalPattern, $content ) ) {
62
- /* match external google lib */
63
- $content = preg_replace( $externalPattern, '$0<script>InboundQuery = jQuery;</script>', $content );
64
- return $content;
65
- }
66
-
67
- if ( preg_match( $patternAdmin, $content ) ) {
68
- $content = preg_replace( $patternAdmin, '$0<script>InboundQuery = jQuery;</script>', $content );
69
- return $content;
70
- }
71
-
72
- //return $content;
73
-
74
- }
75
- /**
76
- * Flushes the buffer
77
- */
78
- public static function end_buffer() {
79
- if (self::$end_buffer_fired) {
80
- return;
81
- }
82
-
83
- ob_end_flush();
84
-
85
- self::$end_buffer_fired = true;
86
- }
87
-
88
- }
89
-
90
- Inbound_Magic::init();
91
-
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
1
+ <?php
2
+ /**
3
+ * Fixes jQuery and Javascript issues from popping up
4
+ *
5
+ * Usage: When using jQuery: use jQuery instead of jQuery / $
6
+ *
7
+ */
8
+
9
+ if ( ! class_exists( 'Inbound_Magic' ) ) {
10
+
11
+ class Inbound_Magic {
12
+ static $end_buffer_fired;
13
+
14
+ static function init() {
15
+ /* determines if in ajax mode */
16
+ if(is_admin()) {
17
+ add_action( 'admin_enqueue_scripts', array( __CLASS__ , 'start_buffer'), -9999 );
18
+ add_action( 'admin_head', array( __CLASS__ , 'end_buffer'), -9999 );
19
+ } else {
20
+ add_action( 'wp_enqueue_scripts', array( __CLASS__ , 'start_buffer'), -9999 );
21
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
22
+ // check for plugin using plugin name
23
+ if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) ) {
24
+ //plugin is activated
25
+ add_action( 'wp_footer', array( __CLASS__ , 'end_buffer'), -9999 );
26
+ } else {
27
+ add_action( 'wp_head', array( __CLASS__ , 'end_buffer'), -9999 );
28
+ }
29
+
30
+ }
31
+
32
+ }
33
+
34
+ /* Fix JavaScript Conflicts in WordPress */
35
+ public static function start_buffer() {
36
+ ob_start( array( 'Inbound_Magic', 'buffer_callback' ) );
37
+ }
38
+ /**
39
+ * Collects the buffer, and injects a `jQueryWP` JS object as a
40
+ * copy of `jQuery`, so that dumb themes and plugins can't hurt it
41
+ */
42
+ public static function buffer_callback( $content ) {
43
+
44
+
45
+ $main = "#/jquery\.js(.*?)</script>#";
46
+ $patternFrontEnd = "#wp-includes/js/jquery/jquery\.js\?ver=([^']+)'></script>#";
47
+ $patternFrontTwo = "#wp-includes/js/jquery/jquery\.js'></script>#";
48
+ $patternFrontThree = "#jquery\.min\.js\?ver\=([^']+)'></script>#";
49
+ $externalPattern = "#/jquery.min.js'></script>#";
50
+ $patternAdmin = "#load-scripts.php\?([^']+)'></script>#";
51
+ $content = "<!-- /* This Site's marketing is powered by InboundNow.com */ -->" . $content;
52
+ //window.onerror=function(o,n,l){return console.log(o),console.log(n),console.log(l),!0};
53
+
54
+ if ( preg_match( $main, $content ) ) {
55
+ //jQuery = (typeof jQuery !== "undefined") ? jQuery : false;
56
+ $content = preg_replace( $main, '$0<script>jQuery = jQuery;</script>', $content );
57
+ return $content;
58
+
59
+ }else if ( preg_match( $patternFrontEnd, $content ) ) {
60
+ //jQuery = (typeof jQuery !== "undefined") ? jQuery : false;
61
+ $content = preg_replace( $patternFrontEnd, '$0<script>jQuery = jQuery;</script>', $content );
62
+ return $content;
63
+
64
+ } else if ( preg_match( $patternFrontTwo, $content ) ) {
65
+ //jQuery = (typeof jQuery !== "undefined") ? jQuery : false;
66
+ $content = preg_replace( $patternFrontTwo, '$0<script>jQuery = jQuery;</script>', $content );
67
+ return $content;
68
+
69
+ } else if ( preg_match( $patternFrontThree, $content ) ) {
70
+ //jQuery = (typeof jQuery !== "undefined") ? jQuery : false;
71
+ $content = preg_replace( $patternFrontThree, '$0<script>jQuery = jQuery;</script>', $content );
72
+ return $content;
73
+
74
+ } else if ( preg_match( $externalPattern, $content ) ) {
75
+ /* match external google lib */
76
+ $content = preg_replace( $externalPattern, '$0<script>jQuery = jQuery;</script>', $content );
77
+ return $content;
78
+ }
79
+
80
+ if ( preg_match( $patternAdmin, $content ) ) {
81
+ $content = preg_replace( $patternAdmin, '$0<script>jQuery = jQuery;</script>', $content );
82
+ return $content;
83
+ }
84
+
85
+ //return $content;
86
+
87
+ }
88
+ /**
89
+ * Flushes the buffer
90
+ */
91
+ public static function end_buffer() {
92
+ if (self::$end_buffer_fired) {
93
+ return;
94
+ }
95
+
96
+ ob_end_flush();
97
+
98
+ self::$end_buffer_fired = true;
99
+ }
100
+
101
+ }
102
+
103
+ Inbound_Magic::init();
104
+
105
  }
shared/classes/class.menu.php CHANGED
@@ -572,7 +572,7 @@ if (!class_exists('Inbound_Menu')) {
572
  $secondary_menu_items['inbound-docs'] = array(
573
  'parent' => self::$inboundnow_menu_secondary_group_key,
574
  'title' => __( 'Documentation', 'inbound-pro' ),
575
- 'href' => 'http://docs.inboundnow.com/',
576
  'meta' => array( 'title' => __( 'Documentation', 'inbound-pro' ) )
577
  );
578
 
@@ -581,7 +581,7 @@ if (!class_exists('Inbound_Menu')) {
581
 
582
  $secondary_menu_items['inbound-docs-searchform'] = array(
583
  'parent' => self::$inboundnow_menu_secondary_group_key,
584
- 'title' => '<form method="get" id="inbound-menu-form" action="http://www.inboundnow.com/support/search/?action=bbp-search-request" class=" " target="_blank">
585
  <input id="search-inbound-menu" type="text" placeholder="' . $search_docs_text . '" onblur="this.value=(this.value==\'\') ? \'' . $search_docs_text . '\' : this.value;" onfocus="this.value=(this.value==\'' . $search_docs_text . '\') ? \'\' : this.value;" value="' . $search_docs_text . '" name="bbp_search" value="' . esc_attr( 'Search Docs', 'inbound-pro' ) . '" class="text inbound-search-input" />
586
  <input type="hidden" name="post_type[]" value="docs" />
587
  <input type="hidden" name="post_type[]" value="page" />' . self::$go_button,
@@ -652,19 +652,19 @@ if (!class_exists('Inbound_Menu')) {
652
  );
653
 
654
  /* 1.1 - 1.2 - Link Setup */
655
- $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
656
 
657
  $param = (preg_match("/\?/", $actual_link)) ? "&" : '?';
658
  if (preg_match("/inbound-dequeue-scripts/", $actual_link)) {
659
- $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
660
  } else {
661
  $actual_link = $actual_link . $param .'inbound-dequeue-scripts';
662
  }
663
 
664
- $actual_link_two = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
665
  $param_two = (preg_match("/\?/", $actual_link_two)) ? "&" : '?';
666
  if (preg_match("/inbound_js/", $actual_link_two)) {
667
- $actual_link_two = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
668
  } else {
669
  $actual_link_two = $actual_link_two . $param_two .'inbound_js';
670
  }
572
  $secondary_menu_items['inbound-docs'] = array(
573
  'parent' => self::$inboundnow_menu_secondary_group_key,
574
  'title' => __( 'Documentation', 'inbound-pro' ),
575
+ 'href' => '//docs.inboundnow.com/',
576
  'meta' => array( 'title' => __( 'Documentation', 'inbound-pro' ) )
577
  );
578
 
581
 
582
  $secondary_menu_items['inbound-docs-searchform'] = array(
583
  'parent' => self::$inboundnow_menu_secondary_group_key,
584
+ 'title' => '<form method="get" id="inbound-menu-form" action="//www.inboundnow.com/support/search/?action=bbp-search-request" class=" " target="_blank">
585
  <input id="search-inbound-menu" type="text" placeholder="' . $search_docs_text . '" onblur="this.value=(this.value==\'\') ? \'' . $search_docs_text . '\' : this.value;" onfocus="this.value=(this.value==\'' . $search_docs_text . '\') ? \'\' : this.value;" value="' . $search_docs_text . '" name="bbp_search" value="' . esc_attr( 'Search Docs', 'inbound-pro' ) . '" class="text inbound-search-input" />
586
  <input type="hidden" name="post_type[]" value="docs" />
587
  <input type="hidden" name="post_type[]" value="page" />' . self::$go_button,
652
  );
653
 
654
  /* 1.1 - 1.2 - Link Setup */
655
+ $actual_link = "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
656
 
657
  $param = (preg_match("/\?/", $actual_link)) ? "&" : '?';
658
  if (preg_match("/inbound-dequeue-scripts/", $actual_link)) {
659
+ $actual_link = "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
660
  } else {
661
  $actual_link = $actual_link . $param .'inbound-dequeue-scripts';
662
  }
663
 
664
+ $actual_link_two = "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
665
  $param_two = (preg_match("/\?/", $actual_link_two)) ? "&" : '?';
666
  if (preg_match("/inbound_js/", $actual_link_two)) {
667
+ $actual_link_two = "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
668
  } else {
669
  $actual_link_two = $actual_link_two . $param_two .'inbound_js';
670
  }
shared/shortcodes/inbound-shortcodes.php CHANGED
@@ -4,19 +4,21 @@
4
  //=============================================
5
  // Define constants
6
  //=============================================
7
- if (!defined('INBOUND_FORMS'))
8
  define('INBOUND_FORMS', plugin_dir_url(__FILE__));
 
9
 
10
- if (!defined('INBOUND_FORMS_PATH'))
11
  define('INBOUND_FORMS_PATH', plugin_dir_path(__FILE__));
 
12
 
13
- if (!defined('INBOUND_FORMS_BASENAME'))
14
  define('INBOUND_FORMS_BASENAME', plugin_basename(__FILE__));
 
15
 
16
- if (!defined('INBOUND_FORMS_ADMIN'))
17
  define('INBOUND_FORMS_ADMIN', get_bloginfo('url') . "/wp-admin");
18
-
19
-
20
 
21
 
22
 
4
  //=============================================
5
  // Define constants
6
  //=============================================
7
+ if (!defined('INBOUND_FORMS')) {
8
  define('INBOUND_FORMS', plugin_dir_url(__FILE__));
9
+ }
10
 
11
+ if (!defined('INBOUND_FORMS_PATH')) {
12
  define('INBOUND_FORMS_PATH', plugin_dir_path(__FILE__));
13
+ }
14
 
15
+ if (!defined('INBOUND_FORMS_BASENAME')) {
16
  define('INBOUND_FORMS_BASENAME', plugin_basename(__FILE__));
17
+ }
18
 
19
+ if (!defined('INBOUND_FORMS_ADMIN')) {
20
  define('INBOUND_FORMS_ADMIN', get_bloginfo('url') . "/wp-admin");
21
+ }
 
22
 
23
 
24