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

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

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

class Lesya_Numbers_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Numbers', '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(
			'value', [
				'label'       => esc_html__( 'Value', 'lesya-plugin' ),
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter value', 'lesya-plugin' ),
				'default' => esc_html__( '10', 'lesya-plugin' ),
			]
		);

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

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

		$this->end_controls_section();

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

		$this->add_control(
			'item_value_color',
			[
				'label' => esc_html__( 'Value Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .counter-item .count-text' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_value_typography',
				'label' => esc_html__( 'Value Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .counter-item .count-text',
			]
		);

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

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'item_label_typography',
				'label' => esc_html__( 'Label Typography:', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .counter-item p',
			]
		);

		$this->end_controls_section();
	}

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

		?>

    <!-- Counter Section Start -->
    <div class="counter-section text-white bg-yellow pt-60 pb-30">
        <div class="container">
            <?php if ( $settings['items'] ) : ?>
            <div class="row">
                <?php $i=2; foreach ( $settings['items'] as $index => $item ) : $i+=2;
                  $item_label = $this->get_repeater_setting_key( 'label', 'items', $index );
                  $this->add_inline_editing_attributes( $item_label, 'basic' );
                ?>
                <div class="col-lg-3 col-sm-6">
                    <div class="counter-item wow fadeInUp delay-0-2s">
                        <?php if ( $item['value'] ) : ?>
                        <span class="count-text" data-speed="5000" data-stop="<?php echo esc_attr( $item['value'] ); ?>">0</span>
                        <?php endif; ?>
                        <?php if ( $item['label'] ) : ?>
                        <p>
                          <span <?php echo $this->get_render_attribute_string( $item_label ); ?>>
  													<?php echo wp_kses_post( $item['label'] ); ?>
  												</span>
                        </p>
                        <?php endif; ?>
                    </div>
                </div>
                <?php endforeach; ?>
            </div>
            <?php endif; ?>
        </div>
    </div>
    <!-- Counter Section End -->

		<?php
	}
}

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