/** * Загрузка конфига * @param array $config */ public static function set($config) { if (empty($config)) { throw new Exception('Class Config: empty array $config'); } self::$config = $config; }
public static function factory() { if (!self::$config) { self::$config = (include APPPATH . '/config.php'); } return self::$config; }
public static function get() { if (empty(self::$config)) { self::$config = (require_once GW2STATS_PATH . '/config/config.php'); } return self::$config; }
public static function init() { if (!self::$config) { self::$config = (include BASE_PATH . 'config.php'); } // Incluir la base de datos include BASE_PATH . 'app/DB.php'; include BASE_PATH . 'app/DBObject.php'; include BASE_PATH . 'app/Query.php'; // Conectamos con la base de datos DB::config(self::get('database')); DB::connect(); // Definimos algunas constantes importantes foreach (array('cache', 'includes', 'models', 'controllers', 'views', 'assets') as $path) { self::$config['path'][$path . '_orig'] = self::$config['path'][$path]; self::$config['path'][$path] = BASE_PATH . self::get('path.' . $path) . '/'; } // Cargar los modelos automáticamente foreach (glob(self::get('path.models') . '*.php', GLOB_NOSORT) as $file) { include $file; } // Configurar el cargado automático de clases spl_autoload_register(function ($name) { require Config::get('path.includes') . $name . '.php'; }); Cache::configure(array('cache_path' => self::get('path.cache'), 'expires' => self::get('cache.expires'))); }
public static function getConfig() { if (Config::$config == null) { Config::$config = json_decode(file_get_contents(MAIN_PATH . "/private/config.json"), true); } return Config::$config; }
public static function get($key) { if (!self::$config) { self::$config = (require '../app/config/config.' . Environment::get() . '.php'); } return self::$config[$key]; }
/** * get_config() * * Simple wrapper-function that retrieves the given entry from the * config-array. * This is added as a step towards an invisible and protected config-array * * @param String $entry_name the name of the config-switch to find * @return String the config-entry * @access public * @throws KeyNotFoundException */ static function get_config($entry_name) { if (!is_object(Config::$config)) { Config::$config = new Config_Holder(); } return Config::$config->getConfigVal($entry_name); }
/** * Merges the given array with the config array. It uses the keys/values from config/container.php. * * @param array $tconfig */ static function setConfig($tconfig) { if (!is_array(self::$config)) { self::loadConfig(); } self::$config = array_merge(self::$config, $tconfig); }
public function get($paramId) { self::$configFilePath = dirname(__FILE__) . '/../../config/parameters.json'; if (count(self::$config) == 0) { self::$config = json_decode(file_get_contents(self::$configFilePath)); } return self::$config->{$paramId}; }
public static function get($config = NULL) { if ($config == NULL) { return new stdObject(); } self::$config = (require ROOT . DS . 'config' . DS . $config . EXT); return json_decode(json_encode(self::$config)); }
public static function init() { if (Config::config('cache') == true) { $config = Config::cache(); Loader::core('CacheCarry'); Loader::driver('caches', $config['driver']); self::$cache = new $config['driver']($config); } }
function __construct() { $rand = rand(0, 1); if ($rand == 0) { $this->font = __ROOT__ . parseDir(Config::config('core_dir'), 'libs', 'font') . 'elephant.ttf'; } else { $this->font = __ROOT__ . parseDir(Config::config('core_dir'), 'libs', 'font') . 'Vineta.ttf'; } }
public static function loadFile($filename) { $ini = @parse_ini_file($filename, true); if ($ini === FALSE) { $phpError = error_get_last(); throw new ConfigLoadException('Can\'t load config file: ' . $phpError['message']); } self::$config = $ini; }
public static function get($item) { if (isset(self::$config[$item])) { return self::$config[$item]; } require 'config.php'; self::$config = $config; return isset(self::$config[$item]) ? self::$config[$item] : false; }
public static function get($name) { if (null === self::$config) { self::$config = Db::pairs("SELECT c.nombre, c.valor\n FROM configuracion c\n ORDER BY c.nombre"); } if (self::$config[$name]) { return self::$config[$name]; } return false; }
public static function url($action, $get = false) { $url = self::$router->_url($action, $get); //var_dump(Config::router('hidden_entry')); if (Config::router('hidden_entry') !== true) { return Config::config('entry') . '/' . $url; } else { return '/' . Config::config('app_dir') . '/' . $url; } }
/** * Constructor (singleton!) * * @return void */ private function __construct() { // current dir might be in an extension or in core.. if (file_exists('../../config/config.ini')) { $path = '../../config/config.ini'; } else { $path = '../config/config.ini'; } self::$config = parse_ini_file($path); }
static function stop() { self::$stopTime = microtime(true); //将获取的时间赋给成员属性$stopTime if (Config::config('debug')) { //显示DEBUG信息 debug::message(); } // if(Extension_Loaded('zlib')&&GZIP===TRUE)Ob_End_Flush(); }
/** * Get function, returns a Config object * * @return Config * @access public */ public static function Get() { if (!isset(self::$config)) { try { self::$config = \Skeleton\Core\Application::Get()->config; } catch (Exception $e) { return new Config(); } } return self::$config; }
/** * Gets a configuration value * * @param $key string * @return string|null * @throws Exception if configuration file doesn't exist */ public static function get($key) { if (!self::$config) { $config_file = APP . 'config/config.php'; if (!file_exists($config_file)) { throw new Exception("Configuration file doesn't exist"); } self::$config = (require $config_file . ""); } return isset(self::$config[$key]) ? self::$config[$key] : null; }
public static function get($key) { if (!self::$config) { $config_file = '../application/config/config.' . Environment::get() . '.php'; if (!file_exists($config_file)) { return false; } self::$config = (require $config_file); } return self::$config[$key]; }
public static function get($key) { if (!self::$config) { $config_file = '../app/SiteConfig.php'; if (!file_exists($config_file)) { return false; } self::$config = (require $config_file); } return self::$config[$key]; }
private function get_path($templateName, $type = 'template', $key = false) { switch ($type) { case 'template': return __ROOT__ . parseDir(Config::config('app_dir'), Config::template('view_dir'), Config::template('view_name')) . $templateName . Config::template('view_suffix'); case 'cache': return __ROOT__ . parseDir(Config::config('app_dir'), Config::template('cache_dir'), Config::template('view_cache_dir'), Config::template('view_name')) . '/' . $templateName . $key; case 'view_c': return __ROOT__ . parseDir(Config::config('app_dir'), Config::template('view_c_dir'), Config::template('view_name')) . $templateName . '.php'; } }
private static function _config($file) { global $config; $path = CONFIG_DIR . suffix($file, ".php"); if (!is_file($path)) { return false; } if (!isImport($path)) { require_once restorationPath($path); self::$config = $config; } }
static function load($config = array()) { self::$config = $config; self::$mode = $config['mode']; self::$appsDir = $config['appsDir']; self::$pluginsDir = $config['pluginsDir']; self::$helpersDir = $config['helpersDir']; self::$mainApp = $config['mainApp']; self::$disabledApps = $config['disabledApps']; self::$database = $config['database']; self::init(); }
/** * Returns Config from api.conf * @return array */ public static function get() { if (is_array(self::$config)) { return self::$config; } if (file_exists(__DIR__ . '/../../api.conf')) { self::$config = parse_ini_file(__DIR__ . '/../../api.conf', true); } else { self::$config = array(); } return self::$config; }
public static function url($action = '', $get = false) { $url = self::$router->_url($action, $get); //====是否要隐藏入口 if (Config::router('hidden_entry') !== true) { return Config::config('entry') . '/' . $url; } else { $path = dirname(Config::config('entry')); //转义掉windows的反斜杠 $path = str_replace('\\', '/', $path); return $path . $url; } }
public static function get($key) { if (!self::$config) { $config_file = dirname(realpath(__DIR__)) . '/config/config.php'; if (!file_exists($config_file)) { return false; } self::$config = (require $config_file); if (!array_key_exists($key, self::$config)) { return false; } } return self::$config[$key]; }
public static function load() { $Yml = YamlFactory::factory(); self::$config = $Yml->load('config/config.yaml'); if (!empty(self::$config['import-file'])) { foreach (self::$config['import-file'] as $name => $link) { if (is_file($link)) { self::$config[$name] = $Yml->load($link); } else { exit('config/config.yaml: The file ' . $link . ' doesn\'t exists.'); } } unset(self::$config['import-file']); } }
private static function loadConfig() { global $shindigConfig; if (!self::$config) { // load default configuration include_once 'config/container.php'; self::$config = $shindigConfig; if (file_exists('config/local.php')) { // include local.php if it exists and merge the config arrays. // the second array values overwrites the first one's include_once 'config/local.php'; self::$config = array_merge(self::$config, $shindigConfig); } } }