From e2db40a21167156fc55dca8c95385c1da9732c9d Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Fri, 12 Jun 2020 10:23:13 +0700 Subject: [PATCH] Fixes: Country select --- changelog.txt | 3 +++ inc/ajax-functions.php | 4 +-- inc/property/class-opalestate-search.php | 31 ++++++++++++++++++++---- opal-estate-pro.php | 6 ++--- readme.txt | 5 +++- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index d807d694..12551927 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ += 1.5.6 - 2020-06-12 = +* Fixes - Country select when not logged in. + = 1.5.5 - 2020-06-09 = * Fixes - Search box field for vertical form. diff --git a/inc/ajax-functions.php b/inc/ajax-functions.php index 40161601..32e8bc19 100755 --- a/inc/ajax-functions.php +++ b/inc/ajax-functions.php @@ -69,8 +69,8 @@ function opalestate_ajax_search_property_users() { add_action( 'wp_ajax_opalestate_search_property_users', 'opalestate_ajax_search_property_users' ); - -add_action( 'wp_ajax_opalestate_ajax_get_state_by_country', "opalestate_ajax_get_state_by_country" ); +add_action( 'wp_ajax_opalestate_ajax_get_state_by_country', 'opalestate_ajax_get_state_by_country' ); +add_action( 'wp_ajax_nopriv_opalestate_ajax_get_state_by_country', 'opalestate_ajax_get_state_by_country' ); function opalestate_ajax_get_state_by_country() { if ( ! isset( $_POST['country'] ) ) { die; diff --git a/inc/property/class-opalestate-search.php b/inc/property/class-opalestate-search.php index e83d8593..3786aff1 100755 --- a/inc/property/class-opalestate-search.php +++ b/inc/property/class-opalestate-search.php @@ -28,12 +28,33 @@ class OpalEstate_Search { public static function get_search_results_query( $limit = 9 ) { global $wp_query; - $search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ) : ''; - $search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ) : ''; + $search_min_price = ''; + $search_max_price = ''; + if ( isset( $_GET['min_price'] ) || isset( $_GET['max_price'] ) ) { + $search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ) : ''; + $search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ) : ''; + } elseif ( isset( $_GET['range_price'] ) ) { + $range_price = explode( '-', sanitize_text_field( $_GET['range_price'] ) ); + if ( isset( $range_price[0] ) && isset( $range_price[1] ) ) { + $search_min_price = 'min' !== $range_price[0] ? $range_price[0] : ''; + $search_max_price = 'max' !== $range_price[1] ? $range_price[1] : ''; + } + } - $search_min_area = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : ''; - $search_max_area = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : ''; - $s = isset( $_GET['search_text'] ) ? sanitize_text_field( $_GET['search_text'] ) : null; + $search_min_area = ''; + $search_max_area = ''; + if ( isset( $_GET['min_area'] ) || isset( $_GET['max_area'] ) ) { + $search_min_area = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : ''; + $search_max_area = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : ''; + } elseif ( isset( $_GET['range_area'] ) ) { + $range_area = explode( '-', sanitize_text_field( $_GET['range_area'] ) ); + if ( isset( $range_area[0] ) && isset( $range_area[1] ) ) { + $search_min_area = 'min' !== $range_area[0] ? $range_area[0] : ''; + $search_max_area = 'max' !== $range_area[1] ? $range_area[1] : ''; + } + } + + $s = isset( $_GET['search_text'] ) ? sanitize_text_field( $_GET['search_text'] ) : null; $posts_per_page = apply_filters( 'opalestate_search_property_per_page', opalestate_options( 'search_property_per_page', $limit ) ); diff --git a/opal-estate-pro.php b/opal-estate-pro.php index 4e07f305..c1143d31 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -3,7 +3,7 @@ * Plugin Name: Opal Estate Pro * Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. - * Version: 1.5.5 + * Version: 1.5.6 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.9 @@ -154,7 +154,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { */ public function __clone() { // Cloning instances of the class is forbidden - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.5.5' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.5.6' ); } /** @@ -163,7 +163,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.5.5' ); + define( 'OPALESTATE_VERSION', '1.5.6' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index 237552f2..67ec3c6a 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://wpdocs.gitbook.io/opal-estate/ Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Requires at least: 4.9 Tested up to: 5.3.2 -Stable tag: 1.5.5 +Stable tag: 1.5.6 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -150,6 +150,9 @@ This section describes how to install the plugin and get it working. * System tickets support 24/7 available : [free support](https://themelexus.ticksy.com/ "Visit the Plugin support Page") == Changelog == += 1.5.6 - 2020-06-12 = +* Fixes - Country select when not logged in. + = 1.5.5 - 2020-06-09 = * Fixes - Search box field for vertical form.