From 5a007f95a073b96c433655c6852b2a044cfa3066 Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Tue, 3 Jan 2017 11:40:03 -0600 Subject: [PATCH 1/6] Better naming for API credential inputs on settings page --- simply-rets-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simply-rets-admin.php b/simply-rets-admin.php index 1f64083..3e441b1 100644 --- a/simply-rets-admin.php +++ b/simply-rets-admin.php @@ -159,8 +159,8 @@ function sr_admin_page() {
Note - to use the SimplyRETS demo data, you can use these API credentials: - API Username: simplyrets API Key: simplyrets + API Secret: simplyrets
From 2c232243d1c7f0a38726f5d5ceb7f77761d49516 Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Tue, 3 Jan 2017 12:02:08 -0600 Subject: [PATCH 2/6] Don't send empty 'status' and 'type' parameters to API Problem: When the API is sent an empty status parameter, like "..&status=&", it returns only Active listings. But with not status parameter it returns Active and Pending listings. The plugin was setting empty status parameters on short-code pagintation links when there was no status specified. For example, this would set an empty status parameter: [sr_listings type="Land"] on the pagination links in the output and provide unexpected listings on the next page. --- simply-rets-post-pages.php | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/simply-rets-post-pages.php b/simply-rets-post-pages.php index 6a489d9..b688400 100644 --- a/simply-rets-post-pages.php +++ b/simply-rets-post-pages.php @@ -556,17 +556,16 @@ public static function srPostDefaultContent( $content ) { /** - * Check if there is multiple 'types' being searched. - * HACK: This is a bit of hack because sometimes the parameters - * are in an array() and sometimes they are in a string that needs - * to be made into an array. The others aren't like that, - * so we should fix this one. + * Format the 'type' parameter. + * Note that the 'type' might come in as an Array or a + * String. For strings, we split on ";" to support + * multiple property types only if the string is not + * empty. Arrays are concated into multiple type= + * parameters. */ - - /** Multiple Types */ $p_types = isset($_GET['sr_ptype']) ? $_GET['sr_ptype'] : ''; $ptypes_string = ''; - if(!is_array($p_types)) { + if(!is_array($p_types) && !empty($p_types)) { if(strpos($p_types, ";") !== FALSE) { $p_types = explode(';', $p_types); } else { @@ -581,10 +580,22 @@ public static function srPostDefaultContent( $content ) { } - /** Multiple Statuses */ + /** + * Format the 'status' parameter. + * Note that the 'status' might come in as an Array or a + * String. For strings, we split on ";" to support + * multiple statuses only if the string is not empty. + * Arrays are concated into multiple status= parameters. + * + * NOTE: it is important to not send an empty status + * parameter, for example "status=" to the API, as it will + * interpret it as Active, whereas _no_ status parameter + * is Active and Pending. + */ $statuses = isset($_GET['sr_status']) ? $_GET['sr_status'] : $status; $statuses_string = ''; - if(!is_array($statuses)) { + + if(!is_array($statuses) && !empty($statuses)) { if(strpos($statuses, ";") !== FALSE) { $statuses = explode(';', $statuses); } else { @@ -598,6 +609,7 @@ public static function srPostDefaultContent( $content ) { } } + /** * The loops below check if the short-code has multiple * values for any query parameter. Eg, multiple cities. From 9c5c8eb65a35145c39f068d208b58152da8a84ea Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Tue, 3 Jan 2017 12:12:34 -0600 Subject: [PATCH 3/6] Remove incorrect 'area' parameter for documentation The API does not support an 'area' parameter, it support 'minarea' and 'maxarea', so this documentation is incorrect. See https://github.com/SimplyRETS/simplyretswp/issues/43 --- readme.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/readme.txt b/readme.txt index 2effb3b..32ed782 100644 --- a/readme.txt +++ b/readme.txt @@ -502,10 +502,6 @@ Refines listings to a specific agent by taking an agent's MLS ID. Refines listings to a specific brokerage by taking a brokerage's MLS ID. `[sr_listings brokers="KWREALTY1"]` -* **area** -Refines listings by a certain area size in Sq Ft. -`[sr_listings area="1500"]` - * **cities** Refines listings to a given set of cities. (Separate multiple with a semi-colon). `[sr_listings cities="Houston; Austin; Dallas"]` From b390e4a0df9d5cc8c3aca9f96d920de821f23ca2 Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Tue, 3 Jan 2017 12:25:47 -0600 Subject: [PATCH 4/6] Bump version to 2.2.4 and update CHANGELOG --- CHANGELOG | 4 ++++ readme.txt | 6 +++++- simply-rets-api-helper.php | 4 ++-- simply-rets.php | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d6ee958..8bc1c0d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Changelog +## 2.2.4 +* BUGFIX: Don't send empty 'status' and 'type' parameters to the API. +* DOCUMENTATION: Update documentation for 'area' parameter. + ## 2.2.3 * DOCUMENTATION: Remove unsupported 'lotsize' parameter from documentation. diff --git a/readme.txt b/readme.txt index 32ed782..90491a0 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Contributors: SimplyRETS Tags: rets, idx, real estate listings, real estate, listings, rets listings, simply rets, realtor, rets feed, idx feed Requires at least: 3.0.1 Tested up to: 4.7 -Stable tag: 2.2.3 +Stable tag: 2.2.4 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -235,6 +235,10 @@ listing sidebar widget. == Changelog == += 2.2.4 = +* BUGFIX: Don't send empty 'status' and 'type' parameters to the API. +* DOCUMENTATION: Update documentation for 'area' parameter. + = 2.2.3 = * DOCUMENTATION: Remove unsupported 'lotsize' parameter from documentation. diff --git a/simply-rets-api-helper.php b/simply-rets-api-helper.php index 38c6a1b..c50d404 100644 --- a/simply-rets-api-helper.php +++ b/simply-rets-api-helper.php @@ -90,7 +90,7 @@ public static function srApiOptionsRequest( $url ) { $php_version = phpversion(); $site_url = get_site_url(); - $ua_string = "SimplyRETSWP/2.2.3 Wordpress/{$wp_version} PHP/{$php_version}"; + $ua_string = "SimplyRETSWP/2.2.4 Wordpress/{$wp_version} PHP/{$php_version}"; $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; if( is_callable( 'curl_init' ) ) { @@ -209,7 +209,7 @@ public static function srApiRequest( $url ) { $wp_version = get_bloginfo('version'); $php_version = phpversion(); - $ua_string = "SimplyRETSWP/2.2.3 Wordpress/{$wp_version} PHP/{$php_version}"; + $ua_string = "SimplyRETSWP/2.2.4 Wordpress/{$wp_version} PHP/{$php_version}"; $accept_header = "Accept: application/json; q=0.2, application/vnd.simplyrets-v0.1+json"; if( is_callable( 'curl_init' ) ) { diff --git a/simply-rets.php b/simply-rets.php index bede125..14d5610 100644 --- a/simply-rets.php +++ b/simply-rets.php @@ -4,7 +4,7 @@ Plugin URI: https://simplyrets.com Description: Show your Real Estate listings on your Wordpress site. SimplyRETS provides a very simple set up and full control over your listings. Author: SimplyRETS -Version: 2.2.3 +Version: 2.2.4 License: GNU General Public License v3 or later Copyright (c) SimplyRETS 2014 - 2015 From f88d893bda213feb981393cae824d192648ffccd Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Wed, 4 Jan 2017 10:37:06 -0600 Subject: [PATCH 5/6] Remove numeric restrictions from contact form name and subject --- simply-rets-api-helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simply-rets-api-helper.php b/simply-rets-api-helper.php index c50d404..29af380 100644 --- a/simply-rets-api-helper.php +++ b/simply-rets-api-helper.php @@ -1511,7 +1511,7 @@ public static function srContactFormMarkup($listing) { $markup .= '

'; $markup .= ''; $markup .= 'Your Name (required)
'; - $markup .= ''; $markup .= '

'; $markup .= '

'; @@ -1521,7 +1521,7 @@ public static function srContactFormMarkup($listing) { $markup .= '

'; $markup .= '

'; $markup .= 'Subject (required)
'; - $markup .= ''; $markup .= '

'; $markup .= '

'; From 2c5f0aa09808fdb7937f2773313e532e249368fe Mon Sep 17 00:00:00 2001 From: Cody Reichert Date: Wed, 4 Jan 2017 11:06:45 -0600 Subject: [PATCH 6/6] Add text to contact form success message --- simply-rets-api-helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simply-rets-api-helper.php b/simply-rets-api-helper.php index 29af380..614d0ed 100644 --- a/simply-rets-api-helper.php +++ b/simply-rets-api-helper.php @@ -1557,7 +1557,7 @@ public static function srContactFormDeliver() { // If email has been process for sending, display a success message if ( wp_mail( $to, $subject, $message, $headers ) ) { - echo '

'; + echo '
Your message was delivered successfully.
'; } else { echo 'An unexpected error occurred'; }