Merge pull request #16 from wpopal/develop

Develop
This commit is contained in:
wpopal 2019-11-18 11:29:55 +07:00 committed by GitHub
commit 47e9f648cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 144 additions and 65 deletions

@ -139,10 +139,21 @@ function opalestate_api_get_property_data( $property_info ) {
$property['labels'] = $data->get_labels();
$property['locations'] = $data->get_locations();
$property['facilities'] = $data->get_facilities();
$property['amenities'] = $data->get_amenities();
$property['types'] = $data->get_types_tax();
$property['author_type'] = $data->get_author_type();
$property['author_data'] = $data->get_author_link_data();
$amenities = $data->get_amenities();
$amenities_result = [];
if ( $amenities ) {
foreach ( $amenities as $amenity ) {
$value = has_term( $amenity->term_id, 'opalestate_amenities', $property_info->ID );
$amenity->value = $value;
$amenities_result[] = $amenity;
}
}
$property['amenities'] = $amenities_result;
$property['types'] = $data->get_types_tax();
$property['author_type'] = $data->get_author_type();
$property['author_data'] = $data->get_author_link_data();
$limit = opalestate_get_option( 'single_views_statistics_limit', 8 );
$stats = new Opalestate_View_Stats( $data->get_id(), $limit );

@ -366,7 +366,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
[
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => sanitize_text_field( $request['amenities'] ),
'terms' => ( $request['amenities'] ),
];
}
@ -376,29 +376,46 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
}
$args['meta_query'] = [ 'relation' => 'AND' ];
if ( isset( $request['info'] ) && is_array( $request['info'] ) ) {
$metaquery = [];
foreach ( $request['info'] as $key => $value ) {
if ( trim( $value ) ) {
if ( is_numeric( trim( $value ) ) ) {
$fieldquery = [
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
'value' => sanitize_text_field( trim( $value ) ),
'compare' => apply_filters( 'opalestate_info_numeric_compare', '>=' ),
'type' => 'NUMERIC',
];
} else {
$fieldquery = [
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
'value' => sanitize_text_field( trim( $value ) ),
'compare' => 'LIKE',
];
}
$sarg = apply_filters( 'opalestate_search_field_query_' . $key, $fieldquery );
$metaquery[] = $sarg;
if ( isset( $request['info'] ) ) {
$info_array = [];
if ( is_array( $request['info'] ) ) {
$info_array = $request['info'];
} elseif ( is_string( $request['info'] ) ) {
$info = $request['info'];
$array = json_decode($info);
$array = json_decode(json_encode($array), true);
if ( is_array( $array ) ) {
$info_array = $array;
}
}
$args['meta_query'] = array_merge( $args['meta_query'], $metaquery );
if ( $info_array && ! empty($info_array) ) {
$metaquery = [];
foreach ( $info_array as $key => $value ) {
if ( trim( $value ) ) {
if ( is_numeric( trim( $value ) ) ) {
$fieldquery = [
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
'value' => sanitize_text_field( trim( $value ) ),
'compare' => apply_filters( 'opalestate_info_numeric_compare', '>=' ),
'type' => 'NUMERIC',
];
} else {
$fieldquery = [
'key' => OPALESTATE_PROPERTY_PREFIX . $key,
'value' => sanitize_text_field( trim( $value ) ),
'compare' => 'LIKE',
];
}
$sarg = apply_filters( 'opalestate_search_field_query_' . $key, $fieldquery );
$metaquery[] = $sarg;
}
}
$args['meta_query'] = array_merge( $args['meta_query'], $metaquery );
}
}
if ( $search_min_price != '' && $search_min_price != '' && is_numeric( $search_min_price ) && is_numeric( $search_max_price ) ) {
@ -637,13 +654,13 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'validate_callback' => 'rest_validate_request_arg',
];
$params['info'] = [
'description' => __( 'Info', 'opalestate-pro' ),
'type' => 'array',
// 'default' => '',
// 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg',
];
// $params['info'] = [
// 'description' => __( 'Info', 'opalestate-pro' ),
// 'type' => 'array',
// // 'default' => '',
// // 'sanitize_callback' => 'sanitize_text_field',
// 'validate_callback' => 'rest_validate_request_arg',
// ];
return $params;
}

@ -240,7 +240,6 @@ class Opalestate_Property_MetaBox {
'name' => esc_html__( 'Regular Price', 'opalestate-pro' ) . $currency,
'type' => 'text',
'description' => esc_html__( 'Enter amount without currency', 'opalestate-pro' ),
'attributes' => [ 'required' => 'required' ],
'before_row' => '<div class="row-group-features group-has-three group-price clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Price', 'opalestate-pro' ) ) . '</h3>', // callback
],
[

@ -114,7 +114,7 @@ class OpalEstate_Search {
[
'taxonomy' => 'opalestate_amenities',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['amenities'] ),
'terms' => ( $_GET['amenities'] ),
];
}
@ -153,7 +153,6 @@ 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'], [
'key' => OPALESTATE_PROPERTY_PREFIX . 'price',
'value' => [ $search_min_price, $search_max_price ],

