Merge pull request #2 from wpopal/develop

Develop
This commit is contained in:
wpopal 2019-10-10 11:33:44 +07:00 committed by GitHub
commit 7d1bffa380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 424 additions and 242 deletions

View File

@ -261,36 +261,36 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
];
}
$fields[] = [
'name' => esc_html__( 'Vertical Search Fields', 'opalestate-pro' ),
'type' => 'opalestate_title',
'id' => 'opalestate_title_general_settings_2',
'before_row' => '<hr>',
'after_row' => '<hr>',
];
$fields[] = [
'name' => esc_html__( 'Show Price', 'opalestate-pro' ),
'id' => OPALESTATE_PROPERTY_PREFIX . 'price_opt_v',
'type' => 'switch',
'options' => [
0 => esc_html__( 'Disable', 'opalestate-pro' ),
1 => esc_html__( 'Enable', 'opalestate-pro' ),
],
];
foreach ( $metas as $key => $meta ) {
$fields[] = [
'name' => $meta['name'],
'id' => $meta['id'] . '_opt_v',
'type' => 'switch',
'options' => [
0 => esc_html__( 'Disable', 'opalestate-pro' ),
1 => esc_html__( 'Enable', 'opalestate-pro' ),
],
];
}
// $fields[] = [
// 'name' => esc_html__( 'Vertical Search Fields', 'opalestate-pro' ),
// 'type' => 'opalestate_title',
// 'id' => 'opalestate_title_general_settings_2',
// 'before_row' => '<hr>',
// 'after_row' => '<hr>',
// ];
//
// $fields[] = [
// 'name' => esc_html__( 'Show Price', 'opalestate-pro' ),
// 'id' => OPALESTATE_PROPERTY_PREFIX . 'price_opt_v',
// 'type' => 'switch',
// 'options' => [
// 0 => esc_html__( 'Disable', 'opalestate-pro' ),
// 1 => esc_html__( 'Enable', 'opalestate-pro' ),
// ],
// ];
//
// foreach ( $metas as $key => $meta ) {
// $fields[] = [
// 'name' => $meta['name'],
// 'id' => $meta['id'] . '_opt_v',
// 'type' => 'switch',
// 'options' => [
// 0 => esc_html__( 'Disable', 'opalestate-pro' ),
// 1 => esc_html__( 'Enable', 'opalestate-pro' ),
// ],
//
// ];
// }
}
return $fields;

View File

@ -156,7 +156,7 @@ function opalestate_ajax_get_city_by_state() {
/* set feature property */
add_action( 'wp_ajax_opalestate_set_feature_property', 'opalestate_set_feature_property' );
add_action( 'wp_ajax_nopriv_opalestate_set_feature_property', 'opalestate_set_feature_property' );
// add_action( 'wp_ajax_nopriv_opalestate_set_feature_property', 'opalestate_set_feature_property' );
if ( ! function_exists( 'opalestate_set_feature_property' ) ) {
function opalestate_set_feature_property() {
@ -174,7 +174,7 @@ if ( ! function_exists( 'opalestate_set_feature_property' ) ) {
}
/* remove feature property */
add_action( 'wp_ajax_opalestate_remove_feature_property', 'opalestate_remove_feature_property' );
add_action( 'wp_ajax_nopriv_opalestate_remove_feature_property', 'opalestate_remove_feature_property' );
// add_action( 'wp_ajax_nopriv_opalestate_remove_feature_property', 'opalestate_remove_feature_property' );
if ( ! function_exists( 'opalestate_remove_feature_property' ) ) {
function opalestate_remove_feature_property() {
if ( ! isset( $_REQUEST['nonce'] ) && ! wp_verify_nonce( $_REQUEST['nonce'], 'nonce' ) ) {

View File

@ -80,11 +80,11 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ],
],
[
'methods' => WP_REST_Server::EDITABLE,
'callback' => [ $this, 'update_item' ],
// 'permission_callback' => [ $this, 'update_item_permissions_check' ],
],
// [
// 'methods' => WP_REST_Server::EDITABLE,
// 'callback' => [ $this, 'update_item' ],
// // 'permission_callback' => [ $this, 'update_item_permissions_check' ],
// ],
]
);

View File

@ -71,11 +71,11 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ],
],
[
'methods' => WP_REST_Server::EDITABLE,
'callback' => [ $this, 'update_item' ],
// 'permission_callback' => [ $this, 'update_item_permissions_check' ],
],
// [
// 'methods' => WP_REST_Server::EDITABLE,
// 'callback' => [ $this, 'update_item' ],
// // 'permission_callback' => [ $this, 'update_item_permissions_check' ],
// ],
]
);

