Add property settings

This commit is contained in:
Hoang Huu 2020-02-28 15:12:31 +07:00
parent 40bcb3b3b2
commit ca997b7dde
9 changed files with 473 additions and 344 deletions

View File

@ -1,3 +1,7 @@
= 1.3.5 - 2020-02-28 =
* Added - Time format setting
* Added - Hide unset amenities settings
= 1.3.4 - 2020-02-21 = = 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email * Fixes - Enquire email & Contact email

View File

@ -226,6 +226,14 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'options' => opalestate_get_measurement_units(), 'options' => opalestate_get_measurement_units(),
'default' => 'sqft', 'default' => 'sqft',
], ],
[
'name' => esc_html__( 'Time Format', 'opalestate-pro' ),
'desc' => esc_html__( 'Select a time format.', 'opalestate-pro' ),
'id' => 'time_format',
'type' => 'select',
'options' => opalestate_get_time_formats(),
'default' => '12_hour',
],
] ]
); );
} }

View File

@ -361,6 +361,20 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'default' => 'on', 'default' => 'on',
]; ];
$fields[] = [
'name' => esc_html__( 'Request Viewing Time Range (minute)', 'opalestate-pro' ),
'desc' => esc_html__( 'Time range from 1-60 minutes.', 'opalestate-pro' ),
'id' => 'request_viewing_time_range',
'type' => 'text_small',
'attributes' => [
'type' => 'number',
'min' => 1,
'max' => 60,
],
'default' => 15,
'after_row' => '<hr>',
];
$fields[] = [ $fields[] = [
'name' => esc_html__( 'Show Amenities tab', 'opalestate-pro' ), 'name' => esc_html__( 'Show Amenities tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Amenities tab in the single property page.', 'opalestate-pro' ), 'desc' => esc_html__( 'Show Amenities tab in the single property page.', 'opalestate-pro' ),
@ -372,6 +386,18 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
], ],
]; ];
$fields[] = [
'name' => esc_html__( 'Hide Unset amenities', 'opalestate-pro' ),
'desc' => esc_html__( 'Hide unset amenities. Default: Show unset amenities with disable icons.', 'opalestate-pro' ),
'id' => 'hide_unset_amenities',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [ $fields[] = [
'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ), 'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ), 'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ),
@ -381,6 +407,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -392,6 +419,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -403,6 +431,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -414,6 +443,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -425,6 +455,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -436,6 +467,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -447,6 +479,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -458,6 +491,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -469,6 +503,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -493,6 +528,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'max' => 365, 'max' => 365,
], ],
'default' => 8, 'default' => 8,
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -515,6 +551,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -526,6 +563,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -537,6 +575,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'on' => esc_html__( 'Enable', 'opalestate-pro' ), 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ), 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
], ],
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -545,6 +584,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'id' => 'single_related_properties_layout', 'id' => 'single_related_properties_layout',
'type' => 'select', 'type' => 'select',
'options' => opalestate_get_loop_property_layouts(), 'options' => opalestate_get_loop_property_layouts(),
'after_row' => '<hr>',
]; ];
$fields[] = [ $fields[] = [
@ -553,6 +593,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'id' => 'single_nearby_properties_layout', 'id' => 'single_nearby_properties_layout',
'type' => 'select', 'type' => 'select',
'options' => opalestate_get_loop_property_layouts(), 'options' => opalestate_get_loop_property_layouts(),
'after_row' => '<hr>',
]; ];
return $fields; return $fields;

View File

