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

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

/**
 * Lesya Header Buttons Widget.
 *
 * @since 1.0
 */
class Lesya_Header_Buttons_Widget extends Widget_Base {

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

	public function get_title() {
		return esc_html__( 'Header Buttons', '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(
			'content_tab',
			[
				'label' => esc_html__( 'Content', 'lesya-plugin' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'search_show',
			[
				'label' => esc_html__( 'Show Search', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->add_control(
			'sidebar_show',
			[
				'label' => esc_html__( 'Show Sidebar', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->add_control(
			'cart_show',
			[
				'label' => esc_html__( 'Show Shopping Cart', 'lesya-plugin' ),
				'type' => Controls_Manager::SWITCHER,
				'label_on' => __( 'Show', 'lesya-plugin' ),
				'label_off' => __( 'Hide', 'lesya-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);

		$this->add_responsive_control(
			'align',
			[
				'label' => __( 'Alignment', 'lesya-plugin' ),
				'type' => Controls_Manager::CHOOSE,
				'options' => [
					'left' => [
						'title' => __( 'Left', 'lesya-plugin' ),
						'icon' => 'eicon-text-align-left',
					],
					'center' => [
						'title' => __( 'Center', 'lesya-plugin' ),
						'icon' => 'eicon-text-align-center',
					],
					'right' => [
						'title' => __( 'Right', 'lesya-plugin' ),
						'icon' => 'eicon-text-align-right',
					],
				],
				'selectors' => [
					'{{WRAPPER}} .menu-icons' => 'justify-content: {{VALUE}};',
				],
				'default'	=> 'right',
			]
		);

		$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(
			'icons_color',
			[
				'label' => esc_html__( 'Icons Color', 'lesya-plugin' ),
				'type' => Controls_Manager::COLOR,
				'default'   => '',
				'selectors' => [
					'{{WRAPPER}} .menu-sidebar button .icon-bar' => 'background-color: {{VALUE}};',
					'{{WRAPPER}} .cart .cart-btn, .nav-search .fa-search' => 'color: {{VALUE}};',
				],
			]
		);

		$this->end_controls_section();

	}


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

		$this->add_inline_editing_attributes( 'button', 'none' );

		?>

    <!-- Menu Button -->
    <div class="menu-icons">
				<?php if ( $settings['cart_show'] == 'yes' ) : ?>
				<?php if ( class_exists( 'WooCommerce' ) ) : ?>
			  <?php if ( true == get_theme_mod( 'cart_shop', true ) ) : if ( is_object( WC()->cart ) ) : ?>
				<div class="cart">
					 <a href="#" class="cart-btn">
           		<i class="fas fa-shopping-cart"></i>
					 		<span class="cart-count"><?php echo sprintf (_n( '%d', '%d', WC()->cart->get_cart_contents_count(), 'lesya' ), WC()->cart->get_cart_contents_count() ); ?></span>
					 </a>
					 <div class="cart-widget">
	 					  <?php woocommerce_mini_cart(); ?>
	 			   </div>
        </div>
				<?php endif; endif; ?>
				<?php endif; ?>
				<?php endif; ?>

			  <?php if ( $settings['search_show'] == 'yes' ) : ?>
        <!-- Nav Search -->
        <div class="nav-search py-15">
            <button class="fa fa-search"></button>
            <form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="hide">
                <input type="text" value="<?php echo esc_attr( get_search_query() ); ?>" placeholder="<?php echo esc_attr__( 'Search', 'lesya-plugin' ); ?>" class="searchbox" required="" name="s" />
                <button type="submit" class="searchbutton fa fa-search"></button>
            </form>
        </div>
			  <?php endif; ?>

				<?php if ( $settings['sidebar_show'] == 'yes' ) : ?>
        <!-- menu sidbar -->
        <div class="menu-sidebar">
            <button>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
				<?php endif; ?>
    </div>

		<?php
	}
}

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