<?php
namespace Elementor;

/**
 * Elementor Widget
 * @package Feron
 * @since 1.0.0
 */ 
 
class Testimonials 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 'feron-testimonials-widget';
	}

	/**
	 * Get widget title.
	 * Retrieve button widget title.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget title.
	 */
	public function get_title() {
		return esc_html__( 'Testimonials Widget', 'feron-core' );
	}

	/**
	 * Get widget icon.
	 * Retrieve button widget icon.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'eicon-flash';
	}

	/**
	 * 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 ['feron_widgets'];
    }
	
	/**
	 * 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() {

		// Tab Start - 1

		$this->start_controls_section(
			'testimonials',
			[
				'label' => esc_html__( 'Testimonials', 'feron-core' ),
			]
		);		
		
		$this->add_control(
			'style',
			[
				'label'   => esc_html__( 'Select Style', 'feron-core' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'style1',
				'options' => array(
					'style1'   => esc_html__( 'Style One', 'feron-core' ),
					'style2'   => esc_html__( 'Style Two', 'feron-core' ),
					'style3'   => esc_html__( 'Style Three', 'feron-core' ),
					'style4'   => esc_html__( 'Style Four', 'feron-core' ),
					'style5'   => esc_html__( 'Style Five', 'feron-core' ),
				),
			]
		);

		$this->add_control(
			'subtitle',
			[
				'label'       => esc_html__( 'Subtitle', 'feron-core' ),
				'type'        => Controls_Manager::TEXT,
				'default'     => esc_html__( 'What They Say', 'feron-core' ),
				'label_block' => true,
			]
		);

		$this->add_control(
			'title',
			[
				'label'       => esc_html__( 'Title', 'feron-core' ),
				'type'        => Controls_Manager::TEXT,
				'default'     => esc_html__( 'Our Clients Feedback', 'feron-core' ),
				'label_block' => true,
			]
		);

		 $this->add_control(
			'bg_image',
			[
				'label' => esc_html__( 'Background Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);

		$this->add_control(
			'image',
			[
				'label' => esc_html__( 'Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);	

		
		$this->add_control(
			'image2',
			[
				'label' => esc_html__( 'Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);	

		
		$this->add_control(
			'image3',
			[
				'label' => esc_html__( 'Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);	

		
		$this->add_control(
			'image4',
			[
				'label' => esc_html__( 'Image', 'feron-core' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => Utils::get_placeholder_image_src(),
				],
			]
		);	
	
		$this->end_controls_section();

		// Tab Start - 2

		$this->start_controls_section(
			'content_section',
			[
				'label' => __( 'Block', 'feron-core' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);
		$this->add_control(
		  'repeat', 
			[
				'type' => Controls_Manager::REPEATER,
				'separator' => 'before',
				'default' => 
					[
						['section_title' => esc_html__('Projects Completed', 'feron-core')],
					],
				'fields' => 
					[			
					
						[
							'name'  => 'section_image',
							'label' => esc_html__( 'Image', 'feron-core' ),
							'type'  => Controls_Manager::MEDIA,
							'default' => ['url' => Utils::get_placeholder_image_src(),],
						],
						[
							'name'  => 'section_image2',
							'label' => esc_html__( 'Image Two', 'feron-core' ),
							'type'  => Controls_Manager::MEDIA,
							'default' => ['url' => Utils::get_placeholder_image_src(),],
						],
						[
							'name'  => 'section_text',
							'label' => esc_html__( 'Text', 'feron-core' ),
							'type'  => Controls_Manager::TEXTAREA,
							'default' => esc_html__('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'feron-core'),
						],
						[
							'name'  => 'section_title',
							'label' => esc_html__( 'Title', 'feron-core' ),
							'type'  => Controls_Manager::TEXT,
							'default' => esc_html__('John Doe', 'feron-core'),
						],
						[
							'name'  => 'section_subtitle',
							'label' => esc_html__( 'Subtitle', 'feron-core' ),
							'type'  => Controls_Manager::TEXT,
							'default' => esc_html__('CEO, XYZ Company', 'feron-core'),
						],
					   
						[
							'name' => 'section_class',
							'label' => __( 'Box Class', 'feron-core' ),
							'type' => Controls_Manager::SELECT,
							'options' => [
								'testimonial-sticky-hover' => __( 'Class 1', 'feron-core' ),
								'testimonial-sticky-hover style-none' => __( 'Class 2', 'feron-core' ),
							],
							'default' => 'testimonial-sticky-hover',
						],

						[
							'name' => 'section_id',
							'label' => __( 'Box ID', 'feron-core' ),
							'type' => Controls_Manager::SELECT,
							'options' => [
								'card1' => __( 'ID 1', 'feron-core' ),
								'card2' => __( 'ID 2', 'feron-core' ),
								'card3' => __( 'ID 3', 'feron-core' ),
							],
							'default' => 'card1',
						],
						
					],
				'title_field' => '{{section_title}}',
			 ]
	);
		
		
	$this->end_controls_section();	


			// ===== Tab Start - 4: Section Sub Title Settings =====

		$this->start_controls_section(
			'section_subtitle_settings',
			[
				'label' => __( 'Section Sub Title Setting', 'feron-core' ),
				'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'show_section_subtitle',
			[
				'label'   => esc_html__( 'Show Section Sub Title', 'feron-core' ),
				'type'    => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'show' => [
						'title' => esc_html__( 'Show', 'feron-core' ),
						'icon'  => 'eicon-check-circle',
					],
					'none' => [
						'title' => esc_html__( 'Hide', 'feron-core' ),
						'icon'  => 'eicon-close-circle',
					],
				],
				'default'   => 'show',
				'selectors' => [
					'{{WRAPPER}} .section-title h6' => 'display: {{VALUE}} !important',
				],
			]
		);

		$this->add_control(
			'section_subtitle_alignment',
			[
				'label'     => esc_html__( 'Alignment', 'feron-core' ),
				'type'      => \Elementor\Controls_Manager::CHOOSE,
				'options'   => [
					'left' => [
						'title' => esc_html__( 'Left', 'feron-core' ),
						'icon'  => 'eicon-text-align-left',
					],
					'center' => [
						'title' => esc_html__( 'Center', 'feron-core' ),
						'icon'  => 'eicon-text-align-center',
					],
					'right' => [
						'title' => esc_html__( 'Right', 'feron-core' ),
						'icon'  => 'eicon-text-align-right',
					],
				],
				'toggle'    => true,
				'condition' => [ 'show_section_subtitle' => 'show' ],
				'selectors' => [
					'{{WRAPPER}} .section-title h6' => 'text-align: {{VALUE}} !important',
				],
			]
		);

		$this->add_control(
			'section_subtitle_margin',
			[
				'label'      => __( 'Margin', 'feron-core' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%', 'em' ],
				'condition'  => [ 'show_section_subtitle' => 'show' ],
				'selectors'  => [
					'{{WRAPPER}} .section-title h6' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important',
				],
			]
		);

		$this->add_control(
			'section_subtitle_padding',
			[
				'label'      => __( 'Padding', 'feron-core' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%', 'em' ],
				'condition'  => [ 'show_section_subtitle' => 'show' ],
				'selectors'  => [
					'{{WRAPPER}} .section-title h6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important',
				],
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Typography::get_type(),
			[
				'name'      => 'section_subtitle_typography',
				'label'     => __( 'Typography', 'feron-core' ),
				'selector'  => '{{WRAPPER}} .section-title h6',
				'condition' => [ 'show_section_subtitle' => 'show' ],
			]
		);

		$this->add_control(
			'section_subtitle_color',
			[
				'label'     => __( 'Color', 'feron-core' ),
				'type'      => \Elementor\Controls_Manager::COLOR,
				'separator' => 'after',
				'condition' => [ 'show_section_subtitle' => 'show' ],
				'selectors' => [
					'{{WRAPPER}} .section-title h6' => 'color: {{VALUE}} !important',
				],
			]
		);

		$this->end_controls_section();

		// ===== End Tab - 4: Section Sub Title Settings =====


				// Section Title ==================
		$this->start_controls_section(
			'section_title_settings',
			[
				'label' => __( 'Section Title Setting', 'feron-core' ),
				'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'show_section_title',
			[
				'label'   => esc_html__( 'Show Section Title', 'feron-core' ),
				'type'    => \Elementor\Controls_Manager::CHOOSE,
				'options' => [
					'show' => [
						'title' => esc_html__( 'Show', 'feron-core' ),
						'icon'  => 'eicon-check-circle',
					],
					'none' => [
						'title' => esc_html__( 'Hide', 'feron-core' ),
						'icon'  => 'eicon-close-circle',
					],
				],
				'default'   => 'show',
				'selectors' => [
					'{{WRAPPER}} .section-title h2' => 'display: {{VALUE}} !important',
				],
			]
		);

		$this->add_control(
			'section_title_alignment',
			[
				'label'     => esc_html__( 'Alignment', 'feron-core' ),
				'type'      => \Elementor\Controls_Manager::CHOOSE,
				'options'   => [
					'left' => [
						'title' => esc_html__( 'Left', 'feron-core' ),
						'icon'  => 'eicon-text-align-left',
					],
					'center' => [
						'title' => esc_html__( 'Center', 'feron-core' ),
						'icon'  => 'eicon-text-align-center',
					],
					'right' => [
						'title' => esc_html__( 'Right', 'feron-core' ),
						'icon'  => 'eicon-text-align-right',
					],
				],
				'toggle'    => true,
				'condition' => [ 'show_section_title' => 'show' ],
				'selectors' => [
					'{{WRAPPER}} .section-title h2' => 'text-align: {{VALUE}} !important',
				],
			]
		);

		$this->add_control(
			'section_title_margin',
			[
				'label'      => __( 'Margin', 'feron-core' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%', 'em' ],
				'condition'  => [ 'show_section_title' => 'show' ],
				'selectors'  => [
					'{{WRAPPER}} .section-title h2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important',
				],
			]
		);

		$this->add_control(
			'section_title_padding',
			[
				'label'      => __( 'Padding', 'feron-core' ),
				'type'       => \Elementor\Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%', 'em' ],
				'condition'  => [ 'show_section_title' => 'show' ],
				'selectors'  => [
					'{{WRAPPER}} .section-title h2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important',
				],
			]
		);

		$this->add_group_control(
			\Elementor\Group_Control_Typography::get_type(),
			[
				'name'      => 'section_title_typography',
				'label'     => __( 'Typography', 'feron-core' ),
				'selector'  => '{{WRAPPER}} .section-title h2',
				'condition' => [ 'show_section_title' => 'show' ],
			]
		);

		$this->add_control(
			'section_title_color',
			[
				'label'     => __( 'Color', 'feron-core' ),
				'type'      => \Elementor\Controls_Manager::COLOR,
				'condition' => [ 'show_section_title' => 'show' ],
				'selectors' => [
					'{{WRAPPER}} .section-title h2' => 'color: {{VALUE}} !important',
				],
			]
		);

		$this->end_controls_section();
		// End of Title ==================

		

	
		}

	/**
	 * 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');
		?>


		<?php  if ( 'style1' === $settings['style'] ) : ?>	

		<section id="testimonials" class="testimonial-section fix bg-cover" style="background-image: url('<?php echo wp_get_attachment_url($settings['bg_image']['id']);?>');">
			<?php  if ( !empty(esc_url($settings['image']['id']) )) : ?>   
				<img class="shape-1" src="<?php echo wp_get_attachment_url($settings['image']['id']);?>" alt=""/>
			<?php endif;?>
            <div class="container">
                <div class="row g-4 align-items-center">
                    <div class="col-lg-7 order-2 order-xl-1">
                        <div class="testimonial-wrapper pin-area">
                            <div class="pin-inner">

								<?php foreach($settings['repeat'] as $item):?>	
                                <div class="<?php echo esc_attr($item['section_class']); ?>" id="<?php echo esc_attr($item['section_id']); ?>">
                                    <div class="tetsimonial-box-items">
                                        <div class="client-thumb">
                                            <?php if(!empty(wp_get_attachment_url($item['section_image']['id']))): ?>
												<img src="<?php echo wp_get_attachment_url($item['section_image']['id']);?>" alt="">
											<?php endif;?>
                                            <div class="quote-icon">
                                                <?php if(!empty(wp_get_attachment_url($item['section_image2']['id']))): ?>
													<img src="<?php echo wp_get_attachment_url($item['section_image2']['id']);?>" alt="">
												<?php endif;?>
                                            </div>
                                        </div>
                                        <div class="testi-content">
                                            <p>
                                                <?php echo wp_kses($item['section_text'], $allowed_tags);?>
                                            </p>
                                            <div class="client-info">
                                                <h6><?php echo wp_kses($item['section_title'], $allowed_tags);?></h6>
                                                <span><?php echo wp_kses($item['section_subtitle'], $allowed_tags);?></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
								<?php endforeach; ?>

                            </div>
                        </div>
                    </div>
                    <div class="col-lg-5 order-1 order-xl-2">
                        <div class="section-title">
                            <h6 class="wow fadeInUp"><?php echo $settings['subtitle'];?></h6>
                            <h2 class="wow fadeInUp" data-wow-delay=".3s">
                                <?php echo $settings['title'];?>
                            </h2>
							<?php 
							$total_slides = ! empty( $settings['repeat'] ) ? count( $settings['repeat'] ) : 0;
							if ( $total_slides > 0 ) : ?>
								<div class="testimonial-count">
									<span class="current-slide">1</span> | <span class="total-slide"><?php echo esc_html( $total_slides ); ?></span>
								</div>
							<?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </section>

		<?php  elseif ( 'style2' === $settings['style'] ) : ?>	

		   <div class="testimonial-box-items-2">
				<div class="border-shape">
				<?php  if ( !empty(esc_url($settings['image']['id']) )) : ?>   
					<img src="<?php echo wp_get_attachment_url($settings['image']['id']);?>" alt=""/>
				<?php endif;?>
				</div>
				<div class="swiper tetsimonial-slider-2">
					<div class="swiper-wrapper">

						<?php foreach($settings['repeat'] as $item):?>	
						<div class="swiper-slide">
							<div class="testimonial-box-slider">
								<div class="quote-icon">
									<?php if(!empty(wp_get_attachment_url($item['section_image']['id']))): ?>
										<img src="<?php echo wp_get_attachment_url($item['section_image']['id']);?>" alt="">
									<?php endif;?>
								</div>
								<p><?php echo wp_kses($item['section_text'], $allowed_tags);?></p>
								<div class="client-info-items">
									<div class="client-info">
										<?php if(!empty(wp_get_attachment_url($item['section_image2']['id']))): ?>
											<img src="<?php echo wp_get_attachment_url($item['section_image2']['id']);?>" alt="">
										<?php endif;?>
										<div class="content">
											<h4><?php echo wp_kses($item['section_title'], $allowed_tags);?></h4>
											<span>
												<?php echo wp_kses($item['section_subtitle'], $allowed_tags);?>
											</span>
										</div>
									</div>
									<div class="star">
										<i class="fa-solid fa-star"></i>
										<i class="fa-solid fa-star"></i>
										<i class="fa-solid fa-star"></i>
										<i class="fa-solid fa-star"></i>
										<i class="fa-solid fa-star"></i>
									</div>
								</div>
							</div>
						</div>
						<?php endforeach; ?>

					</div>
				</div>
				<div class="testi-pagi">
					<div class="array-button d-flex align-items-center">
						<button class="array-prev">
							<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
								<g clip-path="url(#clip0_0_434)">
									<path d="M1.16006 18L14.762 18C15.4019 18 15.9222 17.4797 15.9222 16.8398C15.9222 16.2 15.4019 15.6797 14.762 15.6797L3.96553 15.6797L17.6589 1.98281C18.1124 1.5293 18.1124 0.794531 17.6589 0.341017C17.2054 -0.112499 16.4706 -0.112499 16.0171 0.341017L2.32373 14.0379L2.32373 3.24141C2.32373 2.60156 1.80342 2.08125 1.16357 2.08125C0.52373 2.08125 0.00341662 2.60156 0.00341668 3.24141L0.00341787 16.8398C-9.73203e-05 17.4797 0.520214 18 1.16006 18Z" fill="#0B0E13"/>
								</g>
								<defs>
									<clipPath id="clip0_0_434">
									<rect width="18" height="18" fill="white" transform="translate(18 18) rotate(180)"/>
									</clipPath>
								</defs>
							</svg>
						</button>
						<button class="array-next">
							<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
							<g clip-path="url(#clip0_0_427)">
								<path d="M16.8399 0H3.23799C2.59814 0 2.07783 0.520312 2.07783 1.16016C2.07783 1.8 2.59814 2.32031 3.23799 2.32031H14.0345L0.341113 16.0172C-0.112402 16.4707 -0.112402 17.2055 0.341113 17.659C0.794629 18.1125 1.52939 18.1125 1.98291 17.659L15.6763 3.96211V14.7586C15.6763 15.3984 16.1966 15.9187 16.8364 15.9187C17.4763 15.9187 17.9966 15.3984 17.9966 14.7586V1.16016C18.0001 0.520312 17.4798 0 16.8399 0Z" fill="#0B0E13"/>
							</g>
							<defs>
								<clipPath id="clip0_0_427">
								<rect width="18" height="18" fill="white"/>
								</clipPath>
							</defs>
							</svg>
						</button>
					</div>
					<div class="testimonial-pagination">
						<span class="current">01</span> / <span class="total">01</span>
					</div>
				</div>
			</div>

		<?php  elseif ( 'style3' === $settings['style'] ) : ?>	

		<section class="testimonial-section-3 section-padding fix">
            <div class="left-shape">
                <?php  if ( !empty(esc_url($settings['image']['id']) )) : ?>   
					<img src="<?php echo wp_get_attachment_url($settings['image']['id']);?>" alt=""/>
				<?php endif;?>
            </div>
             <div class="right-shape">
                <?php  if ( !empty(esc_url($settings['image2']['id']) )) : ?>   
					<img src="<?php echo wp_get_attachment_url($settings['image2']['id']);?>" alt=""/>
				<?php endif;?>
            </div>
            <div class="container">
                <div class="testimonial-wrapper-3">
                    <div class="row g-4">
                        <div class="col-lg-4">
                            <div class="testimonial-image">
                            <?php  if ( !empty(esc_url($settings['image3']['id']) )) : ?>   
								<img src="<?php echo wp_get_attachment_url($settings['image3']['id']);?>" alt=""/>
							<?php endif;?>
                         </div>
                        </div>
                        <div class="col-lg-8">
                             <div class="testimonial-content">
                                <div class="icon-item">
                                    <div class="icon">
                                    <?php  if ( !empty(esc_url($settings['image4']['id']) )) : ?>   
										<img src="<?php echo wp_get_attachment_url($settings['image4']['id']);?>" alt=""/>
									<?php endif;?>
                                    </div>
                                    <h2 class="wow fadeInUp" data-wow-delay=".3s">
                                        <?php echo $settings['title'];?>
                                    </h2>
                                </div>
                                <div class="swiper testimonial-slider-3">
                                    <div class="swiper-wrapper">
										<?php foreach($settings['repeat'] as $item):?>	
                                        <div class="swiper-slide">
                                            <div class="testi-content">
                                                <p>
                                                   <?php echo wp_kses($item['section_text'], $allowed_tags);?>
                                                </p>
                                                <div class="quate-icon">
                                                    <?php if(!empty(wp_get_attachment_url($item['section_image']['id']))): ?>
														<img src="<?php echo wp_get_attachment_url($item['section_image']['id']);?>" alt="">
													<?php endif;?>
                                                </div>
                                            </div>
                                        </div>
										<?php endforeach; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

		<?php  elseif ( 'style4' === $settings['style'] ) : ?>	

			<div class="gt-testimonial-wrapper-3 m-0 p-0">
				<div class="testimonial-content">
					<?php if($settings['title']): ?>
					<div class="section-title-2">
						<h6 class="wow fadeInUp"><?php echo $settings['subtitle'];?></h6>
						<h2 class="wow fadeInUp" data-wow-delay=".3s">
							<?php echo $settings['title'];?>
						</h2>
					</div>
					<?php endif; ?>
					<div class="swiper gt-testimonial-slider">
						<div class="swiper-wrapper">

							<?php foreach($settings['repeat'] as $item):?>	
							<div class="swiper-slide">
								<div class="gt-testimonial-card-item">
									<div class="gt-client-info">
										<div class="image">
											<?php if(!empty(wp_get_attachment_url($item['section_image']['id']))): ?>
												<img src="<?php echo wp_get_attachment_url($item['section_image']['id']);?>" alt="">
											<?php endif;?>
										</div>
										<div class="text">
											<h6><?php echo wp_kses($item['section_title'], $allowed_tags);?></h6>
											<p><?php echo wp_kses($item['section_subtitle'], $allowed_tags);?></p>
										</div>
									</div>
									<div class="gt-testi-content">
										<div class="icon">
											<?php if(!empty(wp_get_attachment_url($item['section_image2']['id']))): ?>
												<img src="<?php echo wp_get_attachment_url($item['section_image2']['id']);?>" alt="">
											<?php endif;?>
										</div>
										<p>
											<?php echo wp_kses($item['section_text'], $allowed_tags);?>
										</p>
									</div>
								</div>
							</div>
								<?php endforeach; ?>

						</div>
					</div>
					<div class="swiper-dot mt-3">
						<div class="dot"></div>
					</div>
				</div>
			</div>

		<?php  elseif ( 'style5' === $settings['style'] ) : ?>	

		<section class="gt-testimonial-section-4 fix section-padding">
            <div class="gt-testimonial-image">
                <?php  if ( !empty(esc_url($settings['image']['id']) )) : ?>   
					<img src="<?php echo wp_get_attachment_url($settings['image']['id']);?>" alt=""/>
				<?php endif;?>
            </div>
            <div class="container">
				<?php if($settings['title']): ?>
                <div class="section-title-2 text-center">
                    <h6 class="wow fadeInUp"><?php echo $settings['subtitle'];?></h6>
                    <h2 class="wow fadeInUp" data-wow-delay=".3s">
                        <?php echo $settings['title'];?>
                    </h2>
                </div>
				<?php endif; ?>
                <div class="gt-testimonial-wraper-4">
                    <div class="swiper gt-testimonial-slider-4">
                        <div class="swiper-wrapper">

							<?php foreach($settings['repeat'] as $item):?>	
                            <div class="swiper-slide">
                                <div class="gt-testimonial-card-items-4">
                                    <div class="gt-client-info">
                                        <div class="gt-thumb">
                                           <?php if(!empty(wp_get_attachment_url($item['section_image']['id']))): ?>
												<img src="<?php echo wp_get_attachment_url($item['section_image']['id']);?>" alt="">
											<?php endif;?>
                                        </div>
                                        <div class="gt-content">
                                          	<h6><?php echo wp_kses($item['section_title'], $allowed_tags);?></h6>
											<p><?php echo wp_kses($item['section_subtitle'], $allowed_tags);?></p>
                                        </div>
                                    </div>
                                    <div class="gt-text">
                                       <div class="icon">
                                         <?php if(!empty(wp_get_attachment_url($item['section_image2']['id']))): ?>
											<img src="<?php echo wp_get_attachment_url($item['section_image2']['id']);?>" alt="">
										<?php endif;?>
                                       </div>
                                        <p>
                                            <?php echo wp_kses($item['section_text'], $allowed_tags);?>
                                        </p>
                                    </div>
                                    <div class="star">
                                        <i class="fa-solid fa-star-sharp"></i>
                                        <i class="fa-solid fa-star-sharp"></i>
                                        <i class="fa-solid fa-star-sharp"></i>
                                        <i class="fa-solid fa-star-sharp"></i>
                                        <i class="fa-solid fa-star-sharp"></i>
                                    </div>
                                </div>
                            </div>
								<?php endforeach; ?>

                        </div>
                    </div>
                </div>
            </div>
        </section>

		<?php endif ;?>	

             
		<?php 
	}


}

Plugin::instance()->widgets_manager->register_widget_type(new Testimonials());