WordPress Landing Pages - Version 1.7.6

Version Description

  • Fixed double email submission on contact form 7
Download this release

Release Info

Developer DavidWells
Plugin Icon 128x128 WordPress Landing Pages
Version 1.7.6
Comparing to
See all releases

Code changes from version 1.7.3 to 1.7.6

classes/class.activation.upgrade-routines.php CHANGED
@@ -52,6 +52,19 @@ if ( !class_exists('Landing_Pages_Activation_Update_Routines') ) {
52
 
53
  }
54
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /*
56
  * @introduced: 1.5.7
57
  * @migration-type: Meta pair migragtion
52
 
53
  }
54
  }
55
+
56
+ /*
57
+ * @introduced: 1.7.5
58
+ * @migration-type: Meta key rename
59
+ * @migration: renames all instances of inbound_conversion_data to _inbound_conversion_data
60
+
61
+ */
62
+ public static function meta_key_change_conversion_object() {
63
+ global $wpdb;
64
+
65
+ $wpdb->query("UPDATE $wpdb->postmeta SET `meta_key` = REPLACE (`meta_key` , 'inbound_conversion_data', '_inbound_conversion_data')");
66
+ }
67
+
68
  /*
69
  * @introduced: 1.5.7
70
  * @migration-type: Meta pair migragtion
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.7.3
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
  Text Domain: landing-pages
@@ -102,7 +102,7 @@ if (!class_exists('Inbound_Landing_Pages_Plugin')) {
102
  */
