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/booking-info.php
<?php
namespace Elementor;

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

/**
 * Lesya Booking Info Widget.
 *
 * @since 1.0
 */

class Lesya_Booking_Info_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Booking Info', '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(
			'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(
			'title', [
				'label'       => esc_html__( 'Title', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter title', 'lesya-plugin' ),
				'default' => esc_html__( 'Title', 'lesya-plugin' ),
			]
		);

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

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

		$repeater->add_control(
			'item1_show', [
				'label' => esc_html__( 'Field #1', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'no',
			]
		);

		$repeater->add_control(
			'item1_icon', [
				'label' => esc_html__( 'Icon (Field #1)', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::ICONS,
				'condition' => [
					'item1_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'item1_subtitle', [
				'label'       => esc_html__( 'Subtitle (Field #1)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter subtitle', 'lesya-plugin' ),
				'default' => esc_html__( 'Subtitle', 'lesya-plugin' ),
				'condition' => [
					'item1_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'item1_text', [
				'label'       => esc_html__( 'Text (Field #1)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter text', 'lesya-plugin' ),
				'default' => esc_html__( 'Text', 'lesya-plugin' ),
				'condition' => [
					'item1_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'item2_show', [
				'label' => esc_html__( 'Field #2', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'no',
			]
		);

		$repeater->add_control(
			'item2_icon', [
				'label' => esc_html__( 'Icon (Field #2)', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::ICONS,
				'condition' => [
					'item2_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'item2_subtitle', [
				'label'       => esc_html__( 'Subtitle (Field #2)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter subtitle', 'lesya-plugin' ),
				'default' => esc_html__( 'Subtitle', 'lesya-plugin' ),
				'condition' => [
					'item2_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'item2_text', [
				'label'       => esc_html__( 'Text (Field #2)', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter text', 'lesya-plugin' ),
				'default' => esc_html__( 'Text', 'lesya-plugin' ),
				'condition' => [
					'item2_show' => 'yes',
				],
			]
		);

		$repeater->add_control(
			'button_show', [
				'label' => esc_html__( 'Button', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'no',
			]
		);

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

		$repeater->add_control(
			'link', [
				'label'       => esc_html__( 'Button (URL)', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::URL,
				'show_external' => true,
				'condition' => [
					'button_show' => 'yes',
				],
				'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_bgtext_color',
			[
				'label' => esc_html__( 'BG text Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .booking-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}} .booking-item .bg-text',
			]
		);

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

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

		$this->add_control(
			'item_description_color',
			[
				'label' => esc_html__( 'Description Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .booking-item > div' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_description_typography',
				'label' => esc_html__( 'Description Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .booking-item > div',
			]
		);

		$this->add_control(
			'item_title2_color',
			[
				'label' => esc_html__( 'Title 2 Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .booking-item .booking-info h5' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_title2_typography',
				'label' => esc_html__( 'Title 2 Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .booking-item .booking-info h5',
			]
		);

		$this->add_control(
			'item_desc2_color',
			[
				'label' => esc_html__( 'Text 2 Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .booking-item .booking-info p' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_desc2_typography',
				'label' => esc_html__( 'Text 2 Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .booking-item .booking-info p',
			]
		);

		$this->add_control(
			'item_icon_color',
			[
				'label' => esc_html__( 'Icon Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .booking-item .booking-content ul li > i' => 'color: {{VALUE}};',
					'{{WRAPPER}} .booking-item .booking-content ul li > svg' => 'fill: {{VALUE}};',
				],
			]
		);

		$this->end_controls_section();
	}

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

		?>

		<!-- Booking Section Start -->
		<section class="booking-section pb-20">
				<div class="container-fluid">
						<?php if ( $settings['items'] ) : ?>
						<div class="row">
								<?php foreach ( $settings['items'] as $index => $item ) :
									$item_title = $this->get_repeater_setting_key( 'title', 'items', $index );
									$this->add_inline_editing_attributes( $item_title, 'basic' );

									$item_bg_title = $this->get_repeater_setting_key( 'bg_title', 'items', $index );
									$this->add_inline_editing_attributes( $item_bg_title, 'none' );

									$item_description = $this->get_repeater_setting_key( 'description', 'items', $index );
									$this->add_inline_editing_attributes( $item_description, 'advanced' );

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

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

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

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

									$item_button = $this->get_repeater_setting_key( 'button', 'items', $index );
									$this->add_inline_editing_attributes( $item_button, 'none' );
								?>
								<div class="col-xl-6">
									 <div class="booking-item">
										 		<?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'lesya_900xAuto' ); ?>
												<div class="booking-image" style="background-image: url('<?php echo esc_url( $image ); ?>');"></div>
												<?php endif; ?>
												<div class="booking-content wow fadeInUp delay-0-4s">
														<?php if ( $item['bg_title'] ) : ?>
														<span class="bg-text">
															<span <?php echo $this->get_render_attribute_string( $item_bg_title ); ?>>
																<?php echo esc_html( $item['bg_title'] ); ?>
															</span>
														</span>
														<?php endif; ?>
														<?php if ( $item['title'] ) : ?>
														<h3>
															<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
																<?php echo wp_kses_post( $item['title'] ); ?>
															</span>
														</h3>
														<?php endif; ?>
														<?php if ( $item['description'] ) : ?>
														<div <?php echo $this->get_render_attribute_string( $item_description ); ?>>
															<?php echo wp_kses_post( $item['description'] ); ?>
														</div>
														<?php endif; ?>
														<?php if ( $item['item1_show'] == 'yes' || $item['item2_show'] == 'yes' ) : ?>
														<ul>
																<?php if ( $item['item1_show'] == 'yes' ) : ?>
																<li>
																	 <?php if ( $item['item1_icon'] ) : ?>
																	 	<?php \Elementor\Icons_Manager::render_icon( $item['item1_icon'], [ 'aria-hidden' => 'true' ] ); ?>
																 	 <?php endif; ?>
																	 <div class="booking-info">
																		 	 <?php if ( $item['item1_subtitle'] ) : ?>
																		 	 <h5>
																				 <span <?php echo $this->get_render_attribute_string( $item1_subtitle ); ?>>
							 														<?php echo wp_kses_post( $item['item1_subtitle'] ); ?>
							 													 </span>
																			 </h5>
																		 	 <?php endif; ?>
																			 <?php if ( $item['item1_text'] ) : ?>
																			 <p>
																				 <span <?php echo $this->get_render_attribute_string( $item1_text ); ?>>
							 														<?php echo wp_kses_post( $item['item1_text'] ); ?>
							 													 </span>
																			 </p>
																		 	 <?php endif; ?>
																		</div>
																</li>
																<?php endif; ?>
																<?php if ( $item['item2_show'] == 'yes' ) : ?>
																<li>
																	 <?php if ( $item['item2_icon'] ) : ?>
																	 	<?php \Elementor\Icons_Manager::render_icon( $item['item2_icon'], [ 'aria-hidden' => 'true' ] ); ?>
																 	 <?php endif; ?>
																	 <div class="booking-info">
																		 	 <?php if ( $item['item2_subtitle'] ) : ?>
																		 	 <h5>
																				 <span <?php echo $this->get_render_attribute_string( $item2_subtitle ); ?>>
							 														<?php echo wp_kses_post( $item['item2_subtitle'] ); ?>
							 													 </span>
																			 </h5>
																		 	 <?php endif; ?>
																			 <?php if ( $item['item2_text'] ) : ?>
																			 <p>
																				 <span <?php echo $this->get_render_attribute_string( $item2_text ); ?>>
							 														<?php echo wp_kses_post( $item['item2_text'] ); ?>
							 													 </span>
																			 </p>
																		 	 <?php endif; ?>
																		</div>
																</li>
																<?php endif; ?>
														</ul>
														<?php endif; ?>

														<?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">
															<span <?php echo $this->get_render_attribute_string( $item_button ); ?>>
																<?php echo esc_html( $item['button'] ); ?>
															</span>
															<i class="fas fa-long-arrow-alt-right"></i>
														</a>
														<?php endif; ?>
											 </div>
									 </div>
								</div>
								<?php endforeach; ?>
						</div>
						<?php endif; ?>
				</div>
		</section>
		<!-- Booking Section End -->

		<?php
	}
}

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