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 * GooglemapSearch
*/ */
var GooglemapSingle = Opalestate.GooglemapSingle = function ( data, id ) { var GooglemapSingle = Opalestate.GooglemapSingle = function ( data, id ) {
/** /**
* Create Google Map In Single Property Only * Create Google Map In Single Property Only
*/ */
@ -42,11 +41,36 @@
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false 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 ) { var createMarker = function ( position, icon ) {
@ -1430,7 +1454,7 @@
} ); } );
$( '.property-preview-street-map' ).show( 100 ); $( '.property-preview-street-map' ).show( 100 );
} ); } );
/// ///
// auto set height for split google map // auto set height for split google map
$( '.split-maps-container' ).each( function () { $( '.split-maps-container' ).each( function () {
$( '#opalestate-map-preview ' ).height( $( window ).height() ); $( '#opalestate-map-preview ' ).height( $( window ).height() );
@ -1539,12 +1563,12 @@
} ); } );
} ); } );
// // Sortable Change // // // // Sortable Change // //
$( 'body' ).delegate( '#opalestate-sortable-form select', 'change', function () { $( 'body' ).delegate( '#opalestate-sortable-form select', 'change', function () {
var ps = ''; var ps = '';
if ( $( 'form.opalestate-search-form' ).length > 0 ) { if ( $( 'form.opalestate-search-form' ).length > 0 ) {
var $form = $( 'form.opalestate-search-form' ); var $form = $( 'form.opalestate-search-form' );
if ( $('body').hasClass( 'archive' ) ) { if ( $( 'body' ).hasClass( 'archive' ) ) {
ps = 'opalsortable=' + $( this ).val() + '&display=' + ps = 'opalsortable=' + $( this ).val() + '&display=' +
$( '.display-mode a.active' ).data( 'mode' ); $( '.display-mode a.active' ).data( 'mode' );
} else { } else {
@ -1561,7 +1585,7 @@
updatePropertiesByParseringHtml( newurl ); updatePropertiesByParseringHtml( newurl );
} }
} else { } else {
if ( history.pushState && $('body').hasClass( 'archive' ) ) { if ( history.pushState && $( 'body' ).hasClass( 'archive' ) ) {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname +
'?' + ps; '?' + ps;
window.history.pushState( { path: newurl }, '', newurl ); window.history.pushState( { path: newurl }, '', newurl );
@ -1571,7 +1595,7 @@
} }
} ); } );
// display mode // display mode
$( 'body' ).delegate( '.display-mode a', 'click', function () { $( 'body' ).delegate( '.display-mode a', 'click', function () {
if ( $( '.opalesate-properties-results' ).length > 0 ) { if ( $( '.opalesate-properties-results' ).length > 0 ) {
var newurl = $( this ).attr( 'href' ); var newurl = $( this ).attr( 'href' );
@ -1580,7 +1604,7 @@
return false; return false;
} }
} ); } );
// check any estate search form is enabled /////////////////
if ( $( '#opalestate-map-preview' ).length > 0 ) { if ( $( '#opalestate-map-preview' ).length > 0 ) {
$( 'body' ).delegate( 'form.opalestate-search-form select', 'change', function () { $( 'body' ).delegate( 'form.opalestate-search-form select', 'change', function () {
var params = $( 'form.opalestate-search-form' ).serialize(); var params = $( 'form.opalestate-search-form' ).serialize();
@ -1603,12 +1627,9 @@
$( 'form.opalestate-search-form' ).submit(); $( 'form.opalestate-search-form' ).submit();
} ); } );
} }
/////////// ///////
} ); } );
} )( jQuery ); } )( jQuery );
//// //////
( function ( $ ) { ( function ( $ ) {
'use strict'; 'use strict';
@ -1627,8 +1648,11 @@
var latitude = mapInstance.find( '.opal-map-latitude' ); var latitude = mapInstance.find( '.opal-map-latitude' );
var longitude = mapInstance.find( '.opal-map-longitude' ); 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(); var place = autocomplete.getPlace();
if ( !place.geometry ) { if ( !place.geometry ) {
@ -1657,7 +1681,5 @@
event.preventDefault(); event.preventDefault();
} }
} ); } );
} }
} )( jQuery ); } )( jQuery );

View File

