initialize($ini); } function initialize ($ini) { if (is_array($ini)) { $result = new Zend_Config($ini); } elseif($ini instanceof Zend_Config) { $result = $ini; } else { $result = new Zend_Config_Ini($ini); } $this->setIni($result); } function parse() { } protected function setIni(Zend_Config $ini) { $this->ini = $ini; } protected function getIni($key = null) { return $this->ini; } protected function get ($key, $default = null) { if ($this->hasKeyPrefix()) { $key = $this->getKeyPrefix() . $key; } $parts = preg_split('~/~', $key); $first_part = array_shift($parts); if ($first_part != '') { throw new Exception("Invalid config key $key."); } $config = $this->getIni(); $count = count($parts); $i = 0; foreach ($parts as $part) { $i++; if (isset($config->$part)) { if ($i == $count) { return $config->$part; } else { $config = $config->$part; } } else { return $default; } } } function setKeyPrefix($prefix) { $this->prefix = $prefix; } function getKeyPrefix() { return $this->prefix; } function hasKeyPrefix() { return isset($this->prefix); } }