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 =
* 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(),
'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

@ -288,15 +288,15 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
];
$fields[] = [
'name' => esc_html__( 'Field type', 'opalestate-pro' ),
'options' => [
'name' => esc_html__( 'Field type', 'opalestate-pro' ),
'options' => [
'select' => esc_html__( 'Select', 'opalestate-pro' ),
'range' => esc_html__( 'Range', 'opalestate-pro' ),
'text' => esc_html__( 'Text', 'opalestate-pro' ),
],
'id' => $meta['id'] . '_search_type',
'type' => 'radio_inline',
'default' => 'select',
'id' => $meta['id'] . '_search_type',
'type' => 'radio_inline',
'default' => 'select',
];
$fields[] = [
@ -361,6 +361,20 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'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[] = [
'name' => esc_html__( 'Show Amenities tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Amenities tab in the single property page.', 'opalestate-pro' ),
@ -373,102 +387,123 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
];
$fields[] = [
'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_facilities',
'type' => 'switch',
'options' => [
'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[] = [
'name' => esc_html__( 'Show Attachments tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Attachments tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_attachments',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_facilities',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Video tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Video tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_video',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Attachments tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Attachments tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_attachments',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Virtual Tour tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Virtual Tour tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_virtual_tour',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Video tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Video tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_video',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Map tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Map tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_map',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Virtual Tour tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Virtual Tour tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_virtual_tour',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Nearby tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Nearby tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_nearby',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Map tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Map tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_map',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Walk Scores tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Walk Scores tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_walkscores',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Nearby tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Nearby tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_nearby',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Apartments tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Apartments tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_apartments',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Walk Scores tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Walk Scores tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_walkscores',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Floor Plans tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Floor Plans tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_floor_plans',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Apartments tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Apartments tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_apartments',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Floor Plans tab', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Floor Plans tab in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_floor_plans',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
@ -493,6 +528,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
'max' => 365,
],
'default' => 8,
'after_row' => '<hr>',
];
$fields[] = [
@ -507,52 +543,57 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
];
$fields[] = [
'name' => esc_html__( 'Login to show Author box', 'opalestate-pro' ),
'desc' => esc_html__( 'Require users login to show Author box', 'opalestate-pro' ),
'id' => 'enable_single_login_to_show_author_box',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Login to show Author box', 'opalestate-pro' ),
'desc' => esc_html__( 'Require users login to show Author box', 'opalestate-pro' ),
'id' => 'enable_single_login_to_show_author_box',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Enquire form', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Enquire form in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_enquire_form',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Enquire form', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Enquire form in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_enquire_form',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Mortgage Calculator', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Mortgage Calculator in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_mortgage',
'type' => 'switch',
'options' => [
'name' => esc_html__( 'Show Mortgage Calculator', 'opalestate-pro' ),
'desc' => esc_html__( 'Show Mortgage Calculator in the single property page.', 'opalestate-pro' ),
'id' => 'enable_single_mortgage',
'type' => 'switch',
'options' => [
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
],
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Related properties layout', 'opalestate-pro' ),
'desc' => esc_html__( 'Select a layout for related properties.', 'opalestate-pro' ),
'id' => 'single_related_properties_layout',
'type' => 'select',
'options' => opalestate_get_loop_property_layouts(),
'name' => esc_html__( 'Related properties layout', 'opalestate-pro' ),
'desc' => esc_html__( 'Select a layout for related properties.', 'opalestate-pro' ),
'id' => 'single_related_properties_layout',
'type' => 'select',
'options' => opalestate_get_loop_property_layouts(),
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Nearby properties layout', 'opalestate-pro' ),
'desc' => esc_html__( 'Select a layout for nearby properties.', 'opalestate-pro' ),
'id' => 'single_nearby_properties_layout',
'type' => 'select',
'options' => opalestate_get_loop_property_layouts(),
'name' => esc_html__( 'Nearby properties layout', 'opalestate-pro' ),
'desc' => esc_html__( 'Select a layout for nearby properties.', 'opalestate-pro' ),
'id' => 'single_nearby_properties_layout',
'type' => 'select',
'options' => opalestate_get_loop_property_layouts(),
'after_row' => '<hr>',
];
return $fields;

View File

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

View File

@ -133,8 +133,14 @@ function opalestate_upload_base64_image( $file, $parent_id = 0 ) {
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 ) {
@ -147,9 +153,20 @@ function opalestate_get_time_lapses( $lapse = 15 ) {
$end_str = strtotime( $end );
$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 ) {
$output[ date( 'h:i a', $now_str ) ] = date( 'h:i A', $now_str );
$now_str = strtotime( $interval, $now_str );
$output[ date( $time_format_value, $now_str ) ] = date( $time_format_show, $now_str );
$now_str = strtotime( $interval, $now_str );
}
return $output;
@ -1199,7 +1216,7 @@ add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_mu
* @return array
*/
function opalestate_get_measurement_units() {
return apply_filters( 'opalestate_measurement_unit', [
return apply_filters( 'opalestate_measurement_units', [
'sqft' => esc_html__( 'sq ft', 'opalestate-pro' ),
'sqm' => esc_html__( 'sq m', '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.
*

View File

@ -343,3 +343,12 @@ function opalestate_single_property_sidebar_widgets() {
}
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 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.3.4
* Version: 1.3.5
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.9
@ -150,7 +150,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.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() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.4' );
define( 'OPALESTATE_VERSION', '1.3.5' );
}
// 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.3.4
Stable tag: 1.3.5
License: GPLv3
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")
== Changelog ==
= 1.3.5 - 2020-02-28 =
* Added - Time format setting
* Added - Hide unset amenities settings
= 1.3.4 - 2020-02-21 =
* Fixes - Enquire email & Contact email