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


PHP static::_config方法代码示例

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


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

示例1: config

 /**
  * @param null $path
  * @param null $default
  *
  * @return array|mixed
  */
 static final function config($path = NULL, $default = NULL)
 {
     if (!static::$_config) {
         static::$_config = Kohana::$config->load('restfulapi')->as_array();
     }
     return NULL !== $path ? Kohana_Arr::path(static::$_config, $path, $default) : static::$_config;
 }
开发者ID:vspvt,项目名称:kohana-restfulapi,代码行数:13,代码来源:RestfulAPI.php

示例2: _init

 /**
  * Loads config data and reCaptcha library.
  *
  * @return  void
  */
 protected static function _init()
 {
     if (empty(static::$_config)) {
         static::$_config = Kohana::$config->load('recaptcha');
     }
     require_once Kohana::find_file('vendor', 'recaptcha/recaptchalib');
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:12,代码来源:Recaptcha.php

示例3: config

 public static function config(array $config = [])
 {
     if (!$config) {
         return static::$_config;
     }
     static::$_config = $config;
 }
开发者ID:davidpersson,项目名称:mm,代码行数:7,代码来源:Info.php

示例4: loadConfigFile

 public static function loadConfigFile($_file_path)
 {
     if (file_exists($_file_path)) {
         $_file_contents = file_get_contents($_file_path);
         $_config_data = json_decode($_file_contents, true);
         static::$_config = array_merge(static::$_config, $_config_data);
     }
 }
开发者ID:reang,项目名称:AtomicPHP,代码行数:8,代码来源:Config.php

示例5: config

 public static function config()
 {
     if (empty(static::$_config)) {
         $adminBean = BeanFactory::getBean("Administration");
         static::$_config = $adminBean->getConfigForModule('dm_Recycler', 'base');
     }
     return static::$_config;
 }
开发者ID:MichaelJ2324,项目名称:SugarDataManager,代码行数:8,代码来源:dm_Recycler.php

示例6: initialize

 public static function initialize()
 {
     // resolve details from host name
     // get site ID
     /*
     		if(empty(static::$ID))
     		{
     			if(!empty($_SERVER['SITE_ID']))
     				static::$ID = $_SERVER['SITE_ID'];
     			else
     				throw new Exception('No Site ID detected');
     		}
     */
     // get site root
     if (empty(static::$rootPath)) {
         if (!empty($_SERVER['SITE_ROOT'])) {
             static::$rootPath = $_SERVER['SITE_ROOT'];
         } else {
             throw new Exception('No Site root detected');
         }
     }
     // retrieve static configuration
     if (!(static::$_config = apc_fetch($_SERVER['HTTP_HOST'])) || $_GET['_recache'] == static::$controlKey) {
         static::$_config = static::_compileConfiguration();
         apc_store($_SERVER['HTTP_HOST'], static::$_config);
     }
     // get host-specific config
     if (!(static::$_hostConfig = static::$_config['hosts'][$_SERVER['HTTP_HOST']])) {
         throw new Exception('Current host is unknown');
     }
     if (static::$_hostConfig['ParentHostname']) {
         if (!(static::$_parentHostConfig = static::$_config['hosts'][static::$_hostConfig['ParentHostname']])) {
             throw new Exception('Parent host is unknown');
         }
     }
     // get request URI
     if (empty(static::$requestURI)) {
         static::$requestURI = parse_url($_SERVER['REQUEST_URI']);
     }
     // get path stack
     static::$pathStack = static::$requestPath = static::splitPath(static::$requestURI['path']);
     // register class loader
     spl_autoload_register('Site::loadClass');
     // set error handle
     set_error_handler('Site::handleError');
     // register exception handler
     set_exception_handler('Site::handleException');
     // check virtual system for site config
     static::loadConfig(__CLASS__);
     if (is_callable(static::$onInitialized)) {
         call_user_func(static::$onInitialized);
     }
 }
开发者ID:JarvusInnovations,项目名称:Emergence-preview,代码行数:53,代码来源:Site.class.php

示例7: load

 public static function load($configFile)
 {
     if (!file_exists($configFile) || !is_readable($configFile)) {
         return;
     }
     $config = file_get_contents($configFile);
     try {
         static::$_config = json_decode($config, true);
     } catch (Exception $e) {
     }
     return static::$_config;
 }
开发者ID:katienazarova,项目名称:wp-sugar,代码行数:12,代码来源:Config.php

示例8: load

 public static function load()
 {
     $lang = static::getLaguage();
     $filename = get_template_directory() . '/lang/' . $lang . '.json';
     if (!file_exists($filename) || !is_readable($filename)) {
         return;
     }
     $config = file_get_contents($filename);
     try {
         static::$_config = json_decode($config, true);
     } catch (Exception $e) {
     }
     return static::$_config;
 }
开发者ID:katienazarova,项目名称:wp-sugar,代码行数:14,代码来源:Localization.php

示例9: config

	/**
	 * Used to set configuration options.
	 *
	 * Sending the config options through the static reference initalizes the
	 * instance. If you need to send a driver config through the static reference,
	 * make sure its the first one sent! If errors arise, create a new instance using
	 * factory().
	 *
	 * @param  array   $config   An array of configuration settings.
	 * @return Image_Driver
	 */
	public static function config($index = array(), $value = null)
	{
		if (static::$_instance === null)
		{
			if ($value !== null)
				$index = array($index => $value);
			if (is_array($index))
				static::$_config = array_merge(static::$_config, $index);
			static::instance();
			return static::instance();
		} else {
			return static::instance()->config($index, $value);
		}
	}
开发者ID:novius,项目名称:core,代码行数:25,代码来源:image.php

示例10: run

 /**
  * @param $config array
  */
 public static function run($config)
 {
     static::$_config = $config;
     // initialize error handling
     register_shutdown_function(array('App', 'onFatalError'));
     set_exception_handler(array('App', 'onException'));
     set_error_handler(array('App', 'onError'));
     $response = App::response();
     // init response
     $response->enableBuffering();
     // start output buffering
     // initialize class Autoloader
     $autoloader = static::autoloader();
     // initialize Router
     $router = static::router();
     $parsedUrl = $router->parseRequestUrl(App::request()->getUrl());
     $controllerClassName = $parsedUrl['controller'];
     $actionMethodName = $parsedUrl['action'];
     $parameters = $parsedUrl['parameters'];
     if (!$autoloader->classDefined($controllerClassName)) {
         trigger_error('Controller "' . $controllerClassName . '" not found');
         App::response()->sendNotFoundAndExit();
     }
     /** @var $controller AppController */
     $controller = new $controllerClassName();
     $controller->setAction($actionMethodName);
     $controller->setParameters($parameters);
     // get response from action
     $actionContent = $controller->run();
     // get layout from controller
     $layout = $controller->getLayout();
     if ($layout) {
         // if layout not disabled ( @see AppController::disableLayout() )
         $layoutView = new AppView('layouts/' . $layout);
         $layoutView->title = static::$_config['applicationName'];
         $layoutView->content = $actionContent;
         // insert action response into page layout
         // render page
         echo $layoutView->render();
     }
     // send response to client
     App::response()->sendContent();
 }
开发者ID:stefangruncharov,项目名称:url-shortening-service,代码行数:46,代码来源:App.php

示例11: config

 public static function config($key = null, $value = null)
 {
     if (is_null($key) && is_null($value)) {
         return static::$_config;
     }
     $path = explode('.', $key);
     if (!is_null($value)) {
         if (is_null($key)) {
             static::$_config = (array) $value;
         } else {
             $config =& static::$_config;
             foreach ($path as $i => $k) {
                 if (is_numeric($k) && intval($k) > 0 || $k === '0') {
                     $k = intval($k);
                 }
                 if ($i === count($path) - 1) {
                     $config[$k] = $value;
                 } else {
                     if (!isset($config[$k])) {
                         $config[$k] = [];
                     }
                     $config =& $config[$k];
                 }
             }
         }
         return static::config($key);
     } else {
         $value = null;
         $config = static::$_config;
         while ($index = array_shift($path)) {
             if (isset($config[$index])) {
                 $config = $config[$index];
                 if (empty($path)) {
                     $value = $config;
                 }
             } else {
                 break;
             }
         }
         return $value;
     }
 }
开发者ID:p-m-d,项目名称:naf,代码行数:42,代码来源:Config.php

示例12: reset

 /**
  * Setup basic error handling checks/types, as well as register the error and exception
  * handlers and wipes out all configuration and resets the error handler to its initial state
  * when loaded. Mainly used for testing.
  */
 public static function reset()
 {
     static::$_config = array();
     static::$_checks = array();
     static::$_exceptionHandler = null;
     static::$_checks = array('type' => function ($config, $info) {
         return (bool) array_filter((array) $config['type'], function ($type) use($info) {
             return $type === $info['type'] || is_subclass_of($info['type'], $type);
         });
     }, 'code' => function ($config, $info) {
         return $config['code'] & $info['code'];
     }, 'stack' => function ($config, $info) {
         return (bool) array_intersect((array) $config['stack'], $info['stack']);
     }, 'message' => function ($config, $info) {
         return preg_match($config['message'], $info['message']);
     });
     $self = get_called_class();
     static::$_exceptionHandler = function ($exception, $return = false) use($self) {
         if (ob_get_length()) {
             ob_end_clean();
         }
         $info = compact('exception') + array('type' => get_class($exception), 'stack' => $self::trace($exception->getTrace()));
         foreach (array('message', 'file', 'line', 'trace') as $key) {
             $method = 'get' . ucfirst($key);
             $info[$key] = $exception->{$method}();
         }
         return $return ? $info : $self::handle($info);
     };
 }
开发者ID:rapzo,项目名称:lithium,代码行数:34,代码来源:ErrorHandler.php

示例13: loadConfig

    public static function loadConfig() {
      $ini = parse_ini_file(static::BASE_DIRECTORY . 'Config/settings.ini', true);

      if ( file_exists(static::BASE_DIRECTORY . 'Config/local_settings.ini') ) {
        $local = parse_ini_file(static::BASE_DIRECTORY . 'Config/local_settings.ini', true);

        $ini = array_merge($ini, $local);
      }

      static::$_config = $ini;
    }
开发者ID:haraldpdl,项目名称:oscommerce,代码行数:11,代码来源:OSCOM.php

示例14: resetAllStaticPropertiesExceptDefaultConfig

 /**
  * 
  * DBConnector::resetAllStaticPropertiesExceptDefaultConfig() resets all properties
  * DBConnector::resetAllStaticPropertiesExceptDefaultConfig('_db') will reset only DBConnector::$_db
  * 
  * @param string $prop_name name of the property (eg. 'db' or '_db') whose value is to be reset. 
  * 
  */
 public static function resetAllStaticPropertiesExceptDefaultConfig($prop_name = '')
 {
     switch ($prop_name) {
         case '_config':
         case 'config':
             // Map of configuration settings
             static::$_config = array();
             break;
         case '_db':
         case 'db':
             // Map of database connections, instances of the PDO class
             static::$_db = array();
             break;
         case '_last_query':
         case 'last_query':
             // Last query run, only populated if logging is enabled
             static::$_last_query = '';
             break;
         case '_query_log':
         case 'query_log':
             // Log of all queries run, mapped by connection key, only populated if logging is enabled
             static::$_query_log = array();
             break;
         default:
             //////////////////////////
             // Reset all properties //
             //////////////////////////
             // Map of configuration settings
             static::$_config = array();
             // Map of database connections, instances of the PDO class
             static::$_db = array();
             // Last query run, only populated if logging is enabled
             static::$_last_query = '';
             // Log of all queries run, mapped by connection key, only populated if logging is enabled
             static::$_query_log = array();
             break;
     }
 }
开发者ID:rotexsoft,项目名称:leanorm,代码行数:46,代码来源:DBConnector.php

示例15: reset

 /**
  * Wipes out all configuration and resets the error handler to its initial state when loaded.
  * Mainly used for testing.
  *
  * @return void
  */
 public static function reset()
 {
     static::$_config = array();
     static::$_checks = array();
     static::$_handlers = array();
     static::$_exceptionHandler = null;
     static::__init();
 }
开发者ID:nashadalam,项目名称:lithium,代码行数:14,代码来源:ErrorHandler.php


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