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

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

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

class Lesya_Clients_Widget extends Widget_Base {

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

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

		$repeater->add_control(
			'link', [
				'label'       => esc_html__( 'Link (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();
	}

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

		?>

		<!-- Client Logo Section Start -->
		<div class="client-logos text-center pt-80 pb-70">
      <div class="container">
		    <?php if ( $settings['items'] ) : ?>
          <div class="client-logo-wrap">
            <?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' );

            ?>
              <?php if ( $item['image'] ) : $image = wp_get_attachment_image_url( $item['image']['id'], 'lesya_900x900' ); ?>
								<div>
									<?php if ( $item['link'] ) : if ( $item['link']['url'] ) : ?>
									<a<?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; endif; ?>
	                  <img src="<?php echo esc_url( $image ); ?>" alt="<?php echo esc_attr( $item_title ); ?>" />
									<?php if ( $item['link'] ) : if ( $item['link']['url'] ) : ?>
	                </a>
									<?php endif; endif; ?>
								</div>
              <?php endif; ?>
    				<?php endforeach; ?>
          </div>
				<?php endif; ?>
      </div>
		</section>
		<!-- Client Logo Section End -->

		<?php
	}
}

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