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


PHP Zend_Config_Ini::merge方法代码示例

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


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

示例1: getConfig

 /**
  *
  * @return Zend_Config_Ini
  */
 public function getConfig()
 {
     $this->config = new Zend_Config_Ini(array_shift($this->configFiles), $this->section, true);
     foreach ($this->configFiles as $file) {
         $this->config->merge(new Zend_Config_Ini($file, $this->section, true));
     }
     return $this->config;
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:12,代码来源:IniConfig.php

示例2: _loadConfig

 /**
  * Load configuration file of options
  *
  * @param  string $file
  * @return array
  */
 protected function _loadConfig($file, $environment)
 {
     $configCommon = new Zend_Config_Ini($file, $environment, true);
     $configCustom = new Zend_Config_Ini(str_replace('.common.ini', '.ini', $file), $environment);
     $configCommon->merge($configCustom);
     $configCommon->path->root = getcwd();
     $config = new System_Config_Placeholder($configCommon);
     return $config->toArray();
 }
开发者ID:kandy,项目名称:HamsterCMF,代码行数:15,代码来源:ConfigAdapterTask.php

示例3: __construct

 public function __construct()
 {
     $this->originalFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR, '/var/settings/upgrades.ini');
     $this->upgradeFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR, '/var/settings/upgrades_' . APPLICATION_ENV . '.ini');
     if (!file_exists($this->originalFile)) {
         touch($this->originalFile);
     }
     if (!file_exists($this->upgradeFile)) {
         touch($this->upgradeFile);
     }
     $this->_info = new \Zend_Config_Ini($this->originalFile, null, array('allowModifications' => true));
     // Merge the environment config file
     $this->_info->merge(new \Zend_Config_Ini($this->upgradeFile, null, array('allowModifications' => true)));
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:14,代码来源:UpgradesAbstract.php

示例4: _initConfig

 /**
  * init configuration
  * @return void
  */
 protected function _initConfig()
 {
     $this->applicationStatus = getenv('APPLICATION_ENV');
     # fetch the application settings
     $this->settings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", "settings", true);
     $this->routes = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", "routes");
     $this->mailsettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/email.ini", "email");
     $this->databasesettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/database.ini", "database");
     $this->environmentsettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/environment.ini", "environment");
     # merge settings in main settings obj
     $this->settings->merge($this->mailsettings);
     $this->settings->merge($this->databasesettings);
     $this->settings->merge($this->environmentsettings);
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:18,代码来源:Bootstrap.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', null, true);
     $system_ini = new \Zend_Config_Ini('/var/yujiaqu.ini');
     $config->merge($system_ini);
     $application = new Zend_Application(APPLICATION_ENV, $config->get(APPLICATION_ENV));
     $application->bootstrap();
     $this->_bootstrap = $application->getBootstrap();
     // manually init Zend_Controller_Front, otherwise, it is not inited in testing environment
     $this->_bootstrap->getResource('FrontController')->setParam('bootstrap', $this->_bootstrap);
     $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel');
     $this->_container = $this->_bootstrap->getResource('serviceContainer');
     $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager');
     $this->_logger = $this->_bootstrap->getResource('logger');
 }
开发者ID:ud223,项目名称:yj,代码行数:16,代码来源:AngelTestAbstract.php

