Big fixes

This commit is contained in:
Hoang Huu 2020-05-04 15:53:09 +07:00
parent 453e78da8b
commit b4db533574
24 changed files with 4837 additions and 4697 deletions

View File

@ -9,7 +9,6 @@
* GooglemapSearch
*/
var GooglemapSingle = Opalestate.GooglemapSingle = function ( data, id ) {
/**
* Create Google Map In Single Property Only
*/
@ -42,11 +41,36 @@
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false
};
var propertyMap = new google.maps.Map( document.getElementById( id ), propertyMapOptions );
/**
*
*/
if ( ( typeof opalestateGmap !== 'undefined' ) ) {
switch ( opalestateGmap.style ) {
case 'standard':
propertyMapOptions.styles = GoogleMapStyles.standard;
break;
case 'silver':
propertyMapOptions.styles = GoogleMapStyles.silver;
break;
case 'retro':
propertyMapOptions.styles = GoogleMapStyles.retro;
break;
case 'dark':
propertyMapOptions.styles = GoogleMapStyles.dark;
break;
case 'night':
propertyMapOptions.styles = GoogleMapStyles.night;
break;
case 'aubergine':
propertyMapOptions.styles = GoogleMapStyles.aubergine;
break;
case 'custom':
if ( opalestateGmap.custom_style != '' ) {
propertyMapOptions.styles = $.parseJSON( opalestateGmap.custom_style );
}
break;
}
}
var propertyMap = new google.maps.Map( document.getElementById( id ), propertyMapOptions );
var createMarker = function ( position, icon ) {
@ -1580,7 +1604,7 @@
return false;
}
} );
// check any estate search form is enabled /////////////////
if ( $( '#opalestate-map-preview' ).length > 0 ) {
$( 'body' ).delegate( 'form.opalestate-search-form select', 'change', function () {
var params = $( 'form.opalestate-search-form' ).serialize();
@ -1603,12 +1627,9 @@
$( 'form.opalestate-search-form' ).submit();
} );
}
/////////// ///////
} );
} )( jQuery );
//// //////
( function ( $ ) {
'use strict';
@ -1627,8 +1648,11 @@
var latitude = mapInstance.find( '.opal-map-latitude' );
var longitude = mapInstance.find( '.opal-map-longitude' );
google.maps.event.addListener( autocomplete, 'place_changed', function () {
if ( ( typeof opalestateGmap !== 'undefined' ) && opalestateGmap.autocomplete_restrictions ) {
autocomplete.setComponentRestrictions( { 'country': JSON.parse(opalestateGmap.autocomplete_restrictions) } );
}
google.maps.event.addListener( autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
if ( !place.geometry ) {
@ -1657,7 +1681,5 @@
event.preventDefault();
}
} );
}
} )( jQuery );

View File

