/** * get config * * @return array */ protected function _getConfig() { $bootstrap = $this->getBootstrap(); $cache = false; if (!empty($this->_options['cache'])) { if ($bootstrap->hasPluginResource('CacheManager')) { $manager = $bootstrap->bootstrap('CacheManager')->getResource('CacheManager'); $cache = $manager->getCache($this->_options['cache']); } } $config = empty($this->_options['config']) ? $this->_config : $this->_options['config']; return new Zend_Config(Core_Module_Config::getConfig($config, null, Core_Module_Config::MAIN_ORDER_LAST, $cache)); }
/** * Get source from config * @return string */ public function getSource() { $config = Core_Module_Config::getConfig('application'); if (APPLICATION_ENV == 'testing') { $source = $config['testing']['resources']['navigation']['source']; } else { $source = $config['production']['resources']['navigation']['source']; } if (isset($source[$this->_section])) { return $source[$this->_section]; } else { return null; } }
/** * Gets config array from file * * @return array */ private function _getConfig() { if (!$this->_configArray) { $this->_configArray = Core_Module_Config::getConfig($this->_config, null, Core_Module_Config::MAIN_ORDER_FIRST, $this->_cache); } return $this->_configArray; }
/** * get config * * @return array */ protected function _getConfig() { $bootstrap = $this->getBootstrap(); $cache = false; if ($this->_cache) { if ($bootstrap->hasPluginResource('CacheManager')) { $manager = $bootstrap->bootstrap('CacheManager')->getResource('CacheManager'); $cache = $manager->getCache($this->_options['cache']); } } return Core_Module_Config::getConfig($this->_config, null, Core_Module_Config::MAIN_ORDER_FIRST, $cache); }
/** * getConfig * * return configs from all modules merged with main * * @todo add new parameter for set order of load main config * * @param string $filename Configuration file name w/out extension * @param string $section Section name * @param int $order Order of load main config * @param string $cache cache name * @return array $result */ public static function getConfig($filename, $section = null, $order = Core_Module_Config::MAIN_ORDER_FIRST, $cache = null) { $moduleConfig = Core_Module_Config::getInstance(); try { $cache = Zend_Registry::get('cache'); } catch (Zend_Exception $ex) { $cache = null; } if ($cache) { if (!($result = $cache->load($filename . $section))) { $result = $moduleConfig->_getYamlConfig($filename, $section, $order); $cache->save($result, $filename . $section); } } else { $result = $moduleConfig->_getYamlConfig($filename, $section, $order); } return $result; }
/** * get config * * @return array */ protected function _getConfig() { return Core_Module_Config::getConfig($this->_config, null, Core_Module_Config::MAIN_ORDER_FIRST, $this->_cache); }
/** * getConfig * * return configs from all modules merged with main * * @todo add new parameter for set order of load main config * * @param string $filename Configuration file name w/out extension * @param string $section Section name * @param int $order Order of load main config * @param string $cache cache name * @return array $result */ public static function getConfig($filename, $section = null, $order = Core_Module_Config::MAIN_ORDER_FIRST, $cache = null) { $moduleConfig = Core_Module_Config::getInstance(); if ($cache) { if (!$cache instanceof Zend_Cache_Core) { $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); if ($bootstrap && $bootstrap->hasPluginResource('CacheManager')) { $manager = $bootstrap->getResource('CacheManager'); $cache = $manager->getCache($cache); } else { $cache = null; } } } if ($cache) { if (!($result = $cache->load($filename . $section))) { $result = $moduleConfig->_getYamlConfig($filename, $section, $order); $cache->save($result, $filename . $section); } } else { $result = $moduleConfig->_getYamlConfig($filename, $section, $order); } return $result; }