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

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

/**
 * Lesya Pricing Widget.
 *
 * @since 1.0
 */
class Lesya_Pricing_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Pricing', '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(
			'icon', [
				'label'       => esc_html__( 'Icon Class', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXT,
				'placeholder' => esc_html__( 'Enter class', 'lesya-plugin' ),
				'default' => esc_html__( 'icon', 'lesya-plugin' ),
			]
		);

		$repeater->add_control(
			'icon_note',
			[
				'type' => Controls_Manager::RAW_HTML,
				'raw' => __( 'IMPORTANT! You can use icons class FontAwesome or Flaticon. Examples: <br><br><strong>fas fa-swimmer</strong> - find classes <a href="https://fontawesome.com/v5/search" target="blank">here</a> <br><br><strong>flaticon-laser</strong> - find classes <a href="https://lesya.bslthemes.com/flaticons.html" target="blank">here</a>', 'lesya-plugin' ),
				'content_classes' => 'elementor-descriptor',
			]
		);

		$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(
			'price', [
				'label'       => esc_html__( 'Price', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::TEXTAREA,
				'placeholder' => esc_html__( 'Enter price', 'lesya-plugin' ),
				'default' => esc_html__( 'Price', 'lesya-plugin' ),
			]
		);

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

    $repeater->add_control(
			'description', [
				'label'       => esc_html__( 'Description', 'lesya-plugin' ),
				'label_block' => true,
				'type'        => Controls_Manager::WYSIWYG,
				'placeholder' => esc_html__( 'Enter description', 'lesya-plugin' ),
				'default' => esc_html__( 'Description', '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(
			'items_styling',
			[
				'label'     => esc_html__( 'Items Styling', 'lesya-plugin' ),
				'tab'       => Controls_Manager::TAB_STYLE,
			]
		);

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

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

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

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

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

		$this->add_control(
			'item_price_color',
			[
				'label'     => esc_html__( 'Price Color', 'lesya-plugin' ),
				'type'      => Controls_Manager::COLOR,
				'default'	=> '',
				'selectors' => [
					'{{WRAPPER}} .pricing-content .pricing-title .price' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'item_price_typography',
				'label'     => esc_html__( 'Price Typography', 'lesya-plugin' ),
				'selector' => '{{WRAPPER}} .pricing-content .pricing-title .price',
			]
		);

		$this->end_controls_section();
	}


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

		?>

    <!-- Offer Section Start -->
    <?php if ( $settings['items'] ) : ?>
    <div class="pricing-wrap wow fadeInLeft delay-0-2s">
      <?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_price = $this->get_repeater_setting_key( 'price', 'items', $index );
        $this->add_inline_editing_attributes( $item_price, 'basic' );

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

        $item_description = $this->get_repeater_setting_key( 'description', 'items', $index );
        $this->add_inline_editing_attributes( $item_description, 'advanced' );
      ?>
      <div class="pricing-item">
        <?php if ( $item['icon'] ) : ?>
          <i class="<?php echo esc_attr( $item['icon'] ); ?>"></i>
        <?php endif; ?>
        <div class="pricing-content">
          <div class="pricing-title">
            <?php if ( $item['title'] ) : ?>
            <h5>
              <span <?php echo $this->get_render_attribute_string( $item_title ); ?>>
                <?php echo wp_kses_post( $item['title'] ); ?>
              </span>
            </h5>
            <?php endif; ?>
            <?php if ( $item['price'] ) : ?>
              <span class="price">
			  	<?php if ( $item['price_before'] ) : ?>
			  	<span <?php echo $this->get_render_attribute_string( $item_price_b ); ?>>
                  <?php echo wp_kses_post( $item['price_before'] ); ?>
                </span>
				<?php endif; ?>
                <span <?php echo $this->get_render_attribute_string( $item_price ); ?>>
                  <?php echo wp_kses_post( $item['price'] ); ?>
                </span>
              </span>
            <?php endif; ?>
          </div>
          <?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>
        </a>
      </div>
      <?php endforeach; ?>
    </div>
    <?php endif; ?>
    <!-- Offer Section 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_Pricing_Widget() );