navasena/wp-content/plugins/thinkai-plugin/elementor/newsletter.php

266 lines
7.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php namespace THINKAIPLUGIN\Element;
use Elementor\Controls_Manager;
use Elementor\Controls_Stack;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Border;
use Elementor\Repeater;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Text_Stroke;
use Elementor\Plugin;
/**
* Elementor button widget.
* Elementor widget that displays a button with the ability to control every
* aspect of the button design.
*
* @since 1.0.0
*/
class Newsletter extends Widget_Base {
/**
* Get widget name.
* Retrieve button widget name.
*
* @since 1.0.0
* @access public
* @return string Widget name.
*/
public function get_name() {
return 'thinkai_newsletter';
}
/**
* Get widget title.
* Retrieve button widget title.
*
* @since 1.0.0
* @access public
* @return string Widget title.
*/
public function get_title() {
return esc_html__( 'Thinkai Newsletter', 'thinkai' );
}
/**
* Get widget icon.
* Retrieve button widget icon.
*
* @since 1.0.0
* @access public
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-gallery-grid';
}
/**
* Get widget categories.
* Retrieve the list of categories the button widget belongs to.
* Used to determine where to display the widget in the editor.
*
* @since 2.0.0
* @access public
* @return array Widget categories.
*/
public function get_categories() {
return [ 'thinkai' ];
}
/**
* Register button 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(
'newsletter',
[
'label' => esc_html__( 'Thinkai Newsletter', 'thinkai' ),
]
);
$this->add_control(
'layout_control',
[
'label' => esc_html__( 'Layout Style', 'thinkai' ),
'label_block' => true,
'type' => Controls_Manager::SELECT,
'default' => '1',
'options' => array(
'1' => esc_html__( 'Style One ', 'thinkai'),
'2' => esc_html__( 'Style Two ', 'thinkai'),
),
]
);
//features_list
$this->add_control(
'features_list',
[
'label' => __( 'Feature List', 'thinkai' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'Enter Feature List', 'thinkai' ),
]
);
//BG Image
$this->add_control(
'feature_image',
[
'label' => __( 'Feature Image Url', 'thinkai' ),
'type' => Controls_Manager::MEDIA,
'default' => ['url' => Utils::get_placeholder_image_src(),],
]
);
//Image Caption
$this->add_control(
'image_caption',
[
'label' => __( 'Image Caption', 'thinkai' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( '1.5 Million Subscribers', 'thinkai' ),
]
);
//SubTitle
$this->add_control(
'subtitle',
[
'label' => __( 'Sub Title', 'thinkai' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( '[ NEWSLETTER ]', 'thinkai' ),
]
);
//Title
$this->add_control(
'title',
[
'label' => __( 'Title', 'thinkai' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'Dont miss updates', 'thinkai' ),
]
);
//Text
$this->add_control(
'text',
[
'label' => __( 'Description', 'thinkai' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'Latest news, AI models & fun memes from the community.', 'thinkai' ),
]
);
//Mailchimp Form Url
$this->add_control(
'mailchimp_form_url',
[
'label' => __( 'MailChimp Form Url', 'thinkai' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'MailChimp Form Url', 'thinkai' ),
]
);
$this->end_controls_section();
}
/**
* Render button 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();
$allowed_tags = wp_kses_allowed_html('post');
$layout = $settings[ 'layout_control' ];
?>
<?php if($layout == '2') : ?>
<?php else: ?>
<!--Start Newsletter style1-->
<section class="newsletter-style1">
<?php $features_list = $settings['features_list'];
if(!empty($features_list)){
$features_list = explode("\n", ($features_list));
?>
<!--Start Scrolling Text Style4-->
<div class="scrolling-text-style4">
<div class="inner">
<ul class="clearfix marquee_mode">
<?php foreach($features_list as $features): ?>
<li data-hover="<?php echo wp_kses($features, true); ?>">
<?php echo wp_kses($features, true); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<!--End Scrolling Text Style4-->
<?php } ?>
<div class="newsletter-style1__bg"
style="background-image: url(<?php echo esc_url(wp_get_attachment_url($settings['feature_image']['id'])); ?>);">
<div class="text-box"><?php echo wp_kses($settings['image_caption'], true); ?></div>
</div>
<div class="container">
<div class="newsletter-style1__inner clearfix">
<div class="newsletter-style1__content">
<div class="title-box">
<div class="sec-title sec-title-animation animation-style2">
<div class="sub-title">
<h4><?php echo wp_kses($settings['subtitle'], true); ?></h4>
</div>
<h2 class="title-animation"><?php echo wp_kses($settings['title'], true); ?></h2>
</div>
<p><?php echo wp_kses($settings['text'], true); ?></p>
</div>
<?php echo do_shortcode($settings['mailchimp_form_url']); ?>
</div>
</div>
</div>
</section>
<!--End Newsletter style1-->
<?php endif; ?>
<?php
}
}