当前位置: 首页>>代码示例>>PHP>>正文


PHP static::config方法代码示例

本文整理汇总了PHP中static::config方法的典型用法代码示例。如果您正苦于以下问题:PHP static::config方法的具体用法?PHP static::config怎么用?PHP static::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
     static::$config = $config;
 }
开发者ID:gingerwfms,项目名称:wf-configurator-backend,代码行数:29,代码来源:Bootstrap.php

示例2: register

 public static function register(Di $di)
 {
     static::$di = $di;
     static::$config = Config::get('auth');
     $di->setShared('auth', function () {
         $di = static::$di;
         $config = static::$config;
         $class = $config['adapter'];
         $options = $config['options'];
         strpos($class, '\\') === false and $class = 'Phwoolcon\\Auth\\Adapter\\' . $class;
         if ($di->has($class)) {
             $class = $di->getRaw($class);
         }
         if (!class_exists($class)) {
             throw new Exception('Admin auth adapter class should implement ' . AdapterInterface::class);
         }
         /* @var Security $hasher */
         $hasher = static::$di->getShared('security');
         $hasher->setDefaultHash($options['security']['default_hash']);
         $hasher->setWorkFactor($options['security']['work_factor']);
         $adapter = new $class($options, $hasher, $di);
         if (!$adapter instanceof AdapterInterface) {
             throw new Exception('Auth adapter class should implement ' . AdapterInterface::class);
         }
         return $adapter;
     });
     static::addPhwoolconJsOptions();
 }
开发者ID:phwoolcon,项目名称:auth,代码行数:28,代码来源:Auth.php

示例3: getConfig

 public static function getConfig($key = null)
 {
     if (!static::$config) {
         $file = static::getConfigJson();
         if (!file_exists($file)) {
             file_put_contents($file, json_encode(Yaml::parse(static::getConfigYml())));
         }
         static::$config = json_decode(file_get_contents($file), true);
         static::_bindConfig(self::$config);
         static::_bindConfig(self::$config);
     }
     if (!$key) {
         return static::$config;
     }
     if (array_key_exists($key, static::$config)) {
         return static::$config[$key];
     }
     if (strpos($key, '.') !== false) {
         $parts = explode('.', $key, 2);
         $data = static::getConfig($parts[0]);
         $data = UtilArray::cascadeGet($data, $parts[1]);
         if ($data) {
             return $data;
         }
     }
     throw new Exception("Config '{$key}' not found");
 }
开发者ID:stopsopa,项目名称:utils,代码行数:27,代码来源:Cache.php

示例4: _init

 /**
  * Initialize
  */
 public static function _init()
 {
     $config = \Config::load('sentry', true);
     static::$config = $config[\Fuel::$env];
     // create instance for PHP
     static::$client = new \Raven_Client(static::$config['php']['dsn']);
 }
开发者ID:core-tech,项目名称:fuel-packages-sentry,代码行数:10,代码来源:sentry.php

示例5: getInstance

 public static function getInstance()
 {
     if (!static::$config) {
         static::$config = static::factory(array("path" => static::$path));
     }
     return static::$config;
 }
开发者ID:rezon,项目名称:sugi,代码行数:7,代码来源:Config.php

示例6: _init

 /**
  * Load configurations
  *
  * @static
  * @access  public
  * @return  void
  */
 public static function _init()
 {
     if (null === static::$config) {
         Config::load('hybrid', 'hybrid');
         static::$config = Config::get('hybrid.template', array());
     }
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:14,代码来源:driver.php

示例7: init

 public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/application.config.php')) {
         $testConfig = (include __DIR__ . '/application.config.php');
     } else {
         $testConfig = (include __DIR__ . '/application.config.php.dist');
     }
     chdir(__DIR__ . '/..');
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     $entityManager = $serviceManager->get('doctrine.entitymanager.orm_default');
     $eventManager = $entityManager->getEventManager();
     $eventManager->addEventSubscriber(new \Aaa\EntityEvents\PrePersistListener(null));
     static::$eventManager = $eventManager;
     static::$serviceManager = $serviceManager;
     static::$config = $config;
     // static::createSchemaFromEntities();
 }
开发者ID:ifigenija,项目名称:server,代码行数:35,代码来源:_bootstrap.ooo.php

示例8: parse

 /**
  * parse a yml config file and return the result.
  *
  * @param $path
  *   The yml config file path
  *
  * @param $sub (optional)
  *   An associative array of substitutions to recursively apply. This is
  *   used to simulate "variables" in the config, mostly for paths like
  *   APPDIR etc.
  *
  * @return
  *   The parsed result
  */
 public static function parse($path, $sub)
 {
     $yaml = new Parser();
     $parsed = $yaml->parse(file_get_contents($path));
     static::$config = static::substitute($parsed, $sub);
     return static::$config;
 }
开发者ID:NetOxygen,项目名称:no2-php-framework,代码行数:21,代码来源:config.class.php

示例9: load_configs

 protected static function load_configs()
 {
     static::$config = \Config::get('contexy::config');
     foreach (static::$config as $key => $value) {
         static::${$key} = $value;
     }
 }
