@@ -630,8 +630,8 @@ discard block |
||
| 630 | 630 | public function &addElement($element) |
| 631 | 631 | { |
| 632 | 632 | if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) { |
| 633 | - $elementObject = &$element; |
|
| 634 | - $elementObject->onQuickFormEvent('updateValue', null, $this); |
|
| 633 | + $elementObject = &$element; |
|
| 634 | + $elementObject->onQuickFormEvent('updateValue', null, $this); |
|
| 635 | 635 | } else { |
| 636 | 636 | $args = func_get_args(); |
| 637 | 637 | $elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1)); |
@@ -676,22 +676,22 @@ discard block |
||
| 676 | 676 | // }}} |
| 677 | 677 | // {{{ insertElementBefore() |
| 678 | 678 | |
| 679 | - /** |
|
| 680 | - * Inserts a new element right before the other element |
|
| 681 | - * |
|
| 682 | - * Warning: it is not possible to check whether the $element is already |
|
| 683 | - * added to the form, therefore if you want to move the existing form |
|
| 684 | - * element to a new position, you'll have to use removeElement(): |
|
| 685 | - * $form->insertElementBefore($form->removeElement('foo', false), 'bar'); |
|
| 686 | - * |
|
| 687 | - * @access public |
|
| 688 | - * @since 3.2.4 |
|
| 689 | - * @param HTML_QuickForm_element Element to insert |
|
| 690 | - * @param string Name of the element before which the new |
|
| 691 | - * one is inserted |
|
| 692 | - * @return HTML_QuickForm_element reference to inserted element |
|
| 693 | - * @throws HTML_QuickForm_Error |
|
| 694 | - */ |
|
| 679 | + /** |
|
| 680 | + * Inserts a new element right before the other element |
|
| 681 | + * |
|
| 682 | + * Warning: it is not possible to check whether the $element is already |
|
| 683 | + * added to the form, therefore if you want to move the existing form |
|
| 684 | + * element to a new position, you'll have to use removeElement(): |
|
| 685 | + * $form->insertElementBefore($form->removeElement('foo', false), 'bar'); |
|
| 686 | + * |
|
| 687 | + * @access public |
|
| 688 | + * @since 3.2.4 |
|
| 689 | + * @param HTML_QuickForm_element Element to insert |
|
| 690 | + * @param string Name of the element before which the new |
|
| 691 | + * one is inserted |
|
| 692 | + * @return HTML_QuickForm_element reference to inserted element |
|
| 693 | + * @throws HTML_QuickForm_Error |
|
| 694 | + */ |
|
| 695 | 695 | function &insertElementBefore(&$element, $nameAfter) |
| 696 | 696 | { |
| 697 | 697 | if (!empty($this->_duplicateIndex[$nameAfter])) { |
@@ -870,9 +870,9 @@ discard block |
||
| 870 | 870 | if ((is_array($value) || null === $value) && isset($this->_submitFiles[$base])) { |
| 871 | 871 | $props = array('name', 'type', 'size', 'tmp_name', 'error'); |
| 872 | 872 | $code = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n" . |
| 873 | - " return null;\n" . |
|
| 874 | - "} else {\n" . |
|
| 875 | - " \$v = array();\n"; |
|
| 873 | + " return null;\n" . |
|
| 874 | + "} else {\n" . |
|
| 875 | + " \$v = array();\n"; |
|
| 876 | 876 | foreach ($props as $prop) { |
| 877 | 877 | $code .= " \$v = HTML_QuickForm::arrayMerge(\$v, \$this->_reindexFiles(\$this->_submitFiles['{$base}']['{$prop}']{$idx}, '{$prop}'));\n"; |
| 878 | 878 | } |
@@ -917,13 +917,13 @@ discard block |
||
| 917 | 917 | return $value; |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - /** |
|
| 921 | - * A helper function to change the indexes in $_FILES array |
|
| 922 | - * |
|
| 923 | - * @param mixed Some value from the $_FILES array |
|
| 924 | - * @param string The key from the $_FILES array that should be appended |
|
| 925 | - * @return array |
|
| 926 | - */ |
|
| 920 | + /** |
|
| 921 | + * A helper function to change the indexes in $_FILES array |
|
| 922 | + * |
|
| 923 | + * @param mixed Some value from the $_FILES array |
|
| 924 | + * @param string The key from the $_FILES array that should be appended |
|
| 925 | + * @return array |
|
| 926 | + */ |
|
| 927 | 927 | function _reindexFiles($value, $key) |
| 928 | 928 | { |
| 929 | 929 | if (!is_array($value)) { |
@@ -976,27 +976,27 @@ discard block |
||
| 976 | 976 | } |
| 977 | 977 | } // end func setElementError |
| 978 | 978 | |
| 979 | - // }}} |
|
| 980 | - // {{{ getElementType() |
|
| 981 | - |
|
| 982 | - /** |
|
| 983 | - * Returns the type of the given element |
|
| 984 | - * |
|
| 985 | - * @param string $element Name of form element |
|
| 986 | - * @since 1.1 |
|
| 987 | - * @access public |
|
| 988 | - * @return string Type of the element, false if the element is not found |
|
| 989 | - */ |
|
| 990 | - function getElementType($element) |
|
| 991 | - { |
|
| 992 | - if (isset($this->_elementIndex[$element])) { |
|
| 993 | - return $this->_elements[$this->_elementIndex[$element]]->getType(); |
|
| 994 | - } |
|
| 995 | - return false; |
|
| 996 | - } // end func getElementType |
|
| 997 | - |
|
| 998 | - // }}} |
|
| 999 | - // {{{ updateElementAttr() |
|
| 979 | + // }}} |
|
| 980 | + // {{{ getElementType() |
|
| 981 | + |
|
| 982 | + /** |
|
| 983 | + * Returns the type of the given element |
|
| 984 | + * |
|
| 985 | + * @param string $element Name of form element |
|
| 986 | + * @since 1.1 |
|
| 987 | + * @access public |
|
| 988 | + * @return string Type of the element, false if the element is not found |
|
| 989 | + */ |
|
| 990 | + function getElementType($element) |
|
| 991 | + { |
|
| 992 | + if (isset($this->_elementIndex[$element])) { |
|
| 993 | + return $this->_elements[$this->_elementIndex[$element]]->getType(); |
|
| 994 | + } |
|
| 995 | + return false; |
|
| 996 | + } // end func getElementType |
|
| 997 | + |
|
| 998 | + // }}} |
|
| 999 | + // {{{ updateElementAttr() |
|
| 1000 | 1000 | |
| 1001 | 1001 | /** |
| 1002 | 1002 | * Updates Attributes for one or more elements |
@@ -1263,18 +1263,18 @@ discard block |
||
| 1263 | 1263 | // }}} |
| 1264 | 1264 | // {{{ addFormRule() |
| 1265 | 1265 | |
| 1266 | - /** |
|
| 1267 | - * Adds a global validation rule |
|
| 1268 | - * |
|
| 1269 | - * This should be used when for a rule involving several fields or if |
|
| 1270 | - * you want to use some completely custom validation for your form. |
|
| 1271 | - * The rule function/method should return true in case of successful |
|
| 1272 | - * validation and array('element name' => 'error') when there were errors. |
|
| 1273 | - * |
|
| 1274 | - * @access public |
|
| 1275 | - * @param mixed Callback, either function name or array(&$object, 'method') |
|
| 1276 | - * @throws HTML_QuickForm_Error |
|
| 1277 | - */ |
|
| 1266 | + /** |
|
| 1267 | + * Adds a global validation rule |
|
| 1268 | + * |
|
| 1269 | + * This should be used when for a rule involving several fields or if |
|
| 1270 | + * you want to use some completely custom validation for your form. |
|
| 1271 | + * The rule function/method should return true in case of successful |
|
| 1272 | + * validation and array('element name' => 'error') when there were errors. |
|
| 1273 | + * |
|
| 1274 | + * @access public |
|
| 1275 | + * @param mixed Callback, either function name or array(&$object, 'method') |
|
| 1276 | + * @throws HTML_QuickForm_Error |
|
| 1277 | + */ |
|
| 1278 | 1278 | function addFormRule($rule) |
| 1279 | 1279 | { |
| 1280 | 1280 | if (!is_callable($rule)) { |
@@ -1351,18 +1351,18 @@ discard block |
||
| 1351 | 1351 | // }}} |
| 1352 | 1352 | // {{{ arrayMerge() |
| 1353 | 1353 | |
| 1354 | - /** |
|
| 1355 | - * Merges two arrays |
|
| 1356 | - * |
|
| 1357 | - * Merges two array like the PHP function array_merge but recursively. |
|
| 1358 | - * The main difference is that existing keys will not be renumbered |
|
| 1359 | - * if they are integers. |
|
| 1360 | - * |
|
| 1361 | - * @access public |
|
| 1362 | - * @param array $a original array |
|
| 1363 | - * @param array $b array which will be merged into first one |
|
| 1364 | - * @return array merged array |
|
| 1365 | - */ |
|
| 1354 | + /** |
|
| 1355 | + * Merges two arrays |
|
| 1356 | + * |
|
| 1357 | + * Merges two array like the PHP function array_merge but recursively. |
|
| 1358 | + * The main difference is that existing keys will not be renumbered |
|
| 1359 | + * if they are integers. |
|
| 1360 | + * |
|
| 1361 | + * @access public |
|
| 1362 | + * @param array $a original array |
|
| 1363 | + * @param array $b array which will be merged into first one |
|
| 1364 | + * @return array merged array |
|
| 1365 | + */ |
|
| 1366 | 1366 | static function arrayMerge($a, $b) |
| 1367 | 1367 | { |
| 1368 | 1368 | foreach ($b as $k => $v) { |
@@ -1493,10 +1493,10 @@ discard block |
||
| 1493 | 1493 | */ |
| 1494 | 1494 | function isElementFrozen($element) |
| 1495 | 1495 | { |
| 1496 | - if (isset($this->_elementIndex[$element])) { |
|
| 1497 | - return $this->_elements[$this->_elementIndex[$element]]->isFrozen(); |
|
| 1498 | - } |
|
| 1499 | - return false; |
|
| 1496 | + if (isset($this->_elementIndex[$element])) { |
|
| 1497 | + return $this->_elements[$this->_elementIndex[$element]]->isFrozen(); |
|
| 1498 | + } |
|
| 1499 | + return false; |
|
| 1500 | 1500 | } // end func isElementFrozen |
| 1501 | 1501 | |
| 1502 | 1502 | // }}} |
@@ -1685,7 +1685,7 @@ discard block |
||
| 1685 | 1685 | */ |
| 1686 | 1686 | function isFrozen() |
| 1687 | 1687 | { |
| 1688 | - return $this->_freezeAll; |
|
| 1688 | + return $this->_freezeAll; |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | /** |
@@ -1707,14 +1707,14 @@ discard block |
||
| 1707 | 1707 | return call_user_func($callback, $values); |
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | - /** |
|
| 1711 | - * Accepts a renderer |
|
| 1712 | - * |
|
| 1713 | - * @param object An HTML_QuickForm_Renderer object |
|
| 1714 | - * @since 3.0 |
|
| 1715 | - * @access public |
|
| 1716 | - * @return void |
|
| 1717 | - */ |
|
| 1710 | + /** |
|
| 1711 | + * Accepts a renderer |
|
| 1712 | + * |
|
| 1713 | + * @param object An HTML_QuickForm_Renderer object |
|
| 1714 | + * @since 3.0 |
|
| 1715 | + * @access public |
|
| 1716 | + * @return void |
|
| 1717 | + */ |
|
| 1718 | 1718 | function accept(&$renderer) { |
| 1719 | 1719 | $renderer->startForm($this); |
| 1720 | 1720 | foreach (array_keys($this->_elements) as $key) { |
@@ -1727,13 +1727,13 @@ discard block |
||
| 1727 | 1727 | $renderer->finishForm($this); |
| 1728 | 1728 | } |
| 1729 | 1729 | |
| 1730 | - /** |
|
| 1731 | - * Returns a reference to default renderer object |
|
| 1732 | - * |
|
| 1733 | - * @access public |
|
| 1734 | - * @since 3.0 |
|
| 1735 | - * @return HTML_QuickForm_Renderer_Default |
|
| 1736 | - */ |
|
| 1730 | + /** |
|
| 1731 | + * Returns a reference to default renderer object |
|
| 1732 | + * |
|
| 1733 | + * @access public |
|
| 1734 | + * @since 3.0 |
|
| 1735 | + * @return HTML_QuickForm_Renderer_Default |
|
| 1736 | + */ |
|
| 1737 | 1737 | function &defaultRenderer() { |
| 1738 | 1738 | if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) { |
| 1739 | 1739 | // Modified by Ivan Tcholakov, 16-MAR-2010. Suppressing a deprecation warning on PHP 5.3 |
@@ -1889,7 +1889,7 @@ discard block |
||
| 1889 | 1889 | // |
| 1890 | 1890 | $this->accept($renderer); |
| 1891 | 1891 | return $renderer->toArray(); |
| 1892 | - } |
|
| 1892 | + } |
|
| 1893 | 1893 | |
| 1894 | 1894 | /** |
| 1895 | 1895 | * Returns a 'safe' element's value |
@@ -1961,15 +1961,15 @@ discard block |
||
| 1961 | 1961 | return $values; |
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | - /** |
|
| 1965 | - * Tells whether the form was already submitted |
|
| 1966 | - * |
|
| 1967 | - * This is useful since the _submitFiles and _submitValues arrays |
|
| 1968 | - * may be completely empty after the trackSubmit value is removed. |
|
| 1969 | - * |
|
| 1970 | - * @access public |
|
| 1971 | - * @return bool |
|
| 1972 | - */ |
|
| 1964 | + /** |
|
| 1965 | + * Tells whether the form was already submitted |
|
| 1966 | + * |
|
| 1967 | + * This is useful since the _submitFiles and _submitValues arrays |
|
| 1968 | + * may be completely empty after the trackSubmit value is removed. |
|
| 1969 | + * |
|
| 1970 | + * @access public |
|
| 1971 | + * @return bool |
|
| 1972 | + */ |
|
| 1973 | 1973 | function isSubmitted() |
| 1974 | 1974 | { |
| 1975 | 1975 | return $this->_flagSubmitted; |
@@ -2056,21 +2056,21 @@ discard block |
||
| 2056 | 2056 | { |
| 2057 | 2057 | |
| 2058 | 2058 | /** |
| 2059 | - * Prefix for all error messages |
|
| 2060 | - * @var string |
|
| 2061 | - */ |
|
| 2059 | + * Prefix for all error messages |
|
| 2060 | + * @var string |
|
| 2061 | + */ |
|
| 2062 | 2062 | var $error_message_prefix = 'QuickForm Error: '; |
| 2063 | 2063 | |
| 2064 | 2064 | /** |
| 2065 | - * Creates a quickform error object, extending the PEAR_Error class |
|
| 2066 | - * |
|
| 2067 | - * @param int $code the error code |
|
| 2068 | - * @param int $mode the reaction to the error, either return, die or trigger/callback |
|
| 2069 | - * @param int $level intensity of the error (PHP error code) |
|
| 2070 | - * @param mixed $debuginfo any information that can inform user as to nature of the error |
|
| 2071 | - */ |
|
| 2065 | + * Creates a quickform error object, extending the PEAR_Error class |
|
| 2066 | + * |
|
| 2067 | + * @param int $code the error code |
|
| 2068 | + * @param int $mode the reaction to the error, either return, die or trigger/callback |
|
| 2069 | + * @param int $level intensity of the error (PHP error code) |
|
| 2070 | + * @param mixed $debuginfo any information that can inform user as to nature of the error |
|
| 2071 | + */ |
|
| 2072 | 2072 | function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN, |
| 2073 | - $level = E_USER_NOTICE, $debuginfo = null) |
|
| 2073 | + $level = E_USER_NOTICE, $debuginfo = null) |
|
| 2074 | 2074 | { |
| 2075 | 2075 | if (is_int($code)) { |
| 2076 | 2076 | $this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo); |