HubSpot – Free Marketing Plugin for WordPress - Version 2.2.10

Version Description

(2014.01.26) =

Download this release

Release Info

Developer AndyGCook
Plugin Icon 128x128 HubSpot – Free Marketing Plugin for WordPress
Version 2.2.10
Comparing to
See all releases

Code changes from version 2.2.9 to 2.2.10

admin/inc/class-leadin-list-table.php CHANGED
@@ -337,8 +337,14 @@ class LI_List_Table extends WP_List_Table {
337
  // search filter
338
  if ( isset($_GET['s']) )
339
  {
 
 
 
 
 
 
340
  $search_query = $_GET['s'];
341
- $mysql_search_filter = $wpdb->prepare(" AND ( l.lead_email LIKE '%%%s%%' OR l.lead_source LIKE '%%%s%%' ) ", $wpdb->esc_like($search_query), $wpdb->esc_like($search_query));
342
  }
343
 
344
  $filtered_contacts = array();
337
  // search filter
338
  if ( isset($_GET['s']) )
339
  {
340
+ $escaped_query = '';
341
+ if ( $wp_version >= 4 )
342
+ $escaped_query = $wpdb->esc_like($_GET['s']);
343
+ else
344
+ $escaped_query = like_escape($_GET['s']);
345
+
346
  $search_query = $_GET['s'];
347
+ $mysql_search_filter = $wpdb->prepare(" AND ( l.lead_email LIKE '%%%s%%' OR l.lead_source LIKE '%%%s%%' ) ", $escaped_query, $escaped_query);
348
  }
349
 
350
  $filtered_contacts = array();
admin/inc/class-leadin-tag-editor.php CHANGED
@@ -196,7 +196,7 @@ class LI_Tag_Editor {
196
  function get_contacts_in_tagged_list ( $tag_id = 0 )
197
  {
198
  global $wpdb;
199
- $q = $wpdb->prepare("SELECT contact_hashkey, lead_email FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE ltr.contact_hashkey = ll.hashkey AND ltr.tag_id = %d", $tag_id);
200
  $contacts = $wpdb->get_results($q);
201
  return $contacts;
202
  }
196
  function get_contacts_in_tagged_list ( $tag_id = 0 )
197
  {
198
  global $wpdb;
199
+ $q = $wpdb->prepare("SELECT contact_hashkey, lead_email, lead_first_name, lead_last_name FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE ltr.contact_hashkey = ll.hashkey AND ltr.tag_id = %d AND ltr.tag_relationship_deleted = 0", $tag_id);
200
  $contacts = $wpdb->get_results($q);
201
  return $contacts;
202
  }
admin/inc/class-leadin-tags-list-table.php CHANGED
@@ -156,7 +156,7 @@ class LI_Tags_Table extends WP_List_Table {
156
  {
157
  global $wpdb;
158
 
159
- $q = $wpdb->prepare("
160
  SELECT
161
  lt.tag_text, lt.tag_slug, lt.tag_synced_lists, lt.tag_form_selectors, lt.tag_order, lt.tag_id,
162
  ( SELECT COUNT(DISTINCT contact_hashkey) FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE tag_id = lt.tag_id AND ltr.tag_relationship_deleted = 0 AND ltr.contact_hashkey != '' AND ll.hashkey = ltr.contact_hashkey AND ll.lead_deleted = 0 AND ll.hashkey != '' GROUP BY tag_id ) AS tag_count
@@ -165,7 +165,7 @@ class LI_Tags_Table extends WP_List_Table {
165
  WHERE
166
  lt.tag_deleted = 0
167
  GROUP BY lt.tag_slug
168
- ORDER BY lt.tag_order ASC", "");
169
 
170
  $tags = $wpdb->get_results($q);
171
 
156
  {
157
  global $wpdb;
158
 
159
+ $q = "
160
  SELECT
161
  lt.tag_text, lt.tag_slug, lt.tag_synced_lists, lt.tag_form_selectors, lt.tag_order, lt.tag_id,
162
  ( SELECT COUNT(DISTINCT contact_hashkey) FROM $wpdb->li_tag_relationships ltr, $wpdb->li_leads ll WHERE tag_id = lt.tag_id AND ltr.tag_relationship_deleted = 0 AND ltr.contact_hashkey != '' AND ll.hashkey = ltr.contact_hashkey AND ll.lead_deleted = 0 AND ll.hashkey != '' GROUP BY tag_id ) AS tag_count
165
  WHERE
166
  lt.tag_deleted = 0
167
  GROUP BY lt.tag_slug
168
+ ORDER BY lt.tag_order ASC";
169
 
170
  $tags = $wpdb->get_results($q);
171
 
admin/leadin-admin.php CHANGED
@@ -62,6 +62,10 @@ class WPLeadInAdmin {
62
  //=============================================
63
 
64
  $options = get_option('leadin_options');
 
 
 
 
65
  $this->action = $this->leadin_current_action();
66
 
67
  // If the plugin version matches the latest version escape the update function
62
  //=============================================
63
 
64
  $options = get_option('leadin_options');
65
+
66
+ if ( is_multisite() )
67
+ $options = leadin_check_multisite_missing_options($options);
68
+
69
  $this->action = $this->leadin_current_action();
70
 
71
  // If the plugin version matches the latest version escape the update function
inc/leadin-ajax-functions.php CHANGED
@@ -14,11 +14,18 @@ if ( !defined('LEADIN_PLUGIN_VERSION') )
14
  function leadin_check_merged_contact ()
15
  {
16
  global $wpdb;
 
17
 
18
  $stale_hash = $_POST['li_id'];
19
 
 
 
 
 
 
 
20
  // Check if hashkey is in a merged contact
21
- $q = $wpdb->prepare("SELECT hashkey, merged_hashkeys FROM $wpdb->li_leads WHERE merged_hashkeys LIKE '%%%s%%'", $wpdb->esc_like($stale_hash));
22
  $row = $wpdb->get_row($q);
23
 
24
  if ( isset($row->hashkey) && $stale_hash )
@@ -271,8 +278,11 @@ function leadin_insert_form_submission ()
271
  $leadin_esp_wp = 'leadin_' . $synced_list['esp'] . '_connect_wp';
272
  global ${$leadin_esp_wp};
273
 
274
- if ( ${$leadin_esp_wp}->activated )
275
- ${$leadin_esp_wp}->push_contact_to_list($synced_list['list_id'], $email, $first_name, $last_name, $phone);
 
 
 
276
  }
277
  }
278
  }
14
  function leadin_check_merged_contact ()
15
  {
16
  global $wpdb;
17
+ global $wp_version;
18
 
19
  $stale_hash = $_POST['li_id'];
20
 
21
+ $escaped_hash = '';
22
+ if ( $wp_version >= 4 )
23
+ $escaped_hash = $wpdb->esc_like($stale_hash);
24
+ else
25
+ $escaped_hash = like_escape($stale_hash);
26
+
27
  // Check if hashkey is in a merged contact
28
+ $q = $wpdb->prepare("SELECT hashkey, merged_hashkeys FROM $wpdb->li_leads WHERE merged_hashkeys LIKE '%%%s%%'", $escaped_hash);
29
  $row = $wpdb->get_row($q);
30
 
31
  if ( isset($row->hashkey) && $stale_hash )
278
  $leadin_esp_wp = 'leadin_' . $synced_list['esp'] . '_connect_wp';
279
  global ${$leadin_esp_wp};
280
 
281
+ if ( isset(${$leadin_esp_wp}) )
282
+ {
283
+ if ( ${$leadin_esp_wp}->activated )
284
+ ${$leadin_esp_wp}->push_contact_to_list($synced_list['list_id'], $email, $first_name, $last_name, $phone);
285
+ }
286
  }
287
  }
288
  }
inc/leadin-functions.php CHANGED
@@ -835,4 +835,36 @@ function leadin_ignore_logged_in_user ()
835
  return FALSE;
836
  }
837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
838
  ?>
835
  return FALSE;
836
  }
837
 
838
+ function leadin_check_multisite_missing_options ( $options )
839
+ {
840
+ $default_options = array(
841
+ 'li_installed' => 1,
842
+ 'leadin_version' => LEADIN_PLUGIN_VERSION,
843
+ 'li_db_version' => LEADIN_DB_VERSION,
844
+ 'li_email' => get_bloginfo('admin_email'),
845
+ 'li_updates_subscription' => 1,
846
+ 'onboarding_step' => 1,
847
+ 'onboarding_complete' => 0,
848
+ 'ignore_settings_popup' => 0,
849
+ 'data_recovered' => 1,
850
+ 'delete_flags_fixed' => 1,
851
+ 'beta_tester' => 0,
852
+ 'converted_to_tags' => 1,
853
+ 'names_added_to_contacts' => 1
854
+ );
855
+
856
+ if ( count($options) && is_array($options) )
857
+ {
858
+ foreach ( $default_options as $key => $value )
859
+ {
860
+ if ( ! array_key_exists($key, $options) )
861
+ $options[$key] = $value;
862
+ }
863
+ }
864
+
865
+ update_option('leadin_options', $options);
866
+
867
+ return $options;
868
+ }
869
+
870
  ?>
leadin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Leadin
4
  Plugin URI: http://leadin.com
5
  Description: Leadin is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
6
- Version: 2.2.9
7
  Author: Andy Cook, Nelson Joyce
8
  Author URI: http://leadin.com
9
  License: GPL2
@@ -26,7 +26,7 @@ if ( !defined('LEADIN_DB_VERSION') )
26
  define('LEADIN_DB_VERSION', '2.2.4');
27
 
28
  if ( !defined('LEADIN_PLUGIN_VERSION') )
29
- define('LEADIN_PLUGIN_VERSION', '2.2.9');
30
 
31
  if ( !defined('MC_KEY') )
32
  define('MC_KEY', '934aaed05049dde737d308be26167eef-us3');
@@ -105,6 +105,7 @@ function add_leadin_defaults ( )
105
  {
106
  $opt = array(
107
  'li_installed' => 1,
 
108
  'li_db_version' => LEADIN_DB_VERSION,
109
  'li_email' => get_bloginfo('admin_email'),
110
  'li_updates_subscription' => 1,
3
  Plugin Name: Leadin
4
  Plugin URI: http://leadin.com
5
  Description: Leadin is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
6
+ Version: 2.2.10
7
  Author: Andy Cook, Nelson Joyce
8
  Author URI: http://leadin.com
9
  License: GPL2
26
  define('LEADIN_DB_VERSION', '2.2.4');
27
 
28
  if ( !defined('LEADIN_PLUGIN_VERSION') )
29
+ define('LEADIN_PLUGIN_VERSION', '2.2.10');
30
 
31
  if ( !defined('MC_KEY') )
32
  define('MC_KEY', '934aaed05049dde737d308be26167eef-us3');
105
  {
106
  $opt = array(
107
  'li_installed' => 1,
108
+ 'leadin_version' => LEADIN_PLUGIN_VERSION,
109
  'li_db_version' => LEADIN_DB_VERSION,
110
  'li_email' => get_bloginfo('admin_email'),
111
  'li_updates_subscription' => 1,
power-ups/contacts/admin/contacts-admin.php CHANGED
@@ -505,6 +505,8 @@ class WPLeadInContactsAdmin extends WPLeadInAdmin {
505
  if ( isset($_POST['export-all']) || isset($_POST['export-selected']) )
506
  {
507
  global $wpdb;
 
 
508
  leadin_set_wpdb_tables();
509
  leadin_set_mysql_timezone_offset();
510
 
@@ -542,8 +544,14 @@ if ( isset($_POST['export-all']) || isset($_POST['export-selected']) )
542
  // search filter
543
  if ( isset($_GET['s']) )
544
  {
 
 
 
 
 
 
545
  $search_query = $_GET['s'];
546
- $mysql_search_filter = $wpdb->prepare(" AND ( l.lead_email LIKE '%%%s%%' OR l.lead_source LIKE '%%%s%%' ) ", $wpdb->esc_like($search_query), $wpdb->esc_like($search_query));
547
  }
548
 
549
  // @TODO - need to modify the filters to pull down the form ID types
505
  if ( isset($_POST['export-all']) || isset($_POST['export-selected']) )
506
  {
507
  global $wpdb;
508
+ global $wp_version;
509
+
510
  leadin_set_wpdb_tables();
511
  leadin_set_mysql_timezone_offset();
512
 
544
  // search filter
545
  if ( isset($_GET['s']) )
546
  {
547
+ $escaped_query = '';
548
+ if ( $wp_version >= 4 )
549
+ $escaped_query = $wpdb->esc_like($_GET['s']);
550
+ else
551
+ $escaped_query = like_escape($_GET['s']);
552
+
553
  $search_query = $_GET['s'];
554
+ $mysql_search_filter = $wpdb->prepare(" AND ( l.lead_email LIKE '%%%s%%' OR l.lead_source LIKE '%%%s%%' ) ", $escaped_query, $escaped_query);
555
  }
556
 
557
  // @TODO - need to modify the filters to pull down the form ID types
power-ups/mailchimp-connect.php CHANGED
@@ -157,8 +157,20 @@ class WPMailChimpConnect extends WPLeadIn {
157
  $MailChimp = new LI_MailChimp($this->options['li_mls_api_key']);
158
 
159
  $batch_contacts = array();
160
- foreach ( $contacts as $contact )
161
- array_push($batch_contacts, array('email' => array('email' => $contact->lead_email)));
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  $list_updated = $MailChimp->call("lists/batch-subscribe", array(
164
  "id" => $list_id,
@@ -167,7 +179,7 @@ class WPMailChimpConnect extends WPLeadIn {
167
  "update_existing" => TRUE,
168
  'replace_interests' => FALSE,
169
  'double_optin' => FALSE,
170
- "batch" => $batch_contacts
171
  ));
172
 
173
  return $list_updated;
157
  $MailChimp = new LI_MailChimp($this->options['li_mls_api_key']);
158
 
159
  $batch_contacts = array();
160
+ if ( count($contacts) )
161
+ {
162
+ foreach ( $contacts as $contact )
163
+ {
164
+ array_push($batch_contacts, array(
165
+ 'email' => array('email' => $contact->lead_email),
166
+ 'merge_vars' => array(
167
+ 'EMAIL' => $contact->lead_email,
168
+ 'FNAME' => $contact->lead_first_name,
169
+ 'LNAME' => $contact->lead_last_name
170
+ ))
171
+ );
172
+ }
173
+ }
174
 
175
  $list_updated = $MailChimp->call("lists/batch-subscribe", array(
176
  "id" => $list_id,
179
  "update_existing" => TRUE,
180
  'replace_interests' => FALSE,
181
  'double_optin' => FALSE,
182
+ "batch" => $batch_contacts,
183
  ));
184
 
185
  return $list_updated;
power-ups/mailchimp-connect/inc/MailChimp-API.php CHANGED
@@ -71,7 +71,6 @@ class LI_MailChimp
71
  $result = curl_exec($ch);
72
  curl_close($ch);
73
 
74
-
75
  } else {
76
  $json_data = json_encode($args);
77
  $result = file_get_contents($url, null, stream_context_create(array(
71
  $result = curl_exec($ch);
72
  curl_close($ch);
73
 
 
74
  } else {
75
  $json_data = json_encode($args);
76
  $result = file_get_contents($url, null, stream_context_create(array(
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: andygcook, nelsonjoyce
3
  Tags: crm, contacts, lead tracking, click tracking, visitor tracking, analytics, marketing automation, inbound marketing, subscription, marketing, lead generation, mailchimp, constant contact, newsletter, popup, popover, email list, email, contacts database, contact form, forms, form widget, popup form
4
  Requires at least: 3.7
5
  Tested up to: 4.1
6
- Stable tag: 2.2.9
7
 
8
  Leadin is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
9
 
@@ -90,6 +90,7 @@ To ensure quality we've tested the most popular WordPress form builder plugins.
90
  - Easy Contact Forms
91
  - Disqus comments
92
  - SumoMe
 
93
  - Forms contained in an iFrame
94
 
95
  = Does Leadin work on Multisite? =
@@ -107,8 +108,19 @@ You betcha! Leadin should work just fine on Multisite right out-of-the-box witho
107
 
108
  == Changelog ==
109
 
110
- - Current version: 2.2.9
111
- - Current version release: 2014-01-20
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  = 2.2.9 (2014.01.20) =
114
  = Enhancements =
3
  Tags: crm, contacts, lead tracking, click tracking, visitor tracking, analytics, marketing automation, inbound marketing, subscription, marketing, lead generation, mailchimp, constant contact, newsletter, popup, popover, email list, email, contacts database, contact form, forms, form widget, popup form
4
  Requires at least: 3.7
5
  Tested up to: 4.1
6
+ Stable tag: 2.2.10
7
 
8
  Leadin is an easy-to-use marketing automation and lead tracking plugin for WordPress that helps you better understand your web site visitors.
9
 
90
  - Easy Contact Forms
91
  - Disqus comments
92
  - SumoMe
93
+ - JotForm
94
  - Forms contained in an iFrame
95
 
96
  = Does Leadin work on Multisite? =
108
 
109
  == Changelog ==
110
 
111
+ - Current version: 2.2.10
112
+ - Current version release: 2014-01-26
113
+
114
+ = 2.2.10 (2014.01.26) =
115
+ = Enhancements =
116
+ - Tested JotForm + added compatibility to the ReadMe file
117
+
118
+ - Bug fixes
119
+ - Add in support for like_escape for < WordPress 4.0
120
+ - Add first + last names to bulk MailChimp connector
121
+ - Remove rogue WPDB prepare in tag list table
122
+ - Check for existence of ESP connector when pushing to an email list
123
+ - Bug fix for multisite installs with broken onboarding
124
 
125
  = 2.2.9 (2014.01.20) =
126
  = Enhancements =