PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 104 lines | 28 code | 10 blank | 66 comment | 3 complexity | eb17b68d81d9beede8fcd6f48494b75f 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. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: FormTextarea.php 23775 2011-03-01 17:25:24Z ralph $
  21. */
  22. /**
  23. * Abstract class for extension
  24. */
  25. require_once 'Zend/View/Helper/FormElement.php';
  26. /**
  27. * Helper to generate a "textarea" element
  28. *
  29. * @category Zend
  30. * @package Zend_View
  31. * @subpackage Helper
  32. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_View_Helper_FormTextarea extends Zend_View_Helper_FormElement
  36. {
  37. /**
  38. * The default number of rows for a textarea.
  39. *
  40. * @access public
  41. *
  42. * @var int
  43. */
  44. public $rows = 24;
  45. /**
  46. * The default number of columns for a textarea.
  47. *
  48. * @access public
  49. *
  50. * @var int
  51. */
  52. public $cols = 80;
  53. /**
  54. * Generates a 'textarea' element.
  55. *
  56. * @access public
  57. *
  58. * @param string|array $name If a string, the element name. If an
  59. * array, all other parameters are ignored, and the array elements
  60. * are extracted in place of added parameters.
  61. *
  62. * @param mixed $value The element value.
  63. *
  64. * @param array $attribs Attributes for the element tag.
  65. *
  66. * @return string The element XHTML.
  67. */
  68. public function formTextarea($name, $value = null, $attribs = null)
  69. {
  70. $info = $this->_getInfo($name, $value, $attribs);
  71. extract($info); // name, value, attribs, options, listsep, disable
  72. // is it disabled?
  73. $disabled = '';
  74. if ($disable) {
  75. // disabled.
  76. $disabled = ' disabled="disabled"';
  77. }
  78. // Make sure that there are 'rows' and 'cols' values
  79. // as required by the spec. noted by Orjan Persson.
  80. if (empty($attribs['rows'])) {
  81. $attribs['rows'] = (int) $this->rows;
  82. }
  83. if (empty($attribs['cols'])) {
  84. $attribs['cols'] = (int) $this->cols;
  85. }
  86. // build the element
  87. $xhtml = '<textarea name="' . $this->view->escape($name) . '"'
  88. . ' id="' . $this->view->escape($id) . '"'
  89. . $disabled
  90. . $this->_htmlAttribs($attribs) . '>'
  91. . $this->view->escape($value) . '</textarea>';
  92. return $xhtml;
  93. }
  94. }