This commit is contained in:
Hoang Huu 2020-06-18 11:09:45 +07:00
parent 22c65f696a
commit 4fe7aecb30
19 changed files with 176 additions and 93 deletions

View File

@ -4041,3 +4041,14 @@ header#masthead {
border-bottom: 1px solid #ebebeb;
margin-bottom: 15px;
}
.swiper-button-next, .swiper-container-rtl .swiper-button-prev,
.swiper-button-prev, .swiper-container-rtl .swiper-button-next {
background-image: none !important;
}
.swiper-button-prev i,
.swiper-button-next i {
font-size: 20px;
padding: 20px 0;
}

View File

@ -394,8 +394,15 @@
}
}
[class*="swiper-button-"]{
.swiper-button-next, .swiper-container-rtl .swiper-button-prev,
.swiper-button-prev, .swiper-container-rtl .swiper-button-next {
background-image: none !important;
}
.swiper-button-prev i,
.swiper-button-next i {
font-size: 20px;
padding: 20px 0;
}
.swiper-pagination{

View File

@ -1,3 +1,8 @@
= 1.5.8 - 2020-06-18 =
* Added - Single Preview Layout setting
* Added - Range setting for Radius search
* Fixes - Search selection with Custom Fields
= 1.5.6 - 2020-06-12 =
* Fixes - Country select when not logged in.

View File

@ -373,6 +373,14 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
];
$fields[] = [
'name' => esc_html__( 'Single Preview Display', 'opalestate-pro' ),
'desc' => esc_html__( 'Choose preview layout for single property.', 'opalestate-pro' ),
'id' => 'single_preview',
'type' => 'select',
'options' => opalestate_single_layout_preview(),
];
$fields[] = [
'name' => esc_html__( 'Enable Request Viewing', 'opalestate-pro' ),
'desc' => esc_html__( 'Enable Request Viewing feature in the single property page.', 'opalestate-pro' ),

View File

@ -423,7 +423,7 @@ class Opalestate_Agent_Front {
$radius = isset( $_GET['geo_radius'] ) ? sanitize_text_field( $_GET['geo_radius'] ) : 5;
$post_ids = Opalestate_Query::filter_by_location(
sanitize_text_field( $_GET['geo_lat'] ),
sanitize_text_field( $_GET['geo_long'] ), $radius, $prefix );
sanitize_text_field( $_GET['geo_long'] ), $radius, 'km', $prefix );
$args['post__in'] = $post_ids;

View File

@ -382,16 +382,16 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
if ( is_array( $request['info'] ) ) {
$info_array = $request['info'];
} elseif ( is_string( $request['info'] ) ) {
$info = $request['info'];
$array = json_decode($info);
$array = json_decode(json_encode($array), true);
$info = $request['info'];
$array = json_decode( $info );
$array = json_decode( json_encode( $array ), true );
if ( is_array( $array ) ) {
$info_array = $array;
}
}
if ( $info_array && ! empty($info_array) ) {
if ( $info_array && ! empty( $info_array ) ) {
$metaquery = [];
foreach ( $info_array as $key => $value ) {
if ( trim( $value ) ) {
@ -492,8 +492,9 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'operator' => 'OR',
] );
} elseif ( $request['geo_lat'] && $request['geo_long'] ) {
$radius = isset( $request['geo_radius'] ) ? $request['geo_radius'] : 5;
$post_ids = Opalestate_Query::filter_by_location( $request['geo_lat'], $request['geo_long'], $radius );
$radius_measure = isset( $request['radius_measure'] ) ? sanitize_text_field( $request['radius_measure'] ) : 'km';
$radius = isset( $request['geo_radius'] ) ? sanitize_text_field( $request['geo_radius'] ) : 10;
$post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $request['geo_lat'] ), sanitize_text_field( $request['geo_long'] ), $radius_measure, $radius );
$args['post__in'] = $post_ids;
}
}

View File