@ -10,6 +10,33 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Add body classes for Opalestate pages.
*
* @param array $classes Body Classes.
* @return array
*/
function opalestate_body_class( $classes ) {
$classes = (array) $classes;
$classes[] = 'opalestate-active';
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
if ( $current_user ) {
$roles = $current_user->roles;
if ( $roles && is_array( $roles ) ) {
foreach ( $roles as $role ) {
$classes[] = 'opalestate-role-' . esc_attr( $role );
}
}
}
}
return array_unique( $classes );
}
function opalestate_archive_search_block() {
echo opalestate_load_template_path( 'parts/archive-search-block' );
}

@ -1,4 +1,9 @@
<?php
/**
* Body classes.
*/
add_filter( 'body_class', 'opalestate_body_class' );
/**
* Archive Page
*/
@ -14,7 +19,6 @@ function opalestate_single_property_layout_default() {
add_action( 'opalestate_single_property_summary', 'opalestate_property_facilities', 17 );
add_action( 'opalestate_single_property_summary', 'opalestate_property_attachments', 18 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_video', 20 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_virtual_tour', 25 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_map', 30 );
@ -25,7 +29,6 @@ function opalestate_single_property_layout_default() {
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_apartments', 45 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_floor_plans', 45 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_views_statistics', 50 );
// add_action( 'opalestate_after_single_property_summary', '', 55 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_tags', 60 );
if ( opalestate_property_reviews_enabled() ) {
@ -34,12 +37,9 @@ function opalestate_single_property_layout_default() {
add_action( 'opalestate_after_single_property_summary_v2', 'opalestate_property_map_v2', 5 );
////// sidebar ////////
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 );
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 );
// add_action( 'opalestate_single_property_sidebar', 'opalestate_property_request_viewing_button', 7 );
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
@ -57,11 +57,6 @@ function opalestate_single_property_layout_default() {
function opalestate_single_property_layout_v2() {
add_action( 'opalestate_single_property_summary', 'opalestate_get_single_short_meta', 10 );
add_action( 'opalestate_single_property_summary', 'opalestate_property_content', 12 );
//add_action( 'opalestate_single_property_summary', 'opalestate_property_information', 15 );
//add_action( 'opalestate_single_property_summary', 'opalestate_property_amenities', 16 );
//add_action( 'opalestate_single_property_summary', 'opalestate_property_facilities', 17 );
//add_action( 'opalestate_single_property_summary', 'opalestate_property_attachments', 18 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_video', 20 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_virtual_tour', 25 );
@ -71,8 +66,6 @@ function opalestate_single_property_layout_v2() {
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_apartments', 45 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_views_statistics', 50 );
// add_action( 'opalestate_after_single_property_summary', 'opalestate_property_author', 55 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_tags', 60 );
if ( opalestate_property_reviews_enabled() ) {
@ -81,14 +74,11 @@ function opalestate_single_property_layout_v2() {
add_action( 'opalestate_after_single_property_summary_v2', 'opalestate_property_map_v2', 5 );
/// /// sidebar ////////
if ( opalestate_get_option( 'enable_single_mortgage', 'on' ) == 'on' ) {
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 );
}
add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v3', 10 );
// add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form' , 12 );
}
@ -103,17 +93,14 @@ function opalestate_single_property_layout_v3() {
add_action( 'opalestate_single_property_summary', 'opalestate_property_facilities', 17 );
add_action( 'opalestate_single_property_summary', 'opalestate_property_attachments', 18 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_video', 20 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_virtual_tour', 25 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_map', 30 );
// add_action( 'opalestate_after_single_property_summary', 'opalestate_property_nearby', 35 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_walkscore', 40 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_apartments', 45 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_views_statistics', 50 );
// add_action( 'opalestate_after_single_property_summary', 'opalestate_property_author', 55 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_tags', 60 );
if ( opalestate_property_reviews_enabled() ) {
@ -177,7 +164,6 @@ function opalestate_single_property_layout_v5() {
add_action( 'opalestate_single_property_summary', 'opalestate_property_facilities', 17 );
add_action( 'opalestate_single_property_summary', 'opalestate_property_attachments', 18 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_video', 20 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_virtual_tour', 25 );
add_action( 'opalestate_after_single_property_summary', 'opalestate_property_map', 30 );
@ -209,14 +195,10 @@ function opalestate_single_property_layout_v5() {
}
}
///
add_action( 'opalestate_single_property_after_render', 'opalestate_properties_related', 5 );
add_action( 'opalestate_single_property_after_render', 'opalestate_properties_nearby', 6 );
add_action( 'opalestate_single_property_preview', 'opalestate_property_preview', 15 );
function opalestate_property_request_viewing_button( $islink = false ) {
if ( 'on' != opalestate_get_option( 'enable_single_request_viewing', 'on' ) ) {
return;
@ -236,7 +218,9 @@ function opalestate_property_request_viewing_button( $islink = false ) {
}
/**
* @param $layout
* Get single layout.
*
* @param string $layout Layout.
*/
function opalestate_single_property_layout( $layout ) {
switch ( $layout ) {
@ -334,7 +318,6 @@ function opalestate_load_plugin_template( $template ) {
} else {
$template = OPALESTATE_PLUGIN_DIR . '/templates/fullwidth-page.php';
}
}
if ( $template == '' ) {

@ -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.1.9
* Version: 1.1.9.1
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.6
@ -151,7 +151,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.1.9' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.1.9.1' );
}
/**
@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.1.9' );
define( 'OPALESTATE_VERSION', '1.1.9.1' );
}
// Plugin Folder Path

@ -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.6
Tested up to: 5.2.3
Stable tag: 1.1.9
Stable tag: 1.1.9.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -156,6 +156,9 @@ 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.1.9 - 2019-11-08 =
* Added - Template hooks.
= 1.1.9 - 2019-11-07 =
* Fixes - Dashboard page.
* Added - Expired properties.

@ -14,10 +14,14 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<header class="property-single-header">
<div class="property-single-info">
<div class="group-items">
<?php do_action( 'opalestate_before_single_property_title' ); ?>
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<?php opalestate_property_label(); ?>
<?php opalestate_property_status(); ?>
<?php do_action( 'opalestate_after_single_property_title' ); ?>
<div class="property-meta">
<div class="property-meta__list">
<?php opalestate_property_types_list(); ?>
@ -88,6 +92,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="property-tab-content">
<div class="property-meta-top">
<ul class="list-inline property-meta-top__list">
<?php do_action( 'opalestate_before_property_meta_top_list' ); ?>
<?php if ( $property->get_sku() ) : ?>
<li class="list-inline__sku">
<span><?php esc_html_e( 'Property ID: ', 'opalestate-pro' ) ?></span>
@ -103,6 +109,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<li class="list-inline__favorite property-meta-top__button">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
</li>
<?php do_action( 'opalestate_after_property_meta_top_list' ); ?>
</ul>
</div>

@ -13,6 +13,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="property-single-stick-bars keep-top-bars ">
<div class="container">
<ul class="list-inline">
<?php do_action( 'opalestate_before_property_meta_top_list' ); ?>
<li class="list-inline__favorite">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
</li>
@ -24,6 +26,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<li class="list-inline__request-viewing single-property-buttons">
<?php opalestate_property_request_viewing_button(); ?>
</li>
<?php do_action( 'opalestate_after_property_meta_top_list' ); ?>
</ul>
</div>
</div>
@ -38,10 +42,14 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="property-single-info">
<div class="single-price-content"><?php opalestate_property_loop_price(); ?></div>
<div class="group-items">
<?php do_action( 'opalestate_before_single_property_title' ); ?>
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<?php opalestate_property_label(); ?>
<?php opalestate_property_status(); ?>
<?php do_action( 'opalestate_after_single_property_title' ); ?>
<div class="property-meta">
<div class="property-meta__list">
<?php opalestate_property_types_list(); ?>

@ -11,10 +11,14 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<header class="property-single-header">
<div class="property-single-info">
<div class="group-items">
<?php do_action( 'opalestate_before_single_property_title' ); ?>
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<?php opalestate_property_label(); ?>
<?php opalestate_property_status(); ?>
<?php do_action( 'opalestate_after_single_property_title' ); ?>
<div class="property-meta">
<div class="property-meta__list">
<?php opalestate_property_types_list(); ?>
@ -58,6 +62,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="summary entry-summary opalestate-rows">
<div class="property-meta-top">
<ul class="list-inline property-meta-top__list">
<?php do_action( 'opalestate_before_property_meta_top_list' ); ?>
<?php if ( $property->get_sku() ) : ?>
<li class="list-inline__sku">
<span><?php esc_html_e( 'Property ID: ', 'opalestate-pro' ) ?></span>
@ -73,6 +79,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<li class="list-inline__favorite property-meta-top__button">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
</li>
<?php do_action( 'opalestate_after_property_meta_top_list' ); ?>
</ul>
</div>

@ -51,10 +51,14 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="property-single-info">
<div class="single-price-content"><?php opalestate_property_loop_price(); ?></div>
<div class="group-items">
<?php do_action( 'opalestate_before_single_property_title' ); ?>
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<?php opalestate_property_label(); ?>
<?php opalestate_property_status(); ?>
<?php do_action( 'opalestate_after_single_property_title' ); ?>
<div class="property-meta">
<div class="property-meta__list">
<?php opalestate_property_types_list(); ?>
@ -91,6 +95,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="summary entry-summary opalestate-rows">
<div class="property-meta-top">
<ul class="list-inline property-meta-top__list">
<?php do_action( 'opalestate_before_property_meta_top_list' ); ?>
<?php if ( $property->get_sku() ) : ?>
<li class="list-inline__sku">
<span><?php esc_html_e( 'Property ID: ', 'opalestate-pro' ) ?></span>
@ -103,6 +109,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<li class="list-inline__favorite property-meta-top__button">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
</li>
<?php do_action( 'opalestate_after_property_meta_top_list' ); ?>
</ul>
</div>

@ -9,10 +9,14 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<header class="property-single-header">
<div class="property-single-info">
<div class="group-items">
<?php do_action( 'opalestate_before_single_property_title' ); ?>
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
<?php opalestate_property_label(); ?>
<?php opalestate_property_status(); ?>
<?php do_action( 'opalestate_after_single_property_title' ); ?>
<div class="property-meta">
<div class="property-meta__list">
<?php opalestate_property_types_list(); ?>
@ -63,6 +67,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<div class="summary entry-summary opalestate-rows">
<div class="property-meta-top">
<ul class="list-inline property-meta-top__list">
<?php do_action( 'opalestate_before_property_meta_top_list' ); ?>
<?php if ( $property->get_sku() ) : ?>
<li class="list-inline__sku">
<span><?php esc_html_e( 'Property ID: ', 'opalestate-pro' ) ?></span>
@ -78,6 +84,8 @@ $header = apply_filters( 'opalestate_single_show_heading', true );
<li class="list-inline__favorite property-meta-top__button">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
</li>
<?php do_action( 'opalestate_after_property_meta_top_list' ); ?>
</ul>
</div>