HubSpot – Free Marketing Plugin for WordPress - Version 3.1.9

Version Description

(2015.05.26) =

  • Bug fixes
  • Removed the check on the front-end for missing databases - that was a bad idea - fixed now
  • Removed the file_get_contents hack for SVG support and just used an image instead
  • Added in support for "phone number" field name to push phone number to ESPs
Download this release

Release Info

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

Code changes from version 3.1.8 to 3.1.9

admin/leadin-admin.php CHANGED
@@ -264,17 +264,11 @@ class WPLeadInAdmin {
264
 
265
  self::check_admin_action();
266
 
267
- if ( ini_get('allow_url_fopen') )
268
- $leadin_icon = ($wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? LEADIN_PATH . '/images/leadin-icon-16x16.png' : 'data:image/svg+xml;base64,' . base64_encode(file_get_contents(LEADIN_PATH . '/images/leadin-svg-icon.svg')));
269
- else
270
- {
271
-
272
- $leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16.png';
273
- }
274
 
275
  add_menu_page('Leadin', 'Leadin', $capability, 'leadin_stats', array($this, 'leadin_build_stats_page'), $leadin_icon , '25.100713');
276
 
277
- if ( count(leadin_check_tables_exist()) == 5 )
278
  {
279
  foreach ( $this->admin_power_ups as $power_up )
280
  {
@@ -400,34 +394,27 @@ class WPLeadInAdmin {
400
  {
401
  global $wp_version;
402
 
403
- if ( count(leadin_check_tables_exist()) == 5 )
404
- {
405
- $this->stats_dashboard = new LI_StatsDashboard();
406
-
407
- echo '<div id="leadin" class="li-stats wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
408
-
409
- $this->leadin_header('Leadin Stats: ' . date('F j Y, g:ia', current_time('timestamp')), 'leadin-stats__header', 'Loaded Stats Page');
410
 
411
- echo '<div class="leadin-stats__top-container">';
412
- echo $this->leadin_postbox('leadin-stats__chart', leadin_single_plural_label(number_format($this->stats_dashboard->total_contacts_last_30_days), 'new contact', 'new contacts') . ' last 30 days', $this->leadin_build_contacts_chart_stats());
413
- echo '</div>';
414
 
415
- echo '<div class="leadin-stats__postbox_containter">';
416
- echo $this->leadin_postbox('leadin-stats__new-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_new_contacts), 'new contact', 'new contacts') . ' today', $this->leadin_build_new_contacts_postbox());
417
- echo $this->leadin_postbox('leadin-stats__returning-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_returning_contacts), 'returning contact', 'returning contacts') . ' today', $this->leadin_build_returning_contacts_postbox());
418
- echo '</div>';
419
 
 
420
 
 
 
 
421
 
422
- echo '<div class="leadin-stats__postbox_containter">';
423
- echo $this->leadin_postbox('leadin-stats__sources', 'New contact sources last 30 days', $this->leadin_build_sources_postbox());
424
- echo '</div>';
425
- }
426
- else
427
- {
428
- $this->leadin_header(' ', 'leadin-stats__header', 'Error - No Database Tables');
429
 
430
- }
 
 
 
 
431
 
432
  $this->leadin_footer();
433
  }
@@ -1753,9 +1740,7 @@ class WPLeadInAdmin {
1753
  {
1754
  $li_options = get_option('leadin_options');
1755
 
1756
- // if database doesn't exist then don't
1757
- if ( $event_name != 'Error - No Database Tables' )
1758
- $leadin_user = leadin_get_current_user();
1759
  ?>
1760
 
1761
  <?php if ( leadin_check_pro_user() ) : ?>
@@ -1807,57 +1792,41 @@ class WPLeadInAdmin {
1807
  </div>
1808
  <?php endif; ?>
1809
 
1810
- <?php if ( $event_name != 'Error - No Database Tables' ) : ?>
1811
- <?php if ( $li_options['onboarding_complete'] ) : ?>
1812
 
1813
- <?php if ( isset($_GET['settings-updated']) ) : ?>
1814
- <div id="message" class="updated">
1815
- <p><strong><?php _e('Settings saved.') ?></strong></p>
1816
- </div>
1817
 
1818
- <?php
1819
- foreach ( $this->esp_power_ups as $power_up_name => $power_up_slug )
 
 
1820
  {
1821
- if ( WPLeadIn::is_power_up_active($power_up_slug) )
1822
- {
1823
- global ${'leadin_' . $power_up_slug . '_wp'}; // e.g leadin_mailchimp_connect_wp
1824
- $esp_name = strtolower(str_replace('_connect', '', $power_up_slug)); // e.g. mailchimp
1825
 
1826
- if ( ${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key )
1827
- {
1828
- echo '<div id="message" class="error">';
1829
- echo '<p>' . 'Your ' . $power_up_name . ' key seems to not be correct.' . '</p>';
1830
- echo '</div>';
1831
- }
1832
  }
1833
  }
1834
- ?>
1835
- <?php elseif ( $this->has_leads() == FALSE ) : ?>
1836
- <div id="message" class="updated">
1837
- <p>Leadin is set up and waiting for a form submission... Need help? <a href="http://wordpress.org/support/plugin/leadin">Contact Us</a>.</p>
1838
- </div>
1839
- <?php elseif ( !leadin_check_pro_user() ) : ?>
1840
- <div id="message" class="updated">
1841
- <p>Did you know that Leadin Pro is a free upgrade with even more feaures? <a href="<?php echo admin_url(); ?>admin.php?page=leadin_pro_upgrade">Learn more</a>.</p>
1842
- </div>
1843
- <?php endif; ?>
1844
  <?php endif; ?>
1845
- <?php else : ?>
1846
- <div style="border-left: 4px solid #dd3d36; padding: 12px; margin-bottom: 25px; background: #fff;">
1847
- <h3><b>Your Leadin database tables are missing</b></h3>
1848
- <p>
1849
- The usual cause of this problem is that occasionally backup plugins drop the database tables created by Leadin which breaks your install and deletes your data.
1850
-
1851
- Unfortunately we can't restore the data for you because we don't have access to your WordPress server.<br/><br/>
1852
-
1853
- Sorry about the issue... we know this is a big bummer, so we actually built a version of Leadin that stores your data in our <b>securely encrypted, regularly backed-up servers</b> so you're guaranteed to <b>never lose your data again</b>. <br><br>To sweeten the deal for you, Leadin Cloud is 100% free to use.
1854
-
1855
- <p><a href="http://leadin.com" target="_blank" class="button button-primary">Sign up for Leadin Cloud for Free</a></p>
1856
- <p>You can also recreate the missing tables in your MySQL database if you'd prefer to store your data on your own server - <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=leadin_stats&action=restore_tables'; ?>">Click here to restore the default Leadin tables</a></p>
1857
- </p>
1858
- </div>
1859
  <?php endif; ?>
1860
-
1861
  <?php
1862
  }
1863
 
264
 
265
  self::check_admin_action();
266
 
267
+ $leadin_icon = LEADIN_PATH . '/images/leadin-icon-16x16.png';
 
 
 
 
 
 
268
 
269
  add_menu_page('Leadin', 'Leadin', $capability, 'leadin_stats', array($this, 'leadin_build_stats_page'), $leadin_icon , '25.100713');
270
 
271
+ if ( count($this->admin_power_ups) )
272
  {
273
  foreach ( $this->admin_power_ups as $power_up )
274
  {
394
  {
395
  global $wp_version;
396
 
 
 
 
 
 
 
 
397
 
398
+ $this->stats_dashboard = new LI_StatsDashboard();
 
 
399
 
400
+ echo '<div id="leadin" class="li-stats wrap '. ( $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? 'pre-mp6' : ''). '">';
 
 
 
401
 
402
+ $this->leadin_header('Leadin Stats: ' . date('F j Y, g:ia', current_time('timestamp')), 'leadin-stats__header', 'Loaded Stats Page');
403
 
404
+ echo '<div class="leadin-stats__top-container">';
405
+ echo $this->leadin_postbox('leadin-stats__chart', leadin_single_plural_label(number_format($this->stats_dashboard->total_contacts_last_30_days), 'new contact', 'new contacts') . ' last 30 days', $this->leadin_build_contacts_chart_stats());
406
+ echo '</div>';
407
 
408
+ echo '<div class="leadin-stats__postbox_containter">';
409
+ echo $this->leadin_postbox('leadin-stats__new-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_new_contacts), 'new contact', 'new contacts') . ' today', $this->leadin_build_new_contacts_postbox());
410
+ echo $this->leadin_postbox('leadin-stats__returning-contacts', leadin_single_plural_label(number_format($this->stats_dashboard->total_returning_contacts), 'returning contact', 'returning contacts') . ' today', $this->leadin_build_returning_contacts_postbox());
411
+ echo '</div>';
 
 
 
412
 
413
+
414
+
415
+ echo '<div class="leadin-stats__postbox_containter">';
416
+ echo $this->leadin_postbox('leadin-stats__sources', 'New contact sources last 30 days', $this->leadin_build_sources_postbox());
417
+ echo '</div>';
418
 
419
  $this->leadin_footer();
420
  }
1740
  {
1741
  $li_options = get_option('leadin_options');
1742
 
1743
+ $leadin_user = leadin_get_current_user();
 
 
1744
  ?>
1745
 
1746
  <?php if ( leadin_check_pro_user() ) : ?>
1792
  </div>
1793
  <?php endif; ?>
1794
 
1795
+
1796
+ <?php if ( $li_options['onboarding_complete'] ) : ?>
1797
 
1798
+ <?php if ( isset($_GET['settings-updated']) ) : ?>
1799
+ <div id="message" class="updated">
1800
+ <p><strong><?php _e('Settings saved.') ?></strong></p>
1801
+ </div>
1802
 
1803
+ <?php
1804
+ foreach ( $this->esp_power_ups as $power_up_name => $power_up_slug )
1805
+ {
1806
+ if ( WPLeadIn::is_power_up_active($power_up_slug) )
1807
  {
1808
+ global ${'leadin_' . $power_up_slug . '_wp'}; // e.g leadin_mailchimp_connect_wp
1809
+ $esp_name = strtolower(str_replace('_connect', '', $power_up_slug)); // e.g. mailchimp
 
 
1810
 
1811
+ if ( ${'leadin_' . $power_up_slug . '_wp'}->admin->invalid_key )
1812
+ {
1813
+ echo '<div id="message" class="error">';
1814
+ echo '<p>' . 'Your ' . $power_up_name . ' key seems to not be correct.' . '</p>';
1815
+ echo '</div>';
 
1816
  }
1817
  }
1818
+ }
1819
+ ?>
1820
+ <?php elseif ( $this->has_leads() == FALSE ) : ?>
1821
+ <div id="message" class="updated">
1822
+ <p>Leadin is set up and waiting for a form submission... Need help? <a href="http://wordpress.org/support/plugin/leadin">Contact Us</a>.</p>
1823
+ </div>
1824
+ <?php elseif ( !leadin_check_pro_user() ) : ?>
1825
+ <div id="message" class="updated">
1826
+ <p>Did you know that Leadin Pro is a free upgrade with even more feaures? <a href="<?php echo admin_url(); ?>admin.php?page=leadin_pro_upgrade">Learn more</a>.</p>
1827
+ </div>
1828
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1829
  <?php endif; ?>
 
1830
  <?php
1831
  }
1832
 
assets/js/build/leadin-tracking.js CHANGED
@@ -379,7 +379,7 @@ function leadin_submit_form ( $form, $ )
379
  {
380
  if ( $element.attr('id') == 'leadin-subscribe-phone' )
381
  lead_phone = $value;
382
- else if ( lower_label_text == 'phone' || lower_label_text == 'phone' )
383
  lead_phone = $value;
384
  }
385
  });
379
  {
380
  if ( $element.attr('id') == 'leadin-subscribe-phone' )
381
  lead_phone = $value;
382
+ else if ( lower_label_text == 'phone' || lower_label_text == 'phone number' )
383
  lead_phone = $value;
384
  }
385
  });
assets/js/build/leadin-tracking.min.js CHANGED
@@ -1 +1 @@
1
- function leadin_start_debug_mode(){return leadin_debug_mode=!0,jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_print_debug_values"},success:function(data){console.log("SERVER CONFIG:\n------------\n"),console.log("jQuery version: "+jQuery.fn.jquery+"\n"),console.log(data),-1!=jQuery.versioncompare("1.7.0",jQuery.fn.jquery)&&console.log("- jQuery version < 1.7.0")},error:function(){}}),"Debug started..."}function leadin_submit_form($form,$){leadin_debug_mode&&(console.log("\nFUNCTION FIRED: leadin_submit_form()"),console.log("FIELDS:\n-----------\n"));var $this=$form,form_fields=[],lead_email="",lead_first_name="",lead_last_name="",lead_phone="",form_selector_id=$form.attr("id")?$form.attr("id"):"",form_selector_classes=$form.classes()?$form.classes().join(","):"";$this.find('input[type!="submit"], textarea').not('input[type="hidden"], input[type="radio"], input[type="password"]').each(function(){var $element=$(this),$value=$element.val();if(!$element.is(":visible"))return!0;var $label=$("label[for='"+$element.attr("id")+"']").text();0==$label.length&&$("#"+$element.attr("id")+"_label").length&&($label=$("#"+$element.attr("id")+"_label").text()),0==$label.length&&($label=$element.prev("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.prevAll("b, strong, span").text())),0==$label.length&&($label=$element.next("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.nextAll("b, strong, span").text())),0==$label.length&&($label=$element.parent().find("label, b, strong").not(".li_used").first().text()),0==$label.length&&$.contains($this,$element.parent().parent())&&($label=$element.parent().parent().find("label, b, strong").first().text()),0==$label.length&&($p=$element.closest("p").not(".li_used").addClass("li_used"),$p.length&&($label=$p.text(),$label=$.trim($label.replace($value,"")))),0==$label.length&&void 0!==$element.attr("placeholder")&&($label=$element.attr("placeholder").toString()),0==$label.length&&void 0!==$element.attr("name")&&($label=$element.attr("name").toString()),$element.is(":checkbox")&&($value=$element.is(":checked")?"Checked":"Not checked"),$value=$value.replace("C:\\fakepath\\","");var $label_text=$.trim($label.replaceArray(["(",")","required","Required","*",":"],[""])),lower_label_text=$label_text.toLowerCase();ignore_field($label_text,$value)?leadin_debug_mode&&console.log(" - Skipping... label: "+$label+" value: "+$value):push_form_field($label_text,$value,form_fields),-1==$value.indexOf("@")||-1==$value.indexOf(".")||lead_email||(lead_email=$value),lead_first_name||("leadin-subscribe-fname"==$element.attr("id")?lead_first_name=$value:("first"==lower_label_text||"first name"==lower_label_text||"name"==lower_label_text||"your name"==lower_label_text)&&(lead_first_name=$value)),lead_last_name||("leadin-subscribe-lname"==$element.attr("id")?lead_last_name=$value:("last"==lower_label_text||"last name"==lower_label_text||"your last name"==lower_label_text||"surname"==lower_label_text)&&(lead_last_name=$value)),lead_phone||("leadin-subscribe-phone"==$element.attr("id")?lead_phone=$value:("phone"==lower_label_text||"phone"==lower_label_text)&&(lead_phone=$value))});var radio_groups=[],rbg_label_values=[];$this.find(":radio").each(function(){-1==$.inArray(this.name,radio_groups)&&radio_groups.push(this.name),rbg_label_values.push($(this).val())});for(var i=0;i<radio_groups.length;i++){{var $rbg=$("input:radio[name='"+radio_groups[i]+"']");$("input:radio[name='"+radio_groups[i]+"']:checked").val()}$p=$this.find(".gfield").length?$rbg.closest(".gfield").not(".li_used").addClass("li_used"):$this.find(".frm_form_field").length?$rbg.closest(".frm_form_field").not(".li_used").addClass("li_used"):$rbg.closest("div, p").not(".li_used").addClass("li_used"),$p.length&&($rbg_label=$p.text(),$rbg_label=$.trim($rbg_label.replaceArray(rbg_label_values,[""]).replace($p.find(".gfield_description").text(),"")));var rgb_selected=$("input:radio[name='"+radio_groups[i]+"']:checked").val()?$("input:radio[name='"+radio_groups[i]+"']:checked").val():"not selected";ignore_field($rbg_label,rgb_selected)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($rbg_label,rgb_selected,form_fields)}if($this.find("select").each(function(){var $select=$(this),$select_label=$("label[for='"+$select.attr("id")+"']").text();if(!$select_label.length){var select_values=[];$select.find("option").each(function(){-1==$.inArray($(this).val(),select_values)&&select_values.push($(this).val())}),$p=$select.closest("div, p").not(".li_used").addClass("li_used"),$p=$this.find(".gfield").length?$select.closest(".gfield").not(".li_used").addClass("li_used"):$select.closest("div, p").addClass("li_used"),$p.length&&($select_label=$p.text(),$select_label=$.trim($select_label.replaceArray(select_values,[""]).replace($p.find(".gfield_description").text(),"")))}var select_value="";if($select.val()instanceof Array){var select_vals=$select.val();for(i=0;i<select_vals.length;i++)select_value+=select_vals[i],i!=select_vals.length-1&&(select_value+=", ")}else select_value=$select.find("option:selected").text()?$select.find("option:selected").text():$select.val();ignore_field($select_label,select_value)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($select_label,select_value,form_fields)}),$this.find(".li_used").removeClass("li_used"),lead_email){leadin_debug_mode&&console.log("\nFOUND lead_email: "+lead_email+"\n"),ignore_form&&push_form_field("Credit card form submitted","Payment fields not collected for security",form_fields);var submission_hash=Math.random().toString(36).slice(2),hashkey=$.cookie("li_hash"),json_form_fields=JSON.stringify(form_fields),form_submission={};form_submission={submission_hash:submission_hash,hashkey:hashkey,lead_email:lead_email,lead_first_name:lead_first_name,lead_last_name:lead_last_name,lead_phone:lead_phone,page_title:page_title,page_url:page_url,json_form_fields:json_form_fields,form_selector_id:form_selector_id,form_selector_classes:form_selector_classes},leadin_debug_mode&&(console.log("\nFORM SUBMISSION OBJECT:"),console.log(form_submission)),$.cookie("li_submission",JSON.stringify(form_submission),{path:"/",domain:""}),leadin_insert_form_submission(submission_hash,hashkey,page_title,page_url,json_form_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}else form_saved=!0,leadin_debug_mode&&console.log("ERROR: lead_email not found\n")}function leadin_check_merged_contact(hashkey){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_merged_contact",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);json_data&&jQuery.cookie("li_hash",json_data,{path:"/",domain:""})},error:function(){}})}function leadin_check_visitor_status(hashkey,callback){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_visitor_status",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);callback&&callback(json_data)},error:function(){}})}function leadin_log_pageview(hashkey,page_title,page_url,page_referrer,last_visit){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_log_pageview",li_id:hashkey,li_title:page_title,li_url:page_url,li_referrer:page_referrer,li_last_visit:last_visit},success:function(){},error:function(){}})}function leadin_insert_lead(hashkey,page_referrer){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_lead",li_id:hashkey,li_referrer:page_referrer},success:function(){},error:function(){}})}function leadin_insert_form_submission(submission_haskey,hashkey,page_title,page_url,json_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,Callback){leadin_debug_mode&&console.log("\nFUNCTION FIRED: leadin_insert_form_submission()"),jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_form_submission",li_submission_id:submission_haskey,li_id:hashkey,li_title:page_title,li_url:page_url,li_fields:json_fields,li_email:lead_email,li_first_name:lead_first_name,li_last_name:lead_last_name,li_phone:lead_phone,li_form_selector_id:form_selector_id,li_form_selector_classes:form_selector_classes},success:function(data){leadin_debug_mode&&console.log("RESULT rows updated: "+data),Callback&&Callback(data)},error:function(){}})}function push_form_field(label,value,form_fields){var field={label:label,value:value};form_fields.push(field),leadin_debug_mode&&console.log(" + Adding... [label:] "+label+" [value:] "+value)}function ignore_field(label,value){var bool_ignore_field=!1;(-1!=label.toLowerCase().indexOf("credit card")||-1!=label.toLowerCase().indexOf("card number"))&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("expiration")||-1!=label.toLowerCase().indexOf("expiry"))&&(bool_ignore_field=!0),("month"==label.toLowerCase()||"mm"==label.toLowerCase()||"yy"==label.toLowerCase()||"yyyy"==label.toLowerCase()||"year"==label.toLowerCase())&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("cvv")||-1!=label.toLowerCase().indexOf("cvc")||-1!=label.toLowerCase().indexOf("secure code")||-1!=label.toLowerCase().indexOf("security code"))&&(bool_ignore_field=!0),("visa"==value.toLowerCase()||"mastercard"==value.toLowerCase()||"american express"==value.toLowerCase()||"amex"==value.toLowerCase()||"discover"==value.toLowerCase())&&(bool_ignore_field=!0);var int_regex=new RegExp("/^[0-9]+$/");if(int_regex.test(value)){var value_no_spaces=value.replace(" ","");isInt(value_no_spaces)&&value_no_spaces.length>=16&&(bool_ignore_field=!0)}return label.length>250&&(bool_ignore_field=!0),bool_ignore_field?(ignore_form||(ignore_form=!0),!0):!1}function isInt(n){return"number"==typeof n&&isFinite(n)&&n%1===0}!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){0===s.indexOf('"')&&(s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return s=decodeURIComponent(s.replace(pluses," ")),config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var pluses=/\+/g,config=$.cookie=function(key,value,options){if(void 0!==value&&!$.isFunction(value)){if(options=$.extend({},config.defaults,options),"number"==typeof options.expires){var days=options.expires,t=options.expires=new Date;t.setDate(t.getDate()+days)}return document.cookie=[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}for(var result=key?void 0:{},cookies=document.cookie?document.cookie.split("; "):[],i=0,l=cookies.length;l>i;i++){var parts=cookies[i].split("="),name=decode(parts.shift()),cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}key||void 0===(cookie=read(cookie))||(result[name]=cookie)}return result};config.defaults={},$.removeCookie=function(key,options){return void 0===$.cookie(key)?!1:($.cookie(key,"",$.extend({},options,{expires:-1})),!$.cookie(key))}});var page_title=jQuery(document).find("title").text(),page_url=window.location.href,page_referrer=document.referrer,form_saved=!1,ignore_form=!1,leadin_debug_mode=!1;jQuery(document).ready(function($){var hashkey=$.cookie("li_hash"),li_submission_cookie=$.cookie("li_submission");if(li_submission_cookie){var submission_data=JSON.parse(li_submission_cookie);leadin_insert_form_submission(submission_data.submission_hash,submission_data.hashkey,submission_data.page_title,submission_data.page_url,submission_data.json_form_fields,submission_data.lead_email,submission_data.lead_first_name,submission_data.lead_last_name,submission_data.lead_phone,submission_data.form_selector_id,submission_data.form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}hashkey||(hashkey=Math.random().toString(36).slice(2),$.cookie("li_hash",hashkey,{path:"/",domain:""}),leadin_insert_lead(hashkey,page_referrer)),leadin_log_pageview(hashkey,page_title,page_url,page_referrer,$.cookie("li_last_visit"));var date=new Date,current_time=date.getTime();date.setTime(date.getTime()+36e5),$.cookie("li_last_visit")||leadin_check_merged_contact(hashkey),$.cookie("li_last_visit",current_time,{path:"/",domain:"",expires:date})}),jQuery(function($){-1!=$.versioncompare($.fn.jquery,"1.7.0")?$(document).on("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}}):$(document).bind("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}})}),String.prototype.replaceArray=function(find,replace){for(var replaceString=this,i=0;i<find.length;i++)replaceString=1!=replace.length?replaceString.replace(find[i],replace[i]):replaceString.replace(find[i],replace[0]);return replaceString},function($){function normalize(version){return $.map(version.split("."),function(value){return parseInt(value,10)})}$.versioncompare=function(version1,version2){if("undefined"==typeof version1)throw new Error("$.versioncompare needs at least one parameter.");if(version2=version2||$.fn.jquery,version1==version2)return 0;for(var v1=normalize(version1),v2=normalize(version2),len=Math.max(v1.length,v2.length),i=0;len>i;i++)if(v1[i]=v1[i]||0,v2[i]=v2[i]||0,v1[i]!=v2[i])return v1[i]>v2[i]?1:-1;return 0}}(jQuery),function($){$.fn.classes=function(callback){var classes=[];if($.each(this,function(i,v){var splitClassName=v.className.split(/\s+/);for(var j in splitClassName){var className=splitClassName[j];-1===classes.indexOf(className)&&classes.push(className)}}),"function"==typeof callback)for(var i in classes)callback(classes[i]);return classes}}(jQuery);
1
+ function leadin_start_debug_mode(){return leadin_debug_mode=!0,jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_print_debug_values"},success:function(data){console.log("SERVER CONFIG:\n------------\n"),console.log("jQuery version: "+jQuery.fn.jquery+"\n"),console.log(data),-1!=jQuery.versioncompare("1.7.0",jQuery.fn.jquery)&&console.log("- jQuery version < 1.7.0")},error:function(){}}),"Debug started..."}function leadin_submit_form($form,$){leadin_debug_mode&&(console.log("\nFUNCTION FIRED: leadin_submit_form()"),console.log("FIELDS:\n-----------\n"));var $this=$form,form_fields=[],lead_email="",lead_first_name="",lead_last_name="",lead_phone="",form_selector_id=$form.attr("id")?$form.attr("id"):"",form_selector_classes=$form.classes()?$form.classes().join(","):"";$this.find('input[type!="submit"], textarea').not('input[type="hidden"], input[type="radio"], input[type="password"]').each(function(){var $element=$(this),$value=$element.val();if(!$element.is(":visible"))return!0;var $label=$("label[for='"+$element.attr("id")+"']").text();0==$label.length&&$("#"+$element.attr("id")+"_label").length&&($label=$("#"+$element.attr("id")+"_label").text()),0==$label.length&&($label=$element.prev("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.prevAll("b, strong, span").text())),0==$label.length&&($label=$element.next("label").not(".li_used").addClass("li_used").first().text(),$label.length||($label=$element.nextAll("b, strong, span").text())),0==$label.length&&($label=$element.parent().find("label, b, strong").not(".li_used").first().text()),0==$label.length&&$.contains($this,$element.parent().parent())&&($label=$element.parent().parent().find("label, b, strong").first().text()),0==$label.length&&($p=$element.closest("p").not(".li_used").addClass("li_used"),$p.length&&($label=$p.text(),$label=$.trim($label.replace($value,"")))),0==$label.length&&void 0!==$element.attr("placeholder")&&($label=$element.attr("placeholder").toString()),0==$label.length&&void 0!==$element.attr("name")&&($label=$element.attr("name").toString()),$element.is(":checkbox")&&($value=$element.is(":checked")?"Checked":"Not checked"),$value=$value.replace("C:\\fakepath\\","");var $label_text=$.trim($label.replaceArray(["(",")","required","Required","*",":"],[""])),lower_label_text=$label_text.toLowerCase();ignore_field($label_text,$value)?leadin_debug_mode&&console.log(" - Skipping... label: "+$label+" value: "+$value):push_form_field($label_text,$value,form_fields),-1==$value.indexOf("@")||-1==$value.indexOf(".")||lead_email||(lead_email=$value),lead_first_name||("leadin-subscribe-fname"==$element.attr("id")?lead_first_name=$value:("first"==lower_label_text||"first name"==lower_label_text||"name"==lower_label_text||"your name"==lower_label_text)&&(lead_first_name=$value)),lead_last_name||("leadin-subscribe-lname"==$element.attr("id")?lead_last_name=$value:("last"==lower_label_text||"last name"==lower_label_text||"your last name"==lower_label_text||"surname"==lower_label_text)&&(lead_last_name=$value)),lead_phone||("leadin-subscribe-phone"==$element.attr("id")?lead_phone=$value:("phone"==lower_label_text||"phone number"==lower_label_text)&&(lead_phone=$value))});var radio_groups=[],rbg_label_values=[];$this.find(":radio").each(function(){-1==$.inArray(this.name,radio_groups)&&radio_groups.push(this.name),rbg_label_values.push($(this).val())});for(var i=0;i<radio_groups.length;i++){{var $rbg=$("input:radio[name='"+radio_groups[i]+"']");$("input:radio[name='"+radio_groups[i]+"']:checked").val()}$p=$this.find(".gfield").length?$rbg.closest(".gfield").not(".li_used").addClass("li_used"):$this.find(".frm_form_field").length?$rbg.closest(".frm_form_field").not(".li_used").addClass("li_used"):$rbg.closest("div, p").not(".li_used").addClass("li_used"),$p.length&&($rbg_label=$p.text(),$rbg_label=$.trim($rbg_label.replaceArray(rbg_label_values,[""]).replace($p.find(".gfield_description").text(),"")));var rgb_selected=$("input:radio[name='"+radio_groups[i]+"']:checked").val()?$("input:radio[name='"+radio_groups[i]+"']:checked").val():"not selected";ignore_field($rbg_label,rgb_selected)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($rbg_label,rgb_selected,form_fields)}if($this.find("select").each(function(){var $select=$(this),$select_label=$("label[for='"+$select.attr("id")+"']").text();if(!$select_label.length){var select_values=[];$select.find("option").each(function(){-1==$.inArray($(this).val(),select_values)&&select_values.push($(this).val())}),$p=$select.closest("div, p").not(".li_used").addClass("li_used"),$p=$this.find(".gfield").length?$select.closest(".gfield").not(".li_used").addClass("li_used"):$select.closest("div, p").addClass("li_used"),$p.length&&($select_label=$p.text(),$select_label=$.trim($select_label.replaceArray(select_values,[""]).replace($p.find(".gfield_description").text(),"")))}var select_value="";if($select.val()instanceof Array){var select_vals=$select.val();for(i=0;i<select_vals.length;i++)select_value+=select_vals[i],i!=select_vals.length-1&&(select_value+=", ")}else select_value=$select.find("option:selected").text()?$select.find("option:selected").text():$select.val();ignore_field($select_label,select_value)?leadin_debug_mode&&console.log("Skipping... label: "+$label+" value: "+$value):push_form_field($select_label,select_value,form_fields)}),$this.find(".li_used").removeClass("li_used"),lead_email){leadin_debug_mode&&console.log("\nFOUND lead_email: "+lead_email+"\n"),ignore_form&&push_form_field("Credit card form submitted","Payment fields not collected for security",form_fields);var submission_hash=Math.random().toString(36).slice(2),hashkey=$.cookie("li_hash"),json_form_fields=JSON.stringify(form_fields),form_submission={};form_submission={submission_hash:submission_hash,hashkey:hashkey,lead_email:lead_email,lead_first_name:lead_first_name,lead_last_name:lead_last_name,lead_phone:lead_phone,page_title:page_title,page_url:page_url,json_form_fields:json_form_fields,form_selector_id:form_selector_id,form_selector_classes:form_selector_classes},leadin_debug_mode&&(console.log("\nFORM SUBMISSION OBJECT:"),console.log(form_submission)),$.cookie("li_submission",JSON.stringify(form_submission),{path:"/",domain:""}),leadin_insert_form_submission(submission_hash,hashkey,page_title,page_url,json_form_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}else form_saved=!0,leadin_debug_mode&&console.log("ERROR: lead_email not found\n")}function leadin_check_merged_contact(hashkey){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_merged_contact",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);json_data&&jQuery.cookie("li_hash",json_data,{path:"/",domain:""})},error:function(){}})}function leadin_check_visitor_status(hashkey,callback){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_check_visitor_status",li_id:hashkey},success:function(data){var json_data=jQuery.parseJSON(data);callback&&callback(json_data)},error:function(){}})}function leadin_log_pageview(hashkey,page_title,page_url,page_referrer,last_visit){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_log_pageview",li_id:hashkey,li_title:page_title,li_url:page_url,li_referrer:page_referrer,li_last_visit:last_visit},success:function(){},error:function(){}})}function leadin_insert_lead(hashkey,page_referrer){jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_lead",li_id:hashkey,li_referrer:page_referrer},success:function(){},error:function(){}})}function leadin_insert_form_submission(submission_haskey,hashkey,page_title,page_url,json_fields,lead_email,lead_first_name,lead_last_name,lead_phone,form_selector_id,form_selector_classes,Callback){leadin_debug_mode&&console.log("\nFUNCTION FIRED: leadin_insert_form_submission()"),jQuery.ajax({type:"POST",url:li_ajax.ajax_url,data:{action:"leadin_insert_form_submission",li_submission_id:submission_haskey,li_id:hashkey,li_title:page_title,li_url:page_url,li_fields:json_fields,li_email:lead_email,li_first_name:lead_first_name,li_last_name:lead_last_name,li_phone:lead_phone,li_form_selector_id:form_selector_id,li_form_selector_classes:form_selector_classes},success:function(data){leadin_debug_mode&&console.log("RESULT rows updated: "+data),Callback&&Callback(data)},error:function(){}})}function push_form_field(label,value,form_fields){var field={label:label,value:value};form_fields.push(field),leadin_debug_mode&&console.log(" + Adding... [label:] "+label+" [value:] "+value)}function ignore_field(label,value){var bool_ignore_field=!1;(-1!=label.toLowerCase().indexOf("credit card")||-1!=label.toLowerCase().indexOf("card number"))&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("expiration")||-1!=label.toLowerCase().indexOf("expiry"))&&(bool_ignore_field=!0),("month"==label.toLowerCase()||"mm"==label.toLowerCase()||"yy"==label.toLowerCase()||"yyyy"==label.toLowerCase()||"year"==label.toLowerCase())&&(bool_ignore_field=!0),(-1!=label.toLowerCase().indexOf("cvv")||-1!=label.toLowerCase().indexOf("cvc")||-1!=label.toLowerCase().indexOf("secure code")||-1!=label.toLowerCase().indexOf("security code"))&&(bool_ignore_field=!0),("visa"==value.toLowerCase()||"mastercard"==value.toLowerCase()||"american express"==value.toLowerCase()||"amex"==value.toLowerCase()||"discover"==value.toLowerCase())&&(bool_ignore_field=!0);var int_regex=new RegExp("/^[0-9]+$/");if(int_regex.test(value)){var value_no_spaces=value.replace(" ","");isInt(value_no_spaces)&&value_no_spaces.length>=16&&(bool_ignore_field=!0)}return label.length>250&&(bool_ignore_field=!0),bool_ignore_field?(ignore_form||(ignore_form=!0),!0):!1}function isInt(n){return"number"==typeof n&&isFinite(n)&&n%1===0}!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):factory(jQuery)}(function($){function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){0===s.indexOf('"')&&(s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return s=decodeURIComponent(s.replace(pluses," ")),config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var pluses=/\+/g,config=$.cookie=function(key,value,options){if(void 0!==value&&!$.isFunction(value)){if(options=$.extend({},config.defaults,options),"number"==typeof options.expires){var days=options.expires,t=options.expires=new Date;t.setDate(t.getDate()+days)}return document.cookie=[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}for(var result=key?void 0:{},cookies=document.cookie?document.cookie.split("; "):[],i=0,l=cookies.length;l>i;i++){var parts=cookies[i].split("="),name=decode(parts.shift()),cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}key||void 0===(cookie=read(cookie))||(result[name]=cookie)}return result};config.defaults={},$.removeCookie=function(key,options){return void 0===$.cookie(key)?!1:($.cookie(key,"",$.extend({},options,{expires:-1})),!$.cookie(key))}});var page_title=jQuery(document).find("title").text(),page_url=window.location.href,page_referrer=document.referrer,form_saved=!1,ignore_form=!1,leadin_debug_mode=!1;jQuery(document).ready(function($){var hashkey=$.cookie("li_hash"),li_submission_cookie=$.cookie("li_submission");if(li_submission_cookie){var submission_data=JSON.parse(li_submission_cookie);leadin_insert_form_submission(submission_data.submission_hash,submission_data.hashkey,submission_data.page_title,submission_data.page_url,submission_data.json_form_fields,submission_data.lead_email,submission_data.lead_first_name,submission_data.lead_last_name,submission_data.lead_phone,submission_data.form_selector_id,submission_data.form_selector_classes,function(){$.removeCookie("li_submission",{path:"/",domain:""})})}hashkey||(hashkey=Math.random().toString(36).slice(2),$.cookie("li_hash",hashkey,{path:"/",domain:""}),leadin_insert_lead(hashkey,page_referrer)),leadin_log_pageview(hashkey,page_title,page_url,page_referrer,$.cookie("li_last_visit"));var date=new Date,current_time=date.getTime();date.setTime(date.getTime()+36e5),$.cookie("li_last_visit")||leadin_check_merged_contact(hashkey),$.cookie("li_last_visit",current_time,{path:"/",domain:"",expires:date})}),jQuery(function($){-1!=$.versioncompare($.fn.jquery,"1.7.0")?$(document).on("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}}):$(document).bind("submit","form",function(){if(!("loginform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php")||"lostpasswordform"==$(this).attr("id")&&-1!=$(this).attr("action").indexOf("wp-login.php"))){var $form=$(this).closest("form");leadin_submit_form($form,$)}})}),String.prototype.replaceArray=function(find,replace){for(var replaceString=this,i=0;i<find.length;i++)replaceString=1!=replace.length?replaceString.replace(find[i],replace[i]):replaceString.replace(find[i],replace[0]);return replaceString},function($){function normalize(version){return $.map(version.split("."),function(value){return parseInt(value,10)})}$.versioncompare=function(version1,version2){if("undefined"==typeof version1)throw new Error("$.versioncompare needs at least one parameter.");if(version2=version2||$.fn.jquery,version1==version2)return 0;for(var v1=normalize(version1),v2=normalize(version2),len=Math.max(v1.length,v2.length),i=0;len>i;i++)if(v1[i]=v1[i]||0,v2[i]=v2[i]||0,v1[i]!=v2[i])return v1[i]>v2[i]?1:-1;return 0}}(jQuery),function($){$.fn.classes=function(callback){var classes=[];if($.each(this,function(i,v){var splitClassName=v.className.split(/\s+/);for(var j in splitClassName){var className=splitClassName[j];-1===classes.indexOf(className)&&classes.push(className)}}),"function"==typeof callback)for(var i in classes)callback(classes[i]);return classes}}(jQuery);
inc/class-leadin.php CHANGED
@@ -74,11 +74,7 @@ class WPLeadIn {
74
  return FALSE;
75
  }
76
 
77
-
78
- if ( ini_get('allow_url_fopen') )
79
- $leadin_icon = '<img style="width: 16px; height: 16px; opacity: 0.6" src="data:image/svg+xml;base64,' . base64_encode(file_get_contents(LEADIN_PATH . '/images/leadin-svg-icon.svg')) . '">';
80
- else
81
- $leadin_icon = '<img src="' . LEADIN_PATH . '/images/leadin-icon-16x16.png' . '">';
82
 
83
  $args = array(
84
  'id' => 'leadin-admin-menu',
74
  return FALSE;
75
  }
76
 
77
+ $leadin_icon = '<img src="' . LEADIN_PATH . '/images/leadin-icon-16x16.png' . '">';
 
 
 
 
78
 
79
  $args = array(
80
  'id' => 'leadin-admin-menu',
inc/leadin-ajax-functions.php CHANGED
@@ -566,7 +566,7 @@ function leadin_print_debug_values ( )
566
  $debug_string .= "- " . $table->table_name . "\n";
567
  }
568
 
569
- if ( $li_tables_count != 5 )
570
  $error_string .= "- Missing database tables\n";
571
  }
572
  else
566
  $debug_string .= "- " . $table->table_name . "\n";
567
  }
568
 
569
+ if ( $li_tables_count < 5 )
570
  $error_string .= "- Missing database tables\n";
571
  }
572
  else
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: 3.1.8
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', '3.1.8');
30
 
31
  if ( !defined('MIXPANEL_PROJECT_TOKEN') )
32
  define('MIXPANEL_PROJECT_TOKEN', '2791b6942b57bbef2ba12b2452468253');
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: 3.1.9
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', '3.1.9');
30
 
31
  if ( !defined('MIXPANEL_PROJECT_TOKEN') )
32
  define('MIXPANEL_PROJECT_TOKEN', '2791b6942b57bbef2ba12b2452468253');
readme.txt CHANGED
@@ -68,8 +68,15 @@ Having trouble? Check out our <a href="http://support.leadin.com/" target="_blan
68
 
69
  == Changelog ==
70
 
71
- - Current version: 3.1.8
72
- - Current version release: 2015-05-15
 
 
 
 
 
 
 
73
 
74
  = 3.1.8 (2015.05.15) =
75
 
68
 
69
  == Changelog ==
70
 
71
+ - Current version: 3.1.9
72
+ - Current version release: 2015-05-26
73
+
74
+ = 3.1.9 (2015.05.26) =
75
+
76
+ - Bug fixes
77
+ - Removed the check on the front-end for missing databases - that was a bad idea - fixed now
78
+ - Removed the file_get_contents hack for SVG support and just used an image instead
79
+ - Added in support for "phone number" field name to push phone number to ESPs
80
 
81
  = 3.1.8 (2015.05.15) =
82