View File

@ -75,11 +75,11 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ],
],
[
'methods' => WP_REST_Server::EDITABLE,
'callback' => [ $this, 'update_item' ],
// 'permission_callback' => [ $this, 'update_item_permissions_check' ],
],
// [
// 'methods' => WP_REST_Server::EDITABLE,
// 'callback' => [ $this, 'update_item' ],
// // 'permission_callback' => [ $this, 'update_item_permissions_check' ],
// ],
// [
// 'methods' => WP_REST_Server::DELETABLE,
// 'callback' => [ $this, 'delete_item' ],
@ -263,7 +263,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
$search_min_area = isset( $request['min_area'] ) ? sanitize_text_field( $request['min_area'] ) : '';
$search_max_area = isset( $request['max_area'] ) ? sanitize_text_field( $request['max_area'] ) : '';
$s = isset( $request['search_text'] ) ? sanitize_text_field( $request['search_text'] ) : null;
$per_page = isset( $request['per_page'] ) && $request['per_page'] ? $request['per_page'] : 5;
$per_page = isset( $request['per_page'] ) && $request['per_page'] ? $request['per_page'] : opalestate_options( 'search_property_per_page', 5 );
$paged = isset( $request['page'] ) && $request['page'] ? $request['page'] : 1;
if ( isset( $request['paged'] ) && intval( $request['paged'] ) > 0 ) {
@ -578,6 +578,14 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'validate_callback' => 'rest_validate_request_arg',
];
$params['cat'] = [
'description' => __( 'Categories', 'opalestate-pro' ),
'type' => 'array',
// 'default' => '',
// 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg',
];
$params['types'] = [
'description' => __( 'Types', 'opalestate-pro' ),
'type' => 'string',
@ -602,14 +610,6 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'validate_callback' => 'rest_validate_request_arg',
];
$params['amenities'] = [
'description' => __( 'Amenities', 'opalestate-pro' ),
'type' => 'array',
// 'default' => '',
// 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg',
];
$params['info'] = [
'description' => __( 'Info', 'opalestate-pro' ),
'type' => 'array',

View File

@ -57,11 +57,85 @@ class Opalestate_Search_Form_Api extends Opalestate_Base_API {
$response = [];
$fields = [];
$fields['min_price'] = [
'enable' => opalestate_is_enable_price_field(),
'default' => opalestate_options( 'search_min_price', 0 ),
];
$fields['types'] = Opalestate_Taxonomy_Type::get_list();
$fields['status'] = Opalestate_Taxonomy_Status::get_list();
$fields['cat'] = Opalestate_Taxonomy_Categories::get_list();
$fields['amenities'] = Opalestate_Taxonomy_Amenities::get_list();
$fields['max_price'] = [
'enable' => opalestate_is_enable_price_field(),
'default' => opalestate_options( 'search_max_price', 10000000 ),
];
$fields['min_area'] = [
'enable' => opalestate_is_enable_areasize_field(),
'default' => opalestate_options( 'search_min_area', 0 ),
];
$fields['max_area'] = [
'enable' => opalestate_is_enable_areasize_field(),
'default' => opalestate_options( 'search_max_area', 1000 ),
];
$fields['search_text'] = [
'default' => '',
];
$fields['location_text'] = [
'default' => '',
];
$fields['geo_long'] = [
'default' => '',
];
$fields['geo_lat'] = [
'default' => '',
];
$fields['types'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_Type::get_list(),
];
$fields['status'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_Status::get_list(),
];
$fields['cat'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_Categories::get_list(),
];
$fields['location'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_Location::get_list(),
];
$fields['city'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_City::get_list(),
];
$fields['state'] = [
'enable' => true,
'default' => -1,
'data' => Opalestate_Taxonomy_State::get_list(),
];
$fields['amenities'] = [
'enable' => true,
'default' => [],
'data' => Opalestate_Taxonomy_Amenities::get_list(),
];
$fields['info'] = OpalEstate_Search::get_setting_search_fields();
$response['fields'] = $fields;
return $this->get_response( 200, $response );

View File

@ -98,16 +98,16 @@ class Opalestate_Install {
$options['from_email'] = get_bloginfo( 'admin_email' );
$options['message_log'] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'bedrooms_opt' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'parking_opt' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'bathrooms_opt' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'areasize_opt' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'price_opt' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'bedrooms_opt_v' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'parking_opt_v' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'bathrooms_opt_v' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'areasize_opt_v' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'price_opt_v' ] = 1;
$options[ OPALESTATE_PROPERTY_PREFIX . 'bedrooms_opt' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'parking_opt' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'bathrooms_opt' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'areasize_opt' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'price_opt' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'bedrooms_opt_v' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'parking_opt_v' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'bathrooms_opt_v' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'areasize_opt_v' ] = 'on';
$options[ OPALESTATE_PROPERTY_PREFIX . 'price_opt_v' ] = 'on';
$options['enable_single_amenities'] = 'on';
$options['enable_single_facilities'] = 'on';

View File

@ -1214,3 +1214,21 @@ function opalestate_get_property_meta_icon( $key ) {
return $classes;
}
/**
* Is enable price field in the search forms?
*
* @return bool
*/
function opalestate_is_enable_price_field() {
return 'on' == opalestate_get_option( 'opalestate_ppt_price_opt', 'on' );
}
/**
* Is enable areasize field in the search forms?
*
* @return bool
*/
function opalestate_is_enable_areasize_field() {
return 'on' == opalestate_get_option( 'opalestate_ppt_areasize_opt', 'on' );
}

View File

@ -394,18 +394,17 @@ class OpalEstate_Search {
}
/**
*
* Get_setting_search_fields.
*/
public static function get_setting_search_fields( $option = '' ) {
$options = [
$default = apply_filters( 'opalestate_default_fields_setting', [
OPALESTATE_PROPERTY_PREFIX . 'bedrooms' => esc_html__( 'Bed Rooms', 'opalestate-pro' ),
OPALESTATE_PROPERTY_PREFIX . 'parking' => esc_html__( 'Parking', 'opalestate-pro' ),
OPALESTATE_PROPERTY_PREFIX . 'bathrooms' => esc_html__( 'Bath Rooms', 'opalestate-pro' ),
];
$default = apply_filters( 'opalestate_default_fields_setting', $options );
] );
$metas = Opalestate_Property_MetaBox::metaboxes_info_fields();
$esettings = [];
$found = false;
foreach ( $metas as $key => $meta ) {
@ -415,10 +414,11 @@ class OpalEstate_Search {
continue;
}
if ( $value ) {
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, "", $meta['id'] );
if ( 'on' == $value ) {
$id = str_replace( OPALESTATE_PROPERTY_PREFIX, '', $meta['id'] );
$esettings[ $id ] = $meta['name'];
}
if ( $value == 0 ) {
$found = true;
}

View File

@ -26,36 +26,33 @@ class Opalestate_Taxonomy_Categories {
* Init
*/
public static function init() {
add_action( 'init', [ __CLASS__, 'definition' ] );
add_filter( 'opalestate_taxomony_category_metaboxes', [ __CLASS__, 'metaboxes' ] );
add_action( 'cmb2_admin_init', [ __CLASS__, 'taxonomy_metaboxes' ], 999 );
}
public static function metaboxes() {
}
/**
*
* Definition.
*/
public static function definition() {
register_taxonomy( static::OPALESTATE_CATEGORY, 'opalestate_property', apply_filters( 'opalestate_taxonomy_args_property_category', [
'labels' => [
$labels = [
'name' => esc_html__( 'Categories', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Category', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Category', 'opalestate-pro' ),
],
];
register_taxonomy( static::OPALESTATE_CATEGORY, 'opalestate_property', [
'labels' => apply_filters( 'opalestate_category_labels', $labels ),
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => [ 'slug' => _x( 'property-category', 'slug', 'opalestate-pro' ), 'with_front' => false, 'hierarchical' => true ],
] ) );
] );
}
@ -104,7 +101,6 @@ class Opalestate_Taxonomy_Categories {
}
public static function dropdown_list( $selected = 0 ) {
$id = static::OPALESTATE_CATEGORY . rand();
$args = [

View File

@ -19,7 +19,12 @@ if ( ! defined( 'ABSPATH' ) ) {
class Opalestate_Taxonomy_City {
/**
*
* Constant.
*/
const OPALESTATE_CITY = 'opalestate_city';
/**
* Init
*/
public static function init() {
add_action( 'init', [ __CLASS__, 'definition' ] );
@ -27,7 +32,7 @@ class Opalestate_Taxonomy_City {
}
/**
*
* Definition.
*/
public static function definition() {
@ -45,7 +50,7 @@ class Opalestate_Taxonomy_City {
'menu_name' => esc_html__( 'Cities / Towns', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_city', 'opalestate_property', [
register_taxonomy( static::OPALESTATE_CITY, 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_city_labels', $labels ),
'hierarchical' => true,
'query_var' => 'city',
@ -66,9 +71,9 @@ class Opalestate_Taxonomy_City {
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'City Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_city' ], // Tells CMB2 which taxonomies should have these fields
'title' => esc_html__( 'City Metabox', 'opalestate-pro' ),
'object_types' => [ 'term' ],
'taxonomies' => [ static::OPALESTATE_CITY ],
] );
$cmb_term->add_field( [
@ -82,7 +87,6 @@ class Opalestate_Taxonomy_City {
],
] );
////
$cmb_term->add_field( [
'name' => esc_html__( 'Country', 'opalestate-pro' ),
'desc' => esc_html__( 'Select one, to add new you create in countries of estate panel', 'opalestate-pro' ),
@ -91,7 +95,6 @@ class Opalestate_Taxonomy_City {
'type' => 'taxonomy_select',
] );
///
$cmb_term->add_field( [
'name' => esc_html__( 'State / Province', 'opalestate-pro' ),
'desc' => esc_html__( 'Select one, to add new you create in City/Town of estate panel', 'opalestate-pro' ),
@ -109,7 +112,7 @@ class Opalestate_Taxonomy_City {
*/
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => 'opalestate_city',
'taxonomy' => static::OPALESTATE_CITY,
'hide_empty' => true,
];
@ -127,7 +130,7 @@ class Opalestate_Taxonomy_City {
* @return string
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_city' . rand();
$id = static::OPALESTATE_CITY . rand();
$args = [
'show_option_none' => esc_html__( 'Select City', 'opalestate-pro' ),
'id' => $id,
@ -137,7 +140,7 @@ class Opalestate_Taxonomy_City {
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_city',
'taxonomy' => static::OPALESTATE_CITY,
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,

View File

@ -17,14 +17,16 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Opalestate_Taxonomy_Label {
/**
* Constant.
*/
const OPALESTATE_LABEL = 'opalestate_label';
/**
*
* Opalestate_Taxonomy_Label constructor.
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_filter( 'opalestate_taxomony_label_metaboxes', [ $this, 'metaboxes' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ], 999 );
}
@ -33,7 +35,6 @@ class Opalestate_Taxonomy_Label {
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Label', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Label', 'opalestate-pro' ),
@ -48,7 +49,7 @@ class Opalestate_Taxonomy_Label {
'menu_name' => esc_html__( 'Label', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_label', 'opalestate_property', [
register_taxonomy( static::OPALESTATE_LABEL, 'opalestate_property', [
'labels' => apply_filters( 'opalestate_label_labels', $labels ),
'hierarchical' => true,
'query_var' => 'property-label',
@ -73,10 +74,9 @@ class Opalestate_Taxonomy_Label {
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'Category Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_label' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
'title' => esc_html__( 'Category Metabox', 'opalestate-pro' ),
'object_types' => [ 'term' ],
'taxonomies' => [ static::OPALESTATE_LABEL ],
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Background', 'opalestate-pro' ),
@ -111,7 +111,7 @@ class Opalestate_Taxonomy_Label {
*/
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => 'opalestate_label',
'taxonomy' => static::OPALESTATE_LABEL,
'hide_empty' => false,
];
@ -129,7 +129,7 @@ class Opalestate_Taxonomy_Label {
* @return string
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_label' . rand();
$id = static::OPALESTATE_LABEL . rand();
$args = [
'show_option_none' => esc_html__( 'Select Label', 'opalestate-pro' ),
@ -140,7 +140,7 @@ class Opalestate_Taxonomy_Label {
'name' => 'label',
'value_field' => 'slug',
'selected' => $selected,
'taxonomy' => 'opalestate_label',
'taxonomy' => static::OPALESTATE_LABEL,
];
return wp_dropdown_categories( $args );

View File

@ -17,9 +17,13 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Opalestate_Taxonomy_Location {
/**
* Constant.
*/
const OPALESTATE_LOCATION = 'opalestate_location';
/**
*
* Opalestate_Taxonomy_Location constructor.
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
@ -28,10 +32,9 @@ class Opalestate_Taxonomy_Location {
}
/**
*
* Definition.
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Countries', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Country', 'opalestate-pro' ),
@ -46,7 +49,7 @@ class Opalestate_Taxonomy_Location {
'menu_name' => esc_html__( 'Countries', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_location', 'opalestate_property', [
register_taxonomy( static::OPALESTATE_LOCATION, 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_location_labels', $labels ),
'hierarchical' => true,
'query_var' => 'location',
@ -74,10 +77,9 @@ class Opalestate_Taxonomy_Location {
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'Country Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_location' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
'title' => esc_html__( 'Country Metabox', 'opalestate-pro' ),
'object_types' => [ 'term' ],
'taxonomies' => [ static::OPALESTATE_LOCATION ],
] );
$cmb_term->add_field( [
@ -93,17 +95,29 @@ class Opalestate_Taxonomy_Location {
}
/**
* Gets list.
*
* @param array $args
* @return array|int|\WP_Error
*/
public static function get_list() {
return get_terms( 'opalestate_location', [ 'hide_empty' => false ] );
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => static::OPALESTATE_LOCATION,
'hide_empty' => true,
];
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
/**
*
*/
public static function dropdown_agents_list( $selected = 0 ) {
$id = "opalestate_location" . rand();
$id = static::OPALESTATE_LOCATION . rand();
$args = [
'show_option_none' => esc_html__( 'Select Country', 'opalestate-pro' ),
'id' => $id,
@ -123,7 +137,7 @@ class Opalestate_Taxonomy_Location {
*
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_location' . rand();
$id = static::OPALESTATE_LOCATION . rand();
$args = [
'show_option_none' => esc_html__( 'Select Country', 'opalestate-pro' ),
'id' => $id,
@ -133,7 +147,7 @@ class Opalestate_Taxonomy_Location {
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_location',
'taxonomy' => static::OPALESTATE_LOCATION,
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,

View File

@ -17,6 +17,11 @@ if ( ! defined( 'ABSPATH' ) ) {
}
class Opalestate_Taxonomy_State {
/**
* Constant.
*/
const OPALESTATE_STATE = 'opalestate_state';
/**
* Opalestate_Taxonomy_State constructor.
*/
@ -27,7 +32,7 @@ class Opalestate_Taxonomy_State {
}
/**
*
* Definition.
*/
public function definition() {
$labels = [
@ -44,7 +49,7 @@ class Opalestate_Taxonomy_State {
'menu_name' => esc_html__( 'States / Provinces', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_state', 'opalestate_property', [
register_taxonomy( static::OPALESTATE_STATE, 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_state_labels', $labels ),
'hierarchical' => true,
'query_var' => 'state',
@ -69,10 +74,9 @@ class Opalestate_Taxonomy_State {
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'State Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_state' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
'title' => esc_html__( 'State Metabox', 'opalestate-pro' ),
'object_types' => [ 'term' ],
'taxonomies' => [ static::OPALESTATE_STATE ],
] );
$cmb_term->add_field( [
@ -86,7 +90,6 @@ class Opalestate_Taxonomy_State {
],
] );
////
$cmb_term->add_field( [
'name' => esc_html__( 'Country', 'opalestate-pro' ),
'desc' => esc_html__( 'Select one, to add new you create in countries of estate panel', 'opalestate-pro' ),
@ -94,16 +97,29 @@ class Opalestate_Taxonomy_State {
'taxonomy' => 'opalestate_location', //Enter Taxonomy Slug
'type' => 'taxonomy_select',
] );
///
}
public static function get_list() {
return get_terms( 'opalestate_state', [ 'hide_empty' => false ] );
/**
* Gets list.
*
* @param array $args
* @return array|int|\WP_Error
*/
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => static::OPALESTATE_STATE,
'hide_empty' => true,
];
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
public static function dropdown_agents_list( $selected = 0 ) {
$id = "opalestate_state" . rand();
$id = static::OPALESTATE_STATE . rand();
$args = [
'show_option_none' => esc_html__( 'Select State', 'opalestate-pro' ),
'id' => $id,
@ -120,7 +136,7 @@ class Opalestate_Taxonomy_State {
}
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_state" . rand();
$id = static::OPALESTATE_STATE . rand();
$args = [
'show_option_none' => esc_html__( 'Select State', 'opalestate-pro' ),
'id' => $id,
@ -130,7 +146,7 @@ class Opalestate_Taxonomy_State {
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_state',
'taxonomy' => static::OPALESTATE_STATE,
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro
* 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.
* Version: 1.1.1
* Version: 1.1.2
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.6
@ -152,7 +152,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
*/
public function __clone() {
// Cloning instances of the class is forbidden
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.1.1' );
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'opalestate-pro' ), '1.1.2' );
}
/**
@ -161,7 +161,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
define( 'OPALESTATE_VERSION', '1.1.1' );
define( 'OPALESTATE_VERSION', '1.1.2' );
}
// Plugin Folder Path

View File

@ -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
Requires at least: 4.6
Tested up to: 5.2.3
Stable tag: 1.1.1
Stable tag: 1.1.2
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -153,6 +153,10 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
== Changelog ==
= 1.1.2 - 2019-10-10 =
* Fixes - Settings.
* Fixes - Templates.
= 1.0.5 - 2019-09-25 =
* Fixes - Dashboard CSS.

View File

@ -1,6 +1,10 @@
<?php
global $property;
echo get_the_term_list( $property->get_id(), 'property_category', '<div class="property-categories-list"><span class="property-categories-list__label">' . esc_html__( 'Categories:', 'opalestate-pro'
) .
'</span>', ', ', '</div>' );
echo get_the_term_list(
$property->get_id(),
'property_category',
'<div class="property-categories-list"><span class="property-categories-list__label">' . esc_html__( 'Categories:', 'opalestate-pro' ) . '</span>',
', ',
'</div>'
);

View File

@ -1,5 +1,10 @@
<?php
global $property;
echo get_the_term_list( $property->get_id(), 'opalestate_types', '<div class="property-types-list"><span class="property-types-list__label">' . esc_html__( 'Types:', 'opalestate-pro' ) . '</span>',
', ', '</div>' );
echo get_the_term_list(
$property->get_id(),
'opalestate_types',
'<div class="property-types-list"><span class="property-types-list__label">' . esc_html__( 'Types:', 'opalestate-pro' ) . '</span>',
', ',
'</div>'
);

View File

@ -62,13 +62,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -48,13 +48,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>
<div class="col-lg-3 col-md-3 col-sm-3">

View File

@ -61,9 +61,13 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<div class="col-lg-6 col-md-6 col-sm-6">
<?php if ( opalestate_is_enable_price_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
<?php endif; ?>
</div>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>

View File

@ -71,13 +71,17 @@ $form_classes = [
<div class="opal-row">
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -67,13 +67,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -89,13 +89,17 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
</div>
<?php

View File

@ -1 +1,6 @@
<?php opalestate_property_areasize_field_template(); ?>
<?php
if ( ! opalestate_is_enable_areasize_field() ) {
return;
}
opalestate_property_areasize_field_template();

View File

@ -1,4 +1,8 @@
<?php
if ( ! opalestate_is_enable_price_field() ) {
return;
}
$search_min_price = isset( $_GET['min_price'] ) ? sanitize_text_field( $_GET['min_price'] ): opalestate_options( 'search_min_price', 0 );
$search_max_price = isset( $_GET['max_price'] ) ? sanitize_text_field( $_GET['max_price'] ): opalestate_options( 'search_max_price', 10000000 );

View File

@ -54,13 +54,18 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/types' ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>
<div class="col-lg-3 col-md-3 col-sm-12">
<?php echo opalestate_load_template_path( 'search-box/fields/submit-button' ); ?>

View File

@ -41,7 +41,9 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
<?php endif; ?>
<?php
if ( $display_more_options ) {

View File

@ -27,23 +27,27 @@ $form_classes = [
<div class="form-item form-item--types">
<h6> <?php esc_html_e( 'Types', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/types' , array( 'ismultiple' => true ) ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/types', [ 'ismultiple' => true ] ); ?>
</div>
<div class="form-item form-item--information">
<h6> <?php esc_html_e( 'Information', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', array( 'type' => 'input' ) ); ?>
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="form-item form-item--price">
<h6> <?php esc_html_e( 'Price', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="form-item form-item--area">
<h6> <?php esc_html_e( 'Area', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php
if ( $display_more_options ) {

View File

@ -52,15 +52,19 @@ $form_classes = [
<?php echo opalestate_load_template_path( 'search-box/fields/group-info', [ 'type' => 'input' ] ); ?>
</div>
<?php if ( opalestate_is_enable_price_field() ) : ?>
<div class="form-item form-item--price">
<h6> <?php esc_html_e( 'Price', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<?php endif; ?>
<?php if ( opalestate_is_enable_areasize_field() ) : ?>
<div class="form-item form-item--area">
<h6> <?php esc_html_e( 'Area', 'opalestate-pro' ); ?></h6>
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
<?php endif; ?>
<?php
if ( $display_more_options ) {