Uname: Linux premium264.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.3.22 [ PHP INFO ] PHP os: Linux
Server Ip: 69.57.162.13
Your Ip: 216.73.216.219
User: workvvfb (1129) | Group: workvvfb (1084)
Safe Mode: OFF
Disable Function:
NONE

name : class-frontend.php
<?php

namespace WPDaddy\Builder;

use Elementor\Plugin as Elementor_Plugin;
use WPDaddy\Builder\Library\Header;

defined('ABSPATH') OR exit;

final class Frontend {
	private static $instance = null;

	/** @return self */
	public static function instance(){
		if(is_null(static::$instance)) {
			static::$instance = new static();
		}

		return static::$instance;
	}

	private function __construct(){
		$settings = Settings::instance()->get_settings();
		if($this->show_panel()) {
			define('WPDA_PANEL_ENABLED', true);
			add_action('wp_enqueue_scripts', array( $this, 'action_wp_enqueue_scripts' ));
		}
	}

	public static function can_show(){
		return (
			!is_admin() && current_user_can('manage_options')
		);
	}

	public static function show_panel(){
		return (
			static::can_show()
			&& key_exists('wpda-show-panel', $_GET) && $_GET['wpda-show-panel']
		);
	}

	public function action_wp_enqueue_scripts(){
		if(!static::can_show()) {
			return;
		}
		wp_enqueue_script('react');
		wp_enqueue_script('react-dom');
		wp_enqueue_script('moment');
		wp_enqueue_script('lodash');
		wp_enqueue_script('wp-components');
		wp_enqueue_script('wp-api-fetch');
		wp_enqueue_script('wp-notices');

		Assets::enqueue_script('wpda-builder-pro', 'frontend/panel.js');
		Assets::enqueue_style('wpda-builder-pro', 'frontend/panel.css');
	}
}
© 2025 GrazzMean