diff --git a/CHANGELOG b/CHANGELOG
index 76cc99b..f048e6a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,10 @@
# Changelog
+## 2.8.3
+* FIX: Handle "/" characters in single listing page URLs.
+
## 2.8.2
-* FIX: Add error handling for openhouses API requests
+* FIX: Add error handling for openhouses API requests.
## 2.8.1
* ENHANCEMENT: Add support for open houses short-code and search results.
diff --git a/src/readme.txt b/src/readme.txt
index c7c9f96..96bff71 100644
--- a/src/readme.txt
+++ b/src/readme.txt
@@ -4,7 +4,7 @@ Contributors: SimplyRETS
Tags: rets, idx, idx plugin, mls, mls listings, real estate, simply rets, realtor, rets feed, idx feed
Requires at least: 3.0.1
Tested up to: 5.3.0
-Stable tag: 2.8.2
+Stable tag: 2.8.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -236,6 +236,9 @@ listing sidebar widget.
== Changelog ==
+= 2.8.3 =
+* FIX: Handle "/" characters in single listing page URLs.
+
= 2.8.2 =
* FIX: Add error handling for openhouses API requests
diff --git a/src/simply-rets-api-helper.php b/src/simply-rets-api-helper.php
index 5ff7db8..0dbc62a 100644
--- a/src/simply-rets-api-helper.php
+++ b/src/simply-rets-api-helper.php
@@ -119,7 +119,7 @@ public static function srApiOptionsRequest( $url ) {
$php_version = phpversion();
$site_url = get_site_url();
- $ua_string = "SimplyRETSWP/2.8.2 Wordpress/{$wp_version} PHP/{$php_version}";
+ $ua_string = "SimplyRETSWP/2.8.3 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' ) ) {
@@ -240,7 +240,7 @@ public static function srApiRequest( $url ) {
$wp_version = get_bloginfo('version');
$php_version = phpversion();
- $ua_string = "SimplyRETSWP/2.8.2 Wordpress/{$wp_version} PHP/{$php_version}";
+ $ua_string = "SimplyRETSWP/2.8.3 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/src/simply-rets-post-pages.php b/src/simply-rets-post-pages.php
index 4162b69..f3d725e 100644
--- a/src/simply-rets-post-pages.php
+++ b/src/simply-rets-post-pages.php
@@ -941,13 +941,20 @@ public static function srCreateDynamicPost( $posts ) {
(!empty($wpq['sr-listings']) AND $wpq['sr-listings'] == "sr-single")
) {
- $post_id = urldecode(get_query_var( 'listing_id', '' ));
- $post_addr = urldecode(get_query_var( 'listing_title', '' ));
- $post_price = urldecode(get_query_var( 'listing_price', '' ));
+ $post_id = urldecode(get_query_var('listing_id', ''));
+ $post_price = urldecode(get_query_var('listing_price', ''));
+ $post_addr = SrUtils::decodeStringForUrl(
+ urldecode(get_query_var('listing_title', ''))
+ );
$listing_USD = $post_price == '' ? '' : '$' . number_format( $post_price );
$title_normalize = "background-color:transparent;padding:0px;";
- $post_title = "{$post_addr} {$listing_USD}";
+ $post_title = "{$post_addr} "
+ . ""
+ . " "
+ . " {$listing_USD}"
+ . " "
+ . "";
$post = (object)array(
"ID" => $post_id,
diff --git a/src/simply-rets-utils.php b/src/simply-rets-utils.php
index defa2cf..1d5af10 100644
--- a/src/simply-rets-utils.php
+++ b/src/simply-rets-utils.php
@@ -123,6 +123,21 @@ public static function buildFullAddressString($listing) {
return $address . $comma . $city . ', ' . $state . ' ' . $zip;
}
+ /**
+ * Encode specific characters in a string to work in a URL. For
+ * example, a `/` character cannot be normally encoded as %2F
+ * because Apache url decodes the string and treats it as a path
+ * separator. See: https://stackoverflow.com/a/3235361/3464723
+ */
+ public static function encodeStringForUrl($str) {
+ return str_replace("/", "_", $str);
+ }
+
+ // Decode a string encoded with `encodeStringForUrl`
+ public static function decodeStringForUrl($str) {
+ return str_replace("_", "/", $str);
+ }
+
/**
* Builds a link to a listings' details page. Used in search results.
*/
@@ -150,8 +165,11 @@ public static function buildDetailsLink($listing, $params = array()) {
$listing_city = $listing->address->city;
$listing_state = $listing->address->state;
$listing_zip = $listing->address->postalCode;
+
$listing_address = $listing->address->full;
- $listing_address_full = SrUtils::buildFullAddressString($listing);
+ $listing_address_full = SrUtils::encodeStringForUrl(
+ SrUtils::buildFullAddressString($listing)
+ );
if($prettify && $custom_permalink_struct === "pretty_extra") {
diff --git a/src/simply-rets.php b/src/simply-rets.php
index 7425466..e76f2c0 100644
--- a/src/simply-rets.php
+++ b/src/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.8.2
+Version: 2.8.3
License: GNU General Public License v3 or later
Copyright (c) SimplyRETS 2014 - 2015