File: //proc/self/cwd/wp-content/plugins/woolentor-addons/includes/addons/special_day_offer.php
<?php
namespace Elementor;
// Elementor Classes
use \Elementor\Core\Schemes\Color as Scheme_Color;
use \Elementor\Core\Schemes\Typography as Scheme_Typography;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Woolentor_Elementor_Widget_Special_day_Banner extends Widget_Base {
public function get_name() {
return 'woolentor-specialdaybanner-addons';
}
public function get_title() {
return __( 'WL: Special Day Offer', 'woolentor' );
}
public function get_icon() {
return 'eicon-image';
}
public function get_categories() {
return [ 'woolentor-addons' ];
}
public function get_style_depends(){
return [
'woolentor-widgets',
];
}
public function get_keywords(){
return['offer','day','day offer','special offer','special day'];
}
protected function _register_controls() {
$this->start_controls_section(
'add_banner_content',
[
'label' => __( 'Banner', 'woolentor' ),
]
);
$this->add_control(
'banner_content_pos',
[
'label' => __( 'Content Position', 'woolentor' ),
'type' => Controls_Manager::SELECT,
'default' => 'center',
'options' => [
'top' => __( 'Top', 'woolentor' ),
'center' => __( 'Center', 'woolentor' ),
'bottom' => __( 'Bottom', 'woolentor' ),
'left' => __( 'Left', 'woolentor' ),
'right' => __( 'Right', 'woolentor' ),
],
]
);
$this->add_control(
'banner_image',
[
'label' => __( 'Image', 'woolentor' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'banner_image_size',
'default' => 'large',
'separator' => 'none',
]
);
$this->add_control(
'banner_title',
[
'label' => __( 'Title', 'woolentor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Banner Title', 'woolentor' ),
]
);
$this->add_control(
'banner_sub_title',
[
'label' => __( 'Subtitle', 'woolentor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Banner Sub Title', 'woolentor' ),
]
);
$this->add_control(
'banner_description',
[
'label' => __( 'Description', 'woolentor' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => __( 'Banner Description', 'woolentor' ),
]
);
$this->add_control(
'banner_offer',
[
'label' => __( 'Offer Amount', 'woolentor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( '50%', 'woolentor' ),
]
);
$this->add_control(
'banner_offer_tag_line',
[
'label' => __( 'Offer Tag Line', 'woolentor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Off', 'woolentor' ),
]
);
$this->add_control(
'banner_link',
[
'label' => __( 'Banner Link', 'woolentor' ),
'type' => Controls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'woolentor' ),
'show_external' => true,
'default' => [
'url' => '#',
'is_external' => false,
'nofollow' => false,
],
]
);
$this->add_control(
'banner_button_txt',
[
'label' => __( 'Button Text', 'woolentor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => __( 'Button Text', 'woolentor' ),
]
);
$this->add_control(
'banner_badge_toggle',
[
'label' => __( 'Banner Badge', 'woolentor' ),
'type' => Controls_Manager::POPOVER_TOGGLE,
]
);
$this->start_popover();
$this->add_control(
'banner_badge_image',
[
'label' => __( 'Badge Image', 'woolentor' ),
'type' => Controls_Manager::MEDIA,
]
);
$this->add_responsive_control(
'badge_width',
[
'label' => __( 'Width', 'woolentor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'condition'=>[
'banner_badge_image[url]!'=>'',
],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .wlbanner-badgeimage' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'badge_x_position',
[
'label' => __( 'Horizontal Postion', 'woolentor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'default' => [
'size' => 25,
'unit' => '%',
],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'condition'=>[
'banner_badge_image[url]!'=>'',
],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .wlbanner-badgeimage' => 'left: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'badge_y_position',
[
'label' => __( 'Vertical Postion', 'woolentor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'default' => [
'size' => 0,
'unit' => '%',
],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'condition'=>[
'banner_badge_image[url]!'=>'',
],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .wlbanner-badgeimage' => 'top: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_popover();
$this->end_controls_section();
// Style tab section
$this->start_controls_section(
'add_banner_style_section',
[
'label' => __( 'Style', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'add_banner_section_align',
[
'label' => __( 'Alignment', 'woolentor' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'woolentor' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => __( 'Center', 'woolentor' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => __( 'Right', 'woolentor' ),
'icon' => 'fa fa-align-right',
],
'justify' => [
'title' => __( 'Justified', 'woolentor' ),
'icon' => 'fa fa-align-justify',
],
],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content' => 'text-align: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'add_banner_section_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'add_banner_section_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Title tab section
$this->start_controls_section(
'banner_title_style_section',
[
'label' => __( 'Title', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_title!'=>'',
]
]
);
$this->add_control(
'banner_title_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h2' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'banner_title_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content h2',
]
);
$this->add_responsive_control(
'banner_title_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'banner_title_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Sub Title tab section
$this->start_controls_section(
'banner_sub_title_style_section',
[
'label' => __( 'Sub Title', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_sub_title!'=>'',
]
]
);
$this->add_control(
'banner_sub_title_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h6' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'banner_sub_title_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content h6',
]
);
$this->add_responsive_control(
'banner_sub_title_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h6' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'banner_sub_title_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Description tab section
$this->start_controls_section(
'banner_description_style_section',
[
'label' => __( 'Description', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_description!'=>'',
]
]
);
$this->add_control(
'banner_description_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content p' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'banner_description_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content p',
]
);
$this->add_responsive_control(
'banner_description_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'banner_description_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Offer tab section
$this->start_controls_section(
'banner_offer_style_section',
[
'label' => __( 'Offer Amount', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_offer!'=>'',
]
]
);
$this->add_control(
'banner_offer_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'banner_offer_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content h5',
]
);
$this->add_responsive_control(
'banner_offer_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'banner_offer_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Offer Tag section
$this->start_controls_section(
'banner_offer_tag_style_section',
[
'label' => __( 'Offer Tag Line', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_offer!'=>'',
]
]
);
$this->add_control(
'banner_offer_tag_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' => '#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5 span' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'banner_offer_tag_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content h5 span',
]
);
$this->add_responsive_control(
'banner_offer_tag_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5 span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'banner_offer_tag_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content h5 span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->end_controls_section();
// Style Button tab section
$this->start_controls_section(
'banner_button_style_section',
[
'label' => __( 'Button', 'woolentor' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition'=>[
'banner_button_txt!'=>'',
]
]
);
$this->start_controls_tabs('button_style_tabs');
$this->start_controls_tab(
'button_style_normal_tab',
[
'label' => __( 'Normal', 'woolentor' ),
]
);
$this->add_control(
'button_text_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' =>'#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'label' => __( 'Typography', 'woolentor' ),
'scheme' => Scheme_Typography::TYPOGRAPHY_4,
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content a',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'button_border',
'label' => __( 'Border', 'woolentor' ),
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content a',
]
);
$this->add_responsive_control(
'button_border_radius',
[
'label' => __( 'Border Radius', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'button_background',
'label' => __( 'Background', 'woolentor' ),
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content a',
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_padding',
[
'label' => __( 'Padding', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->add_responsive_control(
'button_margin',
[
'label' => __( 'Margin', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'separator' => 'before',
]
);
$this->end_controls_tab(); // Button Normal tab end
// Button Hover tab start
$this->start_controls_tab(
'button_style_hover_tab',
[
'label' => __( 'Hover', 'woolentor' ),
]
);
$this->add_control(
'button_hover_text_color',
[
'label' => __( 'Color', 'woolentor' ),
'type' => Controls_Manager::COLOR,
'default' =>'#ffffff',
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a:hover' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'button_hover_border',
'label' => __( 'Border', 'woolentor' ),
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content a:hover',
]
);
$this->add_responsive_control(
'button_hover_border_radius',
[
'label' => __( 'Border Radius', 'woolentor' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .wlspcial-banner .banner-content a:hover' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
],
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'button_hover_background',
'label' => __( 'Background', 'woolentor' ),
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}} .wlspcial-banner .banner-content a:hover',
'separator' => 'before',
]
);
$this->end_controls_tab(); // Button Hover tab end
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render( $instance = [] ) {
$settings = $this->get_settings_for_display();
$this->add_render_attribute( 'woolentor_banner', 'class', 'wlspcial-banner woolentor-banner-content-pos-'.$settings['banner_content_pos'] );
// URL Generate
if ( ! empty( $settings['banner_link']['url'] ) ) {
$this->add_render_attribute( 'url', 'href', $settings['banner_link']['url'] );
if ( $settings['banner_link']['is_external'] ) {
$this->add_render_attribute( 'url', 'target', '_blank' );
}
if ( ! empty( $settings['banner_link']['nofollow'] ) ) {
$this->add_render_attribute( 'url', 'rel', 'nofollow' );
}
}
?>
<div <?php echo $this->get_render_attribute_string( 'woolentor_banner' ); ?>>
<div class="banner-thumb">
<a <?php echo $this->get_render_attribute_string( 'url' ); ?>>
<?php
echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'banner_image_size', 'banner_image' );
?>
</a>
</div>
<?php
if( !empty($settings['banner_badge_image']['url']) ){
echo '<div class="wlbanner-badgeimage"><img src="' . $settings['banner_badge_image']['url'] . '"></div>';
}
?>
<div class="banner-content">
<?php
if( !empty( $settings['banner_title'] ) ){
echo '<h2>'.$settings['banner_title'].'</h2>';
}
if( !empty( $settings['banner_sub_title'] ) ){
echo '<h6>'.$settings['banner_sub_title'].'</h6>';
}
if( !empty( $settings['banner_offer'] ) ){
echo '<h5>'.$settings['banner_offer'].'<span>'.$settings['banner_offer_tag_line'].'</span></h5>';
}
if( !empty( $settings['banner_description'] ) ){
echo '<p>'.$settings['banner_description'].'</p>';
}
if( !empty( $settings['banner_button_txt'] ) ){
echo '<a '.$this->get_render_attribute_string( 'url' ).'>'.esc_html__( $settings['banner_button_txt'],'woolentor' ).'</a>';
}
?>
</div>
</div>
<?php
}
}
Plugin::instance()->widgets_manager->register_widget_type( new Woolentor_Elementor_Widget_Special_day_Banner() );