@ -712,7 +712,7 @@ class OpalEstate_User_Message {
'id' => "{$prefix}time", 'id' => "{$prefix}time",
'name' => esc_html__( 'Time', 'opalestate-pro' ), 'name' => esc_html__( 'Time', 'opalestate-pro' ),
'type' => 'select', 'type' => 'select',
'options' => opalestate_get_time_lapses(), 'options' => opalestate_get_request_viewing_time_list(),
], ],
[ [
'id' => "{$prefix}phone", 'id' => "{$prefix}phone",

View File

@ -133,8 +133,14 @@ function opalestate_upload_base64_image( $file, $parent_id = 0 ) {
return $attach_id; return $attach_id;
} }
function opalestate_get_request_viewing_time_list() {
$range_time = opalestate_get_option( 'request_viewing_time_range', 15 );
return apply_filters( 'opalestate_request_viewing_time_list', opalestate_get_time_lapses( $range_time ) );
}
/** /**
* * Gets time lapses.
*/ */
function opalestate_get_time_lapses( $lapse = 15 ) { function opalestate_get_time_lapses( $lapse = 15 ) {
@ -147,8 +153,19 @@ function opalestate_get_time_lapses( $lapse = 15 ) {
$end_str = strtotime( $end ); $end_str = strtotime( $end );
$now_str = $start_str; $now_str = $start_str;
$time_format_value = 'h:i a';
$time_format_show = 'h:i A';
if ( '24_hour' === opalestate_get_option( 'time_format' ) ) {
$time_format_value = 'H:i';
$time_format_show = 'H:i';
}
$time_format_value = apply_filters( 'opalestate_time_lapse_value', $time_format_value );
$time_format_show = apply_filters( 'opalestate_time_lapse_show', $time_format_show );
while ( $now_str <= $end_str ) { while ( $now_str <= $end_str ) {
$output[ date( 'h:i a', $now_str ) ] = date( 'h:i A', $now_str ); $output[ date( $time_format_value, $now_str ) ] = date( $time_format_show, $now_str );
$now_str = strtotime( $interval, $now_str ); $now_str = strtotime( $interval, $now_str );
} }
@ -1199,7 +1216,7 @@ add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_mu
* @return array * @return array
*/ */
function opalestate_get_measurement_units() { function opalestate_get_measurement_units() {
return apply_filters( 'opalestate_measurement_unit', [ return apply_filters( 'opalestate_measurement_units', [
'sqft' => esc_html__( 'sq ft', 'opalestate-pro' ), 'sqft' => esc_html__( 'sq ft', 'opalestate-pro' ),
'sqm' => esc_html__( 'sq m', 'opalestate-pro' ), 'sqm' => esc_html__( 'sq m', 'opalestate-pro' ),
'mq' => esc_html__( 'mq', 'opalestate-pro' ), 'mq' => esc_html__( 'mq', 'opalestate-pro' ),
@ -1207,6 +1224,18 @@ function opalestate_get_measurement_units() {
] ); ] );
} }
/**
* Gets time formats.
*
* @return array
*/
function opalestate_get_time_formats() {
return apply_filters( 'opalestate_time_formats', [
'12_hour' => esc_html__( '12-hour', 'opalestate-pro' ),
'24_hour' => esc_html__( '24-hour', 'opalestate-pro' ),
] );
}
/** /**
* Returns property statuses. * Returns property statuses.
* *

View File

@ -343,3 +343,12 @@ function opalestate_single_property_sidebar_widgets() {
} }
add_action( 'opalestate_single_property_sidebar', 'opalestate_single_property_sidebar_widgets', 99 ); add_action( 'opalestate_single_property_sidebar', 'opalestate_single_property_sidebar_widgets', 99 );
function opalestate_hide_unset_amenities( $show ) {
if ( 'off' === opalestate_get_option( 'hide_unset_amenities', 'off' ) ) {
return false;
}
return true;
}
add_filter( 'opalestate_hide_unset_amenity', 'opalestate_hide_unset_amenities' );

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro * Plugin Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * 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. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.3.4 * Version: 1.3.5
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9
@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/ */
public function __clone() { public function __clone() {
// Cloning instances of the class is forbidden // Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.4' ); _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.5' );
} }
/** /**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() { public function setup_constants() {
// Plugin version // Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) { if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.4' ); define( 'OPALESTATE_VERSION', '1.3.5' );
} }
// Plugin Folder Path // 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 Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.3.2 Tested up to: 5.3.2
Stable tag: 1.3.4 Stable tag: 1.3.5
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,10 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog == == Changelog ==
= 1.3.5 - 2020-02-28 =
* Added - Time format setting
* Added - Hide unset amenities settings
= 1.3.4 - 2020-02-21 = = 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email * Fixes - Enquire email & Contact email