@ -34,8 +34,9 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
<label class="opalestate-label opalestate-label--<?php echo sanitize_html_class( $field ); ?>"><?php echo esc_html( $label ); ?></label>
<div class="input-group-number">
<i class="<?php echo opalestate_get_property_meta_icon( $field ); ?>"></i>
<input class="form-control" value="<?php echo esc_attr( $qvalue ? $qvalue : $input_default_value ); ?>" type="text" name="info[<?php echo $field; ?>]" placeholder="<?php echo esc_attr(
$label ); ?>"/>
<input class="form-control" value="<?php echo esc_attr( $qvalue ? $qvalue : $input_default_value ); ?>" type="text" name="info[<?php echo $field; ?>]"
placeholder="<?php echo esc_attr(
$label ); ?>"/>
<div class="btn-actions">
<span class="btn-minus"><i class="fa fa-minus"></i></span>
<span class="btn-plus"><i class="fa fa-plus"></i></span>
@ -55,14 +56,16 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
$display_type_search = opalestate_options( $setting_search_type, 'select' );
if ( $display_type_search == 'select' ) {
$option_values = (array) explode( ',', opalestate_options( $setting_search_type_options, '1,2,3,4,5,6,7,8,9,10' ) );
$option_values = array_map( 'trim', $option_values );
$option_values = array_combine( $option_values, $option_values );
$option_values = apply_filters( 'opalestate_search_select_type_options', $option_values, $setting_search_type_options, $field );
$template = '<label class="opalestate-label opalestate-label--' . sanitize_html_class( $label ) . '">' . esc_html( $label ) . '</label>';
$template .= '<select class="form-control" name="info[%s]"><option value="">%s</option>';
foreach ( $option_values as $value ) {
foreach ( $option_values as $option_key => $value ) {
$selected = $value == $qvalue ? 'selected="selected"' : '';
$template .= '<option ' . $selected . ' value="' . esc_attr( $value ) . '">' . esc_html( $value ) . '</option>';
$template .= '<option ' . $selected . ' value="' . esc_attr( $option_key ) . '">' . esc_html( $value ) . '</option>';
}
$template .= '</select>';
$template = sprintf( $template, $field, $label );

View File

@ -483,7 +483,7 @@ class Opalestate_Property_MetaBox {
public function metaboxes_layout_fields() {
$prefix = OPALESTATE_PROPERTY_PREFIX;
$templates = opalestate_single_layout_prieview();
$templates = opalestate_single_layout_preview();
$fields = [
[

View File

@ -319,12 +319,11 @@ class Opalestate_Query {
}
if ( isset( $args['featured'] ) && $args['featured'] ) {
$args = array_merge( $args,
[
'meta_key' => OPALESTATE_PROPERTY_PREFIX . 'featured',
'meta_value' => 'on',
'meta_compare' => '=',
] );
$args = array_merge( $args, [
'meta_key' => OPALESTATE_PROPERTY_PREFIX . 'featured',
'meta_value' => 'on',
'meta_compare' => '=',
] );
unset( $args['featured'] );
}
@ -342,17 +341,21 @@ class Opalestate_Query {
}
/**
*
* Filter_by_location
*/
public static function filter_by_location( $geo_lat, $geo_long, $radius, $prefix = OPALESTATE_PROPERTY_PREFIX ) {
public static function filter_by_location( $geo_lat, $geo_long, $radius, $radius_measure = '', $prefix = OPALESTATE_PROPERTY_PREFIX ) {
global $wpdb;
$radius_measure = '';
$earth = 3959;
if ( $radius_measure == 'km' ) {
$earth = 6371;
switch ( $radius_measure ) {
case 'km':
$earth = 6371;
break;
case 'miles':
$earth = 3959;
break;
default :
$earth = 6371;
break;
}
$latitude = $prefix . 'map_latitude';
@ -382,7 +385,6 @@ class Opalestate_Query {
ORDER BY $wpdb->posts.menu_order ASC, distance ASC";
$query = $wpdb->prepare( $sql,
$earth,
$geo_lat,
$geo_long,

View File

@ -288,10 +288,10 @@ class OpalEstate_Search {
'compare' => 'LIKE',
'operator' => 'OR',
];
} elseif ( $_GET['geo_lat'] && $_GET['geo_long'] ) {
$radius = isset( $_GET['geo_radius'] ) ? $_GET['geo_radius'] : 5;
$post_ids = Opalestate_Query::filter_by_location( $_GET['geo_lat'], $_GET['geo_long'], $radius );
$radius_measure = isset( $_GET['radius_measure'] ) ? sanitize_text_field( $_GET['radius_measure'] ) : 'km';
$radius = isset( $_GET['geo_radius'] ) ? sanitize_text_field( $_GET['geo_radius'] ) : 10;
$post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $_GET['geo_lat'] ), sanitize_text_field( $_GET['geo_long'] ), $radius_measure, $radius );
$args['post__in'] = $post_ids;
}
}

View File

@ -456,10 +456,14 @@ function opalestate_single_the_property_layout() {
return $layout;
}
function opalestate_single_layout_prieview() {
$layout = [
'' => esc_html__( 'Inherit', 'opalestate-pro' ),
/**
* Single layout preview.
*
* @param bool $show_none_option
* @return array
*/
function opalestate_single_layout_preview( $show_none_option = true ) {
$layouts = [
'gallery-thumbnail' => esc_html__( 'Gallery Thumb Nav', 'opalestate-pro' ),
'gallery-slider' => esc_html__( 'Gallery Slider', 'opalestate-pro' ),
'map' => esc_html__( 'Maps', 'opalestate-pro' ),
@ -471,7 +475,11 @@ function opalestate_single_layout_prieview() {
'mark-picture' => esc_html__( 'Mark Picture', 'opalestate-pro' ),
];
return $layout;
if ( $show_none_option ) {
$layouts = array_merge( [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ], $layouts );
}
return apply_filters( 'opalestate_single_layout_preview', $layouts );
}
@ -491,10 +499,6 @@ function opalestate_property_status() {
echo opalestate_load_template_path( 'parts/property-status' );
}
/**
* Single property logic functions
*/
/**
* Single property logic functions
*/
@ -512,9 +516,15 @@ function opalestate_single_show_map() {
function opalestate_property_preview() {
global $property;
$preview = $property->get_preview_template();
if ( ! $preview ) {
$preview = opalestate_get_option( 'single_preview', '' );
}
if ( isset( $_GET['preview'] ) && $_GET['preview'] ) {
$preview = sanitize_text_field( $_GET['preview'] );
}
switch ( $preview ) {
case 'tour360':
echo opalestate_load_template_path( 'single-property/preview/virtualtour' );
@ -522,7 +532,6 @@ function opalestate_property_preview() {
case 'gallery-slider':
echo opalestate_load_template_path( 'single-property/preview/gallery-slider' );
break;
case 'tabs-gallery':
echo opalestate_load_template_path( 'single-property/preview/tabs', [ 'tab_active' => 'gallery-slider' ] );
remove_action( 'opalestate_after_single_property_summary', 'opalestate_property_map', 30 );
@ -850,7 +859,7 @@ function opalestate_properties_nearby() {
}
$radius = 5;
$post_ids = Opalestate_Query::filter_by_location( $geo_lat, $geo_long, $radius );
$post_ids = Opalestate_Query::filter_by_location( $geo_lat, $geo_long, 'km', $radius );
if ( empty( $post_ids ) ) {
return;

View File

@ -185,6 +185,34 @@ class Opalestate_Searchbox_Elementor_Widget extends Opalestate_Elementor_Widget_
]
);
$this->add_control(
'range_unit',
[
'label' => esc_html__( 'Range Unit', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'km' => esc_html__( 'km', 'opalestate-pro' ),
'miles' => esc_html__( 'miles', 'opalestate-pro' ),
],
'default' => 'km',
'condition' => [
'style' => $this->get_radius_form(),
],
]
);
$this->add_control(
'max_range',
[
'label' => esc_html__( 'Max Range', 'opalestate-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => '10',
'condition' => [
'style' => $this->get_radius_form(),
],
]
);
$this->end_controls_section();
$this->start_controls_section(
@ -414,4 +442,13 @@ class Opalestate_Searchbox_Elementor_Widget extends Opalestate_Elementor_Widget_
'search-form-v3',
];
}
protected function get_radius_form() {
return [
'search-form-v2',
'collapse-advanced',
'collapse-city',
'simple-city',
];
}
}

View File

@ -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.7
* Version: 1.5.8
* 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&#8217; huh?', 'opalestate-pro' ), '1.5.6' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.5.8' );
}
/**
@ -163,7 +163,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.5.6' );
define( 'OPALESTATE_VERSION', '1.5.8' );
}
// Plugin Folder Path

View File

@ -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.6
Stable tag: 1.5.8
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -150,6 +150,11 @@ 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.8 - 2020-06-18 =
* Added - Single Preview Layout setting
* Added - Range setting for Radius search
* Fixes - Search selection with Custom Fields
= 1.5.6 - 2020-06-12 =
* Fixes - Country select when not logged in.

View File

@ -10,23 +10,9 @@ defined( 'ABSPATH' ) || exit;
$unique_id = esc_attr( opalestate_unique_id() );
$GLOBALS['group-info-column'] = 3;
if ( isset( $nobutton ) && $nobutton ) {
$grid = [
0 => 7,
1 => 4,
2 => 1,
3 => 0,
];
} else {
$grid = [
0 => 6,
1 => 3,
2 => 1,
3 => 2,
];
}
$display_more_options = isset( $display_more_options ) ? $display_more_options : true;
$max_range = isset( $max_range ) && $max_range ? $max_range : apply_filters( 'opalestate_search_geo_max_range', 10 );
$range_unit = isset( $range_unit ) ? $range_unit : 'km';
$form_classes = [
'opalestate-search-form',
@ -43,7 +29,7 @@ $form_classes = [
<div class="searchbox-main">
<div class="searchbox-field searchbox-field--city-text">
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text' ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text', [ 'max_range' => $max_range, 'range_unit' => $range_unit ] ); ?>
</div>
<div class="searchbox-field searchbox-field--types">

View File

@ -27,6 +27,8 @@ if ( isset( $nobutton ) && $nobutton ) {
}
$display_more_options = isset( $display_more_options ) ? $display_more_options : true;
$max_range = isset( $max_range ) && $max_range ? $max_range : apply_filters( 'opalestate_search_geo_max_range', 10 );
$range_unit = isset( $range_unit ) ? $range_unit : 'km';
$form_classes = [
'opalestate-search-form',
@ -39,7 +41,7 @@ $form_classes = [
<form class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $form_classes ) ) ); ?>" action="<?php echo esc_url( opalestate_get_search_link() ); ?>" method="GET">
<div class="opal-row">
<div class="col-lg-<?php echo esc_attr( $grid[0] ) ?> col-md-<?php echo esc_attr( $grid[0] ); ?> col-sm-<?php echo esc_attr( $grid[0] ); ?> col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text' ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text', [ 'max_range' => $max_range, 'range_unit' => $range_unit ] ); ?>
</div>
<div class="col-lg-<?php echo esc_attr( $grid[1] ); ?> col-md-<?php echo esc_attr( $grid[1] ); ?> col-sm-<?php echo esc_attr( $grid[1] ); ?> col-xs-12">

View File

@ -1,19 +1,21 @@
<?php
$max_price = 10;
$start = 1;
$unit = 'KM';
$location_text = isset( $_GET['location_text'] ) ? sanitize_text_field( $_GET['location_text'] ): "";
$geo_lat = isset( $_GET['geo_lat'] ) ? sanitize_text_field( $_GET['geo_lat'] ): "";
$geo_long = isset( $_GET['geo_long'] ) ? sanitize_text_field( $_GET['geo_long'] ): "";
$max_geo_radius = isset( $_GET['geo_radius'] ) ? sanitize_text_field( $_GET['geo_radius'] ): $start;
$data_deposit = [
<?php
$max_range = isset( $max_range ) && $max_range ? $max_range : apply_filters( 'opalestate_search_geo_max_range', 10 );
$range_unit = isset( $range_unit ) ? $range_unit : 'km';
$start = 1;
$location_text = isset( $_GET['location_text'] ) ? sanitize_text_field( $_GET['location_text'] ) : '';
$geo_lat = isset( $_GET['geo_lat'] ) ? sanitize_text_field( $_GET['geo_lat'] ) : '';
$geo_long = isset( $_GET['geo_long'] ) ? sanitize_text_field( $_GET['geo_long'] ) : '';
$max_geo_radius = isset( $_GET['geo_radius'] ) ? sanitize_text_field( $_GET['geo_radius'] ) : $start;
$radius_measure = isset( $_GET['radius_measure'] ) ? sanitize_text_field( $_GET['radius_measure'] ) : $range_unit;
$data_range = [
'id' => 'geo_radius',
'decimals' => 0,
'unit' => $unit,
'unit' => $range_unit,
'ranger_min' => 0,
'ranger_max' => $max_price,
'ranger_max' => $max_range,
'input_min' => 0,
'input_max' => $max_price,
'input_max' => $max_range,
'mode' => 1,
'start' => $max_geo_radius,
];
@ -21,27 +23,28 @@ $data_deposit = [
?>
<div class="input-search-city opalestate-search-opal-map">
<label class="opalestate-label opalestate-label--geo-location"><?php esc_html_e( 'Location', 'opalestate-pro' ); ?></label>
<input class="form-control opal-map-search" name="location_text" value="<?php echo esc_attr( $location_text ); ?>" placeholder="<?php esc_attr_e( 'Type City or Area', 'opalestate-pro' ); ?>">
<input class="form-control opal-map-latitude" name="geo_lat" value="<?php echo esc_attr( $geo_lat ); ?>" type="hidden">
<input class="form-control opal-map-longitude" name="geo_long" type="hidden" value="<?php echo esc_attr( $geo_long ); ?>">
<div class="map-remove"><i class="fa fa-close"></i></div>
<div class="opalestate-popup opalestate-popup-geo-location">
<div class="popup-head">
<input class="form-control opal-map-search" name="location_text" value="<?php echo esc_attr( $location_text ); ?>" placeholder="<?php esc_attr_e( 'Type City or Area', 'opalestate-pro' ); ?>">
<input class="opal-map-latitude" name="geo_lat" type="hidden" value="<?php echo esc_attr( $geo_lat ); ?>">
<input class="opal-map-longitude" name="geo_long" type="hidden" value="<?php echo esc_attr( $geo_long ); ?>">
<input class="opal-map-radius-measure" name="radius_measure" type="hidden" value="<?php echo esc_attr( $radius_measure ); ?>">
<div class="map-remove"><i class="fa fa-close"></i></div>
<div class="opalestate-popup opalestate-popup-geo-location">
<div class="popup-head">
<span class="radius-status">
<span class="radius-status__number"><?php echo absint( $max_geo_radius ); ?></span>
<span class="radius-status__unit"><?php echo esc_html( $unit ); ?></span>
<span class="radius-status__unit"><?php echo esc_html( $range_unit ); ?></span>
</span>
<span><i class="fa fa-location-arrow"></i></span>
</div>
<div class="popup-body">
<div class="popup-close"><i class="fa fa-times" aria-hidden="true"></i></div>
<span><i class="fa fa-location-arrow"></i></span>
</div>
<div class="popup-body">
<div class="popup-close"><i class="fa fa-times" aria-hidden="true"></i></div>
<div class="contact-share-form-container">
<h6><?php esc_html_e( 'Show with in', 'opalestate-pro' ); ?></h6>
<div class="box-content ">
<?php opalesate_property_slide_ranger_template( esc_html__( 'Radius', 'opalestate-pro' ), $data_deposit ); ?>
<?php opalesate_property_slide_ranger_template( esc_html__( 'Radius', 'opalestate-pro' ), $data_range ); ?>
<p><?php esc_html_e( 'Of My Location', 'opalestate-pro' ); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -12,6 +12,8 @@ $GLOBALS['group-info-column'] = 1;
$display_more_options = isset( $display_more_options ) ? $display_more_options : true;
$info_number_input = isset( $info_number_input ) ? $info_number_input : true;
$type = $info_number_input ? 'input' : 'select';
$max_range = isset( $max_range ) && $max_range ? $max_range : apply_filters( 'opalestate_search_geo_max_range', 10 );
$range_unit = isset( $range_unit ) ? $range_unit : 'km';
$form_classes = [
'opalestate-search-form',
@ -24,7 +26,7 @@ $form_classes = [
<form class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $form_classes ) ) ); ?>" action="<?php echo esc_url( opalestate_get_search_link() ); ?>" method="GET">
<div class="opal-form-content">
<div class="form-item form-item--location-text">
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text' ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text', [ 'max_range' => $max_range, 'range_unit' => $range_unit ] ); ?>
</div>
<div class="form-item form-item--types">

View File

@ -24,6 +24,8 @@ if ( isset( $nobutton ) && $nobutton ) {
}
$display_more_options = isset( $display_more_options ) ? $display_more_options : false;
$max_range = isset( $max_range ) && $max_range ? $max_range : apply_filters( 'opalestate_search_geo_max_range', 10 );
$range_unit = isset( $range_unit ) ? $range_unit : 'km';
$form_classes = [
'opalestate-search-form',
@ -36,7 +38,7 @@ $form_classes = [
<form class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $form_classes ) ) ); ?>" action="<?php echo esc_url( opalestate_get_search_link() ); ?>" method="GET">
<div class="opal-row">
<div class="col-lg-<?php echo absint( $grid[0] ); ?> col-md-<?php echo absint( $grid[0] ); ?> col-sm-<?php echo absint( $grid[0] ); ?> col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text' ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text', [ 'max_range' => $max_range, 'range_unit' => $range_unit ] ); ?>
</div>
<div class="col-lg-<?php echo absint( $grid[1] ); ?> col-md-<?php echo absint( $grid[1] ); ?> col-sm-<?php echo absint( $grid[1] ); ?> col-xs-12">