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,83 @@
<?php
/**
* $Desc
*
* @version $Id$
* @package wpbase
* @author 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/questions/
*/
class Opalestate_featured_properties_Widget extends WP_Widget{
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_featured_properties_widget',
// Widget name will appear in UI
esc_html__('Estate: Featured Properties', 'opalestate-pro'),
// Widget description
array( 'description' => esc_html__( 'Featured Properties widget.', 'opalestate-pro' ), )
);
}
public function widget( $args, $instance ) {
extract( $args );
extract( $instance );
//Check
$tpl = OPALESTATE_THEMER_WIDGET_TEMPLATES .'widgets/featured-properties.php';
$tpl_default = OPALESTATE_PLUGIN_DIR .'templates/widgets/featured-properties.php';
if( is_file($tpl) ) {
$tpl_default = $tpl;
}
require $tpl_default;
}
// Form
public function form( $instance ) {
//Set up some default widget settings.
$defaults = array(
'title' => esc_html__('Featured Properties', 'opalestate-pro'),
'num' => '5'
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e('Title:', 'opalestate-pro'); ?></label>
<input type="text" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('num')); ?>"><?php esc_html_e('Limit:', 'opalestate-pro'); ?></label>
<br>
<input id="<?php echo esc_attr($this->get_field_id('num')); ?>" name="<?php echo esc_attr($this->get_field_name('num')); ?>" type="text" value="<?php echo esc_attr( $instance['num'] ); ?>" />
</p>
<?php
}
//Update the widget
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['num'] = $new_instance['num'];
return $instance;
}
}
register_widget( 'Opalestate_featured_properties_Widget' );
?>

View File

@@ -0,0 +1,62 @@
<?php
/**
* Mortgage widget.
*
* A helper class for outputting common HTML elements, such as product drop downs
*
* @package Opalestate
* @since 1.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Opalestate_Mortgage_Calculator_Widget' ) ) {
class Opalestate_Mortgage_Calculator_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_mortgage_calculate_widget',
// Widget name will appear in UI
__( 'Estate: Mortgage Calculator', 'opalestate-pro' ),
// Widget description
[ 'description' => esc_html__( 'Mortgage Calculator widget.', 'opalestate-pro' ), ]
);
}
public function widget( $instance, $args ) {
extract( $args );
extract( $instance );
//Check
$tpl = OPALESTATE_THEMER_WIDGET_TEMPLATES . 'parts/mortgage-calculator.php';
$tpl_default = OPALESTATE_PLUGIN_DIR . 'templates/parts/mortgage-calculator.php';
if ( is_file( $tpl ) ) {
$tpl_default = $tpl;
}
require $tpl_default;
}
public function form( $instance ) {
//Set up some default widget settings.
$defaults = [
'title' => esc_html__( 'Mortgage Calculator', 'opalestate-pro' ),
];
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'opalestate-pro' ); ?></label>
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" style="width:100%;"/>
</p>
<?php
}
}
}
register_widget( 'Opalestate_Mortgage_Calculator_Widget' );

103
inc/widgets/profile-info.php Executable file
View File

@@ -0,0 +1,103 @@
<?php
/**
* $Desc
*
* @version $Id$
* @package wpbase
* @author 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/questions/
*/
class Opalestate_profile_info_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_profile_info_widget',
// Widget name will appear in UI
esc_html__( 'Estate: User Menu Profile', 'opalestate-pro' ),
// Widget description
[ 'description' => esc_html__( 'Display Profile information in box and menu.', 'opalestate-pro' ), ]
);
}
/**
*
*/
public function widget( $args, $instance ) {
global $before_widget, $after_widget, $before_title, $after_title, $post;
if ( ! is_user_logged_in() ) {
return;
}
extract( $args );
$title = apply_filters( 'widget_title', $instance['title'] );
echo( $before_widget );
if ( $title ) {
echo ( $before_title ) . $title . ( $after_title );
}
?>
<div class="widget-body">
<?php
global $current_user;
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
?>
<div class="profile-menu">
<?php opalestate_management_user_menu(); ?>
</div>
<?php }
?>
</div>
<?php
echo( $after_widget );
}
/**
* Form
*/
public function form( $instance ) {
//Set up some default widget settings.
$defaults = [
'title' => esc_html__( 'My Profile', 'opalestate-pro' ),
];
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'opalestate-pro' ); ?></label>
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" style="width:100%;"/>
</p>
<?php
}
//Update the widget
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['num'] = $new_instance['num'];
return $instance;
}
}
register_widget( 'Opalestate_profile_info_Widget' );
?>