@ -13,7 +13,7 @@ window.opalestate_uploader = function() {
* @param {window} The window object. * @param {window} The window object.
* *
*/ */
( function( $, window ) { ( function( $, window ) {
/** /**
@ -26,9 +26,9 @@ window.opalestate_uploader = function() {
function opalestate_uploader() { function opalestate_uploader() {
$document = $( document ); $document = $( document );
function is_image_file( file ) { function is_image_file( file ) {
const acceptedImageTypes = ['image/gif', 'image/jpeg', 'image/png']; const acceptedImageTypes = ['image/gif', 'image/jpeg', 'image/png'];
return file && acceptedImageTypes.includes(file['type']) return file && acceptedImageTypes.includes(file['type'])
} }
@ -36,14 +36,14 @@ window.opalestate_uploader = function() {
function check_number_files( file , i ) { function check_number_files( file , i ) {
if( is_image_file(file) ) { if( is_image_file(file) ) {
if( i+1 > opalesateJS.mfile_image ){ if( i+1 > opalesateJS.mfile_image ){
return false; return false;
} }
} else { } else {
if( i+1 > opalesateJS.mfile_other ){ if( i+1 > opalesateJS.mfile_other ){
return false; return false;
} }
} }
return true; return true;
} }
function check_filesize ( file , i ) { function check_filesize ( file , i ) {
@ -54,8 +54,8 @@ window.opalestate_uploader = function() {
heading: file.name, heading: file.name,
text: opalesateJS.error_upload_size, text: opalesateJS.error_upload_size,
icon: 'error', icon: 'error',
position: 'bottom-right', position: 'bottom-right',
hideAfter: 3500, hideAfter: 3500,
showHideTransition: 'fade' showHideTransition: 'fade'
}); });
return false; return false;
@ -63,7 +63,7 @@ window.opalestate_uploader = function() {
return true; return true;
} }
} else { } else {
return true; return true;
} }
} }
@ -71,56 +71,57 @@ window.opalestate_uploader = function() {
* *
*/ */
function trigger_button_upload(){ function trigger_button_upload(){
var handleUpload = function ( _container ){ var handleUpload = function ( _container ){
var file_btn = $( 'input.select-file', _container ); var file_btn = $( 'input.select-file', _container );
var allow_files = []; var allow_files = [];
// var all_selected = []; // var all_selected = [];
var name = $(this).data( 'name' ); var name = $(this).data( 'name' );
var issingle = $(_container).data('single'); var issingle = $(_container).data('single');
var show_icon = $(_container).data( 'show-icon' ); var show_icon = $(_container).data( 'show-icon' );
var on_select_files = function ( files, _container ) { var on_select_files = function ( files, _container ) {
if ( window.File && window.FileList && window.FileReader ) { if ( window.File && window.FileList && window.FileReader ) {
$(files).each( function( i, file ){ $(files).each( function( i, file ){
if( check_number_files( file, i+$(".uploader-item-preview",_container).length ) == false ){ if( check_number_files( file, i+$(".uploader-item-preview",_container).length ) == false ){
return ; return ;
} }
if( check_filesize( file, i ) ) { if( check_filesize( file, i ) ) {
var picReader = new FileReader(); var picReader = new FileReader();
picReader.addEventListener("load", function ( event ) { picReader.addEventListener("load", function ( event ) {
var input = '<div class="uploader-item-preview">'; var input = '<div class="uploader-item-preview">';
var picFile = event.target; var picFile = event.target;
if ( picFile.result ) { if ( picFile.result ) {
if( show_icon == 1 ) { 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 { } 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>'; input += '</div>';
var a = $(input) ; var a = $(input) ;
if( issingle ){ if( issingle ){
$( ".uploader-item-preview", _container ).remove(); $( ".uploader-item-preview", _container ).remove();
all_selected = []; all_selected = [];
} }
$( _container ).prepend( a ); $( _container ).prepend( a );
a.prop( 'file', file ); a.prop( 'file', file );
} ); } );
picReader.readAsDataURL( file ); picReader.readAsDataURL( file );
} }
} ); } );
} }
}; };
file_btn.on("change", function( event ){ file_btn.on("change", function( event ){
on_select_files( event.target.files, _container, allow_files ); on_select_files( event.target.files, _container, allow_files );
} ); } );
$( _container ).on( "click", ".btn-close", function(){ $( _container ).on( "click", ".btn-close", function(){
if( confirm(opalesateJS.confirmed ) ){ 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() +"\">"); var rinput = $("<input type=\"hidden\" name=\"remove_image_id[]\" value=\""+ $("input", $(this).parent().parent()).val() +"\">");
$(_container).append( rinput ); $(_container).append( rinput );
} }
$(this).parent().parent().remove(); $(this).parent().parent().remove();
} }
} ); } );
$( ".button-placehold", _container ).click( function(){ $( ".button-placehold", _container ).click( function(){
file_btn.trigger("click"); file_btn.trigger("click");
} ); } );
} }
$(".cmb2-uploader-files").each( function(){ $(".cmb2-uploader-files").each( function(){
@ -145,9 +146,9 @@ window.opalestate_uploader = function() {
// fix for submittion form // fix for submittion form
window.CMB2 = window.CMB2 || {}; window.CMB2 = window.CMB2 || {};
window.CMB2.metabox().find('.cmb-repeatable-group').on( 'cmb2_add_row', function(i, row ) { 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 ) { if( $(".cmb2-uploader-files", _container ).length ) {
$( ".uploader-item-preview", _container ).remove(); $( ".uploader-item-preview", _container ).remove();
$(".cmb2-uploader-files", _container ).each( function(){ $(".cmb2-uploader-files", _container ).each( function(){
var name = $( 'input', this ).attr('name'); var name = $( 'input', this ).attr('name');
$( this ).attr('data-name', name ); $( this ).attr('data-name', name );
@ -162,7 +163,7 @@ window.opalestate_uploader = function() {
alert( name ); alert( name );
} }
/** /**
* @summary Sets the autosave time out. * @summary Sets the autosave time out.
* *
@ -176,13 +177,13 @@ window.opalestate_uploader = function() {
* @returns {void} * @returns {void}
*/ */
$document.on( 'body', function( event, editor ) { $document.on( 'body', function( event, editor ) {
}).ready( function() { }).ready( function() {
trigger_button_upload(); trigger_button_upload();
}); });
return { return {
}; };
} }
@ -190,4 +191,4 @@ window.opalestate_uploader = function() {
window.wp = window.wp || {}; window.wp = window.wp || {};
window.wp.opalestate_uploader = opalestate_uploader(); 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 ) { $( '.opalestate-scroll-elements a' ).on( 'click', function ( e ) {
e.preventDefault(); e.preventDefault();
if ( $( $( this ).attr( 'href' ) ).length ) { if ( $( $( this ).attr( 'href' ) ).length ) {
@ -157,9 +157,9 @@ jQuery( document ).ready( function ( $ ) {
} }
} ); } );
//// ////
//// ////
$( '.opalestate-gallery' ).each( function () { // the containers for all your galleries $( '.opalestate-gallery' ).each( function () { // the containers for all your galleries
$( this ).magnificPopup( { $( this ).magnificPopup( {
delegate: 'a', // the selector for gallery item delegate: 'a', // the selector for gallery item
@ -219,32 +219,32 @@ jQuery( document ).ready( function ( $ ) {
} }
} ); } );
// sticky //// // sticky ////
// $( '.opalestate-sticky-column' ).stick_in_parent(); // $( '.opalestate-sticky-column' ).stick_in_parent();
var window_width = $( window ).width(); // var window_width = $( window ).width();
//
if ( window_width < 768 ) { // if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' ); // $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else { // } else {
make_sticky(); // make_sticky();
} // }
//
$( window ).resize( function () { // $( window ).resize( function () {
//
window_width = $( window ).width(); // window_width = $( window ).width();
//
if ( window_width < 768 ) { // if ( window_width < 768 ) {
$( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' ); // $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' );
} else { // } else {
make_sticky(); // make_sticky();
} // }
//
} ); // } );
//
function make_sticky() { // function make_sticky() {
$( '.opalestate-sticky-column' ).stick_in_parent(); // $( '.opalestate-sticky-column' ).stick_in_parent();
} // }
//// ////
$( '.input-group-number' ).each( function () { $( '.input-group-number' ).each( function () {
@ -512,7 +512,7 @@ jQuery( document ).ready( function ( $ ) {
var nummm = wNumb( config_format ); var nummm = wNumb( config_format );
var istart = [ imin, imax ]; var istart = [ imin, imax ];
if ( mode && mode == 1 && start ) { if ( mode && mode == 1 && ( start || start == 0 ) ) {
istart = [ start ]; 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 = = 1.4.1 - 2020-03-25 =
* Fixes - Split map AJAX * 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', 'id' => 'google_map_custom_style',
'type' => 'textarea_code', '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 ); 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', '' ) ) ); $custom_map_styles = json_decode( ( opalestate_options( 'google_map_custom_style', '' ) ) );
wp_localize_script( 'opalestate-gmap', 'opalestateGmap', [ wp_localize_script( 'opalestate-gmap', 'opalestateGmap', [
'style' => opalestate_options( 'google_map_style', 'standard' ), 'style' => opalestate_options( 'google_map_style', 'standard' ),
'custom_style' => json_encode( $custom_map_styles ), '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( 'opalestate-elementor', OPALESTATE_PLUGIN_URL . 'assets/js/frontend/elementor.js', [], null, true );
wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_script( 'jquery-ui-datepicker' );
wp_enqueue_style( 'jquery-ui-datepicker-style', OPALESTATE_PLUGIN_URL . '/assets/3rd/datepicker.css' ); wp_enqueue_style( 'jquery-ui-datepicker-style', OPALESTATE_PLUGIN_URL . '/assets/3rd/datepicker.css' );
/// ///
wp_register_script( 'jquery-toast', wp_register_script( 'jquery-toast',
OPALESTATE_PLUGIN_URL . 'assets/3rd/toast/jquery.toast.js', [], null, true ); 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> <label class="opalestate-label opalestate-label--<?php echo sanitize_html_class( $field ); ?>"><?php echo esc_html( $label ); ?></label>
<div class="input-group-number"> <div class="input-group-number">
<i class="<?php echo opalestate_get_property_meta_icon( $field ); ?>"></i> <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 ); ?>"/> $label ); ?>"/>
<div class="btn-actions"> <div class="btn-actions">
<span class="btn-minus"><i class="fa fa-minus"></i></span> <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 ) { foreach ( $option_values as $value ) {
$selected = $value == $qvalue ? 'selected="selected"' : ''; $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 .= '</select>';
$template = sprintf( $template, $field, $label ); $template = sprintf( $template, $field, $label );

View File

@ -1349,9 +1349,9 @@ function opalestate_is_require_login_to_show_author_box() {
function opalestate_clean( $var ) { function opalestate_clean( $var ) {
if ( is_array( $var ) ) { if ( is_array( $var ) ) {
return array_map( 'opalestate_clean', $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. * Get email date format.
* *
* @return mixed|void * @return string
*/ */
function opalestate_email_date_format() { function opalestate_email_date_format() {
return apply_filters( 'opalestate_email_date_format', 'F j, Y, g:i a' ); 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 ) ); $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 = isset( $wp_query->query['paged'] ) ? $wp_query->query['paged'] : $paged;
$paged = ! empty( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : $paged; $paged = ! empty( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : $paged;
if ( isset( $_GET['paged'] ) && intval( $_GET['paged'] ) > 0 ) { if ( isset( $_GET['paged'] ) && absint( $_GET['paged'] ) > 0 ) {
$paged = intval( $_GET['paged'] ); $paged = absint( $_GET['paged'] );
} }
$args = [ $args = [
@ -56,66 +56,92 @@ class OpalEstate_Search {
$tax_query = []; $tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) { if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] = $tax_query[] = [
[ 'taxonomy' => 'opalestate_location',
'taxonomy' => 'opalestate_location', 'field' => 'slug',
'field' => 'slug', 'terms' => sanitize_text_field( $_GET['location'] ),
'terms' => sanitize_text_field( $_GET['location'] ), ];
];
} }
if ( isset( $_GET['state'] ) && $_GET['state'] != -1 ) { 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', 'taxonomy' => 'opalestate_state',
'field' => 'slug', 'field' => 'slug',
'terms' => sanitize_text_field( $_GET['state'] ), 'terms' => sanitize_text_field( $_GET['state'] ),
]; ];
}
} }
if ( isset( $_GET['city'] ) && $_GET['city'] != -1 ) { if ( isset( $_GET['city'] ) && $_GET['city'] != -1 ) {
$tax_query[] = $tax_query[] = [
[ 'taxonomy' => 'opalestate_city',
'taxonomy' => 'opalestate_city', 'field' => 'slug',
'field' => 'slug', 'terms' => sanitize_text_field( $_GET['city'] ),
'terms' => sanitize_text_field( $_GET['city'] ), ];
];
} }
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) { 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', 'taxonomy' => 'opalestate_types',
'field' => 'slug', 'field' => 'slug',
'terms' => sanitize_text_field( $_GET['types'] ), 'terms' => sanitize_text_field( $_GET['types'] ),
]; ];
}
} }
if ( isset( $_GET['cat'] ) && $_GET['cat'] != -1 ) { 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', 'taxonomy' => 'property_category',
'field' => 'slug', 'field' => 'slug',
'terms' => sanitize_text_field( $_GET['cat'] ), 'terms' => sanitize_text_field( $_GET['cat'] ),
]; ];
}
} }
if ( isset( $_GET['status'] ) && $_GET['status'] != -1 ) { 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', 'taxonomy' => 'opalestate_status',
'field' => 'slug', 'field' => 'slug',
'terms' => sanitize_text_field( $_GET['status'] ), 'terms' => sanitize_text_field( $_GET['status'] ),
]; ];
}
} }
if ( isset( $_GET['amenities'] ) && is_array( $_GET['amenities'] ) ) { if ( isset( $_GET['amenities'] ) && is_array( $_GET['amenities'] ) ) {
$tax_query[] = $tax_query[] = [
[ 'taxonomy' => 'opalestate_amenities',
'taxonomy' => 'opalestate_amenities', 'field' => 'slug',
'field' => 'slug', 'terms' => opalestate_clean( $_GET['amenities'] ),
'terms' => ( $_GET['amenities'] ), ];
];
} }
if ( $tax_query ) { 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 != '' && $search_max_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
if ( $search_min_price ) { if ( $search_min_price ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => [ $search_min_price, $search_max_price ], 'value' => [ $search_min_price, $search_max_price ],
'compare' => 'BETWEEN', 'compare' => 'BETWEEN',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} else { } else {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
[ [
[ [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
@ -174,56 +200,55 @@ class OpalEstate_Search {
'type' => 'NUMERIC', 'type' => 'NUMERIC',
], ],
], ],
] ); ];
} }
} elseif ( $search_min_price != '' && is_numeric( $search_min_price ) ) { } elseif ( $search_min_price != '' && is_numeric( $search_min_price ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => $search_min_price, 'value' => $search_min_price,
'compare' => '>=', 'compare' => '>=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} elseif ( $search_max_price != '' && is_numeric( $search_max_price ) ) { } elseif ( $search_max_price != '' && is_numeric( $search_max_price ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price', 'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => $search_max_price, 'value' => $search_max_price,
'compare' => '<=', 'compare' => '<=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} }
if ( $search_min_area != '' && $search_max_area != '' && is_numeric( $search_min_area ) && is_numeric( $search_max_area ) ) { 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', 'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => [ $search_min_area, $search_max_area ], 'value' => [ $search_min_area, $search_max_area ],
'compare' => 'BETWEEN', 'compare' => 'BETWEEN',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} elseif ( $search_min_area != '' && is_numeric( $search_min_area ) ) { } elseif ( $search_min_area != '' && is_numeric( $search_min_area ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize', 'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => $search_min_area, 'value' => $search_min_area,
'compare' => '>=', 'compare' => '>=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} elseif ( $search_max_area != '' && is_numeric( $search_max_area ) ) { } elseif ( $search_max_area != '' && is_numeric( $search_max_area ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize', 'key' => OPALESTATE_PROPERTY_PREFIX . 'areasize',
'value' => $search_max_area, 'value' => $search_max_area,
'compare' => '<=', 'compare' => '<=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} }
if ( isset( $_GET['geo_long'] ) && isset( $_GET['geo_lat'] ) ) { if ( isset( $_GET['geo_long'] ) && isset( $_GET['geo_lat'] ) ) {
if ( $_GET['location_text'] && ( empty( $_GET['geo_long'] ) || empty( $_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', 'key' => OPALESTATE_PROPERTY_PREFIX . 'map_address',
'value' => sanitize_text_field( trim( $_GET['location_text'] ) ), 'value' => sanitize_text_field( trim( $_GET['location_text'] ) ),
'compare' => 'LIKE', 'compare' => 'LIKE',
'operator' => 'OR', 'operator' => 'OR',
] ); ];
} elseif ( $_GET['geo_lat'] && $_GET['geo_long'] ) { } elseif ( $_GET['geo_lat'] && $_GET['geo_long'] ) {
$radius = isset( $_GET['geo_radius'] ) ? $_GET['geo_radius'] : 5; $radius = isset( $_GET['geo_radius'] ) ? $_GET['geo_radius'] : 5;
@ -249,7 +274,7 @@ class OpalEstate_Search {
$args['orderby'] = 'meta_value_num'; $args['orderby'] = 'meta_value_num';
$args['order'] = $ksearchs[1]; $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['orderby'] = [ 'meta_value' => 'DESC', 'date' => 'DESC' ];
$args['meta_key'] = OPALESTATE_PROPERTY_PREFIX . 'featured'; $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 ] ) : ''; $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 ) ) { if ( $min_request != '' && $max_request != '' && is_numeric( $min_request ) && is_numeric( $max_request ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => $meta['id'], 'key' => $meta['id'],
'value' => [ $min_request, $max_request ], 'value' => [ $min_request, $max_request ],
'compare' => 'BETWEEN', 'compare' => 'BETWEEN',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} elseif ( $min_request != '' && is_numeric( $min_request ) ) { } elseif ( $min_request != '' && is_numeric( $min_request ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => $meta['id'], 'key' => $meta['id'],
'value' => $min_request, 'value' => $min_request,
'compare' => '>=', 'compare' => '>=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} elseif ( $max_request != '' && is_numeric( $max_request ) ) { } elseif ( $max_request != '' && is_numeric( $max_request ) ) {
array_push( $args['meta_query'], [ $args['meta_query'][] = [
'key' => $meta['id'], 'key' => $meta['id'],
'value' => $max_request, 'value' => $max_request,
'compare' => '<=', 'compare' => '<=',
'type' => 'NUMERIC', 'type' => 'NUMERIC',
] ); ];
} }
} }
} }
@ -352,20 +377,20 @@ class OpalEstate_Search {
$args['meta_query'] = [ 'relation' => 'AND' ]; $args['meta_query'] = [ 'relation' => 'AND' ];
if ( $search_min_price != $min && is_numeric( $search_min_price ) ) { 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', 'key' => OPALESTATE_AGENT_PREFIX . 'target_min_price',
'value' => $search_min_price, 'value' => $search_min_price,
'compare' => '>=', 'compare' => '>=',
// 'type' => 'NUMERIC' // 'type' => 'NUMERIC'
] ); ];
} }
if ( is_numeric( $search_max_price ) && $search_max_price != $max ) { 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', 'key' => OPALESTATE_AGENT_PREFIX . 'target_max_price',
'value' => $search_max_price, 'value' => $search_max_price,
'compare' => '<=', 'compare' => '<=',
// 'type' => 'NUMERIC' // 'type' => 'NUMERIC'
] ); ];
} }
return new WP_Query( $args ); return new WP_Query( $args );
@ -388,23 +413,20 @@ class OpalEstate_Search {
$tax_query = []; $tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) { if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] = $tax_query[] = [
[ 'taxonomy' => 'opalestate_location',
'taxonomy' => 'opalestate_location', 'field' => 'slug',
'field' => 'slug', 'terms' => sanitize_text_field( $_GET['location'] ),
'terms' => sanitize_text_field( $_GET['location'] ), ];
];
} }
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) { if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) {
$tax_query[] = $tax_query[] = [
[ 'taxonomy' => 'opalestate_types',
'taxonomy' => 'opalestate_types', 'field' => 'slug',
'field' => 'slug', 'terms' => sanitize_text_field( $_GET['types'] ),
'terms' => sanitize_text_field( $_GET['types'] ), ];
];
} }
if ( $tax_query ) { if ( $tax_query ) {
@ -418,7 +440,6 @@ class OpalEstate_Search {
return new WP_Query( $args ); return new WP_Query( $args );
} }
public function filter_by_geolocations() { public function filter_by_geolocations() {
} }
@ -444,7 +465,7 @@ class OpalEstate_Search {
continue; continue;
} }
if ( 'on' == $value ) { if ( 'on' === $value ) {
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $meta['id'] ); $id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $meta['id'] );
$esettings[ $id ] = $meta['name']; $esettings[ $id ] = $meta['name'];
} }
@ -467,7 +488,6 @@ class OpalEstate_Search {
* Get Json data by action ajax filter * Get Json data by action ajax filter
*/ */
public static function get_search_json() { public static function get_search_json() {
$query = self::get_search_results_query(); $query = self::get_search_results_query();
$output = []; $output = [];
@ -486,7 +506,6 @@ class OpalEstate_Search {
} }
public static function render_get_properties() { public static function render_get_properties() {
// $_GET = $_POST;
echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result' ); echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result' );
die; 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() { public function register_shortcodes() {
$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 ) { public function setting_content_tab( $tabs ) {
$tabs['submission_page'] = esc_html__( 'Submission', 'opalestate-pro' ); $tabs['submission_page'] = esc_html__( 'Submission', 'opalestate-pro' );
@ -112,8 +112,8 @@ class OpalEstate_Submission {
return $tabs; 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 = [] ) { public function setting_content_fields( $fields = [] ) {
$fields = [ $fields = [
@ -267,15 +267,15 @@ class OpalEstate_Submission {
return $fields; 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() { 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() { public function render_button_edit() {
global $post, $current_user; 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() { public function is_submission_page() {
global $post; global $post;
@ -335,7 +335,7 @@ class OpalEstate_Submission {
return; return;
} }
// remove all dirty images before edit/create new a property // remove all dirty images before edit/create new a property
$this->cleanup(); $this->cleanup();
wp_enqueue_script( 'opalestate-submission' ); wp_enqueue_script( 'opalestate-submission' );
@ -396,11 +396,8 @@ class OpalEstate_Submission {
* FrontEnd Submission * FrontEnd Submission
*/ */
public function process_submission() { public function process_submission() {
if ( isset( $_POST['submission_action'] ) && ! empty( $_POST['submission_action'] ) ) { if ( isset( $_POST['submission_action'] ) && ! empty( $_POST['submission_action'] ) ) {
if ( wp_verify_nonce( $_POST['submission_action'], 'submitted-property' ) ) { if ( wp_verify_nonce( $_POST['submission_action'], 'submitted-property' ) ) {
$user_id = get_current_user_id(); $user_id = get_current_user_id();
$edit = false; $edit = false;
$prefix = OPALESTATE_PROPERTY_PREFIX; $prefix = OPALESTATE_PROPERTY_PREFIX;
@ -421,7 +418,7 @@ class OpalEstate_Submission {
$post_status = 'pending'; $post_status = 'pending';
if ( 'on' != opalestate_get_option( 'admin_approve', 'on' ) ) { if ( 'on' !== opalestate_get_option( 'admin_approve', 'on' ) ) {
$post_status = 'publish'; $post_status = 'publish';
} }
@ -485,7 +482,7 @@ class OpalEstate_Submission {
/* /*
* Processing upload files * Processing upload files
*/ */
$this->process_upload_files( $post_id, $_POST ); $this->process_upload_files( $post_id );
/** /**
* Fetch sanitized values * Fetch sanitized values
@ -513,12 +510,14 @@ class OpalEstate_Submission {
update_post_meta( $post_id, $prefix . 'featured_image', null ); update_post_meta( $post_id, $prefix . 'featured_image', null );
// Update SKU. // 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 = 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 ) ); $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 . 'sku', $sku_generated );
} }
update_post_meta( $post_id, $prefix . 'featured', '' );
//redirect //redirect
$_SESSION['messages'][] = [ 'success', esc_html__( 'Property has been successfully updated.', 'opalestate-pro' ) ]; $_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. * @param int $post_id Post ID.
*/ */
private function process_upload_files( $post_id ) { private function process_upload_files( $post_id ) {
//upload images for featured and gallery images //upload images for featured and gallery images
if ( isset( $_FILES ) && ! empty( $_FILES ) ) { if ( isset( $_FILES ) && ! empty( $_FILES ) ) {
///
$fields = [ $fields = [
$this->get_field_name( 'gallery' ), $this->get_field_name( 'gallery' ),
$this->get_field_name( 'featured_image' ), $this->get_field_name( 'featured_image' ),
@ -592,7 +588,6 @@ class OpalEstate_Submission {
if ( in_array( $key, $fields ) ) { if ( in_array( $key, $fields ) ) {
$ufile = $_FILES[ $key ]; $ufile = $_FILES[ $key ];
/// /////
if ( isset( $ufile['name'] ) && is_array( $ufile['name'] ) ) { if ( isset( $ufile['name'] ) && is_array( $ufile['name'] ) ) {
$output = []; $output = [];
@ -620,11 +615,11 @@ class OpalEstate_Submission {
$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id']; $this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
} }
} }
//// / // //// / //
} }
} }
// for group files // for group files
$fields = [ $fields = [
$this->get_field_name( 'public_floor_group' ), $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 ) { public static function get_multi_check_list( $stypes ) {
$list = self::get_list(); $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 ); 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 ) { foreach ( $terms as $term ) {
$html = '<div class="opal-form-group">'; $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>'; $html .= '</div>';
return $html;
} }
$html .= '</div>';
return $html;
} }
function opalestate_categories_multi_check( $terms ) { if ( ! function_exists( 'opalestate_categories_multi_check' ) ) {
$html = '<div class="opal-form-group">'; 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>'; $html .= '</div>';
return $html;
} }
$html .= '</div>';
return $html;
} }
function opalestate_get_image_by_id( $id ) { function opalestate_get_image_by_id( $id ) {
@ -169,39 +172,34 @@ function opalestate_get_image_by_id( $id ) {
return ''; 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">
function opalestate_get_loop_thumbnail( $size = 'property-thumbnail' ) { ?> <?php if ( has_post_thumbnail() ) : ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_property_thumbnail', $size ) ); ?>
<div class="property-box-image"> <?php else: ?>
<a href="<?php the_permalink(); ?>" class="property-box-image-inner"> <?php echo opalestate_get_image_placeholder( $size ); ?>
<?php if ( has_post_thumbnail() ) : ?> <?php endif; ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_property_thumbnail', $size ) ); ?> </a>
<?php else: ?> </div>
<?php echo opalestate_get_image_placeholder( $size ); ?> <?php
<?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">
function opalestate_get_loop_agent_thumbnail( $size = 'agent-thumbnail' ) { ?> <a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
<div class="agent-box-image"> <?php the_post_thumbnail( apply_filters( 'opalestate_loop_agent_thumbnail', $size ) ); ?>
<a href="<?php the_permalink(); ?>"> <?php else: ?>
<?php if ( has_post_thumbnail() ) : ?> <?php echo opalestate_get_image_placeholder( $size ); ?>
<?php the_post_thumbnail( apply_filters( 'opalestate_loop_agent_thumbnail', $size ) ); ?> <?php endif; ?>
<?php else: ?> </a>
<?php echo opalestate_get_image_placeholder( $size ); ?> </div>
<?php endif; ?> <?php
</a> }
</div>
<?php
} }
function opalestate_get_loop_short_meta() { function opalestate_get_loop_short_meta() {

View File

@ -1,173 +1,156 @@
<?php <?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' ) ) { 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 * Constructor
*/ */
class CMB2_Uploader_Button { 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 * Register javascript file for processing upload images/files
*/ */
public function __construct() { public function scripts_styles() {
add_action( 'cmb2_render_uploader', array( $this, 'callback' ), 10, 5 ); wp_register_script(
add_action( 'admin_head', array( $this, 'admin_head' ) ); 'cmb2-uploader',
add_action( 'wp_enqueue_scripts', [$this,'scripts_styles'], 99 ); OPALESTATE_PLUGIN_URL . 'assets/js/frontend/uploader.js',
} [
'jquery',
],
'4.4.3',
true
);
}
/** /**
* Register javascript file for processing upload images/files * Render Preview is image or icon with its name
*/ */
public function scripts_styles () { private function render_image_or_icon( $escaped_value, $show_icon ) {
wp_register_script( $cls = $show_icon ? "preview-icon" : "preview-image";
'cmb2-uploader', echo '<div class="inner ' . $cls . '">';
OPALESTATE_PLUGIN_URL . 'assets/js/frontend/uploader.js', echo ' <span class="btn-close fa fa-close"></span> ';
[ if ( $show_icon ) {
'jquery', echo '<i class="fas fa-paperclip"></i> ' . basename( get_attached_file( $escaped_value ) );
], } else {
'4.4.3', echo wp_get_attachment_image( $escaped_value, 'thumbnail' );
true }
);
}
/** echo '</div>';
* 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>'; /**
} * 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();
* 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 = [
'type' => 'checkbox',
$args = array( 'id' => $field_name,
'type' => 'checkbox', 'name' => $field_name,
'id' => $field_name, 'desc' => '',
'name' => $field_name, 'value' => 'on',
'desc' => '', ];
'value' => 'on',
);
if( $escaped_value == 'on' || $escaped_value == 1 ){ if ( $escaped_value == 'on' || $escaped_value == 1 ) {
$args['checked'] = 'checked'; $args['checked'] = 'checked';
} }
$single = isset( $field->args['single'] ) && $field->args['single']; $single = isset( $field->args['single'] ) && $field->args['single'];
$attrs = $single ? "" : 'multiple="multiple"'; $attrs = $single ? "" : 'multiple="multiple"';
$size = ''; $size = '';
if( isset($field->args['accept']) && $field->args['accept'] ){
$attrs .= ' accept="'.$field->args['accept'].'" ';
$info = array(
'size' => opalestate_options( 'upload_other_max_size', 0.5),
'number' => opalestate_options( 'upload_other_max_files', 10)
);
$class = 'upload-file-wrap'; if ( isset( $field->args['accept'] ) && $field->args['accept'] ) {
} else { $attrs .= ' accept="' . $field->args['accept'] . '" ';
$attrs .= ' accept="image/*" ';
$class = 'upload-image-wrap';
$info = array(
'size' => opalestate_options( 'upload_image_max_size', 0.5), $info = [
'number' => opalestate_options( 'upload_image_max_files', 10) 'size' => opalestate_options( 'upload_other_max_size', 0.5 ),
); 'number' => opalestate_options( 'upload_other_max_files', 10 ),
} ];
if( $single ){
$info['number'] = 1; $class = 'upload-file-wrap';
} } else {
$show_icon = isset($field->args['show_icon']) && $field->args['show_icon'] ? $field->args['show_icon']: false; $attrs .= ' accept="image/*" ';
?> $class = 'upload-image-wrap';
<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) ): ?> $info = [
<?php foreach( $escaped_value as $key => $url ): ?> 'size' => opalestate_options( 'upload_image_max_size', 0.5 ),
<div class="uploader-item-preview"> 'number' => opalestate_options( 'upload_image_max_files', 10 ),
];
<?php echo $this->render_image_or_icon( $key, $show_icon ); ?> }
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $key; ?>"> if ( $single ) {
</div> $info['number'] = 1;
<?php endforeach; ?> }
<?php elseif( $escaped_value && !is_array($escaped_value) ): ?> $show_icon = isset( $field->args['show_icon'] ) && $field->args['show_icon'] ? $field->args['show_icon'] : false;
<div class="uploader-item-preview"> ?>
<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 echo $this->render_image_or_icon( $escaped_value, $show_icon ); ?> <?php if ( $escaped_value && is_array( $escaped_value ) ): ?>
<?php foreach ( $escaped_value as $key => $url ): ?>
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $escaped_value; ?>"> <div class="uploader-item-preview">
</div>
<?php elseif( empty($escaped_value) && isset($field->args['value']) && (int)$field->args['value'] ): <?php echo $this->render_image_or_icon( $key, $show_icon ); ?>
$image_id = $field->args['value']; <input type="hidden" name="<?php echo $field_name; ?>[<?php echo $key; ?>]" value="<?php echo $url; ?>">
?> </div>
<div class="uploader-item-preview"> <?php endforeach; ?>
<?php elseif ( $escaped_value && ! is_array( $escaped_value ) ): ?>
<?php echo $this->render_image_or_icon( $image_id , $show_icon ); ?> <div class="uploader-item-preview">
<input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $image_id; ?>">
</div> <?php echo $this->render_image_or_icon( $escaped_value, $show_icon ); ?>
<?php endif; ?>
<div class="button-placehold"> <input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $escaped_value; ?>">
<div class="button-placehold-content">
<i class="fa fa-plus"></i>
<span><?php esc_html_e( "Upload", "opalestate" ); ?></span>
</div> </div>
</div> <?php elseif ( empty( $escaped_value ) && isset( $field->args['value'] ) && (int) $field->args['value'] ):
<input type="file" name="<?php echo $args['id'];?>" <?php echo $attrs; ?> class="select-file" style="visibility: hidden;"> $image_id = $field->args['value'];
?>
<div class="uploader-item-preview">
</div>
<?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"> <p class="cmb2-metabox-description">
<i> <i>
<?php <?php
echo sprintf( esc_html__( 'Allow upload file have size < %s MB and maximum number of files: %s' ,'opalestate-pro'), 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>' ); ?> '<strong>' . $info['size'] . '</strong>', '<strong>' . $info['number'] . '</strong>' ); ?>
</i>
</i>
</p> </p>
<?php <?php
} }
/** /**
* *
*/ */
public function admin_head() { public function admin_head() {
?> ?>
<?php
}
<?php }
}
} $uploader = new CMB2_Uploader_Button();
$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 Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Plugin URI: https://wpdocs.gitbook.io/opal-estate/
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.4.1 * Version: 1.4.6
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9
@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/ */
public function __clone() { public function __clone() {
// Cloning instances of the class is forbidden // Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.3.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() { public function setup_constants() {
// Plugin version // Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) { if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.3.8' ); define( 'OPALESTATE_VERSION', '1.4.6' );
} }
// Plugin Folder Path // Plugin Folder Path
@ -264,7 +264,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
] ]
); );
// agent // agent
$this->includes( $this->includes(
[ [
'agent/class-opalestate-agent-posttype.php', 'agent/class-opalestate-agent-posttype.php',
@ -275,7 +275,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
] ]
); );
// agent // agent
$this->includes( $this->includes(
[ [
'agency/class-opalestate-agency-posttype.php', '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' ) { if ( opalestate_options( 'enable_submission', 'on' ) == 'on' ) {
$this->includes( $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 Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 5.3.2 Tested up to: 5.3.2
Stable tag: 1.4.1 Stable tag: 1.4.3.1
License: GPLv3 License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -81,7 +81,7 @@ The plugin will not make you disappointed with ease of use, friendly & flexible
= More Features = = More Features =
* Search properties: Properties List, List Sidebar, Grid, Grid Sidebar, Search result, Category, Location, Type, Submit Properties.. * 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 * 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.. * Quick Search: Users can quickly search properties or agents based on filter location, type, packing,bathroom, bedroom..
* Search Google Map * Search Google Map
@ -118,7 +118,7 @@ The plugin will not make you disappointed with ease of use, friendly & flexible
* Account Button * Account Button
= WHAT IS NEW IN PRO VERSION = = 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 * 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 Map with custom styles.
* Implement Google Capcha for all Email Form * 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 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") * 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 * 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") * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog == == 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 = = 1.4.1 - 2020-03-25 =
* Fixes - Split map AJAX * Fixes - Split map AJAX

View File

@ -66,7 +66,7 @@ $agent = new OpalEstate_Agent();
<?php $fax = $agent->get_meta( 'fax' ); ?> <?php $fax = $agent->get_meta( 'fax' ); ?>
<?php if ( ! empty( $fax ) ) : ?> <?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-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> </div>
<?php endif; ?> <?php endif; ?>
@ -117,4 +117,4 @@ $agent = new OpalEstate_Agent();
</div><!-- /.agent-box-content --> </div><!-- /.agent-box-content -->
</div> </div>
</div> </div>
</article> </article>

View File

@ -74,7 +74,7 @@ if ( $agent_id ) {
<div class="agent-box-email"> <div class="agent-box-email">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>
<a href="mailto:<?php echo esc_attr( $email ); ?>"> <a href="mailto:<?php echo esc_attr( $email ); ?>">
<span><?php echo esc_attr( $email ); ?></span> <span><?php echo esc_html( $email ); ?></span>
</a> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -84,7 +84,7 @@ if ( $agent_id ) {
<div class="agent-box-phone"> <div class="agent-box-phone">
<i class="fa fa-phone"></i> <i class="fa fa-phone"></i>
<a href="tel:<?php echo sanitize_title( $phone ); ?>"> <a href="tel:<?php echo sanitize_title( $phone ); ?>">
<span><?php echo esc_attr( $phone ); ?></span> <span><?php echo esc_html( $phone ); ?></span>
</a> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -94,7 +94,7 @@ if ( $agent_id ) {
<div class="agent-box-mobile"> <div class="agent-box-mobile">
<i class="fa fa-mobile"></i> <i class="fa fa-mobile"></i>
<a href="tel:<?php echo sanitize_title( $mobile ); ?>"> <a href="tel:<?php echo sanitize_title( $mobile ); ?>">
<span><?php echo esc_attr( $mobile ); ?></span> <span><?php echo esc_html( $mobile ); ?></span>
</a> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -102,7 +102,7 @@ if ( $agent_id ) {
<?php $fax = $agent->get_meta( 'fax' ); ?> <?php $fax = $agent->get_meta( 'fax' ); ?>
<?php if ( ! empty( $fax ) ) : ?> <?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-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> </div>
<?php endif; ?> <?php endif; ?>
@ -111,7 +111,7 @@ if ( $agent_id ) {
<div class="agent-box-web"> <div class="agent-box-web">
<i class="fa fa-globe"></i> <i class="fa fa-globe"></i>
<a href="<?php echo esc_attr( $web ); ?>" rel="nofollow" target="_blank"> <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> </a>
</div> </div>
<?php endif; ?> <?php endif; ?>
@ -145,4 +145,4 @@ if ( $agent_id ) {
</div><!-- /.agent-box-content --> </div><!-- /.agent-box-content -->
</div> </div>
</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 = (int) ( $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 = str_replace( ".", "", $max_price );
$start_price = $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 = apply_filters( 'opalestate_mortgage_rate_start', 10 );
$rate_start = 10;
$interest_rate_start = $rate_start / 100; $interest_rate_start = $rate_start / 100;
$years_start = 2; $years_start = apply_filters( 'opalestate_mortgage_years_start', 2 );
$deposit_start = $max_price / 2; $deposit_start = apply_filters( 'opalestate_mortgage_deposit_start', $max_price / 2 );
$loan_amount = $max_price - $deposit_start; $loan_amount = $max_price - $deposit_start;
$interest_rate_month = $interest_rate_start / 12; $interest_rate_month = $interest_rate_start / 12;
$number_of_payments_month = $years_start * 12; $number_of_payments_month = $years_start * 12;
@ -97,7 +95,7 @@ $data_years = [
'step' => 0.5, 'step' => 0.5,
]; ];
if ( opalestate_options( 'currency_position', 'before' ) == 'before' ) { if ( opalestate_options( 'currency_position', 'before' ) === 'before' ) {
$data_sale_price['unit_position'] = 'prefix'; $data_sale_price['unit_position'] = 'prefix';
$data_deposit['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 $mobile = get_post_meta( $id, OPALESTATE_AGENCY_PREFIX . 'mobile', true ); ?>
<?php if ( ! empty( $mobile ) ) : ?> <?php if ( ! empty( $mobile ) ) : ?>
<div class="agency-box-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 --> </div><!-- /.agency-box-phone -->
<?php endif; ?> <?php endif; ?>

View File

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

View File

@ -1,4 +1,4 @@
<?php <?php
if( !isset($id) ){ if( !isset($id) ){
$id = get_the_ID(); $id = get_the_ID();
} }
@ -20,7 +20,7 @@
<?php if( $type =='agency'): ?> <?php if( $type =='agency'): ?>
<div class="agent-preview has-avatar"><a href="<?php echo esc_url($link); ?>"> <div class="agent-preview has-avatar"><a href="<?php echo esc_url($link); ?>">
<?php if ( has_post_thumbnail( $id ) ) : ?> <?php if ( has_post_thumbnail( $id ) ) : ?>
<?php echo get_the_post_thumbnail( $id, 'full' ); ?> <?php echo get_the_post_thumbnail( $id, 'full' ); ?>
<?php endif; ?> <?php endif; ?>
<img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a> <img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a>
@ -29,13 +29,13 @@
<i class="fas fa-star"></i> <i class="fas fa-star"></i>
</span> </span>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php else : ?> <?php else : ?>
<div class="agent-preview"><a href="<?php echo esc_url($link); ?>"> <div class="agent-preview"><a href="<?php echo esc_url($link); ?>">
<img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a> <img src="<?php echo esc_url($avatar);?> " class="agent-avatar"></a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="agent-box-meta"> <div class="agent-box-meta">
<h4 class="agent-box-title"> <h4 class="agent-box-title">
@ -50,7 +50,7 @@
<div class="agent-box-email"> <div class="agent-box-email">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>
<a href="mailto:<?php echo esc_attr( $email ); ?>"> <a href="mailto:<?php echo esc_attr( $email ); ?>">
<span><?php echo esc_attr( $email ); ?></span> <span><?php echo esc_html( $email ); ?></span>
</a> </a>
</div><!-- /.agent-box-email --> </div><!-- /.agent-box-email -->
<?php endif; ?> <?php endif; ?>
@ -59,21 +59,21 @@
<?php $phone = get_post_meta( $id, $prefix . 'phone', true ); ?> <?php $phone = get_post_meta( $id, $prefix . 'phone', true ); ?>
<?php if ( ! empty( $phone ) ) : ?> <?php if ( ! empty( $phone ) ) : ?>
<div class="agent-box-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 --> </div><!-- /.agent-box-phone -->
<?php endif; ?> <?php endif; ?>
<?php $mobile = get_post_meta( $id, $prefix . 'mobile', true ); ?> <?php $mobile = get_post_meta( $id, $prefix . 'mobile', true ); ?>
<?php if ( ! empty( $mobile ) ) : ?> <?php if ( ! empty( $mobile ) ) : ?>
<div class="agent-box-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 --> </div><!-- /.agent-box-phone -->
<?php endif; ?> <?php endif; ?>
<?php $fax = get_post_meta( $id, $prefix . 'fax', true ); ?> <?php $fax = get_post_meta( $id, $prefix . 'fax', true ); ?>
<?php if ( ! empty( $fax ) ) : ?> <?php if ( ! empty( $fax ) ) : ?>
<div class="agent-box-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 --> </div><!-- /.agent-box-phone -->
<?php endif; ?> <?php endif; ?>
@ -82,7 +82,7 @@
<div class="agent-box-web"> <div class="agent-box-web">
<i class="fa fa-globe"></i> <i class="fa fa-globe"></i>
<a href="<?php echo esc_attr( $web ); ?>" rel="nofollow" target="_blank"> <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> </a>
</div><!-- /.agent-box-web --> </div><!-- /.agent-box-web -->
<?php endif; ?> <?php endif; ?>

View File

@ -3,7 +3,7 @@
<?php do_action( 'opalestate_user_dashboard_before' ); ?> <?php do_action( 'opalestate_user_dashboard_before' ); ?>
<?php <?php
$statistics = new OpalEstate_User_Statistics(); $statistics = new OpalEstate_User_Statistics();
$properties_count = []; $properties_count = [];
$properties_count[] = [ $properties_count[] = [
@ -52,7 +52,7 @@
<div class="col-lg-12 col-md-12"> <div class="col-lg-12 col-md-12">
<div class="card-item inner"> <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 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> ?></a>
</div> </div>

View File

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