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,568 @@
<?php
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Account_Button_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-account-button';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Account Button', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-lock-user' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'account', 'button' ];
}
private function get_available_menus() {
$menus = wp_get_nav_menus();
$options = [];
foreach ( $menus as $menu ) {
$options[ $menu->slug ] = $menu->name;
}
return $options;
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'account_content',
[
'label' => esc_html__( 'Not logged in', 'opalestate-pro' ),
]
);
$this->add_control(
'icon',
[
'label' => esc_html__( 'Choose Icon', 'opalestate-pro' ),
'type' => Controls_Manager::ICON,
'default' => 'fa fa-user',
]
);
$this->add_control(
'enable_label',
[
'label' => esc_html__( 'Enable Label', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'label_text',
[
'label' => esc_html__( 'Label Text', 'opalestate-pro' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Account', 'opalestate-pro' ),
'condition' => [ 'enable_label' => 'yes' ],
]
);
$this->end_controls_section();
$this->start_controls_section(
'account_logged_in',
[
'label' => esc_html__( 'Logged in', 'opalestate-pro' ),
]
);
$this->add_control(
'logged_in_enable_avatar',
[
'label' => esc_html__( 'Enable Avatar', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'on',
]
);
$this->add_control(
'logged_in_enable_notification',
[
'label' => esc_html__( 'Enable Notification', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'logged_in_icon',
[
'label' => esc_html__( 'Choose Icon', 'opalestate-pro' ),
'type' => Controls_Manager::ICON,
'default' => 'fa fa-user',
]
);
$this->add_control(
'logged_in_enable_label',
[
'label' => esc_html__( 'Enable Label', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'logged_in_label_text',
[
'label' => esc_html__( 'Label Text', 'opalestate-pro' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Account', 'opalestate-pro' ),
'condition' => [ 'logged_in_enable_label' => 'yes' ],
]
);
$menus = $this->get_available_menus();
if ( ! empty( $menus ) ) {
$this->add_control(
'enable_custom_menu',
[
'label' => esc_html__( 'Use Custom Dashboard Menu', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'menu',
[
'label' => esc_html__( 'Menu', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'options' => $menus,
'default' => 'my-account',
'save_default' => true,
'separator' => 'after',
'description' => sprintf( esc_html__( 'Go to the <a href="%s" target="_blank">Menus screen</a> to manage your menus.', 'opalestate-pro' ), admin_url( 'nav-menus.php' ) ),
'condition' => [ 'enable_custom_menu' => 'yes' ],
]
);
}
$this->end_controls_section();
$this->start_controls_section(
'section_general_style_content',
[
'label' => esc_html__( 'General', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'toggle_align',
[
'label' => esc_html__( 'Alignment', 'opalestate-pro' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'opalestate-pro' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'opalestate-pro' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'opalestate-pro' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_label_style_content',
[
'label' => esc_html__( 'Label', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .site-header-account .account-label' => 'color: {{VALUE}};',
],
'scheme' => [
'type' => Scheme_Color::get_type(),
'value' => Scheme_Color::COLOR_1,
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .site-header-account .account-label',
'scheme' => Scheme_Typography::TYPOGRAPHY_1,
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_icon_style_content',
[
'label' => esc_html__( 'Icon', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_icon_style' );
$this->start_controls_tab(
'tab_icon_normal',
[
'label' => esc_html__( 'Normal', 'opalestate-pro' ),
]
);
$this->add_control(
'icon_color',
[
'label' => esc_html__( 'Icon Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .site-header-account i' => 'color: {{VALUE}};',
],
'scheme' => [
'type' => Scheme_Color::get_type(),
'value' => Scheme_Color::COLOR_1,
],
]
);
$this->add_control(
'background_color',
[
'label' => esc_html__( 'Background Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .site-header-account i' => 'background-color: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'icon_fontsize',
[
'label' => esc_html__( 'Icon Font Size', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .site-header-account i' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'icon_border',
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} .site-header-account i',
'separator' => 'before',
]
);
$this->add_control(
'icon_border_radius',
[
'label' => esc_html__( 'Border Radius', 'opalestate-pro' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .site-header-account i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'icon_padding',
[
'label' => esc_html__( 'Padding', 'opalestate-pro' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .site-header-account i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_icon_hover',
[
'label' => esc_html__( 'Hover', 'opalestate-pro' ),
]
);
$this->add_control(
'icon_color_hover',
[
'label' => esc_html__( 'Icon Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .site-header-account i:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'background_color_hover',
[
'label' => esc_html__( 'Background Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .site-header-account i:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'icon_border_hover',
'placeholder' => '1px',
'default' => '1px',
'selector' => '{{WRAPPER}} .site-header-account i:hover',
'separator' => 'before',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
$this->show_poup_hover_form( $settings );
}
protected function show_poup_hover_form( $settings ) {
$settings = wp_parse_args( $settings, [
'enable_label' => false,
'icon' => '',
'style' => '',
] );
$account_link = opalestate_my_account_page();
$id = rand( 2, 9 ) . rand( 0, 9 );
?>
<?php if ( ! is_user_logged_in() ) : ?>
<div class="elementor-dropdown site-header-account">
<div class="elementor-dropdown-header">
<?php
echo '<a href="' . esc_url( $account_link ) . '">
<i class="' . esc_attr( $settings['icon'] ) . '"></i>
' . ( $settings['enable_label'] && $settings['label_text'] ? '<span class="account-label">' . esc_html( $settings['label_text'] ) . '</span>' : '' ) . '
</a>';
?>
</div>
<div class="elementor-dropdown-menu" id="elementor-account-<?php echo esc_attr( $id ); ?>">
<div class="account-wrap">
<div class="account-inner dashboard">
<?php $this->render_form_login(); ?>
</div>
</div>
</div>
</div>
<?php else : ?>
<div class="elementor-dropdown site-header-account">
<div class="elementor-dropdown-header">
<div class="opalestate-user-greeting opalestate-popup hover-align-right">
<div class="popup-head">
<?php if ( $settings['logged_in_enable_avatar'] ) : ?>
<a href="#">
<?php $user_id = get_current_user_id(); ?>
<img src="<?php echo OpalEstate_User::get_author_picture( $user_id ); ?>"/>
<span class="notify active"></span>
</a>
<?php else : ?>
<?php
echo '<a href="#">
<i class="' . esc_attr( $settings['logged_in_icon'] ) . '"></i>
' . ( $settings['logged_in_enable_label'] && $settings['logged_in_label_text'] ? '<span class="account-label">' . esc_html( $settings['logged_in_label_text'] ) . '</span>' : '' ) . '
</a>';
?>
<?php endif; ?>
</div>
<div class="popup-body">
<div class="account-dashboard-content">
<?php $this->render_dashboard( $settings ); ?>
</div>
</div>
</div>
</div>
</div>
<?php endif;
}
protected function render_form_login() {
?>
<div class="login-form-head">
<span class="login-form-title"><?php esc_attr_e( 'Sign in', 'opalestate-pro' ) ?></span>
<span class="pull-right">
<a class="register-link" href="<?php echo esc_url( opalestate_my_account_page() ); ?>"
title="<?php esc_attr_e( 'Register', 'opalestate-pro' ); ?>"><?php esc_attr_e( 'Create an Account', 'opalestate-pro' ); ?></a>
</span>
</div>
<form class="opalestate-login-form opalestate-member-form" action="<?php echo esc_url( wp_login_url() ); ?>" method="POST">
<?php do_action( 'opalestate_member_before_login_form' ); ?>
<p>
<label><?php esc_attr_e( 'Username or email', 'opalestate-pro' ); ?> <span class="required">*</span></label>
<input name="username" type="text" required placeholder="<?php esc_attr_e( 'Username', 'opalestate-pro' ); ?>"
value="<?php echo isset( $_POST['username'] ) ? esc_attr( $_POST['username'] ) : ''; ?>">
</p>
<p>
<label><?php esc_attr_e( 'Password', 'opalestate-pro' ); ?> <span class="required">*</span></label>
<input name="password" type="password" required placeholder="<?php esc_attr_e( 'Password', 'opalestate-pro' ); ?>">
</p>
<?php do_action( 'opalestate_member_login_form' ); ?>
<p>
<input class="opalestate-input checkbox" name="rememberme" type="checkbox" value="forever"/> <?php esc_html_e( 'Remember me', 'opalestate-pro' ); ?>
</p>
<?php wp_nonce_field( 'opalestate-login', 'opalestate-login-nonce' ); ?>
<?php if ( isset( $redirect ) && $redirect ) : ?>
<input type="hidden" name="redirect" value="<?php echo esc_url( $redirect ); ?>">
<?php endif; ?>
<button type="submit" name="login" data-button-action class="btn btn-primary btn-block w-100 mt-1" value="<?php esc_html_e( 'Login', 'opalestate-pro' ); ?>">
<?php esc_html_e( 'Login', 'opalestate-pro' ); ?>
</button>
<?php do_action( 'login_form' ); ?>
<?php do_action( 'opalestate_member_after_login_form' ); ?>
</form>
<div class="login-form-bottom">
<a href="<?php echo wp_lostpassword_url( get_permalink() ); ?>" class="lostpass-link"
title="<?php esc_attr_e( 'Lost your password?', 'opalestate-pro' ); ?>"><?php esc_attr_e( 'Lost your password?', 'opalestate-pro' ); ?></a>
</div>
<?php
}
protected function render_dashboard( $settings ) { ?>
<?php if ( $settings['enable_custom_menu'] == 'yes' ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Dashboard', 'opalestate-pro' ); ?>">
<?php
wp_nav_menu( [
'theme_location' => $settings['menu'],
'menu_class' => 'account-links-menu',
'depth' => 1,
] );
?>
</nav><!-- .social-navigation -->
<?php else: ?>
<div class="account-dashboard">
<?php
if ( function_exists( 'opalestate_management_user_menu_tabs' ) ) {
opalestate_management_user_menu_tabs();
}
?>
</div>
<?php endif;
}
}

View File

@@ -0,0 +1,380 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Agency_Collection_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-agency-collection';
}
/**
* Retrieve the list of scripts the image carousel widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @since 1.3.0
* @access public
*
* @return array Widget scripts dependencies.
*/
public function get_script_depends() {
return [ 'jquery-slick' ];
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Agencies Collection', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'agencys_search_form',
[
'label' => esc_html__( 'Agencies Search/Collection', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__('Search Form', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => array(
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
)
]
);
$this->add_control(
'enable_sortable_bar',
[
'label' => esc_html__('Enable Sortable Bar', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'item_layout',
[
'label' => esc_html__('Item Layout', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'grid',
'options' => array(
'grid' => esc_html__( 'Grid', 'opalestate-pro' ),
'list' => esc_html__( 'List', 'opalestate-pro' ),
)
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__('Columns', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}'
],
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__('Enable', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
$this->add_slick_controls( array('enable_carousel' => 'yes') , ' .agency-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__('Query', 'opalestate-pro'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'posts_per_page',
[
'label' => esc_html__('Posts Per Page', 'opalestate-pro'),
'type' => Controls_Manager::NUMBER,
'default' => 6,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__('Advanced', 'opalestate-pro'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__('Order By', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'post_date' => esc_html__('Date', 'opalestate-pro'),
'post_title' => esc_html__('Title', 'opalestate-pro'),
'menu_order' => esc_html__('Menu Order', 'opalestate-pro'),
'rand' => esc_html__('Random', 'opalestate-pro'),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__('Order', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__('ASC', 'opalestate-pro'),
'desc' => esc_html__('DESC', 'opalestate-pro'),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__('Categories', 'opalestate-pro'),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_categories(),
'multiple' => true,
]
);
$this->add_control(
'cat_operator',
[
'label' => esc_html__('Category Operator', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'IN',
'options' => [
'AND' => esc_html__('AND', 'opalestate-pro'),
'IN' => esc_html__('IN', 'opalestate-pro'),
'NOT IN' => esc_html__('NOT IN', 'opalestate-pro'),
],
'condition' => [
'categories!' => ''
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_pagination',
[
'label' => esc_html__('Pagination', 'opalestate-pro'),
'condition' => [
'enable_carousel!' => 'yes'
],
]
);
$this->add_control(
'pagination_type',
[
'label' => esc_html__('Pagination', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__('None', 'opalestate-pro'),
'numbers' => esc_html__('Numbers', 'opalestate-pro'),
'prev_next' => esc_html__('Previous/Next', 'opalestate-pro'),
'numbers_and_prev_next' => esc_html__('Numbers', 'opalestate-pro') . ' + ' . esc_html__('Previous/Next', 'opalestate-pro'),
]
]
);
$this->add_control(
'pagination_page_limit',
[
'label' => esc_html__('Page Limit', 'opalestate-pro'),
'default' => '5',
'condition' => [
'pagination_type!' => ''
],
]
);
$this->add_control(
'pagination_numbers_shorten',
[
'label' => esc_html__('Shorten', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'pagination_type' => [
'numbers',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_prev_label',
[
'label' => esc_html__('Previous Label', 'opalestate-pro'),
'default' => esc_html__('&laquo; Previous', 'opalestate-pro'),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_next_label',
[
'label' => esc_html__('Next Label', 'opalestate-pro'),
'default' => esc_html__('Next &raquo;', 'opalestate-pro'),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_align',
[
'label' => esc_html__('Alignment', 'opalestate-pro'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__('Left', 'opalestate-pro'),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__('Center', 'opalestate-pro'),
'icon' => 'fa fa-align-center',
],
'flex-end' => [
'title' => esc_html__('Right', 'opalestate-pro'),
'icon' => 'fa fa-align-right',
],
],
'default' => 'flex-start',
'selectors' => [
'{{WRAPPER}} .pagination' => 'justify-content: {{VALUE}};',
],
'condition' => [
'pagination_type!' => '',
],
]
);
$this->end_controls_section();
}
public function get_post_categories() {
$list = array();
return $list;
}
}

View File

@@ -0,0 +1,380 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Agent_Collection_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-agent-collection';
}
/**
* Retrieve the list of scripts the image carousel widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @since 1.3.0
* @access public
*
* @return array Widget scripts dependencies.
*/
public function get_script_depends() {
return [ 'jquery-slick' ];
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Agent Collection', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'agents_search_form',
[
'label' => esc_html__( 'Agents Search Collection', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__('Search Form', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => array(
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
)
]
);
$this->add_control(
'enable_sortable_bar',
[
'label' => esc_html__('Enable Sortable Bar', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'item_layout',
[
'label' => esc_html__('Item Layout', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'grid',
'options' => array(
'grid' => esc_html__( 'Grid', 'opalestate-pro' ),
'list' => esc_html__( 'List', 'opalestate-pro' ),
)
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__('Columns', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}'
],
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__('Enable', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
$this->add_slick_controls( array('enable_carousel' => 'yes') , ' .agent-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__('Query', 'opalestate-pro'),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'posts_per_page',
[
'label' => esc_html__('Posts Per Page', 'opalestate-pro'),
'type' => Controls_Manager::NUMBER,
'default' => 6,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__('Advanced', 'opalestate-pro'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__('Order By', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'post_date' => esc_html__('Date', 'opalestate-pro'),
'post_title' => esc_html__('Title', 'opalestate-pro'),
'menu_order' => esc_html__('Menu Order', 'opalestate-pro'),
'rand' => esc_html__('Random', 'opalestate-pro'),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__('Order', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__('ASC', 'opalestate-pro'),
'desc' => esc_html__('DESC', 'opalestate-pro'),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__('Categories', 'opalestate-pro'),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_categories(),
'multiple' => true,
]
);
$this->add_control(
'cat_operator',
[
'label' => esc_html__('Category Operator', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => 'IN',
'options' => [
'AND' => esc_html__('AND', 'opalestate-pro'),
'IN' => esc_html__('IN', 'opalestate-pro'),
'NOT IN' => esc_html__('NOT IN', 'opalestate-pro'),
],
'condition' => [
'categories!' => ''
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_pagination',
[
'label' => esc_html__('Pagination', 'opalestate-pro'),
'condition' => [
'enable_carousel!' => 'yes'
],
]
);
$this->add_control(
'pagination_type',
[
'label' => esc_html__('Pagination', 'opalestate-pro'),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__('None', 'opalestate-pro'),
'numbers' => esc_html__('Numbers', 'opalestate-pro'),
'prev_next' => esc_html__('Previous/Next', 'opalestate-pro'),
'numbers_and_prev_next' => esc_html__('Numbers', 'opalestate-pro') . ' + ' . esc_html__('Previous/Next', 'opalestate-pro'),
]
]
);
$this->add_control(
'pagination_page_limit',
[
'label' => esc_html__('Page Limit', 'opalestate-pro'),
'default' => '5',
'condition' => [
'pagination_type!' => ''
],
]
);
$this->add_control(
'pagination_numbers_shorten',
[
'label' => esc_html__('Shorten', 'opalestate-pro'),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'pagination_type' => [
'numbers',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_prev_label',
[
'label' => esc_html__('Previous Label', 'opalestate-pro'),
'default' => esc_html__('&laquo; Previous', 'opalestate-pro'),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_next_label',
[
'label' => esc_html__('Next Label', 'opalestate-pro'),
'default' => esc_html__('Next &raquo;', 'opalestate-pro'),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_align',
[
'label' => esc_html__('Alignment', 'opalestate-pro'),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__('Left', 'opalestate-pro'),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__('Center', 'opalestate-pro'),
'icon' => 'fa fa-align-center',
],
'flex-end' => [
'title' => esc_html__('Right', 'opalestate-pro'),
'icon' => 'fa fa-align-right',
],
],
'default' => 'flex-start',
'selectors' => [
'{{WRAPPER}} .pagination' => 'justify-content: {{VALUE}};',
],
'condition' => [
'pagination_type!' => '',
],
]
);
$this->end_controls_section();
}
public function get_post_categories() {
$list = array();
return $list;
}
}

View File

@@ -0,0 +1,238 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Category_List_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-category-list';
}
/**
* Retrieve the list of scripts the image carousel widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @return array Widget scripts dependencies.
* @since 1.3.0
* @access public
*
*/
public function get_script_depends() {
return [ 'jquery-slick' ];
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Category Listing', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'category_search_form',
[
'label' => esc_html__( 'Category Collection', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__( 'Search Form', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
],
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__( 'Columns', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [ 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'enable_carousel!' => 'yes',
],
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
],
'condition' => [
'enable_carousel!' => 'yes',
],
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__( 'Enable Carousel', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
$this->add_slick_controls( [ 'enable_carousel' => 'yes' ], ' .agency-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__( 'Query', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__( 'Advanced', 'opalestate-pro' ),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__( 'Order By', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'term_id' => esc_html__( 'ID', 'opalestate-pro' ),
'name' => esc_html__( 'Name', 'opalestate-pro' ),
'count' => esc_html__( 'Count', 'opalestate-pro' ),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__( 'Order', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__( 'ASC', 'opalestate-pro' ),
'desc' => esc_html__( 'DESC', 'opalestate-pro' ),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__( 'Categories', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_categories(),
'multiple' => true,
]
);
$this->add_control(
'limit',
[
'label' => esc_html__( 'Limit', 'opalestate-pro' ),
'description' => esc_html__( 'Maximum number of terms to return.', 'opalestate-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => 5,
]
);
$this->end_controls_section();
}
protected function get_post_categories() {
$categories = Opalestate_Taxonomy_Categories::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
}

View File

@@ -0,0 +1,238 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_City_List_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-city-list';
}
/**
* Retrieve the list of scripts the image carousel widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @return array Widget scripts dependencies.
* @since 1.3.0
* @access public
*
*/
public function get_script_depends() {
return [ 'jquery-slick' ];
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: City Listing', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'category_search_form',
[
'label' => esc_html__( 'City Collection', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__( 'Search Form', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
],
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__( 'Columns', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [ 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'enable_carousel!' => 'yes',
],
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
],
'condition' => [
'enable_carousel!' => 'yes',
],
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__( 'Enable Carousel', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
$this->add_slick_controls( [ 'enable_carousel' => 'yes' ], ' .agency-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__( 'Query', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__( 'Advanced', 'opalestate-pro' ),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__( 'Order By', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'term_id' => esc_html__( 'ID', 'opalestate-pro' ),
'name' => esc_html__( 'Name', 'opalestate-pro' ),
'count' => esc_html__( 'Count', 'opalestate-pro' ),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__( 'Order', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__( 'ASC', 'opalestate-pro' ),
'desc' => esc_html__( 'DESC', 'opalestate-pro' ),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__( 'Cities', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_cities(),
'multiple' => true,
]
);
$this->add_control(
'limit',
[
'label' => esc_html__( 'Limit', 'opalestate-pro' ),
'description' => esc_html__( 'Maximum number of terms to return.', 'opalestate-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => 5,
]
);
$this->end_controls_section();
}
protected function get_post_cities() {
$categories = Opalestate_Taxonomy_City::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
}

View File

@@ -0,0 +1,141 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_form_builder_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-form-builder';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Search: Form Builder', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'form_builder_head',
[
'label' => esc_html__( 'Agency/Agent Tab Form Search', 'opalestate-pro' ),
]
);
$this->add_control(
'title',
[
'label' => esc_html__( 'Title', 'opalestate-pro' ),
'type' => Controls_Manager::TEXT,
]
);
$this->add_control(
'fields',
[
'label' => esc_html__( 'Brand Items', 'opalestate-pro' ),
'type' => Controls_Manager::REPEATER,
'fields' => [
[
'name' => 'field',
'label' => esc_html__( 'Field', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'options' => $this->field_types()
],
[
'name' => 'column',
'label' => esc_html__( 'Column', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'options'=> array(
'1' => 1,
'2' => 2,
'3' => 3,
'4' => 4,
'5' => 5,
'6' => 6,
'7' => 7,
'12' => 12
),
'default' => 4
]
]
]
);
$this->end_controls_section();
}
public function field_types() {
$files = glob( OPALESTATE_PLUGIN_DIR .'/templates/search-box/fields/*.php');
$output = array();
foreach ( $files as $field ) {
$name = str_replace(".php", "", basename( $field ) );
$label = ucfirst( str_replace( "-", " ", $name ) );
$output[$name] = $label;
}
return $output;
}
}

View File

@@ -0,0 +1,163 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_map_top_search_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-map-top-search';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Search: Maps Preview', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'map_preview_form',
[
'label' => esc_html__( 'Map Preview Form', 'opalestate-pro' ),
'description' => ' '
]
);
$this->add_control(
's_form_description',
[
'raw' => esc_html__( 'This is often used for building seach page, it combines with block => Search: Property Form, Search: Property Results.', 'opalestate-pro' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-descriptor',
]
);
$this->add_control(
'enable_static',
[
'label' => esc_html__('Enable Static Map', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'default' => ''
]
);
$this->add_control(
'static_mode_right',
[
'label' => esc_html__('Map On Right?', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'enable_static!' => ''
]
]
);
$this->add_responsive_control(
'map_width',
[
'label' => esc_html__( 'Map Width %', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 20,
'max' => 100,
],
'default'=>50
],
'selectors' => [
'{{WRAPPER}} .opalestate-map-preview-wrap' => 'Width: {{SIZE}}%'
],
'condition' => [
'enable_static!' => ''
]
]
);
$this->add_responsive_control(
'map_height',
[
'label' => esc_html__( 'Map Height', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 300,
'max' => 1200,
],
],
'selectors' => [
'{{WRAPPER}} #opalestate-map-preview' => 'min-height: {{SIZE}}{{UNIT}}!important'
]
]
);
$this->end_controls_section();
}
}

View File

@@ -0,0 +1,483 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Property_collection_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-property-collection';
}
/**
* Retrieve the list of scripts the image carousel widget depended on.
*
* Used to set scripts dependencies required to run the widget.
*
* @access public
*
*/
public function get_script_depends() {
return [ 'jquery-slick' ];
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Property Collection', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'head',
[
'label' => esc_html__( 'Property Collection', 'opalestate-pro' ),
]
);
$this->add_control(
'style',
[
'label' => esc_html__( 'Style Item Layout', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => $this->get_template_post_type(),
'default' => 'grid',
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__( 'Columns', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [ 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'enable_carousel' => '',
],
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
],
'condition' => [
'enable_carousel' => '',
],
]
);
$this->add_control(
'showmode',
[
'label' => esc_html__( 'Show', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => [
'featured' => esc_html__( 'Featured only', 'opalestate-pro' ),
'normal' => esc_html__( 'Without Featured', 'opalestate-pro' ),
'all' => esc_html__( 'All', 'opalestate-pro' ),
],
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__( 'Enable Carousel', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
$this->add_slick_controls( [ 'enable_carousel' => 'yes' ], ' .product-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__( 'Query', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'posts_per_page',
[
'label' => esc_html__( 'Posts Per Page', 'opalestate-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => 6,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__( 'Advanced', 'opalestate-pro' ),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__( 'Order By', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'post_date' => esc_html__( 'Date', 'opalestate-pro' ),
'post_title' => esc_html__( 'Title', 'opalestate-pro' ),
'menu_order' => esc_html__( 'Menu Order', 'opalestate-pro' ),
'rand' => esc_html__( 'Random', 'opalestate-pro' ),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__( 'Order', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__( 'ASC', 'opalestate-pro' ),
'desc' => esc_html__( 'DESC', 'opalestate-pro' ),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__( 'Categories', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_categories(),
'multiple' => true,
]
);
$this->add_control(
'cat_operator',
[
'label' => esc_html__( 'Category Operator', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'IN',
'options' => [
'AND' => esc_html__( 'AND', 'opalestate-pro' ),
'IN' => esc_html__( 'IN', 'opalestate-pro' ),
'NOT IN' => esc_html__( 'NOT IN', 'opalestate-pro' ),
],
'condition' => [
'categories!' => '',
],
]
);
$this->add_control(
'types',
[
'label' => esc_html__( 'Types', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_types(),
'multiple' => true,
]
);
$this->add_control(
'labels',
[
'label' => esc_html__( 'Lables', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_labels(),
'multiple' => true,
]
);
$this->add_control(
'statuses',
[
'label' => esc_html__( 'Status', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_statuses(),
'multiple' => true,
]
);
$this->add_control(
'cities',
[
'label' => esc_html__( 'Cities', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_cities(),
'multiple' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_pagination',
[
'label' => esc_html__( 'Pagination', 'opalestate-pro' ),
]
);
$this->add_control(
'pagination',
[
'label' => esc_html__( 'Pagination', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'None', 'opalestate-pro' ),
'show' => esc_html__( 'Show', 'opalestate-pro' ),
],
]
);
$this->add_control(
'pagination_page_limit',
[
'label' => esc_html__( 'Page Limit', 'opalestate-pro' ),
'default' => '5',
'condition' => [
'pagination_type!' => '',
],
]
);
// $this->add_control(
// 'pagination_numbers_shorten',
// [
// 'label' => esc_html__( 'Shorten', 'opalestate-pro' ),
// 'type' => Controls_Manager::SWITCHER,
// 'default' => '',
// 'condition' => [
// 'pagination_type' => [
// 'numbers',
// 'numbers_and_prev_next',
// ],
// ],
// ]
// );
//
// $this->add_control(
// 'pagination_prev_label',
// [
// 'label' => esc_html__( 'Previous Label', 'opalestate-pro' ),
// 'default' => esc_html__( '&laquo; Previous', 'opalestate-pro' ),
// 'condition' => [
// 'pagination_type' => [
// 'prev_next',
// 'numbers_and_prev_next',
// ],
// ],
// ]
// );
//
// $this->add_control(
// 'pagination_next_label',
// [
// 'label' => esc_html__( 'Next Label', 'opalestate-pro' ),
// 'default' => esc_html__( 'Next &raquo;', 'opalestate-pro' ),
// 'condition' => [
// 'pagination_type' => [
// 'prev_next',
// 'numbers_and_prev_next',
// ],
// ],
// ]
// );
// $this->add_control(
// 'pagination_align',
// [
// 'label' => esc_html__( 'Alignment', 'opalestate-pro' ),
// 'type' => Controls_Manager::CHOOSE,
// 'options' => [
// 'flex-start' => [
// 'title' => esc_html__( 'Left', 'opalestate-pro' ),
// 'icon' => 'fa fa-align-left',
// ],
// 'center' => [
// 'title' => esc_html__( 'Center', 'opalestate-pro' ),
// 'icon' => 'fa fa-align-center',
// ],
// 'flex-end' => [
// 'title' => esc_html__( 'Right', 'opalestate-pro' ),
// 'icon' => 'fa fa-align-right',
// ],
// ],
// 'default' => 'flex-start',
// 'selectors' => [
// '{{WRAPPER}} .pagination' => 'justify-content: {{VALUE}};',
// ],
// 'condition' => [
// 'pagination_type!' => '',
// ],
// ]
// );
$this->end_controls_section();
}
protected function get_post_labels() {
$categories = Opalestate_Taxonomy_Label::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_types() {
$categories = Opalestate_Taxonomy_Type::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_categories() {
$categories = Opalestate_Taxonomy_Categories::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_statuses() {
$categories = Opalestate_Taxonomy_Status::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_cities() {
$categories = Opalestate_Taxonomy_City::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
private function get_template_post_type() {
$folderes = glob( OPALESTATE_PLUGIN_DIR . '/templates/content-property-*' );
$output = [];
foreach ( $folderes as $folder ) {
$folder = str_replace( "content-property-", '', str_replace( '.php', '', wp_basename( $folder ) ) );
$value = str_replace( '_', ' ', str_replace( '-', ' ', ucfirst( $folder ) ) );
$output[ $folder ] = $value;
}
return $output;
}
}

View File

@@ -0,0 +1,160 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Search_Agency_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-search-agency';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Agency - Search Form', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'agency_search_form',
[
'label' => esc_html__( 'Agency Search Form', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__('Search Form', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => array(
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
)
]
);
$this->add_control(
'current_uri',
[
'label' => esc_html__('Target Submit Page', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 1,
'options' => array(
1 => esc_html__( 'Current Page', 'opalestate-pro' ),
0 => esc_html__( 'Global Agent Search Page', 'opalestate-pro' ),
)
]
);
$this->add_control(
'item_layout',
[
'label' => esc_html__('Item Layout', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'grid',
'options' => array(
'grid' => esc_html__( 'Grid', 'opalestate-pro' ),
'list' => esc_html__( 'List', 'opalestate-pro' ),
)
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__('Columns', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}'
],
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->end_controls_section();
}
}

View File

@@ -0,0 +1,160 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Search_Agents_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-search-agents';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Agents - Search Form', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'agents_search_form',
[
'label' => esc_html__( 'Agents Search Form', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__('Search Form', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => array(
'' => esc_html__( 'Advanded', 'opalestate-pro' ),
'address' => esc_html__( 'Search By Address', 'opalestate-pro' ),
)
]
);
$this->add_control(
'current_uri',
[
'label' => esc_html__('Target Submit Page', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 1,
'options' => array(
1 => esc_html__( 'Current Page', 'opalestate-pro' ),
0 => esc_html__( 'Global Agent Search Page', 'opalestate-pro' ),
)
]
);
$this->add_control(
'item_layout',
[
'label' => esc_html__('Item Layout', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'grid',
'options' => array(
'grid' => esc_html__( 'Grid', 'opalestate-pro' ),
'list' => esc_html__( 'List', 'opalestate-pro' ),
)
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__('Columns', 'opalestate-pro'),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}'
],
'condition' => [
'item_layout' => 'grid'
]
]
);
$this->end_controls_section();
}
}

View File

@@ -0,0 +1,466 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_search_property_results_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-search-property-results';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Search: Property Results', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'head',
[
'label' => esc_html__( 'Show Collection as Default Results', 'opalestate-pro' ),
]
);
$this->add_control(
's_form_description',
[
'raw' => esc_html__( 'This is often used for building seach page, it combines with block => Search: Property Form, Search:Map Preview.', 'opalestate-pro' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-descriptor',
]
);
$this->add_control(
'style',
[
'label' => esc_html__( 'Style Item Layout', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => $this->get_template_post_type(),
'default' => 'grid',
]
);
$this->add_control(
'column',
[
'label' => esc_html__( 'Columns', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [ 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ],
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
],
'condition' => [
'enable_carousel' => '',
],
]
);
$this->add_control(
'enable_carousel',
[
'label' => esc_html__( 'Enable Carousel', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->end_controls_section();
/// $this->add_slick_controls( array('enable_carousel' => 'yes') , ' .product-slick-carousel ' );
$this->start_controls_section(
'section_query',
[
'label' => esc_html__( 'Query', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'posts_per_page',
[
'label' => esc_html__( 'Posts Per Page', 'opalestate-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => 6,
]
);
$this->add_control(
'advanced',
[
'label' => esc_html__( 'Advanced', 'opalestate-pro' ),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'orderby',
[
'label' => esc_html__( 'Order By', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'post_date',
'options' => [
'post_date' => esc_html__( 'Date', 'opalestate-pro' ),
'post_title' => esc_html__( 'Title', 'opalestate-pro' ),
'menu_order' => esc_html__( 'Menu Order', 'opalestate-pro' ),
'rand' => esc_html__( 'Random', 'opalestate-pro' ),
],
]
);
$this->add_control(
'order',
[
'label' => esc_html__( 'Order', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'desc',
'options' => [
'asc' => esc_html__( 'ASC', 'opalestate-pro' ),
'desc' => esc_html__( 'DESC', 'opalestate-pro' ),
],
]
);
$this->add_control(
'categories',
[
'label' => esc_html__( 'Categories', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_categories(),
'multiple' => true,
]
);
$this->add_control(
'cat_operator',
[
'label' => esc_html__( 'Category Operator', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'IN',
'options' => [
'AND' => esc_html__( 'AND', 'opalestate-pro' ),
'IN' => esc_html__( 'IN', 'opalestate-pro' ),
'NOT IN' => esc_html__( 'NOT IN', 'opalestate-pro' ),
],
'condition' => [
'categories!' => '',
],
]
);
$this->add_control(
'types',
[
'label' => esc_html__( 'Types', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_types(),
'multiple' => true,
]
);
$this->add_control(
'labels',
[
'label' => esc_html__( 'Lables', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_labels(),
'multiple' => true,
]
);
$this->add_control(
'statuses',
[
'label' => esc_html__( 'Status', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_statuses(),
'multiple' => true,
]
);
$this->add_control(
'cities',
[
'label' => esc_html__( 'Cities', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->get_post_cities(),
'multiple' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_pagination',
[
'label' => esc_html__( 'Pagination', 'opalestate-pro' ),
]
);
$this->add_control(
'pagination_type',
[
'label' => esc_html__( 'Pagination', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'None', 'opalestate-pro' ),
'numbers' => esc_html__( 'Numbers', 'opalestate-pro' ),
'prev_next' => esc_html__( 'Previous/Next', 'opalestate-pro' ),
'numbers_and_prev_next' => esc_html__( 'Numbers', 'opalestate-pro' ) . ' + ' . esc_html__( 'Previous/Next', 'opalestate-pro' ),
],
]
);
$this->add_control(
'pagination_page_limit',
[
'label' => esc_html__( 'Page Limit', 'opalestate-pro' ),
'default' => '5',
'condition' => [
'pagination_type!' => '',
],
]
);
$this->add_control(
'pagination_numbers_shorten',
[
'label' => esc_html__( 'Shorten', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'pagination_type' => [
'numbers',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_prev_label',
[
'label' => esc_html__( 'Previous Label', 'opalestate-pro' ),
'default' => esc_html__( '&laquo; Previous', 'opalestate-pro' ),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_next_label',
[
'label' => esc_html__( 'Next Label', 'opalestate-pro' ),
'default' => esc_html__( 'Next &raquo;', 'opalestate-pro' ),
'condition' => [
'pagination_type' => [
'prev_next',
'numbers_and_prev_next',
],
],
]
);
$this->add_control(
'pagination_align',
[
'label' => esc_html__( 'Alignment', 'opalestate-pro' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'opalestate-pro' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'opalestate-pro' ),
'icon' => 'fa fa-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'opalestate-pro' ),
'icon' => 'fa fa-align-right',
],
],
'default' => 'flex-start',
'selectors' => [
'{{WRAPPER}} .pagination' => 'justify-content: {{VALUE}};',
],
'condition' => [
'pagination_type!' => '',
],
]
);
$this->end_controls_section();
}
protected function get_post_labels() {
$categories = Opalestate_Taxonomy_Label::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_types() {
$categories = Opalestate_Taxonomy_Type::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_categories() {
$categories = Opalestate_Taxonomy_Categories::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_statuses() {
$categories = Opalestate_Taxonomy_Status::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
protected function get_post_cities() {
$categories = Opalestate_Taxonomy_City::get_list();
$results = [];
if ( ! is_wp_error( $categories ) ) {
foreach ( $categories as $category ) {
$results[ $category->slug ] = $category->name;
}
}
return $results;
}
private function get_template_post_type() {
$folderes = glob( OPALESTATE_PLUGIN_DIR . '/templates/content-property-*' );
$output = [];
foreach ( $folderes as $folder ) {
$folder = str_replace( "content-property-", '', str_replace( '.php', '', wp_basename( $folder ) ) );
$value = str_replace( '_', ' ', str_replace( '-', ' ', ucfirst( $folder ) ) );
$output[ $folder ] = $value;
}
return $output;
}
}

View File

@@ -0,0 +1,386 @@
<?php
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Searchbox_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-searchbox';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Search: Property Form ', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'property_search_form',
[
'label' => esc_html__( 'Property Search Form', 'opalestate-pro' ),
]
);
$this->add_control(
's_form_description',
[
'raw' => esc_html__( 'This is often used for building seach page, it combines with block => Search: Map Preview, Search: Property Results.', 'opalestate-pro' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-descriptor',
]
);
$this->add_control(
'style',
[
'label' => esc_html__( 'Layout', 'opalestate-pro' ),
'type' => Controls_Manager::SELECT,
'options' => opalestate_search_properties_form_styles(),
'default' => 'search-form-h',
]
);
$this->add_control(
'hidden_labels',
[
'label' => esc_html__( 'Disable Labels', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$this->add_control(
'nobutton',
[
'label' => esc_html__( 'Disable Search button', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'display_country',
[
'label' => esc_html__( 'Display Country select', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'style' => $this->has_location_fields(),
],
]
);
$this->add_control(
'display_state',
[
'label' => esc_html__( 'Display State select', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'style' => $this->has_location_fields(),
],
]
);
$this->add_control(
'display_city',
[
'label' => esc_html__( 'Display City select', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'style' => $this->has_location_fields(),
],
]
);
$this->add_control(
'display_more_options',
[
'label' => esc_html__( 'Display More Options', 'opalestate-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_label_style_content',
[
'label' => esc_html__( 'Label', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_label_style' );
$this->start_controls_tab(
'tab_label_normal',
[
'label' => __( 'Normal', 'opalestate-pro' ),
]
);
$this->add_control(
'title_color',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form label.opalestate-label' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .opalestate-search-form label.opalestate-label',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_label_hover',
[
'label' => __( 'Hover', 'opalestate-pro' ),
]
);
$this->add_control(
'title_color_hover',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form label.opalestate-label:hover' => 'color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
$this->start_controls_section(
'section_input_style_content',
[
'label' => esc_html__( 'Input', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_control(
'input_color',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form input, {{WRAPPER}} .opalestate-search-form input::placeholder, {{WRAPPER}} .opalestate-search-form select, {{WRAPPER}} .opalestate-search-form .select2-container--default .select2-selection--single .select2-selection__rendered, {{WRAPPER}} .opalestate-search-form .opalestate-popup .popup-head > span' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'input_background_color',
[
'label' => esc_html__( 'Background color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form input, {{WRAPPER}} .opalestate-search-form select, {{WRAPPER}} .opalestate-search-form .select2-container.select2-container--default .select2-selection--single' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'input_border_color',
[
'label' => esc_html__( 'Border color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form input, {{WRAPPER}} .opalestate-search-form select, {{WRAPPER}} .opalestate-search-form .select2-container.select2-container--default .select2-selection--single' => 'border-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'input_typography',
'selector' => '{{WRAPPER}} .opalestate-search-form input, {{WRAPPER}} .opalestate-search-form select, {{WRAPPER}} .opalestate-search-form .select2-container.select2-container--default .select2-selection--single',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_button_style_content',
[
'label' => esc_html__( 'Button', 'opalestate-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->start_controls_tabs( 'tabs_button_style' );
$this->start_controls_tab(
'tab_button_normal',
[
'label' => __( 'Normal', 'opalestate-pro' ),
]
);
$this->add_control(
'button_color',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form .btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_background_color',
[
'label' => esc_html__( 'Background color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form .btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .opalestate-search-form .btn.btn-search',
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_button_hover',
[
'label' => __( 'Hover', 'opalestate-pro' ),
]
);
$this->add_control(
'button_color_hover',
[
'label' => esc_html__( 'Color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form .btn:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_background_color_hover',
[
'label' => esc_html__( 'Background color', 'opalestate-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .opalestate-search-form .btn:hover' => 'background-color: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function has_location_fields() {
return [
'search-form-h',
'advanced-v2',
'advanced-v3',
'advanced-v4',
'search-form-v',
'search-form-v3',
'collapse-keyword',
];
}
}

View File

@@ -0,0 +1,131 @@
<?php
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon box widget.
*
* Elementor widget that displays an icon, a headline and a text.
*
*/
class Opalestate_Split_maps_search_Elementor_Widget extends Opalestate_Elementor_Widget_Base {
/**
* Get widget name.
*
* Retrieve icon box widget name.
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'opalestate-split-maps-search';
}
/**
* Get widget title.
*
* Retrieve icon box widget title.
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Block: Split Maps Property Search', 'opalestate-pro' );
}
/**
* Get widget icon.
*
* Retrieve icon box widget icon.
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return apply_filters( 'opalestate_' . $this->get_name(), 'eicon-search' );
}
/**
* Get widget keywords.
*
* Retrieve the list of keywords the widget belongs to.
*
* @access public
*
* @return array Widget keywords.
*/
public function get_keywords() {
return [ 'opalestate-pro', 'search' ];
}
/**
* Register icon box widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section(
'agents_search_form',
[
'label' => esc_html__( 'Search Form', 'opalestate-pro' ),
]
);
$this->add_control(
'search_form',
[
'label' => esc_html__( 'Search Form', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'advanced-v2',
'options' => opalestate_search_properties_form_styles(),
]
);
$this->add_responsive_control(
'column',
[
'label' => esc_html__( 'Columns', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 3,
'options' => [ 1 => 1, 2 => 2, 3 => 3, 4 => 4, 6 => 6 ],
'prefix_class' => 'elementor-grid%s-',
'condition' => [
'item_layout' => 'grid',
],
]
);
$this->add_control(
'column_gap',
[
'label' => esc_html__( 'Columns Gap', 'opalestate-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .elementor-items-container' => 'grid-column-gap: {{SIZE}}{{UNIT}}',
],
'condition' => [
'item_layout' => 'grid',
],
]
);
$this->end_controls_section();
}
}