View File

@@ -0,0 +1,92 @@
<?php
/**
* $Desc
*
* @version $Id$
* @package wpbase
* @author 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/questions/
*/
class Opalestate_sammeprice_properties_Widget extends WP_Widget{
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_samepriceproperties_widget',
// Widget name will appear in UI
esc_html__('Estate: Same Price', 'opalestate-pro'),
// Widget description
array( 'description' => esc_html__( 'Similar Properties By Same Price with configured range and Status', 'opalestate-pro' ), )
);
}
public function widget( $instance , $args ) {
$default = array(
'num' => 5,
'range_price' => 100,
);
$args = array_merge( $default , $args );
extract( $args );
extract( $instance );
//Check
$tpl = OPALESTATE_THEMER_WIDGET_TEMPLATES .'widgets/sameprice-properties.php';
$tpl_default = OPALESTATE_PLUGIN_DIR .'templates/widgets/sameprice-properties.php';
if( is_file($tpl) ) {
$tpl_default = $tpl;
}
require $tpl_default;
}
// Form
public function form( $instance ) {
//Set up some default widget settings.
$defaults = array(
'title' => esc_html__('Same Price', 'opalestate-pro'),
'num' => '5',
'range_price' => 1000
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e('Title:', 'opalestate-pro'); ?></label>
<input type="text" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('num')); ?>"><?php echo esc_html_e('Limit:', 'opalestate-pro'); ?></label>
<br>
<input id="<?php echo esc_attr($this->get_field_id('num')); ?>" name="<?php echo esc_attr($this->get_field_name('num')); ?>" type="text" value="<?php echo esc_attr( $instance['num'] ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('range_price')); ?>"><?php echo esc_html__('Range Price:', 'opalestate-pro'); ?></label>
<br>
<input id="<?php echo esc_attr($this->get_field_id('range_price')); ?>" name="<?php echo esc_attr($this->get_field_name('range_price')); ?>" type="text" value="<?php echo esc_attr( $instance['range_price'] ); ?>" />
</p>
<?php
}
//Update the widget
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['num'] = $new_instance['num'];
$instance['range_price'] = $new_instance['range_price'];
return $instance;
}
}
register_widget( 'Opalestate_sammeprice_properties_Widget' );
?>

153
inc/widgets/search-properties.php Executable file
View File

