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/main-section.php
<?php
namespace Elementor;

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

/**
 * Lesya Started Slider Widget.
 *
 * @since 1.0
 */
class Lesya_Started_Slider_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Started Slider', '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(
			'slides_tab',
			[
				'label' => esc_html__( 'Slides', '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(),
				],
				'dynamic' => [
					'active' => true,
				],
			]
		);

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

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

		$repeater->add_control(
			'bg_text', [
				'label'       => esc_html__( 'BG Text', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter BG Text', 'lesya-plugin' ),
				'default' => esc_html__( 'Enter BG Text', 'lesya-plugin' ),
				'dynamic' => [
					'active' => true,
				],
			]
		);

		$repeater->add_control(
			'button',
			[
				'label'       => esc_html__( 'Button (Text)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter Button Label', 'lesya-plugin' ),
				'default'     => esc_html__( 'Button', 'lesya-plugin' ),
				'dynamic' => [
					'active' => true,
				],
			]
		);

		$repeater->add_control(
			'link',
			[
				'label' => esc_html__( 'Button (URL)', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::URL,
				'show_external' => true,
				'dynamic' => [
					'active' => true,
				],
			]
		);

		$repeater->add_control(
			'button-adv',
			[
				'label'       => esc_html__( 'Button Advanced (Text)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter Button Label', 'lesya-plugin' ),
				'default'     => esc_html__( 'Button', 'lesya-plugin' ),
				'dynamic' => [
					'active' => true,
				],
			]
		);

		$repeater->add_control(
			'link-adv',
			[
				'label' => esc_html__( 'Button Advanced (URL)', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::URL,
				'show_external' => true,
				'dynamic' => [
					'active' => true,
				],
			]
		);

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

		$this->end_controls_section();

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

		$this->add_control(
			'item_title_color',
			[
				'label' => esc_html__( 'Title Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .slider-single-item h1' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_title_typography',
				'label' => esc_html__( 'Title Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .slider-single-item h1',
			]
		);

		$this->add_control(
			'item_subtitle_color',
			[
				'label' => esc_html__( 'Subtitle Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .slider-single-item .sub-title' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_subtitle_typography',
				'label' => esc_html__( 'Subtitle Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .slider-single-item .sub-title',
			]
		);

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

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

		$this->end_controls_section();
	}


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

		<!-- Slider Section Start -->
		<section class="slider-section">
			  <?php foreach ( $settings['items'] as $index => $item ) :

					$item_bgtext = $this->get_repeater_setting_key( 'bg_text', 'items', $index );
					$this->add_inline_editing_attributes( $item_bgtext, 'basic' );

					$item_subtitle = $this->get_repeater_setting_key( 'subtitle', 'items', $index );
					$this->add_inline_editing_attributes( $item_subtitle, 'basic' );

					$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
					$this->add_inline_editing_attributes( $item_title, 'basic' );

				?>
				<div class="slider-single-item" <?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'lesya_1920xAuto' ); ?>style="background-image: url(<?php echo esc_url( $image ); ?>)"<?php endif; ?>>
						<div class="container">
								<?php if ( $item['bg_text'] ) : ?>
								<span class="bg-text">
									<span <?php echo $this->get_render_attribute_string( $item_bgtext ); ?>>
										<?php echo wp_kses_post( $item['bg_text'] ); ?>
									</span>
								</span>
								<?php endif; ?>
								<?php if ( $item['subtitle'] ) : ?>
								<span class="sub-title">
									<span <?php echo $this->get_render_attribute_string( $item_subtitle ); ?>>
										<?php echo wp_kses_post( $item['subtitle'] ); ?>
									</span>
								</span>
								<?php endif; ?>
								<?php if ( $item['title'] ) : ?>
								<h1>
									<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
										<?php echo wp_kses_post( $item['title'] ); ?>
									</span>
								</h1>
								<?php endif; ?>
								<div class="slider-btn">
									<?php if ( $item['button'] ) : ?>
	    						<a<?php if ( $item['link'] ) : ?><?php if ( $item['link']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $item['link']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $item['link']['url'] ); ?>"<?php endif; ?> class="theme-btn style-six">
	    							<?php echo wp_kses_post( $item['button'] ); ?>
	    							<i class="fas fa-long-arrow-alt-right"></i>
	    						</a>
	                <?php endif; ?>
	                <?php if ( $item['button-adv'] ) : ?>
	    						<a<?php if ( $item['link-adv'] ) : ?><?php if ( $item['link-adv']['is_external'] ) : ?> target="_blank"<?php endif; ?><?php if ( $item['link-adv']['nofollow'] ) : ?> rel="nofollow"<?php endif; ?> href="<?php echo esc_url( $item['link-adv']['url'] ); ?>"<?php endif; ?> class="theme-btn style-five">
	    							<?php echo wp_kses_post( $item['button-adv'] ); ?>
	    							<i class="fas fa-long-arrow-alt-right"></i>
	    						</a>
									<?php endif; ?>
	    					</div>
						</div>
				</div>
				<?php endforeach; ?>
		</section>
		<!-- Slider Section End -->

		<?php
	}

	/**
	 * Render widget output in the editor.
	 *
	 * Written as a Backbone JavaScript template and used to generate the live preview.
	 *
	 * @since 1.0.0
	 * @access protected
	 */
	/*protected function content_template() { ?>

	<?php }*/
}

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