File: /mnt/data/doccure-wp/wp-content/plugins/doccure-elementor/widgets/class-hero-five.php
<?php
/**
* Awesomesauce class.
*
* @category Class
* @package ElementorAwesomesauce
* @subpackage WordPress
* @author Ben Marshall <[email protected]>
* @copyright 2020 Ben Marshall
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0-only
* @link link(https://www.benmarshall.me/build-custom-elementor-widgets/,
* Build Custom Elementor Widgets)
* @since 1.0.0
* php version 7.3.9
*/
namespace ElementorDoccure\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Scheme_Color;
if ( ! defined( 'ABSPATH' ) ) {
// Exit if accessed directly.
exit;
}
/**
* Awesomesauce widget class.
*
* @since 1.0.0
*/
class HomeHeroFive extends Widget_Base {
/**
* Retrieve the widget name.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'HomeHeroFive';
}
/**
* Retrieve the widget title.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Doccure Hero 5', 'doccure_elementor' );
}
/**
* Retrieve the widget icon.
*
* @since 1.0.0
*
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-gallery-group';
}
/**
* Retrieve the list of categories the widget belongs to.
*
* Used to determine where to display the widget in the editor.
*
* Note that currently Elementor supports only one category.
* When multiple categories passed, Elementor uses the first one.
*
* @since 1.0.0
*
* @access public
*
* @return array Widget categories.
*/
public function get_categories() {
return array( 'doccure' );
}
/**
* Register the widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 1.0.0
*
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'content_section2',
[
'label' => __( 'Backgrounds Section', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'bg_1',
[
'label' => __( 'Background', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_section1',
[
'label' => __( 'Left Ratings Section', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'shape_1',
[
'label' => __( 'User image 1', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'shape_2',
[
'label' => __( 'User image 2', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'shape_3',
[
'label' => __( 'User image 3', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'appoinment_title',
array(
'label' => __( 'Appoinment Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '5K+ Appointments', 'doccure_elementor' ),
)
);
$this->add_control(
'ratings_title',
array(
'label' => __( 'Ratings Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '5.0 Ratings', 'doccure_elementor' ),
)
);
$this->end_controls_section();
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title',
array(
'label' => __( 'Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Discover Health: Find Your Trusted ', 'doccure_elementor' ),
)
);
$this->add_control(
'color_title',
array(
'label' => __( 'Color Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Doctors ', 'doccure_elementor' ),
)
);
$this->add_control(
'last_title',
array(
'label' => __( 'Title Last', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Today ', 'doccure_elementor' ),
)
);
$this->add_control(
'title_image',
[
'label' => __( 'Choose Title icon', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_section3',
[
'label' => __( 'Right Content', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'app_title',
array(
'label' => __( 'Appointments Title', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Appointments <span class="d-block">Completed <span>', 'doccure_elementor' ),
)
);
$this->add_control(
'app_title_count',
array(
'label' => __( 'Appointments Count', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '1K ', 'doccure_elementor' ),
)
);
$this->add_control(
'right_image',
[
'label' => __( 'Banner Right Image', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'right_image_back',
[
'label' => __( 'Banner Right Background Image', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'satis_title',
array(
'label' => __( 'Satisfied Patients', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Satisfied Patients ', 'doccure_elementor' ),
)
);
$this->add_control(
'satis_title_count',
array(
'label' => __( 'Satisfied Patients Counts', 'doccure_elementor' ),
'type' => Controls_Manager::TEXT,
'default' => __( '15K+', 'doccure_elementor' ),
)
);
$this->add_control(
'satis_user1',
[
'label' => __( 'Satisfied User 1', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'satis_user2',
[
'label' => __( 'Satisfied User 2', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'satis_user3',
[
'label' => __( 'Satisfied User 3', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'content_section4',
[
'label' => __( 'Banner Images', 'plugin-name' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'extra_image1',
[
'label' => __( 'Image 1', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'extra_image2',
[
'label' => __( 'Image 2', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'extra_image3',
[
'label' => __( 'Image 3', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'extra_image4',
[
'label' => __( 'Image 4', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->add_control(
'extra_image5',
[
'label' => __( 'Image 5', 'dreamslms_elementor' ),
'type' => \Elementor\Controls_Manager::MEDIA,
'default' => [
'url' => \Elementor\Utils::get_placeholder_image_src(),
]
]
);
$this->end_controls_section();
}
/**
* Render the widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
*
* @access protected
*/
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes( 'title', 'none' );
$this->add_inline_editing_attributes( 'subtitle', 'none' );
?>
<!-- Banner
================================================== -->
<!-- Home Banner -->
<section class="banner-section banner-sec-one" <?php if(isset($settings['bg_1']['url']) && !empty(isset($settings['bg_1']['url']))){ ?> style="background: url('<?php echo esc_url($settings['bg_1']['url']);?>' ) no-repeat; <?php } ?> ">
<div class="container">
<div class="row ">
<div class="col-lg-8">
<div class="banner-content aos" data-aos="fade-up">
<div class="rating-appointment d-inline-flex align-items-center gap-2">
<div class="avatar-list-stacked avatar-group-lg">
<span class="avatar avatar-rounded">
<img class="border border-white" src="<?php echo esc_url($settings['shape_1']['url']); ?>" alt="img">
</span>
<span class="avatar avatar-rounded">
<img class="border border-white" src="<?php echo esc_url($settings['shape_2']['url']); ?>" alt="img">
</span>
<span class="avatar avatar-rounded">
<img src="<?php echo esc_url($settings['shape_3']['url']); ?>" alt="img">
</span>
</div>
<div class="me-2">
<h6 class="mb-0"><?php echo $settings['appoinment_title']; ?></h6>
<div class="d-flex align-items-center">
<div class="d-flex align-items-center">
<i class="fa-solid fa-star text-orange me-1"></i>
<i class="fa-solid fa-star text-orange me-1"></i>
<i class="fa-solid fa-star text-orange me-1"></i>
<i class="fa-solid fa-star text-orange me-1"></i>
<i class="fa-solid fa-star text-orange me-1"></i>
</div>
<p><?php echo $settings['ratings_title']; ?></p>
</div>
</div>
</div>
<h1 class="display-5"><?php echo $settings['title']; ?><span class="banner-icon"><img src="<?php echo esc_url($settings['title_image']['url']); ?>" alt="img"></span> <span class="text-gradient"><?php echo $settings['color_title']; ?></span> <?php echo $settings['last_title']; ?></h1>
<?php
global $doccure_options;
$hide_location = !empty($doccure_options['hide_location']) ? $doccure_options['hide_location'] : 'no';
$search_settings = !empty( $doccure_options['search_form'] ) ? $doccure_options['search_form'] : '';
$search_option = !empty($doccure_options['search_type']) ? $doccure_options['search_type'] : '';
$search_type = !empty($doccure_options['search_type']) ? $doccure_options['search_type'] : '';
$gender_search = array_key_exists('gender_search', (array)$doccure_options) ? (bool)$doccure_options['gender_search'] : true;
$specialities_search = array_key_exists('specialities_search', (array)$doccure_options) ? (bool)$doccure_options['specialities_search'] : true;
$search_page = doccure_get_search_page_uri('doctors');
ob_start();
if( !empty($search_settings) ){?>
<div class="search-box-five aos" data-aos="fade-up">
<form action="<?php echo $search_page; ?>" method="get" id="search_form">
<div class="search-input-five search-line-five">
<i class="isax isax-hospital5 bficon"></i>
<div class=" mb-0">
<input type="hidden" name="searchby" class="form-control" value="both">
<input type="text" name="keyword" class="form-control" placeholder="<?php esc_html_e('Search doctors, clinics, hospitals, etc','doccure_elementor');?>" value="">
</div>
</div>
<div class="search-input-five search-map-line">
<i class="isax isax-location5"></i>
<div class=" mb-0">
<!-- <input type="text" class="form-control" placeholder="Location"> -->
<?php do_action('doccure_get_search_locations_home5');?>
</div>
</div>
<div class="search-input-five search-calendar-line">
<i class="isax isax isax-user"></i>
<div class=" mb-0">
<!-- <input type="text" class="form-control datetimepicker" placeholder="Date"> -->
<?php
if ( $gender_search ) {
do_action('doccure_get_search_gender5');
} elseif ( $specialities_search ) {
$speciality_terms = $this->get_terms('specialities');
?>
<select name="specialities" class="form-control">
<option value=""><?php esc_html_e('Speciality','doccure_elementor'); ?></option>
<?php if ( !empty($speciality_terms) ) { foreach ( $speciality_terms as $tid => $label ) { if ( empty($tid) ) { continue; } $term_obj = get_term( (int)$tid, 'specialities' ); if ( is_wp_error($term_obj) || empty($term_obj) ) { continue; } ?>
<option value="<?php echo esc_attr($term_obj->slug); ?>"><?php echo esc_html($label); ?></option>
<?php } } ?>
</select>
<?php } ?>
</div>
</div>
<div class="form-search-btn">
<button class="btn btn-primary" type="submit"><i class="isax isax-search-normal5 me-2"></i><?php esc_html_e('Search','doccure_elementor');?></button>
</div>
</form>
</div>
<?php
}
echo ob_get_clean();
?>
</div>
</div>
<div class="col-lg-4">
<div class="banner-img aos" data-aos="fade-up">
<img src="<?php echo esc_url($settings['right_image']['url']); ?>" class="img-fluid" alt="patient-image">
<div class="banner-appointment">
<h6 class="mb-0"><?php echo $settings['app_title_count']; ?></h6>
<p><?php echo $settings['app_title']; ?> </p>
</div>
<div class="banner-patient">
<div class="avatar-list-stacked avatar-group-sm">
<span class="avatar avatar-rounded">
<img src="<?php echo esc_url($settings['satis_user1']['url']); ?>" alt="img">
</span>
<span class="avatar avatar-rounded">
<img src="<?php echo esc_url($settings['satis_user2']['url']); ?>" alt="img">
</span>
<span class="avatar avatar-rounded">
<img src="<?php echo esc_url($settings['satis_user3']['url']); ?>" alt="img">
</span>
</div>
<p><?php echo $settings['satis_title_count']; ?></p>
<p><?php echo $settings['satis_title']; ?></p>
</div>
</div>
</div>
</div>
</div>
<div class="banner-bg">
<img src="<?php echo esc_url($settings['extra_image1']['url']); ?>" alt="img" class="banner-bg-01">
<img src="<?php echo esc_url($settings['extra_image2']['url']); ?>" alt="img" class="banner-bg-02">
<img src="<?php echo esc_url($settings['extra_image3']['url']); ?>" alt="img" class="banner-bg-03">
<img src="<?php echo esc_url($settings['extra_image4']['url']); ?>" alt="img" class="banner-bg-04">
<img src="<?php echo esc_url($settings['extra_image5']['url']); ?>" alt="img" class="banner-bg-05">
<img src="<?php echo esc_url($settings['extra_image5']['url']); ?>" alt="img" class="banner-bg-06">
</div>
</section>
<!-- /Home Banner -->
<style>
.banner-section.banner-sec-one .banner-img::before {
background: url("<?php echo esc_url($settings['right_image_back']['url']); ?> ") no-repeat;
}
</style>
<?php
}
protected function get_terms($taxonomy) {
$taxonomies = get_terms( array( 'taxonomy' =>$taxonomy,'hide_empty' => false) );
$options = [ '' => '' ];
if ( !empty($taxonomies) ) :
foreach ( $taxonomies as $taxonomy ) {
$options[ $taxonomy->term_id ] = $taxonomy->name;
}
endif;
return $options;
}
}