Update hooks & settings

This commit is contained in:
Hoang Huu 2019-09-20 14:37:55 +07:00
parent 044ef293da
commit 7fe9e71ec0
7 changed files with 70 additions and 69 deletions

View File

@ -63,7 +63,8 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
], ],
[ [
'name' => esc_html__( 'Enable Message Database', 'opalestate-pro' ), 'name' => esc_html__( 'Enable Message Database', 'opalestate-pro' ),
'desc' => esc_html__( 'Allow User send message Contact/Equire via email and saved into database to exchange theirs message direct in User Message Management', 'opalestate-pro' ), 'desc' => esc_html__( 'Allow User send message Contact/Equire via email and saved into database to exchange theirs message direct in User Message Management',
'opalestate-pro' ),
'id' => 'message_log', 'id' => 'message_log',
'type' => 'switch', 'type' => 'switch',
'options' => [ 'options' => [
@ -95,7 +96,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'id' => 'upload_other_max_size', 'id' => 'upload_other_max_size',
'type' => 'text', 'type' => 'text',
'default' => '0.8' 'default' => '0.8',
], ],
[ [
'name' => esc_html__( 'Maximun Upload Other Files', 'opalestate-pro' ), 'name' => esc_html__( 'Maximun Upload Other Files', 'opalestate-pro' ),
@ -104,7 +105,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'id' => 'upload_other_max_files', 'id' => 'upload_other_max_files',
'type' => 'text', 'type' => 'text',
'default' => '10', 'default' => '10',
'after_row' => '<hr>' 'after_row' => '<hr>',
], ],
[ [
'name' => esc_html__( 'Agent Image Size', 'opalestate-pro' ), 'name' => esc_html__( 'Agent Image Size', 'opalestate-pro' ),
@ -147,7 +148,7 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
'type' => 'select', 'type' => 'select',
'default' => 'full', 'default' => 'full',
'options' => opalestate_get_featured_image_sizes(), 'options' => opalestate_get_featured_image_sizes(),
'after_row' => '<em>' . esc_html__( 'To generate images with new image sizes, you can use this <a href="https://goo.gl/FuXFex" target="_blank">Force Regenerate Thumbnails</a>', 'after_row' => '<em>' . __( 'To generate images with new image sizes, you can use this <a href="https://goo.gl/FuXFex" target="_blank">Force Regenerate Thumbnails</a>',
'opalestate-pro' ) . '</em>', 'opalestate-pro' ) . '</em>',
], ],
[ [
@ -232,16 +233,11 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
], ],
[ [
'name' => esc_html__( 'Measurement Unit', 'opalestate-pro' ), 'name' => esc_html__( 'Measurement Unit', 'opalestate-pro' ),
'desc' => esc_html__( 'Measurement Unit', 'opalestate-pro' ), 'desc' => esc_html__( 'Select a measurement unit.', 'opalestate-pro' ),
'id' => 'measurement_unit', 'id' => 'measurement_unit',
'type' => 'select', 'type' => 'select',
'options' => apply_filters( 'opalestate_measurement_unit', [ 'options' => opalestate_get_measurement_units(),
'sq ft' => esc_html__( 'sq ft', 'opalestate-pro' ), 'default' => 'sqft',
'sq m' => esc_html__( 'sq m', 'opalestate-pro' ),
'mq' => esc_html__( 'mq', 'opalestate-pro' ),
'm2' => esc_html__( 'm2', 'opalestate-pro' ),
] ),
'default' => 'sq ft',
], ],
[ [
'name' => esc_html__( 'Google Map API', 'opalestate-pro' ), 'name' => esc_html__( 'Google Map API', 'opalestate-pro' ),

View File

@ -90,7 +90,7 @@ class Opalestate_Install {
$options['test_mode'] = 1; $options['test_mode'] = 1;
$options['currency'] = 'USD'; $options['currency'] = 'USD';
$options['currency_position'] = 'before'; $options['currency_position'] = 'before';
$options['measurement_unit'] = 'sq ft'; $options['measurement_unit'] = 'sqft';
$options['google_map_api_keys'] = 'AIzaSyCfMVNIa7khIqYHCw6VBn8ShUWWm4tjbG8'; $options['google_map_api_keys'] = 'AIzaSyCfMVNIa7khIqYHCw6VBn8ShUWWm4tjbG8';
$options['admin_approve'] = 'on'; $options['admin_approve'] = 'on';
$options['require_input_price'] = 'on'; $options['require_input_price'] = 'on';
@ -131,7 +131,6 @@ class Opalestate_Install {
$options['enable_submission_tab_facilities'] = 'on'; $options['enable_submission_tab_facilities'] = 'on';
$options['enable_submission_tab_apartments'] = 'on'; $options['enable_submission_tab_apartments'] = 'on';
$options['enable_submission_tab_floor_plans'] = 'on'; $options['enable_submission_tab_floor_plans'] = 'on';
} }
// Checks if the Success Page option exists AND that the page exists // Checks if the Success Page option exists AND that the page exists
@ -140,7 +139,7 @@ class Opalestate_Install {
$profile_page = wp_insert_post( $profile_page = wp_insert_post(
[ [
'post_title' => esc_html__( 'User Dashboard Page', 'opalestate-pro' ), 'post_title' => esc_html__( 'User Dashboard Page', 'opalestate-pro' ),
'post_content' => esc_html__( '', 'opalestate-pro' ), 'post_content' => '',
'post_status' => 'publish', 'post_status' => 'publish',
'post_author' => 1, 'post_author' => 1,
'post_type' => 'page', 'post_type' => 'page',

View File

@ -1133,3 +1133,17 @@ function opalestate_add_hidden_multilingual() {
} }
add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_multilingual' ); add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_multilingual' );
/**
* Gets measurement units.
*
* @return array
*/
function opalestate_get_measurement_units() {
return apply_filters( 'opalestate_measurement_unit', [
'sqft' => esc_html__( 'sq ft', 'opalestate-pro' ),
'sqm' => esc_html__( 'sq m', 'opalestate-pro' ),
'mq' => esc_html__( 'mq', 'opalestate-pro' ),
'm2' => esc_html__( 'm2', 'opalestate-pro' ),
] );
}

View File

@ -293,7 +293,6 @@ class Opalestate_Property_MetaBox {
$prefix = OPALESTATE_PROPERTY_PREFIX; $prefix = OPALESTATE_PROPERTY_PREFIX;
$fields = [ $fields = [
[ [
'name' => esc_html__( 'Built year', 'opalestate-pro' ), 'name' => esc_html__( 'Built year', 'opalestate-pro' ),
'id' => $prefix . 'builtyear', 'id' => $prefix . 'builtyear',
@ -302,9 +301,7 @@ class Opalestate_Property_MetaBox {
'before_row' => '<div class="row-group-features group-has-three group-property-info clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Property Information', 'opalestate-pro' ) ) . '</h3>', 'before_row' => '<div class="row-group-features group-has-three group-property-info clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Property Information', 'opalestate-pro' ) ) . '</h3>',
// callback // callback
], ],
[ [
'name' => esc_html__( 'Parking', 'opalestate-pro' ), 'name' => esc_html__( 'Parking', 'opalestate-pro' ),
'id' => $prefix . 'parking', 'id' => $prefix . 'parking',

View File

@ -168,11 +168,9 @@ class Opalestate_Property {
$fields = Opalestate_Property_MetaBox::metaboxes_info_fields(); $fields = Opalestate_Property_MetaBox::metaboxes_info_fields();
foreach ( $fields as $a => $field ) { foreach ( $fields as $a => $field ) {
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $field['id'] );
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, "", $field['id'] );
if ( $field['type'] == 'multicheck' || $field['type'] == 'select' ) { if ( $field['type'] == 'multicheck' || $field['type'] == 'select' ) {
$opt_values = (array) get_post_meta( $this->post_id, $field['id'] ); $opt_values = (array) get_post_meta( $this->post_id, $field['id'] );
if ( ! empty( $opt_values ) && isset( $field['options'] ) ) { if ( ! empty( $opt_values ) && isset( $field['options'] ) ) {
$tmp = []; $tmp = [];
@ -194,7 +192,7 @@ class Opalestate_Property {
} }
} }
return $this->metabox_info; return apply_filters( 'opalestate_property_metabox_info', $this->metabox_info );
} }
public function get_id() { public function get_id() {
@ -240,6 +238,7 @@ class Opalestate_Property {
$prop->icon = OPALESTATE_PLUGIN_URL . '/assets/map/market_icon.png'; $prop->icon = OPALESTATE_PLUGIN_URL . '/assets/map/market_icon.png';
} }
$prop->icon = apply_filters( 'opalestate_prop_icon', $prop->icon );
$prop->featured = $this->featured; $prop->featured = $this->featured;
@ -281,7 +280,6 @@ class Opalestate_Property {
if ( ! empty( $meta ) ) { if ( ! empty( $meta ) ) {
$fields = $this->get_meta_fullinfo(); $fields = $this->get_meta_fullinfo();
foreach ( $meta as $key => $value ) { foreach ( $meta as $key => $value ) {
if ( isset( $fields[ $value ] ) ) { if ( isset( $fields[ $value ] ) ) {
$output[ $value ] = $fields[ $value ]; $output[ $value ] = $fields[ $value ];
} }

View File

@ -1,7 +1,7 @@
<?php <?php
function opalestate_submssion_list_page( $args = [] ) { function opalestate_submssion_list_page( $args = [] ) {
return opalestate_get_user_management_page_uri( array('tab' => 'submission_list') ); return opalestate_get_user_management_page_uri( [ 'tab' => 'submission_list' ] );
} }
function opalestate_get_user_management_page_uri( $args = [] ) { function opalestate_get_user_management_page_uri( $args = [] ) {
@ -24,33 +24,34 @@ function opalestate_get_user_management_page_uri( $args = [] ) {
function opalestate_get_current_url( $args = [] ) { function opalestate_get_current_url( $args = [] ) {
global $wp; global $wp;
if( isset($_GET['tab']) && $_GET['tab'] ) { if ( isset( $_GET['tab'] ) && $_GET['tab'] ) {
$args['tab'] = $_GET['tab']; $args['tab'] = $_GET['tab'];
} }
$current_url = home_url( add_query_arg( $args, $wp->request ) ); $current_url = home_url( add_query_arg( $args, $wp->request ) );
return $current_url; return $current_url;
} }
function opalestate_get_user_tab_uri( $tab ) { function opalestate_get_user_tab_uri( $tab ) {
$args['tab'] = $tab ; $args['tab'] = $tab;
return opalestate_get_current_url( $args ); return opalestate_get_current_url( $args );
} }
function opalestate_management_show_content_page_tab() { function opalestate_management_show_content_page_tab() {
$tab = isset($_GET['tab']) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ): 'dashboard'; $tab = isset( $_GET['tab'] ) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ) : 'dashboard';
$fnc = 'opalestate_user_content_'.$tab.'_page'; $fnc = 'opalestate_user_content_' . $tab . '_page';
$content = apply_filters( $fnc, '' ); $content = apply_filters( $fnc, '' );
if( $content ) { if ( $content ) {
echo $content; echo $content;
} else { } else {
if( function_exists( $fnc ) ) { if ( function_exists( $fnc ) ) {
$fnc(); $fnc();
} else { } else {
opalestate_user_content_dashboard_page(); opalestate_user_content_dashboard_page();
@ -75,7 +76,7 @@ function opalestate_user_savedsearch_page( $args = [] ) {
} }
function opalestate_my_account_page( $id = false, $args = array() ) { function opalestate_my_account_page( $id = false, $args = [] ) {
$page = get_permalink( opalestate_get_option( 'user_myaccount_page', '/' ) ); $page = get_permalink( opalestate_get_option( 'user_myaccount_page', '/' ) );
if ( $id ) { if ( $id ) {
@ -83,15 +84,16 @@ function opalestate_my_account_page( $id = false, $args = array() ) {
$page = $edit_page_id ? get_permalink( $edit_page_id ) : $page; $page = $edit_page_id ? get_permalink( $edit_page_id ) : $page;
$page = add_query_arg( 'id', $id, $page ); $page = add_query_arg( 'id', $id, $page );
} }
if( $args ){ if ( $args ) {
foreach( $args as $key => $value ) { foreach ( $args as $key => $value ) {
$page = add_query_arg( $key, $value, $page ); $page = add_query_arg( $key, $value, $page );
} }
} }
return $page; return $page;
} }
function opalestate_submssion_page( $id = false, $args = array() ) { function opalestate_submssion_page( $id = false, $args = [] ) {
$page = get_permalink( opalestate_get_option( 'submission_page', '/' ) ); $page = get_permalink( opalestate_get_option( 'submission_page', '/' ) );
@ -100,11 +102,12 @@ function opalestate_submssion_page( $id = false, $args = array() ) {
$page = $edit_page_id ? get_permalink( $edit_page_id ) : $page; $page = $edit_page_id ? get_permalink( $edit_page_id ) : $page;
$page = add_query_arg( 'id', $id, $page ); $page = add_query_arg( 'id', $id, $page );
} }
if( $args ){ if ( $args ) {
foreach( $args as $key => $value ) { foreach ( $args as $key => $value ) {
$page = add_query_arg( $key, $value, $page ); $page = add_query_arg( $key, $value, $page );
} }
} }
return $page; return $page;
} }
@ -145,14 +148,7 @@ function opalestate_management_user_menu_tabs() {
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0, 'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
]; ];
$menu['reviews'] = [ if ( opalestate_get_option( 'message_log' ) ) {
'icon' => 'fa fa-star',
'link' => 'reviews',
'title' => esc_html__( 'Reviews', 'opalestate-pro' ),
'id' => isset( $opalestate_options['reviews_page'] ) ? $opalestate_options['reviews_page'] : 0,
];
if( opalestate_get_option('message_log') ) {
$menu['messages'] = [ $menu['messages'] = [
'icon' => 'fa fa-envelope', 'icon' => 'fa fa-envelope',
'link' => 'messages', 'link' => 'messages',
@ -186,7 +182,7 @@ function opalestate_management_user_menu_tabs() {
$current_tab = isset( $_GET['tab'] ) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ) : 'dashboard'; $current_tab = isset( $_GET['tab'] ) && $_GET['tab'] ? sanitize_text_field( $_GET['tab'] ) : 'dashboard';
foreach ( $menu as $key => $item ) { foreach ( $menu as $key => $item ) {
if( preg_match("#http#", $item['link']) ){ if ( preg_match( "#http#", $item['link'] ) ) {
$link = $item['link']; $link = $item['link'];
} else { } else {
$link = $uri . '?tab=' . $item['link']; $link = $uri . '?tab=' . $item['link'];
@ -202,7 +198,7 @@ function opalestate_management_user_menu_tabs() {
echo $output; echo $output;
} }
function opalestate_user_content_dashboard_page(){ function opalestate_user_content_dashboard_page() {
echo opalestate_load_template_path( 'user/dashboard' ); echo opalestate_load_template_path( 'user/dashboard' );
} }

View File

@ -12,7 +12,8 @@ Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set
== Description == == Description ==
Whether you want to create a website for your real estate business and you are meeting difficulties to pick a suitable real estate plugin to install in your property site. Opal real estate plugin Pro will be your best choice to help you control your site in a perfect way. Whether you want to create a website for your real estate business and you are meeting difficulties to pick a suitable real estate plugin to install in your property site. Opal Estate Pro plugin will
be your best choice to help you control your site in a perfect way.
The plugin will not make you disappointed with ease of use, friendly & flexible with users, high advanced functions and a range of powerful feature updated insight. They are created for selling, buying or renting an apartment, villa, house, flat, etc. Scroll down to see how awesome it is! The plugin will not make you disappointed with ease of use, friendly & flexible with users, high advanced functions and a range of powerful feature updated insight. They are created for selling, buying or renting an apartment, villa, house, flat, etc. Scroll down to see how awesome it is!