@ -96,9 +96,10 @@ window.opalestate_uploader = function() {
var picFile = event.target;
if ( picFile.result ) {
if( show_icon == 1 ) {
input += '<div class="inner preview-icon"><span class="btn-close"></span><i class="fas fa-paperclip"></i> '+ file.name +' </div>';
input += '<div class="inner preview-icon"><span class="btn-close fa fa-close"></span><i class="fas fa-paperclip"></i> '+ file.name +' </div>';
} else {
input += '<div class="inner preview-image"><span class="btn-close"></span><img src="'+picFile.result+'"></div>';
input += '<div class="inner preview-image"><span class="btn-close' +
' fa fa-close"></span><img src="'+picFile.result+'"></div>';
}
}

View File

@ -222,29 +222,29 @@ jQuery( document ).ready( function ( $ ) {
// sticky ////
// $( '.opalestate-sticky-column' ).stick_in_parent();
var window_width = $( window ).width();
if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else {
make_sticky();
}
$( window ).resize( function () {
window_width = $( window ).width();
if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else {
make_sticky();
}
} );
function make_sticky() {
$( '.opalestate-sticky-column' ).stick_in_parent();
}
// var window_width = $( window ).width();
//
// if ( window_width < 768 ) {
// $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
// } else {
// make_sticky();
// }
//
// $( window ).resize( function () {
//
// window_width = $( window ).width();
//
// if ( window_width < 768 ) {
// $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
// } else {
// make_sticky();
// }
//
// } );
//
// function make_sticky() {
// $( '.opalestate-sticky-column' ).stick_in_parent();
// }
////
$( '.input-group-number' ).each( function () {
@ -512,7 +512,7 @@ jQuery( document ).ready( function ( $ ) {
var nummm = wNumb( config_format );
var istart = [ imin, imax ];
if ( mode && mode == 1 && start ) {
if ( mode && mode == 1 && ( start || start == 0 ) ) {
istart = [ start ];
}

View File

@ -1,3 +1,27 @@
= 1.4.6 - 2020-04-22 =
* Fixes - Search queries.
* Removed - Sticky single property sidebar.
= 1.4.5 - 2020-04-20 =
* Fixes - Templates.
= 1.4.4 - 2020-04-17 =
* Fixes - Feature properties in submission.
* Added - Mortgage hooks.
= 1.4.3.1 - 2020-04-10 =
* Fixes - Translate strings.
= 1.4.3 - 2020-04-08 =
* Fixes - Google style in Single property page.
* Added - Autocomplete Restrictions setting.
= 1.4.2.1 - 2020-03-31 =
* Fixes - Sanitize data
= 1.4.2 - 2020-03-31 =
* Fixes - Upload images in submission page
= 1.4.1 - 2020-03-25 =
* Fixes - Split map AJAX

View File

@ -84,6 +84,14 @@ class Opalestate_Settings_3rd_party_Tab extends Opalestate_Settings_Base_Tab {
'id' => 'google_map_custom_style',
'type' => 'textarea_code',
],
[
'name' => esc_html__( 'Autocomplete Restrictions', 'opalestate-pro' ),
'desc' => __( 'Enter one or more country codes ALPHA-2 separator by ",". Example: "us" for USA. <a href="https://www.iban.com/country-codes" target="_blank">See list country codes.</a>',
'opalestate-pro' ),
'id' => 'autocomplete_restrictions',
'type' => 'text',
'default' => '',
],
];
}

View File

@ -54,6 +54,7 @@ class OpalEstate_Enqueue {
$custom_map_styles = json_decode( ( opalestate_options( 'google_map_custom_style', '' ) ) );
wp_localize_script( 'opalestate-gmap', 'opalestateGmap', [
'style' => opalestate_options( 'google_map_style', 'standard' ),
'autocomplete_restrictions' => opalestate_get_autocomplete_restrictions(),
'custom_style' => json_encode( $custom_map_styles ),
] );

View File

@ -34,7 +34,7 @@ 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 $qvalue ? $qvalue : $input_default_value; ?>" type="text" name="info[<?php echo $field; ?>]" placeholder="<?php echo esc_attr(
<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>
@ -62,7 +62,7 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
foreach ( $option_values as $value ) {
$selected = $value == $qvalue ? 'selected="selected"' : '';
$template .= '<option ' . $selected . ' value="' . $value . '">' . $value . '</option>';
$template .= '<option ' . $selected . ' value="' . esc_attr( $value ) . '">' . esc_html( $value ) . '</option>';
}
$template .= '</select>';
$template = sprintf( $template, $field, $label );

View File

@ -1349,9 +1349,9 @@ function opalestate_is_require_login_to_show_author_box() {
function opalestate_clean( $var ) {
if ( is_array( $var ) ) {
return array_map( 'opalestate_clean', $var );
} else {
return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
}
return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
}
/**
@ -1400,8 +1400,34 @@ add_action( 'widgets_init', 'opalestate_widgets_init' );
/**
* Get email date format.
*
* @return mixed|void
* @return string
*/
function opalestate_email_date_format() {
return apply_filters( 'opalestate_email_date_format', 'F j, Y, g:i a' );
}
/**
* Get autocomplete restrictions.
*
* @return string
*/
function opalestate_get_autocomplete_restrictions() {
$restrictions_option = trim( opalestate_options( 'autocomplete_restrictions', '' ) );
if ( ! $restrictions_option ) {
return '';
}
$array = explode( ',', $restrictions_option );
$results = [];
foreach ( $array as $res ) {
$results[] = strtolower( trim( $res ) );
}
if ( ! $results ) {
return '';
}
return json_encode( $results );
}

View File

@ -37,12 +37,12 @@ class OpalEstate_Search {
$posts_per_page = apply_filters( 'opalestate_search_property_per_page', opalestate_options( 'search_property_per_page', $limit ) );
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$paged = isset( $wp_query->query['paged'] ) ? $wp_query->query['paged'] : $paged;
$paged = ! empty( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : $paged;
if ( isset( $_GET['paged'] ) && intval( $_GET['paged'] ) > 0 ) {
$paged = intval( $_GET['paged'] );
if ( isset( $_GET['paged'] ) && absint( $_GET['paged'] ) > 0 ) {
$paged = absint( $_GET['paged'] );
}
$args = [
@ -56,8 +56,7 @@ class OpalEstate_Search {
$tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] =
[
$tax_query[] = [
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
@ -65,17 +64,23 @@ class OpalEstate_Search {
}
if ( isset( $_GET['state'] ) && $_GET['state'] != -1 ) {
$tax_query[] =
[
if ( is_array( $_GET['state'] ) ) {
$tax_query[] = [
'taxonomy' => 'opalestate_state',
'field' => 'slug',
'terms' => opalestate_clean( $_GET['state'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'opalestate_state',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['state'] ),
];
}
}
if ( isset( $_GET['city'] ) && $_GET['city'] != -1 ) {
$tax_query[] =
[
$tax_query[] = [
'taxonomy' => 'opalestate_city',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['city'] ),
@ -83,38 +88,59 @@ class OpalEstate_Search {
}
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) {
$tax_query[] =
[
if ( is_array( $_GET['types'] ) ) {
$tax_query[] = [
'taxonomy' => 'opalestate_types',
'field' => 'slug',
'terms' => opalestate_clean( $_GET['types'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'opalestate_types',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['types'] ),
];
}
}
if ( isset( $_GET['cat'] ) && $_GET['cat'] != -1 ) {
$tax_query[] =
[
if ( is_array( $_GET['cat'] ) ) {
$tax_query[] = [
'taxonomy' => 'property_category',
'field' => 'slug',
'terms' => opalestate_clean( $_GET['cat'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'property_category',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['cat'] ),
];
}
}
if ( isset( $_GET['status'] ) && $_GET['status'] != -1 ) {
$tax_query[] =
[
if ( is_array( $_GET['status'] ) ) {
$tax_query[] = [
'taxonomy' => 'opalestate_status',
'field' => 'slug',
'terms' => opalestate_clean( $_GET['status'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'opalestate_status',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['status'] ),
];
}
}
if ( isset( $_GET['amenities'] ) && is_array( $_GET['amenities'] ) ) {
$tax_query[] =
[
$tax_query[] = [
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => ( $_GET['amenities'] ),
'terms' => opalestate_clean( $_GET['amenities'] ),
];
}
@ -153,14 +179,14 @@ class OpalEstate_Search {
if ( $search_min_price != '' && $search_max_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
if ( $search_min_price ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => [ $search_min_price, $search_max_price ],
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
] );
];
} else {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
[
[
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
@ -174,56 +200,55 @@ class OpalEstate_Search {
'type' => 'NUMERIC',
],
],
] );
];
}
} elseif ( $search_min_price != '' && is_numeric( $search_min_price ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => $search_min_price,
'compare' => '>=',
'type' => 'NUMERIC',
] );
];
} elseif ( $search_max_price != '' && is_numeric( $search_max_price ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => $search_max_price,
'compare' => '<=',
'type' => 'NUMERIC',
] );
];
}
if ( $search_min_area != '' && $search_max_area != '' && is_numeric( $search_min_area ) && is_numeric( $search_max_area ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => [ $search_min_area, $search_max_area ],
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
] );
];
} elseif ( $search_min_area != '' && is_numeric( $search_min_area ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => $search_min_area,
'compare' => '>=',
'type' => 'NUMERIC',
] );
];
} elseif ( $search_max_area != '' && is_numeric( $search_max_area ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => $search_max_area,
'compare' => '<=',
'type' => 'NUMERIC',
] );
];
}
if ( isset( $_GET['geo_long'] ) && isset( $_GET['geo_lat'] ) ) {
if ( $_GET['location_text'] && ( empty( $_GET['geo_long'] ) || empty( $_GET['geo_lat'] ) ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'map_address',
'value' => sanitize_text_field( trim( $_GET['location_text'] ) ),
'compare' => 'LIKE',
'operator' => 'OR',
] );
];
} elseif ( $_GET['geo_lat'] && $_GET['geo_long'] ) {
$radius = isset( $_GET['geo_radius'] ) ? $_GET['geo_radius'] : 5;
@ -249,7 +274,7 @@ class OpalEstate_Search {
$args['orderby'] = 'meta_value_num';
$args['order'] = $ksearchs[1];
}
} elseif ( 'on' == opalestate_options( 'show_featured_first', 'off' ) ) {
} elseif ( 'on' === opalestate_options( 'show_featured_first', 'off' ) ) {
$args['orderby'] = [ 'meta_value' => 'DESC', 'date' => 'DESC' ];
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured';
}
@ -269,26 +294,26 @@ class OpalEstate_Search {
$max_request = isset( $_GET[ 'max_' . $request ] ) ? sanitize_text_field( $_GET[ 'max_' . $request ] ) : '';
if ( $min_request != '' && $max_request != '' && is_numeric( $min_request ) && is_numeric( $max_request ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => $meta['id'],
'value' => [ $min_request, $max_request ],
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
] );
];
} elseif ( $min_request != '' && is_numeric( $min_request ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => $meta['id'],
'value' => $min_request,
'compare' => '>=',
'type' => 'NUMERIC',
] );
];
} elseif ( $max_request != '' && is_numeric( $max_request ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => $meta['id'],
'value' => $max_request,
'compare' => '<=',
'type' => 'NUMERIC',
] );
];
}
}
}
@ -352,20 +377,20 @@ class OpalEstate_Search {
$args['meta_query'] = [ 'relation' => 'AND' ];
if ( $search_min_price != $min && is_numeric( $search_min_price ) ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_AGENT_PREFIX . 'target_min_price',
'value' => $search_min_price,
'compare' => '>=',
// 'type' => 'NUMERIC'
] );
];
}
if ( is_numeric( $search_max_price ) && $search_max_price != $max ) {
array_push( $args['meta_query'], [
$args['meta_query'][] = [
'key' => OPALESTATE_AGENT_PREFIX . 'target_max_price',
'value' => $search_max_price,
'compare' => '<=',
// 'type' => 'NUMERIC'
] );
];
}
return new WP_Query( $args );
@ -388,10 +413,8 @@ class OpalEstate_Search {
$tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] =
[
$tax_query[] = [
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
@ -399,8 +422,7 @@ class OpalEstate_Search {
}
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) {
$tax_query[] =
[
$tax_query[] = [
'taxonomy' => 'opalestate_types',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['types'] ),
@ -418,7 +440,6 @@ class OpalEstate_Search {
return new WP_Query( $args );
}
public function filter_by_geolocations() {
}
@ -444,7 +465,7 @@ class OpalEstate_Search {
continue;
}
if ( 'on' == $value ) {
if ( 'on' === $value ) {
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $meta['id'] );
$esettings[ $id ] = $meta['name'];
}
@ -467,7 +488,6 @@ class OpalEstate_Search {
* Get Json data by action ajax filter
*/
public static function get_search_json() {
$query = self::get_search_results_query();
$output = [];
@ -486,7 +506,6 @@ class OpalEstate_Search {
}
public static function render_get_properties() {
// $_GET = $_POST;
echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result' );
die;
}

View File

@ -396,11 +396,8 @@ class OpalEstate_Submission {
* FrontEnd Submission
*/
public function process_submission() {
if ( isset( $_POST['submission_action'] ) && ! empty( $_POST['submission_action'] ) ) {
if ( wp_verify_nonce( $_POST['submission_action'], 'submitted-property' ) ) {
$user_id = get_current_user_id();
$edit = false;
$prefix = OPALESTATE_PROPERTY_PREFIX;
@ -421,7 +418,7 @@ class OpalEstate_Submission {
$post_status = 'pending';
if ( 'on' != opalestate_get_option( 'admin_approve', 'on' ) ) {
if ( 'on' !== opalestate_get_option( 'admin_approve', 'on' ) ) {
$post_status = 'publish';
}
@ -485,7 +482,7 @@ class OpalEstate_Submission {
/*
* Processing upload files
*/
$this->process_upload_files( $post_id, $_POST );
$this->process_upload_files( $post_id );
/**
* Fetch sanitized values
@ -513,12 +510,14 @@ class OpalEstate_Submission {
update_post_meta( $post_id, $prefix . 'featured_image', null );
// Update SKU.
if ( 'on' == opalestate_get_option( 'enable_submission_generate_sku', 'off' ) ) {
if ( 'on' === opalestate_get_option( 'enable_submission_generate_sku', 'off' ) ) {
$_sku = str_replace( '{property_id}', $post_id, opalestate_options( 'submission_sku_format', 'SKU-{property_id}' ) );
$sku_generated = apply_filters( 'opalestate_submission_sku_generated', sanitize_text_field( $_sku ) );
update_post_meta( $post_id, $prefix . 'sku', $sku_generated );
}
update_post_meta( $post_id, $prefix . 'featured', '' );
//redirect
$_SESSION['messages'][] = [ 'success', esc_html__( 'Property has been successfully updated.', 'opalestate-pro' ) ];
@ -577,11 +576,8 @@ class OpalEstate_Submission {
* @param int $post_id Post ID.
*/
private function process_upload_files( $post_id ) {
//upload images for featured and gallery images
if ( isset( $_FILES ) && ! empty( $_FILES ) ) {
///
$fields = [
$this->get_field_name( 'gallery' ),
$this->get_field_name( 'featured_image' ),
@ -592,7 +588,6 @@ class OpalEstate_Submission {
if ( in_array( $key, $fields ) ) {
$ufile = $_FILES[ $key ];
/// /////
if ( isset( $ufile['name'] ) && is_array( $ufile['name'] ) ) {
$output = [];

View File

@ -149,7 +149,7 @@ class Opalestate_Taxonomy_Type {
public static function get_multi_check_list( $stypes ) {
$list = self::get_list();
echo opalestate_terms_multi_check( $list, $stypes );
echo opalestate_terms_multi_check( $list );
}
}

View File

@ -126,14 +126,14 @@ function opalestate_get_read_message_uri( $message_id ) {
return opalestate_get_current_url( $args );
}
if ( ! function_exists( 'opalestate_terms_multi_check' ) ) {
function opalestate_terms_multi_check( $terms ) {
$html = '<div class="opal-form-group">';
foreach ( $terms as $term ) {
$id = time() . '-' . $term->slug;
$html .= '<div class="group-item">';
$html .= '<input type="checkbox" class="form-control-checkbox" id="' . $id . '" name="types[' . $term->slug . ']" id="' . $id . '" value="' . $term->slug . '">';
$html .= '<input type="checkbox" class="form-control-checkbox" id="' . $id . '" name="types[]" id="' . $id . '" value="' . $term->slug . '">';
$html .= ' <label for="' . $id . '">' . $term->name . '</label>';
$html .= '</div>';
}
@ -142,7 +142,9 @@ function opalestate_terms_multi_check( $terms ) {
return $html;
}
}
if ( ! function_exists( 'opalestate_categories_multi_check' ) ) {
function opalestate_categories_multi_check( $terms ) {
$html = '<div class="opal-form-group">';
@ -158,6 +160,7 @@ function opalestate_categories_multi_check( $terms ) {
return $html;
}
}
function opalestate_get_image_by_id( $id ) {
if ( $id ) {
@ -169,12 +172,8 @@ function opalestate_get_image_by_id( $id ) {
return '';
}
/**
*
*/
if ( ! function_exists( 'opalestate_get_loop_thumbnail' ) ) {
function opalestate_get_loop_thumbnail( $size = 'property-thumbnail' ) { ?>
<div class="property-box-image">
<a href="<?php the_permalink(); ?>" class="property-box-image-inner">
<?php if ( has_post_thumbnail() ) : ?>
@ -186,12 +185,10 @@ function opalestate_get_loop_thumbnail( $size = 'property-thumbnail' ) { ?>
</div>
<?php
}
}
/**
*
*/
if ( ! function_exists( 'opalestate_get_loop_agent_thumbnail' ) ) {
function opalestate_get_loop_agent_thumbnail( $size = 'agent-thumbnail' ) { ?>
<div class="agent-box-image">
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
@ -203,6 +200,7 @@ function opalestate_get_loop_agent_thumbnail( $size = 'agent-thumbnail' ) { ?>
</div>
<?php
}
}
function opalestate_get_loop_short_meta() {
echo opalestate_load_template_path( 'parts/property-loop-short-meta' );

View File

@ -1,23 +1,9 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'CMB2_Uploader_Button' ) ) {
/**
* Class CMB2_Uploader_Button
*/
@ -27,8 +13,8 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
* Constructor
*/
public function __construct() {
add_action( 'cmb2_render_uploader', array( $this, 'callback' ), 10, 5 );
add_action( 'admin_head', array( $this, 'admin_head' ) );
add_action( 'cmb2_render_uploader', [ $this, 'callback' ], 10, 5 );
add_action( 'admin_head', [ $this, 'admin_head' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'scripts_styles' ], 99 );
}
@ -67,18 +53,17 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
* Render content input field.
*/
public function callback( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
wp_enqueue_script( 'cmb2-uploader' );
$field_name = $field->_name();
$args = array(
$args = [
'type' => 'checkbox',
'id' => $field_name,
'name' => $field_name,
'desc' => '',
'value' => 'on',
);
];
if ( $escaped_value == 'on' || $escaped_value == 1 ) {
$args['checked'] = 'checked';
@ -93,20 +78,20 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
$attrs .= ' accept="' . $field->args['accept'] . '" ';
$info = array(
$info = [
'size' => opalestate_options( 'upload_other_max_size', 0.5 ),
'number' => opalestate_options( 'upload_other_max_files', 10)
);
'number' => opalestate_options( 'upload_other_max_files', 10 ),
];
$class = 'upload-file-wrap';
} else {
$attrs .= ' accept="image/*" ';
$class = 'upload-image-wrap';
$info = array(
$info = [
'size' => opalestate_options( 'upload_image_max_size', 0.5 ),
'number' => opalestate_options( 'upload_image_max_files', 10)
);
'number' => opalestate_options( 'upload_image_max_files', 10 ),
];
}
if ( $single ) {
$info['number'] = 1;
@ -119,7 +104,7 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $key, $show_icon ); ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $key; ?>">
<input type="hidden" name="<?php echo $field_name; ?>[<?php echo $key; ?>]" value="<?php echo $url; ?>">
</div>
<?php endforeach; ?>
<?php elseif ( $escaped_value && ! is_array( $escaped_value ) ): ?>
@ -141,7 +126,7 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
<div class="button-placehold">
<div class="button-placehold-content">
<i class="fa fa-plus"></i>
<span><?php esc_html_e( "Upload", "opalestate" ); ?></span>
<span><?php esc_html_e( "Upload", "opalestate-pro" ); ?></span>
</div>
</div>
<input type="file" name="<?php echo $args['id']; ?>" <?php echo $attrs; ?> class="select-file" style="visibility: hidden;">
@ -153,7 +138,6 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
<?php
echo sprintf( esc_html__( 'Allow upload file have size < %s MB and maximum number of files: %s', 'opalestate-pro' ),
'<strong>' . $info['size'] . '</strong>', '<strong>' . $info['number'] . '</strong>' ); ?>
</i>
</p>
<?php
@ -164,10 +148,9 @@ if( !class_exists( 'CMB2_Uploader_Button' ) ) {
*/
public function admin_head() {
?>
<?php
}
}
$uploader = new CMB2_Uploader_Button();
}

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.4.1
* Version: 1.4.6
* 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.8' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.4.6' );
}
/**
@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.8' );
define( 'OPALESTATE_VERSION', '1.4.6' );
}
// 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.4.1
Stable tag: 1.4.3.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,30 @@ 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.4.6 - 2020-04-22 =
* Fixes - Search queries.
* Removed - Sticky single property sidebar.
= 1.4.5 - 2020-04-20 =
* Fixes - Templates.
= 1.4.4 - 2020-04-17 =
* Fixes - Feature properties in submission.
* Added - Mortgage hooks.
= 1.4.3.1 - 2020-04-10 =
* Fixes - Translate strings.
= 1.4.3 - 2020-04-08 =
* Fixes - Google style in Single property page.
* Added - Autocomplete Restrictions setting.
= 1.4.2.1 - 2020-03-31 =
* Fixes - Sanitize data
= 1.4.2 - 2020-03-31 =
* Fixes - Upload images in submission page
= 1.4.1 - 2020-03-25 =
* Fixes - Split map AJAX

View File

@ -66,7 +66,7 @@ $agent = new OpalEstate_Agent();
<?php $fax = $agent->get_meta( 'fax' ); ?>
<?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-fax">
<i class="fa fa-fax"></i><span><?php echo esc_attr( $fax ); ?></span>
<i class="fa fa-fax"></i><span><?php echo esc_html( $fax ); ?></span>
</div>
<?php endif; ?>

View File

@ -74,7 +74,7 @@ if ( $agent_id ) {
<div class="agent-box-email">
<i class="fa fa-envelope"></i>
<a href="mailto:<?php echo esc_attr( $email ); ?>">
<span><?php echo esc_attr( $email ); ?></span>
<span><?php echo esc_html( $email ); ?></span>
</a>
</div>
<?php endif; ?>
@ -84,7 +84,7 @@ if ( $agent_id ) {
<div class="agent-box-phone">
<i class="fa fa-phone"></i>
<a href="tel:<?php echo sanitize_title( $phone ); ?>">
<span><?php echo esc_attr( $phone ); ?></span>
<span><?php echo esc_html( $phone ); ?></span>
</a>
</div>
<?php endif; ?>
@ -94,7 +94,7 @@ if ( $agent_id ) {
<div class="agent-box-mobile">
<i class="fa fa-mobile"></i>
<a href="tel:<?php echo sanitize_title( $mobile ); ?>">
<span><?php echo esc_attr( $mobile ); ?></span>
<span><?php echo esc_html( $mobile ); ?></span>
</a>
</div>
<?php endif; ?>
@ -102,7 +102,7 @@ if ( $agent_id ) {
<?php $fax = $agent->get_meta( 'fax' ); ?>
<?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-fax">
<i class="fa fa-fax"></i><span><?php echo esc_attr( $fax ); ?></span>
<i class="fa fa-fax"></i><span><?php echo esc_html( $fax ); ?></span>
</div>
<?php endif; ?>
@ -111,7 +111,7 @@ if ( $agent_id ) {
<div class="agent-box-web">
<i class="fa fa-globe"></i>
<a href="<?php echo esc_attr( $web ); ?>" rel="nofollow" target="_blank">
<span><?php echo esc_attr( $web ); ?></span>
<span><?php echo esc_html( $web ); ?></span>
</a>
</div>
<?php endif; ?>

View File

@ -26,19 +26,17 @@ wp_localize_script( 'opalestate-scripts', 'opalestate_mortgage',
]
);
$max_price = intval( $property && $property->get_price() ) ? $property->get_price() : opalestate_options( 'search_max_price', 10000000 );
$max_price = str_replace( ",", "", $max_price );
$max_price = str_replace( ".", "", $max_price );
$max_price = (int) ( $property && $property->get_price() ) ? $property->get_price() : opalestate_options( 'search_max_price', 10000000 );
$max_price = str_replace( [ ",", "." ], "", $max_price );
$start_price = $max_price;
$max_price = $max_price + ( $max_price * 20 / 100 );
$max_price = apply_filters( 'opalestate_mortgage_max_price', $max_price + ( $max_price * 20 / 100 ) );
$rate_start = 10;
$rate_start = apply_filters( 'opalestate_mortgage_rate_start', 10 );
$interest_rate_start = $rate_start / 100;
$years_start = 2;
$deposit_start = $max_price / 2;
$years_start = apply_filters( 'opalestate_mortgage_years_start', 2 );
$deposit_start = apply_filters( 'opalestate_mortgage_deposit_start', $max_price / 2 );
$loan_amount = $max_price - $deposit_start;
$interest_rate_month = $interest_rate_start / 12;
$number_of_payments_month = $years_start * 12;
@ -97,7 +95,7 @@ $data_years = [
'step' => 0.5,
];
if ( opalestate_options( 'currency_position', 'before' ) == 'before' ) {
if ( opalestate_options( 'currency_position', 'before' ) === 'before' ) {
$data_sale_price['unit_position'] = 'prefix';
$data_deposit['unit_position'] = 'prefix';
}

View File

@ -106,7 +106,7 @@ $address = $agency->get_meta( 'address' ); ?>
<?php $mobile = get_post_meta( $id, OPALESTATE_AGENCY_PREFIX . 'mobile', true ); ?>
<?php if ( ! empty( $mobile ) ) : ?>
<div class="agency-box-mobile">
<i class="fa fa-mobile"></i><span><a href="tel:<?php echo esc_attr( $phone ); ?>"><?php echo esc_attr( $mobile ); ?></a></span>
<i class="fa fa-mobile"></i><span><a href="tel:<?php echo esc_attr( $mobile ); ?>"><?php echo esc_html( $mobile ); ?></a></span>
</div><!-- /.agency-box-phone -->
<?php endif; ?>

View File

@ -62,7 +62,7 @@ $agent = new OpalEstate_Agent();
<div class="agent-box-mobile">
<i class="fa fa-mobile"></i>
<a href="tel:<?php echo sanitize_title( $mobile ); ?>">
<span><?php echo esc_attr( $mobile ); ?></span>
<span><?php echo esc_html( $mobile ); ?></span>
</a>
</div>
<?php endif; ?>

View File

@ -50,7 +50,7 @@
<div class="agent-box-email">
<i class="fa fa-envelope"></i>
<a href="mailto:<?php echo esc_attr( $email ); ?>">
<span><?php echo esc_attr( $email ); ?></span>
<span><?php echo esc_html( $email ); ?></span>
</a>
</div><!-- /.agent-box-email -->
<?php endif; ?>
@ -59,21 +59,21 @@
<?php $phone = get_post_meta( $id, $prefix . 'phone', true ); ?>
<?php if ( ! empty( $phone ) ) : ?>
<div class="agent-box-phone">
<i class="fa fa-phone"></i><span><a href="tel:<?php echo sanitize_title( $phone ); ?>"><?php echo esc_attr( $phone ); ?></a></span>
<i class="fa fa-phone"></i><span><a href="tel:<?php echo sanitize_title( $phone ); ?>"><?php echo esc_html( $phone ); ?></a></span>
</div><!-- /.agent-box-phone -->
<?php endif; ?>
<?php $mobile = get_post_meta( $id, $prefix . 'mobile', true ); ?>
<?php if ( ! empty( $mobile ) ) : ?>
<div class="agent-box-mobile">
<i class="fa fa-mobile"></i><span><a href="tel:<?php echo sanitize_title( $phone ); ?>"><?php echo esc_attr( $mobile ); ?></a></span>
<i class="fa fa-mobile"></i><span><a href="tel:<?php echo sanitize_title( $mobile ); ?>"><?php echo esc_html( $mobile ); ?></a></span>
</div><!-- /.agent-box-phone -->
<?php endif; ?>
<?php $fax = get_post_meta( $id, $prefix . 'fax', true ); ?>
<?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-fax">
<i class="fa fa-fax"></i><span><?php echo esc_attr( $fax ); ?></span>
<i class="fa fa-fax"></i><span><?php echo esc_html( $fax ); ?></span>
</div><!-- /.agent-box-phone -->
<?php endif; ?>
@ -82,7 +82,7 @@
<div class="agent-box-web">
<i class="fa fa-globe"></i>
<a href="<?php echo esc_attr( $web ); ?>" rel="nofollow" target="_blank">
<span><?php echo esc_attr( $web ); ?></span>
<span><?php echo esc_html( $web ); ?></span>
</a>
</div><!-- /.agent-box-web -->
<?php endif; ?>

View File

@ -52,7 +52,7 @@
<div class="col-lg-12 col-md-12">
<div class="card-item inner">
<div class="heading"><i class="fa fa-comment"></i> <span><?php esc_html_e( 'Latest review' ) ?></span>
<div class="heading"><i class="fa fa-comment"></i> <span><?php esc_html_e( 'Latest review', 'opalestate-pro' ); ?></span>
<a href="<?php echo esc_url( opalestate_get_user_management_page_uri() . '?tab=reviews' ); ?>" class="dash-view-all"><?php esc_html_e( 'View All', 'opalestate-pro' );
?></a>
</div>

View File

@ -20,7 +20,7 @@
<div class="opalestate-box">
<div class="box-content">
<div class="opalestate-message">
<h3>No Item In Favorite</h3>
<h3><?php esc_html_e( 'No item in your favorite', 'opalestate-pro' ) ;?></h3>
<p><?php esc_html_e( 'You have not added any property as favorite.', 'opalestate-pro' ) ;?></p>
</div>
</div>