PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 79 lines | 33 code | 6 blank | 40 comment | 4 complexity | f4986374f89fe88b3a2d6038303e049f 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: Fieldset.php 23775 2011-03-01 17:25:24Z ralph $
  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 fieldsets
  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_Fieldset extends Zend_View_Helper_FormElement
  33. {
  34. /**
  35. * Render HTML form
  36. *
  37. * @param string $name Form name
  38. * @param string $content Form content
  39. * @param array $attribs HTML form attributes
  40. * @return string
  41. */
  42. public function fieldset($name, $content, $attribs = null)
  43. {
  44. $info = $this->_getInfo($name, $content, $attribs);
  45. extract($info);
  46. // get legend
  47. $legend = '';
  48. if (isset($attribs['legend'])) {
  49. $legendString = trim($attribs['legend']);
  50. if (!empty($legendString)) {
  51. $legend = '<legend>'
  52. . (($escape) ? $this->view->escape($legendString) : $legendString)
  53. . '</legend>' . PHP_EOL;
  54. }
  55. unset($attribs['legend']);
  56. }
  57. // get id
  58. if (!empty($id)) {
  59. $id = ' id="' . $this->view->escape($id) . '"';
  60. } else {
  61. $id = '';
  62. }
  63. // render fieldset
  64. $xhtml = '<fieldset'
  65. . $id
  66. . $this->_htmlAttribs($attribs)
  67. . '>'
  68. . $legend
  69. . $content
  70. . '</fieldset>';
  71. return $xhtml;
  72. }
  73. }