本文整理汇总了PHP中Zend_Config_Ini::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Ini::toArray方法的具体用法?PHP Zend_Config_Ini::toArray怎么用?PHP Zend_Config_Ini::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Ini
的用法示例。
在下文中一共展示了Zend_Config_Ini::toArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_plugins
/**
* Initialize plugins hook system
*/
function init_plugins()
{
include APPPATH . 'config/cache.php';
$feEngine = $config['plugins_frontend_engine'];
$feOptions = $config['plugins_frontend'];
$beEngine = $config['plugins_backend_engine'];
$beOptions = $config['plugins_backend'];
if (isset($beOptions['cache_dir']) && !file_exists($beOptions['cache_dir'])) {
mkdir($beOptions['cache_dir']);
chmod($beOptions['cache_dir'], 0777);
}
$cache = Zend_Cache::factory($feEngine, $beEngine, $feOptions, $beOptions);
$pluginsConfigArray = $cache->load('pluginsConfig');
if (!$pluginsConfigArray) {
$pluginsConfigArray = array();
$pluginConfDirHandler = opendir(APPPATH . 'config/plugins');
while (false !== ($pluginConfigFile = readdir($pluginConfDirHandler))) {
if (preg_match('~^.*?\\.ini$~si', $pluginConfigFile)) {
try {
$pluginConfig = new Zend_Config_Ini(APPPATH . 'config/plugins/' . $pluginConfigFile, 'plugins');
$pluginsConfigArray = array_merge_recursive($pluginsConfigArray, $pluginConfig->toArray());
} catch (Exception $e) {
}
}
}
closedir($pluginConfDirHandler);
$cache->save($pluginsConfigArray, 'pluginsConfig');
}
Zend_Registry::getInstance()->set('pluginsConfig', new Zend_Config($pluginsConfigArray));
}
示例2: loadApplicationConfig
function loadApplicationConfig()
{
require_once 'Zend/Config/Ini.php';
$default = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
$options = $default->toArray();
return $options;
}
示例3: getApplication
/**
*
* @return Zend_Application
*/
public static function getApplication()
{
$application = new Zend_Application(APPLICATION_ENV);
$applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
$options = $applicationini->toArray();
foreach (self::$_ini as $value) {
$iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
if (is_readable($iniFile)) {
$config = new Zend_Config_Ini($iniFile);
$options = $application->mergeOptions($options, $config->toArray());
} else {
throw new Zend_Exception('error en la configuracion de los .ini');
}
}
// foreach (self::$_ini as $value) {
// $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
//
// if (is_readable($iniFile)) {
// $config = new Zend_Config_Ini($iniFile);
// $options = $application->mergeOptions($options,
// $config->toArray());
// } else {
// throw new Zend_Exception('error en la configuracion de los .ini');
// }
// }
Zend_Registry::set('config', $options);
$a = $application->setOptions($options);
return $application;
}
示例4: _initConfig
/**
* Initialize module config options
*
* @return void
*/
protected function _initConfig()
{
// load ini file
$config = new Zend_Config_Ini(MODULES_PATH . '/' . $this->_module['folder'] . '/configs/module.ini', APPLICATION_ENV);
$this->setOptions($config->toArray());
Zend_Registry::set($this->_module['folder'] . 'Config', $this->_config = $config);
}
示例5: _initSession
protected function _initSession()
{
$configSession = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
if (!$this->_request->isInstalling()) {
$config = array('name' => 'session', 'primary' => 'session_id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime', 'lifetime' => $configSession->gc_maxlifetime);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config));
}
if (!$this->_request->isInstalling() or is_writable(Core_Model_Directory::getSessionDirectory(true))) {
$types = array();
$options = $configSession->toArray();
if (isset($options['types'])) {
$types = $options['types'];
unset($options['types']);
}
Zend_Session::start($options);
$session_type = $this->_request->isApplication() ? 'mobile' : 'front';
$session = new Core_Model_Session($session_type);
foreach ($types as $type => $class) {
$session->addType($type, $class);
}
$language_session = new Core_Model_Session('language');
if (!$language_session->current_language) {
$language_session->current_language = null;
}
Core_Model_Language::setSession($language_session);
Core_View_Default::setSession($session);
Core_Controller_Default::setSession($session);
}
}
示例6: _initSession
protected function _initSession()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/sessions.ini', 'development');
Zend_Session::setOptions($config->toArray());
// start session
Zend_Session::start();
}
示例7: getRecipients
private static function getRecipients($docid, $rec_num = -1)
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$sql = "select AV.VAL\r\nfrom V_ADD_VALUES AV\r\nwhere AV.NODEID = ?\r\nand AV.FIELDNAME = '_ADD_RECIPIENTS'";
$rec = $db->fetchOne($sql, $docid);
$rec = new Zend_Config_Ini('data://,' . $rec);
return $rec->toArray();
}
示例8: _initLocalConfigs
/**
* Save all values from config to ZendRegistry
*/
protected function _initLocalConfigs()
{
$allconfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/config.ini');
$envconfig = $allconfig->toArray();
$registry = new Zend_Registry($envconfig[APPLICATION_ENV], ArrayObject::ARRAY_AS_PROPS);
foreach ($registry as $key => $value) {
Zend_Registry::set($key, $value);
}
}
示例9: _initConfig
protected function _initConfig()
{
$config = new Zend_Config($this->getOptions(), true);
Zend_Registry::set('config', $config);
// TODO faut-il utiliser les sessions ou les registres ?
$configSession = new Zend_Config_Ini(__DIR__ . '/configs/session.ini', APPLICATION_ENV);
Zend_Session::setOptions($configSession->toArray());
return $config;
}
示例10: addNewsAction
public function addNewsAction()
{
$options = $this->getInvokeArg('bootstrap')->getOptions();
$configDir = $options['path']['configs'];
$config = new Zend_Config_Ini($configDir . '/agregator.ini', 'korespondent');
$data = $config->toArray();
$news = new Spider_News($data);
$news->setLogger($this->getLog());
$news->process();
}
示例11: load
public function load($file, $type = null)
{
$file = $this->locator->locate($file);
$type = $type ?: pathinfo($file, PATHINFO_EXTENSION);
switch ($type) {
case 'php':
$data = (require $file);
$config = new \Zend_Config($data);
break;
case 'xml':
$config = new \Zend_Config_Xml($file);
break;
case 'ini':
$config = new \Zend_Config_Ini($file, "routes");
break;
}
$data = $config->toArray();
if (isset($data['routes'])) {
$data = $data['routes'];
}
$collection = new RouteCollection();
foreach ($data as $routeName => $config) {
if (isset($config['type']) && $config['type'] == "Zend_Controller_Router_Route_Regex") {
throw new \InvalidArgumentException("Not supported");
}
if (!isset($config['reqs'])) {
$config['reqs'] = array();
}
if (!isset($config['defaults'])) {
$config['defaults'] = array();
}
if (!isset($config['options'])) {
$config['options'] = array();
}
if (!isset($config['defaults']['module'])) {
// TODO: DefaultModule config
$config['defaults']['module'] = 'Default';
}
if (!isset($config['defaults']['controller'])) {
$config['defaults']['controller'] = 'Index';
}
if (!isset($config['defaults']['action'])) {
$config['defaults']['action'] = 'index';
}
$config['defaults']['_controller'] = sprintf('%sBundle:%s:%s', $config['defaults']['module'], $config['defaults']['controller'], $config['defaults']['action']);
if (preg_match_all('(:([^/]+)+)', $config['route'], $matches)) {
for ($i = 0; $i < count($matches[0]); $i++) {
$config['route'] = str_replace($matches[0][$i], "{" . $matches[1][$i] . "}", $config['route']);
}
}
$route = new Route($config['route'], $config['defaults'], $config['reqs'], $config['options']);
$collection->add($routeName, $route);
}
return $collection;
}
示例12: _init
/**
*
* @throws ZendT_Exception
*/
private function _init()
{
$_config = new Zend_Config_Ini($this->_configIni, APPLICATION_ENV);
$this->_configs = $_config->toArray();
if ($this->_documentRoot == '') {
throw new ZendT_Exception('"documentRoot" não configurado!');
}
if ($this->_object == '') {
throw new ZendT_Exception('"object" não informado!');
}
}
示例13: getModuleConfig
private function getModuleConfig($moduleName)
{
$aConfig = array();
try {
$config = new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . $moduleName . DS . 'view.ini', APPLICATION_ENV);
$aConfig = $config->toArray();
} catch (Zend_Config_Exception $e) {
Zend_Debug::dump($e->getMessage());
}
return $aConfig;
}
示例14: _findModules
protected function _findModules()
{
$moduleInfoFiles = (array) glob(MODULES_PATH . '/*/info.ini') + (array) glob(HEAP_PATH . '/*/info.ini');
sort($moduleInfoFiles);
$return = array();
$returnDeveloper = array();
foreach ($moduleInfoFiles as $row) {
$config = new Zend_Config_Ini($row);
preg_match('|.*/(.*)/info.ini$|i', $row, $matches);
/* регистрируем плагин вывода панели администрирования на frontend */
if (Zetta_Acl::getInstance()->isAllowed('admin_module_' . System_String::StrToLower($matches[1]), 'deny')) {
if (false == $config->developer) {
$return[] = array_merge($config->toArray(), array('module' => $matches[1]));
} else {
$returnDeveloper[] = array_merge($config->toArray(), array('module' => $matches[1]));
}
}
}
return array($return, $returnDeveloper);
}
示例15: _bootstrap
protected function _bootstrap()
{
//Now let's parse the module specific configuration
//Path might change however this is probably the one you won't ever need to change...
//And also don't forget to use the current staging environment by sending the APP_ENV parameter to the Zend_Config
$_conf = new Zend_Config_Ini(APPLICATION_PATH . "/modules/" . strtolower($this->getModuleName()) . "/config/application.ini", APPLICATION_ENV);
$this->_options = array_merge($this->_options, $_conf->toArray());
//Let's merge the both arrays so that we can use them together...
parent::_bootstrap();
//Well our custom bootstrap logic should end with the actual bootstrapping, now that we have merged both configs, we can go on...
}