_options, $options); if ($options['clear'] || !isset($this->_translate[$locale])) { $this->_translate[$locale] = array(); } $this->_file = @fopen($filename, 'rb'); if (!$this->_file) { require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.'); } while(!feof($this->_file)) { $content = fgets($this->_file); if (trim($content) == "---") { continue; } $content = explode(':', $content); if (count($content) < 2) { continue; } if (strpos($content[0], '"') !== false) { $pos = strpos($content[0], '"'); while(strpos($content[0], '"', $pos + 1) === false) { $value = array_shift($content); $value2 = array_shift($content); array_unshift($content, $value . ":" . $value2); } trim($content[0]); $content[0] = substr($content[0], strpos($content[0], '"') + 1); $content[0] = substr($content[0], 0, strpos($content[0], '"')); } $origin = array_shift($content); while (count($content) > 1) { $value = array_shift($content); $value2 = array_shift($content); array_unshift($content, $value . ":" . $value2); } if (strpos($content[0], '"') !== false) { trim($content[0]); $content[0] = substr($content[0], strpos($content[0], '"') + 1); $content[0] = substr($content[0], 0, strpos($content[0], '"') + 1); } array_unshift($content, $origin); if (!empty($content[1])) { if (feof($this->_file)) { $this->_translate[$locale][$content[0]] = $content[1]; } else { if (substr($content[1], -2, 2) == "\r\n") { $this->_translate[$locale][$content[0]] = substr($content[1], 0, -2); } else { $this->_translate[$locale][$content[0]] = substr($content[1], 0, -1); } } } } } /** * returns the adapters name * * @return string */ public function toString() { return "Yaml"; } }