开发者ID:SerdarSanri,项目名称:Contexy,代码行数:7,代码来源:contexy.php

示例10: config

 public static function config($key = null, $default = null)
 {
     if (!static::$config instanceof Config) {
         static::$config = new Config(static::path('src/config/'));
     }
     return is_null($key) ? static::$config : static::$config->get($key, $default);
 }
开发者ID:solutionworks,项目名称:theme-setup,代码行数:7,代码来源:Yare.php

示例11: __construct

 public function __construct($config = [])
 {
     static::$config = $config;
     static::setAlias('web', $config['web']);
     static::setAlias('path', $config['path']);
     static::setAlias('gbox', static::getAlias('path') . '/gbox');
     static::setAlias('controllers', static::getAlias('gbox') . '/controllers');
     static::setAlias('components', static::getAlias('gbox') . '/components');
     static::setAlias('plugins', static::getAlias('gbox') . '/plugins');
     static::setAlias('modules', static::getAlias('gbox') . '/modules');
     static::setAlias('models', static::getAlias('gbox') . '/models');
     static::setAlias('views', static::getAlias('gbox') . '/views');
     static::setAlias('tmp', static::getAlias('gbox') . '/tmp');
     static::setAlias('layouts', static::getAlias('views') . '/layouts');
     static::setAlias('uploads-path', static::getAlias('path') . '/uploads');
     static::setAlias('uploads', static::getAlias('web') . '/uploads');
     static::setAlias('images', static::getAlias('web') . '/assets' . '/images');
     static::setAlias('fonts', static::getAlias('web') . '/assets' . '/fonts');
     static::setAlias('css', static::getAlias('web') . '/assets' . '/css');
     static::setAlias('js', static::getAlias('web') . '/assets' . '/js');
     session_save_path(realpath(Url::to('@tmp')));
     Session::init();
     if (property_exists(static::getConfig(), 'timezone')) {
         date_default_timezone_set(static::getConfig()->timezone);
     } else {
         date_default_timezone_set('America/Montevideo');
     }
 }
开发者ID:roxgueldevs,项目名称:gboxframework,代码行数:28,代码来源:gbox.php

示例12: _init

 public static function _init()
 {
     static::$crypter = new Crypt_AES();
     static::$hasher = new Crypt_Hash('sha256');
     // load the config
     \Config::load('crypt', true);
     static::$config = \Config::get('crypt', array());
     // generate random crypto keys if we don't have them or they are incorrect length
     $update = false;
     foreach (array('crypto_key', 'crypto_iv', 'crypto_hmac') as $key) {
         if (empty(static::$config[$key]) or strlen(static::$config[$key]) % 4 != 0) {
             $crypto = '';
             for ($i = 0; $i < 8; $i++) {
                 $crypto .= static::safe_b64encode(pack('n', mt_rand(0, 0xffff)));
             }
             static::$config[$key] = $crypto;
             $update = true;
         }
     }
     // update the config if needed
     if ($update === true) {
         // load the file config
         \Config::load('file', true);
         try {
             \Config::save('crypt', static::$config);
             chmod(APPPATH . 'config' . DS . 'crypt.php', \Config::get('file.chmod.files', 0666));
         } catch (\FileAccessException $e) {
             // failed to write the config file, inform the user
             echo \View::forge('errors/crypt_keys', array('keys' => static::$config));
             die;
         }
     }
     static::$crypter->enableContinuousBuffer();
     static::$hasher->setKey(static::safe_b64decode(static::$config['crypto_hmac']));
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:35,代码来源:crypt.php

示例13: init

 public static function init()
 {
     $test_config = (include is_readable('TestConfig.php') ? 'TestConfig.php' : 'TestConfig.php.dist');
     $test_config['module_listener_options']['config_cache_enabled'] = false;
     $test_config['module_listener_options']['module_map_cache_enabled'] = false;
     $zf2ModulePaths = array();
     if (isset($test_config['module_listener_options']['module_paths'])) {
         $modulePaths = $test_config['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             $path = static::findParentPath($modulePath);
             if (false !== $path) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $test_config);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
     static::$config = $config;
 }
开发者ID:leloulight,项目名称:Cornerstone,代码行数:27,代码来源:Bootstrap.php

示例14: getConfig

 /**
  * get the contents of the config.php file as array
  * @return array
  */
 protected static function getConfig()
 {
     if (empty(static::$config)) {
         static::$config = (require WINKFORM_PATH . 'config.php');
     }
     return static::$config;
 }
开发者ID:winkbrace,项目名称:winkform,代码行数:11,代码来源:Config.php

示例15: _init

 public static function _init()
 {
     static::$config = Yaml::parse(file_get_contents(core_config_path() . '/api.yaml'));
     foreach (static::$config as $k => $v) {
         static::$keys[$k] = $v;
     }
 }
开发者ID:roaringsky,项目名称:repose-core,代码行数:7,代码来源:Config.php


注:本文中的static::config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。