HEX
Server: Apache
System: Linux host17.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User: shrsglobal (7178)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/shrsglobal/www/wp-content/plugins/elementor/vendor/elementor/wp-one-package/src/Loader.php
<?php

namespace ElementorOne;

use ElementorOne\Admin\Config;
use ElementorOne\Connect\Facade;

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

/**
 * Class \ElementorOne\Loader
 */
class Loader {

	/**
	 * Initialize the loader.
	 * @return void
	 */
	public static function init(): void {
		/**
		 * Fires in the early stages of Elementor One init hook.
		 */
		do_action( 'elementor_one/pre_init' );

		self::define_constants();
		self::initialize_connect();
		self::initialize_services();
		self::initialize_components();
		self::initialize_controllers();
	}

	/**
	 * Initialize the Connect facade with configuration.
	 *
	 * @return void
	 */
	private static function initialize_connect(): void {
		Facade::make( [
			'app_name' => Config::APP_NAME,
			'app_prefix' => Config::APP_PREFIX,
			'app_rest_namespace' => Config::APP_REST_NAMESPACE,
			'admin_page' => Config::ADMIN_PAGE,
			'base_url' => Config::BASE_URL,
			'app_type' => Config::APP_TYPE,
			'plugin_slug' => Config::PLUGIN_SLUG,
			'scopes' => Config::SCOPES,
			'connect_mode' => Config::CONNECT_MODE,
			'state_nonce' => Config::STATE_NONCE,
		] );
	}

	/**
	 * Initialize all services.
	 *
	 * @return void
	 */
	private static function initialize_services(): void {
		\ElementorOne\Admin\Services\Editor::instance();
		\ElementorOne\Admin\Services\Migration::instance();
	}

	/**
	 * Initialize all components.
	 *
	 * @return void
	 */
	private static function initialize_components(): void {
		\ElementorOne\Admin\Components\Page::instance();
		\ElementorOne\Admin\Components\Assets::instance();
		\ElementorOne\Admin\Components\Fields::instance();
		\ElementorOne\Admin\Components\Onboarding::instance();
		\ElementorOne\Admin\Components\EditorUpdateNotification::instance();
	}

	/**
	 * Initialize all REST controllers.
	 *
	 * @return void
	 */
	private static function initialize_controllers(): void {
		new \ElementorOne\Admin\Controllers\TopBar();
		new \ElementorOne\Admin\Controllers\Themes();
		new \ElementorOne\Admin\Controllers\Plugins();
		new \ElementorOne\Admin\Controllers\Settings();
	}

	/**
	 * Define constants
	 * @return void
	 */
	public static function define_constants(): void {
		if ( ! defined( 'ELEMENTOR_ONE_ASSETS_URL' ) && function_exists( 'plugin_dir_url' ) ) {
			define( 'ELEMENTOR_ONE_ASSETS_URL', plugin_dir_url( __DIR__ ) . 'assets/build/' );
		}

		if ( ! defined( 'ELEMENTOR_ONE_ASSETS_PATH' ) && function_exists( 'plugin_dir_path' ) ) {
			define( 'ELEMENTOR_ONE_ASSETS_PATH', plugin_dir_path( __DIR__ ) . 'assets/build/' );
		}

		if ( ! defined( 'ELEMENTOR_ONE_UI_ASSETS_ROOT_URL' ) && function_exists( 'plugin_dir_url' ) ) {
			define( 'ELEMENTOR_ONE_UI_ASSETS_ROOT_URL', plugin_dir_url( __DIR__ ) . 'assets/elementor-home/' );
		}

		if ( ! defined( 'ELEMENTOR_ONE_CLIENT_APP_URL' ) ) {
			define( 'ELEMENTOR_ONE_CLIENT_APP_URL', ELEMENTOR_ONE_UI_ASSETS_ROOT_URL . 'client.js' );
		}
	}
}