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/contact-us.php
<?php
namespace Elementor;

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

/**
 * Lesya Contact Us Widget.
 *
 * @since 1.0
 */

class Lesya_Contact_Us_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Contact Us', '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__( 'Contact Items', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$repeater = new \Elementor\Repeater();

		$repeater->add_control(
			'icon', [
				'label'       => esc_html__( 'Icon', 'myour-plugin' ),
				'type'        => Controls_Manager::ICONS,
				'label_block' => 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__( 'Title', 'lesya-plugin' ),
			]
		);

		$repeater->add_control(
			'description', [
				'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' => '{{{ title }}}',
			]
		);

		$this->end_controls_section();

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

		$this->add_control(
			'item_icon_color',
			[
				'label' => esc_html__( 'Item Icon Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .contact-info-item .icon' => 'color: {{VALUE}};',
					'{{WRAPPER}} .contact-info-item .icon svg' => 'fill: {{VALUE}};',
				],
			]
		);

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

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

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

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

		$this->end_controls_section();

	}

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

    <!-- Contact Information Start -->
    <section class="contact-info-section pt-150 rpt-100 pb-120 rpb-70">
        <div class="container">
            <?php if ( $settings['items'] ) : ?>
            <div class="row justify-content-center">
                <?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_description = $this->get_repeater_setting_key( 'description', 'items', $index );
									$this->add_inline_editing_attributes( $item_description, 'advanced' );
                ?>
                <div class="col-lg-4 col-sm-6">
                    <div class="contact-info-item wow fadeInUp delay-0-2s">
                        <span class="icon">
							<?php if ( $item['icon'] ) : ?>
                          		<?php \Elementor\Icons_Manager::render_icon( $item['icon'], [ 'aria-hidden' => 'true' ] ); ?>
                        	<?php endif; ?>
						</span>
                        <?php if ( $item['title'] ) : ?>
                        <h4>
  												<span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
  													<?php echo wp_kses_post( $item['title'] ); ?>
  												</span>
    										</h4>
    										<?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; ?>
                    </div>
                </div>
                <?php endforeach; ?>
            </div>
            <?php endif; ?>
        </div>
    </section>
    <!-- Contact Information 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_Contact_Us_Widget() );