103
  private static function load_constants() {
104
 
105
- define('LANDINGPAGES_CURRENT_VERSION', '1.7.3' );
106
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
107
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
108
  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.7.6
7
  Author: Inbound Now
8
  Author URI: http://www.inboundnow.com/
9
  Text Domain: landing-pages
102
  */
103
  private static function load_constants() {
104
 
105
+ define('LANDINGPAGES_CURRENT_VERSION', '1.7.6' );
106
  define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
107
  define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
108
  define('LANDINGPAGES_PLUGIN_SLUG', plugin_basename( dirname(__FILE__) ) );
modules/module.ab-testing.php CHANGED
@@ -769,6 +769,7 @@ function lp_ab_testing_add_rewrite_rules()
769
  //echo $slug;exit;
770
  $ab_testing = get_option( 'lp-main-landing-page-disable-turn-off-ab', "0");
771
  if($ab_testing === "0") {
 
772
  add_rewrite_rule("$slug/([^/]*)?", $this_path."modules/module.redirect-ab-testing.php?permalink_name=$1 ",'top');
773
  add_rewrite_rule("landing-page=([^/]*)?", $this_path.'modules/module.redirect-ab-testing.php?permalink_name=$1','top');
774
  }
@@ -795,7 +796,7 @@ function lp_ab_testing_add_rewrite_rules()
795
  foreach ($rules_array as $key=>$val)
796
  {
797
 
798
- if (stristr($val,"RewriteRule ^{$slug}/([^/]*)? "))
799
  {
800
  $new_val = "RewriteCond %{QUERY_STRING} !lp-variation-id";
801
  $rules_array[$i] = $new_val;
769
  //echo $slug;exit;
770
  $ab_testing = get_option( 'lp-main-landing-page-disable-turn-off-ab', "0");
771
  if($ab_testing === "0") {
772
+ add_rewrite_rule("$slug/([^/]*)/([0-9]+)/", "$slug/$1?lp-variation-id=$2",'top');
773
  add_rewrite_rule("$slug/([^/]*)?", $this_path."modules/module.redirect-ab-testing.php?permalink_name=$1 ",'top');
774
  add_rewrite_rule("landing-page=([^/]*)?", $this_path.'modules/module.redirect-ab-testing.php?permalink_name=$1','top');
775
  }
796
  foreach ($rules_array as $key=>$val)
797
  {
798
 
799
+ if ( stristr($val,"RewriteRule ^{$slug}/([^/]*)? ") || stristr($val,"RewriteRule ^{$slug}/([^/]*)/([0-9]+)/ ") )
800
  {
801
  $new_val = "RewriteCond %{QUERY_STRING} !lp-variation-id";
802
  $rules_array[$i] = $new_val;
modules/module.global-settings.php CHANGED
@@ -36,14 +36,6 @@ function lp_get_global_settings() {
36
  'default' => 'go',
37
  'options' => null
38
  ),
39
- array(
40
- 'id' => 'landing-page-prepopulate-forms',
41
- 'label' => __( 'Enable Form Prepopulation' , 'landing-pages') ,
42
- 'description' => __("With this setting enabled landing pages plugin will remember form input data that the user submits to a form and attempt to pre-populate all other forms with the same user's data when applicable." , 'landing-pages'),
43
- 'type' => 'radio',
44
- 'default' => '1',
45
- 'options' => array('1'=>'on','0'=>'off')
46
- ),
47
  array(
48
  'id' => 'landing-page-disable-admin-tracking',
49
  'label' => __('Disable Admin Impression/Conversion Tracking' , 'landing-pages') ,
@@ -60,22 +52,6 @@ function lp_get_global_settings() {
60
  'default' => '0',
61
  'options' => array('1'=>'on','0'=>'off')
62
  ),
63
- array(
64
- 'id' => 'landing-page-auto-format-forms',
65
- 'label' => __('Enable Form Standardization' , 'landing-pages'),
66
- 'description' => __("With this setting enabled landing pages plugin will clean and standardize all input ids and classnames. Uncheck this setting to disable standardization." , 'landing-pages'),
67
- 'type' => 'radio',
68
- 'default' => '0',
69
- 'options' => array('1'=>'on','0'=>'off')
70
- ),
71
- array(
72
- 'id' => 'main-landing-page-auto-format-forms-retain-elements',
73
- 'label' => __('Form Standardization Element Whitelist' , 'landing-pages'),
74
- 'description' => __("Form standardization strips the conversion area content of html elements. Add the elements you do not want to be stripped to this list." , 'landing-pages') ,
75
- 'type' => 'textarea',
76
- 'default' => '<button><script><textarea><style><input><form><select><label><a><p><b><u><strong><i><img><strong><span><font><h1><h2><h3><center><blockquote><embed><object><small>',
77
- 'options' => null
78
- ),
79
  array(
80
  'id' => 'inbound_compatibility_mode',
81
  'label' => 'Turn on compability mode',
36
  'default' => 'go',
37
  'options' => null
38
  ),
 
 
 
 
 
 
 
 
39
  array(
40
  'id' => 'landing-page-disable-admin-tracking',
41
  'label' => __('Disable Admin Impression/Conversion Tracking' , 'landing-pages') ,
52
  'default' => '0',
53
  'options' => array('1'=>'on','0'=>'off')
54
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  array(
56
  'id' => 'inbound_compatibility_mode',
57
  'label' => 'Turn on compability mode',
modules/module.javascript-frontend.php CHANGED
@@ -32,12 +32,6 @@ function lp_fontend_enqueue_scripts($hook) {
32
 
33
  if (isset($post)&&$post->post_type=='landing-page') {
34
 
35
- $form_prepopulation = get_option( 'lp-main-landing-page-prepopulate-forms' , 1);
36
- // load form pre-population script
37
- if ($form_prepopulation) {
38
- /* TODO set global option */
39
- }
40
-
41
  if (isset($_GET['template-customize']) &&$_GET['template-customize']=='on') {
42
  echo "<style type='text/css'>#variation-list{background:#eaeaea !important; top: 26px !important; height: 35px !important;padding-top: 10px !important;}#wpadminbar {height: 32px !important;}</style>"; // enqueue styles not firing
43
  }
32
 
33
  if (isset($post)&&$post->post_type=='landing-page') {
34
 
 
 
 
 
 
 
35
  if (isset($_GET['template-customize']) &&$_GET['template-customize']=='on') {
36
  echo "<style type='text/css'>#variation-list{background:#eaeaea !important; top: 26px !important; height: 35px !important;padding-top: 10px !important;}#wpadminbar {height: 32px !important;}</style>"; // enqueue styles not firing
37
  }
modules/module.metaboxes.php CHANGED
@@ -169,10 +169,6 @@ function lp_landing_page_header_area()
169
  $variation_notes = apply_filters('lp_edit_variation_notes', $variation_notes, 1);
170
  $variation_id = apply_filters( 'lp_display_notes_input_id' , 'lp-variation-notes' );
171
 
172
- $page_conversion_data = get_post_meta( $post->ID, 'inbound_conversion_data', TRUE );
173
- $page_conversion_data = json_decode($page_conversion_data,true);
174
- //print_r($page_conversion_data);
175
- //echo "TEST";
176
  echo "<div id='lp-notes-area'>";
177
  echo "<span id='add-lp-notes'>". __('Notes' , 'landing-pages') .":</span><input placeholder='". __('Add Notes to your variation. Example: This version is testing a green submit button ' , 'landing-pages') ."' type='text' class='lp-notes' name='{$variation_id}' id='{$variation_id}' value='{$variation_notes}' size='30'>";
178
  echo '</div><div id="main-title-area"><input type="text" name="lp-main-headline" placeholder="'. __('Primary Headline Goes here. This will be visible on the page' , 'landing-pages') .'" id="lp-main-headline" value="'.$main_title.'" title="'. __('This headline will appear in the landing page template.' , 'landing-pages') .'"></div><div id="lp-current-view">'.$lp_variation.'</div><div id="switch-lp">0</div>';
169
  $variation_notes = apply_filters('lp_edit_variation_notes', $variation_notes, 1);
170
  $variation_id = apply_filters( 'lp_display_notes_input_id' , 'lp-variation-notes' );
171
 
 
 
 
 
172
  echo "<div id='lp-notes-area'>";
173
  echo "<span id='add-lp-notes'>". __('Notes' , 'landing-pages') .":</span><input placeholder='". __('Add Notes to your variation. Example: This version is testing a green submit button ' , 'landing-pages') ."' type='text' class='lp-notes' name='{$variation_id}' id='{$variation_id}' value='{$variation_notes}' size='30'>";
174
  echo '</div><div id="main-title-area"><input type="text" name="lp-main-headline" placeholder="'. __('Primary Headline Goes here. This will be visible on the page' , 'landing-pages') .'" id="lp-main-headline" value="'.$main_title.'" title="'. __('This headline will appear in the landing page template.' , 'landing-pages') .'"></div><div id="lp-current-view">'.$lp_variation.'</div><div id="switch-lp">0</div>';
modules/module.track.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  $count_key = 'lp_page_views_count';
3
  $count = get_post_meta($postID, $count_key, true);
4
  if($count==''){
5
  $count = 0;
6
  delete_post_meta($postID, $count_key);
7
  add_post_meta($postID, $count_key, '0');
8
  }else{
9
  $count++;
10
  update_post_meta($postID, $count_key, $count);
11
  }
12
  $count_key = 'lp_page_conversions_count';
13
  $count = get_post_meta($postID, $count_key, true);
14
  if($count==''){
15
  delete_post_meta($postID, $count_key);
16
  add_post_meta($postID, $count_key, '0');
17
  return "0";
18
  }
19
  return $count;
20
  $count_key = 'lp_page_conversions_count';
21
  $count = get_post_meta($postID, $count_key, true);
22
  if($count==''){
23
  $count = 0;
24
  delete_post_meta($postID, $count_key);
25
  add_post_meta($postID, $count_key, '0');
26
  }else{
27
  $count++;
28
  update_post_meta($postID, $count_key, $count);
29
  }
30
  $count_key = 'lp_page_views_count';
31
  $count = get_post_meta($postID, $count_key, true);
32
  if($count==''){
33
  delete_post_meta($postID, $count_key);
34
  add_post_meta($postID, $count_key, '0');
35
  return;
36
  }
37
  return $count;
 
38
  $count_key = 'lp_page_views_count';
39
  $count = get_post_meta($postID, $count_key, true);
40
  if($count==''){
41
  $count = 0;
42
  delete_post_meta($postID, $count_key);
43
  add_post_meta($postID, $count_key, '0');
44
  }else{
45
  $count++;
46
  update_post_meta($postID, $count_key, $count);
47
  }
48
  $count_key = 'lp_page_conversions_count';
49
  $count = get_post_meta($postID, $count_key, true);
50
  if($count==''){
51
  delete_post_meta($postID, $count_key);
52
  add_post_meta($postID, $count_key, '0');
53
  return "0";
54
  }
55
  return $count;
56
  $count_key = 'lp_page_conversions_count';
57
  $count = get_post_meta($postID, $count_key, true);
58
  if($count==''){
59
  $count = 0;
60
  delete_post_meta($postID, $count_key);
61
  add_post_meta($postID, $count_key, '0');
62
  }else{
63
  $count++;
64
  update_post_meta($postID, $count_key, $count);
65
  }
66
  $count_key = 'lp_page_views_count';
67
  $count = get_post_meta($postID, $count_key, true);
68
  if($count==''){
69
  delete_post_meta($postID, $count_key);
70
  add_post_meta($postID, $count_key, '0');
71
  return;
72
  }
73
  return $count;
 
1
  $count_key = 'lp_page_views_count';
2
  $count = get_post_meta($postID, $count_key, true);
3
  if($count==''){
4
  $count = 0;
5
  delete_post_meta($postID, $count_key);
6
  add_post_meta($postID, $count_key, '0');
7
  }else{
8
  $count++;
9
  update_post_meta($postID, $count_key, $count);
10
  }
11
  $count_key = 'lp_page_conversions_count';
12
  $count = get_post_meta($postID, $count_key, true);
13
  if($count==''){
14
  delete_post_meta($postID, $count_key);
15
  add_post_meta($postID, $count_key, '0');
16
  return "0";
17
  }
18
  return $count;
19
  $count_key = 'lp_page_conversions_count';
20
  $count = get_post_meta($postID, $count_key, true);
21
  if($count==''){
22
  $count = 0;
23
  delete_post_meta($postID, $count_key);
24
  add_post_meta($postID, $count_key, '0');
25
  }else{
26
  $count++;
27
  update_post_meta($postID, $count_key, $count);
28
  }
29
  $count_key = 'lp_page_views_count';
30
  $count = get_post_meta($postID, $count_key, true);
31
  if($count==''){
32
  delete_post_meta($postID, $count_key);
33
  add_post_meta($postID, $count_key, '0');
34
  return;
35
  }
36
  return $count;
37
+ <?php
38
  $count_key = 'lp_page_views_count';
39
  $count = get_post_meta($postID, $count_key, true);
40
  if($count==''){
41
  $count = 0;
42
  delete_post_meta($postID, $count_key);
43
  add_post_meta($postID, $count_key, '0');
44
  }else{
45
  $count++;
46
  update_post_meta($postID, $count_key, $count);
47
  }
48
  $count_key = 'lp_page_conversions_count';
49
  $count = get_post_meta($postID, $count_key, true);
50
  if($count==''){
51
  delete_post_meta($postID, $count_key);
52
  add_post_meta($postID, $count_key, '0');
53
  return "0";
54
  }
55
  return $count;
56
  $count_key = 'lp_page_conversions_count';
57
  $count = get_post_meta($postID, $count_key, true);
58
  if($count==''){
59
  $count = 0;
60
  delete_post_meta($postID, $count_key);
61
  add_post_meta($postID, $count_key, '0');
62
  }else{
63
  $count++;
64
  update_post_meta($postID, $count_key, $count);
65
  }
66
  $count_key = 'lp_page_views_count';
67
  $count = get_post_meta($postID, $count_key, true);
68
  if($count==''){
69
  delete_post_meta($postID, $count_key);
70
  add_post_meta($postID, $count_key, '0');
71
  return;
72
  }
73
  return $count;
readme.txt CHANGED
@@ -6,8 +6,8 @@ License: GPLv2 or later
6
  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.0.1
10
- Stable Tag: 1.7.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
 
@@ -72,6 +72,12 @@ The plugin is also fully extendable and has a number of actions, filters, and ho
72
  4. Choose from a ton of pre-made templates, use your existing design, or design your own theme!
73
 
74
  == Changelog ==
 
 
 
 
 
 
75
  = 1.7.3 =
76
  * See changelog here: https://github.com/inboundnow/landing-pages/issues?q=is%3Aissue+is%3Aclosed+label%3Av1.7.3
77
 
6
  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.7.6
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
 
72
  4. Choose from a ton of pre-made templates, use your existing design, or design your own theme!
73
 
74
  == Changelog ==
75
+ = 1.7.6 =
76
+ * Fixed double email submission on contact form 7
77
+
78
+ = 1.7.5 =
79
+ * Added form field exclusions to ignore sensitive data
80
+
81
  = 1.7.3 =
82
  * See changelog here: https://github.com/inboundnow/landing-pages/issues?q=is%3Aissue+is%3Aclosed+label%3Av1.7.3
83
 
shared/assets/frontend/js/analytics-src/analytics.events.js CHANGED
@@ -60,14 +60,22 @@ var _inboundEvents = (function(_inbound) {
60
  /*! Customize Data via filter_ + "namespace" */
61
  data = _inbound.apply_filters('filter_' + eventName, data);
62
 
63
- var TriggerEvent = new CustomEvent(eventName, {
64
- detail: data,
65
- bubbles: options.bubbles,
66
- cancelable: options.cancelable
67
- });
68
 
69
- // console.log('Action:' + eventName + " ran on ->", data);
 
 
 
 
 
 
 
 
 
 
 
70
 
 
71
  /*! 1. Trigger Pure Javascript Event See: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events for example on creating events */
72
  window.dispatchEvent(TriggerEvent);
73
  /*! 2. Trigger _inbound action */
@@ -75,6 +83,8 @@ var _inboundEvents = (function(_inbound) {
75
  /*! 3. jQuery trigger */
76
  triggerJQueryEvent(eventName, data);
77
 
 
 
78
  }
79
 
80
  function triggerJQueryEvent(eventName, data) {
@@ -510,7 +520,7 @@ var _inboundEvents = (function(_inbound) {
510
  });
511
  window.dispatchEvent(error);
512
  console.log('Page Save Error');
513
- },
514
 
515
  };
516
 
60
  /*! Customize Data via filter_ + "namespace" */
61
  data = _inbound.apply_filters('filter_' + eventName, data);
62
 
63
+ var is_IE_11 = !(window.ActiveXObject) && "ActiveXObject" in window;
 
 
 
 
64
 
65
+ if(is_IE_11){
66
+
67
+ var TriggerEvent = document.createEvent("Event");
68
+ TriggerEvent.initEvent(eventName, true, true);
69
+
70
+ } else {
71
+
72
+ var TriggerEvent = new CustomEvent(eventName, {
73
+ detail: data,
74
+ bubbles: options.bubbles,
75
+ cancelable: options.cancelable
76
+ });
77
 
78
+ }
79
  /*! 1. Trigger Pure Javascript Event See: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events for example on creating events */
80
  window.dispatchEvent(TriggerEvent);
81
  /*! 2. Trigger _inbound action */
83
  /*! 3. jQuery trigger */
84
  triggerJQueryEvent(eventName, data);
85
 
86
+ // console.log('Action:' + eventName + " ran on ->", data);
87
+
88
  }
89
 
90
  function triggerJQueryEvent(eventName, data) {
520
  });
521
  window.dispatchEvent(error);
522
  console.log('Page Save Error');
523
+ }
524
 
525
  };
526
 
shared/assets/frontend/js/analytics-src/analytics.forms.js CHANGED
@@ -141,8 +141,13 @@ var InboundForms = (function(_inbound) {
141
  loopClassSelectors: function(selectors, action) {
142
  for (var i = selectors.length - 1; i >= 0; i--) {
143
 
 
 
 
 
 
144
  //if(selectors[i] match . or # )
145
- selector = document.querySelector(utils.trim(selectors[i]));
146
  //console.log("SELECTOR", selector);
147
  if (selector) {
148
  if (action === 'add') {
@@ -166,6 +171,9 @@ var InboundForms = (function(_inbound) {
166
  hiddenInputs.push(formInput);
167
  continue;
168
  }
 
 
 
169
  /* Map form fields */
170
  this.mapField(formInput);
171
  /* Remember visible inputs */
@@ -182,6 +190,80 @@ var InboundForms = (function(_inbound) {
182
  };
183
 
184
  //console.log('mapping on load completed');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  },
186
  /* prevent default submission temporarily */
187
  formListener: function(event) {
@@ -196,32 +278,41 @@ var InboundForms = (function(_inbound) {
196
  var email_input = document.querySelector('.inbound-email');
197
  utils.addListener(email_input, 'blur', this.mailCheck);
198
  },
199
- ignoreFields: function(input) {
 
 
200
 
201
- var ignore_field = false,
202
- label = "",
203
- value = "";
204
 
205
  // Ignore any fields with labels that indicate a credit card field
206
  if (label.toLowerCase().indexOf('credit card') != -1 || label.toLowerCase().indexOf('card number') != -1) {
207
  ignore_field = true;
208
  }
209
 
210
-
211
  if (label.toLowerCase().indexOf('expiration') != -1 || label.toLowerCase().indexOf('expiry') != -1) {
212
  ignore_field = true;
213
  }
214
 
215
-
216
  if (label.toLowerCase() == 'month' || label.toLowerCase() == 'mm' || label.toLowerCase() == 'yy' || label.toLowerCase() == 'yyyy' || label.toLowerCase() == 'year') {
217
  ignore_field = true;
218
  }
219
 
220
-
221
  if (label.toLowerCase().indexOf('cvv') != -1 || label.toLowerCase().indexOf('cvc') != -1 || label.toLowerCase().indexOf('secure code') != -1 || label.toLowerCase().indexOf('security code') != -1) {
222
  ignore_field = true;
223
  }
224
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
  if (value.toLowerCase() == 'visa' || value.toLowerCase() == 'mastercard' || value.toLowerCase() == 'american express' || value.toLowerCase() == 'amex' || value.toLowerCase() == 'discover') {
227
  ignore_field = true;
@@ -249,8 +340,21 @@ var InboundForms = (function(_inbound) {
249
  document.body.style.cursor = "default";
250
  utils.removeClass('wpl-track-me', form);
251
  utils.removeListener(form, 'submit', this.formListener);
 
 
 
 
 
 
 
 
 
 
 
 
252
  form.submit();
253
  /* fallback if submit name="submit" */
 
254
  setTimeout(function() {
255
  for (var i = 0; i < form.elements.length; i++) {
256
  formInput = form.elements[i];
@@ -259,7 +363,7 @@ var InboundForms = (function(_inbound) {
259
  form.elements[i].click();
260
  }
261
  }
262
- }, 1300);
263
 
264
  },
265
  saveFormData: function(form) {
@@ -347,6 +451,7 @@ var InboundForms = (function(_inbound) {
347
  }
348
  }
349
  _inbound.deBugger('forms', inputsObject);
 
350
  //console.log('These are the raw values', inputsObject);
351
  //_inbound.totalStorage('the_key', inputsObject);
352
  //var inputsObject = sortInputs(inputsObject);
@@ -506,12 +611,11 @@ var InboundForms = (function(_inbound) {
506
  rememberInputValues: function(input) {
507
  var name = (input.name) ? "inbound_" + input.name : '';
508
  var type = (input.type) ? input.type : 'text';
509
- if (type === 'submit' || type === 'hidden' || type === 'file' || type === "password") {
510
  return false;
511
  }
512
 
513
  utils.addListener(input, 'change', function(e) {
514
-
515
  if (e.target.name) {
516
  /* Check for input type */
517
  if (type !== "checkbox") {
@@ -570,81 +674,16 @@ var InboundForms = (function(_inbound) {
570
  }
571
  }
572
  },
573
- /* Maps data attributes to fields on page load */
574
- mapField: function(input) {
575
-
576
- var input_id = input.id || false;
577
- var input_name = input.name || false;
578
-
579
- /* Loop through all match possiblities */
580
- for (i = 0; i < FieldMapArray.length; i++) {
581
- //for (var i = FieldMapArray.length - 1; i >= 0; i--) {
582
- var found = false;
583
- var match = FieldMapArray[i];
584
- var lookingFor = utils.trim(match);
585
- var nice_name = lookingFor.replace(/ /g, '_');
586
-
587
-
588
- //console.log("NICE NAME", nice_name);
589
- //console.log('looking for match on ' + lookingFor);
590
- //_inbound.deBugger('forms', 'looking for match on ' + lookingFor + " nice_name= " + nice_name);
591
-
592
- // Check if input has an attached lable using for= tag
593
- //var $laxbel = $("label[for='" + $element.attr('id') + "']").text();
594
- //var labxel = 'label[for="' + input_id + '"]';
595
-
596
- /* look for name attribute match */
597
- if (input_name && input_name.toLowerCase().indexOf(lookingFor) > -1) {
598
-
599
- found = true;
600
- _inbound.deBugger('forms', 'Found matching name attribute for -> ' + lookingFor);
601
-
602
- /* look for id match */
603
- } else if (input_id && input_id.toLowerCase().indexOf(lookingFor) > -1) {
604
-
605
- found = true;
606
- _inbound.deBugger('forms', 'Found matching ID attribute for ->' + lookingFor);
607
-
608
- /* Check siblings for label */
609
- } else if (label = this.siblingsIsLabel(input)) {
610
-
611
- //var label = (label.length > 1 ? label[0] : label);
612
- //console.log('label', label);
613
- if (label[0].innerText.toLowerCase().indexOf(lookingFor) > -1) {
614
-
615
- found = true;
616
- _inbound.deBugger('forms', 'Found matching sibling label for -> ' + lookingFor);
617
-
618
- }
619
- /* Check closest li for label */
620
- } else if (labelText = this.CheckParentForLabel(input)) {
621
-
622
- //console.log(labelText)
623
-
624
- if (labelText.toLowerCase().indexOf(lookingFor) > -1) {
625
- found = true;
626
- _inbound.deBugger('forms', 'Found Matching parent label for -> ' + lookingFor);
627
-
628
- }
629
-
630
- } else {
631
- /* no match found */
632
- //_inbound.deBugger('forms', 'NO Match on ' + lookingFor + " in " + input_name);
633
- no_match.push(lookingFor);
634
-
635
- }
636
-
637
- /* Map the field */
638
- if (found) {
639
- this.addDataAttr(input, nice_name);
640
- this.removeArrayItem(FieldMapArray, lookingFor);
641
- i--; //decrement count
642
- }
643
-
644
  }
645
-
646
- return inbound_data;
647
-
648
  },
649
  /* Get correct input values */
650
  getInputValue: function(input) {
@@ -732,7 +771,7 @@ var InboundForms = (function(_inbound) {
732
  do {
733
  var labels = element.getElementsByTagName("label");
734
  if (labels.length > 0 && labels.length < 2) {
735
- return element.getElementsByTagName("label")[0].innerText;
736
  }
737
 
738
  } while (element = element.parentNode);
141
  loopClassSelectors: function(selectors, action) {
142
  for (var i = selectors.length - 1; i >= 0; i--) {
143
 
144
+ var selector = utils.trim(selectors[i])
145
+ if (selector.indexOf("#") === -1 && selector.indexOf(".") === -1) {
146
+ // assign ID as default
147
+ selector = "#" + selector;
148
+ }
149
  //if(selectors[i] match . or # )
150
+ selector = document.querySelector(selector);
151
  //console.log("SELECTOR", selector);
152
  if (selector) {
153
  if (action === 'add') {
171
  hiddenInputs.push(formInput);
172
  continue;
173
  }
174
+
175
+
176
+ //this.ignoreFields(formInput);
177
  /* Map form fields */
178
  this.mapField(formInput);
179
  /* Remember visible inputs */
190
  };
191
 
192
  //console.log('mapping on load completed');
193
+ },
194
+ /* Maps data attributes to fields on page load */
195
+ mapField: function(input) {
196
+
197
+ var input_id = input.id || false;
198
+ var input_name = input.name || false;
199
+ var label = this.getInputLabel(input);
200
+
201
+ if(label){
202
+ //console.log(label[0].innerText);
203
+ var ignoreField = this.ignoreFieldByLabel(label[0].innerText);
204
+ if(ignoreField){
205
+ input.dataset.ignoreFormField = true;
206
+ return false;
207
+ }
208
+ }
209
+ /* Loop through all match possiblities */
210
+ for (i = 0; i < FieldMapArray.length; i++) {
211
+ //for (var i = FieldMapArray.length - 1; i >= 0; i--) {
212
+ var found = false;
213
+ var match = FieldMapArray[i];
214
+ var lookingFor = utils.trim(match);
215
+ var nice_name = lookingFor.replace(/ /g, '_');
216
+
217
+
218
+ //console.log("NICE NAME", nice_name);
219
+ //console.log('looking for match on ' + lookingFor);
220
+ //_inbound.deBugger('forms', 'looking for match on ' + lookingFor + " nice_name= " + nice_name);
221
+
222
+ // Check if input has an attached lable using for= tag
223
+ //var $laxbel = $("label[for='" + $element.attr('id') + "']").text();
224
+ //var labxel = 'label[for="' + input_id + '"]';
225
+
226
+ /* look for name attribute match */
227
+ if (input_name && input_name.toLowerCase().indexOf(lookingFor) > -1) {
228
+
229
+ found = true;
230
+ _inbound.deBugger('forms', 'Found matching name attribute for -> ' + lookingFor);
231
+
232
+ /* look for id match */
233
+ } else if (input_id && input_id.toLowerCase().indexOf(lookingFor) > -1) {
234
+
235
+ found = true;
236
+ _inbound.deBugger('forms', 'Found matching ID attribute for ->' + lookingFor);
237
+
238
+ /* Check siblings for label */
239
+ } else if (label) {
240
+ //var label = (label.length > 1 ? label[0] : label);
241
+ //console.log('label', label);
242
+ if (label[0].innerText.toLowerCase().indexOf(lookingFor) > -1) {
243
+
244
+ found = true;
245
+ _inbound.deBugger('forms', 'Found matching sibling label for -> ' + lookingFor);
246
+
247
+ }
248
+
249
+ } else {
250
+ /* no match found */
251
+ //_inbound.deBugger('forms', 'NO Match on ' + lookingFor + " in " + input_name);
252
+ no_match.push(lookingFor);
253
+
254
+ }
255
+
256
+ /* Map the field */
257
+ if (found) {
258
+ this.addDataAttr(input, nice_name);
259
+ this.removeArrayItem(FieldMapArray, lookingFor);
260
+ i--; //decrement count
261
+ }
262
+
263
+ }
264
+
265
+ return inbound_data;
266
+
267
  },
268
  /* prevent default submission temporarily */
269
  formListener: function(event) {
278
  var email_input = document.querySelector('.inbound-email');
279
  utils.addListener(email_input, 'blur', this.mailCheck);
280
  },
281
+ /* Ignore CC data */
282
+ ignoreFieldByLabel: function(label) {
283
+ var ignore_field = false;
284
 
285
+ if(!label){ return false; }
 
 
286
 
287
  // Ignore any fields with labels that indicate a credit card field
288
  if (label.toLowerCase().indexOf('credit card') != -1 || label.toLowerCase().indexOf('card number') != -1) {
289
  ignore_field = true;
290
  }
291
 
 
292
  if (label.toLowerCase().indexOf('expiration') != -1 || label.toLowerCase().indexOf('expiry') != -1) {
293
  ignore_field = true;
294
  }
295
 
 
296
  if (label.toLowerCase() == 'month' || label.toLowerCase() == 'mm' || label.toLowerCase() == 'yy' || label.toLowerCase() == 'yyyy' || label.toLowerCase() == 'year') {
297
  ignore_field = true;
298
  }
299
 
 
300
  if (label.toLowerCase().indexOf('cvv') != -1 || label.toLowerCase().indexOf('cvc') != -1 || label.toLowerCase().indexOf('secure code') != -1 || label.toLowerCase().indexOf('security code') != -1) {
301
  ignore_field = true;
302
  }
303
 
304
+ if(ignore_field){
305
+ _inbound.deBugger('forms', 'ignore ' + label);
306
+ }
307
+
308
+ return ignore_field;
309
+
310
+ },
311
+ /* not implemented yet */
312
+ ignoreFieldByValue: function(value){
313
+ var ignore_field = false;
314
+
315
+ if(!value){ return false };
316
 
317
  if (value.toLowerCase() == 'visa' || value.toLowerCase() == 'mastercard' || value.toLowerCase() == 'american express' || value.toLowerCase() == 'amex' || value.toLowerCase() == 'discover') {
318
  ignore_field = true;
340
  document.body.style.cursor = "default";
341
  utils.removeClass('wpl-track-me', form);
342
  utils.removeListener(form, 'submit', this.formListener);
343
+ var formClass = form.getAttribute('class');
344
+ if (formClass !== "" && formClass !== null) {
345
+ /* If contact form 7 do this */
346
+ if (formClass.toLowerCase().indexOf("wpcf7-form") != -1) {
347
+ //alert('release')
348
+ setTimeout(function() {
349
+ document.body.style.cursor = "default";
350
+ }, 300);
351
+ return true;
352
+ }
353
+ }
354
+
355
  form.submit();
356
  /* fallback if submit name="submit" */
357
+
358
  setTimeout(function() {
359
  for (var i = 0; i < form.elements.length; i++) {
360
  formInput = form.elements[i];
363
  form.elements[i].click();
364
  }
365
  }
366
+ }, 2000);
367
 
368
  },
369
  saveFormData: function(form) {
451
  }
452
  }
453
  _inbound.deBugger('forms', inputsObject);
454
+
455
  //console.log('These are the raw values', inputsObject);
456
  //_inbound.totalStorage('the_key', inputsObject);
457
  //var inputsObject = sortInputs(inputsObject);
611
  rememberInputValues: function(input) {
612
  var name = (input.name) ? "inbound_" + input.name : '';
613
  var type = (input.type) ? input.type : 'text';
614
+ if (type === 'submit' || type === 'hidden' || type === 'file' || type === "password" || input.dataset.ignoreFormField) {
615
  return false;
616
  }
617
 
618
  utils.addListener(input, 'change', function(e) {
 
619
  if (e.target.name) {
620
  /* Check for input type */
621
  if (type !== "checkbox") {
674
  }
675
  }
676
  },
677
+ getInputLabel: function(input){
678
+ var label;
679
+ if(label = this.siblingsIsLabel(input)){
680
+ return label;
681
+ } else if (label = this.CheckParentForLabel(input)) {
682
+ return label;
683
+ } else {
684
+ //console.log("no label nf", input);
685
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
686
  }
 
 
 
687
  },
688
  /* Get correct input values */
689
  getInputValue: function(input) {
771
  do {
772
  var labels = element.getElementsByTagName("label");
773
  if (labels.length > 0 && labels.length < 2) {
774
+ return element.getElementsByTagName("label");
775
  }
776
 
777
  } while (element = element.parentNode);
shared/assets/frontend/js/analytics-src/analytics.lead.js CHANGED
@@ -33,7 +33,7 @@ var _inboundLeadsAPI = (function(_inbound) {
33
  leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
34
  data = {
35
  action: 'inbound_get_all_lead_data',
36
- wp_lead_id: wp_lead_id,
37
  },
38
  success = function(returnData) {
39
  var leadData = JSON.parse(returnData);
@@ -70,7 +70,7 @@ var _inboundLeadsAPI = (function(_inbound) {
70
  var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id");
71
  var data = {
72
  action: 'wpl_check_lists',
73
- wp_lead_id: wp_lead_id,
74
  };
75
  var success = function(user_id) {
76
  _inbound.Utils.createCookie("lead_session_list_check", true, {
33
  leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
34
  data = {
35
  action: 'inbound_get_all_lead_data',
36
+ wp_lead_id: wp_lead_id
37
  },
38
  success = function(returnData) {
39
  var leadData = JSON.parse(returnData);
70
  var wp_lead_id = _inbound.Utils.readCookie("wp_lead_id");
71
  var data = {
72
  action: 'wpl_check_lists',
73
+ wp_lead_id: wp_lead_id
74
  };
75
  var success = function(user_id) {
76
  _inbound.Utils.createCookie("lead_session_list_check", true, {
shared/assets/frontend/js/analytics/closurecompiled.js ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var n=n||{},w=w||{},x=x||[],y=function(a){var g={h:function(){y.a.h();y.a.Ca(window,function(){y.ka()})},ka:function(){y.f.h();y.i.h();y.a.ib();y.k.h();setTimeout(function(){y.i.h()},2E3);y.e("analytics_ready")},extend:function(c,a){var b={},d;for(d in c)Object.prototype.hasOwnProperty.call(c,d)&&(b[d]=c[d]);for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(b[d]=a[d]);return b},debug:function(){},b:function(c,a,b){if(console){var d=document.location.hash?document.location.hash:"",p=-1<d.indexOf("#debug");
2
+ a=a||!1;var h,f;d&&d.match(/debug/)&&(d=d.split("-"),f=d[1]);h="true"===y.a.d("inbound_debug")?!0:!1;if((d="true"===y.a.d("inbound_debug_"+c)?!0:!1)||p||h)a&&"string"===typeof a&&(h||"all"===f?console.log('logAll "'+c+'" =>',a):d?console.log('log "'+c+'" =>',a):c===f&&console.log('#log "'+c+'" =>',a)),b&&b instanceof Function&&b()}}};a=g.extend({timeout:3E4,Fb:!0,Ha:!0},a);g.D=a||{};return g}(w);
3
+ (function(a){a.j=new function(){function a(c,b,f){if(d[c][b])if(f)for(c=d[c][b],b=c.length;b--;)c[b].v===f&&c.splice(b,1);else d[c][b]=[]}function c(c,a,f,l,b){f={v:f,$:l,K:b};if(l=d[c][a]){l.push(f);f=l;for(var e,g=1,v=f.length;g<v;g++){l=f[g];for(b=g;(e=f[b-1])&&e.$>l.$;)f[b]=f[b-1],--b;f[b]=l}l=f}else l=[f];d[c][a]=l}function e(c,a,f){a=d[c][a];if(!a)return"filters"===c?f[0]:!1;var l=0,b=a.length;if("filters"===c)for(;l<b;l++)f[0]=a[l].v.apply(a[l].K,f);else for(;l<b;l++)a[l].v.apply(a[l].K,f);
4
+ return"filters"===c?f[0]:!0}var b={cb:function(c,d){"string"===typeof c&&a("filters",c,d);return b},H:function(){var c=Array.prototype.slice.call(arguments),a=c.shift();return"string"===typeof a?e("filters",a,c):b},ra:function(a,d,f){"string"===typeof a&&"function"===typeof d&&(f=parseInt(f||10,10),c("filters",a,d,f));return b},$a:function(c,d){"string"===typeof c&&a("actions",c,d);return b},Aa:function(){var c=Array.prototype.slice.call(arguments),a=c.shift();"string"===typeof a&&e("actions",a,c);
5
+ return b},oa:function(a,d,f,l){"string"===typeof a&&"function"===typeof d&&(f=parseInt(f||10,10),c("actions",a,d,f,l));return b}},d={tb:{},filters:{}};return b};a.ub=function(){var g=arguments[0].split(" ");for(k in g)arguments[0]="inbound."+g[k],a.j.oa.apply(this,arguments);return this};a.ac=function(){arguments[0]="inbound."+arguments[0];a.j.$a.apply(this,arguments);return this};a.Ba=function(){arguments[0]="inbound."+arguments[0];a.j.Aa.apply(this,arguments)};a.vb=function(){arguments[0]="inbound."+
6
+ arguments[0];a.j.ra.apply(this,arguments);return this};a.bc=function(){arguments[0]="inbound."+arguments[0];a.j.cb.apply(this,arguments);return this};a.ta=function(){arguments[0]="inbound."+arguments[0];return a.j.H.apply(this,arguments)};return a})(y||{});
7
+ (function(a){var g;a.a={h:function(){this.Xa();this.I();this.na();this.nb()},Xa:function(){window.console||(window.console={});for(var c="log info warn error debug trace dir group groupCollapsed groupEnd time timeEnd profile profileEnd dirxml assert count markTimeline timeStamp clear".split(" "),a=0;a<c.length;a++)window.console[c[a]]||(window.console[c[a]]=function(){});try{new CustomEvent("?")}catch(b){this.CustomEvent=function(a,c){function b(f,c,q,e){this["init"+a](f,c,q,e);"detail"in this||(this.detail=
8
+ e)}return function(f,l){var q=document.createEvent(a);null!==f?b.call(q,f,(l||(l=c)).bubbles,l.cancelable,l.detail):q.initCustomEvent=b;return q}}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(c){var a=document.createElement("style"),b=[];document.documentElement.firstChild.appendChild(a);document.u=[];a.styleSheet.cssText=c+"{x-qsa:expression(document._qsa && document._qsa.push(this))}";window.scrollBy(0,
9
+ 0);for(a.parentNode.removeChild(a);document.u.length;)c=document.u.shift(),c.style.removeAttribute("x-qsa"),b.push(c);document.u=null;return b});document.querySelector||(document.querySelector=function(c){c=document.querySelectorAll(c);return c.length?c[0]:null});!("innerText"in document.createElement("a"))&&"getSelection"in window&&HTMLElement.prototype.__defineGetter__("innerText",function(){for(var c=window.getSelection(),a=[],b,f=0;f<c.rangeCount;f++)a[f]=c.getRangeAt(f);c.removeAllRanges();c.selectAllChildren(this);
10
+ b=c.toString();c.removeAllRanges();for(f=0;f<a.length;f++)c.addRange(a[f]);return b})},g:function(c,a,b){var d="";b&&(d=new Date,d.setTime(d.getTime()+864E5*b),d="; expires="+d.toGMTString());document.cookie=c+"="+a+d+"; path=/"},d:function(c){c+="=";for(var a=document.cookie.split(";"),b=0;b<a.length;b++){for(var d=a[b];" "===d.charAt(0);)d=d.substring(1,d.length);if(0===d.indexOf(c))return d.substring(c.length,d.length)}return null},N:function(c){this.g(c,"",-1)},Jb:function(){var c={};if(document.cookie&&
11
+ ""!==document.cookie)for(var e=document.cookie.split(";"),b=0;b<e.length;b++){var d=e[b].split("=");d[0]=d[0].replace(/^ /,"");c[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}a.c("inbound_cookies",c);return c},ib:function(){var c={};(function(){function a(f){return decodeURIComponent(f).replace(/\+/g," ")}for(var b,e=window.location.search.substring(1),f=/([^&=]+)=?([^&]*)/g;b=f.exec(e);)if("-1"==b[1].indexOf("["))c[a(b[1])]=a(b[2]);else{var l=b[1].indexOf("["),q=b[1].slice(l+1,b[1].indexOf("]",
12
+ l)),l=a(b[1].slice(0,l));"object"!=typeof c[l]&&(c[a(l)]={},c[a(l)].length=0);q?c[a(l)][a(q)]=a(b[2]):Array.prototype.push.call(c[a(l)],a(b[2]))}})();for(var e in c)if("object"==typeof c[e])for(var b in c[e])this.g(b,c[e][b],30);else this.g(e,c[e],30);g&&(e=a.c("inbound_url_params")||{},a.c("inbound_url_params",this.Va(e,c)));a.e("url_parameters",c)},Kb:function(){var c={};g&&(c=a.c("inbound_url_params"));return c},n:function(a,e){return(RegExp(a+"=(.+?)(&|$)").exec(e)||[,!1])[1]},I:function(){if("localStorage"in
13
+ window)try{ls="undefined"===typeof window.localStorage?void 0:window.localStorage,g="undefined"==typeof ls||"undefined"==typeof window.JSON?!1:!0}catch(a){g=!1}return g},qa:function(a,e){return new Date(a.getTime()+864E5*e)},ma:function(){var a=new Date,e=a.getDate(),b=a.getHours(),d=a.getMinutes(),g=a.getSeconds(),h=a.getMonth()+1;return a.getFullYear()+"/"+(10>h?"0":"")+h+"/"+(10>e?"0":"")+e+" "+(10>b?"0":"")+b+":"+(10>d?"0":"")+d+":"+(10>g?"0":"")+g},sb:function(){var a=new Date;a.setTime(a.getTime()+
14
+ 18E5);this.g("lead_session_expire",!0,a,!0)},nb:function(){var c=new Date,e=document.referrer||"Direct Traffic",b=a.a.d("inbound_referral_site"),d=a.c("inbound_original_referral");c.setTime(c.getTime()+18E5);b||this.g("inbound_referral_site",e,c,!0);d||a.c("inbound_original_referral",d)},ja:function(a){var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),b="";a||(a=Math.floor(Math.random()*e.length));for(var d=0;d<a;d++)b+=e[Math.floor(Math.random()*e.length)];return b},
15
+ na:function(a){this.d("wp_lead_uid")||this.g("wp_lead_uid",a||this.ja(35))},Bb:function(a){var e=0,b;for(b in a)a.hasOwnProperty(b)&&++e;return e},Va:function(a,e){var b={},d;for(d in a)b[d]=a[d];for(d in e)b[d]=e[d];return b},S:function(a,e){var b=!1;return b="classList"in document.documentElement?e.classList.contains(a):(new RegExp("(^|\\s)"+a+"(\\s|$)")).test(e.className)},F:function(a,e){"classList"in document.documentElement?e.classList.add(a):this.S(e,a)||(e.className+=(e.className?" ":"")+
16
+ a)},w:function(a,e){"classList"in document.documentElement?e.classList.remove(a):this.S(e,a)&&(e.className=e.className.replace(new RegExp("(^|\\s)*"+a+"(\\s|$)*","g"),""))},bb:function(a){a.parentNode.removeChild(a)},trim:function(a){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");return a=a.replace(/\n /,"\n")},sa:function(){if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;for(var a=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0",
17
+ "Microsoft.XmlHttp"],e,b=0;b<a.length;b++)try{e=new ActiveXObject(a[b]);break}catch(d){}return e},G:function(a,e,b,d,g){var h=this.sa();h.open(b,a,g);h.onreadystatechange=function(){4==h.readyState&&e(h.responseText)};"POST"==b&&h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(d)},wb:function(a,e,b,d){var g=[],h;for(h in e)g.push(encodeURIComponent(h)+"="+encodeURIComponent(e[h]));this.G(a+"?"+g.join("&"),b,"GET",null,d)},m:function(a,e,b,d){var g=[],h;for(h in e)g.push(encodeURIComponent(h)+
18
+ "="+encodeURIComponent(e[h]));this.G(a,b,"POST",g.join("&"),d)},Tb:function(c,e){if(window.XMLHttpRequest)httpRequest=new XMLHttpRequest;else if(window.ActiveXObject)try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}if(!httpRequest)return alert("Giving up :( Cannot create an XMLHTTP instance"),!1;httpRequest.onreadystatechange=a.k.xb;httpRequest.open("GET",c);httpRequest.send(e)},Ca:function(a,e){function b(){try{l.doScroll("left")}catch(a){setTimeout(b,
19
+ 50);return}d("poll")}function d(l){if("readystatechange"!=l.type||"complete"==f.readyState)("load"==l.type?a:f)[t](m+l.type,d,!1),!g&&(g=!0)&&e.call(a,l.type||l)}var g=!1,h=!0,f=a.document,l=f.documentElement,q=f.addEventListener?"addEventListener":"attachEvent",t=f.addEventListener?"removeEventListener":"detachEvent",m=f.addEventListener?"":"on";if("complete"==f.readyState)e.call(a,"lazy");else{if(f.createEventObject&&l.doScroll){try{h=!a.frameElement}catch(v){}h&&b()}f[q](m+"DOMContentLoaded",d,
20
+ !1);f[q](m+"readystatechange",d,!1);a[q](m+"load",d,!1)}},addListener:function(a,e,b){a&&(a.addEventListener?a.addEventListener(e,b,!1):a.attachEvent?a.attachEvent("on"+e,b):a["on"+e]=b)},removeListener:function(a,e,b){a.removeEventListener?a.removeEventListener(e,b,!1):a.detachEvent?a.detachEvent("on"+e,b):a["on"+e]=null},B:function(a,e){function b(){l=new Date;f=null;h=a.apply(d,g)}var d,g,h,f=null,l=0;return function(){var q=new Date;l||(l=q);var t=e-(q-l);d=this;g=arguments;0>=t?(clearTimeout(f),
21
+ f=null,l=q,h=a.apply(d,g)):f||(f=setTimeout(b,t));return h}},Ab:function(){"function"===typeof ga&&(universalGA=!0);"undefined"!==typeof x&&"function"===typeof x.push&&(classicGA=!0);"undefined"!==typeof dataLayer&&"function"===typeof dataLayer.push&&(googleTagManager=!0)}};return a})(y||{});
22
+ (function(a){var g=a.a,c=[],e=[],b=[],d=a.D,p="first name;last name;name;email;e-mail;phone;website;job title;your favorite food;company;tele;address;comment".split(";");a.i={h:function(){a.i.gb();a.i.ua();a.i.Ja()},gb:function(){p=a.j.H("forms.field_map",p)},debug:function(){},Ja:function(){for(var a=0;a<window.document.forms.length;a++){var l=!1,b=window.document.forms[a];!b.dataset.Ia&&(b.dataset.Ia=!0,l=this.wa(b))&&(this.va(b),this.Sa(b))}},wa:function(f){var l=f.getAttribute("class");if(""!==
23
+ l&&null!==l){if(-1<l.toLowerCase().indexOf("wpl-track-me")||-1<l.toLowerCase().indexOf("inbound-track"))return!0;cb=function(){console.log(f)};a.b("forms","This form not tracked. Please assign on in settings...",cb);return!1}},ua:function(){if(window.Pb){if(inbound_settings.V){var f=inbound_settings.V.split(","),l="add selectors "+inbound_settings.V;a.b("forms",l);this.W(f,"add")}inbound_settings.U&&(f=inbound_settings.U.split(","),l="remove selectors "+inbound_settings.U,a.b("forms",l),this.W(f,
24
+ "remove"))}},W:function(f,l){for(var b=f.length-1;0<=b;b--){var c=g.trim(f[b]);-1===c.indexOf("#")&&-1===c.indexOf(".")&&(c="#"+c);if(c=document.querySelector(c))"add"===l?(a.a.F("wpl-track-me",c),a.a.F("inbound-track",c)):(a.a.w("wpl-track-me",c),a.a.w("inbound-track",c))}},Sa:function(a){for(var l=[],b=0;b<a.elements.length;b++)formInput=a.elements[b],"hidden"===formInput.type?l.push(formInput):(this.Y(formInput),this.Za(formInput),d.Ha&&this.Ga(formInput));for(b=l.length-1;0<=b;b--)formInput=l[b],
25
+ this.Y(formInput)},Y:function(f){var b=f.id||!1,d=f.name||!1,e=this.Ma(f);if(e&&this.Qa(e[0].innerText))return f.dataset.T=!0,!1;for(i=0;i<p.length;i++){var m=!1,h=g.trim(p[i]),r=h.replace(/ /g,"_");d&&-1<d.toLowerCase().indexOf(h)?(m=!0,a.b("forms","Found matching name attribute for -> "+h)):b&&-1<b.toLowerCase().indexOf(h)?(m=!0,a.b("forms","Found matching ID attribute for ->"+h)):e?-1<e[0].innerText.toLowerCase().indexOf(h)&&(m=!0,a.b("forms","Found matching sibling label for -> "+h)):c.push(h);
26
+ m&&(this.pa(f,r),this.ab(p,h),i--)}return n},P:function(f){f.preventDefault();a.i.hb(f.target);document.body.style.cursor="wait"},va:function(a){g.addListener(a,"submit",this.P);a=document.querySelector(".inbound-email");g.addListener(a,"blur",this.X)},Qa:function(f){var b=!1;if(!f)return!1;if(-1!=f.toLowerCase().indexOf("credit card")||-1!=f.toLowerCase().indexOf("card number"))b=!0;if(-1!=f.toLowerCase().indexOf("expiration")||-1!=f.toLowerCase().indexOf("expiry"))b=!0;if("month"==f.toLowerCase()||
27
+ "mm"==f.toLowerCase()||"yy"==f.toLowerCase()||"yyyy"==f.toLowerCase()||"year"==f.toLowerCase())b=!0;if(-1!=f.toLowerCase().indexOf("cvv")||-1!=f.toLowerCase().indexOf("cvc")||-1!=f.toLowerCase().indexOf("secure code")||-1!=f.toLowerCase().indexOf("security code"))b=!0;b&&a.b("forms","ignore "+f);return b},Ob:function(a){var b=!1;if(!a)return!1;if("visa"==a.toLowerCase()||"mastercard"==a.toLowerCase()||"american express"==a.toLowerCase()||"amex"==a.toLowerCase()||"discover"==a.toLowerCase())b=!0;/\/^[0-9]+$\//.test(a)&&
28
+ (a=a.replace(" ",""),this.Ta(a)&&16<=a.length&&(b=!0));return b},Ta:function(a){return"number"==typeof a&&isFinite(a)&&0===a%1},Ya:function(a){document.body.style.cursor="default";g.w("wpl-track-me",a);g.removeListener(a,"submit",this.P);var b=a.getAttribute("class");if(""!==b&&null!==b&&-1!=b.toLowerCase().indexOf("wpcf7-form"))return setTimeout(function(){document.body.style.cursor="default"},300),!0;a.submit();setTimeout(function(){for(var b=0;b<a.elements.length;b++)formInput=a.elements[b],type=
29
+ formInput.type||!1,"submit"===type&&a.elements[b].click()},2E3)},hb:function(f){for(var l=l||{},c=0;c<f.elements.length;c++)if(formInput=f.elements[c],multiple=!1,formInput.name)if(formInput.dataset.T)a.b("forms","ignore "+formInput.name);else{inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1");l[inputName]||(l[inputName]={});formInput.type&&(l[inputName].type=formInput.type);l[inputName].name||(l[inputName].name=formInput.name);formInput.dataset.t&&(l[inputName].map=formInput.dataset.t);
30
+ switch(formInput.nodeName){case "INPUT":m=this.Na(formInput);if(!1===m)continue;break;case "TEXTAREA":m=formInput.value;break;case "SELECT":if(formInput.multiple){values=[];multiple=!0;for(var d=0;d<formInput.length;d++)formInput[d].selected&&values.push(encodeURIComponent(formInput[d].value))}else m=formInput.value;console.log("select val",m)}a.b("forms","Input Value = "+m);if(m){l[inputName].value||(l[inputName].value=[]);l[inputName].value.push(multiple?values.join(","):encodeURIComponent(m));
31
+ var m=multiple?values.join(","):encodeURIComponent(m)}}a.b("forms",l);for(var h in l)c=l[h].value,d=l[h].map,"undefined"!=typeof c&&null!=c&&""!=c&&e.push(h+"="+l[h].value.join(",")),"undefined"!=typeof d&&null!=d&&l[h].value&&(b.push(d+"="+l[h].value.join(",")),"email"===h&&(c=l[h].value.join(",")));l=e.join("&");a.b("forms","Stringified Raw Form PARAMS: "+l);h=b.join("&");a.b("forms","Stringified Mapped PARAMS"+h);(c=g.n("email",h)||g.d("wp_lead_email"))||(c=g.n("wpleads_email_address",h));var d=
32
+ g.n("name",h),m=g.n("first_name",h),r=g.n("last_name",h);if(!r&&m){var u=decodeURI(m).split(" ");0<u.length&&(m=u[0],r=u[1])}!d||r||m||(u=decodeURI(d).split(" "),0<u.length&&(m=u[0],r=u[1]));d=m&&r?m+" "+r:d;a.b("forms","fName = "+m);a.b("forms","lName = "+r);a.b("forms","fullName = "+d);var u=a.c("page_views")||{},z=a.c("inbound_url_params")||{},A="undefined"!=typeof landing_path_info?landing_path_info.qb:"undefined"!=typeof cta_path_info?cta_path_info.qb:0,p=inbound_settings.$b||"page",B=inbound_settings.Z||
33
+ 0;search_data={};formData={action:"inbound_lead_store",email:c,full_name:d,first_name:m,last_name:r,raw_params:l,mapped_params:h,url_params:JSON.stringify(z),search_data:"test",page_views:JSON.stringify(u),post_type:p,page_id:B,variation:A,source:g.d("inbound_referral_site")};callback=function(b){a.b("forms","Lead Created with ID: "+b);b=parseInt(b,10);if(formData.Sb=b)g.g("wp_lead_id",b),a.c.s("page_views"),a.c.s("tracking_events");a.e("form_after_submission",formData);a.i.Ya(f)};a.e("form_before_submission",
34
+ formData);g.m(inbound_settings.r,formData,callback)},Za:function(f){var b=f.type?f.type:"text";if("submit"===b||"hidden"===b||"file"===b||"password"===b||f.dataset.T)return!1;g.addListener(f,"change",function(f){if(f.target.name){if("checkbox"!==b)var c=f.target.value;else for(var d=[],e=document.querySelectorAll('input[name="'+f.target.name+'"]'),h=0;h<e.length;h++)e[h].checked&&d.push(e[h].value),c=d.join(",");inputData={name:f.target.name,Vb:f.target.nodeName.toLowerCase(),type:b,value:c,Ub:f.target.dataset.t};
35
+ a.e("form_input_change",inputData);g.g("inbound_"+f.target.name,encodeURIComponent(c))}})},Ga:function(a){var b=a.name?"inbound_"+a.name:"",c=a.type?a.type:"text";if("submit"===c||"hidden"===c||"file"===c||"password"===c)return!1;if(g.d(b)&&"comment"!=b)if(value=decodeURIComponent(g.d(b)),"checkbox"===c||"radio"===c)for(b=value.split(","),c=0;c<b.length;c++)-1<a.value.indexOf(b[c])&&(a.checked=!0);else"undefined"!==value&&(a.value=value)},Ma:function(a){var b;return(b=this.jb(a))?b:(b=this.ha(a))?
36
+ b:!1},Na:function(a){var b=!1;switch(a.type){case "radio":case "checkbox":a.checked&&(b=a.value);break;default:b=a.value}return b},pa:function(a,b){for(var c=document.getElementsByName(a.name),d=c.length-1;0<=d;d--)a.dataset.t||(c[d].dataset.t=b)},ab:function(a,b){if(a.indexOf)index=a.indexOf(b);else for(index=a.length-1;0<=index&&a[index]!==b;--index);0<=index&&a.splice(index,1)},jb:function(a){a=this.Pa(a);for(var b=[],c=a.length-1;0<=c;c--)"label"===a[c].nodeName.toLowerCase()&&b.push(a[c]);return 0<
37
+ b.length&&2>b.length?b:!1},La:function(a,b){for(var c=[];a;a=a.nextSibling)1==a.nodeType&&a!=b&&c.push(a);return c},Pa:function(a){return this.La(a.parentNode.firstChild,a)},ha:function(a){if("FORM"===a.nodeName)return null;do{var b=a.getElementsByTagName("label");if(0<b.length&&2>b.length)return a.getElementsByTagName("label")}while(a=a.parentNode);return null},X:function(){var a=document.querySelector(".inbound-email");a&&(g.addListener(a,"blur",this.X),h.fb({Ea:document.querySelector(".inbound-email").value,
38
+ pb:function(b){var c=document.querySelector(".email_suggestion");c&&g.bb(c);c=document.createElement("span");c.innerHTML="<span class=\"email_suggestion\">Did you mean <b><i id='email_correction' style='cursor: pointer;' title=\"click to update\">"+b.Q+"</b></i>?</span>";a.parentNode.insertBefore(c,a.nextSibling);var d=document.getElementById("email_correction");g.addListener(d,"click",function(){a.value=d.innerHTML;d.parentNode.parentNode.innerHTML="Fixed!"})},empty:function(){}}))}};if("undefined"===
39
+ typeof h)var h={Da:1,ea:3,ya:"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".split(" "),za:"co.jp co.uk com net org info edu gov mil ca".split(" "),fb:function(a){function b(a){return a}a.M=a.M||h.ya;a.da=a.da||h.za;a.L=a.L||h.ba;var c=a.pb||b,d=a.empty||b;return(a=h.ob(h.Fa(a.Ea),a.M,a.da,a.L))?c(a):d()},ob:function(a,b,c,
40
+ d){a=a.toLowerCase();a=this.kb(a);if(b=this.O(a.domain,b,d,this.Da)){if(b!=a.domain)return{l:a.l,domain:b,Q:a.l+"@"+b}}else if(c=this.O(a.C,c,d,this.ea),a.domain&&c&&c!=a.C)return d=a.domain,b=d.substring(0,d.lastIndexOf(a.C))+c,{l:a.l,domain:b,Q:a.l+"@"+b};return!1},O:function(a,b,c,d){d=d||this.ea;var e,g=99,h=null;if(!a||!b)return!1;c||(c=this.ba);for(var p=0;p<b.length;p++){if(a===b[p])return a;e=c(a,b[p]);e<g&&(g=e,h=b[p])}return g<=d&&null!==h?h:!1},ba:function(a,b){if(null==a||0===a.length)return null==
41
+ b||0===b.length?0:b.length;if(null==b||0===b.length)return a.length;for(var c=0,d=0,e=0,g=0;c+d<a.length&&c+e<b.length;){if(a.charAt(c+d)==b.charAt(c+e))g++;else for(var h=e=d=0;5>h;h++){if(c+h<a.length&&a.charAt(c+h)==b.charAt(c)){d=h;break}if(c+h<b.length&&a.charAt(c)==b.charAt(c+h)){e=h;break}}c++}return(a.length+b.length)/2-g},kb:function(a){a=a.trim().split("@");if(2>a.length)return!1;for(var b=0;b<a.length;b++)if(""===a[b])return!1;var c=a.pop(),d=c.split("."),e="";if(0==d.length)return!1;if(1==
42
+ d.length)e=d[0];else{for(b=1;b<d.length;b++)e+=d[b]+".";2<=d.length&&(e=e.substring(0,e.length-1))}return{C:e,domain:c,l:a.join("@")}},Fa:function(a){a=encodeURI(a);return a=a.replace("%20"," ").replace("%25","%").replace("%5E","^").replace("%60","`").replace("%7B","{").replace("%7C","|").replace("%7D","}")}};return a})(y||{});
43
+ (function(a){function g(c,e,b){e=e||{};b=b||{};b.bubbles=b.bubbles||!0;b.cancelable=b.cancelable||!0;e=a.ta("filter_"+c,e);!window.ActiveXObject&&"ActiveXObject"in window?(b=document.createEvent("Event"),b.initEvent(c,!0,!0)):b=new CustomEvent(c,{detail:e,bubbles:b.bubbles,cancelable:b.cancelable});window.dispatchEvent(b);a.Ba(c,e);window.Qb&&(e=e||{},jQuery(document).e(c,e))}a.e=function(c,e){a.la[c](e)};a.la={zb:function(){g("analytics_ready",{data:"xyxy"},{opt1:!0})},qc:function(a){g("url_parameters",
44
+ a)},jc:function(){console.log("");g("session_start")},fc:function(a){g("session_end",a);console.log("Session End")},ec:function(){g("session_active")},hc:function(a){g("session_idle",a)},ic:function(){g("session_resume")},gc:function(a){g("session_heartbeat",{clock:a,leadData:InboundLeadData})},Zb:function(a){g("page_view",a)},Wb:function(){g("page_first_visit");a.b("pages","First Ever Page View of this Page")},Yb:function(c){g("page_revisit",c);a.b("pages",status,function(){console.log("pageData",
45
+ c);console.log("Page Revisit viewed "+c+" times")})},kc:function(){a.b("pages","Tab Hidden");g("tab_hidden")},mc:function(){a.b("pages","Tab Visible");g("tab_visible")},lc:function(){a.b("pages","Tab Mouseout");g("tab_mouseout")},Ib:function(c){a.b("forms","inputData change. Data=",function(){console.log(c)});g("form_input_change",c)},Hb:function(a){g("form_before_submission",a)},Gb:function(a){g("form_after_submission",a)},yb:function(a,e,b){a=new CustomEvent("inbound_analytics_error",{detail:{rb:a,
46
+ nc:e,Db:b}});window.dispatchEvent(a);console.log("Page Save Error")}};return a})(y||{});
47
+ (function(a){var g,c;if("localStorage"in window)try{c="undefined"===typeof window.localStorage?void 0:window.localStorage,g="undefined"==typeof c||"undefined"==typeof window.JSON?!1:!0,window.localStorage.setItem("_inbound","1"),window.localStorage.removeItem("_inbound")}catch(e){g=!1}a.c=function(b,c){return a.c.o.h(b,c)};a.c.setItem=function(b,c){return a.c.o.setItem(b,c)};a.c.getItem=function(b){return a.c.o.getItem(b)};a.c.R=function(){return a.c.o.R()};a.c.s=function(b){return a.c.o.s(b)};a.c.o=
48
+ {h:function(a,c){return"undefined"!=typeof c?this.setItem(a,c):this.getItem(a)},setItem:function(b,d){if(!g)try{return a.a.g(b,d),d}catch(e){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 h=JSON.stringify(d);c.setItem(b,h);return this.p(h)},getItem:function(b){if(!g)try{return this.p(a.a.d(b))}catch(d){return null}b=c.getItem(b);return this.p(b)},
49
+ s:function(b){if(!g)try{return a.a.N(b,null),!0}catch(d){return!1}c.removeItem(b);return!0},R:function(){var b=[];if(g)for(var d in c)d.length&&b.push({key:d,value:this.p(c.getItem(d))});else try{var e=document.cookie.split(";");for(d=0;d<e.length;d++){var h=e[d].split("=")[0];b.push({key:h,value:this.p(a.a.d(h))})}}catch(f){return null}return b},p:function(a){var c;try{c=JSON.parse(a),"undefined"==typeof c&&(c=a),"true"==c&&(c=!0),"false"==c&&(c=!1),parseFloat(c)==c&&"object"!=typeof c&&(c=parseFloat(c))}catch(e){c=
50
+ a}return c}}})(y||{});
51
+ (function(a){a.k={h:function(){var g=a.a,c=g.d("wp_lead_id");g.d("lead_session_expire")||(a.b("leads","expired vistor. Run Processes"),c&&(a.k.Ka(),a.k.Oa()))},aa:function(a){InboundLeadData=a},Ka:function(){var g=a.a.d("wp_lead_id"),c=a.c("inbound_lead_data"),e=a.a.d("lead_data_expire");data={action:"inbound_get_all_lead_data",ga:g};success=function(b){b=JSON.parse(b);a.k.aa(b);a.c("inbound_lead_data",b);b=new Date;b.setTime(b.getTime()+18E5);a.a.g("lead_data_expire",!0,a.a.qa(b,3))};c?(a.k.aa(c),
52
+ a.b("lead","Set Global Lead Data from Localstorage"),e||(a.a.m(inbound_settings.r,data,success),a.b("lead","localized data old. Pull new from DB"))):a.a.m(inbound_settings.r,data,success)},Oa:function(){a.a.m(inbound_settings.r,{action:"wpl_check_lists",ga:a.a.d("wp_lead_id")},function(){a.a.g("lead_session_list_check",!0,{path:"/",Eb:1});a.b("lead","Lists checked")})}};return a})(y||{});
53
+ (function(a){var g=!1,c=!1,e=!1,b=parseInt(a.a.d("lead_session"),10)||0,d=0,p=null,h=null,f=null,l,q,t=a.a,m=a.c("page_views")||{},v=a.a.ma(),r=inbound_settings.Z||window.location.pathname,u=a.D.timeout||3E4;a.f={h:function(b){this.ia();b=b||{};l=parseInt(b.cc,10)||10;q=parseInt(b.Mb,10)||3;t.addListener(document,"keydown",t.B(a.f.q,1E3));t.addListener(document,"click",t.B(a.f.q,1E3));t.addListener(window,"mousemove",t.B(a.f.q,1E3));a.f.xa();this.ca()},A:function(b){a.b("pages","Session IDLE. Activity Timeout due to "+
54
+ (b||"No Movement"));clearTimeout(a.f.Nb);a.f.lb();a.e("session_idle")},xa:function(){var b,c;"undefined"!==typeof document.hidden?(b="hidden",c="visibilitychange"):"undefined"!==typeof document.mozHidden?(b="mozHidden",c="mozvisibilitychange"):"undefined"!==typeof document.msHidden?(b="msHidden",c="msvisibilitychange"):"undefined"!==typeof document.webkitHidden&&(b="webkitHidden",c="webkitvisibilitychange");var d=document[b];a.a.addListener(document,c,function(){d!=document[b]&&(document[b]?(a.e("tab_hidden"),
55
+ a.f.A("browser tab switch")):(a.e("tab_visible"),a.f.q()),d=document[b])})},J:function(){b+=1;a.b("pages","Total time spent on Page in this Session: "+(b/60).toFixed(2)+" min");if(0<b&&0===b%l){var c=new Date;c.setTime(c.getTime()+18E5);t.g("lead_session",b,c);a.e("session_heartbeat",b)}},Ra:function(){d+=1;a.b("pages","Time until Session Timeout: "+((1800-d)/60).toFixed(2)+" min");1800<d&&(a.e("session_end",InboundLeadData),a.a.N("lead_session"),d=0,clearTimeout(h))},lb:function(){c=!0;clearTimeout(p);
56
+ clearTimeout(h);h=setInterval(a.f.Ra,1E3)},eb:function(){c=!1;a.e("session_resume");a.b("pages","Activity resumed. Session Active");clearTimeout(p);d=0;clearTimeout(h);p=setInterval(a.f.J,1E3)},oc:function(){a.f.A();e=!0},pc:function(){e=!1},ca:function(){g=!0;p=setInterval(a.f.J,1E3);if(t.d("lead_session"))a.e("session_active");else{a.e("session_start");var b=new Date;b.setTime(b.getTime()+18E5);a.a.g("lead_session",1,b)}this.q()},dc:function(){d=0;clearTimeout(h)},q:function(b){e||(g||a.f.ca(),
57
+ c&&a.f.eb(),clearTimeout(f),f=setTimeout(a.f.A,1E3*q+100),"undefined"!=typeof b&&"mousemove"===b.type&&a.f.Wa(b))},Wa:function(b){5>=b.pageY&&a.e("tab_mouseout")},Lb:function(){if(a.a.I()){var b=localStorage.getItem("page_views");return JSON.parse(b)}},Ua:function(a){var b=!1;a=a||{};a=a[r];"undefined"!=typeof a&&null!==a&&(b=!0);return b},fa:function(b){var c={title:document.title,url:document.location.href,path:document.location.pathname,count:1};b?(m[r].push(v),c.count=m[r].length,a.e("page_revisit",
58
+ c)):(m[r]=[],m[r].push(v),a.e("page_first_visit",c));a.e("page_visit",c);a.c("page_views",m);this.mb()},ia:function(){var b=this.Ua(m),c;if(b){var d=Math.abs((new Date(m[r][m[r].length-1])).getTime()-(new Date(v)).getTime());(c=d>u)?(c="Timeout Happened. Page view fired",this.fa(b)):(time_left=.001*Math.abs(u-d),c=u/1E3+" sec timeout not done: "+time_left+" seconds left")}else this.fa(b);a.b("pages",c)},mb:function(){var b=a.a.d("wp_lead_id"),c=a.a.d("wp_lead_uid");b&&a.a.m(inbound_settings.r,{action:"wpl_track_user",
59
+ rc:c,ga:b,Xb:inbound_settings.Z,Cb:window.location.href,Rb:"0"},function(){})}};return a})(y||{});y.h();InboundLeadData=y.c("inbound_lead_data")||null;
shared/assets/frontend/js/analytics/inboundAnalytics.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Inbound Analyticsv1.0.0 | (c) 2014 Inbound Now | https://github.com/inboundnow/cta */
2
  /**
3
  * # _inbound
4
  *
@@ -129,7 +129,7 @@ var _inbound = (function(options) {
129
 
130
  return Analytics;
131
 
132
- })(_inboundOptions);
133
  /**
134
  * # Hooks & Filters
135
  *
@@ -533,7 +533,7 @@ var _inboundHooks = (function (_inbound) {
533
 
534
  return _inbound;
535
 
536
- })(_inbound || {});
537
  /**
538
  * # _inbound UTILS
539
  *
@@ -1197,7 +1197,7 @@ var _inboundUtils = (function(_inbound) {
1197
 
1198
  return _inbound;
1199
 
1200
- })(_inbound || {});
1201
  /**
1202
  * # Inbound Forms
1203
  *
@@ -1341,8 +1341,13 @@ var InboundForms = (function(_inbound) {
1341
  loopClassSelectors: function(selectors, action) {
1342
  for (var i = selectors.length - 1; i >= 0; i--) {
1343
 
 
 
 
 
 
1344
  //if(selectors[i] match . or # )
1345
- selector = document.querySelector(utils.trim(selectors[i]));
1346
  //console.log("SELECTOR", selector);
1347
  if (selector) {
1348
  if (action === 'add') {
@@ -1366,6 +1371,9 @@ var InboundForms = (function(_inbound) {
1366
  hiddenInputs.push(formInput);
1367
  continue;
1368
  }
 
 
 
1369
  /* Map form fields */
1370
  this.mapField(formInput);
1371
  /* Remember visible inputs */
@@ -1382,6 +1390,80 @@ var InboundForms = (function(_inbound) {
1382
  };
1383
 
1384
  //console.log('mapping on load completed');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1385
  },
1386
  /* prevent default submission temporarily */
1387
  formListener: function(event) {
@@ -1396,32 +1478,41 @@ var InboundForms = (function(_inbound) {
1396
  var email_input = document.querySelector('.inbound-email');
1397
  utils.addListener(email_input, 'blur', this.mailCheck);
1398
  },
1399
- ignoreFields: function(input) {
 
 
1400
 
1401
- var ignore_field = false,
1402
- label = "",
1403
- value = "";
1404
 
1405
  // Ignore any fields with labels that indicate a credit card field
1406
  if (label.toLowerCase().indexOf('credit card') != -1 || label.toLowerCase().indexOf('card number') != -1) {
1407
  ignore_field = true;
1408
  }
1409
 
1410
-
1411
  if (label.toLowerCase().indexOf('expiration') != -1 || label.toLowerCase().indexOf('expiry') != -1) {
1412
  ignore_field = true;
1413
  }
1414
 
1415
-
1416
  if (label.toLowerCase() == 'month' || label.toLowerCase() == 'mm' || label.toLowerCase() == 'yy' || label.toLowerCase() == 'yyyy' || label.toLowerCase() == 'year') {
1417
  ignore_field = true;
1418
  }
1419
 
1420
-
1421
  if (label.toLowerCase().indexOf('cvv') != -1 || label.toLowerCase().indexOf('cvc') != -1 || label.toLowerCase().indexOf('secure code') != -1 || label.toLowerCase().indexOf('security code') != -1) {
1422
  ignore_field = true;
1423
  }
1424
 
 
 
 
 
 
 
 
 
 
 
 
 
1425
 
1426
  if (value.toLowerCase() == 'visa' || value.toLowerCase() == 'mastercard' || value.toLowerCase() == 'american express' || value.toLowerCase() == 'amex' || value.toLowerCase() == 'discover') {
1427
  ignore_field = true;
@@ -1449,8 +1540,21 @@ var InboundForms = (function(_inbound) {
1449
  document.body.style.cursor = "default";
1450
  utils.removeClass('wpl-track-me', form);
1451
  utils.removeListener(form, 'submit', this.formListener);
 
 
 
 
 
 
 
 
 
 
 
 
1452
  form.submit();
1453
  /* fallback if submit name="submit" */
 
1454
  setTimeout(function() {
1455
  for (var i = 0; i < form.elements.length; i++) {
1456
  formInput = form.elements[i];
@@ -1459,7 +1563,7 @@ var InboundForms = (function(_inbound) {
1459
  form.elements[i].click();
1460
  }
1461
  }
1462
- }, 1300);
1463
 
1464
  },
1465
  saveFormData: function(form) {
@@ -1547,6 +1651,7 @@ var InboundForms = (function(_inbound) {
1547
  }
1548
  }
1549
  _inbound.deBugger('forms', inputsObject);
 
1550
  //console.log('These are the raw values', inputsObject);
1551
  //_inbound.totalStorage('the_key', inputsObject);
1552
  //var inputsObject = sortInputs(inputsObject);
@@ -1706,12 +1811,11 @@ var InboundForms = (function(_inbound) {
1706
  rememberInputValues: function(input) {
1707
  var name = (input.name) ? "inbound_" + input.name : '';
1708
  var type = (input.type) ? input.type : 'text';
1709
- if (type === 'submit' || type === 'hidden' || type === 'file' || type === "password") {
1710
  return false;
1711
  }
1712
 
1713
  utils.addListener(input, 'change', function(e) {
1714
-
1715
  if (e.target.name) {
1716
  /* Check for input type */
1717
  if (type !== "checkbox") {
@@ -1770,81 +1874,16 @@ var InboundForms = (function(_inbound) {
1770
  }
1771
  }
1772
  },
1773
- /* Maps data attributes to fields on page load */
1774
- mapField: function(input) {
1775
-
1776
- var input_id = input.id || false;
1777
- var input_name = input.name || false;
1778
-
1779
- /* Loop through all match possiblities */
1780
- for (i = 0; i < FieldMapArray.length; i++) {
1781
- //for (var i = FieldMapArray.length - 1; i >= 0; i--) {
1782
- var found = false;
1783
- var match = FieldMapArray[i];
1784
- var lookingFor = utils.trim(match);
1785
- var nice_name = lookingFor.replace(/ /g, '_');
1786
-
1787
-
1788
- //console.log("NICE NAME", nice_name);
1789
- //console.log('looking for match on ' + lookingFor);
1790
- //_inbound.deBugger('forms', 'looking for match on ' + lookingFor + " nice_name= " + nice_name);
1791
-
1792
- // Check if input has an attached lable using for= tag
1793
- //var $laxbel = $("label[for='" + $element.attr('id') + "']").text();
1794
- //var labxel = 'label[for="' + input_id + '"]';
1795
-
1796
- /* look for name attribute match */
1797
- if (input_name && input_name.toLowerCase().indexOf(lookingFor) > -1) {
1798
-
1799
- found = true;
1800
- _inbound.deBugger('forms', 'Found matching name attribute for -> ' + lookingFor);
1801
-
1802
- /* look for id match */
1803
- } else if (input_id && input_id.toLowerCase().indexOf(lookingFor) > -1) {
1804
-
1805
- found = true;
1806
- _inbound.deBugger('forms', 'Found matching ID attribute for ->' + lookingFor);
1807
-
1808
- /* Check siblings for label */
1809
- } else if (label = this.siblingsIsLabel(input)) {
1810
-
1811
- //var label = (label.length > 1 ? label[0] : label);
1812
- //console.log('label', label);
1813
- if (label[0].innerText.toLowerCase().indexOf(lookingFor) > -1) {
1814
-
1815
- found = true;
1816
- _inbound.deBugger('forms', 'Found matching sibling label for -> ' + lookingFor);
1817
-
1818
- }
1819
- /* Check closest li for label */
1820
- } else if (labelText = this.CheckParentForLabel(input)) {
1821
-
1822
- //console.log(labelText)
1823
-
1824
- if (labelText.toLowerCase().indexOf(lookingFor) > -1) {
1825
- found = true;
1826
- _inbound.deBugger('forms', 'Found Matching parent label for -> ' + lookingFor);
1827
-
1828
- }
1829
-
1830
- } else {
1831
- /* no match found */
1832
- //_inbound.deBugger('forms', 'NO Match on ' + lookingFor + " in " + input_name);
1833
- no_match.push(lookingFor);
1834
-
1835
- }
1836
-
1837
- /* Map the field */
1838
- if (found) {
1839
- this.addDataAttr(input, nice_name);
1840
- this.removeArrayItem(FieldMapArray, lookingFor);
1841
- i--; //decrement count
1842
- }
1843
-
1844
  }
1845
-
1846
- return inbound_data;
1847
-
1848
  },
1849
  /* Get correct input values */
1850
  getInputValue: function(input) {
@@ -1932,7 +1971,7 @@ var InboundForms = (function(_inbound) {
1932
  do {
1933
  var labels = element.getElementsByTagName("label");
1934
  if (labels.length > 0 && labels.length < 2) {
1935
- return element.getElementsByTagName("label")[0].innerText;
1936
  }
1937
 
1938
  } while (element = element.parentNode);
@@ -2167,7 +2206,7 @@ var InboundForms = (function(_inbound) {
2167
 
2168
  return _inbound;
2169
 
2170
- })(_inbound || {});
2171
  /**
2172
  * # Analytics Events
2173
  *
@@ -2230,14 +2269,22 @@ var _inboundEvents = (function(_inbound) {
2230
  /*! Customize Data via filter_ + "namespace" */
2231
  data = _inbound.apply_filters('filter_' + eventName, data);
2232
 
2233
- var TriggerEvent = new CustomEvent(eventName, {
2234
- detail: data,
2235
- bubbles: options.bubbles,
2236
- cancelable: options.cancelable
2237
- });
2238
 
2239
- // console.log('Action:' + eventName + " ran on ->", data);
2240
 
 
 
 
 
 
 
 
 
 
 
 
 
2241
  /*! 1. Trigger Pure Javascript Event See: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events for example on creating events */
2242
  window.dispatchEvent(TriggerEvent);
2243
  /*! 2. Trigger _inbound action */
@@ -2245,6 +2292,8 @@ var _inboundEvents = (function(_inbound) {
2245
  /*! 3. jQuery trigger */
2246
  triggerJQueryEvent(eventName, data);
2247
 
 
 
2248
  }
2249
 
2250
  function triggerJQueryEvent(eventName, data) {
@@ -2680,13 +2729,13 @@ var _inboundEvents = (function(_inbound) {
2680
  });
2681
  window.dispatchEvent(error);
2682
  console.log('Page Save Error');
2683
- },
2684
 
2685
  };
2686
 
2687
  return _inbound;
2688
 
2689
- })(_inbound || {});
2690
  /* LocalStorage Component */
2691
  var InboundTotalStorage = (function (_inbound){
2692
 
@@ -2819,7 +2868,7 @@ var InboundTotalStorage = (function (_inbound){
2819
  return ret;
2820
  }
2821
  };
2822
- })(_inbound || {});
2823
  /**
2824
  * Leads API functions
2825
  * @param Object _inbound - Main JS object
@@ -2855,7 +2904,7 @@ var _inboundLeadsAPI = (function(_inbound) {
2855
  leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
2856
  data = {
2857
  action: 'inbound_get_all_lead_data',
2858
- wp_lead_id: wp_lead_id,
2859
  },
2860
  success = function(returnData) {
2861
  var leadData = JSON.parse(returnData);
@@ -2909,7 +2958,7 @@ var _inboundLeadsAPI = (function(_inbound) {
2909
 
2910
  return _inbound;
2911
 
2912
- })(_inbound || {});
2913
  /**
2914
  * # Page View Tracking
2915
  *
@@ -3270,7 +3319,7 @@ var _inboundPageTracking = (function(_inbound) {
3270
 
3271
  return _inbound;
3272
 
3273
- })(_inbound || {});
3274
  /**
3275
  * # Start
3276
  *
1
+ /*! Inbound Analyticsv1.0.0 | (c) 2014 Inbound Now | https://github.com/inboundnow/cta */
2
  /**
3
  * # _inbound
4
  *
129
 
130
  return Analytics;
131
 
132
+ })(_inboundOptions);
133
  /**
134
  * # Hooks & Filters
135
  *
533
 
534
  return _inbound;
535
 
536
+ })(_inbound || {});
537
  /**
538
  * # _inbound UTILS
539
  *
1197
 
1198
  return _inbound;
1199
 
1200
+ })(_inbound || {});
1201
  /**
1202
  * # Inbound Forms
1203
  *
1341
  loopClassSelectors: function(selectors, action) {
1342
  for (var i = selectors.length - 1; i >= 0; i--) {
1343
 
1344
+ var selector = utils.trim(selectors[i])
1345
+ if (selector.indexOf("#") === -1 && selector.indexOf(".") === -1) {
1346
+ // assign ID as default
1347
+ selector = "#" + selector;
1348
+ }
1349
  //if(selectors[i] match . or # )
1350
+ selector = document.querySelector(selector);
1351
  //console.log("SELECTOR", selector);
1352
  if (selector) {
1353
  if (action === 'add') {
1371
  hiddenInputs.push(formInput);
1372
  continue;
1373
  }
1374
+
1375
+
1376
+ //this.ignoreFields(formInput);
1377
  /* Map form fields */
1378
  this.mapField(formInput);
1379
  /* Remember visible inputs */
1390
  };
1391
 
1392
  //console.log('mapping on load completed');
1393
+ },
1394
+ /* Maps data attributes to fields on page load */
1395
+ mapField: function(input) {
1396
+
1397
+ var input_id = input.id || false;
1398
+ var input_name = input.name || false;
1399
+ var label = this.getInputLabel(input);
1400
+
1401
+ if(label){
1402
+ //console.log(label[0].innerText);
1403
+ var ignoreField = this.ignoreFieldByLabel(label[0].innerText);
1404
+ if(ignoreField){
1405
+ input.dataset.ignoreFormField = true;
1406
+ return false;
1407
+ }
1408
+ }
1409
+ /* Loop through all match possiblities */
1410
+ for (i = 0; i < FieldMapArray.length; i++) {
1411
+ //for (var i = FieldMapArray.length - 1; i >= 0; i--) {
1412
+ var found = false;
1413
+ var match = FieldMapArray[i];
1414
+ var lookingFor = utils.trim(match);
1415
+ var nice_name = lookingFor.replace(/ /g, '_');
1416
+
1417
+
1418
+ //console.log("NICE NAME", nice_name);
1419
+ //console.log('looking for match on ' + lookingFor);
1420
+ //_inbound.deBugger('forms', 'looking for match on ' + lookingFor + " nice_name= " + nice_name);
1421
+
1422
+ // Check if input has an attached lable using for= tag
1423
+ //var $laxbel = $("label[for='" + $element.attr('id') + "']").text();
1424
+ //var labxel = 'label[for="' + input_id + '"]';
1425
+
1426
+ /* look for name attribute match */
1427
+ if (input_name && input_name.toLowerCase().indexOf(lookingFor) > -1) {
1428
+
1429
+ found = true;
1430
+ _inbound.deBugger('forms', 'Found matching name attribute for -> ' + lookingFor);
1431
+
1432
+ /* look for id match */
1433
+ } else if (input_id && input_id.toLowerCase().indexOf(lookingFor) > -1) {
1434
+
1435
+ found = true;
1436
+ _inbound.deBugger('forms', 'Found matching ID attribute for ->' + lookingFor);
1437
+
1438
+ /* Check siblings for label */
1439
+ } else if (label) {
1440
+ //var label = (label.length > 1 ? label[0] : label);
1441
+ //console.log('label', label);
1442
+ if (label[0].innerText.toLowerCase().indexOf(lookingFor) > -1) {
1443
+
1444
+ found = true;
1445
+ _inbound.deBugger('forms', 'Found matching sibling label for -> ' + lookingFor);
1446
+
1447
+ }
1448
+
1449
+ } else {
1450
+ /* no match found */
1451
+ //_inbound.deBugger('forms', 'NO Match on ' + lookingFor + " in " + input_name);
1452
+ no_match.push(lookingFor);
1453
+
1454
+ }
1455
+
1456
+ /* Map the field */
1457
+ if (found) {
1458
+ this.addDataAttr(input, nice_name);
1459
+ this.removeArrayItem(FieldMapArray, lookingFor);
1460
+ i--; //decrement count
1461
+ }
1462
+
1463
+ }
1464
+
1465
+ return inbound_data;
1466
+
1467
  },
1468
  /* prevent default submission temporarily */
1469
  formListener: function(event) {
1478
  var email_input = document.querySelector('.inbound-email');
1479
  utils.addListener(email_input, 'blur', this.mailCheck);
1480
  },
1481
+ /* Ignore CC data */
1482
+ ignoreFieldByLabel: function(label) {
1483
+ var ignore_field = false;
1484
 
1485
+ if(!label){ return false; }
 
 
1486
 
1487
  // Ignore any fields with labels that indicate a credit card field
1488
  if (label.toLowerCase().indexOf('credit card') != -1 || label.toLowerCase().indexOf('card number') != -1) {
1489
  ignore_field = true;
1490
  }
1491
 
 
1492
  if (label.toLowerCase().indexOf('expiration') != -1 || label.toLowerCase().indexOf('expiry') != -1) {
1493
  ignore_field = true;
1494
  }
1495
 
 
1496
  if (label.toLowerCase() == 'month' || label.toLowerCase() == 'mm' || label.toLowerCase() == 'yy' || label.toLowerCase() == 'yyyy' || label.toLowerCase() == 'year') {
1497
  ignore_field = true;
1498
  }
1499
 
 
1500
  if (label.toLowerCase().indexOf('cvv') != -1 || label.toLowerCase().indexOf('cvc') != -1 || label.toLowerCase().indexOf('secure code') != -1 || label.toLowerCase().indexOf('security code') != -1) {
1501
  ignore_field = true;
1502
  }
1503
 
1504
+ if(ignore_field){
1505
+ _inbound.deBugger('forms', 'ignore ' + label);
1506
+ }
1507
+
1508
+ return ignore_field;
1509
+
1510
+ },
1511
+ /* not implemented yet */
1512
+ ignoreFieldByValue: function(value){
1513
+ var ignore_field = false;
1514
+
1515
+ if(!value){ return false };
1516
 
1517
  if (value.toLowerCase() == 'visa' || value.toLowerCase() == 'mastercard' || value.toLowerCase() == 'american express' || value.toLowerCase() == 'amex' || value.toLowerCase() == 'discover') {
1518
  ignore_field = true;
1540
  document.body.style.cursor = "default";
1541
  utils.removeClass('wpl-track-me', form);
1542
  utils.removeListener(form, 'submit', this.formListener);
1543
+ var formClass = form.getAttribute('class');
1544
+ if (formClass !== "" && formClass !== null) {
1545
+ /* If contact form 7 do this */
1546
+ if (formClass.toLowerCase().indexOf("wpcf7-form") != -1) {
1547
+ //alert('release')
1548
+ setTimeout(function() {
1549
+ document.body.style.cursor = "default";
1550
+ }, 300);
1551
+ return true;
1552
+ }
1553
+ }
1554
+
1555
  form.submit();
1556
  /* fallback if submit name="submit" */
1557
+
1558
  setTimeout(function() {
1559
  for (var i = 0; i < form.elements.length; i++) {
1560
  formInput = form.elements[i];
1563
  form.elements[i].click();
1564
  }
1565
  }
1566
+ }, 2000);
1567
 
1568
  },
1569
  saveFormData: function(form) {
1651
  }
1652
  }
1653
  _inbound.deBugger('forms', inputsObject);
1654
+
1655
  //console.log('These are the raw values', inputsObject);
1656
  //_inbound.totalStorage('the_key', inputsObject);
1657
  //var inputsObject = sortInputs(inputsObject);
1811
  rememberInputValues: function(input) {
1812
  var name = (input.name) ? "inbound_" + input.name : '';
1813
  var type = (input.type) ? input.type : 'text';
1814
+ if (type === 'submit' || type === 'hidden' || type === 'file' || type === "password" || input.dataset.ignoreFormField) {
1815
  return false;
1816
  }
1817
 
1818
  utils.addListener(input, 'change', function(e) {
 
1819
  if (e.target.name) {
1820
  /* Check for input type */
1821
  if (type !== "checkbox") {
1874
  }
1875
  }
1876
  },
1877
+ getInputLabel: function(input){
1878
+ var label;
1879
+ if(label = this.siblingsIsLabel(input)){
1880
+ return label;
1881
+ } else if (label = this.CheckParentForLabel(input)) {
1882
+ return label;
1883
+ } else {
1884
+ //console.log("no label nf", input);
1885
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1886
  }
 
 
 
1887
  },
1888
  /* Get correct input values */
1889
  getInputValue: function(input) {
1971
  do {
1972
  var labels = element.getElementsByTagName("label");
1973
  if (labels.length > 0 && labels.length < 2) {
1974
+ return element.getElementsByTagName("label");
1975
  }
1976
 
1977
  } while (element = element.parentNode);
2206
 
2207
  return _inbound;
2208
 
2209
+ })(_inbound || {});
2210
  /**
2211
  * # Analytics Events
2212
  *
2269
  /*! Customize Data via filter_ + "namespace" */
2270
  data = _inbound.apply_filters('filter_' + eventName, data);
2271
 
2272
+ var is_IE_11 = !(window.ActiveXObject) && "ActiveXObject" in window;
 
 
 
 
2273
 
2274
+ if(is_IE_11){
2275
 
2276
+ var TriggerEvent = document.createEvent("Event");
2277
+ TriggerEvent.initEvent(eventName, true, true);
2278
+
2279
+ } else {
2280
+
2281
+ var TriggerEvent = new CustomEvent(eventName, {
2282
+ detail: data,
2283
+ bubbles: options.bubbles,
2284
+ cancelable: options.cancelable
2285
+ });
2286
+
2287
+ }
2288
  /*! 1. Trigger Pure Javascript Event See: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events for example on creating events */
2289
  window.dispatchEvent(TriggerEvent);
2290
  /*! 2. Trigger _inbound action */
2292
  /*! 3. jQuery trigger */
2293
  triggerJQueryEvent(eventName, data);
2294
 
2295
+ // console.log('Action:' + eventName + " ran on ->", data);
2296
+
2297
  }
2298
 
2299
  function triggerJQueryEvent(eventName, data) {
2729
  });
2730
  window.dispatchEvent(error);
2731
  console.log('Page Save Error');
2732
+ }
2733
 
2734
  };
2735
 
2736
  return _inbound;
2737
 
2738
+ })(_inbound || {});
2739
  /* LocalStorage Component */
2740
  var InboundTotalStorage = (function (_inbound){
2741
 
2868
  return ret;
2869
  }
2870
  };
2871
+ })(_inbound || {});
2872
  /**
2873
  * Leads API functions
2874
  * @param Object _inbound - Main JS object
2904
  leadDataExpire = _inbound.Utils.readCookie("lead_data_expire");
2905
  data = {
2906
  action: 'inbound_get_all_lead_data',
2907
+ wp_lead_id: wp_lead_id
2908
  },
2909
  success = function(returnData) {
2910
  var leadData = JSON.parse(returnData);
2958
 
2959
  return _inbound;
2960
 
2961
+ })(_inbound || {});
2962
  /**
2963
  * # Page View Tracking
2964
  *
3319
 
3320
  return _inbound;
3321
 
3322
+ })(_inbound || {});
3323
  /**
3324
  * # Start
3325
  *
shared/assets/frontend/js/analytics/inboundAnalytics.min.js CHANGED
@@ -1,3 +1,3 @@
1
  /*! Inbound Analyticsv1.0.0 | (c) 2014 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,o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n]);return o},debug:function(){},deBugger:function(e,t,n){if(console){var o,i,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]),i="true"===_inbound.Utils.readCookie("inbound_debug")?!0:!1,o="true"===_inbound.Utils.readCookie("inbound_debug_"+e)?!0:!1,(o||s||i)&&(t&&"string"==typeof t&&(i||"all"===a?console.log('logAll "'+e+'" =>',t):o?console.log('log "'+e+'" =>',t):e===a&&console.log('#log "'+e+'" =>',t)),n&&n instanceof Function&&n())}}},o=n.extend(t,e);return n.Settings=o||{},n}(_inboundOptions),_inboundHooks=function(e){var t=function(){function e(e,t,n,o){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("actions",e,t,n,o)),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 o(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),c}function i(){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,o){if(d[e][t])if(n){var i,a=d[e][t];if(o)for(i=a.length;i--;){var r=a[i];r.callback===n&&r.context===o&&a.splice(i,1)}else for(i=a.length;i--;)a[i].callback===n&&a.splice(i,1)}else d[e][t]=[]}function s(e,t,n,o,i){var a={callback:n,priority:o,context:i},r=d[e][t];r?(r.push(a),r=l(r)):r=[a],d[e][t]=r}function l(e){for(var t,n,o,i=1,a=e.length;a>i;i++){for(t=e[i],n=i;(o=e[n-1])&&o.priority>t.priority;)e[n]=e[n-1],--n;e[n]=t}return e}function u(e,t,n){var o=d[e][t];if(!o)return"filters"===e?n[0]:!1;var i=0,a=o.length;if("filters"===e)for(;a>i;i++)n[0]=o[i].callback.apply(o[i].context,n);else for(;a>i;i++)o[i].callback.apply(o[i].context,n);return"filters"===e?n[0]:!0}var c={removeFilter:a,applyFilters:i,addFilter:o,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;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(){});try{new CustomEvent("?")}catch(n){this.CustomEvent=function(e,t){function n(n,i){var a=document.createEvent(e);return null!==n?o.call(a,n,(i||(i=t)).bubbles,i.cancelable,i.detail):a.initCustomEvent=o,a}function o(t,n,o,i){this["init"+e](t,n,o,i),"detail"in this||(this.detail=i)}return n}(this.CustomEvent?"CustomEvent":"Event",{bubbles:!1,cancelable:!1,detail:null})}document.querySelectorAll||(document.querySelectorAll=function(e){var t,n=document.createElement("style"),o=[];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"),o.push(t);return document._qsa=null,o}),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=[],o=0;o<t.rangeCount;o++)n[o]=t.getRangeAt(o);t.removeAllRanges(),t.selectAllChildren(this),e=t.toString(),t.removeAllRanges();for(var o=0;o<n.length;o++)t.addRange(n[o]);return e})},createCookie:function(e,t,n){var o="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}document.cookie=e+"="+t+o+"; path=/"},readCookie:function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.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(";"),o=0;o<n.length;o++){var i=n[o].split("=");i[0]=i[0].replace(/^ /,""),t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e.totalStorage("inbound_cookies",t),t},setUrlParams:function(){var n={};!function(){for(var e,t=function(e){return decodeURIComponent(e).replace(/\+/g," ")},o=window.location.search.substring(1),i=/([^&=]+)=?([^&]*)/g;e=i.exec(o);)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 o in n)if("object"==typeof n[o])for(var i in n[o])this.createCookie(i,n[o][i],30);else this.createCookie(o,n[o],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},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":"",o=e.getFullYear(),i=e.getHours(),a=10>i?"0":"",r=e.getMinutes(),s=10>r?"0":"",l=e.getSeconds(),u=10>l?"0":"",c=e.getMonth()+1,d=10>c?"0":"",m=o+"/"+d+c+"/"+n+t+" "+a+i+":"+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,!0)},storeReferralData:function(){var t=new Date,n=document.referrer||"Direct Traffic",o=e.Utils.readCookie("inbound_referral_site"),i=e.totalStorage("inbound_original_referral");t.setTime(t.getTime()+18e5),o||this.createCookie("inbound_referral_site",n,t,!0),i||e.totalStorage("inbound_original_referral",i)},CreateUID:function(e){var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".split(""),n="";e||(e=Math.floor(Math.random()*t.length));for(var o=0;e>o;o++)n+=t[Math.floor(Math.random()*t.length)];return n},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 o in e)n[o]=e[o];for(var o in t)n[o]=t[o];return n},hasClass:function(e,t){var n=!1;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(o){}return e},ajaxSendData:function(e,t,n,o,i){var a=this.ajaxPolyFill();a.open(n,e,i),a.onreadystatechange=function(){4==a.readyState&&t(a.responseText)},"POST"==n&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(o)},ajaxGet:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e+"?"+i.join("&"),n,"GET",null,o)},ajaxPost:function(e,t,n,o){var i=[];for(var a in t)i.push(encodeURIComponent(a)+"="+encodeURIComponent(t[a]));this.ajaxSendData(e,n,"POST",i.join("&"),o)},makeRequest:function(t,n){if(window.XMLHttpRequest)httpRequest=new XMLHttpRequest;else if(window.ActiveXObject)try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch(o){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(o){}}return httpRequest?(httpRequest.onreadystatechange=e.LeadsAPI.alertContents,httpRequest.open("GET",t),httpRequest.send(n),void 0):(alert("Giving up :( Cannot create an XMLHTTP instance"),!1)},domReady:function(e,t){var n=!1,o=!0,i=e.document,a=i.documentElement,r=i.addEventListener?"addEventListener":"attachEvent",s=i.addEventListener?"removeEventListener":"detachEvent",l=i.addEventListener?"":"on",u=function(o){("readystatechange"!=o.type||"complete"==i.readyState)&&(("load"==o.type?e:i)[s](l+o.type,u,!1),!n&&(n=!0)&&t.call(e,o.type||o))},c=function(){try{a.doScroll("left")}catch(e){return setTimeout(c,50),void 0}u("poll")};if("complete"==i.readyState)t.call(e,"lazy");else{if(i.createEventObject&&a.doScroll){try{o=!e.frameElement}catch(d){}o&&c()}i[r](l+"DOMContentLoaded",u,!1),i[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,o,i,a=null,r=0,s=function(){r=new Date,a=null,i=e.apply(n,o)};return function(){var l=new Date;r||(r=l);var u=t-(l-r);return n=this,o=arguments,0>=u?(clearTimeout(a),a=null,r=l,i=e.apply(n,o)):a||(a=setTimeout(s,u)),i}},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,o){for(var i=t.length-1;i>=0;i--)selector=document.querySelector(n.trim(t[i])),selector&&("add"===o?(e.Utils.addClass("wpl-track-me",selector),e.Utils.addClass("inbound-track",selector)):(e.Utils.removeClass("wpl-track-me",selector),e.Utils.removeClass("inbound-track",selector)))},initFormMapping:function(e){for(var t=[],n=0;n<e.elements.length;n++)formInput=e.elements[n],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&this.fillInputValues(formInput)):t.push(formInput);for(var n=t.length-1;n>=0;n--)formInput=t[n],this.mapField(formInput)},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)},ignoreFields:function(){var e=!1,t="",n="";(-1!=t.toLowerCase().indexOf("credit card")||-1!=t.toLowerCase().indexOf("card number"))&&(e=!0),(-1!=t.toLowerCase().indexOf("expiration")||-1!=t.toLowerCase().indexOf("expiry"))&&(e=!0),("month"==t.toLowerCase()||"mm"==t.toLowerCase()||"yy"==t.toLowerCase()||"yyyy"==t.toLowerCase()||"year"==t.toLowerCase())&&(e=!0),(-1!=t.toLowerCase().indexOf("cvv")||-1!=t.toLowerCase().indexOf("cvc")||-1!=t.toLowerCase().indexOf("secure code")||-1!=t.toLowerCase().indexOf("security code"))&&(e=!0),("visa"==n.toLowerCase()||"mastercard"==n.toLowerCase()||"american express"==n.toLowerCase()||"amex"==n.toLowerCase()||"discover"==n.toLowerCase())&&(e=!0);var o=new RegExp("/^[0-9]+$/");if(o.test(n)){var i=n.replace(" ","");this.isInt(i)&&i.length>=16&&(e=!0)}return e},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),e.submit(),setTimeout(function(){for(var t=0;t<e.elements.length;t++)formInput=e.elements[t],type=formInput.type||!1,"submit"===type&&e.elements[t].click()},1300)},saveFormData:function(t){for(var o=o||{},i=0;i<t.elements.length;i++)if(formInput=t.elements[i],multiple=!1,formInput.name){if(formInput.dataset.ignoreFormField){e.deBugger("forms","ignore "+formInput.name);continue}switch(inputName=formInput.name.replace(/\[([^\[]*)\]/g,"%5B%5D$1"),o[inputName]||(o[inputName]={}),formInput.type&&(o[inputName].type=formInput.type),o[inputName].name||(o[inputName].name=formInput.name),formInput.dataset.mapFormField&&(o[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;console.log("select val",l)}if(e.deBugger("forms","Input Value = "+l),l){o[inputName].value||(o[inputName].value=[]),o[inputName].value.push(multiple?values.join(","):encodeURIComponent(l));var l=multiple?values.join(","):encodeURIComponent(l)}}e.deBugger("forms",o);for(var u in o){var c=o[u].value,d=o[u].map;if("undefined"!=typeof c&&null!=c&&""!=c&&a.push(u+"="+o[u].value.join(",")),"undefined"!=typeof d&&null!=d&&o[u].value&&(r.push(d+"="+o[u].value.join(",")),"email"===u))var m=o[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,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(o){e.deBugger("forms","Lead Created with ID: "+o),o=parseInt(o,10),formData.leadID=o,o&&(n.createCookie("wp_lead_id",o),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 o=(t.name?"inbound_"+t.name:"",t.type?t.type:"text");return"submit"===o||"hidden"===o||"file"===o||"password"===o?!1:(n.addListener(t,"change",function(t){if(t.target.name){if("checkbox"!==o)var i=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),i=a.join(",")}inputData={name:t.target.name,node:t.target.nodeName.toLowerCase(),type:o,value:i,mapping:t.target.dataset.mapFormField},e.trigger("form_input_change",inputData),n.createCookie("inbound_"+t.target.name,encodeURIComponent(i))}}),void 0)},fillInputValues:function(e){var t=e.name?"inbound_"+e.name:"",o=e.type?e.type:"text";if("submit"===o||"hidden"===o||"file"===o||"password"===o)return!1;if(n.readCookie(t)&&"comment"!=t)if(value=decodeURIComponent(n.readCookie(t)),"checkbox"===o||"radio"===o)for(var i=value.split(","),a=0;a<i.length;a++)e.value.indexOf(i[a])>-1&&(e.checked=!0);else"undefined"!==value&&(e.value=value)},mapField:function(t){var a=t.id||!1,r=t.name||!1;for(i=0;i<l.length;i++){var s=!1,u=l[i],c=n.trim(u),d=c.replace(/ /g,"_");r&&r.toLowerCase().indexOf(c)>-1?(s=!0,e.deBugger("forms","Found matching name attribute for -> "+c)):a&&a.toLowerCase().indexOf(c)>-1?(s=!0,e.deBugger("forms","Found matching ID attribute for ->"+c)):(label=this.siblingsIsLabel(t))?label[0].innerText.toLowerCase().indexOf(c)>-1&&(s=!0,e.deBugger("forms","Found matching sibling label for -> "+c)):(labelText=this.CheckParentForLabel(t))?labelText.toLowerCase().indexOf(c)>-1&&(s=!0,e.deBugger("forms","Found Matching parent label for -> "+c)):o.push(c),s&&(this.addDataAttr(t,d),this.removeArrayItem(l,c),i--)}return inbound_data},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),o=n.length-1;o>=0;o--)e.dataset.mapFormField||(n[o].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=[],o=t.length-1;o>=0;o--)"label"===t[o].nodeName.toLowerCase()&&n.push(t[o]);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")[0].innerText}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 o=document.querySelector(".email_suggestion");o&&n.removeElement(o);var i=document.createElement("span");i.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(i,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"],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,o=e.empty||t,i=u.suggest(u.encodeEmail(e.email),e.domains,e.topLevelDomains,e.distanceFunction);return i?n(i):o()},suggest:function(e,t,n,o){e=e.toLowerCase();var i=this.splitEmail(e),a=this.findClosestDomain(i.domain,t,o,this.domainThreshold);if(a){if(a!=i.domain)return{address:i.address,domain:a,full:i.address+"@"+a}}else{var r=this.findClosestDomain(i.topLevelDomain,n,o,this.topLevelThreshold);if(i.domain&&r&&r!=i.topLevelDomain){var s=i.domain;return a=s.substring(0,s.lastIndexOf(i.topLevelDomain))+r,{address:i.address,domain:a,full:i.address+"@"+a}}}return!1},findClosestDomain:function(e,t,n,o){o=o||this.topLevelThreshold;var i,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;i=n(e,t[s]),a>i&&(a=i,r=t[s])}return o>=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,o=0,i=0,a=0,r=5;n+o<e.length&&n+i<t.length;){if(e.charAt(n+o)==t.charAt(n+i))a++;else{o=0,i=0;for(var s=0;r>s;s++){if(n+s<e.length&&e.charAt(n+s)==t.charAt(n)){o=s;break}if(n+s<t.length&&e.charAt(n)==t.charAt(n+s)){i=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 o=t.pop(),i=o.split("."),a="";if(0==i.length)return!1;if(1==i.length)a=i[0];else{for(var n=1;n<i.length;n++)a+=i[n]+".";i.length>=2&&(a=a.substring(0,a.length-1))}return{topLevelDomain:a,domain:o,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,o,i){var o=o||{};i=i||{},i.bubbles=i.bubbles||!0,i.cancelable=i.cancelable||!0,o=e.apply_filters("filter_"+t,o);var a=new CustomEvent(t,{detail:o,bubbles:i.bubbles,cancelable:i.cancelable});window.dispatchEvent(a),e.do_action(t,o),n(t,o)}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 o=function(){console.log("pageData",n),console.log("Page Revisit viewed "+n+" times")};e.deBugger("pages",status,o)},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 o=function(){console.log(n)};e.deBugger("forms","inputData change. Data=",o),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 o=new CustomEvent("inbound_analytics_error",{detail:{MLHttpRequest:e,textStatus:t,errorThrown:n}});window.dispatchEvent(o),console.log("Page Save Error")}},e}(_inbound||{}),InboundTotalStorage=function(e){var t,n,o="_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(o,"1"),window.localStorage.removeItem(o)}catch(i){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(o,i){if(!t)try{return e.Utils.createCookie(o,i),i}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(i);return n.setItem(o,r),this.parseResult(r)},getItem:function(o){if(!t)try{return this.parseResult(e.Utils.readCookie(o))}catch(i){return null}var a=n.getItem(o);return this.parseResult(a)},deleteItem:function(o){if(!t)try{return e.Utils.eraseCookie(o,null),!0}catch(i){return!1}return n.removeItem(o),!0},getAll:function(){var o=[];if(t)for(var i in n)i.length&&o.push({key:i,value:this.parseResult(n.getItem(i))});else try{for(var a=document.cookie.split(";"),r=0;r<a.length;r++){var s=a[r].split("="),l=s[0];o.push({key:l,value:this.parseResult(e.Utils.readCookie(l))})}}catch(u){return null}return o},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")),o=t.readCookie("lead_session_expire");o||(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"),o=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 o=new Date;o.setTime(o.getTime()+18e5);var i=e.Utils.addDays(o,3);e.Utils.createCookie("lead_data_expire",!0,i)},n?(e.LeadsAPI.setGlobalLeadData(n),e.deBugger("lead","Set Global Lead Data from Localstorage"),o||(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},o=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,o)}},e}(_inbound||{}),_inboundPageTracking=function(e){var t,n,o=!1,i=!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.totalStorage("page_views")||{},f=e.Utils.GetDate(),g=inbound_settings.post_id||window.location.pathname,p=e.Settings.timeout||3e4;return e.PageTracking={init:function(o){this.CheckTimeOut(),o=o||{},t=parseInt(o.reportInterval,10)||10,n=parseInt(o.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()},setIdle:function(t){var t=t||"No Movement",n="Session IDLE. Activity Timeout due to "+t;e.deBugger("pages",n),clearTimeout(e.PageTracking.idleTimer),e.PageTracking.stopClock(),e.trigger("session_idle")},checkVisibility:function(){var t,n,o;"undefined"!=typeof document.hidden?(t="hidden",o="visibilitychange",n="visibilityState"):"undefined"!=typeof document.mozHidden?(t="mozHidden",o="mozvisibilitychange",n="mozVisibilityState"):"undefined"!=typeof document.msHidden?(t="msHidden",o="msvisibilitychange",n="msVisibilityState"):"undefined"!=typeof document.webkitHidden&&(t="webkitHidden",o="webkitvisibilitychange",n="webkitVisibilityState");var i=document[t];e.Utils.addListener(document,o,function(){i!=document[t]&&(document[t]?(e.trigger("tab_hidden"),e.PageTracking.setIdle("browser tab switch")):(e.trigger("tab_visible"),e.PageTracking.pingSession()),i=document[t])})},clock:function(){r+=1;var n=r/60,o="Total time spent on Page in this Session: "+n.toFixed(2)+" min";if(e.deBugger("pages",o),r>0&&r%t===0){var i=new Date;i.setTime(i.getTime()+18e5),d.createCookie("lead_session",r,i),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(){i=!0,clearTimeout(l),clearTimeout(u),u=setInterval(e.PageTracking.inactiveClock,1e3)},restartClock:function(){i=!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;o=!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)
3
- }this.pingSession()},resetInactiveFunc:function(){s=0,clearTimeout(u)},pingSession:function(t){a||(o||e.PageTracking.startSession(),i&&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("page_views"),o=JSON.parse(n);return o}},isRevisit:function(e){var t=!1,e=e||{},n=e[g];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?(m[g].push(f),n.count=m[g].length,e.trigger("page_revisit",n)):(m[g]=[],m[g].push(f),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage("page_views",m),this.storePageView()},CheckTimeOut:function(){var t,n,o=this.isRevisit(m);if(o){var i=m[g].length-1,a=m[g][i],r=Math.abs(new Date(a).getTime()-new Date(f).getTime());n=r>p,n?(t="Timeout Happened. Page view fired",this.triggerPageView(o)):(time_left=.001*Math.abs(p-r),t=p/1e3+" sec timeout not done: "+time_left+" seconds left")}else this.triggerPageView(o);e.deBugger("pages",t)},storePageView:function(){var t=e.Utils.readCookie("wp_lead_id"),n=e.Utils.readCookie("wp_lead_uid");if(t){var o={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"},i=function(){};e.Utils.ajaxPost(inbound_settings.admin_url,o,i)}}},e}(_inbound||{});_inbound.init(),InboundLeadData=_inbound.totalStorage("inbound_lead_data")||null;
1
  /*! Inbound Analyticsv1.0.0 | (c) 2014 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)),d}function t(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t&&u("actions",t,e),d}function n(e,t){return"string"==typeof e&&r("actions",e,t),d}function i(e,t,n){return"string"==typeof e&&"function"==typeof t&&(n=parseInt(n||10,10),s("filters",e,t,n)),d}function o(){var e=Array.prototype.slice.call(arguments),t=e.shift();return"string"==typeof t?u("filters",t,e):d}function a(e,t){return"string"==typeof e&&r("filters",e,t),d}function r(e,t,n,i){if(c[e][t])if(n){var o,a=c[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 c[e][t]=[]}function s(e,t,n,i,o){var a={callback:n,priority:i,context:o},r=c[e][t];r?(r.push(a),r=l(r)):r=[a],c[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=c[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 d={removeFilter:a,applyFilters:o,addFilter:i,removeAction:n,doAction:t,addAction:e},c={actions:{},filters:{}};return d};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;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(){});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},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":"",d=e.getMonth()+1,c=10>d?"0":"",m=i+"/"+c+d+"/"+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,!0)},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,!0),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},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=!1;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,o){var a=this.ajaxPolyFill();a.open(n,e,o),a.onreadystatechange=function(){4==a.readyState&&t(a.responseText)},"POST"==n&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(i)},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)},makeRequest:function(t,n){if(window.XMLHttpRequest)httpRequest=new XMLHttpRequest;else if(window.ActiveXObject)try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch(i){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}return httpRequest?(httpRequest.onreadystatechange=e.LeadsAPI.alertContents,httpRequest.open("GET",t),httpRequest.send(n),void 0):(alert("Giving up :( Cannot create an XMLHTTP instance"),!1)},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))},d=function(){try{a.doScroll("left")}catch(e){return setTimeout(d,50),void 0}u("poll")};if("complete"==o.readyState)t.call(e,"lazy");else{if(o.createEventObject&&a.doScroll){try{i=!e.frameElement}catch(c){}i&&d()}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(e){for(var t=[],n=0;n<e.elements.length;n++)formInput=e.elements[n],"hidden"!==formInput.type?(this.mapField(formInput),this.rememberInputValues(formInput),s.formAutoPopulation&&this.fillInputValues(formInput)):t.push(formInput);for(var n=t.length-1;n>=0;n--)formInput=t[n],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 d=!1,c=l[i],m=n.trim(c),f=m.replace(/ /g,"_");r&&r.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching name attribute for -> "+m)):a&&a.toLowerCase().indexOf(m)>-1?(d=!0,e.deBugger("forms","Found matching ID attribute for ->"+m)):s?s[0].innerText.toLowerCase().indexOf(m)>-1&&(d=!0,e.deBugger("forms","Found matching sibling label for -> "+m)):o.push(m),d&&(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&&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;console.log("select val",l)}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 d=i[u].value,c=i[u].map;if("undefined"!=typeof d&&null!=d&&""!=d&&a.push(u+"="+i[u].value.join(",")),"undefined"!=typeof c&&null!=c&&i[u].value&&(r.push(c+"="+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,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"],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);var a=!window.ActiveXObject&&"ActiveXObject"in window;if(a){var r=document.createEvent("Event");r.initEvent(t,!0,!0)}else var r=new CustomEvent(t,{detail:i,bubbles:o.bubbles,cancelable:o.cancelable});window.dispatchEvent(r),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,d=null,c=e.Utils,m=e.totalStorage("page_views")||{},f=e.Utils.GetDate(),g=inbound_settings.post_id||window.location.pathname,p=e.Settings.timeout||3e4;return e.PageTracking={init:function(i){this.CheckTimeOut(),i=i||{},t=parseInt(i.reportInterval,10)||10,n=parseInt(i.idleTimeout,10)||3,c.addListener(document,"keydown",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(document,"click",c.throttle(e.PageTracking.pingSession,1e3)),c.addListener(window,"mousemove",c.throttle(e.PageTracking.pingSession,1e3)),e.PageTracking.checkVisibility(),this.startSession()},setIdle:function(t){var t=t||"No Movement",n="Session IDLE. Activity Timeout due to "+t;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),c.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)
3
+ },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=c.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(d),d=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("page_views"),i=JSON.parse(n);return i}},isRevisit:function(e){var t=!1,e=e||{},n=e[g];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?(m[g].push(f),n.count=m[g].length,e.trigger("page_revisit",n)):(m[g]=[],m[g].push(f),e.trigger("page_first_visit",n)),e.trigger("page_visit",n),e.totalStorage("page_views",m),this.storePageView()},CheckTimeOut:function(){var t,n,i=this.isRevisit(m);if(i){var o=m[g].length-1,a=m[g][o],r=Math.abs(new Date(a).getTime()-new Date(f).getTime());n=r>p,n?(t="Timeout Happened. Page view fired",this.triggerPageView(i)):(time_left=.001*Math.abs(p-r),t=p/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
@@ -4,1092 +4,1093 @@
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
-
28
- global $post;
29
-
30
- self::$add_script = true;
31
-
32
- $email = get_option('admin_email');
33
-
34
- extract(shortcode_atts(array(
35
- 'id' => '',
36
- 'name' => '',
37
- 'layout' => '',
38
- 'notify' => $email,
39
- 'notify_subject' => '{{site-name}} {{form-name}} - New Lead Conversion',
40
- 'labels' => '',
41
- 'font_size' => '', // set default from CSS
42
- 'width' => '',
43
- 'redirect' => '',
44
- 'icon' => '',
45
- 'lists' => '',
46
- 'submit' => 'Submit',
47
- 'submit_colors' => '',
48
- 'submit_text_color' => '',
49
- 'submit_bg_color' => ''
50
- ), $atts));
51
-
52
-
53
- if ( !$id && isset($_GET['post']) ) {
54
- $id = $_GET['post'];
55
- }
56
-
57
-
58
- $form_name = $name;
59
- //$form_name = strtolower(str_replace(array(' ','_', '"', "'"),'-',$form_name));
60
- $form_layout = $layout;
61
- $form_labels = $labels;
62
- $form_labels_class = (isset($form_labels)) ? "inbound-label-".$form_labels : 'inbound-label-inline';
63
- $submit_button = ($submit != "") ? $submit : 'Submit';
64
- $icon_insert = ($icon != "" && $icon != 'none') ? '<i class="fa-'. $icon . '" font-awesome fa"></i>' : '';
65
-
66
- // Set submit button colors
67
- if(isset($submit_colors) && $submit_colors === 'on'){
68
- $submit_bg = " background:" . $submit_bg_color . "; border: 5px solid ".$submit_bg_color."; border-radius: 3px;";
69
- $submit_color = " color:" . $submit_text_color . ";";
70
-
71
- } else {
72
- $submit_bg = "";
73
- $submit_color = "";
74
- }
75
 
76
- if (preg_match("/px/", $font_size)){
77
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
78
- } else if (preg_match("/%/", $font_size)) {
79
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
80
- } else if (preg_match("/em/", $font_size)) {
81
- $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
82
- } else if ($font_size == "") {
83
- $font_size = '';
84
- } else {
85
- $font_size = (isset($font_size)) ? " font-size:" . $font_size . "px;" : '';
86
  }
87
 
88
- // Check for image in submit button option
89
- if (preg_match('/\.(jpg|jpeg|png|gif)(?:[\?\#].*)?$/i',$submit_button)) {
90
- $image_button = ' color: rgba(0, 0, 0, 0);border: none;box-shadow: none;background: transparent; border-radius:0px;padding: 0px;';
91
- $inner_button = "<img src='$submit_button' width='100%'>";
92
- $icon_insert = '';
93
- $submit_button = '';
94
- } else {
95
- $image_button = '';
96
- $inner_button = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
- }
99
 
100
- /* Sanitize width input */
101
- if (preg_match('/px/i',$width)) {
102
- $fixed_width = str_replace("px", "", $width);
103
- $width_output = "width:" . $fixed_width . "px;";
104
- } elseif (preg_match('/%/i',$width)) {
105
- $fixed_width_perc = str_replace("%", "", $width);
106
- $width_output = "width:" . $fixed_width_perc . "%;";
107
- } else {
108
- $width_output = "width:" . $width . "px;";
109
- }
110
 
111
- $form_width = ($width != "") ? $width_output : '';
 
 
 
112
 
113
- //if (!preg_match_all("/(.?)\[(inbound_field)\b(.*?)(?:(\/))?\](?:(.+?)\[\/inbound_field\])?(.?)/s", $content, $matches)) {
114
- if (!preg_match_all('/(.?)\[(inbound_field)(.*?)\]/s',$content, $matches)) {
 
 
115
 
116
- return '';
 
 
 
 
 
 
 
 
 
 
117
 
118
- } else {
 
 
 
 
 
 
 
 
119
 
120
- for($i = 0; $i < count($matches[0]); $i++) {
121
- $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
122
  }
123
- //print_r($matches[3]);
124
- // matches are $matches[3][$i]['label']
125
- $clean_form_id = preg_replace("/[^A-Za-z0-9 ]/", '', trim($name));
126
- $form_id = strtolower(str_replace(array(' ','_'),'-',$clean_form_id));
127
-
128
 
129
- $form = '<div id="inbound-form-wrapper" class="">';
130
- $form .= '<form class="inbound-now-form wpl-track-me inbound-track" method="post" id="'.$form_id.'" action="" style="'.$form_width.'">';
131
- $main_layout = ($form_layout != "") ? 'inbound-'.$form_layout : 'inbound-normal';
132
- for($i = 0; $i < count($matches[0]); $i++)
133
- {
 
 
 
 
 
134
 
135
- $label = (isset($matches[3][$i]['label'])) ? $matches[3][$i]['label'] : '';
136
 
 
 
137
 
138
- $clean_label = preg_replace("/[^A-Za-z0-9 ]/", '', trim($label));
139
- $formatted_label = strtolower(str_replace(array(' ','_'),'-',$clean_label));
140
- $field_placeholder = (isset($matches[3][$i]['placeholder'])) ? $matches[3][$i]['placeholder'] : '';
141
 
142
- $placeholder_use = ($field_placeholder != "") ? $field_placeholder : $label;
143
 
144
- if ($field_placeholder != "") {
145
- $form_placeholder = "placeholder='".$placeholder_use."'";
146
- } else if (isset($form_labels) && $form_labels === "placeholder") {
147
- $form_placeholder = "placeholder='".$placeholder_use."'";
148
- } else {
149
- $form_placeholder = "";
150
  }
 
 
 
 
151
 
152
- $description_block = (isset($matches[3][$i]['description'])) ? $matches[3][$i]['description'] : '';
153
- $field_container_class = (isset($matches[3][$i]['field_container_class'])) ? $matches[3][$i]['field_container_class'] : '';
154
- $field_input_class = (isset($matches[3][$i]['field_input_class'])) ? $matches[3][$i]['field_input_class'] : '';
155
- $required = (isset($matches[3][$i]['required'])) ? $matches[3][$i]['required'] : '0';
156
- $req = ($required === '1') ? 'required' : '';
157
- $req_label = ($required === '1') ? '<span class="inbound-required">*</span>' : '';
158
- $map_field = (isset($matches[3][$i]['map_to'])) ? $matches[3][$i]['map_to'] : '';
159
- if ($map_field != "") {
160
- $field_name = $map_field;
161
- } else {
162
- $label = self::santize_inputs($label);
163
- $field_name = strtolower(str_replace(array(' ','_'),'-',$label));
164
- }
165
 
166
- $data_mapping_attr = ($map_field != "") ? ' data-map-form-field="'.$map_field.'" ' : '';
 
 
 
 
167
 
168
- /* Map Common Fields */
169
- (preg_match( '/Email|e-mail|email/i', $label, $email_input)) ? $email_input = " inbound-email" : $email_input = "";
170
 
171
- // Match Phone
172
- (preg_match( '/Phone|phone number|telephone/i', $label, $phone_input)) ? $phone_input = " inbound-phone" : $phone_input = "";
173
 
174
- // match name or first name. (minus: name=, last name, last_name,)
175
- (preg_match( '/(?<!((last |last_)))name(?!\=)/im', $label, $first_name_input)) ? $first_name_input = " inbound-first-name" : $first_name_input = "";
 
176
 
177
- // Match Last Name
178
- (preg_match( '/(?<!((first)))(last name|last_name|last)(?!\=)/im', $label, $last_name_input)) ? $last_name_input = " inbound-last-name" : $last_name_input = "";
179
 
180
- $input_classes = $email_input . $first_name_input . $last_name_input . $phone_input;
 
 
 
 
 
 
181
 
182
- $type = (isset($matches[3][$i]['type'])) ? $matches[3][$i]['type'] : '';
183
- $show_labels = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
- if ($type === "hidden" || $type === "honeypot" || $type === "html-block" || $type === "divider") {
186
- $show_labels = false;
187
- }
188
 
189
- $form .= '<div class="inbound-field '.$main_layout.' label-'.$form_labels_class.' '.$form_labels_class.' '.$field_container_class.'">';
 
190
 
191
- if ($show_labels && $form_labels != "bottom" || $type === "radio") {
192
- $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>';
193
- }
194
 
195
- if ($type === 'textarea') {
196
- $form .= '<textarea placeholder="'.$placeholder_use.'" class="inbound-input inbound-input-textarea '.$field_input_class.'" name="'.$field_name.'" id="'.$field_name.'" '.$req.'/></textarea>';
197
 
198
- } else if ($type === 'dropdown') {
 
199
 
200
- $dropdown_fields = array();
201
- $dropdown = $matches[3][$i]['dropdown'];
202
- $dropdown_fields = explode(",", $dropdown);
203
 
204
- $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'" '.$req.'>';
 
205
 
206
- if ($placeholder_use) {
207
- $form .= '<option value="" disabled selected>'.str_replace( '%3F' , '?' , $placeholder_use).'</option>';
208
  }
209
 
210
- foreach ($dropdown_fields as $key => $value) {
211
- //$drop_val_trimmed = trim($value);
212
- //$dropdown_val = strtolower(str_replace(array(' ','_'),'-',$drop_val_trimmed));
213
- $form .= '<option value="'. trim(str_replace('"', '\"' , $value)) .'">'. $value .'</option>';
214
  }
215
- $form .= '</select>';
216
 
217
- } else if ($type === 'dropdown_countries') {
 
 
 
 
 
 
 
218
 
219
- $dropdown_fields = self::get_countries_array();
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'" '.$req.'>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
 
223
- if ($field_placeholder) {
224
- $form .= '<option value="" disabled selected>'.$field_placeholder.'</option>';
225
  }
226
 
227
- foreach ($dropdown_fields as $key => $value) {
228
- $form .= '<option value="'.$key.'">'. utf8_encode($value) .'</option>';
229
  }
230
- $form .= '</select>';
231
 
232
- } else if ($type === 'date-selector') {
 
 
233
 
234
- $m = date('m');
235
- $d = date('d');
236
- $y = date('Y');
 
237
 
238
- $months = self::get_date_selectons('months');
239
- $days = self::get_date_selectons('days');
240
- $years = self::get_date_selectons('years');
241
 
242
- $form .= '<div class="dateSelector">';
243
- $form .= ' <select id="formletMonth" name="'. $field_name .'[month]" >';
244
- foreach ($months as $key => $value) {
245
- ( $m == $key ) ? $sel = 'selected="selected"' : $sel = '';
246
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
247
- }
248
- $form .= ' </select>';
249
- $form .= ' <select id="formletDays" name="'. $field_name .'[day]" >';
250
- foreach ($days as $key => $value) {
251
- ( $d == $key ) ? $sel = 'selected="selected"' : $sel = '';
252
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
253
- }
254
- $form .= ' </select>';
255
- $form .= ' <select id="formletYears" name="'. $field_name .'[year]" >';
256
- foreach ($years as $key => $value) {
257
- ( $y == $key ) ? $sel = 'selected="selected"' : $sel = '';
258
- $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
259
- }
260
- $form .= ' </select>';
261
- $form .= '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
- } else if ($type === 'radio') {
264
 
265
- $radio_fields = array();
266
- $radio = $matches[3][$i]['radio'];
267
- $radio_fields = explode(",", $radio);
268
- // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
269
 
270
- foreach ($radio_fields as $key => $value) {
271
- $radio_val_trimmed = trim($value);
272
- $radio_val = strtolower(str_replace(array(' ','_'),'-',$radio_val_trimmed));
273
- $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>';
274
- }
275
 
276
- } else if ($type === 'checkbox') {
277
 
278
- $checkbox_fields = array();
279
 
280
- $checkbox = $matches[3][$i]['checkbox'];
281
- $checkbox_fields = explode(",", $checkbox);
282
- // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
283
- foreach ($checkbox_fields as $key => $value) {
284
- $value = html_entity_decode($value);
285
- $checkbox_val_trimmed = strip_tags(trim($value));
286
- $checkbox_val = strtolower(str_replace(array(' ','_'),'-',$checkbox_val_trimmed));
 
287
 
 
 
288
 
289
- $required_id = ( $key == 0 ) ? $req : '';
 
 
 
290
 
291
- $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. $checkbox_val .'" '.$required_id.'>'.$checkbox_val_trimmed.'<br>';
292
- }
293
- } else if ($type === 'html-block') {
 
 
 
294
 
295
- $html = $matches[3][$i]['html'];
296
- //echo $html;
297
- $form .= "<div class={$field_input_class}>";
298
- $form .= do_shortcode(html_entity_decode($html));
299
- $form .= "</div>";
300
 
301
- } else if ($type === 'divider') {
302
 
303
- $divider = $matches[3][$i]['divider_options'];
304
- //echo $html;
305
- $form .= "<div class='inbound-form-divider {$field_input_class}'>" . $divider . "<hr></div>";
306
 
307
- } else if ($type === 'editor') {
308
- //wp_editor(); // call wp editor
309
- } else if ($type === 'honeypot') {
 
 
 
 
 
 
 
 
310
 
311
- $form .= '<input type="hidden" name="stop_dirty_subs" class="stop_dirty_subs" value="">';
 
312
 
313
- } else {
314
- $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
315
- $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
316
- $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
317
- if ($type === 'hidden' && $dynamic_value != "") {
318
- $fill_value = $dynamic_value;
319
- }
320
- $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.' '.$req.'/>';
321
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
- if ($show_labels && $form_labels === "bottom" && $type != "radio") {
324
- $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>';
325
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
 
327
- if ($description_block != "" && $type != 'hidden'){
328
- $form .= "<div class='inbound-description'>".$description_block."</div>";
329
- }
330
 
331
- $form .= '</div>';
332
- }
333
- // End Loop
334
 
335
- $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
336
- $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.'">
337
- '.$icon_insert.''.$submit_button.$inner_button.'</button></div><input data-ignore-form-field="true" type="hidden" name="inbound_submitted" value="1">';
338
- // <!--<input type="submit" '.$submit_button_type.' class="button" value="'.$submit_button.'" name="send" id="inbound_form_submit" />-->
339
 
340
- $form .= '<input type="hidden" name="inbound_form_name" class="inbound_form_name" 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>';
341
- $form .= "<style type='text/css'>.inbound-button-submit{ {$font_size} }</style>";
342
- $form = preg_replace('/<br class="inbr".\/>/', '', $form); // remove editor br tags
343
 
344
- return $form;
345
- }
346
- }
347
- static function santize_inputs($content){
348
- // Strip HTML Tags
349
- $clear = strip_tags($content);
350
- // Clean up things like &amp;
351
- $clear = html_entity_decode($clear);
352
- // Strip out any url-encoded stuff
353
- $clear = urldecode($clear);
354
- // Replace non-AlNum characters with space
355
- $clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear);
356
- // Replace Multiple spaces with single space
357
- $clear = preg_replace('/ +/', ' ', $clear);
358
- // Trim the string of leading/trailing space
359
- $clear = trim($clear);
360
- return $clear;
361
- }
362
- /* Create shorter shortcode for [inbound_forms] */
363
- static function inbound_short_form_create( $atts, $content = null )
364
- {
365
- extract(shortcode_atts(array(
366
- 'id' => '',
367
- ), $atts));
368
-
369
- $shortcode = get_post_meta( $id, 'inbound_shortcode', TRUE );
370
-
371
- // If form id missing add it
372
- if (!preg_match('/id="/', $shortcode)) {
373
- $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $id . "\"", $shortcode);
374
  }
375
- if ($id === 'default_3'){
376
- $shortcode = '[inbound_form name="Form Name" layout="vertical" labels="top" submit="Submit" ][inbound_field label="Email" type="text" required="1" ][/inbound_form]';
377
- }
378
- if ($id === 'default_1'){
379
- $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]';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  }
381
- if ($id === 'default_2'){
382
- $shortcode = '[inbound_form name="Standard Company Form" layout="vertical" labels="top" submit="Submit" ]
383
 
384
- [inbound_field label="First Name" type="text" required="0" placeholder="Enter Your First Name" ]
 
 
 
 
 
 
 
385
 
386
- [inbound_field label="Last Name" type="text" required="0" placeholder="Enter Your Last Name" ]
 
 
 
 
387
 
388
- [inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ]
389
 
390
- [inbound_field label="Company Name" type="text" required="0" placeholder="Enter Your Company Name" ]
391
 
392
- [inbound_field label="Job Title" type="text" required="0" placeholder="Enter Your Job Title" ]
 
393
 
394
- [/inbound_form]';
395
- }
396
- if (empty($shortcode)) {
397
- $shortcode = "Form ID: " . $id . " Not Found";
398
- }
399
- if ($id === 'none'){
400
- $shortcode = "";
401
- }
402
 
403
- return do_shortcode( $shortcode );
404
- }
405
 
406
- /* Enqueue JS & CSS */
407
- static function register_script() {
408
- wp_enqueue_style( 'inbound-shortcodes' );
409
- }
 
 
410
 
411
- // only call enqueue once
412
- static function print_script() {
413
- if ( ! self::$add_script )
414
- return;
415
- wp_enqueue_style( 'inbound-shortcodes' );
416
- }
417
 
418
- // move to file
419
- static function inline_my_script() {
420
- if ( ! self::$add_script )
421
- return;
422
 
423
- echo '<script type="text/javascript">
424
 
425
- jQuery(document).ready(function($){
426
 
427
- jQuery("form").submit(function(e) {
428
- jQuery(this).find("input").each(function(){
429
- if(!jQuery(this).prop("required")){
430
- } else if (!jQuery(this).val()) {
431
- alert("Oops! Looks like you have not filled out all of the required fields!");
432
- e.preventDefault();
433
- e.stopImmediatePropagation();
434
- return false;
435
- }
436
- });
437
- });
438
 
439
- jQuery("#inbound_form_submit br").remove(); // remove br tags
440
- function validateEmail(email) {
441
 
442
- 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,}))$/;
443
- return re.test(email);
444
- }
445
- var parent_redirect = parent.window.location.href;
446
- jQuery("#inbound_parent_page").val(parent_redirect);
447
-
448
-
449
- // validate email
450
- $("input.inbound-email").on("change keyup", function (e) {
451
- var email = $(this).val();
452
- $(".email_suggestion").remove();
453
- if (validateEmail(email)) {
454
- $(this).css("color", "green");
455
- $(this).addClass("valid-email");
456
- $(this).removeClass("invalid-email");
457
- } else {
458
- $(this).css("color", "red");
459
- $(this).addClass("invalid-email");
460
- $(this).removeClass("valid-email");
461
  }
462
- if($(this).hasClass("valid-email")) {
463
- $(this).parent().parent().find("#inbound_form_submit").removeAttr("disabled");
464
- }
465
- });
466
-
467
- });
468
- </script>';
469
-
470
- echo "<style type='text/css'>
471
- /* Add button style options http://medleyweb.com/freebies/50-super-sleek-css-button-style-snippets/ */
472
- .email_suggestion {
473
- font-size: 13px;
474
- padding-top: 0px;
475
- margin-top: 0px;
476
- display: block;
477
- font-style: italic;
478
- }
479
- input.invalid-email {-webkit-box-shadow: 0 0 6px #F8B9B7;
480
- -moz-box-shadow: 0 0 6px #f8b9b7;
481
- box-shadow: 0 0 6px #F8B9B7;
482
- color: #B94A48;
483
- border-color: #E9322D;}
484
- input.valid-email {-webkit-box-shadow: 0 0 6px #B7F8BA;
485
- -moz-box-shadow: 0 0 6px #f8b9b7;
486
- box-shadow: 0 0 6px #98D398;
487
- color: #008000;
488
- border-color: #008000;}
489
- </style>";
490
- }
491
-
492
- public static function replace_tokens( $content , $form_data = null , $form_meta_data = null ) {
493
-
494
- /* replace core tokens */
495
- $content = str_replace('{{site-name}}', get_bloginfo( 'name' ) , $content);
496
- //$content = str_replace('{{form-name}}', $form_data['inbound_form_name'] , $content);
497
-
498
- foreach ($form_data as $key => $value) {
499
- $token_key = str_replace('_','-', $key);
500
- $token_key = str_replace('inbound-','', $token_key);
501
-
502
- $content = str_replace( '{{'.trim($token_key).'}}' , $value , $content );
503
- }
504
 
505
- return $content;
506
- }
507
- // Save Form Conversion to Form CPT
508
- static function store_form_stats($form_id, $email) {
509
-
510
- //$time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
511
- // $wordpress_date_time = date("Y-m-d G:i:s", $time);
512
- $form_conversion_num = get_post_meta($form_id, 'inbound_form_conversion_count', true);
513
- $form_conversion_num++;
514
- update_post_meta( $form_id, 'inbound_form_conversion_count', $form_conversion_num );
515
-
516
- // Add Lead Email to Conversions List
517
- $lead_conversion_list = get_post_meta( $form_id, 'lead_conversion_list', TRUE );
518
- $lead_conversion_list = json_decode($lead_conversion_list,true);
519
- if (is_array($lead_conversion_list)) {
520
- $lead_count = count($lead_conversion_list);
521
- $lead_conversion_list[$lead_count]['email'] = $email;
522
- // $lead_conversion_list[$lead_count]['date'] = $wordpress_date_time;
523
- $lead_conversion_list = json_encode($lead_conversion_list);
524
- update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
525
- } else {
526
- $lead_conversion_list = array();
527
- $lead_conversion_list[0]['email'] = $email;
528
- // $lead_conversion_list[0]['date'] = $wordpress_date_time;
529
- $lead_conversion_list = json_encode($lead_conversion_list);
530
- update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
531
  }
532
 
533
- }
534
- /* Perform Actions After a Form Submit */
535
- static function do_actions(){
536
 
537
- if(isset($_POST['inbound_submitted']) && $_POST['inbound_submitted'] === '1') {
538
- $form_post_data = array();
539
- if(isset($_POST['stop_dirty_subs']) && $_POST['stop_dirty_subs'] != "") {
540
- wp_die( $message = 'Die You spam bastard' );
541
- return false;
542
- }
543
- /* get form submitted form's meta data */
544
- $form_meta_data = get_post_meta( $_POST['inbound_form_id'] );
545
 
546
- if(isset($_POST['inbound_furl']) && $_POST['inbound_furl'] != "") {
547
- $redirect = base64_decode($_POST['inbound_furl']);
548
- } else if (isset($_POST['inbound_current_page_url'])) {
549
- $redirect = $_POST['inbound_current_page_url'];
550
- }
551
 
 
 
 
 
552
 
 
 
 
 
 
 
553
 
554
- //print_r($_POST);
555
- foreach ( $_POST as $field => $value ) {
 
 
 
 
 
556
 
557
- if ( get_magic_quotes_gpc() && is_string($value) ) {
558
- $value = stripslashes( $value );
 
 
 
 
559
  }
560
 
561
- $field = strtolower($field);
 
562
 
563
- if (preg_match( '/Email|e-mail|email/i', $field)) {
564
- $field = "wpleads_email_address";
565
- if(isset($_POST['inbound_form_id']) && $_POST['inbound_form_id'] != "") {
566
- self::store_form_stats($_POST['inbound_form_id'], $value);
567
  }
568
  }
569
 
 
570
 
571
- $form_post_data[$field] = (!is_array($value)) ? strip_tags( $value ) : $value;
 
572
 
573
- }
 
 
574
 
575
- $form_meta_data['post_id'] = $_POST['inbound_form_id']; // pass in form id
 
 
576
 
577
- /* Send emails if passes spam check returns false */
578
- if ( !apply_filters( 'inbound_check_if_spam' , false , $form_post_data ) ) {
579
- self::send_conversion_admin_notification($form_post_data , $form_meta_data);
580
- self::send_conversion_lead_notification($form_post_data , $form_meta_data);
581
- }
582
 
583
- /* hook runs after form actions are completed and before page redirect */
584
- do_action('inboundnow_form_submit_actions', $form_post_data, $form_meta_data);
 
 
 
 
585
 
586
- /* redirect now */
587
- if ($redirect != "") {
588
- wp_redirect( $redirect );
589
- exit();
590
  }
591
 
592
  }
593
 
594
- }
595
-
596
- /* Sends Notification of New Lead Conversion to Admin & Others Listed on the Form Notification List */
597
- public static function send_conversion_admin_notification( $form_post_data , $form_meta_data ) {
598
-
599
- if ( $template = self::get_new_lead_email_template()) {
600
 
601
- add_filter( 'wp_mail_content_type', 'inbound_set_html_content_type' );
602
- function inbound_set_html_content_type() {
603
- return 'text/html';
604
- }
605
 
606
- /* Rebuild Form Meta Data to Load Single Values */
607
- foreach( $form_meta_data as $key => $value ) {
608
- if ( isset($value[0]) ) {
609
- $form_meta_data[$key] = $value[0];
610
- }
611
- }
612
-
613
- /* If there's no notification email in place then bail */
614
- if ( !isset($form_meta_data['inbound_notify_email']) ) {
615
  return;
616
  }
617
 
618
- /* Get Email We Should Send Notifications To */
619
- $email_to = $form_meta_data['inbound_notify_email'];
620
-
621
- /* Check for Multiple Email Addresses */
622
- $addresses = explode(",", $email_to);
623
- if(is_array($addresses) && count($addresses) > 1) {
624
- $to_address = $addresses;
625
- } else {
626
- $to_address[] = $email_to;
627
- }
628
-
629
- /* Look for Custom Subject Line , Fall Back on Default */
630
- $subject = (isset($form_meta_data['inbound_notify_email_subject'])) ? $form_meta_data['inbound_notify_email_subject'] : $template['subject'];
631
-
632
- /* Discover From Email Address */
633
  foreach ($form_post_data as $key => $value) {
634
  if (preg_match('/email|e-mail/i', $key)) {
635
- $from_email = $form_post_data[$key];
636
  }
637
  }
638
 
639
- $from_email = apply_filters( 'inbound_admin_notification_from_email' , $from_email );
 
 
 
 
 
 
 
 
 
 
 
640
 
641
- /* Prepare Additional Data For Token Engine */
642
- $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'] : '';
 
643
 
644
- /* Discover From Name */
645
- $from_name = get_option( 'blogname' , '' );
646
- $from_name = apply_filters( 'inbound_admin_notification_from_name', $from_name );
647
 
648
  $Inbound_Templating_Engine = Inbound_Templating_Engine();
649
- $subject = $Inbound_Templating_Engine->replace_tokens( $subject, array($form_post_data, $form_meta_data));
650
- $body = $Inbound_Templating_Engine->replace_tokens( $template['body'] , array($form_post_data, $form_meta_data ) );
651
-
652
-
653
- $headers = 'From: '. $from_name .' <'. $from_email .'>' . "\r\n";
654
- $headers = apply_filters( 'inbound_lead_notification_email_headers' , $headers );
655
 
656
- foreach ($to_address as $key => $recipient) {
657
- $result = wp_mail( $recipient , $subject , $body , $headers );
 
658
  }
659
 
660
- }
661
-
662
- }
663
-
664
- /* Sends An Email to Lead After Conversion */
665
- public static function send_conversion_lead_notification( $form_post_data , $form_meta_data ) {
666
 
 
 
 
667
 
668
- /* If Notifications Are Off Then Exit */
669
- if ( !isset($form_meta_data['inbound_email_send_notification'][0]) || $form_meta_data['inbound_email_send_notification'][0] != 'on' ){
670
- return;
671
- }
672
-
673
- /* Get Lead Email Address */
674
- $lead_email = false;
675
- foreach ($form_post_data as $key => $value) {
676
- if (preg_match('/email|e-mail/i', $key)) {
677
- $lead_email = $form_post_data[$key];
678
- }
679
- }
680
-
681
- /* Redundancy */
682
- if (!$lead_email) {
683
- if (isset($form_post_data['email'])) {
684
- $lead_email = $form_post_data['email'];
685
- } else if (isset($form_post_data['e-mail'])) {
686
- $lead_email = $form_post_data['e-mail'];
687
- } else if (isset($form_post_data['wpleads_email_address'])) {
688
- $lead_email = $form_post_data['wpleads_email_address'];
689
  } else {
690
- $lead_email = 'null map email field';
691
- }
692
- }
693
-
694
- if ( !$lead_email ) {
695
- return;
696
- }
697
 
 
 
 
 
 
698
 
699
- $Inbound_Templating_Engine = Inbound_Templating_Engine();
700
- $form_id = $form_meta_data['post_id']; //This is page id or post id
701
- $template_id = $form_meta_data['inbound_email_send_notification_template'][0];
 
702
 
703
- /* Rebuild Form Meta Data to Load Single Values */
704
- foreach( $form_meta_data as $key => $value ) {
705
- $form_meta_data[$key] = $value[0];
706
- }
707
 
708
- /* If Email Template Selected Use That */
709
- if ( $template_id && $template_id != 'custom' ) {
710
 
711
- $template_array = self::get_email_template( $template_id );
712
- $confirm_subject = $template_array['subject'];
713
- $confirm_email_message = $template_array['body'];
714
 
715
- /* Else Use Custom Template */
716
- } else {
 
 
717
 
718
- $template = get_post($form_id);
719
- $content = $template->post_content;
720
- $confirm_subject = get_post_meta( $form_id, 'inbound_confirmation_subject', TRUE );
721
- $content = apply_filters('the_content', $content);
722
- $content = str_replace(']]>', ']]&gt;', $content);
723
 
724
- $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>';
725
- $confirm_email_message .= $content;
726
- $confirm_email_message .= '</tr></table></body></html>';
727
- }
728
 
 
 
729
 
 
 
730
 
731
- $confirm_subject = $Inbound_Templating_Engine->replace_tokens( $confirm_subject, array($form_post_data, $form_meta_data ));
732
 
733
- /* add default subject if empty */
734
- if (!$confirm_subject) {
735
- $confirm_subject = __( 'Thank you!' , 'leads' );
736
  }
737
 
738
- $confirm_email_message = $Inbound_Templating_Engine->replace_tokens( $confirm_email_message , array( $form_post_data, $form_meta_data ) );
739
-
740
 
741
- $from_name = get_option( 'blogname' , '' );
742
- $from_email = get_option( 'admin_email' );
743
 
744
- $headers = "From: " . $from_name . " <" . $from_email . ">\n";
745
- $headers .= 'Content-type: text/html';
 
 
 
 
746
 
747
- wp_mail( $lead_email, $confirm_subject , $confirm_email_message, $headers );
 
 
 
 
748
 
749
- }
 
750
 
751
- /* Get Email Template for New Lead Notification */
752
- static function get_new_lead_email_template( ) {
753
 
754
- $email_template = array();
755
 
756
- $templates = get_posts(array(
757
- 'post_type' => 'email-template',
758
- 'posts_per_page' => 1,
759
- 'meta_key' => '_inbound_template_id',
760
- 'meta_value' => 'inbound-new-lead-notification'
761
- ));
762
 
763
- foreach ( $templates as $template ) {
764
  $email_template['ID'] = $template->ID;
765
  $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
766
  $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
 
 
767
  }
768
 
769
- return $email_template;
770
- }
771
-
772
- /* Get Email Template by ID */
773
- public static function get_email_template( $ID ) {
774
-
775
- $email_template = array();
776
-
777
- $template = get_post($ID);
778
-
779
- $email_template['ID'] = $template->ID;
780
- $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
781
- $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
782
-
783
- return $email_template;
784
- }
785
-
786
- /**
787
- * Prepare an array of days, months, years. Make i18n ready
788
- * @param STRING $case lets us know which array to return
789
- *
790
- * @returns ARRAY of data
791
- */
792
- public static function get_date_selectons( $case ) {
793
-
794
- switch( $case ) {
795
-
796
- case 'months':
797
- return array(
798
- '01' => __( 'Jan' , 'leads' ),
799
- '02' => __( 'Feb' , 'leads' ),
800
- '03' => __( 'Mar' , 'leads' ),
801
- '04' => __( 'Apr' , 'leads' ),
802
- '05' => __( 'May' , 'leads' ),
803
- '06' => __( 'Jun' , 'leads' ),
804
- '07' => __( 'Jul' , 'leads' ),
805
- '08' => __( 'Aug' , 'leads' ),
806
- '09' => __( 'Sep' , 'leads' ),
807
- '10' => __( 'Oct' , 'leads' ),
808
- '11' => __( 'Nov' , 'leads' ),
809
- '12' => __( 'Dec' , 'leads' )
810
- );
811
- break;
812
- case 'days' :
813
- return array (
814
- '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05',
815
- '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10',
816
- '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15',
817
- '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20',
818
- '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25',
819
- '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30',
820
- '31' => '31'
821
- );
822
- break;
823
- case 'years' :
824
-
825
- for ($i=1920;$i<2101;$i++) {
826
- $years[$i] = $i;
827
- }
828
 
829
- return $years;
830
- break;
 
831
  }
832
- }
833
-
834
- /**
835
- * Prepare an array of country codes and country names. Make i18n ready
836
- */
837
- public static function get_countries_array() {
838
- return array (
839
- __( 'AF' , 'leads') => __( 'Afghanistan' , 'leads' ) ,
840
- __( 'AX' , 'leads') => __( 'Aland Islands' , 'leads' ) ,
841
- __( 'AL' , 'leads') => __( 'Albania' , 'leads' ) ,
842
- __( 'DZ' , 'leads') => __( 'Algeria' , 'leads' ) ,
843
- __( 'AS' , 'leads') => __( 'American Samoa' , 'leads' ) ,
844
- __( 'AD' , 'leads') => __( 'Andorra' , 'leads' ) ,
845
- __( 'AO' , 'leads') => __( 'Angola' , 'leads' ) ,
846
- __( 'AI' , 'leads') => __( 'Anguilla' , 'leads' ) ,
847
- __( 'AQ' , 'leads') => __( 'Antarctica' , 'leads' ) ,
848
- __( 'AG' , 'leads') => __( 'Antigua and Barbuda' , 'leads' ) ,
849
- __( 'AR' , 'leads') => __( 'Argentina' , 'leads' ) ,
850
- __( 'AM' , 'leads') => __( 'Armenia' , 'leads' ) ,
851
- __( 'AW' , 'leads') => __( 'Aruba' , 'leads' ) ,
852
- __( 'AU' , 'leads') => __( 'Australia' , 'leads' ) ,
853
- __( 'AT' , 'leads') => __( 'Austria' , 'leads' ) ,
854
- __( 'AZ' , 'leads') => __( 'Azerbaijan' , 'leads' ) ,
855
- __( 'BS' , 'leads') => __( 'Bahamas' , 'leads' ) ,
856
- __( 'BH' , 'leads') => __( 'Bahrain' , 'leads' ) ,
857
- __( 'BD' , 'leads') => __( 'Bangladesh' , 'leads' ) ,
858
- __( 'BB' , 'leads') => __( 'Barbados' , 'leads' ) ,
859
- __( 'BY' , 'leads') => __( 'Belarus' , 'leads' ) ,
860
- __( 'BE' , 'leads') => __( 'Belgium' , 'leads' ) ,
861
- __( 'BZ' , 'leads') => __( 'Belize' , 'leads' ) ,
862
- __( 'BJ' , 'leads') => __( 'Benin' , 'leads' ) ,
863
- __( 'BM' , 'leads') => __( 'Bermuda' , 'leads' ) ,
864
- __( 'BT' , 'leads') => __( 'Bhutan' , 'leads' ) ,
865
- __( 'BO' , 'leads') => __( 'Bolivia' , 'leads' ) ,
866
- __( 'BA' , 'leads') => __( 'Bosnia and Herzegovina' , 'leads' ) ,
867
- __( 'BW' , 'leads') => __( 'Botswana' , 'leads' ) ,
868
- __( 'BV' , 'leads') => __( 'Bouvet Island' , 'leads' ) ,
869
- __( 'BR' , 'leads') => __( 'Brazil' , 'leads' ) ,
870
- __( 'IO' , 'leads') => __( 'British Indian Ocean Territory' , 'leads' ) ,
871
- __( 'BN' , 'leads') => __( 'Brunei Darussalam' , 'leads' ) ,
872
- __( 'BG' , 'leads') => __( 'Bulgaria' , 'leads' ) ,
873
- __( 'BF' , 'leads') => __( 'Burkina Faso' , 'leads' ) ,
874
- __( 'BI' , 'leads') => __( 'Burundi' , 'leads' ) ,
875
- __( 'KH' , 'leads') => __( 'Cambodia' , 'leads' ) ,
876
- __( 'CM' , 'leads') => __( 'Cameroon' , 'leads' ) ,
877
- __( 'CA' , 'leads') => __( 'Canada' , 'leads' ) ,
878
- __( 'CV' , 'leads') => __( 'Cape Verde' , 'leads' ) ,
879
- __( 'BQ' , 'leads') => __( 'Caribbean Netherlands ' , 'leads' ) ,
880
- __( 'KY' , 'leads') => __( 'Cayman Islands' , 'leads' ) ,
881
- __( 'CF' , 'leads') => __( 'Central African Republic' , 'leads' ) ,
882
- __( 'TD' , 'leads') => __( 'Chad' , 'leads' ) ,
883
- __( 'CL' , 'leads') => __( 'Chile' , 'leads' ) ,
884
- __( 'CN' , 'leads') => __( 'China' , 'leads' ) ,
885
- __( 'CX' , 'leads') => __( 'Christmas Island' , 'leads' ) ,
886
- __( 'CC' , 'leads') => __( 'Cocos (Keeling) Islands' , 'leads' ) ,
887
- __( 'CO' , 'leads') => __( 'Colombia' , 'leads' ) ,
888
- __( 'KM' , 'leads') => __( 'Comoros' , 'leads' ) ,
889
- __( 'CG' , 'leads') => __( 'Congo' , 'leads' ) ,
890
- __( 'CD' , 'leads') => __( 'Congo, Democratic Republic of' , 'leads' ) ,
891
- __( 'CK' , 'leads') => __( 'Cook Islands' , 'leads' ) ,
892
- __( 'CR' , 'leads') => __( 'Costa Rica' , 'leads' ) ,
893
- __( 'CI' , 'leads') => __( 'Cote d\'Ivoire' , 'leads' ) ,
894
- __( 'HR' , 'leads') => __( 'Croatia' , 'leads' ) ,
895
- __( 'CU' , 'leads') => __( 'Cuba' , 'leads' ) ,
896
- __( 'CW' , 'leads') => __( 'Curacao' , 'leads' ) ,
897
- __( 'CY' , 'leads') => __( 'Cyprus' , 'leads' ) ,
898
- __( 'CZ' , 'leads') => __( 'Czech Republic' , 'leads' ) ,
899
- __( 'DK' , 'leads') => __( 'Denmark' , 'leads' ) ,
900
- __( 'DJ' , 'leads') => __( 'Djibouti' , 'leads' ) ,
901
- __( 'DM' , 'leads') => __( 'Dominica' , 'leads' ) ,
902
- __( 'DO' , 'leads') => __( 'Dominican Republic' , 'leads' ) ,
903
- __( 'EC' , 'leads') => __( 'Ecuador' , 'leads' ) ,
904
- __( 'EG' , 'leads') => __( 'Egypt' , 'leads' ) ,
905
- __( 'SV' , 'leads') => __( 'El Salvador' , 'leads' ) ,
906
- __( 'GQ' , 'leads') => __( 'Equatorial Guinea' , 'leads' ) ,
907
- __( 'ER' , 'leads') => __( 'Eritrea' , 'leads' ) ,
908
- __( 'EE' , 'leads') => __( 'Estonia' , 'leads' ) ,
909
- __( 'ET' , 'leads') => __( 'Ethiopia' , 'leads' ) ,
910
- __( 'FK' , 'leads') => __( 'Falkland Islands' , 'leads' ) ,
911
- __( 'FO' , 'leads') => __( 'Faroe Islands' , 'leads' ) ,
912
- __( 'FJ' , 'leads') => __( 'Fiji' , 'leads' ) ,
913
- __( 'FI' , 'leads') => __( 'Finland' , 'leads' ) ,
914
- __( 'FR' , 'leads') => __( 'France' , 'leads' ) ,
915
- __( 'GF' , 'leads') => __( 'French Guiana' , 'leads' ) ,
916
- __( 'PF' , 'leads') => __( 'French Polynesia' , 'leads' ) ,
917
- __( 'TF' , 'leads') => __( 'French Southern Territories' , 'leads' ) ,
918
- __( 'GA' , 'leads') => __( 'Gabon' , 'leads' ) ,
919
- __( 'GM' , 'leads') => __( 'Gambia' , 'leads' ) ,
920
- __( 'GE' , 'leads') => __( 'Georgia' , 'leads' ) ,
921
- __( 'DE' , 'leads') => __( 'Germany' , 'leads' ) ,
922
- __( 'GH' , 'leads') => __( 'Ghana' , 'leads' ) ,
923
- __( 'GI' , 'leads') => __( 'Gibraltar' , 'leads' ) ,
924
- __( 'GR' , 'leads') => __( 'Greece' , 'leads' ) ,
925
- __( 'GL' , 'leads') => __( 'Greenland' , 'leads' ) ,
926
- __( 'GD' , 'leads') => __( 'Grenada' , 'leads' ) ,
927
- __( 'GP' , 'leads') => __( 'Guadeloupe' , 'leads' ) ,
928
- __( 'GU' , 'leads') => __( 'Guam' , 'leads' ) ,
929
- __( 'GT' , 'leads') => __( 'Guatemala' , 'leads' ) ,
930
- __( 'GG' , 'leads') => __( 'Guernsey' , 'leads' ) ,
931
- __( 'GN' , 'leads') => __( 'Guinea' , 'leads' ) ,
932
- __( 'GW' , 'leads') => __( 'Guinea-Bissau' , 'leads' ) ,
933
- __( 'GY' , 'leads') => __( 'Guyana' , 'leads' ) ,
934
- __( 'HT' , 'leads') => __( 'Haiti' , 'leads' ) ,
935
- __( 'HM' , 'leads') => __( 'Heard and McDonald Islands' , 'leads' ) ,
936
- __( 'HN' , 'leads') => __( 'Honduras' , 'leads' ) ,
937
- __( 'HK' , 'leads') => __( 'Hong Kong' , 'leads' ) ,
938
- __( 'HU' , 'leads') => __( 'Hungary' , 'leads' ) ,
939
- __( 'IS' , 'leads') => __( 'Iceland' , 'leads' ) ,
940
- __( 'IN' , 'leads') => __( 'India' , 'leads' ) ,
941
- __( 'ID' , 'leads') => __( 'Indonesia' , 'leads' ) ,
942
- __( 'IR' , 'leads') => __( 'Iran' , 'leads' ) ,
943
- __( 'IQ' , 'leads') => __( 'Iraq' , 'leads' ) ,
944
- __( 'IE' , 'leads') => __( 'Ireland' , 'leads' ) ,
945
- __( 'IM' , 'leads') => __( 'Isle of Man' , 'leads' ) ,
946
- __( 'IL' , 'leads') => __( 'Israel' , 'leads' ) ,
947
- __( 'IT' , 'leads') => __( 'Italy' , 'leads' ) ,
948
- __( 'JM' , 'leads') => __( 'Jamaica' , 'leads' ) ,
949
- __( 'JP' , 'leads') => __( 'Japan' , 'leads' ) ,
950
- __( 'JE' , 'leads') => __( 'Jersey' , 'leads' ) ,
951
- __( 'JO' , 'leads') => __( 'Jordan' , 'leads' ) ,
952
- __( 'KZ' , 'leads') => __( 'Kazakhstan' , 'leads' ) ,
953
- __( 'KE' , 'leads') => __( 'Kenya' , 'leads' ) ,
954
- __( 'KI' , 'leads') => __( 'Kiribati' , 'leads' ) ,
955
- __( 'KW' , 'leads') => __( 'Kuwait' , 'leads' ) ,
956
- __( 'KG' , 'leads') => __( 'Kyrgyzstan' , 'leads' ) ,
957
- __( 'LA' , 'leads') => __( 'Lao People\'s Democratic Republic' , 'leads' ) ,
958
- __( 'LV' , 'leads') => __( 'Latvia' , 'leads' ) ,
959
- __( 'LB' , 'leads') => __( 'Lebanon' , 'leads' ) ,
960
- __( 'LS' , 'leads') => __( 'Lesotho' , 'leads' ) ,
961
- __( 'LR' , 'leads') => __( 'Liberia' , 'leads' ) ,
962
- __( 'LY' , 'leads') => __( 'Libya' , 'leads' ) ,
963
- __( 'LI' , 'leads') => __( 'Liechtenstein' , 'leads' ) ,
964
- __( 'LT' , 'leads') => __( 'Lithuania' , 'leads' ) ,
965
- __( 'LU' , 'leads') => __( 'Luxembourg' , 'leads' ) ,
966
- __( 'MO' , 'leads') => __( 'Macau' , 'leads' ) ,
967
- __( 'MK' , 'leads') => __( 'Macedonia' , 'leads' ) ,
968
- __( 'MG' , 'leads') => __( 'Madagascar' , 'leads' ) ,
969
- __( 'MW' , 'leads') => __( 'Malawi' , 'leads' ) ,
970
- __( 'MY' , 'leads') => __( 'Malaysia' , 'leads' ) ,
971
- __( 'MV' , 'leads') => __( 'Maldives' , 'leads' ) ,
972
- __( 'ML' , 'leads') => __( 'Mali' , 'leads' ) ,
973
- __( 'MT' , 'leads') => __( 'Malta' , 'leads' ) ,
974
- __( 'MH' , 'leads') => __( 'Marshall Islands' , 'leads' ) ,
975
- __( 'MQ' , 'leads') => __( 'Martinique' , 'leads' ) ,
976
- __( 'MR' , 'leads') => __( 'Mauritania' , 'leads' ) ,
977
- __( 'MU' , 'leads') => __( 'Mauritius' , 'leads' ) ,
978
- __( 'YT' , 'leads') => __( 'Mayotte' , 'leads' ) ,
979
- __( 'MX' , 'leads') => __( 'Mexico' , 'leads' ) ,
980
- __( 'FM' , 'leads') => __( 'Micronesia, Federated States of' , 'leads' ) ,
981
- __( 'MD' , 'leads') => __( 'Moldova' , 'leads' ) ,
982
- __( 'MC' , 'leads') => __( 'Monaco' , 'leads' ) ,
983
- __( 'MN' , 'leads') => __( 'Mongolia' , 'leads' ) ,
984
- __( 'ME' , 'leads') => __( 'Montenegro' , 'leads' ) ,
985
- __( 'MS' , 'leads') => __( 'Montserrat' , 'leads' ) ,
986
- __( 'MA' , 'leads') => __( 'Morocco' , 'leads' ) ,
987
- __( 'MZ' , 'leads') => __( 'Mozambique' , 'leads' ) ,
988
- __( 'MM' , 'leads') => __( 'Myanmar' , 'leads' ) ,
989
- __( 'NA' , 'leads') => __( 'Namibia' , 'leads' ) ,
990
- __( 'NR' , 'leads') => __( 'Nauru' , 'leads' ) ,
991
- __( 'NP' , 'leads') => __( 'Nepal' , 'leads' ) ,
992
- __( 'NC' , 'leads') => __( 'New Caledonia' , 'leads' ) ,
993
- __( 'NZ' , 'leads') => __( 'New Zealand' , 'leads' ) ,
994
- __( 'NI' , 'leads') => __( 'Nicaragua' , 'leads' ) ,
995
- __( 'NE' , 'leads') => __( 'Niger' , 'leads' ) ,
996
- __( 'NG' , 'leads') => __( 'Nigeria' , 'leads' ) ,
997
- __( 'NU' , 'leads') => __( 'Niue' , 'leads' ) ,
998
- __( 'NF' , 'leads') => __( 'Norfolk Island' , 'leads' ) ,
999
- __( 'KP' , 'leads') => __( 'North Korea' , 'leads' ) ,
1000
- __( 'MP' , 'leads') => __( 'Northern Mariana Islands' , 'leads' ) ,
1001
- __( 'NO' , 'leads') => __( 'Norway' , 'leads' ) ,
1002
- __( 'OM' , 'leads') => __( 'Oman' , 'leads' ) ,
1003
- __( 'PK' , 'leads') => __( 'Pakistan' , 'leads' ) ,
1004
- __( 'PW' , 'leads') => __( 'Palau' , 'leads' ) ,
1005
- __( 'PS' , 'leads') => __( 'Palestinian Territory, Occupied' , 'leads' ) ,
1006
- __( 'PA' , 'leads') => __( 'Panama' , 'leads' ) ,
1007
- __( 'PG' , 'leads') => __( 'Papua New Guinea' , 'leads' ) ,
1008
- __( 'PY' , 'leads') => __( 'Paraguay' , 'leads' ) ,
1009
- __( 'PE' , 'leads') => __( 'Peru' , 'leads' ) ,
1010
- __( 'PH' , 'leads') => __( 'Philippines' , 'leads' ) ,
1011
- __( 'PN' , 'leads') => __( 'Pitcairn' , 'leads' ) ,
1012
- __( 'PL' , 'leads') => __( 'Poland' , 'leads' ) ,
1013
- __( 'PT' , 'leads') => __( 'Portugal' , 'leads' ) ,
1014
- __( 'PR' , 'leads') => __( 'Puerto Rico' , 'leads' ) ,
1015
- __( 'QA' , 'leads') => __( 'Qatar' , 'leads' ) ,
1016
- __( 'RE' , 'leads') => __( 'Reunion' , 'leads' ) ,
1017
- __( 'RO' , 'leads') => __( 'Romania' , 'leads' ) ,
1018
- __( 'RU' , 'leads') => __( 'Russian Federation' , 'leads' ) ,
1019
- __( 'RW' , 'leads') => __( 'Rwanda' , 'leads' ) ,
1020
- __( 'BL' , 'leads') => __( 'Saint Barthelemy' , 'leads' ) ,
1021
- __( 'SH' , 'leads') => __( 'Saint Helena' , 'leads' ) ,
1022
- __( 'KN' , 'leads') => __( 'Saint Kitts and Nevis' , 'leads' ) ,
1023
- __( 'LC' , 'leads') => __( 'Saint Lucia' , 'leads' ) ,
1024
- __( 'VC' , 'leads') => __( 'Saint Vincent and the Grenadines' , 'leads' ) ,
1025
- __( 'MF' , 'leads') => __( 'Saint-Martin (France)' , 'leads' ) ,
1026
- __( 'SX' , 'leads') => __( 'Saint-Martin (Pays-Bas)' , 'leads' ) ,
1027
- __( 'WS' , 'leads') => __( 'Samoa' , 'leads' ) ,
1028
- __( 'SM' , 'leads') => __( 'San Marino' , 'leads' ) ,
1029
- __( 'ST' , 'leads') => __( 'Sao Tome and Principe' , 'leads' ) ,
1030
- __( 'SA' , 'leads') => __( 'Saudi Arabia' , 'leads' ) ,
1031
- __( 'SN' , 'leads') => __( 'Senegal' , 'leads' ) ,
1032
- __( 'RS' , 'leads') => __( 'Serbia' , 'leads' ) ,
1033
- __( 'SC' , 'leads') => __( 'Seychelles' , 'leads' ) ,
1034
- __( 'SL' , 'leads') => __( 'Sierra Leone' , 'leads' ) ,
1035
- __( 'SG' , 'leads') => __( 'Singapore' , 'leads' ) ,
1036
- __( 'SK' , 'leads') => __( 'Slovakia (Slovak Republic)' , 'leads' ) ,
1037
- __( 'SI' , 'leads') => __( 'Slovenia' , 'leads' ) ,
1038
- __( 'SB' , 'leads') => __( 'Solomon Islands' , 'leads' ) ,
1039
- __( 'SO' , 'leads') => __( 'Somalia' , 'leads' ) ,
1040
- __( 'ZA' , 'leads') => __( 'South Africa' , 'leads' ) ,
1041
- __( 'GS' , 'leads') => __( 'South Georgia and the South Sandwich Islands' , 'leads' ) ,
1042
- __( 'KR' , 'leads') => __( 'South Korea' , 'leads' ) ,
1043
- __( 'SS' , 'leads') => __( 'South Sudan' , 'leads' ) ,
1044
- __( 'ES' , 'leads') => __( 'Spain' , 'leads' ) ,
1045
- __( 'LK' , 'leads') => __( 'Sri Lanka' , 'leads' ) ,
1046
- __( 'PM' , 'leads') => __( 'St. Pierre and Miquelon' , 'leads' ) ,
1047
- __( 'SD' , 'leads') => __( 'Sudan' , 'leads' ) ,
1048
- __( 'SR' , 'leads') => __( 'Suriname' , 'leads' ) ,
1049
- __( 'SJ' , 'leads') => __( 'Svalbard and Jan Mayen Islands' , 'leads' ) ,
1050
- __( 'SZ' , 'leads') => __( 'Swaziland' , 'leads' ) ,
1051
- __( 'SE' , 'leads') => __( 'Sweden' , 'leads' ) ,
1052
- __( 'CH' , 'leads') => __( 'Switzerland' , 'leads' ) ,
1053
- __( 'SY' , 'leads') => __( 'Syria' , 'leads' ) ,
1054
- __( 'TW' , 'leads') => __( 'Taiwan' , 'leads' ) ,
1055
- __( 'TJ' , 'leads') => __( 'Tajikistan' , 'leads' ) ,
1056
- __( 'TZ' , 'leads') => __( 'Tanzania' , 'leads' ) ,
1057
- __( 'TH' , 'leads') => __( 'Thailand' , 'leads' ) ,
1058
- __( 'NL' , 'leads') => __( 'The Netherlands' , 'leads' ) ,
1059
- __( 'TL' , 'leads') => __( 'Timor-Leste' , 'leads' ) ,
1060
- __( 'TG' , 'leads') => __( 'Togo' , 'leads' ) ,
1061
- __( 'TK' , 'leads') => __( 'Tokelau' , 'leads' ) ,
1062
- __( 'TO' , 'leads') => __( 'Tonga' , 'leads' ) ,
1063
- __( 'TT' , 'leads') => __( 'Trinidad and Tobago' , 'leads' ) ,
1064
- __( 'TN' , 'leads') => __( 'Tunisia' , 'leads' ) ,
1065
- __( 'TR' , 'leads') => __( 'Turkey' , 'leads' ) ,
1066
- __( 'TM' , 'leads') => __( 'Turkmenistan' , 'leads' ) ,
1067
- __( 'TC' , 'leads') => __( 'Turks and Caicos Islands' , 'leads' ) ,
1068
- __( 'TV' , 'leads') => __( 'Tuvalu' , 'leads' ) ,
1069
- __( 'UG' , 'leads') => __( 'Uganda' , 'leads' ) ,
1070
- __( 'UA' , 'leads') => __( 'Ukraine' , 'leads' ) ,
1071
- __( 'AE' , 'leads') => __( 'United Arab Emirates' , 'leads' ) ,
1072
- __( 'GB' , 'leads') => __( 'United Kingdom' , 'leads' ) ,
1073
- __( 'US' , 'leads') => __( 'United States' , 'leads' ) ,
1074
- __( 'UM' , 'leads') => __( 'United States Minor Outlying Islands' , 'leads' ) ,
1075
- __( 'UY' , 'leads') => __( 'Uruguay' , 'leads' ) ,
1076
- __( 'UZ' , 'leads') => __( 'Uzbekistan' , 'leads' ) ,
1077
- __( 'VU' , 'leads') => __( 'Vanuatu' , 'leads' ) ,
1078
- __( 'VA' , 'leads') => __( 'Vatican' , 'leads' ) ,
1079
- __( 'VE' , 'leads') => __( 'Venezuela' , 'leads' ) ,
1080
- __( 'VN' , 'leads') => __( 'Vietnam' , 'leads' ) ,
1081
- __( 'VG' , 'leads') => __( 'Virgin Islands (British)' , 'leads' ) ,
1082
- __( 'VI' , 'leads') => __( 'Virgin Islands (U.S.)' , 'leads' ) ,
1083
- __( 'WF' , 'leads') => __( 'Wallis and Futuna Islands' , 'leads' ) ,
1084
- __( 'EH' , 'leads') => __( 'Western Sahara' , 'leads' ) ,
1085
- __( 'YE' , 'leads') => __( 'Yemen' , 'leads' ) ,
1086
- __( 'ZM' , 'leads') => __( 'Zambia' , 'leads' ) ,
1087
- __( 'ZW' , 'leads') => __( 'Zimbabwe' , 'leads' )
1088
- );
1089
- }
1090
-
1091
- }
1092
- }
1093
 
1094
- Inbound_Forms::init();
1095
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
28
+ global $post;
29
+
30
+ self::$add_script = true;
31
+
32
+ $email = get_option('admin_email');
33
+
34
+ extract(shortcode_atts(array(
35
+ 'id' => '',
36
+ 'name' => '',
37
+ 'layout' => '',
38
+ 'notify' => $email,
39
+ 'notify_subject' => '{{site-name}} {{form-name}} - New Lead Conversion',
40
+ 'labels' => '',
41
+ 'font_size' => '', // set default from CSS
42
+ 'width' => '',
43
+ 'redirect' => '',
44
+ 'icon' => '',
45
+ 'lists' => '',
46
+ 'submit' => 'Submit',
47
+ 'submit_colors' => '',
48
+ 'submit_text_color' => '',
49
+ 'submit_bg_color' => ''
50
+ ), $atts));
51
+
52
+
53
+ if ( !$id && isset($_GET['post']) ) {
54
+ $id = $_GET['post'];
55
+ }
56
 
 
57
 
58
+ $form_name = $name;
59
+ //$form_name = strtolower(str_replace(array(' ','_', '"', "'"),'-',$form_name));
60
+ $form_layout = $layout;
61
+ $form_labels = $labels;
62
+ $form_labels_class = (isset($form_labels)) ? "inbound-label-".$form_labels : 'inbound-label-inline';
63
+ $submit_button = ($submit != "") ? $submit : 'Submit';
64
+ $icon_insert = ($icon != "" && $icon != 'none') ? '<i class="fa-'. $icon . '" font-awesome fa"></i>' : '';
 
 
 
65
 
66
+ // Set submit button colors
67
+ if(isset($submit_colors) && $submit_colors === 'on'){
68
+ $submit_bg = " background:" . $submit_bg_color . "; border: 5px solid ".$submit_bg_color."; border-radius: 3px;";
69
+ $submit_color = " color:" . $submit_text_color . ";";
70
 
71
+ } else {
72
+ $submit_bg = "";
73
+ $submit_color = "";
74
+ }
75
 
76
+ if (preg_match("/px/", $font_size)){
77
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
78
+ } else if (preg_match("/%/", $font_size)) {
79
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
80
+ } else if (preg_match("/em/", $font_size)) {
81
+ $font_size = (isset($font_size)) ? " font-size: $font_size;" : '';
82
+ } else if ($font_size == "") {
83
+ $font_size = '';
84
+ } else {
85
+ $font_size = (isset($font_size)) ? " font-size:" . $font_size . "px;" : '';
86
+ }
87
 
88
+ // Check for image in submit button option
89
+ if (preg_match('/\.(jpg|jpeg|png|gif)(?:[\?\#].*)?$/i',$submit_button)) {
90
+ $image_button = ' color: rgba(0, 0, 0, 0);border: none;box-shadow: none;background: transparent; border-radius:0px;padding: 0px;';
91
+ $inner_button = "<img src='$submit_button' width='100%'>";
92
+ $icon_insert = '';
93
+ $submit_button = '';
94
+ } else {
95
+ $image_button = '';
96
+ $inner_button = '';
97
 
 
 
98
  }
 
 
 
 
 
99
 
100
+ /* Sanitize width input */
101
+ if (preg_match('/px/i',$width)) {
102
+ $fixed_width = str_replace("px", "", $width);
103
+ $width_output = "width:" . $fixed_width . "px;";
104
+ } elseif (preg_match('/%/i',$width)) {
105
+ $fixed_width_perc = str_replace("%", "", $width);
106
+ $width_output = "width:" . $fixed_width_perc . "%;";
107
+ } else {
108
+ $width_output = "width:" . $width . "px;";
109
+ }
110
 
111
+ $form_width = ($width != "") ? $width_output : '';
112
 
113
+ //if (!preg_match_all("/(.?)\[(inbound_field)\b(.*?)(?:(\/))?\](?:(.+?)\[\/inbound_field\])?(.?)/s", $content, $matches)) {
114
+ if (!preg_match_all('/(.?)\[(inbound_field)(.*?)\]/s',$content, $matches)) {
115
 
116
+ return '';
 
 
117
 
118
+ } else {
119
 
120
+ for($i = 0; $i < count($matches[0]); $i++) {
121
+ $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
 
 
 
 
122
  }
123
+ //print_r($matches[3]);
124
+ // matches are $matches[3][$i]['label']
125
+ $clean_form_id = preg_replace("/[^A-Za-z0-9 ]/", '', trim($name));
126
+ $form_id = strtolower(str_replace(array(' ','_'),'-',$clean_form_id));
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
+ $form = '<div id="inbound-form-wrapper" class="">';
130
+ $form .= '<form class="inbound-now-form wpl-track-me inbound-track" method="post" id="'.$form_id.'" action="" style="'.$form_width.'">';
131
+ $main_layout = ($form_layout != "") ? 'inbound-'.$form_layout : 'inbound-normal';
132
+ for($i = 0; $i < count($matches[0]); $i++)
133
+ {
134
 
135
+ $label = (isset($matches[3][$i]['label'])) ? $matches[3][$i]['label'] : '';
 
136
 
 
 
137
 
138
+ $clean_label = preg_replace("/[^A-Za-z0-9 ]/", '', trim($label));
139
+ $formatted_label = strtolower(str_replace(array(' ','_'),'-',$clean_label));
140
+ $field_placeholder = (isset($matches[3][$i]['placeholder'])) ? $matches[3][$i]['placeholder'] : '';
141
 
142
+ $placeholder_use = ($field_placeholder != "") ? $field_placeholder : $label;
 
143
 
144
+ if ($field_placeholder != "") {
145
+ $form_placeholder = "placeholder='".$placeholder_use."'";
146
+ } else if (isset($form_labels) && $form_labels === "placeholder") {
147
+ $form_placeholder = "placeholder='".$placeholder_use."'";
148
+ } else {
149
+ $form_placeholder = "";
150
+ }
151
 
152
+ $description_block = (isset($matches[3][$i]['description'])) ? $matches[3][$i]['description'] : '';
153
+ $field_container_class = (isset($matches[3][$i]['field_container_class'])) ? $matches[3][$i]['field_container_class'] : '';
154
+ $field_input_class = (isset($matches[3][$i]['field_input_class'])) ? $matches[3][$i]['field_input_class'] : '';
155
+ $required = (isset($matches[3][$i]['required'])) ? $matches[3][$i]['required'] : '0';
156
+ $req = ($required === '1') ? 'required' : '';
157
+ $exclude_tracking = (isset($matches[3][$i]['exclude_tracking'])) ? $matches[3][$i]['exclude_tracking'] : '0';
158
+ $et_output = ($exclude_tracking === '1') ? ' data-ignore-form-field="true"' : '';
159
+ $req_label = ($required === '1') ? '<span class="inbound-required">*</span>' : '';
160
+ $map_field = (isset($matches[3][$i]['map_to'])) ? $matches[3][$i]['map_to'] : '';
161
+ if ($map_field != "") {
162
+ $field_name = $map_field;
163
+ } else {
164
+ $label = self::santize_inputs($label);
165
+ $field_name = strtolower(str_replace(array(' ','_'),'-',$label));
166
+ }
167
 
168
+ $data_mapping_attr = ($map_field != "") ? ' data-map-form-field="'.$map_field.'" ' : '';
 
 
169
 
170
+ /* Map Common Fields */
171
+ (preg_match( '/Email|e-mail|email/i', $label, $email_input)) ? $email_input = " inbound-email" : $email_input = "";
172
 
173
+ // Match Phone
174
+ (preg_match( '/Phone|phone number|telephone/i', $label, $phone_input)) ? $phone_input = " inbound-phone" : $phone_input = "";
 
175
 
176
+ // match name or first name. (minus: name=, last name, last_name,)
177
+ (preg_match( '/(?<!((last |last_)))name(?!\=)/im', $label, $first_name_input)) ? $first_name_input = " inbound-first-name" : $first_name_input = "";
178
 
179
+ // Match Last Name
180
+ (preg_match( '/(?<!((first)))(last name|last_name|last)(?!\=)/im', $label, $last_name_input)) ? $last_name_input = " inbound-last-name" : $last_name_input = "";
181
 
182
+ $input_classes = $email_input . $first_name_input . $last_name_input . $phone_input;
 
 
183
 
184
+ $type = (isset($matches[3][$i]['type'])) ? $matches[3][$i]['type'] : '';
185
+ $show_labels = true;
186
 
187
+ if ($type === "hidden" || $type === "honeypot" || $type === "html-block" || $type === "divider") {
188
+ $show_labels = false;
189
  }
190
 
191
+ $form .= '<div class="inbound-field '.$main_layout.' label-'.$form_labels_class.' '.$form_labels_class.' '.$field_container_class.'">';
192
+
193
+ if ($show_labels && $form_labels != "bottom" || $type === "radio") {
194
+ $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>';
195
  }
 
196
 
197
+ if ($type === 'textarea') {
198
+ $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>';
199
+
200
+ } else if ($type === 'dropdown') {
201
+
202
+ $dropdown_fields = array();
203
+ $dropdown = $matches[3][$i]['dropdown'];
204
+ $dropdown_fields = explode(",", $dropdown);
205
 
206
+ $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'"'.$data_mapping_attr.$et_output.' '.$req.'>';
207
+
208
+ if ($placeholder_use) {
209
+ $form .= '<option value="" disabled selected>'.str_replace( '%3F' , '?' , $placeholder_use).'</option>';
210
+ }
211
+
212
+ foreach ($dropdown_fields as $key => $value) {
213
+ //$drop_val_trimmed = trim($value);
214
+ //$dropdown_val = strtolower(str_replace(array(' ','_'),'-',$drop_val_trimmed));
215
+ $form .= '<option value="'. trim(str_replace('"', '\"' , $value)) .'">'. $value .'</option>';
216
+ }
217
+ $form .= '</select>';
218
 
219
+ } else if ($type === 'dropdown_countries') {
220
+
221
+ $dropdown_fields = self::get_countries_array();
222
+
223
+ $form .= '<select name="'. $field_name .'" class="'.$field_input_class.'" '.$req.'>';
224
+
225
+ if ($field_placeholder) {
226
+ $form .= '<option value="" disabled selected>'.$field_placeholder.'</option>';
227
+ }
228
+
229
+ foreach ($dropdown_fields as $key => $value) {
230
+ $form .= '<option value="'.$key.'">'. utf8_encode($value) .'</option>';
231
+ }
232
+ $form .= '</select>';
233
+
234
+ } else if ($type === 'date-selector') {
235
+
236
+ $m = date('m');
237
+ $d = date('d');
238
+ $y = date('Y');
239
+
240
+ $months = self::get_date_selectons('months');
241
+ $days = self::get_date_selectons('days');
242
+ $years = self::get_date_selectons('years');
243
+
244
+ $form .= '<div class="dateSelector">';
245
+ $form .= ' <select id="formletMonth" name="'. $field_name .'[month]" >';
246
+ foreach ($months as $key => $value) {
247
+ ( $m == $key ) ? $sel = 'selected="selected"' : $sel = '';
248
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
249
+ }
250
+ $form .= ' </select>';
251
+ $form .= ' <select id="formletDays" name="'. $field_name .'[day]" >';
252
+ foreach ($days as $key => $value) {
253
+ ( $d == $key ) ? $sel = 'selected="selected"' : $sel = '';
254
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
255
+ }
256
+ $form .= ' </select>';
257
+ $form .= ' <select id="formletYears" name="'. $field_name .'[year]" >';
258
+ foreach ($years as $key => $value) {
259
+ ( $y == $key ) ? $sel = 'selected="selected"' : $sel = '';
260
+ $form .= '<option value="'.$key.'" '.$sel.'>'.$value.'</option>';
261
+ }
262
+ $form .= ' </select>';
263
+ $form .= '</div>';
264
+
265
+ } else if ($type === 'radio') {
266
+
267
+ $radio_fields = array();
268
+ $radio = $matches[3][$i]['radio'];
269
+ $radio_fields = explode(",", $radio);
270
+ // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
271
+
272
+ foreach ($radio_fields as $key => $value) {
273
+ $radio_val_trimmed = trim($value);
274
+ $radio_val = strtolower(str_replace(array(' ','_'),'-',$radio_val_trimmed));
275
+ $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>';
276
+ }
277
+
278
+ } else if ($type === 'checkbox') {
279
+
280
+ $checkbox_fields = array();
281
+
282
+ $checkbox = $matches[3][$i]['checkbox'];
283
+ $checkbox_fields = explode(",", $checkbox);
284
+ // $clean_radio = str_replace(array(' ','_'),'-',$value) // clean leading spaces. finish
285
+ foreach ($checkbox_fields as $key => $value) {
286
+ $value = html_entity_decode($value);
287
+ $checkbox_val_trimmed = strip_tags(trim($value));
288
+ $checkbox_val = strtolower(str_replace(array(' ','_'),'-',$checkbox_val_trimmed));
289
+
290
+
291
+ $required_id = ( $key == 0 ) ? $req : '';
292
+
293
+ $form .= '<input class="checkbox-'.$main_layout.' checkbox-'.$form_labels_class.' '.$field_input_class.'" type="checkbox" name="'. $field_name .'[]" value="'. $checkbox_val .'" '.$required_id.'>'.$checkbox_val_trimmed.'<br>';
294
+ }
295
+ } else if ($type === 'html-block') {
296
+
297
+ $html = $matches[3][$i]['html'];
298
+ //echo $html;
299
+ $form .= "<div class={$field_input_class}>";
300
+ $form .= do_shortcode(html_entity_decode($html));
301
+ $form .= "</div>";
302
+
303
+ } else if ($type === 'divider') {
304
+
305
+ $divider = $matches[3][$i]['divider_options'];
306
+ //echo $html;
307
+ $form .= "<div class='inbound-form-divider {$field_input_class}'>" . $divider . "<hr></div>";
308
+
309
+ } else if ($type === 'editor') {
310
+ //wp_editor(); // call wp editor
311
+ } else if ($type === 'honeypot') {
312
+
313
+ $form .= '<input type="hidden" name="stop_dirty_subs" class="stop_dirty_subs" value="">';
314
+
315
+ } else {
316
+ $hidden_param = (isset($matches[3][$i]['dynamic'])) ? $matches[3][$i]['dynamic'] : '';
317
+ $fill_value = (isset($matches[3][$i]['default'])) ? $matches[3][$i]['default'] : '';
318
+ $dynamic_value = (isset($_GET[$hidden_param])) ? $_GET[$hidden_param] : '';
319
+ if ($type === 'hidden' && $dynamic_value != "") {
320
+ $fill_value = $dynamic_value;
321
+ }
322
+ $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.'/>';
323
+ }
324
 
325
+ if ($show_labels && $form_labels === "bottom" && $type != "radio") {
326
+ $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>';
327
  }
328
 
329
+ if ($description_block != "" && $type != 'hidden'){
330
+ $form .= "<div class='inbound-description'>".$description_block."</div>";
331
  }
 
332
 
333
+ $form .= '</div>';
334
+ }
335
+ // End Loop
336
 
337
+ $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
338
+ $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.'">
339
+ '.$icon_insert.''.$submit_button.$inner_button.'</button></div><input data-ignore-form-field="true" type="hidden" name="inbound_submitted" value="1">';
340
+ // <!--<input type="submit" '.$submit_button_type.' class="button" value="'.$submit_button.'" name="send" id="inbound_form_submit" />-->
341
 
342
+ $form .= '<input type="hidden" name="inbound_form_name" class="inbound_form_name" 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>';
343
+ $form .= "<style type='text/css'>.inbound-button-submit{ {$font_size} }</style>";
344
+ $form = preg_replace('/<br class="inbr".\/>/', '', $form); // remove editor br tags
345
 
346
+ return $form;
347
+ }
348
+ }
349
+ static function santize_inputs($content){
350
+ // Strip HTML Tags
351
+ $clear = strip_tags($content);
352
+ // Clean up things like &amp;
353
+ $clear = html_entity_decode($clear);
354
+ // Strip out any url-encoded stuff
355
+ $clear = urldecode($clear);
356
+ // Replace non-AlNum characters with space
357
+ $clear = preg_replace('/[^A-Za-z0-9]/', ' ', $clear);
358
+ // Replace Multiple spaces with single space
359
+ $clear = preg_replace('/ +/', ' ', $clear);
360
+ // Trim the string of leading/trailing space
361
+ $clear = trim($clear);
362
+ return $clear;
363
+ }
364
+ /* Create shorter shortcode for [inbound_forms] */
365
+ static function inbound_short_form_create( $atts, $content = null )
366
+ {
367
+ extract(shortcode_atts(array(
368
+ 'id' => '',
369
+ ), $atts));
370
+
371
+ $shortcode = get_post_meta( $id, 'inbound_shortcode', TRUE );
372
+
373
+ // If form id missing add it
374
+ if (!preg_match('/id="/', $shortcode)) {
375
+ $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $id . "\"", $shortcode);
376
+ }
377
+ if ($id === 'default_3'){
378
+ $shortcode = '[inbound_form name="Form Name" layout="vertical" labels="top" submit="Submit" ][inbound_field label="Email" type="text" required="1" ][/inbound_form]';
379
+ }
380
+ if ($id === 'default_1'){
381
+ $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]';
382
+ }
383
+ if ($id === 'default_2'){
384
+ $shortcode = '[inbound_form name="Standard Company Form" layout="vertical" labels="top" submit="Submit" ]
385
 
386
+ [inbound_field label="First Name" type="text" required="0" placeholder="Enter Your First Name" ]
387
 
388
+ [inbound_field label="Last Name" type="text" required="0" placeholder="Enter Your Last Name" ]
 
 
 
389
 
390
+ [inbound_field label="Email" type="text" required="1" placeholder="Enter Your Email Address" ]
 
 
 
 
391
 
392
+ [inbound_field label="Company Name" type="text" required="0" placeholder="Enter Your Company Name" ]
393
 
394
+ [inbound_field label="Job Title" type="text" required="0" placeholder="Enter Your Job Title" ]
395
 
396
+ [/inbound_form]';
397
+ }
398
+ if (empty($shortcode)) {
399
+ $shortcode = "Form ID: " . $id . " Not Found";
400
+ }
401
+ if ($id === 'none'){
402
+ $shortcode = "";
403
+ }
404
 
405
+ return do_shortcode( $shortcode );
406
+ }
407
 
408
+ /* Enqueue JS & CSS */
409
+ static function register_script() {
410
+ wp_enqueue_style( 'inbound-shortcodes' );
411
+ }
412
 
413
+ // only call enqueue once
414
+ static function print_script() {
415
+ if ( ! self::$add_script )
416
+ return;
417
+ wp_enqueue_style( 'inbound-shortcodes' );
418
+ }
419
 
420
+ // move to file
421
+ static function inline_my_script() {
422
+ if ( ! self::$add_script )
423
+ return;
 
424
 
425
+ echo '<script type="text/javascript">
426
 
427
+ jQuery(document).ready(function($){
 
 
428
 
429
+ jQuery("form").submit(function(e) {
430
+ jQuery(this).find("input").each(function(){
431
+ if(!jQuery(this).prop("required")){
432
+ } else if (!jQuery(this).val()) {
433
+ alert("Oops! Looks like you have not filled out all of the required fields!");
434
+ e.preventDefault();
435
+ e.stopImmediatePropagation();
436
+ return false;
437
+ }
438
+ });
439
+ });
440
 
441
+ jQuery("#inbound_form_submit br").remove(); // remove br tags
442
+ function validateEmail(email) {
443
 
444
+ 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,}))$/;
445
+ return re.test(email);
 
 
 
 
 
 
446
  }
447
+ var parent_redirect = parent.window.location.href;
448
+ jQuery("#inbound_parent_page").val(parent_redirect);
449
+
450
+
451
+ // validate email
452
+ $("input.inbound-email").on("change keyup", function (e) {
453
+ var email = $(this).val();
454
+ $(".email_suggestion").remove();
455
+ if (validateEmail(email)) {
456
+ $(this).css("color", "green");
457
+ $(this).addClass("valid-email");
458
+ $(this).removeClass("invalid-email");
459
+ } else {
460
+ $(this).css("color", "red");
461
+ $(this).addClass("invalid-email");
462
+ $(this).removeClass("valid-email");
463
+ }
464
+ if($(this).hasClass("valid-email")) {
465
+ $(this).parent().parent().find("#inbound_form_submit").removeAttr("disabled");
466
+ }
467
+ });
468
 
469
+ });
470
+ </script>';
471
+
472
+ echo "<style type='text/css'>
473
+ /* Add button style options http://medleyweb.com/freebies/50-super-sleek-css-button-style-snippets/ */
474
+ .email_suggestion {
475
+ font-size: 13px;
476
+ padding-top: 0px;
477
+ margin-top: 0px;
478
+ display: block;
479
+ font-style: italic;
480
+ }
481
+ input.invalid-email {-webkit-box-shadow: 0 0 6px #F8B9B7;
482
+ -moz-box-shadow: 0 0 6px #f8b9b7;
483
+ box-shadow: 0 0 6px #F8B9B7;
484
+ color: #B94A48;
485
+ border-color: #E9322D;}
486
+ input.valid-email {-webkit-box-shadow: 0 0 6px #B7F8BA;
487
+ -moz-box-shadow: 0 0 6px #f8b9b7;
488
+ box-shadow: 0 0 6px #98D398;
489
+ color: #008000;
490
+ border-color: #008000;}
491
+ </style>";
492
+ }
493
 
494
+ public static function replace_tokens( $content , $form_data = null , $form_meta_data = null ) {
 
 
495
 
496
+ /* replace core tokens */
497
+ $content = str_replace('{{site-name}}', get_bloginfo( 'name' ) , $content);
498
+ //$content = str_replace('{{form-name}}', $form_data['inbound_form_name'] , $content);
499
 
500
+ foreach ($form_data as $key => $value) {
501
+ $token_key = str_replace('_','-', $key);
502
+ $token_key = str_replace('inbound-','', $token_key);
 
503
 
504
+ $content = str_replace( '{{'.trim($token_key).'}}' , $value , $content );
505
+ }
 
506
 
507
+ return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  }
509
+ // Save Form Conversion to Form CPT
510
+ static function store_form_stats($form_id, $email) {
511
+
512
+ //$time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
513
+ // $wordpress_date_time = date("Y-m-d G:i:s", $time);
514
+ $form_conversion_num = get_post_meta($form_id, 'inbound_form_conversion_count', true);
515
+ $form_conversion_num++;
516
+ update_post_meta( $form_id, 'inbound_form_conversion_count', $form_conversion_num );
517
+
518
+ // Add Lead Email to Conversions List
519
+ $lead_conversion_list = get_post_meta( $form_id, 'lead_conversion_list', TRUE );
520
+ $lead_conversion_list = json_decode($lead_conversion_list,true);
521
+ if (is_array($lead_conversion_list)) {
522
+ $lead_count = count($lead_conversion_list);
523
+ $lead_conversion_list[$lead_count]['email'] = $email;
524
+ // $lead_conversion_list[$lead_count]['date'] = $wordpress_date_time;
525
+ $lead_conversion_list = json_encode($lead_conversion_list);
526
+ update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
527
+ } else {
528
+ $lead_conversion_list = array();
529
+ $lead_conversion_list[0]['email'] = $email;
530
+ // $lead_conversion_list[0]['date'] = $wordpress_date_time;
531
+ $lead_conversion_list = json_encode($lead_conversion_list);
532
+ update_post_meta( $form_id, 'lead_conversion_list', $lead_conversion_list );
533
+ }
534
+
535
  }
536
+ /* Perform Actions After a Form Submit */
537
+ static function do_actions(){
538
 
539
+ if(isset($_POST['inbound_submitted']) && $_POST['inbound_submitted'] === '1') {
540
+ $form_post_data = array();
541
+ if(isset($_POST['stop_dirty_subs']) && $_POST['stop_dirty_subs'] != "") {
542
+ wp_die( $message = 'Die You spam bastard' );
543
+ return false;
544
+ }
545
+ /* get form submitted form's meta data */
546
+ $form_meta_data = get_post_meta( $_POST['inbound_form_id'] );
547
 
548
+ if(isset($_POST['inbound_furl']) && $_POST['inbound_furl'] != "") {
549
+ $redirect = base64_decode($_POST['inbound_furl']);
550
+ } else if (isset($_POST['inbound_current_page_url'])) {
551
+ $redirect = $_POST['inbound_current_page_url'];
552
+ }
553
 
 
554
 
 
555
 
556
+ //print_r($_POST);
557
+ foreach ( $_POST as $field => $value ) {
558
 
559
+ if ( get_magic_quotes_gpc() && is_string($value) ) {
560
+ $value = stripslashes( $value );
561
+ }
 
 
 
 
 
562
 
563
+ $field = strtolower($field);
 
564
 
565
+ if (preg_match( '/Email|e-mail|email/i', $field)) {
566
+ $field = "wpleads_email_address";
567
+ if(isset($_POST['inbound_form_id']) && $_POST['inbound_form_id'] != "") {
568
+ self::store_form_stats($_POST['inbound_form_id'], $value);
569
+ }
570
+ }
571
 
 
 
 
 
 
 
572
 
573
+ $form_post_data[$field] = (!is_array($value)) ? strip_tags( $value ) : $value;
 
 
 
574
 
575
+ }
576
 
577
+ $form_meta_data['post_id'] = $_POST['inbound_form_id']; // pass in form id
578
 
579
+ /* Send emails if passes spam check returns false */
580
+ if ( !apply_filters( 'inbound_check_if_spam' , false , $form_post_data ) ) {
581
+ self::send_conversion_admin_notification($form_post_data , $form_meta_data);
582
+ self::send_conversion_lead_notification($form_post_data , $form_meta_data);
583
+ }
 
 
 
 
 
 
584
 
585
+ /* hook runs after form actions are completed and before page redirect */
586
+ do_action('inboundnow_form_submit_actions', $form_post_data, $form_meta_data);
587
 
588
+ /* redirect now */
589
+ if ($redirect != "") {
590
+ wp_redirect( $redirect );
591
+ exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  }
595
 
596
+ }
 
 
597
 
598
+ /* Sends Notification of New Lead Conversion to Admin & Others Listed on the Form Notification List */
599
+ public static function send_conversion_admin_notification( $form_post_data , $form_meta_data ) {
 
 
 
 
 
 
600
 
601
+ if ( $template = self::get_new_lead_email_template()) {
 
 
 
 
602
 
603
+ add_filter( 'wp_mail_content_type', 'inbound_set_html_content_type' );
604
+ function inbound_set_html_content_type() {
605
+ return 'text/html';
606
+ }
607
 
608
+ /* Rebuild Form Meta Data to Load Single Values */
609
+ foreach( $form_meta_data as $key => $value ) {
610
+ if ( isset($value[0]) ) {
611
+ $form_meta_data[$key] = $value[0];
612
+ }
613
+ }
614
 
615
+ /* If there's no notification email in place then bail */
616
+ if ( !isset($form_meta_data['inbound_notify_email']) ) {
617
+ return;
618
+ }
619
+
620
+ /* Get Email We Should Send Notifications To */
621
+ $email_to = $form_meta_data['inbound_notify_email'];
622
 
623
+ /* Check for Multiple Email Addresses */
624
+ $addresses = explode(",", $email_to);
625
+ if(is_array($addresses) && count($addresses) > 1) {
626
+ $to_address = $addresses;
627
+ } else {
628
+ $to_address[] = $email_to;
629
  }
630
 
631
+ /* Look for Custom Subject Line , Fall Back on Default */
632
+ $subject = (isset($form_meta_data['inbound_notify_email_subject'])) ? $form_meta_data['inbound_notify_email_subject'] : $template['subject'];
633
 
634
+ /* Discover From Email Address */
635
+ foreach ($form_post_data as $key => $value) {
636
+ if (preg_match('/email|e-mail/i', $key)) {
637
+ $from_email = $form_post_data[$key];
638
  }
639
  }
640
 
641
+ $from_email = apply_filters( 'inbound_admin_notification_from_email' , $from_email );
642
 
643
+ /* Prepare Additional Data For Token Engine */
644
+ $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'] : '';
645
 
646
+ /* Discover From Name */
647
+ $from_name = get_option( 'blogname' , '' );
648
+ $from_name = apply_filters( 'inbound_admin_notification_from_name', $from_name );
649
 
650
+ $Inbound_Templating_Engine = Inbound_Templating_Engine();
651
+ $subject = $Inbound_Templating_Engine->replace_tokens( $subject, array($form_post_data, $form_meta_data));
652
+ $body = $Inbound_Templating_Engine->replace_tokens( $template['body'] , array($form_post_data, $form_meta_data ) );
653
 
 
 
 
 
 
654
 
655
+ $headers = 'From: '. $from_name .' <'. $from_email .'>' . "\r\n";
656
+ $headers = apply_filters( 'inbound_lead_notification_email_headers' , $headers );
657
+
658
+ foreach ($to_address as $key => $recipient) {
659
+ $result = wp_mail( $recipient , $subject , $body , $headers );
660
+ }
661
 
 
 
 
 
662
  }
663
 
664
  }
665
 
666
+ /* Sends An Email to Lead After Conversion */
667
+ public static function send_conversion_lead_notification( $form_post_data , $form_meta_data ) {
 
 
 
 
668
 
 
 
 
 
669
 
670
+ /* If Notifications Are Off Then Exit */
671
+ if ( !isset($form_meta_data['inbound_email_send_notification'][0]) || $form_meta_data['inbound_email_send_notification'][0] != 'on' ){
 
 
 
 
 
 
 
672
  return;
673
  }
674
 
675
+ /* Get Lead Email Address */
676
+ $lead_email = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  foreach ($form_post_data as $key => $value) {
678
  if (preg_match('/email|e-mail/i', $key)) {
679
+ $lead_email = $form_post_data[$key];
680
  }
681
  }
682
 
683
+ /* Redundancy */
684
+ if (!$lead_email) {
685
+ if (isset($form_post_data['email'])) {
686
+ $lead_email = $form_post_data['email'];
687
+ } else if (isset($form_post_data['e-mail'])) {
688
+ $lead_email = $form_post_data['e-mail'];
689
+ } else if (isset($form_post_data['wpleads_email_address'])) {
690
+ $lead_email = $form_post_data['wpleads_email_address'];
691
+ } else {
692
+ $lead_email = 'null map email field';
693
+ }
694
+ }
695
 
696
+ if ( !$lead_email ) {
697
+ return;
698
+ }
699
 
 
 
 
700
 
701
  $Inbound_Templating_Engine = Inbound_Templating_Engine();
702
+ $form_id = $form_meta_data['post_id']; //This is page id or post id
703
+ $template_id = $form_meta_data['inbound_email_send_notification_template'][0];
 
 
 
 
704
 
705
+ /* Rebuild Form Meta Data to Load Single Values */
706
+ foreach( $form_meta_data as $key => $value ) {
707
+ $form_meta_data[$key] = $value[0];
708
  }
709
 
710
+ /* If Email Template Selected Use That */
711
+ if ( $template_id && $template_id != 'custom' ) {
 
 
 
 
712
 
713
+ $template_array = self::get_email_template( $template_id );
714
+ $confirm_subject = $template_array['subject'];
715
+ $confirm_email_message = $template_array['body'];
716
 
717
+ /* Else Use Custom Template */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  } else {
 
 
 
 
 
 
 
719
 
720
+ $template = get_post($form_id);
721
+ $content = $template->post_content;
722
+ $confirm_subject = get_post_meta( $form_id, 'inbound_confirmation_subject', TRUE );
723
+ $content = apply_filters('the_content', $content);
724
+ $content = str_replace(']]>', ']]&gt;', $content);
725
 
726
+ $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>';
727
+ $confirm_email_message .= $content;
728
+ $confirm_email_message .= '</tr></table></body></html>';
729
+ }
730
 
 
 
 
 
731
 
 
 
732
 
733
+ $confirm_subject = $Inbound_Templating_Engine->replace_tokens( $confirm_subject, array($form_post_data, $form_meta_data ));
 
 
734
 
735
+ /* add default subject if empty */
736
+ if (!$confirm_subject) {
737
+ $confirm_subject = __( 'Thank you!' , 'leads' );
738
+ }
739
 
740
+ $confirm_email_message = $Inbound_Templating_Engine->replace_tokens( $confirm_email_message , array( $form_post_data, $form_meta_data ) );
 
 
 
 
741
 
 
 
 
 
742
 
743
+ $from_name = get_option( 'blogname' , '' );
744
+ $from_email = get_option( 'admin_email' );
745
 
746
+ $headers = "From: " . $from_name . " <" . $from_email . ">\n";
747
+ $headers .= 'Content-type: text/html';
748
 
749
+ wp_mail( $lead_email, $confirm_subject , $confirm_email_message, $headers );
750
 
 
 
 
751
  }
752
 
753
+ /* Get Email Template for New Lead Notification */
754
+ static function get_new_lead_email_template( ) {
755
 
756
+ $email_template = array();
 
757
 
758
+ $templates = get_posts(array(
759
+ 'post_type' => 'email-template',
760
+ 'posts_per_page' => 1,
761
+ 'meta_key' => '_inbound_template_id',
762
+ 'meta_value' => 'inbound-new-lead-notification'
763
+ ));
764
 
765
+ foreach ( $templates as $template ) {
766
+ $email_template['ID'] = $template->ID;
767
+ $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
768
+ $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
769
+ }
770
 
771
+ return $email_template;
772
+ }
773
 
774
+ /* Get Email Template by ID */
775
+ public static function get_email_template( $ID ) {
776
 
777
+ $email_template = array();
778
 
779
+ $template = get_post($ID);
 
 
 
 
 
780
 
 
781
  $email_template['ID'] = $template->ID;
782
  $email_template['subject'] = get_post_meta( $template->ID , 'inbound_email_subject_template' , true );
783
  $email_template['body'] = get_post_meta( $template->ID , 'inbound_email_body_template' , true );
784
+
785
+ return $email_template;
786
  }
787
 
788
+ /**
789
+ * Prepare an array of days, months, years. Make i18n ready
790
+ * @param STRING $case lets us know which array to return
791
+ *
792
+ * @returns ARRAY of data
793
+ */
794
+ public static function get_date_selectons( $case ) {
795
+
796
+ switch( $case ) {
797
+
798
+ case 'months':
799
+ return array(
800
+ '01' => __( 'Jan' , 'leads' ),
801
+ '02' => __( 'Feb' , 'leads' ),
802
+ '03' => __( 'Mar' , 'leads' ),
803
+ '04' => __( 'Apr' , 'leads' ),
804
+ '05' => __( 'May' , 'leads' ),
805
+ '06' => __( 'Jun' , 'leads' ),
806
+ '07' => __( 'Jul' , 'leads' ),
807
+ '08' => __( 'Aug' , 'leads' ),
808
+ '09' => __( 'Sep' , 'leads' ),
809
+ '10' => __( 'Oct' , 'leads' ),
810
+ '11' => __( 'Nov' , 'leads' ),
811
+ '12' => __( 'Dec' , 'leads' )
812
+ );
813
+ break;
814
+ case 'days' :
815
+ return array (
816
+ '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05',
817
+ '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10',
818
+ '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15',
819
+ '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20',
820
+ '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25',
821
+ '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30',
822
+ '31' => '31'
823
+ );
824
+ break;
825
+ case 'years' :
826
+
827
+ for ($i=1920;$i<2101;$i++) {
828
+ $years[$i] = $i;
829
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
830
 
831
+ return $years;
832
+ break;
833
+ }
834
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835
 
836
+ /**
837
+ * Prepare an array of country codes and country names. Make i18n ready
838
+ */
839
+ public static function get_countries_array() {
840
+ return array (
841
+ __( 'AF' , 'leads') => __( 'Afghanistan' , 'leads' ) ,
842
+ __( 'AX' , 'leads') => __( 'Aland Islands' , 'leads' ) ,
843
+ __( 'AL' , 'leads') => __( 'Albania' , 'leads' ) ,
844
+ __( 'DZ' , 'leads') => __( 'Algeria' , 'leads' ) ,
845
+ __( 'AS' , 'leads') => __( 'American Samoa' , 'leads' ) ,
846
+ __( 'AD' , 'leads') => __( 'Andorra' , 'leads' ) ,
847
+ __( 'AO' , 'leads') => __( 'Angola' , 'leads' ) ,
848
+ __( 'AI' , 'leads') => __( 'Anguilla' , 'leads' ) ,
849
+ __( 'AQ' , 'leads') => __( 'Antarctica' , 'leads' ) ,
850
+ __( 'AG' , 'leads') => __( 'Antigua and Barbuda' , 'leads' ) ,
851
+ __( 'AR' , 'leads') => __( 'Argentina' , 'leads' ) ,
852
+ __( 'AM' , 'leads') => __( 'Armenia' , 'leads' ) ,
853
+ __( 'AW' , 'leads') => __( 'Aruba' , 'leads' ) ,
854
+ __( 'AU' , 'leads') => __( 'Australia' , 'leads' ) ,
855
+ __( 'AT' , 'leads') => __( 'Austria' , 'leads' ) ,
856
+ __( 'AZ' , 'leads') => __( 'Azerbaijan' , 'leads' ) ,
857
+ __( 'BS' , 'leads') => __( 'Bahamas' , 'leads' ) ,
858
+ __( 'BH' , 'leads') => __( 'Bahrain' , 'leads' ) ,
859
+ __( 'BD' , 'leads') => __( 'Bangladesh' , 'leads' ) ,
860
+ __( 'BB' , 'leads') => __( 'Barbados' , 'leads' ) ,
861
+ __( 'BY' , 'leads') => __( 'Belarus' , 'leads' ) ,
862
+ __( 'BE' , 'leads') => __( 'Belgium' , 'leads' ) ,
863
+ __( 'BZ' , 'leads') => __( 'Belize' , 'leads' ) ,
864
+ __( 'BJ' , 'leads') => __( 'Benin' , 'leads' ) ,
865
+ __( 'BM' , 'leads') => __( 'Bermuda' , 'leads' ) ,
866
+ __( 'BT' , 'leads') => __( 'Bhutan' , 'leads' ) ,
867
+ __( 'BO' , 'leads') => __( 'Bolivia' , 'leads' ) ,
868
+ __( 'BA' , 'leads') => __( 'Bosnia and Herzegovina' , 'leads' ) ,
869
+ __( 'BW' , 'leads') => __( 'Botswana' , 'leads' ) ,
870
+ __( 'BV' , 'leads') => __( 'Bouvet Island' , 'leads' ) ,
871
+ __( 'BR' , 'leads') => __( 'Brazil' , 'leads' ) ,
872
+ __( 'IO' , 'leads') => __( 'British Indian Ocean Territory' , 'leads' ) ,
873
+ __( 'BN' , 'leads') => __( 'Brunei Darussalam' , 'leads' ) ,
874
+ __( 'BG' , 'leads') => __( 'Bulgaria' , 'leads' ) ,
875
+ __( 'BF' , 'leads') => __( 'Burkina Faso' , 'leads' ) ,
876
+ __( 'BI' , 'leads') => __( 'Burundi' , 'leads' ) ,
877
+ __( 'KH' , 'leads') => __( 'Cambodia' , 'leads' ) ,
878
+ __( 'CM' , 'leads') => __( 'Cameroon' , 'leads' ) ,
879
+ __( 'CA' , 'leads') => __( 'Canada' , 'leads' ) ,
880
+ __( 'CV' , 'leads') => __( 'Cape Verde' , 'leads' ) ,
881
+ __( 'BQ' , 'leads') => __( 'Caribbean Netherlands ' , 'leads' ) ,
882
+ __( 'KY' , 'leads') => __( 'Cayman Islands' , 'leads' ) ,
883
+ __( 'CF' , 'leads') => __( 'Central African Republic' , 'leads' ) ,
884
+ __( 'TD' , 'leads') => __( 'Chad' , 'leads' ) ,
885
+ __( 'CL' , 'leads') => __( 'Chile' , 'leads' ) ,
886
+ __( 'CN' , 'leads') => __( 'China' , 'leads' ) ,
887
+ __( 'CX' , 'leads') => __( 'Christmas Island' , 'leads' ) ,
888
+ __( 'CC' , 'leads') => __( 'Cocos (Keeling) Islands' , 'leads' ) ,
889
+ __( 'CO' , 'leads') => __( 'Colombia' , 'leads' ) ,
890
+ __( 'KM' , 'leads') => __( 'Comoros' , 'leads' ) ,
891
+ __( 'CG' , 'leads') => __( 'Congo' , 'leads' ) ,
892
+ __( 'CD' , 'leads') => __( 'Congo, Democratic Republic of' , 'leads' ) ,
893
+ __( 'CK' , 'leads') => __( 'Cook Islands' , 'leads' ) ,
894
+ __( 'CR' , 'leads') => __( 'Costa Rica' , 'leads' ) ,
895
+ __( 'CI' , 'leads') => __( 'Cote d\'Ivoire' , 'leads' ) ,
896
+ __( 'HR' , 'leads') => __( 'Croatia' , 'leads' ) ,
897
+ __( 'CU' , 'leads') => __( 'Cuba' , 'leads' ) ,
898
+ __( 'CW' , 'leads') => __( 'Curacao' , 'leads' ) ,
899
+ __( 'CY' , 'leads') => __( 'Cyprus' , 'leads' ) ,
900
+ __( 'CZ' , 'leads') => __( 'Czech Republic' , 'leads' ) ,
901
+ __( 'DK' , 'leads') => __( 'Denmark' , 'leads' ) ,
902
+ __( 'DJ' , 'leads') => __( 'Djibouti' , 'leads' ) ,
903
+ __( 'DM' , 'leads') => __( 'Dominica' , 'leads' ) ,
904
+ __( 'DO' , 'leads') => __( 'Dominican Republic' , 'leads' ) ,
905
+ __( 'EC' , 'leads') => __( 'Ecuador' , 'leads' ) ,
906
+ __( 'EG' , 'leads') => __( 'Egypt' , 'leads' ) ,
907
+ __( 'SV' , 'leads') => __( 'El Salvador' , 'leads' ) ,
908
+ __( 'GQ' , 'leads') => __( 'Equatorial Guinea' , 'leads' ) ,
909
+ __( 'ER' , 'leads') => __( 'Eritrea' , 'leads' ) ,
910
+ __( 'EE' , 'leads') => __( 'Estonia' , 'leads' ) ,
911
+ __( 'ET' , 'leads') => __( 'Ethiopia' , 'leads' ) ,
912
+ __( 'FK' , 'leads') => __( 'Falkland Islands' , 'leads' ) ,
913
+ __( 'FO' , 'leads') => __( 'Faroe Islands' , 'leads' ) ,
914
+ __( 'FJ' , 'leads') => __( 'Fiji' , 'leads' ) ,
915
+ __( 'FI' , 'leads') => __( 'Finland' , 'leads' ) ,
916
+ __( 'FR' , 'leads') => __( 'France' , 'leads' ) ,
917
+ __( 'GF' , 'leads') => __( 'French Guiana' , 'leads' ) ,
918
+ __( 'PF' , 'leads') => __( 'French Polynesia' , 'leads' ) ,
919
+ __( 'TF' , 'leads') => __( 'French Southern Territories' , 'leads' ) ,
920
+ __( 'GA' , 'leads') => __( 'Gabon' , 'leads' ) ,
921
+ __( 'GM' , 'leads') => __( 'Gambia' , 'leads' ) ,
922
+ __( 'GE' , 'leads') => __( 'Georgia' , 'leads' ) ,
923
+ __( 'DE' , 'leads') => __( 'Germany' , 'leads' ) ,
924
+ __( 'GH' , 'leads') => __( 'Ghana' , 'leads' ) ,
925
+ __( 'GI' , 'leads') => __( 'Gibraltar' , 'leads' ) ,
926
+ __( 'GR' , 'leads') => __( 'Greece' , 'leads' ) ,
927
+ __( 'GL' , 'leads') => __( 'Greenland' , 'leads' ) ,
928
+ __( 'GD' , 'leads') => __( 'Grenada' , 'leads' ) ,
929
+ __( 'GP' , 'leads') => __( 'Guadeloupe' , 'leads' ) ,
930
+ __( 'GU' , 'leads') => __( 'Guam' , 'leads' ) ,
931
+ __( 'GT' , 'leads') => __( 'Guatemala' , 'leads' ) ,
932
+ __( 'GG' , 'leads') => __( 'Guernsey' , 'leads' ) ,
933
+ __( 'GN' , 'leads') => __( 'Guinea' , 'leads' ) ,
934
+ __( 'GW' , 'leads') => __( 'Guinea-Bissau' , 'leads' ) ,
935
+ __( 'GY' , 'leads') => __( 'Guyana' , 'leads' ) ,
936
+ __( 'HT' , 'leads') => __( 'Haiti' , 'leads' ) ,
937
+ __( 'HM' , 'leads') => __( 'Heard and McDonald Islands' , 'leads' ) ,
938
+ __( 'HN' , 'leads') => __( 'Honduras' , 'leads' ) ,
939
+ __( 'HK' , 'leads') => __( 'Hong Kong' , 'leads' ) ,
940
+ __( 'HU' , 'leads') => __( 'Hungary' , 'leads' ) ,
941
+ __( 'IS' , 'leads') => __( 'Iceland' , 'leads' ) ,
942
+ __( 'IN' , 'leads') => __( 'India' , 'leads' ) ,
943
+ __( 'ID' , 'leads') => __( 'Indonesia' , 'leads' ) ,
944
+ __( 'IR' , 'leads') => __( 'Iran' , 'leads' ) ,
945
+ __( 'IQ' , 'leads') => __( 'Iraq' , 'leads' ) ,
946
+ __( 'IE' , 'leads') => __( 'Ireland' , 'leads' ) ,
947
+ __( 'IM' , 'leads') => __( 'Isle of Man' , 'leads' ) ,
948
+ __( 'IL' , 'leads') => __( 'Israel' , 'leads' ) ,
949
+ __( 'IT' , 'leads') => __( 'Italy' , 'leads' ) ,
950
+ __( 'JM' , 'leads') => __( 'Jamaica' , 'leads' ) ,
951
+ __( 'JP' , 'leads') => __( 'Japan' , 'leads' ) ,
952
+ __( 'JE' , 'leads') => __( 'Jersey' , 'leads' ) ,
953
+ __( 'JO' , 'leads') => __( 'Jordan' , 'leads' ) ,
954
+ __( 'KZ' , 'leads') => __( 'Kazakhstan' , 'leads' ) ,
955
+ __( 'KE' , 'leads') => __( 'Kenya' , 'leads' ) ,
956
+ __( 'KI' , 'leads') => __( 'Kiribati' , 'leads' ) ,
957
+ __( 'KW' , 'leads') => __( 'Kuwait' , 'leads' ) ,
958
+ __( 'KG' , 'leads') => __( 'Kyrgyzstan' , 'leads' ) ,
959
+ __( 'LA' , 'leads') => __( 'Lao People\'s Democratic Republic' , 'leads' ) ,
960
+ __( 'LV' , 'leads') => __( 'Latvia' , 'leads' ) ,
961
+ __( 'LB' , 'leads') => __( 'Lebanon' , 'leads' ) ,
962
+ __( 'LS' , 'leads') => __( 'Lesotho' , 'leads' ) ,
963
+ __( 'LR' , 'leads') => __( 'Liberia' , 'leads' ) ,
964
+ __( 'LY' , 'leads') => __( 'Libya' , 'leads' ) ,
965
+ __( 'LI' , 'leads') => __( 'Liechtenstein' , 'leads' ) ,
966
+ __( 'LT' , 'leads') => __( 'Lithuania' , 'leads' ) ,
967
+ __( 'LU' , 'leads') => __( 'Luxembourg' , 'leads' ) ,
968
+ __( 'MO' , 'leads') => __( 'Macau' , 'leads' ) ,
969
+ __( 'MK' , 'leads') => __( 'Macedonia' , 'leads' ) ,
970
+ __( 'MG' , 'leads') => __( 'Madagascar' , 'leads' ) ,
971
+ __( 'MW' , 'leads') => __( 'Malawi' , 'leads' ) ,
972
+ __( 'MY' , 'leads') => __( 'Malaysia' , 'leads' ) ,
973
+ __( 'MV' , 'leads') => __( 'Maldives' , 'leads' ) ,
974
+ __( 'ML' , 'leads') => __( 'Mali' , 'leads' ) ,
975
+ __( 'MT' , 'leads') => __( 'Malta' , 'leads' ) ,
976
+ __( 'MH' , 'leads') => __( 'Marshall Islands' , 'leads' ) ,
977
+ __( 'MQ' , 'leads') => __( 'Martinique' , 'leads' ) ,
978
+ __( 'MR' , 'leads') => __( 'Mauritania' , 'leads' ) ,
979
+ __( 'MU' , 'leads') => __( 'Mauritius' , 'leads' ) ,
980
+ __( 'YT' , 'leads') => __( 'Mayotte' , 'leads' ) ,
981
+ __( 'MX' , 'leads') => __( 'Mexico' , 'leads' ) ,
982
+ __( 'FM' , 'leads') => __( 'Micronesia, Federated States of' , 'leads' ) ,
983
+ __( 'MD' , 'leads') => __( 'Moldova' , 'leads' ) ,
984
+ __( 'MC' , 'leads') => __( 'Monaco' , 'leads' ) ,
985
+ __( 'MN' , 'leads') => __( 'Mongolia' , 'leads' ) ,
986
+ __( 'ME' , 'leads') => __( 'Montenegro' , 'leads' ) ,
987
+ __( 'MS' , 'leads') => __( 'Montserrat' , 'leads' ) ,
988
+ __( 'MA' , 'leads') => __( 'Morocco' , 'leads' ) ,
989
+ __( 'MZ' , 'leads') => __( 'Mozambique' , 'leads' ) ,
990
+ __( 'MM' , 'leads') => __( 'Myanmar' , 'leads' ) ,
991
+ __( 'NA' , 'leads') => __( 'Namibia' , 'leads' ) ,
992
+ __( 'NR' , 'leads') => __( 'Nauru' , 'leads' ) ,
993
+ __( 'NP' , 'leads') => __( 'Nepal' , 'leads' ) ,
994
+ __( 'NC' , 'leads') => __( 'New Caledonia' , 'leads' ) ,
995
+ __( 'NZ' , 'leads') => __( 'New Zealand' , 'leads' ) ,
996
+ __( 'NI' , 'leads') => __( 'Nicaragua' , 'leads' ) ,
997
+ __( 'NE' , 'leads') => __( 'Niger' , 'leads' ) ,
998
+ __( 'NG' , 'leads') => __( 'Nigeria' , 'leads' ) ,
999
+ __( 'NU' , 'leads') => __( 'Niue' , 'leads' ) ,
1000
+ __( 'NF' , 'leads') => __( 'Norfolk Island' , 'leads' ) ,
1001
+ __( 'KP' , 'leads') => __( 'North Korea' , 'leads' ) ,
1002
+ __( 'MP' , 'leads') => __( 'Northern Mariana Islands' , 'leads' ) ,
1003
+ __( 'NO' , 'leads') => __( 'Norway' , 'leads' ) ,
1004
+ __( 'OM' , 'leads') => __( 'Oman' , 'leads' ) ,
1005
+ __( 'PK' , 'leads') => __( 'Pakistan' , 'leads' ) ,
1006
+ __( 'PW' , 'leads') => __( 'Palau' , 'leads' ) ,
1007
+ __( 'PS' , 'leads') => __( 'Palestinian Territory, Occupied' , 'leads' ) ,
1008
+ __( 'PA' , 'leads') => __( 'Panama' , 'leads' ) ,
1009
+ __( 'PG' , 'leads') => __( 'Papua New Guinea' , 'leads' ) ,
1010
+ __( 'PY' , 'leads') => __( 'Paraguay' , 'leads' ) ,
1011
+ __( 'PE' , 'leads') => __( 'Peru' , 'leads' ) ,
1012
+ __( 'PH' , 'leads') => __( 'Philippines' , 'leads' ) ,
1013
+ __( 'PN' , 'leads') => __( 'Pitcairn' , 'leads' ) ,
1014
+ __( 'PL' , 'leads') => __( 'Poland' , 'leads' ) ,
1015
+ __( 'PT' , 'leads') => __( 'Portugal' , 'leads' ) ,
1016
+ __( 'PR' , 'leads') => __( 'Puerto Rico' , 'leads' ) ,
1017
+ __( 'QA' , 'leads') => __( 'Qatar' , 'leads' ) ,
1018
+ __( 'RE' , 'leads') => __( 'Reunion' , 'leads' ) ,
1019
+ __( 'RO' , 'leads') => __( 'Romania' , 'leads' ) ,
1020
+ __( 'RU' , 'leads') => __( 'Russian Federation' , 'leads' ) ,
1021
+ __( 'RW' , 'leads') => __( 'Rwanda' , 'leads' ) ,
1022
+ __( 'BL' , 'leads') => __( 'Saint Barthelemy' , 'leads' ) ,
1023
+ __( 'SH' , 'leads') => __( 'Saint Helena' , 'leads' ) ,
1024
+ __( 'KN' , 'leads') => __( 'Saint Kitts and Nevis' , 'leads' ) ,
1025
+ __( 'LC' , 'leads') => __( 'Saint Lucia' , 'leads' ) ,
1026
+ __( 'VC' , 'leads') => __( 'Saint Vincent and the Grenadines' , 'leads' ) ,
1027
+ __( 'MF' , 'leads') => __( 'Saint-Martin (France)' , 'leads' ) ,
1028
+ __( 'SX' , 'leads') => __( 'Saint-Martin (Pays-Bas)' , 'leads' ) ,
1029
+ __( 'WS' , 'leads') => __( 'Samoa' , 'leads' ) ,
1030
+ __( 'SM' , 'leads') => __( 'San Marino' , 'leads' ) ,
1031
+ __( 'ST' , 'leads') => __( 'Sao Tome and Principe' , 'leads' ) ,
1032
+ __( 'SA' , 'leads') => __( 'Saudi Arabia' , 'leads' ) ,
1033
+ __( 'SN' , 'leads') => __( 'Senegal' , 'leads' ) ,
1034
+ __( 'RS' , 'leads') => __( 'Serbia' , 'leads' ) ,
1035
+ __( 'SC' , 'leads') => __( 'Seychelles' , 'leads' ) ,
1036
+ __( 'SL' , 'leads') => __( 'Sierra Leone' , 'leads' ) ,
1037
+ __( 'SG' , 'leads') => __( 'Singapore' , 'leads' ) ,
1038
+ __( 'SK' , 'leads') => __( 'Slovakia (Slovak Republic)' , 'leads' ) ,
1039
+ __( 'SI' , 'leads') => __( 'Slovenia' , 'leads' ) ,
1040
+ __( 'SB' , 'leads') => __( 'Solomon Islands' , 'leads' ) ,
1041
+ __( 'SO' , 'leads') => __( 'Somalia' , 'leads' ) ,
1042
+ __( 'ZA' , 'leads') => __( 'South Africa' , 'leads' ) ,
1043
+ __( 'GS' , 'leads') => __( 'South Georgia and the South Sandwich Islands' , 'leads' ) ,
1044
+ __( 'KR' , 'leads') => __( 'South Korea' , 'leads' ) ,
1045
+ __( 'SS' , 'leads') => __( 'South Sudan' , 'leads' ) ,
1046
+ __( 'ES' , 'leads') => __( 'Spain' , 'leads' ) ,
1047
+ __( 'LK' , 'leads') => __( 'Sri Lanka' , 'leads' ) ,
1048
+ __( 'PM' , 'leads') => __( 'St. Pierre and Miquelon' , 'leads' ) ,
1049
+ __( 'SD' , 'leads') => __( 'Sudan' , 'leads' ) ,
1050
+ __( 'SR' , 'leads') => __( 'Suriname' , 'leads' ) ,
1051
+ __( 'SJ' , 'leads') => __( 'Svalbard and Jan Mayen Islands' , 'leads' ) ,
1052
+ __( 'SZ' , 'leads') => __( 'Swaziland' , 'leads' ) ,
1053
+ __( 'SE' , 'leads') => __( 'Sweden' , 'leads' ) ,
1054
+ __( 'CH' , 'leads') => __( 'Switzerland' , 'leads' ) ,
1055
+ __( 'SY' , 'leads') => __( 'Syria' , 'leads' ) ,
1056
+ __( 'TW' , 'leads') => __( 'Taiwan' , 'leads' ) ,
1057
+ __( 'TJ' , 'leads') => __( 'Tajikistan' , 'leads' ) ,
1058
+ __( 'TZ' , 'leads') => __( 'Tanzania' , 'leads' ) ,
1059
+ __( 'TH' , 'leads') => __( 'Thailand' , 'leads' ) ,
1060
+ __( 'NL' , 'leads') => __( 'The Netherlands' , 'leads' ) ,
1061
+ __( 'TL' , 'leads') => __( 'Timor-Leste' , 'leads' ) ,
1062
+ __( 'TG' , 'leads') => __( 'Togo' , 'leads' ) ,
1063
+ __( 'TK' , 'leads') => __( 'Tokelau' , 'leads' ) ,
1064
+ __( 'TO' , 'leads') => __( 'Tonga' , 'leads' ) ,
1065
+ __( 'TT' , 'leads') => __( 'Trinidad and Tobago' , 'leads' ) ,
1066
+ __( 'TN' , 'leads') => __( 'Tunisia' , 'leads' ) ,
1067
+ __( 'TR' , 'leads') => __( 'Turkey' , 'leads' ) ,
1068
+ __( 'TM' , 'leads') => __( 'Turkmenistan' , 'leads' ) ,
1069
+ __( 'TC' , 'leads') => __( 'Turks and Caicos Islands' , 'leads' ) ,
1070
+ __( 'TV' , 'leads') => __( 'Tuvalu' , 'leads' ) ,
1071
+ __( 'UG' , 'leads') => __( 'Uganda' , 'leads' ) ,
1072
+ __( 'UA' , 'leads') => __( 'Ukraine' , 'leads' ) ,
1073
+ __( 'AE' , 'leads') => __( 'United Arab Emirates' , 'leads' ) ,
1074
+ __( 'GB' , 'leads') => __( 'United Kingdom' , 'leads' ) ,
1075
+ __( 'US' , 'leads') => __( 'United States' , 'leads' ) ,
1076
+ __( 'UM' , 'leads') => __( 'United States Minor Outlying Islands' , 'leads' ) ,
1077
+ __( 'UY' , 'leads') => __( 'Uruguay' , 'leads' ) ,
1078
+ __( 'UZ' , 'leads') => __( 'Uzbekistan' , 'leads' ) ,
1079
+ __( 'VU' , 'leads') => __( 'Vanuatu' , 'leads' ) ,
1080
+ __( 'VA' , 'leads') => __( 'Vatican' , 'leads' ) ,
1081
+ __( 'VE' , 'leads') => __( 'Venezuela' , 'leads' ) ,
1082
+ __( 'VN' , 'leads') => __( 'Vietnam' , 'leads' ) ,
1083
+ __( 'VG' , 'leads') => __( 'Virgin Islands (British)' , 'leads' ) ,
1084
+ __( 'VI' , 'leads') => __( 'Virgin Islands (U.S.)' , 'leads' ) ,
1085
+ __( 'WF' , 'leads') => __( 'Wallis and Futuna Islands' , 'leads' ) ,
1086
+ __( 'EH' , 'leads') => __( 'Western Sahara' , 'leads' ) ,
1087
+ __( 'YE' , 'leads') => __( 'Yemen' , 'leads' ) ,
1088
+ __( 'ZM' , 'leads') => __( 'Zambia' , 'leads' ) ,
1089
+ __( 'ZW' , 'leads') => __( 'Zimbabwe' , 'leads' )
1090
+ );
1091
+ }
1092
+
1093
+ }
1094
+
1095
+ Inbound_Forms::init();
1096
+ }
shared/docs/index.html CHANGED
@@ -5,7 +5,7 @@
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
  <meta name="viewport" content="width=device-width">
7
 
8
- <title>Flatdoc</title>
9
 
10
  <!-- Flatdoc -->
11
  <script src='js/jquery.js'></script>
@@ -57,32 +57,31 @@
57
 
58
  <div class='header'>
59
  <div class='left'>
60
- <h1><a href='.'>Inbound Now</a></h1>
61
  <ul>
62
  <li><a href='https://github.com/inboundnow'>View on GitHub</a></li>
63
- <li><a href='https://github.com/rstacruz/flatdoc/issues'>Issues</a></li>
64
- <li><a href='reference.html'>API reference</a></li>
 
65
  </ul>
66
  </div>
67
  <div class='right'>
68
- <iframe src="http://ghbtns.com/github-btn.html?user=davidwells&amp;type=follow&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="170" height="20"></iframe>
69
- <iframe src="http://ghbtns.com/github-btn.html?user=davidwells&amp;repo=flatdoc&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
70
  </div>
71
  </div>
72
 
73
  <div class='content-root'>
74
  <div class='menubar'>
75
  <div class='section'>
76
- <a class='big button' href='https://raw.github.com/rstacruz/flatdoc/gh-pages/templates/template.html' target='_blank'>Download</a>
77
  <!-- <a href='https://github.com/rstacruz/flatdoc' target='_blank'>View in GitHub</a> -->
78
  </div>
79
  <div class='menu section' role='flatdoc-menu'></div>
80
  <div class='bottom section'>
81
- <iframe src='http://ghbtns.com/github-btn.html?user=rstacruz&amp;repo=flatdoc&amp;type=watch&amp;count=true' allowtransparency="true" frameborder="0" scrolling="0" width="170" height="20"></iframe>
82
- <br>
83
- <a href="https://news.ycombinator.com/submit" class="hn-button" data-title="Flatdoc is the fastest way to create a site for your open source project" data-url="http://ricostacruz.com/flatdoc/" data-count="horizontal" data-style="twitter">HN</a>
84
- <br>
85
- <a href='https://github.com/rstacruz/flatdoc'>View on GitHub</a><br>
86
  <a href='main.md' target='_blank'>See .md source</a>
87
  </div>
88
  </div>
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
  <meta name="viewport" content="width=device-width">
7
 
8
+ <title>Inbound Now Docs</title>
9
 
10
  <!-- Flatdoc -->
11
  <script src='js/jquery.js'></script>
57
 
58
  <div class='header'>
59
  <div class='left'>
60
+ <h1><a href='http://www.inboundnow.com'>Inbound Now</a></h1>
61
  <ul>
62
  <li><a href='https://github.com/inboundnow'>View on GitHub</a></li>
63
+ <li><a href='https://github.com/inboundnow'>Issues</a></li>
64
+ <li><a href='https://support.inboundnow.com'>User Support</a></li>
65
+ <!--<li><a href='reference.html'>API reference</a></li>-->
66
  </ul>
67
  </div>
68
  <div class='right'>
69
+ <iframe src="http://ghbtns.com/github-btn.html?user=inboundnow&amp;type=follow&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="170" height="20"></iframe>
70
+ <iframe src="http://ghbtns.com/github-btn.html?user=inboundnow&amp;repo=landing-pages&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
71
  </div>
72
  </div>
73
 
74
  <div class='content-root'>
75
  <div class='menubar'>
76
  <div class='section'>
77
+ <a class='big button' href='http://www.inboundnow.com/get-started/' target='_blank'>Download</a>
78
  <!-- <a href='https://github.com/rstacruz/flatdoc' target='_blank'>View in GitHub</a> -->
79
  </div>
80
  <div class='menu section' role='flatdoc-menu'></div>
81
  <div class='bottom section'>
82
+ <iframe src='http://ghbtns.com/github-btn.html?user=inboundnow&amp;repo=landing-pages&amp;type=watch&amp;count=true' allowtransparency="true" frameborder="0" scrolling="0" width="170" height="20"></iframe>
83
+
84
+ <a href='https://github.com/inboundnow'>View on GitHub</a><br>
 
 
85
  <a href='main.md' target='_blank'>See .md source</a>
86
  </div>
87
  </div>
shared/docs/js/theme.js CHANGED
@@ -25,7 +25,7 @@
25
  var head = text.replace(/_/g, "-");
26
  var heading = $('#event-list-' + head).text().replace("()", "")
27
  $('#event-list-' + head).text(heading);
28
- console.log('#event-list-' + heading);
29
  });
30
 
31
  });
25
  var head = text.replace(/_/g, "-");
26
  var heading = $('#event-list-' + head).text().replace("()", "")
27
  $('#event-list-' + head).text(heading);
28
+ //console.log('#event-list-' + heading);
29
  });
30
 
31
  });
shared/shortcodes/css/shortcodes.css CHANGED
@@ -482,6 +482,7 @@ padding-right: 10px;
482
  }
483
  .steps a:focus, .steps a:active {
484
  outline: none;
 
485
  }
486
  .step-item {
487
  counter-increment: steps;
482
  }
483
  .steps a:focus, .steps a:active {
484
  outline: none;
485
+ box-shadow: none;
486
  }
487
  .step-item {
488
  counter-increment: steps;
shared/shortcodes/shortcodes/forms.php CHANGED
@@ -272,6 +272,14 @@
272
  'std' => '0',
273
  'class' => '',
274
  ),
 
 
 
 
 
 
 
 
275
  'helper' => array(
276
  'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'leads'),
277
  'desc' => __('<span class="show-advanced-fields">Show advanced fields</span>', 'leads'),
@@ -279,6 +287,14 @@
279
  'std' => '',
280
  'class' => '',
281
  ),
 
 
 
 
 
 
 
 
282
  'placeholder' => array(
283
  'name' => __('Field Placeholder <span class="small-optional-text">(optional)</span>', 'leads'),
284
  'desc' => __('Put field placeholder text here. Only works for normal text inputs', 'leads'),
@@ -316,17 +332,9 @@
316
  'placeholder' => 'enter dynamic url parameter example: utm_campaign ',
317
  'class' => 'advanced',
318
  //'reveal_on' => 'hidden' // on select choice show this
319
- ),
320
- 'map_to' => array(
321
- 'name' => __('Map Field To <span class="small-optional-text">(optional)</span>', 'leads'),
322
- 'desc' => __('Map this field to Leads Value', 'leads'),
323
- 'type' => 'select',
324
- 'options' => $lead_mapping_fields,
325
- 'std' => 'none',
326
- 'class' => 'advanced exclude',
327
- ),
328
  ),
329
- 'shortcode' => '[inbound_field label="{{label}}" type="{{field_type}}" description="{{description}}" required="{{required}}" dropdown="{{dropdown_options}}" radio="{{radio_options}}" checkbox="{{checkbox_options}}" placeholder="{{placeholder}}" field_container_class="{{field_container_class}}" field_input_class="{{field_input_class}}" html="{{html_block_options}}" dynamic="{{hidden_input_options}}" default="{{default_value}}" map_to="{{map_to}}" divider_options="{{divider_options}}"]',
330
  'clone' => __('Add Another Field', 'leads' )
331
  ),
332
  'shortcode' => '[inbound_form name="{{form_name}}" lists="{{lists_hidden}}" redirect="{{redirect}}" notify="{{notify}}" notify_subject="{{notify_subject}}" layout="{{layout}}" font_size="{{font-size}}" labels="{{labels}}" icon="{{icon}}" submit="{{submit}}" submit="{{submit}}" submit_colors="{{submit-colors}}" submit_text_color="{{submit-text-color}}" submit_bg_color="{{submit-bg-color}}" width="{{width}}"]{{child}}[/inbound_form]',
272
  'std' => '0',
273
  'class' => '',
274
  ),
275
+ 'exclude_tracking' => array(
276
+ 'name' => __('Exclude Tracking? <span class="small-optional-text">(optional)</span>', 'leads'),
277
+ 'checkbox_text' => __('Check to exclude this form field from being tracked. Note this will not store in your Database', 'leads'),
278
+ 'desc' => '',
279
+ 'type' => 'checkbox',
280
+ 'std' => '0',
281
+ 'class' => 'advanced',
282
+ ),
283
  'helper' => array(
284
  'name' => __('Field Description <span class="small-optional-text">(optional)</span>', 'leads'),
285
  'desc' => __('<span class="show-advanced-fields">Show advanced fields</span>', 'leads'),
287
  'std' => '',
288
  'class' => '',
289
  ),
290
+ 'map_to' => array(
291
+ 'name' => __('Map Field To <span class="small-optional-text">(optional)</span>', 'leads'),
292
+ 'desc' => __('Map this field to Leads Value', 'leads'),
293
+ 'type' => 'select',
294
+ 'options' => $lead_mapping_fields,
295
+ 'std' => 'none',
296
+ 'class' => 'advanced exclude',
297
+ ),
298
  'placeholder' => array(
299
  'name' => __('Field Placeholder <span class="small-optional-text">(optional)</span>', 'leads'),
300
  'desc' => __('Put field placeholder text here. Only works for normal text inputs', 'leads'),
332
  'placeholder' => 'enter dynamic url parameter example: utm_campaign ',
333
  'class' => 'advanced',
334
  //'reveal_on' => 'hidden' // on select choice show this
335
+ )
 
 
 
 
 
 
 
 
336
  ),
337
+ 'shortcode' => '[inbound_field label="{{label}}" type="{{field_type}}" description="{{description}}" required="{{required}}" exclude_tracking={{exclude_tracking}} dropdown="{{dropdown_options}}" radio="{{radio_options}}" checkbox="{{checkbox_options}}" placeholder="{{placeholder}}" field_container_class="{{field_container_class}}" field_input_class="{{field_input_class}}" html="{{html_block_options}}" dynamic="{{hidden_input_options}}" default="{{default_value}}" map_to="{{map_to}}" divider_options="{{divider_options}}"]',
338
  'clone' => __('Add Another Field', 'leads' )
339
  ),
340
  'shortcode' => '[inbound_form name="{{form_name}}" lists="{{lists_hidden}}" redirect="{{redirect}}" notify="{{notify}}" notify_subject="{{notify_subject}}" layout="{{layout}}" font_size="{{font-size}}" labels="{{labels}}" icon="{{icon}}" submit="{{submit}}" submit="{{submit}}" submit_colors="{{submit-colors}}" submit_text_color="{{submit-text-color}}" submit_bg_color="{{submit-bg-color}}" width="{{width}}"]{{child}}[/inbound_form]',
shared/templates/email-templates/inbound-new-lead-notification/inbound-new-lead-notification.php CHANGED
@@ -58,12 +58,12 @@ $inbound_email_templates['inbound-new-lead-notification'] = '<!DOCTYPE html PUBL
58
  </div>
59
  </td>
60
  </tr>
61
-
62
  <!-- LOOP THROUGH POST PARAMS -->
63
  [inbound-email-post-params]
64
-
65
  <!-- END LOOP -->
66
-
67
  <!-- IF CHAR COUNT OVER 50 make label display block -->
68
 
69
  </tbody>
@@ -134,11 +134,11 @@ $inbound_email_templates['inbound-new-lead-notification'] = '<!DOCTYPE html PUBL
134
  <tr>
135
  <td valign="middle" width="30" style="color:#272727">&nbsp;</td>
136
  <td width="50" height="40" valign="middle" align="left" style="color:#272727">
137
- <img src="{{leads-urlpath}}images/inbound-email.png" height="40" width="40" alt=" " style="outline:none;text-decoration:none;max-width:100%;display:block;width:40px;min-height:40px;border-radius:20px">
138
  </td>
139
- <td style="color:#272727">
140
  '. __( '<b>Leads</b>
141
- from Inbound Now' , 'ma' ) .'
142
  </td>
143
  <td valign="middle" align="left" style="color:#545454;text-align:right">{{date-time}}</td>
144
  <td valign="middle" width="30" style="color:#272727">&nbsp;</td>
58
  </div>
59
  </td>
60
  </tr>
61
+
62
  <!-- LOOP THROUGH POST PARAMS -->
63
  [inbound-email-post-params]
64
+
65
  <!-- END LOOP -->
66
+
67
  <!-- IF CHAR COUNT OVER 50 make label display block -->
68
 
69
  </tbody>
134
  <tr>
135
  <td valign="middle" width="30" style="color:#272727">&nbsp;</td>
136
  <td width="50" height="40" valign="middle" align="left" style="color:#272727">
137
+ <a href="http://www.inboundnow.com" target="_blank"><img src="{{leads-urlpath}}images/inbound-email.png" height="40" width="40" alt=" " style="outline:none;text-decoration:none;max-width:100%;display:block;width:40px;min-height:40px;border-radius:20px"></a>
138
  </td>
139
+ <td style="color:#272727"><a style="color:#272727;text-decoration:none;" href="http://www.inboundnow.com" target="_blank">
140
  '. __( '<b>Leads</b>
141
+ from Inbound Now' , 'ma' ) .'</a>
142
  </td>
143
  <td valign="middle" align="left" style="color:#545454;text-align:right">{{date-time}}</td>
144
  <td valign="middle" width="30" style="color:#272727">&nbsp;</td>
shared/tracking/new.store.lead.php CHANGED
@@ -154,7 +154,7 @@ if (!class_exists('LeadStorage')) {
154
  }
155
 
156
  /* Store Conversion Data to LANDING PAGE/CTA DATA */
157
- if (isset($lead['post_type']) && $lead['post_type'] == 'landing-page' || isset($lead['post_type']) && $lead['post_type'] == 'wp-call-to-action') {
158
  self::store_conversion_stats($lead);
159
  }
160
 
@@ -276,6 +276,7 @@ if (!class_exists('LeadStorage')) {
276
  $search_data = json_encode($search_data);
277
  update_post_meta($lead['id'], 'wpleads_search_data', $search_data); // Store search object
278
  }
 
279
  /**
280
  * updates conversion data object
281
  */
@@ -304,10 +305,10 @@ if (!class_exists('LeadStorage')) {
304
 
305
  }
306
  /**
307
- * Store Conversion Data to LANDING PAGE/CTA DATA
308
  */
309
  static function store_conversion_stats($lead){
310
- $page_conversion_data = get_post_meta( $lead['page_id'], 'inbound_conversion_data', TRUE );
311
  $page_conversion_data = json_decode($page_conversion_data,true);
312
  $version = ($lead['variation'] != 'default') ? $lead['variation'] : '0';
313
  if (is_array($page_conversion_data)) {
@@ -321,7 +322,7 @@ if (!class_exists('LeadStorage')) {
321
  $page_conversion_data[1]['datetime'] = $lead['wordpress_date_time'];
322
  }
323
  $page_conversion_data = json_encode($page_conversion_data);
324
- update_post_meta($lead['page_id'], 'inbound_conversion_data', $page_conversion_data);
325
  }
326
 
327
  /**
@@ -372,6 +373,7 @@ if (!class_exists('LeadStorage')) {
372
  */
373
  static function update_common_meta($lead) {
374
 
 
375
 
376
  if (!empty($lead['user_ID'])) {
377
  /* Update user_ID if exists */
@@ -393,11 +395,10 @@ if (!class_exists('LeadStorage')) {
393
  foreach ( $lead_fields as $key => $value ) {
394
  $shortkey = str_replace('wpleads_' , '' , $key );
395
  if (isset($lead[$shortkey])) {
396
- echo $key . ':' . $lead[$shortkey] . "\r\n";
397
  update_post_meta( $lead['id'], $key, $lead[$shortkey] );
398
  }
399
  }
400
-
401
  }
402
 
403
  /**
154
  }
155
 
156
  /* Store Conversion Data to LANDING PAGE/CTA DATA */
157
+ if (isset($lead['page_id'])) {
158
  self::store_conversion_stats($lead);
159
  }
160
 
276
  $search_data = json_encode($search_data);
277
  update_post_meta($lead['id'], 'wpleads_search_data', $search_data); // Store search object
278
  }
279
+
280
  /**
281
  * updates conversion data object
282
  */
305
 
306
  }
307
  /**
308
+ * Store Conversion Data to LANDING PAGE/CTA DATA
309
  */
310
  static function store_conversion_stats($lead){
311
+ $page_conversion_data = get_post_meta( $lead['page_id'], '_inbound_conversion_data', TRUE );
312
  $page_conversion_data = json_decode($page_conversion_data,true);
313
  $version = ($lead['variation'] != 'default') ? $lead['variation'] : '0';
314
  if (is_array($page_conversion_data)) {
322
  $page_conversion_data[1]['datetime'] = $lead['wordpress_date_time'];
323
  }
324
  $page_conversion_data = json_encode($page_conversion_data);
325
+ update_post_meta($lead['page_id'], '_inbound_conversion_data', $page_conversion_data);
326
  }
327
 
328
  /**
373
  */
374
  static function update_common_meta($lead) {
375
 
376
+ //print_r($lead);
377
 
378
  if (!empty($lead['user_ID'])) {
379
  /* Update user_ID if exists */
395
  foreach ( $lead_fields as $key => $value ) {
396
  $shortkey = str_replace('wpleads_' , '' , $key );
397
  if (isset($lead[$shortkey])) {
 
398
  update_post_meta( $lead['id'], $key, $lead[$shortkey] );
399
  }
400
  }
401
+ //exit;
402
  }
403
 
404
  /**
shared/tracking/store.lead.php CHANGED
@@ -79,14 +79,14 @@ add_action('wp_ajax_nopriv_inbound_store_lead', 'inbound_store_lead' ,10 , 1);
79
  */
80
  function inbound_store_lead( $args = array( ) , $return = false ) {
81
  global $user_ID, $wpdb;
82
-
83
  if (!is_array($args)) {
84
  $args = array();
85
  }
86
-
87
  /* Mergs $args with POST request for support of ajax and direct calls */
88
  $args = array_merge( $args , $_POST );
89
-
90
  /* Grab form values */
91
  $time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
92
  $lead_data['user_ID'] = $user_ID;
@@ -94,7 +94,7 @@ function inbound_store_lead( $args = array( ) , $return = false ) {
94
  $lead_data['wpleads_email_address'] = (isset($args['emailTo'])) ? $args['emailTo'] : false;
95
  $lead_data['page_views'] = (isset($args['page_views'])) ? $args['page_views'] : false;
96
  $lead_data['form_input_values'] = (isset($args['form_input_values'])) ? $args['form_input_values'] : false; // raw post data
97
-
98
  /* Attempt to populate lead data through mappped fields */
99
  $lead_data['Mapped_Data'] = (isset($args['Mapped_Data'] )) ? $args['Mapped_Data'] : false; // mapped data
100
  ($lead_data['Mapped_Data']) ? $mapped_data = json_decode(stripslashes($lead_data['Mapped_Data']), true ) : $mapped_data = array(); // mapped data array
@@ -134,7 +134,7 @@ function inbound_store_lead( $args = array( ) , $return = false ) {
134
  $lead_data = apply_filters( 'inboundnow_store_lead_pre_filter_data' , $lead_data , $args);
135
 
136
  do_action('inbound_store_lead_pre' , $lead_data , $args ); // Global lead storage action hook
137
-
138
  /* bail if spam */
139
  if (apply_filters( 'inbound_check_if_spam' , false , $lead_data )) {
140
  exit;
@@ -253,7 +253,7 @@ function inbound_store_lead( $args = array( ) , $return = false ) {
253
  /* Store Conversion Data to LANDING PAGE/CTA DATA */
254
  if ($lead_data['post_type'] == 'landing-page' || $lead_data['post_type'] == 'wp-call-to-action')
255
  {
256
- $page_conversion_data = get_post_meta( $lead_data['page_id'], 'inbound_conversion_data', TRUE );
257
  $page_conversion_data = json_decode($page_conversion_data,true);
258
  $version = ($lead_data['variation'] != 'default') ? $lead_data['variation'] : '0';
259
 
@@ -274,7 +274,7 @@ function inbound_store_lead( $args = array( ) , $return = false ) {
274
  }
275
 
276
  $page_conversion_data = json_encode($page_conversion_data);
277
- update_post_meta($lead_data['page_id'], 'inbound_conversion_data', $page_conversion_data);
278
  }
279
 
280
 
@@ -407,7 +407,7 @@ function inbound_add_conversion_to_lead( $lead_id, $lead_data ) {
407
 
408
 
409
  /**
410
- * Loop trough lead_data array and update post meta
411
  */
412
  function inbound_update_common_meta($lead_data)
413
  {
@@ -415,12 +415,12 @@ function inbound_update_common_meta($lead_data)
415
  if (!empty($lead_data['user_ID'])) {
416
  update_post_meta( $lead_data['lead_id'], 'wpleads_wordpress_user_id', $lead_data['user_ID'] );
417
  }
418
-
419
  /* Update wp_lead_uid if exist */
420
  if (!empty($lead_data['wp_lead_uid'])) {
421
  update_post_meta( $lead_data['lead_id'], 'wp_leads_uid', $lead_data['wp_lead_uid'] );
422
  }
423
-
424
  /* Update mappable fields */
425
  $lead_fields = Leads_Field_Map::build_map_array();
426
  foreach ( $lead_fields as $key => $value ) {
@@ -432,20 +432,20 @@ function inbound_update_common_meta($lead_data)
432
 
433
  /**
434
  * Connects to geoplugin.net and gets data on IP address and sets it into historical log
435
- * @param ARRAY $lead_data
436
  */
437
  function inbound_update_geolocation_data( $lead_data ) {
438
 
439
  $ip_addresses = get_post_meta( $lead_data['lead_id'] , 'wpleads_ip_address', true );
440
  $ip_addresses = json_decode( stripslashes($ip_addresses) , true);
441
-
442
  if (!$ip_addresses) {
443
  $ip_addresses = array();
444
  }
445
-
446
  $new_record[ $lead_data['ip_address'] ]['ip_address'] = $lead_data['ip_address'];
447
-
448
-
449
  /* ignore for local environments */
450
  if ($lead_data['ip_address']!= "127.0.0.1"){ // exclude localhost
451
  $response = wp_remote_get('http://www.geoplugin.net/php.gp?ip='.$lead_data['ip_address']);
@@ -453,12 +453,12 @@ function inbound_update_geolocation_data( $lead_data ) {
453
  $geo_array = @unserialize( $response['body'] );
454
  $new_record[ $lead_data['ip_address'] ]['geodata'] = $geo_array;
455
  }
456
-
457
  }
458
-
459
  $ip_addresses = array_merge( $new_record , $ip_addresses );
460
  $ip_addresses = json_encode( $ip_addresses );
461
-
462
  update_post_meta( $lead_data['lead_id'], 'wpleads_ip_address', $ip_addresses );
463
  }
464
 
@@ -481,14 +481,14 @@ function inbound_json_array_merge( $arr1, $arr2 ) {
481
 
482
 
483
  /**
484
- * Loop through field map looking for key matches in array
485
- * @param ARRAY $lead_data
486
- * @param ARRAY $args
487
- * @returns ARRAY $lead_data
488
  */
489
  function inbound_search_args_for_mapped_data( $lead_data , $args ) {
490
  $lead_fields = Leads_Field_Map::build_map_array();
491
-
492
  foreach ($lead_fields as $key => $label) {
493
  if (isset($args[$key]) && !empty($args[$key])) {
494
  $lead_data[$key] = $args[$key];
@@ -507,26 +507,26 @@ function inbound_check_lead_name( $lead_data ) {
507
  /* if last name empty and full name present */
508
  if ( empty($lead_data['wpleads_last_name']) && $lead_data['wpleads_full_name'] ) {
509
  $parts = explode(' ' , $lead_data['wpleads_full_name']);
510
-
511
  /* Set first name */
512
  $lead_data['wpleads_first_name'] = $parts[0];
513
-
514
  /* Set last name */
515
  if (isset($parts[1])) {
516
  $lead_data['wpleads_last_name'] = $parts[1];
517
  }
518
- }
519
  /* if last name empty and first name present */
520
  else if (empty($lead_data['wpleads_last_name']) && $lead_data['wpleads_first_name'] ) {
521
  $parts = explode(' ' , $lead_data['wpleads_first_name']);
522
-
523
  /* Set First Name */
524
  $lead_data['wpleads_first_name'] = $parts[0];
525
-
526
  /* Set Last Name */
527
  if (isset($parts[1])) {
528
  $lead_data['wpleads_last_name'] = $parts[1];
529
- }
530
  }
531
 
532
  return $lead_data;
@@ -537,29 +537,29 @@ add_action( 'inboundnow_store_lead_pre_filter_data' , 'inbound_check_lead_name'
537
  * Loads correct lead UID during a login
538
  */
539
  function inbound_load_tracking_cookie( $user_login, $user) {
540
-
541
  if (!isset($user->data->user_email)) {
542
  return;
543
  }
544
-
545
  global $wp_query;
546
-
547
  /* search leads cpt for record containing email & get UID */
548
  $results = new WP_Query( array( 'post_type' => 'wp-lead' , 's' => $user->data->user_email ) );
549
-
550
  if (!$results) {
551
  return;
552
  }
553
-
554
  if ( $results->have_posts() ) {
555
  while ( $results->have_posts() ) {
556
-
557
  $uid = get_post_meta( $results->post->ID , 'wp_leads_uid' , true );
558
-
559
  if ($uid) {
560
  setcookie( 'wp_lead_uid' , $uid , time() + (20 * 365 * 24 * 60 * 60),'/');
561
- }
562
-
563
  setcookie( 'wp_lead_id' , $results->post->ID , time() + (20 * 365 * 24 * 60 * 60),'/');
564
  return;
565
  }
@@ -587,6 +587,6 @@ function inbound_get_ip_address() {
587
  $ip = $_SERVER["REMOTE_ADDR"];
588
  }
589
  }
590
-
591
  return $ip;
592
  }
79
  */
80
  function inbound_store_lead( $args = array( ) , $return = false ) {
81
  global $user_ID, $wpdb;
82
+
83
  if (!is_array($args)) {
84
  $args = array();
85
  }
86
+
87
  /* Mergs $args with POST request for support of ajax and direct calls */
88
  $args = array_merge( $args , $_POST );
89
+
90
  /* Grab form values */
91
  $time = current_time( 'timestamp', 0 ); // Current wordpress time from settings
92
  $lead_data['user_ID'] = $user_ID;
94
  $lead_data['wpleads_email_address'] = (isset($args['emailTo'])) ? $args['emailTo'] : false;
95
  $lead_data['page_views'] = (isset($args['page_views'])) ? $args['page_views'] : false;
96
  $lead_data['form_input_values'] = (isset($args['form_input_values'])) ? $args['form_input_values'] : false; // raw post data
97
+
98
  /* Attempt to populate lead data through mappped fields */
99
  $lead_data['Mapped_Data'] = (isset($args['Mapped_Data'] )) ? $args['Mapped_Data'] : false; // mapped data
100
  ($lead_data['Mapped_Data']) ? $mapped_data = json_decode(stripslashes($lead_data['Mapped_Data']), true ) : $mapped_data = array(); // mapped data array
134
  $lead_data = apply_filters( 'inboundnow_store_lead_pre_filter_data' , $lead_data , $args);
135
 
136
  do_action('inbound_store_lead_pre' , $lead_data , $args ); // Global lead storage action hook
137
+
138
  /* bail if spam */
139
  if (apply_filters( 'inbound_check_if_spam' , false , $lead_data )) {
140
  exit;
253
  /* Store Conversion Data to LANDING PAGE/CTA DATA */
254
  if ($lead_data['post_type'] == 'landing-page' || $lead_data['post_type'] == 'wp-call-to-action')
255
  {
256
+ $page_conversion_data = get_post_meta( $lead_data['page_id'], '_inbound_conversion_data', TRUE );
257
  $page_conversion_data = json_decode($page_conversion_data,true);
258
  $version = ($lead_data['variation'] != 'default') ? $lead_data['variation'] : '0';
259
 
274
  }
275
 
276
  $page_conversion_data = json_encode($page_conversion_data);
277
+ update_post_meta($lead_data['page_id'], '_inbound_conversion_data', $page_conversion_data);
278
  }
279
 
280
 
407
 
408
 
409
  /**
410
+ * Loop trough lead_data array and update post meta
411
  */
412
  function inbound_update_common_meta($lead_data)
413
  {
415
  if (!empty($lead_data['user_ID'])) {
416
  update_post_meta( $lead_data['lead_id'], 'wpleads_wordpress_user_id', $lead_data['user_ID'] );
417
  }
418
+
419
  /* Update wp_lead_uid if exist */
420
  if (!empty($lead_data['wp_lead_uid'])) {
421
  update_post_meta( $lead_data['lead_id'], 'wp_leads_uid', $lead_data['wp_lead_uid'] );
422
  }
423
+
424
  /* Update mappable fields */
425
  $lead_fields = Leads_Field_Map::build_map_array();
426
  foreach ( $lead_fields as $key => $value ) {
432
 
433
  /**
434
  * Connects to geoplugin.net and gets data on IP address and sets it into historical log
435
+ * @param ARRAY $lead_data
436
  */
437
  function inbound_update_geolocation_data( $lead_data ) {
438
 
439
  $ip_addresses = get_post_meta( $lead_data['lead_id'] , 'wpleads_ip_address', true );
440
  $ip_addresses = json_decode( stripslashes($ip_addresses) , true);
441
+
442
  if (!$ip_addresses) {
443
  $ip_addresses = array();
444
  }
445
+
446
  $new_record[ $lead_data['ip_address'] ]['ip_address'] = $lead_data['ip_address'];
447
+
448
+
449
  /* ignore for local environments */
450
  if ($lead_data['ip_address']!= "127.0.0.1"){ // exclude localhost
451
  $response = wp_remote_get('http://www.geoplugin.net/php.gp?ip='.$lead_data['ip_address']);
453
  $geo_array = @unserialize( $response['body'] );
454
  $new_record[ $lead_data['ip_address'] ]['geodata'] = $geo_array;
455
  }
456
+
457
  }
458
+
459
  $ip_addresses = array_merge( $new_record , $ip_addresses );
460
  $ip_addresses = json_encode( $ip_addresses );
461
+
462
  update_post_meta( $lead_data['lead_id'], 'wpleads_ip_address', $ip_addresses );
463
  }
464
 
481
 
482
 
483
  /**
484
+ * Loop through field map looking for key matches in array
485
+ * @param ARRAY $lead_data
486
+ * @param ARRAY $args
487
+ * @returns ARRAY $lead_data
488
  */
489
  function inbound_search_args_for_mapped_data( $lead_data , $args ) {
490
  $lead_fields = Leads_Field_Map::build_map_array();
491
+
492
  foreach ($lead_fields as $key => $label) {
493
  if (isset($args[$key]) && !empty($args[$key])) {
494
  $lead_data[$key] = $args[$key];
507
  /* if last name empty and full name present */
508
  if ( empty($lead_data['wpleads_last_name']) && $lead_data['wpleads_full_name'] ) {
509
  $parts = explode(' ' , $lead_data['wpleads_full_name']);
510
+
511
  /* Set first name */
512
  $lead_data['wpleads_first_name'] = $parts[0];
513
+
514
  /* Set last name */
515
  if (isset($parts[1])) {
516
  $lead_data['wpleads_last_name'] = $parts[1];
517
  }
518
+ }
519
  /* if last name empty and first name present */
520
  else if (empty($lead_data['wpleads_last_name']) && $lead_data['wpleads_first_name'] ) {
521
  $parts = explode(' ' , $lead_data['wpleads_first_name']);
522
+
523
  /* Set First Name */
524
  $lead_data['wpleads_first_name'] = $parts[0];
525
+
526
  /* Set Last Name */
527
  if (isset($parts[1])) {
528
  $lead_data['wpleads_last_name'] = $parts[1];
529
+ }
530
  }
531
 
532
  return $lead_data;
537
  * Loads correct lead UID during a login
538
  */
539
  function inbound_load_tracking_cookie( $user_login, $user) {
540
+
541
  if (!isset($user->data->user_email)) {
542
  return;
543
  }
544
+
545
  global $wp_query;
546
+
547
  /* search leads cpt for record containing email & get UID */
548
  $results = new WP_Query( array( 'post_type' => 'wp-lead' , 's' => $user->data->user_email ) );
549
+
550
  if (!$results) {
551
  return;
552
  }
553
+
554
  if ( $results->have_posts() ) {
555
  while ( $results->have_posts() ) {
556
+
557
  $uid = get_post_meta( $results->post->ID , 'wp_leads_uid' , true );
558
+
559
  if ($uid) {
560
  setcookie( 'wp_lead_uid' , $uid , time() + (20 * 365 * 24 * 60 * 60),'/');
561
+ }
562
+
563
  setcookie( 'wp_lead_id' , $results->post->ID , time() + (20 * 365 * 24 * 60 * 60),'/');
564
  return;
565
  }
587
  $ip = $_SERVER["REMOTE_ADDR"];
588
  }
589
  }
590
+
591
  return $ip;
592
  }
templates/svtle/index.php CHANGED
@@ -168,7 +168,7 @@ $blue = (isset($RBG_array['b'])) ? $RBG_array['b'] : '0';
168
  <h1 class="entry-title"><?php the_title(); ?></h1>
169
 
170
  <div class="entry-content">
171
- <?php echo do_shortcode( $content ); ?>
172
  </div>
173
  </article>
174
  </section>
168
  <h1 class="entry-title"><?php the_title(); ?></h1>
169
 
170
  <div class="entry-content">
171
+ <?php echo do_shortcode( wpautop($content) ); ?>
172
  </div>
173
  </article>
174
  </section>