_regKey)) { $this->_registry = new ArrayObject(array( 'doctypes' => array( self::XHTML11 => '', self::XHTML1_STRICT => '', self::XHTML1_TRANSITIONAL => '', self::XHTML1_FRAMESET => '', self::XHTML_BASIC1 => '', self::HTML4_STRICT => '', self::HTML4_LOOSE => '', self::HTML4_FRAMESET => '', self::HTML5 => '', ) )); Zend_Registry::set($this->_regKey, $this->_registry); $this->setDoctype($this->_defaultDoctype); } else { $this->_registry = Zend_Registry::get($this->_regKey); } } /** * Set or retrieve doctype * * @param string $doctype * @return Zend_View_Helper_Doctype */ public function doctype($doctype = null) { if (null !== $doctype) { switch ($doctype) { case self::XHTML11: case self::XHTML1_STRICT: case self::XHTML1_TRANSITIONAL: case self::XHTML1_FRAMESET: case self::XHTML_BASIC1: case self::HTML4_STRICT: case self::HTML4_LOOSE: case self::HTML4_FRAMESET: case self::HTML5: $this->setDoctype($doctype); break; default: if (substr($doctype, 0, 9) != 'setDoctype($type); $this->_registry['doctypes'][$type] = $doctype; break; } } return $this; } /** * Set doctype * * @param string $doctype * @return Zend_View_Helper_Doctype */ public function setDoctype($doctype) { $this->_registry['doctype'] = $doctype; return $this; } /** * Retrieve doctype * * @return string */ public function getDoctype() { return $this->_registry['doctype']; } /** * Get doctype => string mappings * * @return array */ public function getDoctypes() { return $this->_registry['doctypes']; } /** * Is doctype XHTML? * * @return boolean */ public function isXhtml() { return (stristr($this->getDoctype(), 'xhtml') ? true : false); } /** * String representation of doctype * * @return string */ public function __toString() { $doctypes = $this->getDoctypes(); return $doctypes[$this->getDoctype()]; } }