Origin commit

This commit is contained in:
Hoang Huu
2019-09-10 11:27:33 +07:00
commit 499e068e4f
844 changed files with 188705 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
<?php
/**
* Opalestate_Taxonomy_Amenities
*
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Amenities {
/**
* Opalestate_Taxonomy_Amenities constructor.
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ], 999 );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Amenities', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Amenity', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Amenities', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Amenities', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Amenity', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Amenity:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Amenity', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Amenity', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Amenity', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Amenity', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Amenities', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_amenities', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_amenities_labels', $labels ),
'hierarchical' => true,
'query_var' => 'amenity',
'rewrite' => [ 'slug' => _x( 'amenity', 'slug', 'opalestate-pro' ), 'with_front' => false, 'hierarchical' => true ],
'public' => true,
'show_ui' => true,
] );
}
public static function get_list() {
return get_terms( 'opalestate_amenities', [ 'hide_empty' => false ] );
}
public function taxonomy_metaboxes() {
$prefix = 'opalestate_amt_';
/**
* Metabox to add fields to categories and tags
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'Type Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_amenities' ], // Tells CMB2 which taxonomies should have these fields
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image Icon', 'opalestate-pro' ),
'desc' => esc_html__( 'Select an image icon (SVG, PNG or JPEG).', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
'preview_size' => [ 50, 50 ],
'options' => [
'url' => false, // Hide the text input for the url
],
'query_args' => [
'type' => [
'image/gif',
'image/jpeg',
'image/png',
],
],
] );
}
}
new Opalestate_Taxonomy_Amenities();

View File

@@ -0,0 +1,116 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Categories {
/**
*
*/
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() {
}
/**
*
*/
public static function definition() {
register_taxonomy( 'property_category', 'opalestate_property', apply_filters( 'opalestate_taxonomy_args_property_category', [
'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' ),
],
'public' => true,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => [ 'slug' => _x( 'property-category', 'slug', 'opalestate-pro' ), 'with_front' => false, 'hierarchical' => true ],
] ) );
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public static function taxonomy_metaboxes() {
$prefix = 'opalestate_category_';
/**
* Metabox to add fields to categories and tags
*/
$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' => [ 'property_category' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image', 'opalestate-pro' ),
'desc' => esc_html__( 'Category image', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
] );
}
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => 'property_category',
'hide_empty' => true,
];
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_category" . rand();
$args = [
'show_option_none' => esc_html__( 'Select category', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'label',
'value_field' => 'slug',
'selected' => $selected,
'taxonomy' => 'opalestate_category',
];
return wp_dropdown_categories( $args );
}
}
Opalestate_Taxonomy_Categories::init();

View File

