* @copyright 2010, Enrise * @license http://www.opensource.org/licenses/bsd-license.php * @version $Id: $ */ /** * View helper for generating a HTML5 keygen * * @category Glitch * @package Glitch_View * @subpackage Helper */ class Glitch_View_Helper_FormKeygen extends Zend_View_Helper_FormText { /** * Generates a 'keygen' element. * * @access public * * @param string|array $name If a string, the element name. If an * array, all other parameters are ignored, and the array elements * are used in place of added parameters. * * @param mixed $value The element value. * * @param array $attribs Attributes for the element tag. * * @return string The element XHTML. */ public function formKeygen($name, $value = null, $attribs = null) { $info = $this->_getInfo($name, $value, $attribs); extract($info); // name, value, attribs, options, listsep, disable // build the element $disabled = ''; if ($disable) { // disabled $disabled = ' disabled="disabled"'; } // XHTML or HTML end tag? $endTag = ' />'; if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) { $endTag= '>'; } unset($attribs['type']); $xhtml = '_htmlAttribs($attribs) . $endTag; return $xhtml; } }