AnonSec Shell
Server IP : 104.21.14.48  /  Your IP : 3.129.249.45   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/mu-plugins/vendor/wptool/wp-admin-dash/src/adminDash/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/mu-plugins/vendor/wptool/wp-admin-dash/src/adminDash/utils/Configuration.php
<?php

namespace Wptool\adminDash\utils;

use Wptool\adminDash\config\environments\ConfigDev;
use Wptool\adminDash\config\environments\ConfigProd;
use Wptool\adminDash\config\environments\ConfigLocal;
use Wptool\adminDash\config\environments\ConfigTest;
use Wptool\adminDash\exceptions\AdminDashException;
use Wptool\adminDash\exceptions\ConfigurationFailedToLoadException;

/**
 * Main configuration handler.
 */
class Configuration {

	/** @var string[] configuration map by env */
	protected static $config_envs = array(
		'prod'     => ConfigProd::class,
		'dev'      => ConfigDev::class,
		'test'     => ConfigTest::class,
		'myh.test' => ConfigTest::class,
		'local'    => ConfigLocal::class,
	);

	/** @var string[] configuration for current env */
	protected static $config = array();

	/** @var bool state of configuration*/
	private static $initialized = false;

	/** @var string state of configuration*/
	private static $env = null;

	/**
	 * Initializes the configuration.
	 * @throws AdminDashException
	 */
	public static function initialize() {
		self::$env = BundlesPath::resolve_env();

		self::load_config();

		self::$initialized = true;
	}

	/**
	 * Load config for environment.
	 *
	 * @return void
	 * @throws AdminDashException
	 */
	private static function load_config() {

		if ( empty( $env ) ) {
			self::$env = BundlesPath::resolve_env();
		}

		if ( isset( self::$config_envs[ self::$env ] ) && method_exists( self::$config_envs[ self::$env ], 'get_config' ) ) {

			self::$config = self::$config_envs[ self::$env ]::get_config();

		} elseif ( isset( self::$config_envs['prod'] ) && method_exists( self::$config_envs['prod'], 'get_config' ) ) {

			self::$config = self::$config_envs['prod']::get_config();

		} else {
			throw new ConfigurationFailedToLoadException( 'Configuration failed to boot for ' . self::$env );
		}
	}

	/**
	 * Gets the configuration value in key doted notation.
	 *
	 * @param string $key
	 * @param mixed|null $default default value to return
	 *
	 * @return mixed|null
	 */
	public static function get( $key, $default = null ) {

		if ( ! self::$initialized ) {
			self::initialize();
		}

		$array = self::$config;

		foreach ( explode( '.', $key ) as $segment ) {
			if ( ! array_key_exists( $segment, $array ) ) {
				return $default;
			}

			$array = $array[ $segment ];
		}

		return $array;
	}


	/**
	 * Checks if the key exists in the current configurations.
	 *
	 * @param string $key
	 *
	 * @return bool
	 */
	public static function has_key( $key ) {
		if ( ! self::$initialized ) {
			self::initialize();
		}

		return isset( self::$config[ $key ] );
	}
}

Anon7 - 2022
AnonSec Team