@@ -0,0 +1,152 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_City {
/**
*
*/
public static function init() {
add_action( 'init', [ __CLASS__, 'definition' ] );
add_action( 'cmb2_admin_init', [ __CLASS__, 'taxonomy_metaboxes' ] );
}
/**
*
*/
public static function definition() {
$labels = [
'name' => esc_html__( 'Cities / Towns', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By City', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Cities / Towns', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Cities / Town', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent City', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent City:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit City', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update City', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New City', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New City', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Cities / Towns', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_city', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_city_labels', $labels ),
'hierarchical' => true,
'query_var' => 'city',
'rewrite' => [ 'slug' => esc_html__( 'city', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public static function taxonomy_metaboxes() {
$prefix = 'opalestate_city_';
/**
* Metabox to add fields to categories and tags
*/
$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
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image', 'opalestate-pro' ),
'desc' => esc_html__( 'City image', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
////
$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' ),
'id' => $prefix . 'location',
'taxonomy' => 'opalestate_location', //Enter Taxonomy Slug
'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' ),
'id' => $prefix . 'state',
'taxonomy' => 'opalestate_state', //Enter Taxonomy Slug
'type' => 'taxonomy_select',
] );
}
/**
* Gets list.
*
* @param array $args
* @return array|int|\WP_Error
*/
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => 'opalestate_city',
'hide_empty' => true,
];
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
/**
* Render dopdown list.
*
* @param int $selected
* @return string
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_city' . rand();
$args = [
'show_option_none' => esc_html__( 'Select City', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'name' => 'city',
'show_count' => 0,
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_city',
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,
];
$label = '<label class="opalestate-label opalestate-label--city" for="' . esc_attr( $id ) . '">' . esc_html__( 'City', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
}
Opalestate_Taxonomy_City::init();

View File

@@ -0,0 +1,150 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Label {
/**
*
*/
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 );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Label', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Label', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Label', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Label', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Label', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Label:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Label', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Label', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Label', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Label', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Label', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_label', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_label_labels', $labels ),
'hierarchical' => true,
'query_var' => 'property-label',
'rewrite' => [ 'slug' => esc_html__( 'property-label', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
public function metaboxes() {
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_label_';
/**
* Metabox to add fields to categories and tags
*/
$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
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Background', 'opalestate-pro' ),
'desc' => esc_html__( 'Set background of label', 'opalestate-pro' ),
'id' => $prefix . 'lb_bg',
'type' => 'colorpicker',
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Color', 'opalestate-pro' ),
'desc' => esc_html__( 'Set color of text', 'opalestate-pro' ),
'id' => $prefix . 'lb_color',
'type' => 'colorpicker',
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image Logo', 'opalestate-pro' ),
'desc' => esc_html__( 'Or Using Image Logo without using text', 'opalestate-pro' ),
'id' => $prefix . 'lb_img',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
}
/**
* Gets list.
*
* @param array $args
* @return array|int|\WP_Error
*/
public static function get_list( $args = [] ) {
$default = [
'taxonomy' => 'opalestate_label',
'hide_empty' => false,
];
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
/**
* Render dopdown list.
*
* @param int $selected
* @return string
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_label' . rand();
$args = [
'show_option_none' => esc_html__( 'Select Label', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'label',
'value_field' => 'slug',
'selected' => $selected,
'taxonomy' => 'opalestate_label',
];
return wp_dropdown_categories( $args );
}
}
new Opalestate_Taxonomy_Label();

View File

@@ -0,0 +1,152 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Location {
/**
*
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_filter( 'opalestate_taxomony_location_metaboxes', [ $this, 'metaboxes' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ] );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Countries', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Country', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Countries', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Countries', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Country', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Country:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Country', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Country', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Country', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Country', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Countries', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_location', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_location_labels', $labels ),
'hierarchical' => true,
'query_var' => 'location',
'rewrite' => [ 'slug' => esc_html__( 'location', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
/**
*
*/
public function metaboxes() {
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_location_';
/**
* Metabox to add fields to categories and tags
*/
$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
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image', 'opalestate-pro' ),
'desc' => esc_html__( 'Country image', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
}
/**
*
*/
public static function get_list() {
return get_terms( 'opalestate_location', [ 'hide_empty' => false ] );
}
/**
*
*/
public static function dropdown_agents_list( $selected = 0 ) {
$id = "opalestate_location" . rand();
$args = [
'show_option_none' => esc_html__( 'Select Country', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'name' => 'location',
'show_count' => 0,
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_agent_location',
];
return wp_dropdown_categories( $args );
}
/**
*
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'opalestate_location' . rand();
$args = [
'show_option_none' => esc_html__( 'Select Country', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'name' => 'location',
'show_count' => 0,
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_location',
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,
];
$label = '<label class="opalestate-label opalestate-label--country" for="' . esc_attr( $id ) . '">' . esc_html__( 'Country', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
public static function get_multi_check_list() {
}
}
new Opalestate_Taxonomy_Location();

View File

@@ -0,0 +1,114 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Neighborhood{
/**
*
*/
public static function init(){
add_action( 'init', array( $this, 'definition' ), 99 );
add_action( 'cmb2_admin_init', array( $this, 'taxonomy_metaboxes' ), 9 );
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_nb_';
/**
* Metabox to add fields to categories and tags
*/
$cmb_term = new_cmb2_box( array(
'id' => $prefix . 'edit',
'title' => esc_html__( 'Type Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => array( 'term' ), // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => array( 'opalestate_neighborhoods' ), // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
) );
$cmb_term->add_field( array(
'name' => esc_html__( 'Icon', 'opalestate-pro' ),
'desc' => esc_html__( 'This image will display in google map', 'opalestate-pro' ),
'id' => $prefix . 'icon',
'type' => 'file',
'preview_size' => 'small',
'options' => array(
'url' => false, // Hide the text input for the url
)
) );
}
/**
*
*/
public function definition(){
$labels = array(
'name' => esc_html__( 'Neighborhoods', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Neighborhood', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Neighborhoods', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Neighborhoods', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Neighborhood', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Neighborhood:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Neighborhood', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Neighborhood', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Neighborhood', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Neighborhood', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Neighborhoods', 'opalestate-pro' ),
);
register_taxonomy( 'opalestate_neighborhoods', array( 'opalestate_property' ) , array(
'labels' => apply_filters( 'opalestate_taxomony_neighborhoods_labels', $labels ),
'hierarchical' => true,
'query_var' => 'property-neighborhood',
'rewrite' => array( 'slug' => esc_html__( 'property-neighborhood', 'opalestate-pro' ) ),
'public' => true,
'show_ui' => true,
) );
}
public static function metaboxes(){
}
public static function dropdown_list( $selected=0 ){
$id = "opalestate_neighborhoods".rand();
$args = array(
'show_option_none' => esc_html__( 'Select Neighborhoods', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'neighborhoods',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_neighborhoods'
);
return wp_dropdown_categories( $args );
}
}
new Opalestate_Taxonomy_Neighborhood();

View File

@@ -0,0 +1,145 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_State {
/**
* Opalestate_Taxonomy_State constructor.
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_filter( 'opalestate_taxomony_state_metaboxes', [ $this, 'metaboxes' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ] );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'States / Provinces', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By State', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search States', 'opalestate-pro' ),
'all_items' => esc_html__( 'All States / Province', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent State', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent State:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit State', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update State', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New State', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New State', 'opalestate-pro' ),
'menu_name' => esc_html__( 'States / Provinces', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_state', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_taxomony_state_labels', $labels ),
'hierarchical' => true,
'query_var' => 'state',
'rewrite' => [ 'slug' => esc_html__( 'state', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
public function metaboxes() {
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_state_';
/**
* Metabox to add fields to categories and tags
*/
$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
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image', 'opalestate-pro' ),
'desc' => esc_html__( 'State image', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
////
$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' ),
'id' => $prefix . "location",
'taxonomy' => 'opalestate_location', //Enter Taxonomy Slug
'type' => 'taxonomy_select',
] );
///
}
public static function get_list() {
return get_terms( 'opalestate_state', [ 'hide_empty' => false ] );
}
public static function dropdown_agents_list( $selected = 0 ) {
$id = "opalestate_state" . rand();
$args = [
'show_option_none' => esc_html__( 'Select State', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'name' => 'state',
'show_count' => 0,
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_agent_state',
];
return wp_dropdown_categories( $args );
}
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_state" . rand();
$args = [
'show_option_none' => esc_html__( 'Select State', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'name' => 'state',
'show_count' => 0,
'hierarchical' => '',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_state',
'orderby' => 'name',
'order' => 'ASC',
'echo' => 0,
];
$label = '<label class="opalestate-label opalestate-label--state" for="' . esc_attr( $id ) . '">' . esc_html__( 'State', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
}
new Opalestate_Taxonomy_State();

View File

@@ -0,0 +1,159 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Status {
/**
* Opalestate_Taxonomy_Status constructor.
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_filter( 'opalestate_taxomony_status_metaboxes', [ $this, 'metaboxes' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ] );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Status', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Status', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Status', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Status', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Status', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Status:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Status', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Status', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Status', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Status', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Status', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_status', 'opalestate_property', [
'labels' => apply_filters( 'opalestate_status_labels', $labels ),
'hierarchical' => true,
'query_var' => 'status',
'rewrite' => [ 'slug' => esc_html__( 'status', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_status_';
/**
* Metabox to add fields to categories and tags
*/
$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_status' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Background', 'opalestate-pro' ),
'desc' => esc_html__( 'Set background of label', 'opalestate-pro' ),
'id' => $prefix . 'lb_bg',
'type' => 'colorpicker',
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Color', 'opalestate-pro' ),
'desc' => esc_html__( 'Set background of text', 'opalestate-pro' ),
'id' => $prefix . 'lb_color',
'type' => 'colorpicker',
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Order', 'opalestate-pro' ),
'desc' => esc_html__( 'Set a priority to display', 'opalestate-pro' ),
'id' => $prefix . 'order',
'type' => 'text_small',
'attributes' => [
'type' => 'number',
],
'default' => 0,
] );
}
public function metaboxes() {
}
/**
* Gets list.
*
* @param array $args
* @return array|int|\WP_Error
*/
public static function get_list( $args = [] ) {
$default = apply_filters( 'opalestate_status_args', [
'taxonomy' => 'opalestate_status',
'hide_empty' => false,
'hierarchical' => false,
'parent' => 0,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_query' => [
[
'key' => 'opalestate_status_order',
'type' => 'NUMERIC',
],
],
] );
if ( $args ) {
$default = array_merge( $default, $args );
}
return get_terms( $default );
}
/**
* Render dopdown list.
*
* @param int $selected
* @return string
*/
public static function dropdown_list( $selected = 0 ) {
$id = 'palestate_status' . rand();
$args = [
'show_option_none' => esc_html__( 'Select Status', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'status',
'value_field' => 'slug',
'selected' => $selected,
'taxonomy' => 'opalestate_status',
'echo' => 0,
];
$label = '<label class="opalestate-label opalestate-label--status" for="' . esc_attr( $id ) . '">' . esc_html__( 'Status', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
}
new Opalestate_Taxonomy_Status();

View File

@@ -0,0 +1,136 @@
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Opalestate_Taxonomy_Type {
/**
*
*/
public function __construct() {
add_action( 'init', [ $this, 'definition' ] );
add_action( 'cmb2_admin_init', [ $this, 'taxonomy_metaboxes' ] );
}
/**
* Hook in and add a metabox to add fields to taxonomy terms
*/
public function taxonomy_metaboxes() {
$prefix = 'opalestate_type_';
/**
* Metabox to add fields to categories and tags
*/
$cmb_term = new_cmb2_box( [
'id' => $prefix . 'edit',
'title' => esc_html__( 'Type Metabox', 'opalestate-pro' ), // Doesn't output for term boxes
'object_types' => [ 'term' ], // Tells CMB2 to use term_meta vs post_meta
'taxonomies' => [ 'opalestate_types' ], // Tells CMB2 which taxonomies should have these fields
// 'new_term_section' => true, // Will display in the "Add New Category" section
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Custom Icon Marker', 'opalestate-pro' ),
'desc' => esc_html__( 'This image will display in google map', 'opalestate-pro' ),
'id' => $prefix . 'iconmarker',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
$cmb_term->add_field( [
'name' => esc_html__( 'Image', 'opalestate-pro' ),
'desc' => esc_html__( 'Type image', 'opalestate-pro' ),
'id' => $prefix . 'image',
'type' => 'file',
'preview_size' => 'small',
'options' => [
'url' => false, // Hide the text input for the url
],
] );
}
/**
*
*/
public function definition() {
$labels = [
'name' => esc_html__( 'Types', 'opalestate-pro' ),
'singular_name' => esc_html__( 'Properties By Type', 'opalestate-pro' ),
'search_items' => esc_html__( 'Search Types', 'opalestate-pro' ),
'all_items' => esc_html__( 'All Types', 'opalestate-pro' ),
'parent_item' => esc_html__( 'Parent Type', 'opalestate-pro' ),
'parent_item_colon' => esc_html__( 'Parent Type:', 'opalestate-pro' ),
'edit_item' => esc_html__( 'Edit Type', 'opalestate-pro' ),
'update_item' => esc_html__( 'Update Type', 'opalestate-pro' ),
'add_new_item' => esc_html__( 'Add New Type', 'opalestate-pro' ),
'new_item_name' => esc_html__( 'New Type', 'opalestate-pro' ),
'menu_name' => esc_html__( 'Types', 'opalestate-pro' ),
];
register_taxonomy( 'opalestate_types', [ 'opalestate_property' ], [
'labels' => apply_filters( 'opalestate_taxomony_types_labels', $labels ),
'hierarchical' => true,
'query_var' => 'type',
'rewrite' => [ 'slug' => esc_html__( 'type', 'opalestate-pro' ) ],
'public' => true,
'show_ui' => true,
] );
}
public function metaboxes() {
}
public static function get_list() {
return get_terms( 'opalestate_types', [ 'hide_empty' => false ] );
}
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_types" . rand();
$args = [
'show_option_none' => esc_html__( 'Select Type', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'types',
'selected' => $selected,
'value_field' => 'slug',
'taxonomy' => 'opalestate_types',
'echo' => 0,
];
$label = '<label class="opalestate-label opalestate-label--type" for="' . esc_attr( $id ) . '">' . esc_html__( 'Type', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
public static function get_multi_check_list( $stypes ) {
$list = self::get_list();
echo opalestate_terms_multi_check( $list, $stypes );
}
}
new Opalestate_Taxonomy_Type();