PageRenderTime 53ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/src/application/libraries/Zend/View/Helper/Form.php

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 83 lines | 36 code | 10 blank | 37 comment | 11 complexity | a66f6cdf7e9846a2d906413be513ff52 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_View
  17. * @subpackage Helper
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @version $Id: Form.php 24478 2011-09-26 19:52:58Z adamlundrigan $
  20. * @license http://framework.zend.com/license/new-bsd New BSD License
  21. */
  22. /** Zend_View_Helper_FormElement */
  23. require_once 'Zend/View/Helper/FormElement.php';
  24. /**
  25. * Helper for rendering HTML forms
  26. *
  27. * @package Zend_View
  28. * @subpackage Helper
  29. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_View_Helper_Form extends Zend_View_Helper_FormElement
  33. {
  34. /**
  35. * Render HTML form
  36. *
  37. * @param string $name Form name
  38. * @param null|array $attribs HTML form attributes
  39. * @param false|string $content Form content
  40. * @return string
  41. */
  42. public function form($name, $attribs = null, $content = false)
  43. {
  44. $info = $this->_getInfo($name, $content, $attribs);
  45. extract($info);
  46. if (!empty($id)) {
  47. $id = ' id="' . $this->view->escape($id) . '"';
  48. } else {
  49. $id = '';
  50. }
  51. if (array_key_exists('id', $attribs) && empty($attribs['id'])) {
  52. unset($attribs['id']);
  53. }
  54. if (!empty($name) && !($this->_isXhtml() && $this->_isStrictDoctype())) {
  55. $name = ' name="' . $this->view->escape($name) . '"';
  56. } else {
  57. $name = '';
  58. }
  59. if ( array_key_exists('name', $attribs) && empty($attribs['id'])) {
  60. unset($attribs['id']);
  61. }
  62. $xhtml = '<form'
  63. . $id
  64. . $name
  65. . $this->_htmlAttribs($attribs)
  66. . '>';
  67. if (false !== $content) {
  68. $xhtml .= $content;
  69. }
  70. $xhtml .= '</form>';
  71. return $xhtml;
  72. }
  73. }