From 22d974492ed835d0929932b44b21f3eb753f83a7 Mon Sep 17 00:00:00 2001 From: Aaron Huisinga Date: Fri, 29 Nov 2019 15:50:09 -0700 Subject: [PATCH] Bump to version 1.6.3 1. Update Platform CRM API to v3 --- classes/class-platform-crm.php | 40 +++++++++++++++++----------- classes/class-program-page-admin.php | 2 +- program-page.php | 4 +-- readme.txt | 2 +- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/classes/class-platform-crm.php b/classes/class-platform-crm.php index c7dd057..4ff22c0 100644 --- a/classes/class-platform-crm.php +++ b/classes/class-platform-crm.php @@ -26,7 +26,7 @@ class PlatformCRM * * @param int $api_version */ - public function __construct($api_version = 2) + public function __construct($api_version = 3) { $this->token = 'pf_program_page'; $this->api_key = get_option('pf_program_page_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 Program Page Funnel', '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-program-page-admin.php b/classes/class-program-page-admin.php index 4d658b6..421efc4 100755 --- a/classes/class-program-page-admin.php +++ b/classes/class-program-page-admin.php @@ -213,7 +213,7 @@ public function frontdesk_key_field() $data = $option; echo ' - '; + '; } diff --git a/program-page.php b/program-page.php index f69e4ea..e6837ec 100755 --- a/program-page.php +++ b/program-page.php @@ -4,7 +4,7 @@ /* * Plugin Name: Program Page - * Version: 1.6.2 + * Version: 1.6.3 * Plugin URI: http://www.coldturkeygroup.com/ * Description: Custom info pages for Platform ad campaigns * Author: Cold Turkey Group @@ -26,7 +26,7 @@ } if (!defined('PROGRAM_PAGE_PLUGIN_VERSION')) { - define('PROGRAM_PAGE_PLUGIN_VERSION', '1.6.2'); + define('PROGRAM_PAGE_PLUGIN_VERSION', '1.6.3'); } require_once('classes/class-program-page.php'); diff --git a/readme.txt b/readme.txt index eac1566..3ec18ec 100755 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: Aaron Huisinga Tags: real estate, platform, days on market Requires at least: 3.5 Tested up to: 5.1 -Stable tag: 1.6.2 +Stable tag: 1.6.3 Custom info pages for Platform ad campaigns (currently supports the HIP, Patriot, PATH, HEROES, BOOST, and First Responder Programs).