commit
5c8025aff5
@ -188,11 +188,18 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
|
|||||||
$ouput['featured'] = $agency->is_featured();
|
$ouput['featured'] = $agency->is_featured();
|
||||||
$ouput['trusted'] = $agency->get_trusted();
|
$ouput['trusted'] = $agency->get_trusted();
|
||||||
$ouput['email'] = $agency->get_meta( 'email' );
|
$ouput['email'] = $agency->get_meta( 'email' );
|
||||||
|
$ouput['website'] = $agency->get_meta( 'website' );
|
||||||
|
$ouput['phone'] = $agency->get_meta( 'phone' );
|
||||||
|
$ouput['mobile'] = $agency->get_meta( 'mobile' );
|
||||||
|
$ouput['fax'] = $agency->get_meta( 'fax' );
|
||||||
$ouput['address'] = $agency->get_meta( 'address' );
|
$ouput['address'] = $agency->get_meta( 'address' );
|
||||||
$ouput['map'] = $agency->get_meta( 'map' );
|
$ouput['map'] = $agency->get_meta( 'map' );
|
||||||
$terms = wp_get_post_terms( $agency_info->ID, 'opalestate_agency_location' );
|
$terms = wp_get_post_terms( $agency_info->ID, 'opalestate_agency_location' );
|
||||||
$ouput['location'] = $terms && ! is_wp_error( $terms ) ? $terms : [];
|
$ouput['location'] = $terms && ! is_wp_error( $terms ) ? $terms : [];
|
||||||
$ouput['socials'] = $agency->get_socials();
|
$ouput['socials'] = $agency->get_socials();
|
||||||
|
$properties = $this->get_properties( $agency_info->ID );
|
||||||
|
$ouput['listing_count'] = count( $properties );
|
||||||
|
$ouput['listings'] = $properties;
|
||||||
|
|
||||||
return apply_filters( 'opalestate_api_agencies', $ouput );
|
return apply_filters( 'opalestate_api_agencies', $ouput );
|
||||||
}
|
}
|
||||||
@ -283,4 +290,67 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
|
|||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get agent listings.
|
||||||
|
*
|
||||||
|
* @param int $id Agency ID.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_properties( $id ) {
|
||||||
|
$properties = [];
|
||||||
|
if ( $id > 0 ) {
|
||||||
|
$post = get_post( $id );
|
||||||
|
if ( $post && $this->post_type == get_post_type( $id ) ) {
|
||||||
|
$user_id = get_post_meta( $id, OPALESTATE_AGENCY_PREFIX . 'user_id', true );
|
||||||
|
$agents = get_post_meta( $id, OPALESTATE_AGENCY_PREFIX . 'team', true );
|
||||||
|
|
||||||
|
if ( $user_id ) {
|
||||||
|
$author = [ $user_id ];
|
||||||
|
$agents = get_post_meta( $id, OPALESTATE_AGENCY_PREFIX . 'team', true );
|
||||||
|
|
||||||
|
if ( is_array( $agents ) ) {
|
||||||
|
$author = array_merge( $author, $agents );
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = [
|
||||||
|
'post_type' => 'opalestate_property',
|
||||||
|
'author__in' => $author,
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$args = [
|
||||||
|
'post_type' => 'opalestate_property',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
];
|
||||||
|
$args['meta_query'] = [ 'relation' => 'OR' ];
|
||||||
|
array_push( $args['meta_query'], [
|
||||||
|
'key' => OPALESTATE_PROPERTY_PREFIX . 'agency',
|
||||||
|
'value' => $id,
|
||||||
|
'compare' => '=',
|
||||||
|
] );
|
||||||
|
|
||||||
|
if ( $agents ) {
|
||||||
|
array_push( $args['meta_query'], [
|
||||||
|
'key' => OPALESTATE_PROPERTY_PREFIX . 'agent',
|
||||||
|
'value' => $agents,
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$property_list = get_posts( $args );
|
||||||
|
|
||||||
|
if ( $property_list ) {
|
||||||
|
$i = 0;
|
||||||
|
foreach ( $property_list as $property_info ) {
|
||||||
|
$properties[ $i ] = opalestate_api_get_property_data( $property_info );
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $properties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,13 +246,22 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
|
|||||||
$ouput['featured'] = $agent->is_featured();
|
$ouput['featured'] = $agent->is_featured();
|
||||||
$ouput['trusted'] = $agent->get_trusted();
|
$ouput['trusted'] = $agent->get_trusted();
|
||||||
$ouput['email'] = $agent->get_meta( 'email' );
|
$ouput['email'] = $agent->get_meta( 'email' );
|
||||||
|
$ouput['website'] = $agent->get_meta( 'website' );
|
||||||
|
$ouput['phone'] = $agent->get_meta( 'phone' );
|
||||||
|
$ouput['mobile'] = $agent->get_meta( 'mobile' );
|
||||||
|
$ouput['fax'] = $agent->get_meta( 'fax' );
|
||||||
|
$ouput['job'] = $agent->get_meta( 'job' );
|
||||||
|
$ouput['company'] = $agent->get_meta( 'company' );
|
||||||
$ouput['address'] = $agent->get_meta( 'address' );
|
$ouput['address'] = $agent->get_meta( 'address' );
|
||||||
$ouput['map'] = $agent->get_meta( 'map' );
|
$ouput['map'] = $agent->get_meta( 'map' );
|
||||||
|
|
||||||
$terms = wp_get_post_terms( $agent_info->ID, 'opalestate_agent_location' );
|
$terms = wp_get_post_terms( $agent_info->ID, 'opalestate_agent_location' );
|
||||||
$ouput['location'] = $terms && ! is_wp_error( $terms ) ? $terms : [];
|
$ouput['location'] = $terms && ! is_wp_error( $terms ) ? $terms : [];
|
||||||
$ouput['socials'] = $agent->get_socials();
|
$ouput['socials'] = $agent->get_socials();
|
||||||
$ouput['levels'] = wp_get_post_terms( $agent_info->ID, 'opalestate_agent_level' );
|
$ouput['levels'] = wp_get_post_terms( $agent_info->ID, 'opalestate_agent_level' );
|
||||||
|
$properties = $this->get_properties( $agent_info->ID );
|
||||||
|
$ouput['listing_count'] = count( $properties );
|
||||||
|
$ouput['listing'] = $properties;
|
||||||
|
|
||||||
return apply_filters( 'opalestate_api_agents', $ouput );
|
return apply_filters( 'opalestate_api_agents', $ouput );
|
||||||
}
|
}
|
||||||
@ -267,4 +276,52 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
|
|||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get agent listings.
|
||||||
|
*
|
||||||
|
* @param int $id Agent ID
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_properties( $id ) {
|
||||||
|
$properties = [];
|
||||||
|
if ( $id > 0 ) {
|
||||||
|
$post = get_post( $id );
|
||||||
|
if ( $post && $this->post_type == get_post_type( $id ) ) {
|
||||||
|
|
||||||
|
$user_id = get_post_meta( $id, OPALESTATE_AGENT_PREFIX . 'user_id', true );
|
||||||
|
|
||||||
|
$args = [
|
||||||
|
'post_type' => 'opalestate_property',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'post__not_in' => [ $id ],
|
||||||
|
'post_status' => 'publish',
|
||||||
|
];
|
||||||
|
|
||||||
|
$args['meta_query'] = [ 'relation' => 'AND' ];
|
||||||
|
|
||||||
|
if ( $user_id ) {
|
||||||
|
$args['author'] = $user_id;
|
||||||
|
} else {
|
||||||
|
array_push( $args['meta_query'], [
|
||||||
|
'key' => OPALESTATE_PROPERTY_PREFIX . 'agent',
|
||||||
|
'value' => $id,
|
||||||
|
'compare' => '=',
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$property_list = get_posts( $args );
|
||||||
|
|
||||||
|
if ( $property_list ) {
|
||||||
|
$i = 0;
|
||||||
|
foreach ( $property_list as $property_info ) {
|
||||||
|
$properties[ $i ] = opalestate_api_get_property_data( $property_info );
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $properties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,15 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
|
|||||||
function opalestate_property_areasize_field_template( $template = '' ) {
|
function opalestate_property_areasize_field_template( $template = '' ) {
|
||||||
$search_min = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : opalestate_options( 'search_min_area', 0 );
|
$search_min = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : opalestate_options( 'search_min_area', 0 );
|
||||||
$search_max = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : opalestate_options( 'search_max_area', 1000 );
|
$search_max = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : opalestate_options( 'search_max_area', 1000 );
|
||||||
|
$measurement_units = opalestate_get_measurement_units();
|
||||||
|
$unit = opalestate_options( 'measurement_unit', 'sqft' );
|
||||||
|
if ( isset( $measurement_units[ $unit ] ) ) {
|
||||||
|
$unit = $measurement_units[ $unit ];
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => 'area',
|
'id' => 'area',
|
||||||
'unit' => opalestate_options( 'measurement_unit', 'sq ft' ) . ' ',
|
'unit' => $unit . ' ',
|
||||||
'ranger_min' => opalestate_options( 'search_min_area', 0 ),
|
'ranger_min' => opalestate_options( 'search_min_area', 0 ),
|
||||||
'ranger_max' => opalestate_options( 'search_max_area', 1000 ),
|
'ranger_max' => opalestate_options( 'search_max_area', 1000 ),
|
||||||
'input_min' => $search_min,
|
'input_min' => $search_min,
|
||||||
|
@ -40,7 +40,7 @@ function opalestate_output_msg_json( $result = false, $message = '', $args = [],
|
|||||||
* Process upload images for properties
|
* Process upload images for properties
|
||||||
*/
|
*/
|
||||||
function opalesate_upload_image( $submitted_file, $parent_id = 0 ) {
|
function opalesate_upload_image( $submitted_file, $parent_id = 0 ) {
|
||||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||||
require_once ABSPATH . 'wp-admin/includes/media.php';
|
require_once ABSPATH . 'wp-admin/includes/media.php';
|
||||||
|
|
||||||
@ -1062,7 +1062,13 @@ function opalestate_price( $price, $args = [] ) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function opalestate_areasize_unit_format( $value = '' ) {
|
function opalestate_areasize_unit_format( $value = '' ) {
|
||||||
return $value . ' ' . '<span>' . opalestate_options( 'measurement_unit', 'sq ft' ) . '</span>';
|
$measurement_units = opalestate_get_measurement_units();
|
||||||
|
$unit = opalestate_options( 'measurement_unit', 'sqft' );
|
||||||
|
if ( isset( $measurement_units[ $unit ] ) ) {
|
||||||
|
$unit = $measurement_units[ $unit ];
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf( _x( '%1$s <span>%2$s</span>', 'areasize info','opalestate-pro' ), $value, $unit );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'opalestate_areasize_unit_format', 'opalestate_areasize_unit_format' );
|
add_filter( 'opalestate_areasize_unit_format', 'opalestate_areasize_unit_format' );
|
||||||
|
@ -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.1.9.2
|
* Version: 1.1.9.3
|
||||||
* Author: WPOPAL
|
* Author: WPOPAL
|
||||||
* Author URI: http://www.wpopal.com
|
* Author URI: http://www.wpopal.com
|
||||||
* Requires at least: 4.6
|
* Requires at least: 4.6
|
||||||
@ -151,7 +151,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’ huh?', 'opalestate-pro' ), '1.1.9.2' );
|
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.1.9.3' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +160,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.1.9.2' );
|
define( 'OPALESTATE_VERSION', '1.1.9.3' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin Folder Path
|
// 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
|
Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace
|
||||||
Requires at least: 4.6
|
Requires at least: 4.6
|
||||||
Tested up to: 5.2.3
|
Tested up to: 5.2.3
|
||||||
Stable tag: 1.1.9.2
|
Stable tag: 1.1.9.3
|
||||||
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
|
||||||
|
|
||||||
@ -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")
|
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.1.9.3 - 2019-11-27 =
|
||||||
|
* Fixes - Measurement Unit translation.
|
||||||
|
|
||||||
= 1.1.9.2 - 2019-11-18 =
|
= 1.1.9.2 - 2019-11-18 =
|
||||||
* Added - Fix API.
|
* Added - Fix API.
|
||||||
* Fixes - Search query.
|
* Fixes - Search query.
|
||||||
|
Loading…
Reference in New Issue
Block a user