diff --git a/assets/js/platform-email-validator.js b/assets/js/platform-email-validator.js
index 6795bbc..0c29c41 100644
--- a/assets/js/platform-email-validator.js
+++ b/assets/js/platform-email-validator.js
@@ -1 +1 @@
-!function(e){function a(a,r,t){if(t.platformValidatorRequest&&(t.platformValidatorRequest.abort(),t.platformValidatorRequest=null),a)if(r&&r.in_progress&&r.in_progress(r.e),t.platformValidatorLastSuccessReturn&&a===t.platformValidatorLastSuccessReturn.address)r&&r.success&&r.success(t.platformValidatorLastSuccessReturn,r.e);else{var o=!1;if(a.length>512?o="Email address exceeds maximum allowable length of 512 characters.":1!=a.split("@").length-1&&(o="Email address must contain only one @."),o)r&&r.error&&r.error(o,r.e);else{var s=setTimeout(function(){o="Error occurred, unable to validate address.",t.platformValidatorRequest&&(t.platformValidatorRequest.abort(),t.platformValidatorRequest=null),r&&r.error&&r.error(o,r.e)},3e4);t.platformValidatorRequest=e.ajax({type:"GET",url:"https://platformcrm.com/api/v2/email/validate",data:{email:a,key:r.api_key},dataType:"jsonp",crossDomain:!0,success:function(e){clearTimeout(s),t.platformValidatorLastSuccessReturn=e,r&&r.success&&r.success(e,r.e)},error:function(){clearTimeout(s),o="Error occurred, unable to validate address.",r&&r.error&&r.error(o,r.e)}})}}}e.fn.platform_email_validator=function(r){return this.each(function(){var t,o,s=e(this);s.focusout(function(t){t.timeStamp=Date.now();var l=s.val();l=e.trim(l),s.val(l),l!==o&&(o=l,r.e=t,a(l,r,s))}),s.keyup(function(){clearTimeout(t),s.val&&(t=setTimeout(function(){s.trigger("focusout")},300))})})}}(jQuery);
\ No newline at end of file
+!function(e){function a(a,r,t){if(t.platformValidatorRequest&&(t.platformValidatorRequest.abort(),t.platformValidatorRequest=null),a)if(r&&r.in_progress&&r.in_progress(r.e),t.platformValidatorLastSuccessReturn&&a===t.platformValidatorLastSuccessReturn.address)r&&r.success&&r.success(t.platformValidatorLastSuccessReturn,r.e);else{var o=!1;if(a.length>512?o="Email address exceeds maximum allowable length of 512 characters.":1!=a.split("@").length-1&&(o="Email address must contain only one @."),o)r&&r.error&&r.error(o,r.e);else{var s=setTimeout(function(){o="Error occurred, unable to validate address.",t.platformValidatorRequest&&(t.platformValidatorRequest.abort(),t.platformValidatorRequest=null),r&&r.error&&r.error(o,r.e)},3e4);t.platformValidatorRequest=e.ajax({type:"GET",url:"https://platformcrm.com/api/v3/email/validate",data:{email:a},dataType:"jsonp",crossDomain:!0,success:function(e){clearTimeout(s),t.platformValidatorLastSuccessReturn=e,r&&r.success&&r.success(e,r.e)},error:function(){clearTimeout(s),o="Error occurred, unable to validate address.",r&&r.error&&r.error(o,r.e)}})}}}e.fn.platform_email_validator=function(r){return this.each(function(){var t,o,s=e(this);s.focusout(function(t){t.timeStamp=Date.now();var l=s.val();l=e.trim(l),s.val(l),l!==o&&(o=l,r.e=t,a(l,r,s))}),s.keyup(function(){clearTimeout(t),s.val&&(t=setTimeout(function(){s.trigger("focusout")},300))})})}}(jQuery);
\ No newline at end of file
diff --git a/assets/js/scripts.js b/assets/js/scripts.js
index c824d65..79b8aec 100644
--- a/assets/js/scripts.js
+++ b/assets/js/scripts.js
@@ -7,23 +7,21 @@ jQuery('document').ready(function ($) {
});
// Email Validation
- if (HouseHunter.platformvaluator !== undefined && HouseHunter.platformvaluator !== '') {
- $('#email').platform_email_validator({
- api_key: HouseHunter.platformvaluator,
- in_progress: function () {
- $('#email').parent().removeClass('has-warning has-error');
- $(".mailcheck-suggestion").remove();
- $("[type=submit]").addClass("disabled").attr("disabled", "disabled");
- },
- success: function (data) {
- $('#email').after(get_suggestion_str(data['is_valid'], data['did_you_mean']));
- },
- error: function () {
- $("[type=submit]").removeClass("disabled").removeAttr("disabled");
- }
- });
- }
- // Parse Mailgun Responses
+ $('#email').platform_email_validator({
+ in_progress: function () {
+ $('#email').parent().removeClass('has-warning has-error');
+ $(".mailcheck-suggestion").remove();
+ $("[type=submit]").addClass("disabled").attr("disabled", "disabled");
+ },
+ success: function (data) {
+ $('#email').after(get_suggestion_str(data['is_valid'], data['did_you_mean']));
+ },
+ error: function () {
+ $("[type=submit]").removeClass("disabled").removeAttr("disabled");
+ }
+ });
+
+ // Parse email validator Responses
function get_suggestion_str(is_valid, alternate) {
if (is_valid) {
if (alternate) {
diff --git a/classes/class-frontdesk.php b/classes/class-frontdesk.php
index e406619..4925708 100644
--- a/classes/class-frontdesk.php
+++ b/classes/class-frontdesk.php
@@ -26,7 +26,7 @@ class FrontDesk
*
* @param int $api_version
*/
- public function __construct($api_version = 2)
+ public function __construct($api_version = 3)
{
$this->token = 'pf_house_hunter';
$this->api_key = get_option('pf_seller_quiz_frontdesk_key');
@@ -54,13 +54,15 @@ public function createCampaign($title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'campaigns/', [
'form_params' => [
- 'key' => $this->api_key,
'title' => $title,
'description' => 'Campaign for Platform House Hunter',
'type' => 'Platform',
'total_cost' => '10000',
'source' => $permalink
- ]
+ ],
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->api_key,
+ ],
]);
add_filter('redirect_post_location', [$this, 'add_success_var'], 99);
@@ -85,10 +87,12 @@ public function updateCampaign($id, $title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$this->guzzle->patch($this->api_base . 'campaigns/' . $id, [
'form_params' => [
- 'key' => $this->api_key,
'title' => $title,
'source' => $permalink
- ]
+ ],
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->api_key,
+ ],
]);
}
}
@@ -105,13 +109,15 @@ public function createProspect($data)
{
try {
if ($this->api_key != null || $this->api_key != '') {
- $response = $this->guzzle->post($this->api_base . 'subscribers/complete', [
+ $response = $this->guzzle->post($this->api_base . 'subscribers', [
'form_params' => [
- 'key' => $this->api_key,
- 'campaigns' => $data['campaign_id'],
- 'email' => $data['email'],
- 'first_name' => $data['first_name']
- ]
+ 'campaigns' => $data['campaign_id'],
+ 'email' => $data['email'],
+ 'first_name' => $data['first_name']
+ ],
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->api_key,
+ ],
]);
return json_decode($response->getBody(), true)['data']['id'];
@@ -138,7 +144,6 @@ public function updateProspect($id, $data)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->patch($this->api_base . 'subscribers/' . $id, [
'form_params' => [
- 'key' => $this->api_key,
'email' => $data['email'],
'last_name' => $data['last_name'],
'address' => $data['address'],
@@ -147,7 +152,10 @@ public function updateProspect($id, $data)
'state' => $data['state'],
'zip_code' => $data['zip_code'],
'phone' => $data['phone']
- ]
+ ],
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->api_key,
+ ],
]);
return json_decode($response->getBody(), true)['data']['id'];
@@ -174,11 +182,13 @@ public function createNote($id, $title, $content)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'subscribers/notes/', [
'form_params' => [
- 'key' => $this->api_key,
'subscriber_id' => $id,
'title' => $title,
'content' => $content
- ]
+ ],
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->api_key,
+ ],
]);
return json_decode($response->getBody(), true)['data']['id'];
diff --git a/classes/class-house-hunter-admin.php b/classes/class-house-hunter-admin.php
index e20f57d..32ca493 100755
--- a/classes/class-house-hunter-admin.php
+++ b/classes/class-house-hunter-admin.php
@@ -214,7 +214,7 @@ public function frontdesk_key_field()
$data = $option;
echo '
- ';
+ ';
}
diff --git a/classes/class-house-hunter.php b/classes/class-house-hunter.php
index 24de83d..3a0742f 100755
--- a/classes/class-house-hunter.php
+++ b/classes/class-house-hunter.php
@@ -410,8 +410,7 @@ public function enqueue_scripts()
wp_enqueue_script('platform-email-validator');
$localize = [
- 'ajaxurl' => admin_url('admin-ajax.php'),
- 'platformvaluator' => defined('MAILGUN_PUBLIC') ? MAILGUN_PUBLIC : ''
+ 'ajaxurl' => admin_url('admin-ajax.php'),
];
wp_localize_script($this->token . '-js', 'HouseHunter', $localize);
}
diff --git a/house-hunter.php b/house-hunter.php
index 1e6f517..6a97cee 100755
--- a/house-hunter.php
+++ b/house-hunter.php
@@ -2,7 +2,7 @@
/*
* Plugin Name: House Hunter
- * Version: 1.8.7
+ * Version: 1.8.8
* Plugin URI: http://www.coldturkeygroup.com/
* Description: A form for prospective home buyers to fill out to request more information from a real estate agent.
* Author: Cold Turkey Group
@@ -24,7 +24,7 @@
}
if (!defined('HOUSE_HUNTER_PLUGIN_VERSION')) {
- define('HOUSE_HUNTER_PLUGIN_VERSION', '1.8.7');
+ define('HOUSE_HUNTER_PLUGIN_VERSION', '1.8.8');
}
require_once('classes/class-house-hunter.php');
diff --git a/readme.txt b/readme.txt
index 56eeb78..5871b72 100755
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: Aaron Huisinga
Tags: real estate, platform, house hunter
Requires at least: 3.5
Tested up to: 5.1
-Stable tag: 1.8.7
+Stable tag: 1.8.8
A form for prospective home buyers to fill out to request more information from a real estate agent.