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


PHP Zend_Config::merge方法代码示例

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


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

示例1: _initConfig

 /**
  * Инициализация конфигурации
  */
 protected function _initConfig()
 {
     $path = APPLICATION_PATH . '/../library/Zkernel/Application/configs';
     $config = new Zend_Config(array(), true);
     $it = new DirectoryIterator($path);
     foreach ($it as $file) {
         if ($file->isFile()) {
             $fullpath = $path . '/' . $file;
             switch (substr(trim(strtolower($fullpath)), -3)) {
                 case 'ini':
                     $cfg = new Zend_Config_Ini($fullpath, $this->getEnvironment());
                     break;
                 case 'xml':
                     $cfg = new Zend_Config_Xml($fullpath, $this->getEnvironment());
                     break;
                 default:
                     throw new Zend_Config_Exception('Invalid format for config file');
                     break;
             }
             $config->merge($cfg);
         }
     }
     $config->merge(new Zend_Config($this->getOptions()));
     $this->setOptions($config->toArray());
 }
开发者ID:s-kalaus,项目名称:zkernel,代码行数:28,代码来源:Bootstrap.php

示例2: _initConfig

 /**
  * Combine the static info found in application.ini with the
  * dynamic info found in the Info table.
  *
  * @return void
  */
 protected function _initConfig()
 {
     $this->bootstrap('db');
     $this->bootstrap('locale');
     if (!class_exists('Model_Info')) {
         return;
     }
     try {
         $staticConfig = Zend_Registry::get('config');
         $infoModel = $this->_getInfoModel();
         $dynamicConfig = $infoModel->fetchAsConfig(null, APPLICATION_ENV);
         // Very sneakily bypass 'readOnly'
         if ($staticConfig->readOnly()) {
             $staticConfig = new Zend_Config($staticConfig->toArray(), APPLICATION_ENV, true);
         }
         $staticConfig->merge($dynamicConfig);
         $staticConfig->setReadOnly();
         Zend_Registry::set('config', $staticConfig);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         if (strpos($msg, 'Unknown database') === false && strpos($msg, "doesn't exist") === false) {
             throw $e;
         }
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:31,代码来源:Bootstrap.php

示例3: loadConfig

 /**
  * Loads the Erfurt configuration with an optional given config
  * object injected.
  *
  * @param Zend_Config|null $config
  */
 public function loadConfig(Zend_Config $config = null)
 {
     // Load the default erfurt config.
     require_once 'Zend/Config/Ini.php';
     if (is_readable(EF_BASE . 'config/default.ini')) {
         try {
             $this->_config = new Zend_Config_Ini(EF_BASE . 'config/default.ini', 'default', true);
         } catch (Zend_Config_Exception $e) {
             require_once 'Erfurt/App/Exception.php';
             throw new Erfurt_App_Exception('Error while parsing config file default.ini.');
         }
     } else {
         require_once 'Erfurt/App/Exception.php';
         throw new Erfurt_App_Exception('Config file default.ini not readable.');
     }
     // Load user config iff available.
     if (is_readable(EF_BASE . 'config.ini')) {
         try {
             $this->_config->merge(new Zend_Config_Ini(EF_BASE . 'config.ini', 'private', true));
         } catch (Zend_Config_Exception $e) {
             require_once 'Erfurt/App/Exception.php';
             throw new Erfurt_App_Exception('Error while parsing config file config.ini.');
         }
     }
     // merge with injected config if given
     if (null !== $config) {
         try {
             $this->_config->merge($config);
         } catch (Zend_Config_Exception $e) {
             require_once 'Erfurt/App/Exception.php';
             throw new Erfurt_App_Exception('Error while merging with injected config.');
         }
     }
 }
开发者ID:FTeichmann,项目名称:Erfurt,代码行数:40,代码来源:App.php

示例4: __construct

 /**
  * Constructor.
  * @param array $options
  */
 public function __construct(Zend_Config $config = null)
 {
     $defaultConfig = new Zend_Config(array('style' => array('itemClass' => 'Item', 'titleClass' => 'Title', 'descriptionClass' => 'Description', 'tagContainerClass' => 'TagList', 'tagClass' => 'Tag', 'iconClass' => 'Icon', 'iconWidth' => 16, 'iconHeight' => 16, 'dateClass' => 'Date')), true);
     if (!is_null($config)) {
         $defaultConfig->merge($config);
     }
     $this->_config = $defaultConfig;
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:12,代码来源:Abstract.php

示例5: _mergeOptions

 /**
  * Get options
  *
  * @param  array $options
  * @return void
  */
 protected function _mergeOptions(array $options)
 {
     if (!isset($this->_options)) {
         $this->_options = new Zend_Config(array(), true);
     }
     $optionsConf = new Zend_Config($options, true);
     $this->_options->merge($optionsConf);
 }
开发者ID:BGCX261,项目名称:zlayer-svn-to-git,代码行数:14,代码来源:Abstract.php

示例6: _init

 /**
  * Pseudo-constructor (the actual constructor must be final).
  * @param Zend_Config $config
  * @return void
  */
 protected function _init(Zend_Config $config)
 {
     $defaultConfig = new Zend_Config(array('url' => null, 'cacheLifetime' => 7200, 'cacheDir' => './cache', 'limit' => 5, 'items' => array()), true);
     if (!isset($config->url)) {
         throw new Polycast_Stalker_Provider_Exception('No feed url given');
     }
     $this->_config = $defaultConfig->merge($config);
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:13,代码来源:Feed.php

示例7: loadFromMultiFiles

 public function loadFromMultiFiles(array $files, $ns, $save = true)
 {
     $conf = new Zend_Config(array(), true);
     foreach ($files as $file) {
         $fileConf = $this->_loadConfigFromFile($file);
         $conf->merge($fileConf);
     }
     return $this->processConfigFile($conf, $ns, $save);
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:9,代码来源:Abstract.php

示例8: __construct

 /**
  * Constructor.
  * @param Zend_Config $config
  */
 public function __construct(Zend_Config $config = null)
 {
     $defaultConfig = new Zend_Config(array('providers' => array(), 'style' => array('id' => 'Stalker', 'class' => 'Stalker')), true);
     $defaultConfig->merge($config);
     $this->_config = $defaultConfig;
     foreach ($this->_config->providers as $name => $providerConfig) {
         $this->addProvider(Polycast_Stalker_Provider::factory($providerConfig), $name);
     }
 }
开发者ID:polycaster,项目名称:Polycast_Stalker,代码行数:13,代码来源:Stalker.php

示例9: addConfig

 /**
  * Add configuration to the Fizzy application. The config is merged with
  * the already present config. Configuration can only be added before the
  * bootstrap sequence.
  * @param array|string|Zend_Config $config
  * @return Fizzy
  */
 public function addConfig($config)
 {
     if (null !== $config) {
         if (is_array($config)) {
             $customConfig = new Zend_Config($config);
         } else {
             if ($config instanceof Zend_Config) {
                 $customConfig = $config;
             } else {
                 if (is_string($config)) {
                     $customConfig = $this->_loadConfigFromFile($config);
                 }
             }
         }
         # Merge configs
         $this->_config->merge($customConfig);
     }
     return $this;
 }
开发者ID:jtietema,项目名称:Fizzy,代码行数:26,代码来源:Fizzy.php

示例10: mergeIntoConfig

 /**
  * @param array|\Zend_Config $config
  * @throws \Exception
  */
 public static function mergeIntoConfig($config)
 {
     if (is_array($config)) {
         $config = new \Zend_Config($config);
     } elseif (!$config instanceof \Zend_Config) {
         throw new \Exception('no config given.');
     }
     $curConfig = Registry::getConfig();
     $newConfig = new \Zend_Config($curConfig->toArray(), true);
     $newConfig->merge($config);
     $newConfig->setReadOnly();
     Registry::setConfig($newConfig);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:17,代码来源:ConfigHelper.php

示例11: _testConfig

 protected function _testConfig(array $config, &$error)
 {
     $outputConfig = new Zend_Config(array(), true);
     $outputConfig->merge(XenForo_Application::getInstance()->loadDefaultConfig())->merge(new Zend_Config($config));
     try {
         $db = Zend_Db::factory($outputConfig->db->adapter, array('host' => $outputConfig->db->host, 'port' => $outputConfig->db->port, 'username' => $outputConfig->db->username, 'password' => $outputConfig->db->password, 'dbname' => $outputConfig->db->dbname, 'charset' => 'utf8'));
         $db->getConnection();
         $db->listTables();
         $error = '';
     } catch (Zend_Db_Exception $e) {
         $error = new XenForo_Phrase('following_error_occurred_while_connecting_database', array('error' => $e->getMessage()));
     }
     return $db;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:14,代码来源:Install.php

示例12: _initConfig

 public function _initConfig()
 {
     $config = new Zend_Config($this->getOptions(), true);
     $inifiles = array('app', 'cache', 'private');
     //TODO: only load cache.ini for models
     foreach ($inifiles as $file) {
         $inifile = APPLICATION_PATH . "/configs/{$file}.ini";
         if (is_readable($inifile)) {
             $config->merge(new Zend_Config_Ini($inifile));
         }
     }
     $config->setReadOnly();
     $this->setOptions($config->toArray());
     Zend_Registry::set('config', $config);
     define('DATE_DB', 'Y-m-d H:i:s');
 }
开发者ID:josmel,项目名称:DevelEntretenimientoEntel,代码行数:16,代码来源:Bootstrap.php

示例13: init

 /**
  * Load both config files.
  *
  * @return Zend_Config
  */
 public function init()
 {
     $mainConfig = $this->_coreResource->init();
     $testConfigPath = APP_DIR . '/tests/config.ini';
     $config = new Zend_Config_Ini($testConfigPath);
     if (!Zend_Registry::isRegistered('test_config')) {
         Zend_Registry::set('test_config', $config->testing);
     }
     // Merging the configs allows us to override settings only for tests.
     if ($config->site instanceof Zend_Config) {
         $mainCopy = new Zend_Config($mainConfig->toArray(), true);
         $mainCopy->merge($config->site);
         $mainCopy->setReadOnly(true);
         $mainConfig = $mainCopy;
     }
     return $mainConfig;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:22,代码来源:Config.php

示例14: setDefaultRoute

 /**
  * Sets the default route according to the configuration data provided in $config.
  * Two settings are required: the route prefix (key: routePrefix),
  * and the controller class-name (key: controllerClass).
  *
  * Three optional settings are supported as well: major section (key: majorSection),
  * minor section (key: minorSection) and request parameters (key: params);
  * which might be used during the routing process.
  *
  * @param Zend_Config $config Configuration data
  * @param array $dependencyData Data array supplied by the "init_dependencies" event
  * @throws XenForo_Exception
  */
 public static function setDefaultRoute(Zend_Config $config, array $dependencyData)
 {
     $routesPublic = $dependencyData['routesPublic'];
     if (!$config->routePrefix || !$config->controllerClass) {
         // Debugging message. No need for phrasing.
         throw new XenForo_Exception('Missing route-prefix and/or controller class-name.');
     }
     if ($config->readOnly()) {
         // A read-only object was passed. Arghh!
         $newConfig = new Zend_Config(array('routeClass' => $routesPublic[$config->routePrefix]['route_class']), true);
         $config = $newConfig->merge($config);
     } else {
         $config->routeClass = $routesPublic[$config->routePrefix]['route_class'];
     }
     self::_setCustomRoutePrefixes($config->routePrefix, $routesPublic);
     $config->setReadOnly();
     XenForo_Application::set('customIndex', $config);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Index.php

示例15: _init

 /**
  * Initializes the Akrabat functionality and adds it to Zend_Tool (zf)
  * 
  * @param string $env Environment to initialize for
  * 
  * @return null
  * 
  * @throws Zend_Tool_Project_Exception
  */
 protected function _init($env)
 {
     $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
     $appConfigFileResource = $profile->search('applicationConfigFile');
     if ($appConfigFileResource == false) {
         throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.');
     }
     $appConfigFilePath = $appConfigFileResource->getPath();
     // Base config, normally the application.ini in the configs dir of your app
     $this->_config = $this->_createConfig($appConfigFilePath, $env, true);
     // Are there any override config files?
     foreach ($this->_getAppConfigOverridePathList($appConfigFilePath) as $path) {
         $overrideConfig = $this->_createConfig($path);
         if (isset($overrideConfig->{$env})) {
             $this->_config->merge($overrideConfig->{$env});
         }
     }
     require_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('Akrabat_');
 }
开发者ID:nemgue,项目名称:Akrabat,代码行数:30,代码来源:DatabaseSchemaProvider.php


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