commit
763de6f71b
@ -4,11 +4,11 @@ jQuery( document ).ready( function ( $ ) {
|
|||||||
* Country select.
|
* Country select.
|
||||||
*/
|
*/
|
||||||
var $country_el = $( '.opalestate-submission-form #opalestate_ppt_location, [name="location"],' +
|
var $country_el = $( '.opalestate-submission-form #opalestate_ppt_location, [name="location"],' +
|
||||||
' [name="opalestate_ofe_location"], [name="opalestate_agt_location"]' ),
|
' [name="opalestate_ofe_location"], [name="opalestate_agt_location"], [name="opalestate_user_location"]' ),
|
||||||
$state_el = $( '.opalestate-submission-form #opalestate_ppt_state, [name="state"],' +
|
$state_el = $( '.opalestate-submission-form #opalestate_ppt_state, [name="state"],' +
|
||||||
' [name="opalestate_ofe_state"], [name="opalestate_agt_state"]' ),
|
' [name="opalestate_ofe_state"], [name="opalestate_agt_state"], [name="opalestate_user_state"]' ),
|
||||||
$city_el = $( '.opalestate-submission-form #opalestate_ppt_city, [name="city"],' +
|
$city_el = $( '.opalestate-submission-form #opalestate_ppt_city, [name="city"],' +
|
||||||
' [name="opalestate_ofe_city"], [name="opalestate_agt_city"]' );
|
' [name="opalestate_ofe_city"], [name="opalestate_agt_city"], [name="opalestate_user_city"]' );
|
||||||
|
|
||||||
$country_el.each( function () {
|
$country_el.each( function () {
|
||||||
if ( $( this ).val() != '' && $( this ).val() != '-1' ) {
|
if ( $( this ).val() != '' && $( this ).val() != '-1' ) {
|
||||||
|
76
assets/js/custom-fields.js
Normal file
76
assets/js/custom-fields.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
jQuery( document ).ready( function ( $ ) {
|
||||||
|
$.ajax( {
|
||||||
|
type: 'post',
|
||||||
|
dataType: 'json',
|
||||||
|
url: ajaxurl,
|
||||||
|
data: { action: 'opalestate_setting_custom_fields' },
|
||||||
|
success: function ( response ) {
|
||||||
|
var arr_setting_fields = response.data;
|
||||||
|
|
||||||
|
for ( var i = 0; i < arr_setting_fields.length; i++ ) {
|
||||||
|
$( '#' + arr_setting_fields[ i ] ).addClass( 'search-control' );
|
||||||
|
$( 'input[name="' + arr_setting_fields[ i ] + '_search_type"]' ).addClass( 'search-type-ctrl' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$( '.search-type-ctrl' ).each( function ( index, value ) {
|
||||||
|
if ( $( this ).prop( 'checked' ) ) {
|
||||||
|
var val = $( this ).val();
|
||||||
|
var name = $( this ).attr( 'name' );
|
||||||
|
if ( val === 'select' ) {
|
||||||
|
var res = name.replace( /_search_type/g, '' );
|
||||||
|
var res = res.replace( /_/g, '-' );
|
||||||
|
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( val === 'text' ) {
|
||||||
|
var res = name.replace( /_search_type/g, '' );
|
||||||
|
var res = res.replace( /_/g, '-' );
|
||||||
|
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( val === 'range' ) {
|
||||||
|
var name = $( this ).attr( 'name' );
|
||||||
|
var res = name.replace( /_search_type/g, '' );
|
||||||
|
var res = res.replace( /_/g, '-' );
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
$( '.search-type-ctrl' ).on( 'change', function () {
|
||||||
|
var val = $( this ).val();
|
||||||
|
var name = $( this ).attr( 'name' );
|
||||||
|
var res = name.replace( /_search_type/g, '' );
|
||||||
|
var res = res.replace( /_/g, '-' );
|
||||||
|
|
||||||
|
if ( val == 'range' ) {
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).hide();
|
||||||
|
} else if ( val == 'text' ) {
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).hide();
|
||||||
|
} else {
|
||||||
|
$( '.cmb2-id-' + res + '-options-value' ).show();
|
||||||
|
$( '.cmb2-id-' + res + '-min-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-max-range' ).hide();
|
||||||
|
$( '.cmb2-id-' + res + '-default-text' ).hide();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
} );
|
@ -7,15 +7,13 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
class Opalestate_Admin_Agency {
|
class Opalestate_Admin_Agency {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Opalestate_Admin_Agency constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
add_action( 'cmb2_admin_init', [ $this, 'metaboxes' ] );
|
||||||
add_action( 'cmb2_admin_init', array( $this, 'metaboxes' ) );
|
add_action( 'save_post', [ $this, 'on_save_post' ], 13, 2 );
|
||||||
add_action( 'save_post', array( $this , 'on_save_post'), 13, 2 );
|
add_action( 'user_register', [ $this, 'on_update_user' ], 10, 1 );
|
||||||
|
add_action( 'profile_update', [ $this, 'on_update_user' ], 10, 1 );
|
||||||
add_action( 'user_register' , array( $this, 'on_update_user' ), 10, 1 );
|
|
||||||
add_action( 'profile_update' , array( $this, 'on_update_user' ), 10, 1 );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,13 +24,9 @@ class Opalestate_Admin_Agency {
|
|||||||
$post_type = get_post_type( $post_id );
|
$post_type = get_post_type( $post_id );
|
||||||
if ( $post_type == 'opalestate_agency' ) {
|
if ( $post_type == 'opalestate_agency' ) {
|
||||||
if ( isset( $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] ) && $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] ) {
|
if ( isset( $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] ) && $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] ) {
|
||||||
|
|
||||||
$user_id = absint( $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] );
|
$user_id = absint( $_POST[ OPALESTATE_AGENCY_PREFIX . 'user_id' ] );
|
||||||
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', $post_id );
|
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', $post_id );
|
||||||
|
|
||||||
OpalEstate_Agency::update_user_data( $user_id );
|
OpalEstate_Agency::update_user_data( $user_id );
|
||||||
// OpalEstate_Agency::update_properties_related( $user_id );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,10 +38,10 @@ class Opalestate_Admin_Agency {
|
|||||||
if ( isset( $_POST['user_id'] ) && (int) $_POST['user_id'] && isset( $_POST['role'] ) ) {
|
if ( isset( $_POST['user_id'] ) && (int) $_POST['user_id'] && isset( $_POST['role'] ) ) {
|
||||||
if ( $_POST['role'] == 'opalestate_agency' ) {
|
if ( $_POST['role'] == 'opalestate_agency' ) {
|
||||||
$user_id = absint( $_POST['user_id'] );
|
$user_id = absint( $_POST['user_id'] );
|
||||||
|
static::update_user_metas( $user_id );
|
||||||
|
|
||||||
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
|
||||||
$post = get_post( $related_id );
|
$post = get_post( $related_id );
|
||||||
|
|
||||||
if ( isset( $post->ID ) && $post->ID ) {
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
OpalEstate_Agency::update_data_from_user( $related_id );
|
OpalEstate_Agency::update_data_from_user( $related_id );
|
||||||
}
|
}
|
||||||
@ -55,6 +49,25 @@ class Opalestate_Admin_Agency {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update some user metas.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_user_metas( $user_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] ) ) {
|
||||||
|
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . $term, $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -64,23 +77,22 @@ class Opalestate_Admin_Agency {
|
|||||||
$prefix = OPALESTATE_AGENCY_PREFIX;
|
$prefix = OPALESTATE_AGENCY_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = array(
|
$fields = [
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
array(
|
|
||||||
'name' => esc_html__( 'Gallery', 'opalestate-pro' ),
|
'name' => esc_html__( 'Gallery', 'opalestate-pro' ),
|
||||||
'desc' => esc_html__( 'Select one, to add new you create in location of estate panel', 'opalestate-pro' ),
|
'desc' => esc_html__( 'Select one, to add new you create in location of estate panel', 'opalestate-pro' ),
|
||||||
'id' => $prefix . "gallery",
|
'id' => $prefix . "gallery",
|
||||||
'type' => 'file_list',
|
'type' => 'file_list',
|
||||||
) ,
|
],
|
||||||
|
|
||||||
array(
|
[
|
||||||
'name' => esc_html__( 'Slogan', 'opalestate-pro' ),
|
'name' => esc_html__( 'Slogan', 'opalestate-pro' ),
|
||||||
'id' => "{$prefix}slogan",
|
'id' => "{$prefix}slogan",
|
||||||
'type' => 'text'
|
'type' => 'text',
|
||||||
)
|
],
|
||||||
);
|
];
|
||||||
|
|
||||||
return apply_filters( 'opalestate_postype_agency_metaboxes_fields', $fields );
|
return apply_filters( 'opalestate_postype_agency_metaboxes_fields', $fields );
|
||||||
}
|
}
|
||||||
@ -105,52 +117,53 @@ class Opalestate_Admin_Agency {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$box_options = array(
|
$box_options = [
|
||||||
'id' => $prefix . 'edit',
|
'id' => $prefix . 'edit',
|
||||||
'title' => esc_html__( 'Metabox', 'opalestate-pro' ),
|
'title' => esc_html__( 'Metabox', 'opalestate-pro' ),
|
||||||
'object_types' => array( 'opalestate_agency' ),
|
'object_types' => [ 'opalestate_agency' ],
|
||||||
'show_names' => true,
|
'show_names' => true,
|
||||||
);
|
];
|
||||||
|
|
||||||
// Setup meta box
|
// Setup meta box
|
||||||
$cmb = new_cmb2_box( $box_options );
|
$cmb = new_cmb2_box( $box_options );
|
||||||
|
|
||||||
// Setting tabs
|
// Setting tabs
|
||||||
$tabs_setting = array(
|
$tabs_setting = [
|
||||||
'config' => $box_options,
|
'config' => $box_options,
|
||||||
'layout' => 'vertical', // Default : horizontal
|
'layout' => 'vertical', // Default : horizontal
|
||||||
'tabs' => array()
|
'tabs' => [],
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
$tabs_setting['tabs'][] = array(
|
$tabs_setting['tabs'][] = [
|
||||||
'id' => 'p-general',
|
'id' => 'p-general',
|
||||||
'icon' => 'dashicons-admin-home',
|
'icon' => 'dashicons-admin-home',
|
||||||
'title' => esc_html__( 'General', 'opalestate-pro' ),
|
'title' => esc_html__( 'General', 'opalestate-pro' ),
|
||||||
'fields' => $fields
|
'fields' => $fields,
|
||||||
);
|
];
|
||||||
|
|
||||||
$tabs_setting['tabs'][] = array(
|
$tabs_setting['tabs'][] = [
|
||||||
'id' => 'p-socials',
|
'id' => 'p-socials',
|
||||||
'icon' => 'dashicons-share',
|
'icon' => 'dashicons-share',
|
||||||
'title' => esc_html__( 'Socials', 'opalestate-pro' ),
|
'title' => esc_html__( 'Socials', 'opalestate-pro' ),
|
||||||
'fields' => $metabox->get_social_fields( $prefix )
|
'fields' => $metabox->get_social_fields( $prefix ),
|
||||||
);
|
];
|
||||||
|
|
||||||
|
|
||||||
$tabs_setting['tabs'][] = array(
|
$tabs_setting['tabs'][] = [
|
||||||
'id' => 'p-target',
|
'id' => 'p-target',
|
||||||
'icon' => 'dashicons-admin-tools',
|
'icon' => 'dashicons-admin-tools',
|
||||||
'title' => esc_html__( 'Team', 'opalestate-pro' ),
|
'title' => esc_html__( 'Team', 'opalestate-pro' ),
|
||||||
'fields' => $metabox->metaboxes_target()
|
'fields' => $metabox->metaboxes_target(),
|
||||||
);
|
];
|
||||||
// Set tabs
|
// Set tabs
|
||||||
$cmb->add_field( array(
|
$cmb->add_field( [
|
||||||
'id' => '__tabs',
|
'id' => '__tabs',
|
||||||
'type' => 'tabs',
|
'type' => 'tabs',
|
||||||
'tabs' => $tabs_setting
|
'tabs' => $tabs_setting,
|
||||||
) );
|
] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new Opalestate_Admin_Agency();
|
new Opalestate_Admin_Agency();
|
||||||
|
@ -22,10 +22,8 @@ class Opalestate_Admin_Agent {
|
|||||||
* Auto update meta information to post from user data updated or created
|
* Auto update meta information to post from user data updated or created
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
add_action( 'cmb2_admin_init', [ $this, 'metaboxes' ] );
|
add_action( 'cmb2_admin_init', [ $this, 'metaboxes' ] );
|
||||||
add_action( 'save_post', [ $this, 'save_post' ], 10, 3 );
|
add_action( 'save_post', [ $this, 'save_post' ], 10, 3 );
|
||||||
|
|
||||||
add_action( 'user_register', [ $this, 'on_update_user' ], 10, 1 );
|
add_action( 'user_register', [ $this, 'on_update_user' ], 10, 1 );
|
||||||
add_action( 'profile_update', [ $this, 'on_update_user' ], 10, 1 );
|
add_action( 'profile_update', [ $this, 'on_update_user' ], 10, 1 );
|
||||||
}
|
}
|
||||||
@ -37,6 +35,8 @@ class Opalestate_Admin_Agent {
|
|||||||
if ( isset( $_POST['user_id'] ) && (int) $_POST['user_id'] && isset( $_POST['role'] ) ) {
|
if ( isset( $_POST['user_id'] ) && (int) $_POST['user_id'] && isset( $_POST['role'] ) ) {
|
||||||
if ( $_POST['role'] == 'opalestate_agent' ) {
|
if ( $_POST['role'] == 'opalestate_agent' ) {
|
||||||
$user_id = absint( $_POST['user_id'] );
|
$user_id = absint( $_POST['user_id'] );
|
||||||
|
static::update_user_metas( $user_id );
|
||||||
|
|
||||||
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
$post = get_post( $related_id );
|
$post = get_post( $related_id );
|
||||||
|
|
||||||
@ -47,6 +47,38 @@ class Opalestate_Admin_Agent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function save_post( $post_id, $post, $update ) {
|
||||||
|
$post_type = get_post_type( $post_id );
|
||||||
|
if ( $post_type == 'opalestate_agent' ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) && absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) ) {
|
||||||
|
$user_id = absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] );
|
||||||
|
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', $post_id );
|
||||||
|
|
||||||
|
OpalEstate_Agent::update_user_data( $user_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update some user metas.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_user_metas( $user_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] ) ) {
|
||||||
|
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . $term, $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -103,19 +135,6 @@ class Opalestate_Admin_Agent {
|
|||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save_post( $post_id, $post, $update ) {
|
|
||||||
$post_type = get_post_type( $post_id );
|
|
||||||
if ( $post_type == 'opalestate_agent' ) {
|
|
||||||
if ( isset( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) && absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] ) ) {
|
|
||||||
$user_id = absint( $_POST[ OPALESTATE_AGENT_PREFIX . 'user_id' ] );
|
|
||||||
update_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', $post_id );
|
|
||||||
|
|
||||||
OpalEstate_Agent::update_user_data( $user_id );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new Opalestate_Admin_Agent();
|
new Opalestate_Admin_Agent();
|
||||||
|
@ -19,7 +19,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
|||||||
'opalestate_settings_property_subtabs_nav',
|
'opalestate_settings_property_subtabs_nav',
|
||||||
[
|
[
|
||||||
'property_general' => esc_html__( 'General', 'opalestate-pro' ),
|
'property_general' => esc_html__( 'General', 'opalestate-pro' ),
|
||||||
'property_search' => esc_html__( 'Search Page', 'opalestate-pro' ),
|
'property_search' => esc_html__( 'Search', 'opalestate-pro' ),
|
||||||
'property_detail' => esc_html__( 'Single Page', 'opalestate-pro' ),
|
'property_detail' => esc_html__( 'Single Page', 'opalestate-pro' ),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@ -261,43 +261,75 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// $fields[] = [
|
$fields[] = [
|
||||||
// 'name' => esc_html__( 'Vertical Search Fields', 'opalestate-pro' ),
|
'name' => esc_html__( 'Setting type fields search', 'opalestate-pro' ),
|
||||||
// 'type' => 'opalestate_title',
|
'desc' => esc_html__( 'Setting type fields search', 'opalestate-pro' ) . '<hr>',
|
||||||
// 'id' => 'opalestate_title_general_settings_2',
|
'type' => 'opalestate_title',
|
||||||
// 'before_row' => '<hr>',
|
'id' => 'opalestate_title_general_settings_type_search',
|
||||||
// 'after_row' => '<hr>',
|
'before_row' => '<hr>',
|
||||||
// ];
|
'after_row' => '<hr>',
|
||||||
//
|
];
|
||||||
// $fields[] = [
|
|
||||||
// 'name' => esc_html__( 'Show Price', 'opalestate-pro' ),
|
$metas = Opalestate_Property_MetaBox::metaboxes_info_fields();
|
||||||
// 'id' => OPALESTATE_PROPERTY_PREFIX . 'price_opt_v',
|
|
||||||
// 'type' => 'switch',
|
wp_enqueue_script( 'opalestate-setting-custom-fields', OPALESTATE_PLUGIN_URL . 'assets/js/custom-fields.js', [ 'jquery' ], OPALESTATE_VERSION, false );
|
||||||
// 'options' => [
|
|
||||||
// 0 => esc_html__( 'Disable', 'opalestate-pro' ),
|
foreach ( $metas as $meta ) {
|
||||||
// 1 => esc_html__( 'Enable', 'opalestate-pro' ),
|
if ( $meta['id'] == OPALESTATE_PROPERTY_PREFIX . 'areasize' ) {
|
||||||
// ],
|
continue;
|
||||||
// ];
|
}
|
||||||
//
|
|
||||||
// foreach ( $metas as $key => $meta ) {
|
$fields[] = [
|
||||||
// $fields[] = [
|
'name' => esc_html__( 'Search type ', 'opalestate-pro' ) . $meta['name'],
|
||||||
// 'name' => $meta['name'],
|
'options' => [
|
||||||
// 'id' => $meta['id'] . '_opt_v',
|
'select' => esc_html__( 'Select', 'opalestate-pro' ),
|
||||||
// 'type' => 'switch',
|
'range' => esc_html__( 'Range', 'opalestate-pro' ),
|
||||||
// 'options' => [
|
'text' => esc_html__( 'Text', 'opalestate-pro' ),
|
||||||
// 0 => esc_html__( 'Disable', 'opalestate-pro' ),
|
],
|
||||||
// 1 => esc_html__( 'Enable', 'opalestate-pro' ),
|
'id' => $meta['id'] . '_search_type',
|
||||||
// ],
|
'type' => 'radio_inline',
|
||||||
//
|
'default' => 'select',
|
||||||
// ];
|
];
|
||||||
// }
|
|
||||||
|
$fields[] = [
|
||||||
|
'name' => esc_html__( 'Options select ', 'opalestate-pro' ) . $meta['name'],
|
||||||
|
'description' => esc_html__( 'Options value select. Use "," to separate values.', 'opalestate-pro' ),
|
||||||
|
'id' => $meta['id'] . '_options_value',
|
||||||
|
'type' => 'text',
|
||||||
|
'default' => '1,2,3,4,5,6,7,8,9,10',
|
||||||
|
];
|
||||||
|
|
||||||
|
$fields[] = [
|
||||||
|
'name' => esc_html__( 'Min range ', 'opalestate-pro' ) . $meta['name'],
|
||||||
|
'description' => esc_html__( 'Min range', 'opalestate-pro' ),
|
||||||
|
'id' => $meta['id'] . '_min_range',
|
||||||
|
'type' => 'text',
|
||||||
|
'default' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
$fields[] = [
|
||||||
|
'name' => esc_html__( 'Max range ', 'opalestate-pro' ) . $meta['name'],
|
||||||
|
'description' => esc_html__( 'Max range', 'opalestate-pro' ),
|
||||||
|
'id' => $meta['id'] . '_max_range',
|
||||||
|
'type' => 'text',
|
||||||
|
'default' => 10000000,
|
||||||
|
];
|
||||||
|
|
||||||
|
$fields[] = [
|
||||||
|
'name' => esc_html__( 'Default text ', 'opalestate-pro' ) . $meta['name'],
|
||||||
|
'description' => esc_html__( 'Default text value', 'opalestate-pro' ),
|
||||||
|
'id' => $meta['id'] . '_default_text',
|
||||||
|
'type' => 'text',
|
||||||
|
'default' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get subtab detail fields.
|
||||||
*/
|
*/
|
||||||
private function get_subtab_detail_fields() {
|
private function get_subtab_detail_fields() {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
|
@ -330,7 +330,7 @@ class OpalEstate_Agency {
|
|||||||
/**
|
/**
|
||||||
* Update user data.
|
* Update user data.
|
||||||
*
|
*
|
||||||
* @param $user_id User ID.
|
* @param int $user_id User ID.
|
||||||
*/
|
*/
|
||||||
public static function update_user_data( $user_id ) {
|
public static function update_user_data( $user_id ) {
|
||||||
$fields = self::metaboxes_fields();
|
$fields = self::metaboxes_fields();
|
||||||
@ -349,7 +349,9 @@ class OpalEstate_Agency {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update for others
|
static::update_user_object_terms( $user_id );
|
||||||
|
|
||||||
|
// Update for others
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
$kpos = OPALESTATE_AGENCY_PREFIX . $key;
|
$kpos = OPALESTATE_AGENCY_PREFIX . $key;
|
||||||
if ( isset( $_POST[ $kpos ] ) ) {
|
if ( isset( $_POST[ $kpos ] ) ) {
|
||||||
@ -362,7 +364,7 @@ class OpalEstate_Agency {
|
|||||||
/**
|
/**
|
||||||
* Update data from user.
|
* Update data from user.
|
||||||
*
|
*
|
||||||
* @param $related_id Post ID
|
* @param int $related_id Post ID
|
||||||
*/
|
*/
|
||||||
public static function update_data_from_user( $related_id ) {
|
public static function update_data_from_user( $related_id ) {
|
||||||
$fields = self::metaboxes_fields();
|
$fields = self::metaboxes_fields();
|
||||||
@ -382,7 +384,9 @@ class OpalEstate_Agency {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update for others
|
static::update_post_object_terms( $related_id );
|
||||||
|
|
||||||
|
// Update for others.
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $key;
|
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $key;
|
||||||
if ( isset( $_POST[ $kpos ] ) ) {
|
if ( isset( $_POST[ $kpos ] ) ) {
|
||||||
@ -391,4 +395,42 @@ class OpalEstate_Agency {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object terms.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_user_object_terms( $user_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_AGENCY_PREFIX . $term ] ) ) {
|
||||||
|
wp_set_object_terms( $user_id, $_POST[ OPALESTATE_AGENCY_PREFIX . $term ], 'opalestate_' . $term );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object terms.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_post_object_terms( $related_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] ) ) {
|
||||||
|
wp_set_object_terms( $related_id, $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ], 'opalestate_' . $term );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ class Opalestate_Agent_Front {
|
|||||||
* Auto update meta information to post from user data updated or created
|
* Auto update meta information to post from user data updated or created
|
||||||
*/
|
*/
|
||||||
public function init() {
|
public function init() {
|
||||||
|
|
||||||
add_action( 'opalestate_on_set_role_agent', [ $this, 'on_set_role' ], 1, 9 );
|
add_action( 'opalestate_on_set_role_agent', [ $this, 'on_set_role' ], 1, 9 );
|
||||||
add_filter( 'opalestate_before_render_profile_agent_form', [ $this, 'render_front_form' ], 2, 2 );
|
add_filter( 'opalestate_before_render_profile_agent_form', [ $this, 'render_front_form' ], 2, 2 );
|
||||||
add_filter( 'pre_get_posts', [ $this, 'archives_query' ], 1 );
|
add_filter( 'pre_get_posts', [ $this, 'archives_query' ], 1 );
|
||||||
@ -66,7 +65,10 @@ class Opalestate_Agent_Front {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* render_extra_profile_link.
|
* Render extra profile link.
|
||||||
|
*
|
||||||
|
* @param $menu
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function render_extra_profile_link( $menu ) {
|
public function render_extra_profile_link( $menu ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
@ -133,12 +135,14 @@ class Opalestate_Agent_Front {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process upload files.
|
||||||
|
*
|
||||||
|
* @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( 'avatar_id' ),
|
$this->get_field_name( 'avatar_id' ),
|
||||||
@ -146,11 +150,11 @@ class Opalestate_Agent_Front {
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ( $_FILES as $key => $value ) {
|
foreach ( $_FILES as $key => $value ) {
|
||||||
// allow processing in fixed collection
|
// Allow processing in fixed collection.
|
||||||
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 = [];
|
||||||
|
|
||||||
@ -180,16 +184,20 @@ class Opalestate_Agent_Front {
|
|||||||
$_key = str_replace( "_id", "", $key );
|
$_key = str_replace( "_id", "", $key );
|
||||||
$_POST[ $_key ] = $new_atm['url'];
|
$_POST[ $_key ] = $new_atm['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
|
$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On save front data.
|
||||||
|
*
|
||||||
|
* @return false|mixed|string|void
|
||||||
|
*/
|
||||||
public function on_save_front_data() {
|
public function on_save_front_data() {
|
||||||
if ( isset( $_POST[ 'nonce_CMB2php' . OPALESTATE_AGENT_PREFIX . 'front' ] ) ) {
|
if ( isset( $_POST[ 'nonce_CMB2php' . OPALESTATE_AGENT_PREFIX . 'front' ] ) ) {
|
||||||
$post_id = $this->update_data_agent_or_agency( OPALESTATE_AGENT_PREFIX );
|
$post_id = $this->update_data_agent_or_agency( OPALESTATE_AGENT_PREFIX );
|
||||||
@ -217,14 +225,14 @@ class Opalestate_Agent_Front {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get field name.
|
||||||
*/
|
*/
|
||||||
private function get_field_name( $field ) {
|
private function get_field_name( $field ) {
|
||||||
return OPALESTATE_AGENT_PREFIX . $field;
|
return OPALESTATE_AGENT_PREFIX . $field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Update data for agent or agency.
|
||||||
*/
|
*/
|
||||||
private function update_data_agent_or_agency( $prefix ) {
|
private function update_data_agent_or_agency( $prefix ) {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
@ -270,7 +278,7 @@ class Opalestate_Agent_Front {
|
|||||||
/*
|
/*
|
||||||
* Processing upload files
|
* Processing upload files
|
||||||
*/
|
*/
|
||||||
$this->process_upload_files( $post_id, $_POST );
|
$this->process_upload_files( $post_id );
|
||||||
|
|
||||||
cmb2_get_metabox_form( $metaboxes[ $prefix . 'front' ], $post_id );
|
cmb2_get_metabox_form( $metaboxes[ $prefix . 'front' ], $post_id );
|
||||||
$cmb = cmb2_get_metabox( $prefix . 'front', $post_id );
|
$cmb = cmb2_get_metabox( $prefix . 'front', $post_id );
|
||||||
@ -333,22 +341,21 @@ class Opalestate_Agent_Front {
|
|||||||
return opalestate_load_template_path( 'shortcodes/agent-carousel', $atts );
|
return opalestate_load_template_path( 'shortcodes/agent-carousel', $atts );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive query.
|
||||||
|
*
|
||||||
|
* @param $query
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function archives_query( $query ) {
|
public function archives_query( $query ) {
|
||||||
if ( $query->is_main_query() && is_post_type_archive( 'opalestate_agent' ) ) {
|
if ( $query->is_main_query() && is_post_type_archive( 'opalestate_agent' ) ) {
|
||||||
$args = [];
|
$args = [];
|
||||||
|
|
||||||
$min = opalestate_options( 'search_agent_min_price', 0 );
|
$min = opalestate_options( 'search_agent_min_price', 0 );
|
||||||
$max = opalestate_options( 'search_agent_max_price', 10000000 );
|
$max = opalestate_options( 'search_agent_max_price', 10000000 );
|
||||||
|
|
||||||
|
|
||||||
$search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ) : '';
|
$search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ) : '';
|
||||||
$search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ) : '';
|
$search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ) : '';
|
||||||
|
|
||||||
$search_min_area = isset( $_GET['min_area'] ) ? sanitize_text_field( $_GET['min_area'] ) : '';
|
|
||||||
$search_max_area = isset( $_GET['max_area'] ) ? sanitize_text_field( $_GET['max_area'] ) : '';
|
|
||||||
$s = isset( $_GET['search_text'] ) ? sanitize_text_field( $_GET['search_text'] ) : null;
|
|
||||||
|
|
||||||
|
|
||||||
$paged = ( get_query_var( 'paged' ) == 0 ) ? 1 : get_query_var( 'paged' );
|
$paged = ( get_query_var( 'paged' ) == 0 ) ? 1 : get_query_var( 'paged' );
|
||||||
$default = [
|
$default = [
|
||||||
'post_type' => 'opalestate_agent',
|
'post_type' => 'opalestate_agent',
|
||||||
@ -436,9 +443,10 @@ class Opalestate_Agent_Front {
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Search agents.
|
||||||
*
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function search_agents() {
|
public function search_agents() {
|
||||||
return opalestate_load_template_path( 'shortcodes/search-agents' );
|
return opalestate_load_template_path( 'shortcodes/search-agents' );
|
||||||
@ -470,6 +478,13 @@ class Opalestate_Agent_Front {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create agent.
|
||||||
|
*
|
||||||
|
* @param array $args
|
||||||
|
* @param $user_id
|
||||||
|
* @return int|\WP_Error
|
||||||
|
*/
|
||||||
public function create_agent( $args = [], $user_id ) {
|
public function create_agent( $args = [], $user_id ) {
|
||||||
$data = get_user_by( 'id', $user_id );
|
$data = get_user_by( 'id', $user_id );
|
||||||
|
|
||||||
@ -515,7 +530,11 @@ class Opalestate_Agent_Front {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Render front form.
|
||||||
*
|
*
|
||||||
|
* @param $metaboxes
|
||||||
|
* @param int $post_id
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function render_front_form( $metaboxes, $post_id = 0 ) {
|
public function render_front_form( $metaboxes, $post_id = 0 ) {
|
||||||
$metabox = new Opalestate_Agent_MetaBox();
|
$metabox = new Opalestate_Agent_MetaBox();
|
||||||
|
@ -179,7 +179,7 @@ class OpalEstate_Agent {
|
|||||||
/**
|
/**
|
||||||
* Update user data.
|
* Update user data.
|
||||||
*
|
*
|
||||||
* @param $user_id User ID.
|
* @param int $user_id User ID.
|
||||||
*/
|
*/
|
||||||
public static function update_user_data( $user_id ) {
|
public static function update_user_data( $user_id ) {
|
||||||
$fields = self::metaboxes_fields();
|
$fields = self::metaboxes_fields();
|
||||||
@ -199,6 +199,8 @@ class OpalEstate_Agent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static::update_user_object_terms( $user_id );
|
||||||
|
|
||||||
// update for others
|
// update for others
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
$kpos = OPALESTATE_AGENT_PREFIX . $key;
|
$kpos = OPALESTATE_AGENT_PREFIX . $key;
|
||||||
@ -212,7 +214,7 @@ class OpalEstate_Agent {
|
|||||||
/**
|
/**
|
||||||
* Update data from user.
|
* Update data from user.
|
||||||
*
|
*
|
||||||
* @param $related_id Post ID.
|
* @param int $related_id Post ID.
|
||||||
*/
|
*/
|
||||||
public static function update_data_from_user( $related_id ) {
|
public static function update_data_from_user( $related_id ) {
|
||||||
$fields = self::metaboxes_fields();
|
$fields = self::metaboxes_fields();
|
||||||
@ -232,6 +234,8 @@ class OpalEstate_Agent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static::update_post_object_terms( $related_id );
|
||||||
|
|
||||||
// update for others
|
// update for others
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $key;
|
$kpos = OPALESTATE_USER_PROFILE_PREFIX . $key;
|
||||||
@ -240,6 +244,46 @@ class OpalEstate_Agent {
|
|||||||
update_post_meta( $related_id, OPALESTATE_AGENT_PREFIX . $key, $data );
|
update_post_meta( $related_id, OPALESTATE_AGENT_PREFIX . $key, $data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_action( 'opalestate_update_agent_data_from_user', $related_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object terms.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_post_object_terms( $related_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ] ) ) {
|
||||||
|
wp_set_object_terms( $related_id, $_POST[ OPALESTATE_USER_PROFILE_PREFIX . $term ], 'opalestate_' . $term );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object terms.
|
||||||
|
*
|
||||||
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public static function update_user_object_terms( $user_id ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $_POST[ OPALESTATE_AGENT_PREFIX . $term ] ) ) {
|
||||||
|
wp_set_object_terms( $user_id, $_POST[ OPALESTATE_AGENT_PREFIX . $term ], 'opalestate_' . $term );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -400,4 +400,23 @@ function opalestate_update_api_key() {
|
|||||||
// wp_send_json_success must be outside the try block not to break phpunit tests.
|
// wp_send_json_success must be outside the try block not to break phpunit tests.
|
||||||
wp_send_json_success( $response );
|
wp_send_json_success( $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'wp_ajax_opalestate_update_api_key', 'opalestate_update_api_key' );
|
add_action( 'wp_ajax_opalestate_update_api_key', 'opalestate_update_api_key' );
|
||||||
|
|
||||||
|
function opalestate_ajax_setting_custom_fields() {
|
||||||
|
$metas = Opalestate_Property_MetaBox::metaboxes_info_fields();
|
||||||
|
|
||||||
|
$metabox_key = [];
|
||||||
|
|
||||||
|
if ( $metas ) {
|
||||||
|
foreach ( $metas as $meta_item ) {
|
||||||
|
$metabox_key[] = $meta_item['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode( [ 'data' => $metabox_key ] );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'wp_ajax_opalestate_setting_custom_fields', 'opalestate_ajax_setting_custom_fields' );
|
||||||
|
add_action( 'wp_ajax_nopriv_opalestate_setting_custom_fields', 'opalestate_ajax_setting_custom_fields' );
|
||||||
|
@ -39,6 +39,7 @@ class Opalestate_API {
|
|||||||
'v1/agency.php',
|
'v1/agency.php',
|
||||||
'v1/search-form.php',
|
'v1/search-form.php',
|
||||||
'v1/user.php',
|
'v1/user.php',
|
||||||
|
'v1/terms.php',
|
||||||
'functions.php',
|
'functions.php',
|
||||||
] );
|
] );
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ class Opalestate_API {
|
|||||||
'Opalestate_Agency_Api',
|
'Opalestate_Agency_Api',
|
||||||
'Opalestate_Search_Form_Api',
|
'Opalestate_Search_Form_Api',
|
||||||
'Opalestate_User_Api',
|
'Opalestate_User_Api',
|
||||||
|
'Opalestate_Terms_Api',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -96,6 +98,7 @@ class Opalestate_API {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function jwt_auth_token_before_dispatch( $data, $user ) {
|
public function jwt_auth_token_before_dispatch( $data, $user ) {
|
||||||
|
$data['user_id'] = $user->data->ID;
|
||||||
$data['user_role'] = $user->roles;
|
$data['user_role'] = $user->roles;
|
||||||
$data['avatar'] = opalestate_get_user_meta( $user->data->ID, 'avatar' );
|
$data['avatar'] = opalestate_get_user_meta( $user->data->ID, 'avatar' );
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ abstract class Opalestate_Base_API {
|
|||||||
$endpoint = explode( '/', $route );
|
$endpoint = explode( '/', $route );
|
||||||
$endpoint = end( $endpoint );
|
$endpoint = end( $endpoint );
|
||||||
|
|
||||||
if ( in_array( $endpoint, [ 'properties', 'agencies', 'agents' ] ) ) {
|
if ( in_array( $endpoint, [ 'properties', 'agencies', 'agents', 'search-form' ] ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ function opalestate_get_user_data_by_consumer_key( $consumer_key ) {
|
|||||||
* @param object $property_info The Download Post Object
|
* @param object $property_info The Download Post Object
|
||||||
*
|
*
|
||||||
* @return array Array of post data to return back in the API
|
* @return array Array of post data to return back in the API
|
||||||
* @since 1.0
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function opalestate_api_get_property_data( $property_info ) {
|
function opalestate_api_get_property_data( $property_info ) {
|
||||||
@ -154,7 +153,45 @@ function opalestate_api_get_property_data( $property_info ) {
|
|||||||
'values' => $array_values,
|
'values' => $array_values,
|
||||||
];
|
];
|
||||||
|
|
||||||
return apply_filters( 'opalestate_api_properties_property', $property );
|
return apply_filters( 'opalestate_api_get_property_data', $property );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The opalestate_property post object, generate the data for the API output
|
||||||
|
*
|
||||||
|
* @param object $property_info The Download Post Object
|
||||||
|
*
|
||||||
|
* @return array Array of post data to return back in the API
|
||||||
|
* @since 1.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function opalestate_api_parse_property_meta_key() {
|
||||||
|
$request = [
|
||||||
|
'name' => '',
|
||||||
|
'status' => '',
|
||||||
|
'content' => '',
|
||||||
|
'thumbnail' => '',
|
||||||
|
'gallery' => '',
|
||||||
|
'price' => '',
|
||||||
|
'saleprice' => '',
|
||||||
|
'before_price_label' => '',
|
||||||
|
'price_label' => '',
|
||||||
|
'featured' => '',
|
||||||
|
'map' => '',
|
||||||
|
'address' => '',
|
||||||
|
'video' => '',
|
||||||
|
'virtual_tour' => '',
|
||||||
|
'attachments' => '',
|
||||||
|
'floor_plans' => '',
|
||||||
|
'statuses' => '',
|
||||||
|
'labels' => '',
|
||||||
|
'locations' => '',
|
||||||
|
'facilities' => '',
|
||||||
|
'amenities' => '',
|
||||||
|
'types' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
return apply_filters( 'opalestate_api_parse_property_meta_key', $request );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,11 +47,11 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
'permission_callback' => [ $this, 'get_items_permissions_check' ],
|
'permission_callback' => [ $this, 'get_items_permissions_check' ],
|
||||||
'args' => $this->get_collection_params(),
|
'args' => $this->get_collection_params(),
|
||||||
],
|
],
|
||||||
[
|
// [
|
||||||
'methods' => WP_REST_Server::CREATABLE,
|
// 'methods' => WP_REST_Server::CREATABLE,
|
||||||
'callback' => [ $this, 'create_item' ],
|
// 'callback' => [ $this, 'create_item' ],
|
||||||
'permission_callback' => [ $this, 'create_item_permissions_check' ],
|
// 'permission_callback' => [ $this, 'create_item_permissions_check' ],
|
||||||
],
|
// ],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -70,11 +70,11 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
'callback' => [ $this, 'get_item' ],
|
'callback' => [ $this, 'get_item' ],
|
||||||
'permission_callback' => [ $this, 'get_item_permissions_check' ],
|
'permission_callback' => [ $this, 'get_item_permissions_check' ],
|
||||||
],
|
],
|
||||||
// [
|
[
|
||||||
// 'methods' => WP_REST_Server::EDITABLE,
|
'methods' => WP_REST_Server::EDITABLE,
|
||||||
// 'callback' => [ $this, 'update_item' ],
|
'callback' => [ $this, 'update_item' ],
|
||||||
// // 'permission_callback' => [ $this, 'update_item_permissions_check' ],
|
'permission_callback' => [ $this, 'update_item_permissions_check' ],
|
||||||
// ],
|
],
|
||||||
// [
|
// [
|
||||||
// 'methods' => WP_REST_Server::DELETABLE,
|
// 'methods' => WP_REST_Server::DELETABLE,
|
||||||
// 'callback' => [ $this, 'delete_item' ],
|
// 'callback' => [ $this, 'delete_item' ],
|
||||||
@ -153,11 +153,10 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Property
|
* Get a property
|
||||||
*
|
*
|
||||||
* Based on request to get a property.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
*
|
* @return WP_Error|WP_REST_Response
|
||||||
* @return WP_REST_Response is json data
|
|
||||||
*/
|
*/
|
||||||
public function get_item( $request ) {
|
public function get_item( $request ) {
|
||||||
$response = [];
|
$response = [];
|
||||||
@ -179,6 +178,32 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
|
|||||||
return $this->get_response( $code, $response );
|
return $this->get_response( $code, $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a property.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|WP_REST_Response
|
||||||
|
*/
|
||||||
|
public function update_item( $request ) {
|
||||||
|
$id = absint( $request['id'] );
|
||||||
|
|
||||||
|
$property = get_post( $id );
|
||||||
|
if ( ! $property || $this->post_type != $property->post_type ) {
|
||||||
|
$code = 404;
|
||||||
|
$response['error'] = sprintf( esc_html__( 'Property ID: %s does not exist!', 'opalestate-pro' ), $id );
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->get_response( $code, $response );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a property.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|WP_REST_Response
|
||||||
|
*/
|
||||||
public function delete_item( $request ) {
|
public function delete_item( $request ) {
|
||||||
$id = (int) $request['id'];
|
$id = (int) $request['id'];
|
||||||
$force = (bool) $request['force'];
|
$force = (bool) $request['force'];
|
||||||
|
82
inc/api/v1/terms.php
Normal file
82
inc/api/v1/terms.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opalestate_Terms_Api
|
||||||
|
*
|
||||||
|
* @package Opalestate_Terms_Api
|
||||||
|
*/
|
||||||
|
class Opalestate_Terms_Api extends Opalestate_Base_API {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique identifier of the route resource.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @var string $base .
|
||||||
|
*/
|
||||||
|
public $base = '/terms';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register Routes
|
||||||
|
*
|
||||||
|
* Register all CURD actions with POST/GET/PUT and calling function for each
|
||||||
|
*/
|
||||||
|
public function register_routes() {
|
||||||
|
/**
|
||||||
|
* Get list of terms.
|
||||||
|
*
|
||||||
|
* Call http://domain.com/wp-json/estate-api/v1/terms
|
||||||
|
*/
|
||||||
|
register_rest_route(
|
||||||
|
$this->namespace,
|
||||||
|
'/' . $this->base,
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'methods' => WP_REST_Server::READABLE,
|
||||||
|
'callback' => [ $this, 'get_items' ],
|
||||||
|
// 'permission_callback' => [ $this, 'get_items_permissions_check' ],
|
||||||
|
// 'args' => $this->get_collection_params(),
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get List Of Taxonomies
|
||||||
|
*
|
||||||
|
* Based on request to get collection
|
||||||
|
*
|
||||||
|
* @return WP_REST_Response is json data
|
||||||
|
*/
|
||||||
|
public function get_items( $request ) {
|
||||||
|
$opalestate_terms = [
|
||||||
|
'property_category',
|
||||||
|
'opalestate_amenities',
|
||||||
|
'opalestate_label',
|
||||||
|
'opalestate_status',
|
||||||
|
'opalestate_types',
|
||||||
|
'opalestate_location',
|
||||||
|
'opalestate_city',
|
||||||
|
'opalestate_state',
|
||||||
|
];
|
||||||
|
|
||||||
|
$all_terms = [];
|
||||||
|
foreach ( $opalestate_terms as $term_name ) {
|
||||||
|
$all_terms[ $term_name ] = get_terms( apply_filters( 'opalestate_all_terms_api_args', [
|
||||||
|
'taxonomy' => $term_name,
|
||||||
|
'hide_empty' => false,
|
||||||
|
] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $all_terms ) {
|
||||||
|
return $this->get_response( 404, [ 'collection' => [], 'message' => esc_html__( 'Not found!', 'opalestate-pro' ) ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$response['collection'] = $all_terms;
|
||||||
|
|
||||||
|
return $this->get_response( 200, $response );
|
||||||
|
}
|
||||||
|
}
|
@ -70,6 +70,24 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
register_rest_route(
|
||||||
|
$this->namespace,
|
||||||
|
'/' . $this->base . '/(?P<id>[\d]+)/favorites',
|
||||||
|
[
|
||||||
|
'args' => [
|
||||||
|
'id' => [
|
||||||
|
'description' => __( 'Unique identifier for the resource.', 'opalestate-pro' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'methods' => WP_REST_Server::READABLE,
|
||||||
|
'callback' => [ $this, 'get_favorites' ],
|
||||||
|
'permission_callback' => [ $this, 'get_item_permissions_check' ],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +172,7 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all customers.
|
* Get all users.
|
||||||
*
|
*
|
||||||
* @param WP_REST_Request $request Full details about the request.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
* @return WP_Error|WP_REST_Response
|
* @return WP_Error|WP_REST_Response
|
||||||
@ -249,6 +267,12 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update user data.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|WP_REST_Response
|
||||||
|
*/
|
||||||
public function update_item( $request ) {
|
public function update_item( $request ) {
|
||||||
try {
|
try {
|
||||||
$id = (int) $request['id'];
|
$id = (int) $request['id'];
|
||||||
@ -289,24 +313,49 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
/**
|
/**
|
||||||
* Update user data.
|
* Update user data.
|
||||||
*
|
*
|
||||||
* @param $request User ID.
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
*/
|
*/
|
||||||
public function update_agent_data( $request ) {
|
public function update_agent_data( $request ) {
|
||||||
$fields = OpalEstate_Agent::metaboxes_fields();
|
$fields = OpalEstate_Agent::metaboxes_fields();
|
||||||
|
|
||||||
$others = [
|
$others = [
|
||||||
'avatar_id' => '',
|
|
||||||
'opalestate_agt_map' => '',
|
'opalestate_agt_map' => '',
|
||||||
'map' => '',
|
'map' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ( $fields as $key => $field ) {
|
foreach ( $fields as $key => $field ) {
|
||||||
$tmp = str_replace( OPALESTATE_AGENT_PREFIX, '', $field['id'] );
|
$tmp = str_replace( OPALESTATE_AGENT_PREFIX, '', $field['id'] );
|
||||||
if ( isset( $request[ $tmp ] ) && $tmp ) {
|
|
||||||
|
if ( isset( $request[ $tmp ] ) && $request[ $tmp ] ) {
|
||||||
|
$related_id = get_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
$post = get_post( $related_id );
|
||||||
|
|
||||||
|
if ( 'avatar' === $tmp ) {
|
||||||
|
if ( is_array( $request[ $tmp ] ) ) {
|
||||||
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
|
$attach_id = opalestate_upload_base64_image( $request[ $tmp ], $related_id );
|
||||||
|
} else {
|
||||||
|
$attach_id = opalestate_upload_base64_image( $request[ $tmp ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$request[ $tmp ] = wp_get_attachment_image_url( $attach_id, 'full' );
|
||||||
|
$request[ $tmp . '_id' ] = $attach_id;
|
||||||
|
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp . '_id', $attach_id );
|
||||||
|
update_post_meta( $related_id, $field['id'] . '_id', $attach_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = is_string( $request[ $tmp ] ) ? sanitize_text_field( $request[ $tmp ] ) : $request[ $tmp ];
|
$data = is_string( $request[ $tmp ] ) ? sanitize_text_field( $request[ $tmp ] ) : $request[ $tmp ];
|
||||||
|
|
||||||
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp, $data );
|
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp, $data );
|
||||||
|
|
||||||
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
|
update_post_meta( $related_id, $field['id'], $data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->update_object_terms( $request['id'], $request );
|
||||||
|
|
||||||
// Update for others.
|
// Update for others.
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
@ -318,26 +367,76 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update user data.
|
* Update object terms.
|
||||||
*
|
*
|
||||||
* @param $request User ID.
|
* @param int $related_id Post ID.
|
||||||
|
*/
|
||||||
|
public function update_object_terms( $user_id, $request ) {
|
||||||
|
$terms = [
|
||||||
|
'location',
|
||||||
|
'state',
|
||||||
|
'city',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
if ( isset( $request[ $term ] ) ) {
|
||||||
|
wp_set_object_terms( $user_id, $request[ $term ], 'opalestate_' . $term );
|
||||||
|
|
||||||
|
$related_id = get_user_meta( $user_id, OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
$post = get_post( $related_id );
|
||||||
|
|
||||||
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
|
wp_set_object_terms( $related_id, $request[ $term ], 'opalestate_' . $term );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update agency data.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
*/
|
*/
|
||||||
public function update_agency_data( $request ) {
|
public function update_agency_data( $request ) {
|
||||||
$fields = OpalEstate_Agency::metaboxes_fields();
|
$fields = OpalEstate_Agency::metaboxes_fields();
|
||||||
|
|
||||||
$others = [
|
$others = [
|
||||||
'avatar_id' => '',
|
|
||||||
'map' => '',
|
'map' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ( $fields as $key => $field ) {
|
foreach ( $fields as $key => $field ) {
|
||||||
$kpos = $field['id'];
|
|
||||||
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, '', $field['id'] );
|
$tmp = str_replace( OPALESTATE_AGENCY_PREFIX, '', $field['id'] );
|
||||||
if ( isset( $request[ $kpos ] ) && $tmp ) {
|
|
||||||
$data = is_string( $request[ $kpos ] ) ? sanitize_text_field( $request[ $kpos ] ) : $request[ $kpos ];
|
if ( isset( $request[ $tmp ] ) && $request[ $tmp ] ) {
|
||||||
|
$related_id = get_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . 'related_id', true );
|
||||||
|
$post = get_post( $related_id );
|
||||||
|
|
||||||
|
if ( 'avatar' === $tmp ) {
|
||||||
|
if ( is_array( $request[ $tmp ] ) ) {
|
||||||
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
|
$attach_id = opalestate_upload_base64_image( $request[ $tmp ], $related_id );
|
||||||
|
} else {
|
||||||
|
$attach_id = opalestate_upload_base64_image( $request[ $tmp ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$request[ $tmp ] = wp_get_attachment_image_url( $attach_id, 'full' );
|
||||||
|
$request[ $tmp . '_id' ] = $attach_id;
|
||||||
|
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp . '_id', $attach_id );
|
||||||
|
update_post_meta( $related_id, $field['id'] . '_id', $attach_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = is_string( $request[ $tmp ] ) ? sanitize_text_field( $request[ $tmp ] ) : $request[ $tmp ];
|
||||||
|
|
||||||
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp, $data );
|
update_user_meta( $request['id'], OPALESTATE_USER_PROFILE_PREFIX . $tmp, $data );
|
||||||
|
|
||||||
|
if ( isset( $post->ID ) && $post->ID ) {
|
||||||
|
update_post_meta( $related_id, $field['id'], $data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->update_object_terms( $request['id'], $request );
|
||||||
|
|
||||||
// Update for others.
|
// Update for others.
|
||||||
foreach ( $others as $key => $value ) {
|
foreach ( $others as $key => $value ) {
|
||||||
@ -538,6 +637,46 @@ class Opalestate_User_Api extends Opalestate_Base_API {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show all favorited properties with pagination.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|WP_REST_Response
|
||||||
|
*/
|
||||||
|
public function get_favorites( $request ) {
|
||||||
|
$id = (int) $request['id'];
|
||||||
|
$user_data = get_userdata( $id );
|
||||||
|
|
||||||
|
if ( empty( $id ) || empty( $user_data->ID ) ) {
|
||||||
|
return new WP_Error( 'opalestate_rest_invalid_id', __( 'Invalid resource ID.', 'opalestate-pro' ), [ 'status' => 404 ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$per_page = isset( $request['per_page'] ) && $request['per_page'] ? $request['per_page'] : 5;
|
||||||
|
$paged = isset( $request['page'] ) && $request['page'] ? $request['page'] : 1;
|
||||||
|
$items = (array) get_user_meta( $request['id'], 'opalestate_user_favorite', true );
|
||||||
|
|
||||||
|
$property_list = get_posts( [
|
||||||
|
'post_type' => 'opalestate_property',
|
||||||
|
'posts_per_page' => $per_page,
|
||||||
|
'paged' => $paged,
|
||||||
|
'post__in' => ! empty( $items ) ? $items : [ 9999999 ],
|
||||||
|
] );
|
||||||
|
|
||||||
|
if ( $property_list ) {
|
||||||
|
$i = 0;
|
||||||
|
foreach ( $property_list as $property_info ) {
|
||||||
|
$properties[ $i ] = $this->get_property_data( $property_info );
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return $this->get_response( 404, [ 'collection' => [], 'message' => esc_html__( 'Not found!', 'opalestate-pro' ) ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$response['collection'] = $properties;
|
||||||
|
|
||||||
|
return $this->get_response( 200, $response );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the query params for collections.
|
* Get the query params for collections.
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
*/
|
*/
|
||||||
function opalestate_property_render_field_template( $field, $label, $type = 'select' ) {
|
function opalestate_property_render_field_template( $field, $label, $type = 'select' ) {
|
||||||
$qvalue = isset( $_GET['info'][ $field ] ) ? sanitize_text_field( $_GET['info'][ $field ] ) : '';
|
$qvalue = isset( $_GET['info'][ $field ] ) ? sanitize_text_field( $_GET['info'][ $field ] ) : '';
|
||||||
$template = '';
|
|
||||||
$template = apply_filters( 'opalestate_property_render_search_field_template', $field, $label );
|
$template = apply_filters( 'opalestate_property_render_search_field_template', $field, $label );
|
||||||
$template = apply_filters( 'opalestate_property_' . $field . '_field_template', $template );
|
$template = apply_filters( 'opalestate_property_' . $field . '_field_template', $template );
|
||||||
|
|
||||||
@ -39,10 +38,60 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
|
|||||||
<span class="btn-plus"><i class="fa fa-plus"></i></span>
|
<span class="btn-plus"><i class="fa fa-plus"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
<?php break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
$setting_search_type = 'opalestate_ppt_' . $field . '_search_type';
|
||||||
|
$setting_search_type_options = 'opalestate_ppt_' . $field . '_options_value';
|
||||||
|
$setting_search_min_range = 'opalestate_ppt_' . $field . '_min_range';
|
||||||
|
$setting_search_max_range = 'opalestate_ppt_' . $field . '_max_range';
|
||||||
|
$setting_search_default_text = 'opalestate_ppt_' . $field . '_default_text';
|
||||||
|
|
||||||
|
$display_type_search = opalestate_options( $setting_search_type, 'select' );
|
||||||
|
|
||||||
|
if ( $display_type_search == 'select' ) {
|
||||||
|
|
||||||
|
$option_values = (array) explode( ',', opalestate_options( $setting_search_type_options, '1,2,3,4,5,6,7,8,9,10' ) );
|
||||||
|
$template = '<select class="form-control" name="info[%s]"><option value="">%s</option>';
|
||||||
|
|
||||||
|
foreach ( $option_values as $value ) {
|
||||||
|
$selected = $value == $qvalue ? 'selected="selected"' : '';
|
||||||
|
$template .= '<option ' . $selected . ' value="' . $value . '">' . $value . '</option>';
|
||||||
|
}
|
||||||
|
$template .= '</select>';
|
||||||
|
$template = sprintf( $template, $field, $label );
|
||||||
|
|
||||||
|
} elseif ( $display_type_search == 'text' ) {
|
||||||
|
$option_values = opalestate_options( $setting_search_default_text, '' );
|
||||||
|
$qvalue = $qvalue ? $qvalue : $option_values;
|
||||||
|
|
||||||
|
$template = '<input class="form-control" type="text" name="info[%s]" value="%s"/>';
|
||||||
|
|
||||||
|
$template = sprintf( $template, $field, $qvalue );
|
||||||
|
} elseif ( $display_type_search == 'range' ) {
|
||||||
|
$min_name = 'min_' . $field;
|
||||||
|
$max_name = 'max_' . $field;
|
||||||
|
|
||||||
|
$search_min = (int) isset( $_GET[ $min_name ] ) ? $_GET[ $min_name ] : opalestate_options( $setting_search_min_range, 0 );
|
||||||
|
$search_max = (int) isset( $_GET[ $max_name ] ) ? $_GET[ $max_name ] : opalestate_options( $setting_search_max_range, 1000 );
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'id' => $field,
|
||||||
|
'unit' => '',
|
||||||
|
'ranger_min' => opalestate_options( $setting_search_min_range, 0 ),
|
||||||
|
'ranger_max' => opalestate_options( $setting_search_max_range, 1000 ),
|
||||||
|
'input_min' => $search_min,
|
||||||
|
'input_max' => $search_max,
|
||||||
|
];
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
opalesate_property_slide_ranger_template( __( $label . ": ", 'opalestate-pro' ), $data );
|
||||||
|
$template = ob_get_contents();
|
||||||
|
|
||||||
|
ob_end_clean();
|
||||||
|
} else {
|
||||||
$template = '<label class="opalestate-label opalestate-label--' . sanitize_html_class( $label ) . '">' . esc_html( $label ) . '</label>';
|
$template = '<label class="opalestate-label opalestate-label--' . sanitize_html_class( $label ) . '">' . esc_html( $label ) . '</label>';
|
||||||
|
|
||||||
$template .= '<select class="form-control" name="info[%s]"><option value="">%s</option>';
|
$template .= '<select class="form-control" name="info[%s]"><option value="">%s</option>';
|
||||||
@ -51,8 +100,10 @@ function opalestate_property_render_field_template( $field, $label, $type = 'sel
|
|||||||
|
|
||||||
$template .= '<option ' . $selected . ' value="' . $i . '">' . $i . '</option>';
|
$template .= '<option ' . $selected . ' value="' . $i . '">' . $i . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$template .= '</select>';
|
$template .= '</select>';
|
||||||
$template = sprintf( $template, $field, $label );
|
$template = sprintf( $template, $field, $label );
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -40,15 +40,13 @@ 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 ) {
|
||||||
|
|
||||||
// do_action( 'opalestate_before_process_ajax_upload_file' );
|
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
$uploaded_image = wp_handle_upload( $submitted_file,
|
// Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type, and moving the
|
||||||
[ 'test_form' => false ] ); //Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type, and moving the file to the appropriate directory within the uploads directory.
|
// file to the appropriate directory within the uploads directory.
|
||||||
|
$uploaded_image = wp_handle_upload( $submitted_file, [ 'test_form' => false ] );
|
||||||
|
|
||||||
if ( isset( $uploaded_image['file'] ) ) {
|
if ( isset( $uploaded_image['file'] ) ) {
|
||||||
$file_name = basename( $submitted_file['name'] );
|
$file_name = basename( $submitted_file['name'] );
|
||||||
@ -63,10 +61,15 @@ function opalesate_upload_image( $submitted_file, $parent_id = 0 ) {
|
|||||||
'post_status' => 'inherit',
|
'post_status' => 'inherit',
|
||||||
];
|
];
|
||||||
|
|
||||||
$attach_id = wp_insert_attachment( $attachment_details, $uploaded_image['file'], $parent_id ); // This function inserts an attachment into the media library
|
// This function inserts an attachment into the media library.
|
||||||
$attach_data = wp_generate_attachment_metadata( $attach_id,
|
$attach_id = wp_insert_attachment( $attachment_details, $uploaded_image['file'], $parent_id );
|
||||||
$uploaded_image['file'] ); // This function generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined
|
|
||||||
wp_update_attachment_metadata( $attach_id, $attach_data ); // Update metadata for an attachment.
|
// This function generates metadata for an image attachment.
|
||||||
|
// It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined
|
||||||
|
$attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_image['file'] );
|
||||||
|
|
||||||
|
// Update metadata for an attachment.
|
||||||
|
wp_update_attachment_metadata( $attach_id, $attach_data );
|
||||||
|
|
||||||
$thumbnail_url = opalestate_get_upload_image_url( $attach_data );
|
$thumbnail_url = opalestate_get_upload_image_url( $attach_data );
|
||||||
|
|
||||||
@ -79,12 +82,57 @@ function opalesate_upload_image( $submitted_file, $parent_id = 0 ) {
|
|||||||
update_post_meta( $attach_id, '_pending_to_use_', 1 );
|
update_post_meta( $attach_id, '_pending_to_use_', 1 );
|
||||||
|
|
||||||
return $ajax_response;
|
return $ajax_response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload an image with data base64 encoded.
|
||||||
|
*
|
||||||
|
* @param array $file File information (data, file_name, type)
|
||||||
|
* @return bool|int|\WP_Error
|
||||||
|
*/
|
||||||
|
function opalestate_upload_base64_image( $file, $parent_id = 0 ) {
|
||||||
|
// Upload dir.
|
||||||
|
$img = str_replace( ' ', '+', $file['data'] );
|
||||||
|
$decoded = base64_decode( $img );
|
||||||
|
$filename = $file['file_name'];
|
||||||
|
$file_type = $file['type'];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A writable uploads dir will pass this test. Again, there's no point
|
||||||
|
* overriding this one.
|
||||||
|
*/
|
||||||
|
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = wp_unique_filename( $uploads['path'], $filename );
|
||||||
|
|
||||||
|
// Move the file to the uploads dir.
|
||||||
|
$new_file = $uploads['path'] . "/$filename";
|
||||||
|
|
||||||
|
// Save the image in the uploads directory.
|
||||||
|
$upload_file = file_put_contents( $new_file, $decoded );
|
||||||
|
|
||||||
|
$attachment = [
|
||||||
|
'post_mime_type' => $file_type,
|
||||||
|
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file['file_name'] ) ),
|
||||||
|
'post_content' => '',
|
||||||
|
'post_status' => 'inherit',
|
||||||
|
'guid' => $uploads['url'] . '/' . basename( $filename ),
|
||||||
|
];
|
||||||
|
|
||||||
|
$attach_id = wp_insert_attachment( $attachment, $new_file, $parent_id );
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
||||||
|
$attach_data = wp_generate_attachment_metadata( $attach_id, $new_file );
|
||||||
|
wp_update_attachment_metadata( $attach_id, $attach_data );
|
||||||
|
|
||||||
|
return $attach_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
class Opalestate_Property_MetaBox {
|
class Opalestate_Property_MetaBox {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Register admin fields.
|
||||||
*/
|
*/
|
||||||
public function register_admin_fields() {
|
public function register_admin_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -40,7 +40,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'tabs' => [],
|
'tabs' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$tabs_setting['tabs'][] = [
|
$tabs_setting['tabs'][] = [
|
||||||
'id' => 'p-general',
|
'id' => 'p-general',
|
||||||
'icon' => 'dashicons-admin-home',
|
'icon' => 'dashicons-admin-home',
|
||||||
@ -168,7 +167,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Management fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_management_fields() {
|
public function metaboxes_management_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -196,7 +195,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'sanitization_cb' => 'opal_map_sanitise',
|
'sanitization_cb' => 'opal_map_sanitise',
|
||||||
'split_values' => true,
|
'split_values' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Postal Code / Zip', 'opalestate-pro' ),
|
'name' => esc_html__( 'Postal Code / Zip', 'opalestate-pro' ),
|
||||||
'id' => $prefix . 'zipcode',
|
'id' => $prefix . 'zipcode',
|
||||||
@ -212,7 +210,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
0 => esc_html__( 'No', 'opalestate-pro' ),
|
0 => esc_html__( 'No', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Address', 'opalestate-pro' ),
|
'name' => esc_html__( 'Address', 'opalestate-pro' ),
|
||||||
'id' => $prefix . 'address',
|
'id' => $prefix . 'address',
|
||||||
@ -221,8 +218,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'required' => 'required',
|
'required' => 'required',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => "{$prefix}video",
|
'id' => "{$prefix}video",
|
||||||
'name' => esc_html__( 'Video', 'opalestate-pro' ),
|
'name' => esc_html__( 'Video', 'opalestate-pro' ),
|
||||||
@ -235,7 +230,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Price fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_price_fields() {
|
public function metaboxes_price_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -287,7 +282,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Information fields.
|
||||||
*/
|
*/
|
||||||
public static function metaboxes_info_fields() {
|
public static function metaboxes_info_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -300,7 +295,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'description' => esc_html__( 'Enter built year', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter built year', 'opalestate-pro' ),
|
||||||
|
|
||||||
'before_row' => '<div class="row-group-features group-has-three group-property-info clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Property Information', 'opalestate-pro' ) ) . '</h3>',
|
'before_row' => '<div class="row-group-features group-has-three group-property-info clearfix"><h3>' . ( is_admin() ? "" : esc_html__( 'Property Information', 'opalestate-pro' ) ) . '</h3>',
|
||||||
// callback
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Parking', 'opalestate-pro' ),
|
'name' => esc_html__( 'Parking', 'opalestate-pro' ),
|
||||||
@ -312,7 +306,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
],
|
],
|
||||||
'description' => esc_html__( 'Enter number of Parking', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter number of Parking', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Bedrooms', 'opalestate-pro' ),
|
'name' => esc_html__( 'Bedrooms', 'opalestate-pro' ),
|
||||||
'id' => $prefix . 'bedrooms',
|
'id' => $prefix . 'bedrooms',
|
||||||
@ -351,7 +344,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => esc_html__( 'Enter Orientation of property', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter Orientation of property', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Living Rooms', 'opalestate-pro' ),
|
'name' => esc_html__( 'Living Rooms', 'opalestate-pro' ),
|
||||||
'id' => "{$prefix}livingrooms",
|
'id' => "{$prefix}livingrooms",
|
||||||
@ -362,7 +354,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
],
|
],
|
||||||
'description' => esc_html__( 'Enter Number of Living Rooms', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter Number of Living Rooms', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Kitchens', 'opalestate-pro' ),
|
'name' => esc_html__( 'Kitchens', 'opalestate-pro' ),
|
||||||
'id' => "{$prefix}kitchens",
|
'id' => "{$prefix}kitchens",
|
||||||
@ -373,7 +364,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
],
|
],
|
||||||
'description' => esc_html__( 'Enter Number of Kitchens', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter Number of Kitchens', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Rooms', 'opalestate-pro' ),
|
'name' => esc_html__( 'Rooms', 'opalestate-pro' ),
|
||||||
'id' => "{$prefix}amountrooms",
|
'id' => "{$prefix}amountrooms",
|
||||||
@ -385,7 +375,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'description' => esc_html__( 'Enter Number of Amount Rooms', 'opalestate-pro' ),
|
'description' => esc_html__( 'Enter Number of Amount Rooms', 'opalestate-pro' ),
|
||||||
|
|
||||||
'after_row' => '</div>',
|
'after_row' => '</div>',
|
||||||
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -393,7 +382,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Facilites fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_public_facilities_fields() {
|
public function metaboxes_public_facilities_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -427,7 +416,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Member fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_members_fields() {
|
public function metaboxes_members_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -487,7 +476,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Assigment fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_assignment_fields() {
|
public function metaboxes_assignment_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -518,7 +507,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Layout fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_layout_fields() {
|
public function metaboxes_layout_fields() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -533,7 +522,6 @@ class Opalestate_Property_MetaBox {
|
|||||||
'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
|
'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
|
||||||
'description' => esc_html__( 'Select a layout to display full information of this property', 'opalestate-pro' ),
|
'description' => esc_html__( 'Select a layout to display full information of this property', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Preview Display', 'opalestate-pro' ),
|
'name' => esc_html__( 'Preview Display', 'opalestate-pro' ),
|
||||||
'id' => "{$prefix}preview",
|
'id' => "{$prefix}preview",
|
||||||
@ -547,7 +535,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Floor plans fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_floor_plans() {
|
public function metaboxes_floor_plans() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
@ -617,7 +605,7 @@ class Opalestate_Property_MetaBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Apartment fields.
|
||||||
*/
|
*/
|
||||||
public function metaboxes_apartments() {
|
public function metaboxes_apartments() {
|
||||||
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
$prefix = OPALESTATE_PROPERTY_PREFIX;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Opal Estate Pro
|
* Plugin Name: Opal Estate Pro
|
||||||
* Plugin URI: http://www.wpopal.com/product/opal-estate-wordpress-plugin/
|
* Plugin URI: http://www.wpopal.com/product/opal-estate-wordpress-plugin/
|
||||||
* 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.5
|
* Version: 1.1.6
|
||||||
* 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.5' );
|
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.1.6' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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.5' );
|
define( 'OPALESTATE_VERSION', '1.1.6' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin Folder Path
|
// Plugin Folder Path
|
||||||
|
@ -4,7 +4,7 @@ Donate link: http://www.wpopal.com/product/opal-estate-wordpress-plugin/
|
|||||||
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.4
|
Stable tag: 1.1.6
|
||||||
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
|
||||||
|
|
||||||
@ -153,6 +153,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.6 - 2019-10-26 =
|
||||||
|
* Added - Setting information fields.
|
||||||
|
|
||||||
= 1.1.5 - 2019-10-21 =
|
= 1.1.5 - 2019-10-21 =
|
||||||
* Fixes - Email templates.
|
* Fixes - Email templates.
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ $search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['ma
|
|||||||
|
|
||||||
$showareasize = opalestate_options( OPALESTATE_PROPERTY_PREFIX . 'areasize_opt', 1 );
|
$showareasize = opalestate_options( OPALESTATE_PROPERTY_PREFIX . 'areasize_opt', 1 );
|
||||||
$showprice = opalestate_options( OPALESTATE_PROPERTY_PREFIX . 'price_opt', 1 );
|
$showprice = opalestate_options( OPALESTATE_PROPERTY_PREFIX . 'price_opt', 1 );
|
||||||
$fields = OpalEstate_Search::get_setting_search_fields( '_v' );
|
$fields = OpalEstate_Search::get_setting_search_fields();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="ajax-map-search full-width">
|
<div class="ajax-map-search full-width">
|
||||||
|
Loading…
Reference in New Issue
Block a user