GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/parhudrw/roflma.it/wp-content/plugins/lesya-plugin/elementor/widgets/testimonials.php
<?php
namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Lesya Testimonials Widget.
 *
 * @since 1.0
 */

class Lesya_Testimonials_Widget extends Widget_Base {

	public function get_name() {
		return 'lesya-testimonials';
	}

	public function get_title() {
		return esc_html__( 'Testimonials', 'lesya-plugin' );
	}

	public function get_icon() {
		return 'eicon-parallax';
	}

	public function get_categories() {
		return [ 'lesya-category' ];
	}

	/**
	 * Register widget controls.
	 *
	 * @since 1.0
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'content_tab',
			[
				'label' => esc_html__( 'Content', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

    $this->add_control(
			'bg_text',
			[
				'label'       => esc_html__( 'Background Title', 'lesya-plugin' ),
        'label_block' => true,
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
				'default'     => esc_html__( 'Title', 'lesya-plugin' ),
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'items_tab',
			[
				'label' => esc_html__( 'Items', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'image', [
				'label' => esc_html__( 'Image', 'lesya-plugin' ),
				'type' => Controls_Manager::MEDIA,
				'default' => [
					'url' => \Elementor\Utils::get_placeholder_image_src(),
				],
			]
		);

		$repeater->add_control(
			'company', [
				'label'       => esc_html__( 'Company', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter company', 'lesya-plugin' ),
				'default' => esc_html__( 'Company', 'lesya-plugin' ),
			]
		);

		$repeater->add_control(
			'text', [
				'label'       => esc_html__( 'Text', 'lesya-plugin' ),
				'type'        => Controls_Manager::WYSIWYG,
				'placeholder' => esc_html__( 'Enter text', 'lesya-plugin' ),
				'default' => esc_html__( 'Text', 'lesya-plugin' ),
			]
		);

		$this->add_control(
			'items',
			[
				'label' => esc_html__( 'Items', 'lesya-plugin' ),
				'type' => Controls_Manager::REPEATER,
				'prevent_empty' => false,
				'fields' => $repeater->get_controls(),
				'title_field' => '{{{ name }}}',
			]
		);

		$this->end_controls_section();

    $this->start_controls_section(
			'images_tab',
			[
				'label' => esc_html__( 'Images', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

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

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

		$this->end_controls_section();

		$this->start_controls_section(
			'heading_styling',
			[
				'label' => esc_html__( 'Heading', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'bgtext_color',
			[
				'label' => esc_html__( 'BG Text Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .feedback-wrap .bg-text' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'bgtext_typography',
				'label' => esc_html__( 'BG Text Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .feedback-wrap .bg-text',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'items_styling',
			[
				'label' => esc_html__( 'Items', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_STYLE,
			]
		);

		$this->add_control(
			'item_text_color',
			[
				'label' => esc_html__( 'Text Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .feedback-wrap .feedback-content-item' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_text_typography',
				'label' => esc_html__( 'Text Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .feedback-wrap .feedback-content-item',
			]
		);

		$this->end_controls_section();
	}

	/**
	 * Render widget output on the frontend.
	 *
	 * @since 1.0
	 */
	protected function render() {
		$settings = $this->get_settings_for_display();

		$this->add_inline_editing_attributes( 'bg_text', 'none' );

		?>

    <!-- Feedback Section Start -->
    <div class="feedback-section rel z-1 bg-butter">
        <div class="container-fluid p-0">
            <div class="row">
                <div class="col-xl-6">
                    <?php if ( $settings['image'] ) : $image = wp_get_attachment_image_url( $settings['image']['id'], 'lesya_1920xAuto' ); ?>
                    <div class="feedback-left-image bgs-cover h-100" style="background-image: url('<?php echo esc_url( $image ); ?>');"></div>
                    <?php endif; ?>
                </div>
                <div class="col-xl-6">
                   <div class="feedback-wrap rel my-145 rm-100 text-center wow fadeInRight delay-0-2s">
                        <?php if ( $settings['bg_text'] ) : ?>
                        <span class="bg-text">
                          <span <?php echo $this->get_render_attribute_string( 'bg_text' ); ?>>
                            <?php echo wp_kses_post( $settings['bg_text'] ); ?>
                          </span>
                        </span>
                        <?php endif; ?>
                        <?php if ( $settings['items'] ) : ?>
                        <div class="feedback-item-wrap mb-35">
                            <?php foreach ( $settings['items'] as $index => $item ) :
                                $item_text = $this->get_repeater_setting_key( 'text', 'items', $index );
                                $this->add_inline_editing_attributes( $item_text, 'basic' );
                            ?>
                            <?php if ( $item['text'] ) : ?>
                            <div class="feedback-content-item">
                              <div <?php echo $this->get_render_attribute_string( $item_text ); ?>>
                                <?php echo wp_kses_post( $item['text'] ); ?>
                              </div>
                            </div>
                            <?php endif; ?>
                            <?php endforeach; ?>
                        </div>
                        <div class="feedback-logo-wrap">
                            <?php foreach ( $settings['items'] as $index => $item ) : ?>
                            <?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'lesya_900x900' ); ?>
                            <img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $item['company'] ); ?>" />
                            <?php endif; ?>
                            <?php endforeach; ?>
                        </div>
                        <?php endif; ?>
                   </div>
               </div>
            </div>
        </div>
        <?php if ( $settings['bg_image'] ) : $image = wp_get_attachment_image_url( $settings['bg_image']['id'], 'lesya_900xAuto' ); ?>
        <div class="feedback-leaf">
            <img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $settings['bg_text'] ); ?>" />
        </div>
        <?php endif;?>
    </div>
    <!-- Feedback Section End -->

		<?php
	}
}

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