@@ -0,0 +1,153 @@
<?php
/**
* Opalestate_search_properties_Widget
*
* @package wpbase
* @author 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/questions/
*/
class Opalestate_search_properties_Widget extends WP_Widget {
/**
* Opalestate_search_properties_Widget constructor.
*/
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_search_properties_widget',
// Widget name will appear in UI
__( 'Estate: Search Properties', 'opalestate-pro' ),
// Widget description
[ 'description' => esc_html__( 'Search Properties widget.', 'opalestate-pro' ), ]
);
}
public function widget( $args, $instance ) {
extract( $args );
extract( $instance );
//Our variables from the widget settings.
$title = apply_filters( 'widget_title', esc_attr( $instance['title'] ) );
// Output the widget.
echo $before_widget; // @WPCS: XSS OK.
if ( $title ) {
echo $before_title . $title . $after_title; // @WPCS: XSS OK.
}
?>
<div class="search-properies-form">
<?php echo opalestate_load_template_path( 'search-box/' . $instance['style'], $instance ); ?>
</div>
<?php
echo $after_widget; // WPCS: XSS OK.
}
// Form
public function form( $instance ) {
//Set up some default widget settings.
$defaults = [
'title' => esc_html__( 'Search Properties', 'opalestate-pro' ),
'hidden_labels' => 'true',
'nobutton' => '',
'style' => 'search-form-v',
'display_country' => true,
'display_state' => '',
'display_city' => '',
];
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'opalestate-pro' ); ?></label>
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" style="width:100%;"/>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'style' ) ); ?>"><?php esc_html_e( 'Layout', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'style' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'style' ) ); ?>">
<?php foreach ( opalestate_search_properties_form_styles() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['style'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'hidden_labels' ) ); ?>"><?php esc_html_e( 'Disable Labels', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'hidden_labels' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hidden_labels' ) ); ?>">
<?php foreach ( $this->get_boolean_options() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['hidden_labels'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'nobutton' ) ); ?>"><?php esc_html_e( 'Disable Search button', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'nobutton' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'nobutton' ) ); ?>">
<?php foreach ( $this->get_boolean_options() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['nobutton'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'display_country' ) ); ?>"><?php esc_html_e( 'Display Country select', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_country' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'display_country' ) ); ?>">
<?php foreach ( $this->get_boolean_options() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['display_country'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'display_state' ) ); ?>"><?php esc_html_e( 'Display State select', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_state' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'display_state' ) ); ?>">
<?php foreach ( $this->get_boolean_options() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['display_state'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'display_city' ) ); ?>"><?php esc_html_e( 'Display City select', 'opalestate-pro' ); ?></label>
<select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display_city' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'display_city' ) ); ?>">
<?php foreach ( $this->get_boolean_options() as $option_key => $option_value ) : ?>
<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $instance['display_city'] ); ?>><?php echo esc_html( $option_value ); ?></option>
<?php endforeach; ?>
</select>
</p>
<?php
}
//Update the widget
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['hidden_labels'] = strip_tags( $new_instance['hidden_labels'] );
$instance['nobutton'] = strip_tags( $new_instance['nobutton'] );
$instance['style'] = strip_tags( $new_instance['style'] );
$instance['display_country'] = strip_tags( $new_instance['display_country'] );
$instance['display_state'] = strip_tags( $new_instance['display_state'] );
$instance['display_city'] = strip_tags( $new_instance['display_city'] );
return $instance;
}
protected function get_boolean_options() {
return [
'' => esc_html__( 'No', 'opalestate-pro' ),
'true' => esc_html__( 'Yes', 'opalestate-pro' ),
];
}
}
register_widget( 'Opalestate_search_properties_Widget' );

View File

@@ -0,0 +1,82 @@
<?php
/**
* $Desc
*
* @version $Id$
* @package wpbase
* @author 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/questions/
*/
class Opalestate_similar_properties_Widget extends WP_Widget{
public function __construct() {
parent::__construct(
// Base ID of your widget
'opalestate_similarproperties_widget',
// Widget name will appear in UI
esc_html__('Estate: Similar Properties', 'opalestate-pro'),
// Widget description
array( 'description' => esc_html__( 'Similar Properties By Same Types and Status Of the post', 'opalestate-pro' ), )
);
}
public function widget( $args, $instance ) {
extract( $args );
extract( $instance );
//Check
$tpl = OPALESTATE_THEMER_WIDGET_TEMPLATES .'widgets/similar-properties.php';
$tpl_default = OPALESTATE_PLUGIN_DIR .'templates/widgets/similar-properties.php';
if( is_file($tpl) ) {
$tpl_default = $tpl;
}
require $tpl_default;
}
// Form
public function form( $instance ) {
//Set up some default widget settings.
$defaults = array(
'title' => esc_html__('Similar Properties', 'opalestate-pro'),
'num' => '5'
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e('Title:', 'opalestate-pro'); ?></label>
<input type="text" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" value="<?php echo esc_attr($instance['title']); ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('num')); ?>"><?php esc_html_e('Limit:', 'opalestate-pro'); ?></label>
<br>
<input id="<?php echo esc_attr($this->get_field_id('num')); ?>" name="<?php echo esc_attr($this->get_field_name('num')); ?>" type="text" value="<?php echo esc_attr( $instance['num'] ); ?>" />
</p>
<?php
}
//Update the widget
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
//Strip tags from title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['num'] = $new_instance['num'];
return $instance;
}
}
register_widget( 'Opalestate_similar_properties_Widget' );
?>