示例6: _loadConfig

 /**
  * Добавляет конфиг в реестр, сливает с конфигом-патчем (если есть)
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     $environment = $this->getEnvironment();
     $config = new Zend_Config_Ini($file, $environment, true);
     # Получаем путь к дополнительному конфигу
     $additionConfig = isset($config->config) ? $config->config : dirname($file) . '/_' . basename($file);
     if (is_readable($additionConfig)) {
         try {
             $configCustom = new Zend_Config_Ini($additionConfig, $environment);
             $config->merge($configCustom);
         } catch (Zend_Config_Exception $e) {
         }
     }
     if (isset($config->config)) {
         unset($config->config);
     }
     $config->setReadOnly();
     Zend_Registry::set('config', $config);
     return $config->toArray();
 }
开发者ID:eugenzor,项目名称:zfhrtool,代码行数:27,代码来源:Application.php

示例7: dirname

    // by using PEAR-type naming conventions, autoload will always know where to
    // find class definitions
    function __autoload($class)
    {
        require str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}
define('CRON_ROOT', dirname(__FILE__));
define('APP_ROOT', dirname(CRON_ROOT));
// convoluted way to find the job root
$callstack = debug_backtrace();
$cwd = explode(DIRECTORY_SEPARATOR, dirname($callstack[0]['file']));
$webroot = explode(DIRECTORY_SEPARATOR, CRON_ROOT);
$diff = array_diff($cwd, $webroot);
define('JOB_ROOT', CRON_ROOT . DIRECTORY_SEPARATOR . current($diff) . DIRECTORY_SEPARATOR . next($diff));
set_include_path('.' . PATH_SEPARATOR . JOB_ROOT . PATH_SEPARATOR . JOB_ROOT . "/tests" . PATH_SEPARATOR . APP_ROOT . '/application/lib' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . APP_ROOT . '/thirdpartylibs');
// be careful if modifying the following line.
// phing replaces it when deploying this project.
$env = 'development';
// merge the global config and this job's config and save it in registry
$params = array('allowModifications' => true);
$config = new Zend_Config_Ini(APP_ROOT . '/config/config.ini', $env, $params);
$jobConfig = new Zend_Config_Ini(JOB_ROOT . '/config.ini', $env);
$config->merge($jobConfig);
Zend_Registry::set('config', $config);
// set up logger and save it in registry
$logger = $logger =& Log::singleton('console');
$debug = (bool) $config->application->debug->enabled;
$loglevel = $debug ? PEAR_LOG_DEBUG : PEAR_LOG_INFO;
$logger->setMask(Log::MAX($loglevel));
Zend_Registry::set('logger', $logger);
开发者ID:hellogerard,项目名称:pox-framework,代码行数:31,代码来源:JobHelper.php

示例8: _loadConfigFromFile

 protected function _loadConfigFromFile($file)
 {
     $environment = $this->getEnvironment();
     $configCommon = new Zend_Config_Ini($file, $environment, true);
     $configCustom = new Zend_Config_Ini(str_replace('.common.ini', '.ini', $file), $environment);
     $configCommon->merge($configCustom);
     if (isset($this->rootDir)) {
         $configCommon->path->root = $this->rootDir;
     }
     require_once 'System/Config/Placeholder.php';
     $config = new System_Config_Placeholder($configCommon);
     return $config->toArray();
 }
开发者ID:kandy,项目名称:system,代码行数:13,代码来源:Application.php

示例9: dirname

<?php

// only define __autoload if it has not already been defined (phing may define
// it in its build script
if (!function_exists('__autoload')) {
    // by using PEAR-type naming conventions, autoload will always know where to
    // find class definitions
    function __autoload($class)
    {
        require str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}
define('APP_ROOT', dirname(dirname(dirname(__FILE__))));
set_include_path('.' . PATH_SEPARATOR . APP_ROOT . '/application/lib' . PATH_SEPARATOR . APP_ROOT . '/application/models' . PATH_SEPARATOR . APP_ROOT . '/application/controllers' . PATH_SEPARATOR . APP_ROOT . '/application/tests/lib' . PATH_SEPARATOR . APP_ROOT . '/application/tests/models' . PATH_SEPARATOR . APP_ROOT . '/application/tests/controllers' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . APP_ROOT . '/cron' . PATH_SEPARATOR . APP_ROOT . '/thirdpartylibs');
// merge the real config and test config and save it in registry
$params = array('allowModifications' => true);
$config = new Zend_Config_Ini(APP_ROOT . '/config/config.ini', 'development', $params);
$testConfig = new Zend_Config_Ini(APP_ROOT . '/application/tests/config.ini');
$config->merge($testConfig);
Zend_Registry::set('config', $config);
// use a null logger for unit tests
$logger = new Mock_Logger();
Zend_Registry::set('logger', $logger);
// use a mock database for unit tests
$db = new Mock_Database();
Zend_Registry::set('db', $db);
// use a mock cache for unit tests
$cache = new Mock_Cache();
Zend_Registry::set('cache', $cache);
开发者ID:hellogerard,项目名称:pox-framework,代码行数:29,代码来源:TestHelper.php

示例10: _getDependenciesConfig

 private function _getDependenciesConfig($assetsType)
 {
     $ret = new Zend_Config_Ini(KWF_PATH . '/config.ini', 'dependencies', array('allowModifications' => true));
     $ret->merge(new Zend_Config_Ini('config.ini', 'dependencies'));
     return $ret;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:6,代码来源:AssetsDependenciesController.php

示例11: explode

set_include_path('.' . PATH_SEPARATOR . "{$extranet_path}/includes" . PATH_SEPARATOR . "{$rootDir}/lib" . PATH_SEPARATOR . "{$extranet_path}/modules/banners/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/cart/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/catalog/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/default/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/events/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/form/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/forms/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/gallery/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/member/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/medical/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/news/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/newsletter/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/order/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/page/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/parent/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/partners/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/profile/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/video/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/retailers/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/rss/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/rssreader/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/search/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/staff/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/text/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/users/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/utilities/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/volunteers/models/" . PATH_SEPARATOR . "{$rootDir}/lib/Cible/Models/" . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
// loading configuration
$host = explode('.', $_SERVER['HTTP_HOST']);
$envVar = 'production';
$envVar = 'production';
if (in_array('sandboxes', $host) || in_array('localhost', $host)) {
    $envVar = 'development';
} elseif (in_array('staging', $host)) {
    $envVar = 'staging';
}
$app_config = new Zend_Config_Ini("{$application_path}/config.ini", $envVar);
$imgCfg = new Zend_Config_Ini("{$application_path}/config.ini", 'Images', true);
$config = new Zend_Config_Ini("{$extranet_path}/config.ini", 'general', true);
$config->merge($imgCfg);
$config->readOnly();
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
$registry->set('relativeRootPath', $web_root);
$registry->set('absolute_web_root', $absolute_web_root);
// establishment of the database
$db = Zend_Db::factory($app_config->db);
Zend_Db_Table::setDefaultAdapter($db);
$db->query('SET NAMES utf8');
$registry->set('db', $db);
$registry->set('extranet_root', $extranet_path);
$registry->set('www_root', $www_root);
$registry->set('lucene_index', realpath(dirname(__FILE__) . '/../') . "/indexation/all_index");
// Enables the loading of helpers from /lib/Cible/View/Helper
$view = new Zend_View();
开发者ID:anunay,项目名称:stentors,代码行数:31,代码来源:index.php

示例12: initConfig

 public function initConfig()
 {
     $coreConfig = new Zend_Config_Ini(implode(DIRECTORY_SEPARATOR, array($this->_rootPath, 'RM', 'system', 'config', 'core.config.ini')), self::$_mode, array('allowModifications' => true));
     Zend_Registry::set('config', $coreConfig->merge($this->_config));
 }
开发者ID:laiello,项目名称:resmania,代码行数:5,代码来源:Connector.php

示例13: microtime

 * @version     $Id$
 */
