<?php
/**
 * Elementor Timeline Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.5
 */

use \Elementor\Plugin;

class Elementor_Timeline_Widget extends \Elementor\Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve Timeline widget name.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'timeline';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve Timeline widget title.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Timeline', 'endless-addons' );
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve Timeline widget icon.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'fa fa-clock-o';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the Timeline widget belongs to.
	 *
	 * @since 1.0.5
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'endless-elements' ];
	}

	/**
	 * Register Timeline widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'default_section_timeline',
			[    
				'label' => __( 'Settings', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$this->add_control(
			'show_timeline',
			[
				'label' => __( 'Show/Hide Timeline Section', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'show' => [
						'title' => __( 'Show', 'endless-addons' ),
						'icon' => 'fa fa-check'
					],
					'hide' => [
						'title' => __( 'Hide', 'endless-addons' ),
						'icon' => 'fa fa-close'
					]
				],
				'default' => 'show',
				'toggle' => true
			]
		);

		$this->add_control(
			'timeline_style_select',
			[
				'label' => __( 'Select Timeline Style', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'style-01' => __( 'Style 01', 'endless-addons' ),
					'style-02' => __( 'Style 02', 'endless-addons' ),
					'style-03' => __( 'Style 03', 'endless-addons' ),
					'style-04' => __( 'Style 04', 'endless-addons' ),
					'style-05' => __( 'Style 05', 'endless-addons' ),
					'style-06' => __( 'Style 06', 'endless-addons' ),
					'style-07' => __( 'Style 07', 'endless-addons' )
				],
				'default' => 'style-01'
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'timeline_section',
			[
				'label' => __( 'Timeline Section', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);


		$this->add_control(
			'timeline_title',
			[
				'label' => __( 'Section Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Featured Timeline', 'endless-addons' )
			]
		);

		$this->add_control(
			'timeline_desc',
			[
				'label' => __( 'Section Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default' => __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida.', 'endless-addons')
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name' => 'section_background',
				'label' => __( 'Background', 'plugin-domain' ),
				'types' => [ 'classic', 'gradient', 'video' ],
				'selector' => '{{WRAPPER}} .ea-timeline-area',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'timeline_single',
			[
				'label' => __( 'Timeline Content', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'icon_type',
			[
				'label' => __( 'Icon Type', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'general' => __( 'General', 'endless-addons' ),
					'library' => __( 'Library', 'endless-addons' ),
				],
				'description' => __('Used only for Style 03', 'endless-addons'),
				'default' => 'general'
			]
		);

		$repeater->add_control(
			'single_timeline_icon1', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICON,
				'default'  => 'bx bxs-map',
				'show_label' => true,
				'options' => endless_addons_icons(),
				'description' => __('Used only for Style 03', 'endless-addons'),
				'condition' => [
                    'icon_type' => 'general'
                ]
			]
		);

		$repeater->add_control(
			'single_timeline_icon2', [
				'label' => __( 'Icon', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::ICONS,
				'show_label' => true,
				'description' => __('Used only for Style 03', 'endless-addons'),
				'condition' => [
                    'icon_type' => 'library'
                ]
			]
		);

		$repeater->add_control(
			'single_timeline_title', [
				'label' => __( 'Title', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Title', 'endless-addons' ),
				'default'  => __( 'Lorem Ipsum', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'ea_title_tag',
			[
				'label' => __( 'Title Tag', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'input_type' => 'SELECT',
				'options' => [
					'h1' => __( 'h1', 'endless-addons' ),
					'h2' => __( 'h2', 'endless-addons' ),
					'h3' => __( 'h3', 'endless-addons' ),
					'h4' => __( 'h4', 'endless-addons' ),
					'h5' => __( 'h5', 'endless-addons' ),
					'h6' => __( 'h6', 'endless-addons' )
				],
				'default' => 'h3'
			]
		);

		$repeater->add_control(
            'ea_content_text_type',
            [
                'label' => __('Content Type', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'content' => __('Content', 'endless-addons'),
                    'template' => __('Saved Templates', 'endless-addons'),
                ],
                'default' => 'content',
            ]
        );

		$repeater->add_control(
			'single_timeline_desc', [
				'label' => __( 'Description', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::WYSIWYG,
				'input_type' => 'WYSIWYG',
				'placeholder' => __( 'Description', 'endless-addons' ),
				'default'  => __( 'Lorem ipsum dolor sit amet, consecter adipiscing elit, sed do eiusmod.', 'endless-addons' ),
				'condition' => [
                    'ea_content_text_type' => 'content'
                ]
			]
		);

		$repeater->add_control(
            'ea_content_templates',
            [
                'label' => __('Choose Template', 'endless-addons'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => ea_get_elementor_templates(),
                'condition' => [
                    'ea_content_text_type' => 'template',
                ],
            ]
        );

		$repeater->add_control(
			'single_timeline_btn_text', [
				'label' => __( 'Button Text', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Button Text', 'endless-addons' ),
				'default'  => __( 'Learn More', 'endless-addons' )
			]
		);

		$repeater->add_control(
			'single_timeline_btn_link', [
				'label' => __( 'Button Link', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::URL,
				'input_type' => 'url',
				'default' => [
					'url' => '#',
					'is_external' => true,
					'nofollow' => true
				]
			]
		);

		$repeater->add_control(
			'single_timeline_date_time', [
				'label' => __( 'Date & Time', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::DATE_TIME,
				'input_type' => 'date_time',
				'default' => '2021-02-11 12:00'
			]
		);

		$this->add_control(
			'single_timeline',
			[
				'label' => __( 'Single Timeline', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::REPEATER,
				'fields' => $repeater->get_controls(),
				'default' => [
					[
						'list_title' => __( 'Single Timeline #1', 'endless-addons' ),
						'list_content' => __( 'Single Timeline Content', 'endless-addons' ),
					],
				
				]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'section_style',
			[
				'label' => __( 'Section Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'section_title_color',
			[
				'label' => __( 'Section Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .section-title h2' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_title_typography',
                'label' => __( 'Section Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline-area .section-title h2'
            ]
        );

        $this->add_control(
			'section_desc_color',
			[
				'label' => __( 'Section Description Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .section-title p' => 'color: {{VALUE}}'
                ]
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'section_desc_typography',
                'label' => __( 'Section Description Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline-area .section-title p'
            ]
        );

		$this->end_controls_section();

		$this->start_controls_section(
			'timeline_style',
			[
				'label' => __( 'Timeline Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'timeline_title_color',
			[
				'label' => __( 'Timeline Title Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'input_type' => 'color',
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-two .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-three .ea-timeline-item .ea-timeline-title, .ea-timeline.style-four .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-five .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-six .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-seven .ea-timeline-item .ea-timeline-content .ea-timeline-title' => 'color: {{VALUE}}',
                    '{{WRAPPER}} .ea-timeline.style-three .ea-timeline-item .ea-timeline-title' => '-webkit-text-fill-color: {{VALUE}}'
                ],
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'timeline_title_typography',
                'label' => __( 'Timeline Title Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-two .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-three .ea-timeline-item .ea-timeline-title, .ea-timeline.style-four .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-five .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-six .ea-timeline-item .ea-timeline-content .ea-timeline-title, .ea-timeline.style-seven .ea-timeline-item .ea-timeline-content .ea-timeline-title'
            ]
        );

        $this->add_control(
			'timeline_desc_color',
			[
				'label' => __( 'Timeline Description Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'input_type' => 'color',
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-two .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-three .ea-timeline-item p, .ea-timeline.style-four .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-five .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-six .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-seven .ea-timeline-item .ea-timeline-content p' => 'color: {{VALUE}}'
                ],
			]
		);

        $this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'timeline_desc_typography',
                'label' => __( 'Timeline Description Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-two .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-three .ea-timeline-item p, .ea-timeline.style-four .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-five .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-six .ea-timeline-item .ea-timeline-content p, .ea-timeline.style-seven .ea-timeline-item .ea-timeline-content p'
            ]
        );

		$this->add_control(
			'timeline_circle_box_color',
			[
				'label' => __( 'Timeline Circle Box Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'input_type' => 'color',
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-marker::before' => 'background: {{VALUE}}',
                    '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-marker' => 'border-color: {{VALUE}}',
                ],
                'condition' => [
                    'timeline_style_select' => array('style-01', 'style-02', 'style-04', 'style-05', 'style-06', 'style-07')
                ]
			]
		);

		$this->add_control(
			'timeline_date_color',
			[
				'label' => __( 'Timeline Date Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'input_type' => 'color',
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-info span' => 'color: {{VALUE}}',
                ]
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'timeline_date_typography',
                'label' => __( 'Timeline Date Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline .ea-timeline-item .ea-timeline-info span'
            ]
        );

        $this->end_controls_section();

        $this->start_controls_section(
			'timeline_btn_style',
			[
				'label' => __( 'Button Style', 'endless-addons' ),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE
			]
		);

		$this->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name' => 'timeline_btn_typography',
                'label' => __( 'Button Typography', 'endless-addons' ),
                'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
                'selector' => '{{WRAPPER}} .ea-timeline-area .link-btn'
            ]
        );

		$this->add_control(
			'button_bg_color',
			[
				'label' => __( 'Button Background Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .link-btn' => 'background: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'button_color',
			[
				'label' => __( 'Button Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .link-btn' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'button_bg_hover_color',
			[
				'label' => __( 'Button Background Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .link-btn:hover' => 'background: {{VALUE}}'
                ]
			]
		);

		$this->add_control(
			'button_hover_color',
			[
				'label' => __( 'Button Hover Color', 'endless-addons' ),
				'type' => \Elementor\Controls_Manager::COLOR,
				'selectors' => [
                    '{{WRAPPER}} .ea-timeline-area .link-btn:hover' => 'color: {{VALUE}}'
                ]
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'_section_overlay_style',
			[
				'label' => __('Background Overlay', 'endless-addons'),
				'tab' => \Elementor\Controls_Manager::TAB_STYLE,
				'condition' => [
                    'timeline_style_select' => array('style-01', 'style-02', 'style-03', 'style-05', 'style-07')
                ]
			]
		);

		$this->start_controls_tabs('_tabs_overlay_style');

		$this->start_controls_tab(
			'_tab_overlay_normal',
			[
				'label' => __('Normal', 'endless-addons'),
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_normal',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-timeline-area, .ea-timeline-area.bg-f9f9f9',
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'_tab_overlay_hover',
			[
				'label' => __('Hover', 'endless-addons'),
			]
		);


		$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name'     => 'hover_overlay_hover',
				'label' => __('Background', 'endless-addons'),
				'show_label' => true,
				'types' => ['classic', 'gradient'],
				'exclude' => [
					'classic' => 'image'
				],
				'selector' => '{{WRAPPER}} .ea-timeline-area:hover, .ea-timeline-area.bg-f9f9f9:hover',
			]
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->end_controls_section();

	}

	/**
	 * Render Timeline widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.5
	 * @access protected
	 */
	protected function render() {

		$settings = $this->get_settings_for_display(); ?>

        <!-- Start Timeline Area -->
        <?php if( $settings['show_timeline'] == 'show' ) :

	        if( $settings['timeline_style_select'] == 'style-01' ) : ?>
		        <div class="ea-timeline-area pb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>                          
		                <ul class="ea-timeline style-one">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                        	<<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php elseif( $settings['timeline_style_select'] == 'style-02' ) : ?>
		    	<div class="ea-timeline-area ptb-100 bg-f9f9f9">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>
		                <ul class="ea-timeline style-two">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php elseif( $settings['timeline_style_select'] == 'style-03' ) : ?>
		    	<div class="ea-timeline-area ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>
		                <ul class="ea-timeline style-three">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                		<?php if(! $item['single_timeline_icon1'] == '' || ! $item['single_timeline_icon2'] == '') : ?>
				                            <div class="icon">
				                                <?php if( $item['icon_type'] == 'general' ) : ?>
			                                	    <i class="<?php echo wp_kses_post( $item['single_timeline_icon1'] ); ?>"></i>
			                                	<?php else: 
			                                		endad_render_icon( $item, 'icon', 'single_timeline_icon2' ); 
			                                	endif; ?>
				                            </div>
			                            <?php endif; ?>
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php elseif( $settings['timeline_style_select'] == 'style-04' ) : ?>
		    	<div class="ea-timeline-area ptb-100 bg-gradient-color">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?>
		                    </p>
		                </div>
		                <ul class="ea-timeline style-four">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php elseif( $settings['timeline_style_select'] == 'style-05' ) : ?>
		    	<div class="ea-timeline-area ptb-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>
		                <ul class="ea-timeline style-five">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
	        <?php elseif( $settings['timeline_style_select'] == 'style-06' ) : ?>
	        	<div class="ea-timeline-area ptb-100 bg-gradient-color2">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>
		                <ul class="ea-timeline style-six">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                <li class="ea-timeline-item">
		                        <div class="ea-timeline-info">
		                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
		                        </div>
		                        <div class="ea-timeline-marker"></div>
		                        <div class="ea-timeline-content">
		                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
		                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
		                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
			                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
		                            <?php endif; ?>
		                        </div>
		                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php elseif( $settings['timeline_style_select'] == 'style-07' ) : ?>
		    	<div class="ea-timeline-area bg-shape pt-100">
		            <div class="container">
		                <div class="section-title">
		                    <h2><?php echo esc_html__($settings['timeline_title']); ?></h2>
		                    <p><?php echo wp_kses_post($settings['timeline_desc']); ?></p>
		                </div>
		                <ul class="ea-timeline style-seven">
		                	<?php foreach ( $settings['single_timeline'] as $item ) : 
		                		$target = $item['single_timeline_btn_link']['is_external'] ? ' target="_blank"' : '';
	                            $nofollow = $item['single_timeline_btn_link']['nofollow'] ? ' rel="nofollow"' : ''; ?>
			                	<li class="ea-timeline-item">
			                        <div class="ea-timeline-info">
			                            <span><?php echo wp_kses_post( $item['single_timeline_date_time'] ); ?></span>
			                        </div>
			                        <div class="ea-timeline-marker"></div>
			                        <div class="ea-timeline-content">
			                            <<?php echo esc_attr($item['ea_title_tag']); ?> class="ea-timeline-title"><?php echo esc_html($item['single_timeline_title']); ?></<?php echo esc_attr($item['ea_title_tag']); ?>>
			                            <?php if($item['ea_content_text_type'] == 'content') : ?>
					                        <p><?php echo wp_kses_post($item['single_timeline_desc']); ?></p>
			                            <?php elseif($item['ea_content_text_type'] == 'template') : ?>
			                            	<p>
			                            		<?php if (!empty($item['ea_content_templates'])) {
									                echo Plugin::$instance->frontend->get_builder_content($item['ea_content_templates'], true);
									            } ?>
			                            	</p>
			                            <?php endif; ?>
			                            <?php if( ! $item['single_timeline_btn_text'] == '' ) : ?>
				                            <a href="<?php echo esc_url( $item['single_timeline_btn_link']['url'] ); ?>" <?php echo wp_kses_post( $target ); ?> <?php echo wp_kses_post( $nofollow ); ?> class="link-btn"><?php echo esc_html__( $item['single_timeline_btn_text'] ); ?></a>
			                            <?php endif; ?>
			                        </div>
			                    </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
		    <?php endif;

	    endif; ?>
	    <!-- End Timeline Area -->
    
    <?php

    }
    
}
