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 ) {
@ -1430,7 +1454,7 @@
} );
$( '.property-preview-street-map' ).show( 100 );
} );
///
///
// auto set height for split google map
$( '.split-maps-container' ).each( function () {
$( '#opalestate-map-preview ' ).height( $( window ).height() );
@ -1539,12 +1563,12 @@
} );
} );
// // Sortable Change // //
// // Sortable Change // //
$( 'body' ).delegate( '#opalestate-sortable-form select', 'change', function () {
var ps = '';
if ( $( 'form.opalestate-search-form' ).length > 0 ) {
var $form = $( 'form.opalestate-search-form' );
if ( $('body').hasClass( 'archive' ) ) {
if ( $( 'body' ).hasClass( 'archive' ) ) {
ps = 'opalsortable=' + $( this ).val() + '&display=' +
$( '.display-mode a.active' ).data( 'mode' );
} else {
@ -1561,7 +1585,7 @@
updatePropertiesByParseringHtml( newurl );
}
} else {
if ( history.pushState && $('body').hasClass( 'archive' ) ) {
if ( history.pushState && $( 'body' ).hasClass( 'archive' ) ) {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname +
'?' + ps;
window.history.pushState( { path: newurl }, '', newurl );
@ -1571,7 +1595,7 @@
}
} );
// display mode
// display mode
$( 'body' ).delegate( '.display-mode a', 'click', function () {
if ( $( '.opalesate-properties-results' ).length > 0 ) {
var newurl = $( this ).attr( 'href' );
@ -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

@ -13,7 +13,7 @@ window.opalestate_uploader = function() {
* @param {window} The window object.
*
*/
( function( $, window ) {
/**
@ -26,9 +26,9 @@ window.opalestate_uploader = function() {
function opalestate_uploader() {
$document = $( document );
function is_image_file( file ) {
$document = $( document );
function is_image_file( file ) {
const acceptedImageTypes = ['image/gif', 'image/jpeg', 'image/png'];
return file && acceptedImageTypes.includes(file['type'])
}
@ -36,14 +36,14 @@ window.opalestate_uploader = function() {
function check_number_files( file , i ) {
if( is_image_file(file) ) {
if( i+1 > opalesateJS.mfile_image ){
return false;
return false;
}
} else {
if( i+1 > opalesateJS.mfile_other ){
return false;
return false;
}
}
return true;
return true;
}
function check_filesize ( file , i ) {
@ -54,8 +54,8 @@ window.opalestate_uploader = function() {
heading: file.name,
text: opalesateJS.error_upload_size,
icon: 'error',
position: 'bottom-right',
hideAfter: 3500,
position: 'bottom-right',
hideAfter: 3500,
showHideTransition: 'fade'
});
return false;
@ -63,7 +63,7 @@ window.opalestate_uploader = function() {
return true;
}
} else {
return true;
return true;
}
}
@ -71,56 +71,57 @@ window.opalestate_uploader = function() {
*
*/
function trigger_button_upload(){
var handleUpload = function ( _container ){
var file_btn = $( 'input.select-file', _container );
var file_btn = $( 'input.select-file', _container );
var allow_files = [];
// var all_selected = [];
var name = $(this).data( 'name' );
var issingle = $(_container).data('single');
var issingle = $(_container).data('single');
var show_icon = $(_container).data( 'show-icon' );
var on_select_files = function ( files, _container ) {
if ( window.File && window.FileList && window.FileReader ) {
$(files).each( function( i, file ){
if( check_number_files( file, i+$(".uploader-item-preview",_container).length ) == false ){
return ;
}
}
if( check_filesize( file, i ) ) {
var picReader = new FileReader();
picReader.addEventListener("load", function ( event ) {
picReader.addEventListener("load", function ( event ) {
var input = '<div class="uploader-item-preview">';
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>';
}
}
input += '</div>';
var a = $(input) ;
input += '</div>';
var a = $(input) ;
if( issingle ){
$( ".uploader-item-preview", _container ).remove();
all_selected = [];
}
$( _container ).prepend( a );
a.prop( 'file', file );
a.prop( 'file', file );
} );
picReader.readAsDataURL( file );
}
} );
}
};
file_btn.on("change", function( event ){
on_select_files( event.target.files, _container, allow_files );
} );
} );
$( _container ).on( "click", ".btn-close", function(){
if( confirm(opalesateJS.confirmed ) ){
@ -128,14 +129,14 @@ window.opalestate_uploader = function() {
var rinput = $("<input type=\"hidden\" name=\"remove_image_id[]\" value=\""+ $("input", $(this).parent().parent()).val() +"\">");
$(_container).append( rinput );
}
$(this).parent().parent().remove();
}
} );
$( ".button-placehold", _container ).click( function(){
file_btn.trigger("click");
} );
} );
}
$(".cmb2-uploader-files").each( function(){
@ -145,9 +146,9 @@ window.opalestate_uploader = function() {
// fix for submittion form
window.CMB2 = window.CMB2 || {};
window.CMB2.metabox().find('.cmb-repeatable-group').on( 'cmb2_add_row', function(i, row ) {
var _container = $( row );
var _container = $( row );
if( $(".cmb2-uploader-files", _container ).length ) {
$( ".uploader-item-preview", _container ).remove();
$( ".uploader-item-preview", _container ).remove();
$(".cmb2-uploader-files", _container ).each( function(){
var name = $( 'input', this ).attr('name');
$( this ).attr('data-name', name );
@ -162,7 +163,7 @@ window.opalestate_uploader = function() {
alert( name );
}
/**
* @summary Sets the autosave time out.
*
@ -176,13 +177,13 @@ window.opalestate_uploader = function() {
* @returns {void}
*/
$document.on( 'body', function( event, editor ) {
}).ready( function() {
trigger_button_upload();
trigger_button_upload();
});
return {
};
}
@ -190,4 +191,4 @@ window.opalestate_uploader = function() {
window.wp = window.wp || {};
window.wp.opalestate_uploader = opalestate_uploader();
}( jQuery, window ));
}( jQuery, window ));

View File

@ -132,7 +132,7 @@ jQuery( document ).ready( function ( $ ) {
} );
}
////////
////////
$( '.opalestate-scroll-elements a' ).on( 'click', function ( e ) {
e.preventDefault();
if ( $( $( this ).attr( 'href' ) ).length ) {
@ -157,9 +157,9 @@ jQuery( document ).ready( function ( $ ) {
}
} );
////
////
////
////
$( '.opalestate-gallery' ).each( function () { // the containers for all your galleries
$( this ).magnificPopup( {
delegate: 'a', // the selector for gallery item
@ -219,32 +219,32 @@ jQuery( document ).ready( function ( $ ) {
}
} );
// sticky ////
// 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

@ -53,8 +53,9 @@ class OpalEstate_Enqueue {
wp_enqueue_script( 'opalestate-gmap', OPALESTATE_PLUGIN_URL . 'assets/js/frontend/googlemaps.js', [ 'jquery' ], OPALESTATE_VERSION, false );
$custom_map_styles = json_decode( ( opalestate_options( 'google_map_custom_style', '' ) ) );
wp_localize_script( 'opalestate-gmap', 'opalestateGmap', [
'style' => opalestate_options( 'google_map_style', 'standard' ),
'custom_style' => json_encode( $custom_map_styles ),
'style' => opalestate_options( 'google_map_style', 'standard' ),
'autocomplete_restrictions' => opalestate_get_autocomplete_restrictions(),
'custom_style' => json_encode( $custom_map_styles ),
] );
/**
@ -126,7 +127,7 @@ class OpalEstate_Enqueue {
wp_enqueue_script( 'opalestate-elementor', OPALESTATE_PLUGIN_URL . 'assets/js/frontend/elementor.js', [], null, true );
wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_style( 'jquery-ui-datepicker-style', OPALESTATE_PLUGIN_URL . '/assets/3rd/datepicker.css' );
///
///
wp_register_script( 'jquery-toast',
OPALESTATE_PLUGIN_URL . 'assets/3rd/toast/jquery.toast.js', [], null, true );

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,66 +56,92 @@ class OpalEstate_Search {
$tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] =
[
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
];
$tax_query[] = [
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
];
}
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[] =
[
'taxonomy' => 'opalestate_city',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['city'] ),
];
$tax_query[] = [
'taxonomy' => 'opalestate_city',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['city'] ),
];
}
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[] =
[
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => ( $_GET['amenities'] ),
];
$tax_query[] = [
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => opalestate_clean( $_GET['amenities'] ),
];
}
if ( $tax_query ) {
@ -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,23 +413,20 @@ class OpalEstate_Search {
$tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] =
[
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
];
$tax_query[] = [
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
];
}
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) {
$tax_query[] =
[
'taxonomy' => 'opalestate_types',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['types'] ),
];
$tax_query[] = [
'taxonomy' => 'opalestate_types',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['types'] ),
];
}
if ( $tax_query ) {
@ -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

@ -83,8 +83,8 @@ class OpalEstate_Submission {
);
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function register_shortcodes() {
$shortcodes = [
@ -103,8 +103,8 @@ class OpalEstate_Submission {
}
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function setting_content_tab( $tabs ) {
$tabs['submission_page'] = esc_html__( 'Submission', 'opalestate-pro' );
@ -112,8 +112,8 @@ class OpalEstate_Submission {
return $tabs;
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function setting_content_fields( $fields = [] ) {
$fields = [
@ -267,15 +267,15 @@ class OpalEstate_Submission {
return $fields;
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function head_check_page() {
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function render_button_edit() {
global $post, $current_user;
@ -289,8 +289,8 @@ class OpalEstate_Submission {
}
}
/*
* Is submission page. 'submission_page' option in General Setting
/*
* Is submission page. 'submission_page' option in General Setting
*/
public function is_submission_page() {
global $post;
@ -335,7 +335,7 @@ class OpalEstate_Submission {
return;
}
// remove all dirty images before edit/create new a property
// remove all dirty images before edit/create new a property
$this->cleanup();
wp_enqueue_script( 'opalestate-submission' );
@ -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 = [];
@ -620,11 +615,11 @@ class OpalEstate_Submission {
$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
}
}
//// / //
//// / //
}
}
// for group files
// for group files
$fields = [
$this->get_field_name( 'public_floor_group' ),
];

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,37 +126,40 @@ 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">';
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[]" id="' . $id . '" value="' . $term->slug . '">';
$html .= ' <label for="' . $id . '">' . $term->name . '</label>';
$html .= '</div>';
}
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 .= ' <label for="' . $id . '">' . $term->name . '</label>';
$html .= '</div>';
return $html;
}
$html .= '</div>';
return $html;
}
function opalestate_categories_multi_check( $terms ) {
$html = '<div class="opal-form-group">';
if ( ! function_exists( 'opalestate_categories_multi_check' ) ) {
function opalestate_categories_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="cat[' . $term->slug . ']" id="' . $id . '" value="' . $term->slug . '">';
$html .= ' <label for="' . $id . '">' . $term->name . '</label>';
$html .= '</div>';
}
foreach ( $terms as $term ) {
$id = time() . '-' . $term->slug;
$html .= '<div class="group-item">';
$html .= '<input type="checkbox" class="form-control-checkbox" id="' . $id . '" name="cat[' . $term->slug . ']" id="' . $id . '" value="' . $term->slug . '">';
$html .= ' <label for="' . $id . '">' . $term->name . '</label>';
$html .= '</div>';
return $html;
}
$html .= '</div>';
return $html;
}
function opalestate_get_image_by_id( $id ) {
@ -169,39 +172,34 @@ function opalestate_get_image_by_id( $id ) {
return '';
}
/**
*
*/
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() ) : ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_property_thumbnail', $size ) ); ?>
<?php else: ?>
<?php echo opalestate_get_image_placeholder( $size ); ?>
<?php endif; ?>
</a>
</div>
<?php
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() ) : ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_property_thumbnail', $size ) ); ?>
<?php else: ?>
<?php echo opalestate_get_image_placeholder( $size ); ?>
<?php endif; ?>
</a>
</div>
<?php
}
}
/**
*
*/
function opalestate_get_loop_agent_thumbnail( $size = 'agent-thumbnail' ) { ?>
<div class="agent-box-image">
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_agent_thumbnail', $size ) ); ?>
<?php else: ?>
<?php echo opalestate_get_image_placeholder( $size ); ?>
<?php endif; ?>
</a>
</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() ) : ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_agent_thumbnail', $size ) ); ?>
<?php else: ?>
<?php echo opalestate_get_image_placeholder( $size ); ?>
<?php endif; ?>
</a>
</div>
<?php
}
}
function opalestate_get_loop_short_meta() {

View File

@ -1,173 +1,156 @@
<?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
exit; // Exit if accessed directly
}
if( !class_exists( 'CMB2_Uploader_Button' ) ) {
if ( ! class_exists( 'CMB2_Uploader_Button' ) ) {
/**
* Class CMB2_Uploader_Button
*/
class CMB2_Uploader_Button {
/**
* Class CMB2_Uploader_Button
*/
class CMB2_Uploader_Button {
/**
* Constructor
*/
public function __construct() {
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 );
}
/**
* Constructor
*/
public function __construct() {
add_action( 'cmb2_render_uploader', array( $this, 'callback' ), 10, 5 );
add_action( 'admin_head', array( $this, 'admin_head' ) );
add_action( 'wp_enqueue_scripts', [$this,'scripts_styles'], 99 );
}
/**
* Register javascript file for processing upload images/files
*/
public function scripts_styles() {
wp_register_script(
'cmb2-uploader',
OPALESTATE_PLUGIN_URL . 'assets/js/frontend/uploader.js',
[
'jquery',
],
'4.4.3',
true
);
}
/**
* Register javascript file for processing upload images/files
*/
public function scripts_styles () {
wp_register_script(
'cmb2-uploader',
OPALESTATE_PLUGIN_URL . 'assets/js/frontend/uploader.js',
[
'jquery',
],
'4.4.3',
true
);
}
/**
* Render Preview is image or icon with its name
*/
private function render_image_or_icon( $escaped_value, $show_icon ) {
$cls = $show_icon ? "preview-icon" : "preview-image";
echo '<div class="inner ' . $cls . '">';
echo ' <span class="btn-close fa fa-close"></span> ';
if ( $show_icon ) {
echo '<i class="fas fa-paperclip"></i> ' . basename( get_attached_file( $escaped_value ) );
} else {
echo wp_get_attachment_image( $escaped_value, 'thumbnail' );
}
/**
* Render Preview is image or icon with its name
*/
private function render_image_or_icon ( $escaped_value , $show_icon ) {
$cls = $show_icon ? "preview-icon" : "preview-image";
echo '<div class="inner '.$cls.'">';
echo ' <span class="btn-close fa fa-close"></span> ';
if( $show_icon ){
echo '<i class="fas fa-paperclip"></i> '. basename ( get_attached_file( $escaped_value ) );
} else {
echo wp_get_attachment_image( $escaped_value, 'thumbnail' );
}
echo '</div>';
}
echo '</div>';
}
/**
* Render content input field.
*/
public function callback( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
wp_enqueue_script( 'cmb2-uploader' );
/**
* 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();
$field_name = $field->_name();
$args = array(
'type' => 'checkbox',
'id' => $field_name,
'name' => $field_name,
'desc' => '',
'value' => 'on',
);
$args = [
'type' => 'checkbox',
'id' => $field_name,
'name' => $field_name,
'desc' => '',
'value' => 'on',
];
if( $escaped_value == 'on' || $escaped_value == 1 ){
$args['checked'] = 'checked';
}
if ( $escaped_value == 'on' || $escaped_value == 1 ) {
$args['checked'] = 'checked';
}
$single = isset( $field->args['single'] ) && $field->args['single'];
$attrs = $single ? "" : 'multiple="multiple"';
$size = '';
if( isset($field->args['accept']) && $field->args['accept'] ){
$attrs .= ' accept="'.$field->args['accept'].'" ';
$single = isset( $field->args['single'] ) && $field->args['single'];
$attrs = $single ? "" : 'multiple="multiple"';
$size = '';
$info = array(
'size' => opalestate_options( 'upload_other_max_size', 0.5),
'number' => opalestate_options( 'upload_other_max_files', 10)
);
$class = 'upload-file-wrap';
} else {
$attrs .= ' accept="image/*" ';
$class = 'upload-image-wrap';
if ( isset( $field->args['accept'] ) && $field->args['accept'] ) {
$attrs .= ' accept="' . $field->args['accept'] . '" ';
$info = array(
'size' => opalestate_options( 'upload_image_max_size', 0.5),
'number' => opalestate_options( 'upload_image_max_files', 10)
);
}
if( $single ){
$info['number'] = 1;
}
$show_icon = isset($field->args['show_icon']) && $field->args['show_icon'] ? $field->args['show_icon']: false;
?>
<div class="cmb2-uploader-files <?php echo $class; ?>" data-name="<?php echo $args['id'];?>" data-single="<?php echo $single; ?>" data-show-icon="<?php echo $show_icon; ?>">
<?php if( $escaped_value && is_array($escaped_value) ): ?>
<?php foreach( $escaped_value as $key => $url ): ?>
<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; ?>">
</div>
<?php endforeach; ?>
<?php elseif( $escaped_value && !is_array($escaped_value) ): ?>
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $escaped_value, $show_icon ); ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $escaped_value; ?>">
</div>
<?php elseif( empty($escaped_value) && isset($field->args['value']) && (int)$field->args['value'] ):
$image_id = $field->args['value'];
?>
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $image_id , $show_icon ); ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $image_id; ?>">
</div>
<?php endif; ?>
<div class="button-placehold">
<div class="button-placehold-content">
<i class="fa fa-plus"></i>
<span><?php esc_html_e( "Upload", "opalestate" ); ?></span>
$info = [
'size' => opalestate_options( 'upload_other_max_size', 0.5 ),
'number' => opalestate_options( 'upload_other_max_files', 10 ),
];
$class = 'upload-file-wrap';
} else {
$attrs .= ' accept="image/*" ';
$class = 'upload-image-wrap';
$info = [
'size' => opalestate_options( 'upload_image_max_size', 0.5 ),
'number' => opalestate_options( 'upload_image_max_files', 10 ),
];
}
if ( $single ) {
$info['number'] = 1;
}
$show_icon = isset( $field->args['show_icon'] ) && $field->args['show_icon'] ? $field->args['show_icon'] : false;
?>
<div class="cmb2-uploader-files <?php echo $class; ?>" data-name="<?php echo $args['id']; ?>" data-single="<?php echo $single; ?>" data-show-icon="<?php echo $show_icon; ?>">
<?php if ( $escaped_value && is_array( $escaped_value ) ): ?>
<?php foreach ( $escaped_value as $key => $url ): ?>
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $key, $show_icon ); ?>
<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 ) ): ?>
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $escaped_value, $show_icon ); ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $escaped_value; ?>">
</div>
</div>
<input type="file" name="<?php echo $args['id'];?>" <?php echo $attrs; ?> class="select-file" style="visibility: hidden;">
</div>
<?php elseif ( empty( $escaped_value ) && isset( $field->args['value'] ) && (int) $field->args['value'] ):
$image_id = $field->args['value'];
?>
<div class="uploader-item-preview">
<?php echo $this->render_image_or_icon( $image_id, $show_icon ); ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $image_id; ?>">
</div>
<?php endif; ?>
<div class="button-placehold">
<div class="button-placehold-content">
<i class="fa fa-plus"></i>
<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;">
</div>
<p class="cmb2-metabox-description">
<i>
<?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>
<?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
}
<?php
}
/**
*
*/
public function admin_head() {
?>
<?php
}
}
$uploader = new 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
@ -264,7 +264,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
]
);
// agent
// agent
$this->includes(
[
'agent/class-opalestate-agent-posttype.php',
@ -275,7 +275,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
]
);
// agent
// agent
$this->includes(
[
'agency/class-opalestate-agency-posttype.php',
@ -341,7 +341,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
]
);
//// enable or disable submission ////
//// enable or disable submission ////
if ( opalestate_options( 'enable_submission', 'on' ) == 'on' ) {
$this->includes(
[

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
@ -81,7 +81,7 @@ The plugin will not make you disappointed with ease of use, friendly & flexible
= More Features =
* Search properties: Properties List, List Sidebar, Grid, Grid Sidebar, Search result, Category, Location, Type, Submit Properties..
* Support Membership Packages: There are many different packages with specific features suitable for users to choose the best one for their business goal.
* Support Membership Packages: There are many different packages with specific features suitable for users to choose the best one for their business goal.
* Search Agents: This plugin supports filter function for selecting location, type and price of experienced agents conveniently
* Quick Search: Users can quickly search properties or agents based on filter location, type, packing,bathroom, bedroom..
* Search Google Map
@ -118,7 +118,7 @@ The plugin will not make you disappointed with ease of use, friendly & flexible
* Account Button
= WHAT IS NEW IN PRO VERSION =
* Suport API use to develop great web app and mobile app .
* Suport API use to develop great web app and mobile app .
* Agency Agency and allow edit profile with user having Opal Estate Agency Role. Display Properties and members of agency
* Implement Google Map with custom styles.
* Implement Google Capcha for all Email Form
@ -147,7 +147,7 @@ This section describes how to install the plugin and get it working.
3. Use the Properties->Settings screen to configure the plugin
== Frequently Asked Questions ==
== Frequently Asked Questions ==
* Detailed guide to install and customize: [documentation](https://wpopal-2.gitbook.io/opal-estate/ "Visit the Plugin docs")
* Video guide and tutorials how to set up
@ -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; ?>
@ -117,4 +117,4 @@ $agent = new OpalEstate_Agent();
</div><!-- /.agent-box-content -->
</div>
</div>
</article>
</article>

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; ?>
@ -145,4 +145,4 @@ if ( $agent_id ) {
</div><!-- /.agent-box-content -->
</div>
</div>
</article>
</article>

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

@ -1,4 +1,4 @@
<?php
<?php
if( !isset($id) ){
$id = get_the_ID();
}
@ -20,7 +20,7 @@
<?php if( $type =='agency'): ?>
<div class="agent-preview has-avatar"><a href="<?php echo esc_url($link); ?>">
<?php if ( has_post_thumbnail( $id ) ) : ?>
<?php echo get_the_post_thumbnail( $id, 'full' ); ?>
<?php echo get_the_post_thumbnail( $id, 'full' ); ?>
<?php endif; ?>
<img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a>
@ -29,13 +29,13 @@
<i class="fas fa-star"></i>
</span>
<?php endif; ?>
</div>
<?php else : ?>
<div class="agent-preview"><a href="<?php echo esc_url($link); ?>">
<img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<div class="agent-box-meta">
<h4 class="agent-box-title">
@ -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

@ -3,7 +3,7 @@
<?php do_action( 'opalestate_user_dashboard_before' ); ?>
<?php
$statistics = new OpalEstate_User_Statistics();
$statistics = new OpalEstate_User_Statistics();
$properties_count = [];
$properties_count[] = [
@ -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

@ -1,29 +1,29 @@
<?php if( $loop->have_posts() ): ?>
<div class="property-listing my-favorite">
<div class="box-content">
<div class="opalestate-rows">
<div class="opalestate-rows">
<div class="<?php echo apply_filters('opalestate_row_container_class', 'opal-row');?>">
<?php $cnt=0; while ( $loop->have_posts() ) : $loop->the_post(); global $post; ?>
<div class="col-lg-4 col-md-4">
<?php echo opalestate_load_template_path( 'content-property-grid' ); ?>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php opalestate_pagination( $loop->max_num_pages ); ?>
</div>
</div>
</div>
<?php else : ?>
<div class="opalestate-box">
<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>
</div>
</div>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<?php wp_reset_postdata(); ?>