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/footer-links.php
<?php
namespace Elementor;

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

/**
 * Lesya Footer Links Widget.
 *
 * @since 1.0
 */

class Lesya_Footer_Links_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Footer Links', '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(
			'text', [
				'label'       => esc_html__( 'Text', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter text', 'lesya-plugin' ),
				'default' => esc_html__( 'Text', 'lesya-plugin' ),
				'dynamic' => [
					'active' => true,
				],
			]
		);

		$repeater->add_control(
			'link', [
				'label' => esc_html__( 'URL', 'lesya-plugin' ),
				'label_block' => true,
				'type' => Controls_Manager::URL,
				'show_external' => false,
				'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' => '{{{ text }}}',
			]
		);

		$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_color',
			[
				'label' => esc_html__( 'Item Link Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .footer-menu li a' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_typography',
				'label' => esc_html__( 'Item Link Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .footer-menu li',
			]
		);

		$this->end_controls_section();
	}

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

		?>

    <?php if ( $settings['items'] ) : ?>
    <ul class="footer-menu py-5">
      <?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' );
      ?>
      <li>
        <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; ?>>
          <span <?php echo $this->get_render_attribute_string( $item_text ); ?>>
            <?php echo wp_kses_post( $item['text'] ); ?>
          </span>
        </a>
      </li>
      <?php endforeach; ?>
    </ul>
    <?php endif; ?>

		<?php
	}
}

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