// Saving start time for profiling.
$GLOBALS['start_mtime'] = microtime(true);
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__))));
// Define application environment (use 'production' by default)
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'library'), realpath(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'vendor'), get_include_path())));
require_once 'autoload.php';
require_once 'opus-php-compatibility.php';
// Zend_Application
$config = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
$localConfig = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/config.ini', APPLICATION_ENV, array('allowModifications' => true));
$config->merge($localConfig);
// configuration file that is modified via application user interface
if (is_readable(APPLICATION_PATH . '/application/configs/config.xml')) {
    $onlineConfig = new Zend_Config_Xml(APPLICATION_PATH . '/application/configs/config.xml');
    $config->merge($onlineConfig);
}
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, $config);
try {
    $application->bootstrap()->run();
} catch (Exception $e) {
    if (APPLICATION_ENV === 'production') {
        header("HTTP/1.0 500 Internal Server Error");
        echo $e->getMessage();
    } else {
        throw $e;
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:31,代码来源:index.php

示例14: loadConfig

 /**
  * Loads the configuration
  *
  * First, the main configuration file - "application.ini" - is loaded from
  * the root of the configs directory. Second, all other configuration files,
  * if any, are loaded recursively - except for "user.ini". Third, the
  * developer-specific configuration file - "user.ini" - is loaded. This
  * file overrides any setting in the previously loaded files and is only
  * regarded in development and testing mode.
  *
  * This method must be 'public static' - Zend_Cache_Class requires so.
  * However, users shouldn't call it directly; use getConfig() instead.
  *
  * @param string $section
  * @return Zend_Config
  */
 public static function loadConfig($section)
 {
     // Load the main configuration file
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_APPLICATION;
     $ini = new Zend_Config_Ini($configFile, $section, array('allowModifications' => true));
     // Recursively load all other ini files, if any, but exclude the special cases
     $pattern = '~^(?!' . preg_quote(self::FILENAME_APPLICATION) . '|' . preg_quote(self::FILENAME_USER) . ').+\\.ini$~';
     $dirIterator = new RecursiveDirectoryIterator(GLITCH_CONFIGS_PATH, RecursiveDirectoryIterator::KEY_AS_FILENAME);
     $recursiveIterator = new RecursiveIteratorIterator($dirIterator);
     $iterator = new RegexIterator($recursiveIterator, $pattern, RegexIterator::MATCH, RegexIterator::USE_KEY);
     foreach ($iterator as $file) {
         $ini->merge(new Zend_Config_Ini($file->getPathname(), $section));
     }
     // Optionally load developer-specific settings, overriding previous settings
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_USER;
     if (('development' == $section || 'testing' == $section) && file_exists($configFile)) {
         $ini->merge(new Zend_Config_Ini($configFile, $section));
     }
     if ('testing' != $section) {
         $ini->setReadOnly();
     }
     return $ini;
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:39,代码来源:Ini.php

示例15: _initConfig

 /**
  * Loads the application config file
  *
  * @since 0.9.5
  */
 public function _initConfig()
 {
     // load default application configuration file
     try {
         $config = new Zend_Config_Ini(APPLICATION_PATH . 'config/default.ini', 'default', true);
     } catch (Zend_Config_Exception $e) {
         throw $e;
     }
     // load user application configuration files
     $tryDistConfig = false;
     try {
         $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'config.ini', 'private', true);
         $config->merge($privateConfig);
     } catch (Zend_Config_Exception $e) {
         $tryDistConfig = true;
     }
     if ($tryDistConfig === true) {
         try {
             $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'config.ini.dist', 'private', true);
             $config->merge($privateConfig);
         } catch (Zend_Config_Exception $e) {
             $message = '<p>OntoWiki can not find a proper configuration.</p>' . PHP_EOL . '<p>Maybe you have to copy and modify the distributed ' . '<code>config.ini.dist</code> file?</p>' . PHP_EOL . '<details><summary>Error Details</summary>' . $e->getMessage() . '</details>';
             throw new OntoWiki_Exception($message);
         }
     }
     // normalize path names
     $config->themes->path = rtrim($config->themes->path, '/\\') . '/';
     $config->themes->default = rtrim($config->themes->default, '/\\') . '/';
     $config->extensions->base = rtrim($config->extensions->base, '/\\') . '/';
     if (false === defined('EXTENSION_PATH')) {
         define('EXTENSION_PATH', $config->extensions->base);
     }
     $config->extensions->legacy = EXTENSION_PATH . rtrim($config->extensions->legacy, '/\\') . '/';
     $config->languages->path = EXTENSION_PATH . rtrim($config->languages->path, '/\\') . '/';
     $config->libraries->path = rtrim($config->libraries->path, '/\\') . '/';
     $config->cache->path = rtrim($config->cache->path, '/\\') . '/';
     $config->log->path = rtrim($config->log->path, '/\\') . '/';
     // support absolute path
     $matches = array();
     if (!(preg_match('/^(\\w:[\\/|\\\\]|\\/)/', $config->cache->path, $matches) === 1)) {
         $config->cache->path = ONTOWIKI_ROOT . $config->cache->path;
     }
     // set path variables
     $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE));
     // set protocol and read headers sent by proxies
     $protocol = 'http';
     if (isset($_SERVER['X-Forwarded-Protocol'])) {
         $protocol = strtolower($_SERVER['X-Forwarded-Protocol']);
     } else {
         if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
             $protocol = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
         } else {
             if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
                 $protocol = 'https';
             }
         }
     }
     if (isset($_SERVER['HTTP_HOST'])) {
         $httpHost = $_SERVER['HTTP_HOST'];
     } else {
         $httpHost = 'localhost';
     }
     $urlBase = sprintf('%s://%s%s', $protocol, $httpHost, $rewriteBase);
     // construct URL variables
     $config->host = parse_url($urlBase, PHP_URL_HOST);
     $config->urlBase = rtrim($urlBase . (ONTOWIKI_REWRITE ? '' : BOOTSTRAP_FILE), '/\\') . '/';
     $config->staticUrlBase = rtrim($urlBase, '/\\') . '/';
     $config->themeUrlBase = $config->staticUrlBase . $config->themes->path . $config->themes->default;
     $config->libraryUrlBase = $config->staticUrlBase . $config->libraries->path;
     // define constants for development/debugging
     if (isset($config->debug) && (bool) $config->debug) {
         // display errors
         error_reporting(E_ALL | E_STRICT);
         ini_set('display_errors', 'On');
         // enable debugging options
         if (false === defined('_OWDEBUG')) {
             define('_OWDEBUG', 1);
         }
         // log everything
         $config->log->level = 7;
     }
     return $config;
 }
开发者ID:cfrancois7,项目名称:aksw.org,代码行数:88,代码来源:Bootstrap.php


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