diff options
author | robocoder <anthon.pang@gmail.com> | 2009-07-08 08:58:45 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-07-08 08:58:45 +0400 |
commit | a25f4e56f7d026658ec08b61a2cbf5fb853486e3 (patch) | |
tree | 27c4d903602fdf59b8e7e00abca36721bab2d76b /libs/HTML | |
parent | 4fb541d1bb1b2bed65142ee2ec98a4a554001165 (diff) |
fixes #856 - update PEAR HTML_Common from 1.2.4 to 1.2.5,
and HTML_QuickForm from 3.2.8 to 3.2.10.
git-svn-id: http://dev.piwik.org/svn/trunk@1297 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/HTML')
44 files changed, 2393 insertions, 100 deletions
diff --git a/libs/HTML/Common.php b/libs/HTML/Common.php index 01ba372445..e35467da14 100644 --- a/libs/HTML/Common.php +++ b/libs/HTML/Common.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_Common * @author Adam Daniel <adaniel1@eesus.jnj.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_Common/ @@ -27,7 +27,7 @@ * @category HTML * @package HTML_Common * @author Adam Daniel <adaniel1@eesus.jnj.com> - * @version Release: 1.2.4 + * @version Release: 1.2.5 * @abstract */ class HTML_Common @@ -179,9 +179,10 @@ class HTML_Common $arrAttr[strtolower(trim($name))] = strtolower(trim($name)); } else { if (substr($value, 0, 1) == "\"" || substr($value, 0, 1) == "'") { - $value = substr($value, 1, -1); + $arrAttr[strtolower(trim($name))] = substr($value, 1, -1); + } else { + $arrAttr[strtolower(trim($name))] = trim($value); } - $arrAttr[strtolower(trim($name))] = trim($value); } } return $arrAttr; diff --git a/libs/HTML/QuickForm.php b/libs/HTML/QuickForm.php index 774416bcc6..6ec350a1fb 100644 --- a/libs/HTML/QuickForm.php +++ b/libs/HTML/QuickForm.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -119,7 +119,7 @@ define('QUICKFORM_INVALID_DATASOURCE', -9); * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 */ class HTML_QuickForm extends HTML_Common { @@ -1030,7 +1030,13 @@ class HTML_QuickForm extends HTML_Common $this->_elementIndex[$elementName] = array_shift($this->_duplicateIndex[$elementName]); } if ($removeRules) { + $this->_required = array_diff($this->_required, array($elementName)); unset($this->_rules[$elementName], $this->_errors[$elementName]); + if ('group' == $el->getType()) { + foreach (array_keys($el->getElements()) as $key) { + unset($this->_rules[$el->getElementName($key)]); + } + } } return $el; } // end func removeElement @@ -1526,6 +1532,11 @@ class HTML_QuickForm extends HTML_Common // Fix for bug #3501: we shouldn't validate not uploaded files, either. // Unfortunately, we can't just use $element->isUploadedFile() since // the element in question can be buried in group. Thus this hack. + // See also bug #12014, we should only consider a file that has + // status UPLOAD_ERR_NO_FILE as not uploaded, in all other cases + // validation should be performed, so that e.g. 'maxfilesize' rule + // will display an error if status is UPLOAD_ERR_INI_SIZE + // or UPLOAD_ERR_FORM_SIZE } elseif (is_array($submitValue)) { if (false === ($pos = strpos($target, '['))) { $isUpload = !empty($this->_submitFiles[$target]); @@ -1540,7 +1551,7 @@ class HTML_QuickForm extends HTML_Common ) . "']"; eval("\$isUpload = isset(\$this->_submitFiles['{$base}']['name']{$idx});"); } - if ($isUpload && (!isset($submitValue['error']) || 0 != $submitValue['error'])) { + if ($isUpload && (!isset($submitValue['error']) || UPLOAD_ERR_NO_FILE == $submitValue['error'])) { continue 2; } } @@ -1960,7 +1971,7 @@ class HTML_QuickForm extends HTML_Common * @return bool whether $value is an error * @static */ - static function isError($value) + function isError($value) { return (is_object($value) && is_a($value, 'html_quickform_error')); } // end func isError @@ -1976,7 +1987,7 @@ class HTML_QuickForm extends HTML_Common * @return string error message * @static */ - static function errorMessage($value) + function errorMessage($value) { // make the variable static so that it only has to do the defining on the first call static $errorMessages; @@ -2016,7 +2027,7 @@ class HTML_QuickForm extends HTML_Common * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 */ class HTML_QuickForm_Error extends PEAR_Error { diff --git a/libs/HTML/QuickForm/Renderer.php b/libs/HTML/QuickForm/Renderer.php index 970d4367d8..0bcbf68177 100644 --- a/libs/HTML/QuickForm/Renderer.php +++ b/libs/HTML/QuickForm/Renderer.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -29,7 +29,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.0 * @abstract */ diff --git a/libs/HTML/QuickForm/Renderer/Array.php b/libs/HTML/QuickForm/Renderer/Array.php index 1f5f7253d1..28f5893102 100644 --- a/libs/HTML/QuickForm/Renderer/Array.php +++ b/libs/HTML/QuickForm/Renderer/Array.php @@ -18,7 +18,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Thomas Schulz <ths@4bconsult.de> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -109,7 +109,7 @@ require_once 'HTML/QuickForm/Renderer.php'; * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Thomas Schulz <ths@4bconsult.de> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.0 */ class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer @@ -337,4 +337,4 @@ class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer } } } -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Renderer/ArraySmarty.php b/libs/HTML/QuickForm/Renderer/ArraySmarty.php index 4a7a4c8601..89b59e7dee 100644 --- a/libs/HTML/QuickForm/Renderer/ArraySmarty.php +++ b/libs/HTML/QuickForm/Renderer/ArraySmarty.php @@ -18,7 +18,7 @@ * @author Alexey Borzov <avb@php.net> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Thomas Schulz <ths@4bconsult.de> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -87,7 +87,7 @@ require_once 'HTML/QuickForm/Renderer/Array.php'; * @author Alexey Borzov <avb@php.net> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Thomas Schulz <ths@4bconsult.de> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.0 */ class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array @@ -133,11 +133,12 @@ class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array * * @param Smarty reference to the Smarty template engine instance * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key" + * @param bool true: collect all hidden elements into string; false: process them as usual form elements * @access public */ - function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false) + function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true) { - $this->HTML_QuickForm_Renderer_Array(false, $staticLabels); + $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels); $this->_tpl =& $tpl; } // end constructor @@ -399,4 +400,4 @@ class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array $this->_error = $template; } // end func setErrorTemplate } -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Renderer/Default.php b/libs/HTML/QuickForm/Renderer/Default.php new file mode 100644 index 0000000000..0801105ba8 --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/Default.php @@ -0,0 +1,485 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Alexey Borzov <avb@php.net> + * @author Adam Daniel <adaniel1@eesus.jnj.com> + * @author Bertrand Mansion <bmansion@mamasam.com> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * An abstract base class for QuickForm renderers + */ +require_once 'HTML/QuickForm/Renderer.php'; + +/** + * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one + * + * @category HTML + * @package HTML_QuickForm + * @author Alexey Borzov <avb@php.net> + * @author Adam Daniel <adaniel1@eesus.jnj.com> + * @author Bertrand Mansion <bmansion@mamasam.com> + * @version Release: 3.2.11 + * @since 3.0 + */ +class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer +{ + /** + * The HTML of the form + * @var string + * @access private + */ + var $_html; + + /** + * Header Template string + * @var string + * @access private + */ + var $_headerTemplate = + "\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #CCCCCC;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>"; + + /** + * Element template string + * @var string + * @access private + */ + var $_elementTemplate = + "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->\t{element}</td>\n\t</tr>"; + + /** + * Form template string + * @var string + * @access private + */ + var $_formTemplate = + "\n<form{attributes}>\n<div>\n{hidden}<table border=\"0\">\n{content}\n</table>\n</div>\n</form>"; + + /** + * Required Note template string + * @var string + * @access private + */ + var $_requiredNoteTemplate = + "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\" valign=\"top\">{requiredNote}</td>\n\t</tr>"; + + /** + * Array containing the templates for customised elements + * @var array + * @access private + */ + var $_templates = array(); + + /** + * Array containing the templates for group wraps. + * + * These templates are wrapped around group elements and groups' own + * templates wrap around them. This is set by setGroupTemplate(). + * + * @var array + * @access private + */ + var $_groupWraps = array(); + + /** + * Array containing the templates for elements within groups + * @var array + * @access private + */ + var $_groupTemplates = array(); + + /** + * True if we are inside a group + * @var bool + * @access private + */ + var $_inGroup = false; + + /** + * Array with HTML generated for group elements + * @var array + * @access private + */ + var $_groupElements = array(); + + /** + * Template for an element inside a group + * @var string + * @access private + */ + var $_groupElementTemplate = ''; + + /** + * HTML that wraps around the group elements + * @var string + * @access private + */ + var $_groupWrap = ''; + + /** + * HTML for the current group + * @var string + * @access private + */ + var $_groupTemplate = ''; + + /** + * Collected HTML of the hidden fields + * @var string + * @access private + */ + var $_hiddenHtml = ''; + + /** + * Constructor + * + * @access public + */ + function HTML_QuickForm_Renderer_Default() + { + $this->HTML_QuickForm_Renderer(); + } // end constructor + + /** + * returns the HTML generated for the form + * + * @access public + * @return string + */ + function toHtml() + { + // _hiddenHtml is cleared in finishForm(), so this only matters when + // finishForm() was not called (e.g. group::toHtml(), bug #3511) + return $this->_hiddenHtml . $this->_html; + } // end func toHtml + + /** + * Called when visiting a form, before processing any form elements + * + * @param HTML_QuickForm form object being visited + * @access public + * @return void + */ + function startForm(&$form) + { + $this->_html = ''; + $this->_hiddenHtml = ''; + } // end func startForm + + /** + * Called when visiting a form, after processing all form elements + * Adds required note, form attributes, validation javascript and form content. + * + * @param HTML_QuickForm form object being visited + * @access public + * @return void + */ + function finishForm(&$form) + { + // add a required note, if one is needed + if (!empty($form->_required) && !$form->_freezeAll) { + $this->_html .= str_replace('{requiredNote}', $form->getRequiredNote(), $this->_requiredNoteTemplate); + } + // add form attributes and content + $html = str_replace('{attributes}', $form->getAttributes(true), $this->_formTemplate); + if (strpos($this->_formTemplate, '{hidden}')) { + $html = str_replace('{hidden}', $this->_hiddenHtml, $html); + } else { + $this->_html .= $this->_hiddenHtml; + } + $this->_hiddenHtml = ''; + $this->_html = str_replace('{content}', $this->_html, $html); + // add a validation script + if ('' != ($script = $form->getValidationScript())) { + $this->_html = $script . "\n" . $this->_html; + } + } // end func finishForm + + /** + * Called when visiting a header element + * + * @param HTML_QuickForm_header header element being visited + * @access public + * @return void + */ + function renderHeader(&$header) + { + $name = $header->getName(); + if (!empty($name) && isset($this->_templates[$name])) { + $this->_html .= str_replace('{header}', $header->toHtml(), $this->_templates[$name]); + } else { + $this->_html .= str_replace('{header}', $header->toHtml(), $this->_headerTemplate); + } + } // end func renderHeader + + /** + * Helper method for renderElement + * + * @param string Element name + * @param mixed Element label (if using an array of labels, you should set the appropriate template) + * @param bool Whether an element is required + * @param string Error message associated with the element + * @access private + * @see renderElement() + * @return string Html for element + */ + function _prepareTemplate($name, $label, $required, $error) + { + if (is_array($label)) { + $nameLabel = array_shift($label); + } else { + $nameLabel = $label; + } + if (isset($this->_templates[$name])) { + $html = str_replace('{label}', $nameLabel, $this->_templates[$name]); + } else { + $html = str_replace('{label}', $nameLabel, $this->_elementTemplate); + } + if ($required) { + $html = str_replace('<!-- BEGIN required -->', '', $html); + $html = str_replace('<!-- END required -->', '', $html); + } else { + $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html); + } + if (isset($error)) { + $html = str_replace('{error}', $error, $html); + $html = str_replace('<!-- BEGIN error -->', '', $html); + $html = str_replace('<!-- END error -->', '', $html); + } else { + $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN error -->.*<!-- END error -->([ \t\n\r]*)?/isU", '', $html); + } + if (is_array($label)) { + foreach($label as $key => $text) { + $key = is_int($key)? $key + 2: $key; + $html = str_replace("{label_{$key}}", $text, $html); + $html = str_replace("<!-- BEGIN label_{$key} -->", '', $html); + $html = str_replace("<!-- END label_{$key} -->", '', $html); + } + } + if (strpos($html, '{label_')) { + $html = preg_replace('/\s*<!-- BEGIN label_(\S+) -->.*<!-- END label_\1 -->\s*/is', '', $html); + } + return $html; + } // end func _prepareTemplate + + /** + * Renders an element Html + * Called when visiting an element + * + * @param HTML_QuickForm_element form element being visited + * @param bool Whether an element is required + * @param string An error message associated with an element + * @access public + * @return void + */ + function renderElement(&$element, $required, $error) + { + if (!$this->_inGroup) { + $html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error); + $this->_html .= str_replace('{element}', $element->toHtml(), $html); + + } elseif (!empty($this->_groupElementTemplate)) { + $html = str_replace('{label}', $element->getLabel(), $this->_groupElementTemplate); + if ($required) { + $html = str_replace('<!-- BEGIN required -->', '', $html); + $html = str_replace('<!-- END required -->', '', $html); + } else { + $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html); + } + $this->_groupElements[] = str_replace('{element}', $element->toHtml(), $html); + + } else { + $this->_groupElements[] = $element->toHtml(); + } + } // end func renderElement + + /** + * Renders an hidden element + * Called when visiting a hidden element + * + * @param HTML_QuickForm_element form element being visited + * @access public + * @return void + */ + function renderHidden(&$element) + { + $this->_hiddenHtml .= $element->toHtml() . "\n"; + } // end func renderHidden + + /** + * Called when visiting a raw HTML/text pseudo-element + * + * @param HTML_QuickForm_html element being visited + * @access public + * @return void + */ + function renderHtml(&$data) + { + $this->_html .= $data->toHtml(); + } // end func renderHtml + + /** + * Called when visiting a group, before processing any group elements + * + * @param HTML_QuickForm_group group being visited + * @param bool Whether a group is required + * @param string An error message associated with a group + * @access public + * @return void + */ + function startGroup(&$group, $required, $error) + { + $name = $group->getName(); + $this->_groupTemplate = $this->_prepareTemplate($name, $group->getLabel(), $required, $error); + $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name]; + $this->_groupWrap = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name]; + $this->_groupElements = array(); + $this->_inGroup = true; + } // end func startGroup + + /** + * Called when visiting a group, after processing all group elements + * + * @param HTML_QuickForm_group group being visited + * @access public + * @return void + */ + function finishGroup(&$group) + { + $separator = $group->_separator; + if (is_array($separator)) { + $count = count($separator); + $html = ''; + for ($i = 0; $i < count($this->_groupElements); $i++) { + $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i]; + } + } else { + if (is_null($separator)) { + $separator = ' '; + } + $html = implode((string)$separator, $this->_groupElements); + } + if (!empty($this->_groupWrap)) { + $html = str_replace('{content}', $html, $this->_groupWrap); + } + $this->_html .= str_replace('{element}', $html, $this->_groupTemplate); + $this->_inGroup = false; + } // end func finishGroup + + /** + * Sets element template + * + * @param string The HTML surrounding an element + * @param string (optional) Name of the element to apply template for + * @access public + * @return void + */ + function setElementTemplate($html, $element = null) + { + if (is_null($element)) { + $this->_elementTemplate = $html; + } else { + $this->_templates[$element] = $html; + } + } // end func setElementTemplate + + + /** + * Sets template for a group wrapper + * + * This template is contained within a group-as-element template + * set via setTemplate() and contains group's element templates, set + * via setGroupElementTemplate() + * + * @param string The HTML surrounding group elements + * @param string Name of the group to apply template for + * @access public + * @return void + */ + function setGroupTemplate($html, $group) + { + $this->_groupWraps[$group] = $html; + } // end func setGroupTemplate + + /** + * Sets element template for elements within a group + * + * @param string The HTML surrounding an element + * @param string Name of the group to apply template for + * @access public + * @return void + */ + function setGroupElementTemplate($html, $group) + { + $this->_groupTemplates[$group] = $html; + } // end func setGroupElementTemplate + + /** + * Sets header template + * + * @param string The HTML surrounding the header + * @access public + * @return void + */ + function setHeaderTemplate($html) + { + $this->_headerTemplate = $html; + } // end func setHeaderTemplate + + /** + * Sets form template + * + * @param string The HTML surrounding the form tags + * @access public + * @return void + */ + function setFormTemplate($html) + { + $this->_formTemplate = $html; + } // end func setFormTemplate + + /** + * Sets the note indicating required fields template + * + * @param string The HTML surrounding the required note + * @access public + * @return void + */ + function setRequiredNoteTemplate($html) + { + $this->_requiredNoteTemplate = $html; + } // end func setRequiredNoteTemplate + + /** + * Clears all the HTML out of the templates that surround notes, elements, etc. + * Useful when you want to use addData() to create a completely custom form look + * + * @access public + * @return void + */ + function clearAllTemplates() + { + $this->setElementTemplate('{element}'); + $this->setFormTemplate("\n\t<form{attributes}>{content}\n\t</form>\n"); + $this->setRequiredNoteTemplate(''); + $this->_templates = array(); + } // end func clearAllTemplates +} // end class HTML_QuickForm_Renderer_Default +?> diff --git a/libs/HTML/QuickForm/Renderer/ITDynamic.php b/libs/HTML/QuickForm/Renderer/ITDynamic.php new file mode 100644 index 0000000000..f554203dfa --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/ITDynamic.php @@ -0,0 +1,300 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A concrete renderer for HTML_QuickForm, using Integrated Templates. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Alexey Borzov <avb@php.net> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * An abstract base class for QuickForm renderers + */ +require_once 'HTML/QuickForm/Renderer.php'; + +/** + * A concrete renderer for HTML_QuickForm, using Integrated Templates. + * + * This is a "dynamic" renderer, which means that concrete form look + * is defined at runtime. This also means that you can define + * <b>one</b> template file for <b>all</b> your forms. That template + * should contain a block for every element 'look' appearing in your + * forms and also some special blocks (consult the examples). If a + * special block is not set for an element, the renderer falls back to + * a default one. + * + * @category HTML + * @package HTML_QuickForm + * @author Alexey Borzov <avb@php.net> + * @version Release: 3.2.11 + * @since 3.0 + */ +class HTML_QuickForm_Renderer_ITDynamic extends HTML_QuickForm_Renderer +{ + /**#@+ + * @access private + */ + /** + * A template class (HTML_Template_ITX or HTML_Template_Sigma) instance + * @var HTML_Template_ITX|HTML_Template_Sigma + */ + var $_tpl = null; + + /** + * The errors that were not shown near concrete fields go here + * @var array + */ + var $_errors = array(); + + /** + * Show the block with required note? + * @var bool + */ + var $_showRequired = false; + + /** + * A separator for group elements + * @var mixed + */ + var $_groupSeparator = null; + + /** + * The current element index inside a group + * @var integer + */ + var $_groupElementIdx = 0; + + /** + * Blocks to use for different elements + * @var array + */ + var $_elementBlocks = array(); + + /** + * Block to use for headers + * @var string + */ + var $_headerBlock = null; + /**#@-*/ + + + /** + * Constructor + * + * @param HTML_Template_ITX|HTML_Template_Sigma Template object to use + */ + function HTML_QuickForm_Renderer_ITDynamic(&$tpl) + { + $this->HTML_QuickForm_Renderer(); + $this->_tpl =& $tpl; + $this->_tpl->setCurrentBlock('qf_main_loop'); + } + + + function finishForm(&$form) + { + // display errors above form + if (!empty($this->_errors) && $this->_tpl->blockExists('qf_error_loop')) { + foreach ($this->_errors as $error) { + $this->_tpl->setVariable('qf_error', $error); + $this->_tpl->parse('qf_error_loop'); + } + } + // show required note + if ($this->_showRequired) { + $this->_tpl->setVariable('qf_required_note', $form->getRequiredNote()); + } + // assign form attributes + $this->_tpl->setVariable('qf_attributes', $form->getAttributes(true)); + // assign javascript validation rules + $this->_tpl->setVariable('qf_javascript', $form->getValidationScript()); + } + + + function renderHeader(&$header) + { + $blockName = $this->_matchBlock($header); + if ('qf_header' == $blockName && isset($this->_headerBlock)) { + $blockName = $this->_headerBlock; + } + $this->_tpl->setVariable('qf_header', $header->toHtml()); + $this->_tpl->parse($blockName); + $this->_tpl->parse('qf_main_loop'); + } + + + function renderElement(&$element, $required, $error) + { + $blockName = $this->_matchBlock($element); + // are we inside a group? + if ('qf_main_loop' != $this->_tpl->currentBlock) { + if (0 != $this->_groupElementIdx && $this->_tpl->placeholderExists('qf_separator', $blockName)) { + if (is_array($this->_groupSeparator)) { + $this->_tpl->setVariable('qf_separator', $this->_groupSeparator[($this->_groupElementIdx - 1) % count($this->_groupSeparator)]); + } else { + $this->_tpl->setVariable('qf_separator', (string)$this->_groupSeparator); + } + } + $this->_groupElementIdx++; + + } elseif(!empty($error)) { + // show the error message or keep it for later use + if ($this->_tpl->blockExists($blockName . '_error')) { + $this->_tpl->setVariable('qf_error', $error); + } else { + $this->_errors[] = $error; + } + } + // show an '*' near the required element + if ($required) { + $this->_showRequired = true; + if ($this->_tpl->blockExists($blockName . '_required')) { + $this->_tpl->touchBlock($blockName . '_required'); + } + } + // Prepare multiple labels + $labels = $element->getLabel(); + if (is_array($labels)) { + $mainLabel = array_shift($labels); + } else { + $mainLabel = $labels; + } + // render the element itself with its main label + $this->_tpl->setVariable('qf_element', $element->toHtml()); + if ($this->_tpl->placeholderExists('qf_label', $blockName)) { + $this->_tpl->setVariable('qf_label', $mainLabel); + } + // render extra labels, if any + if (is_array($labels)) { + foreach($labels as $key => $label) { + $key = is_int($key)? $key + 2: $key; + if ($this->_tpl->blockExists($blockName . '_label_' . $key)) { + $this->_tpl->setVariable('qf_label_' . $key, $label); + } + } + } + $this->_tpl->parse($blockName); + $this->_tpl->parseCurrentBlock(); + } + + + function renderHidden(&$element) + { + $this->_tpl->setVariable('qf_hidden', $element->toHtml()); + $this->_tpl->parse('qf_hidden_loop'); + } + + + function startGroup(&$group, $required, $error) + { + $blockName = $this->_matchBlock($group); + $this->_tpl->setCurrentBlock($blockName . '_loop'); + $this->_groupElementIdx = 0; + $this->_groupSeparator = is_null($group->_separator)? ' ': $group->_separator; + // show an '*' near the required element + if ($required) { + $this->_showRequired = true; + if ($this->_tpl->blockExists($blockName . '_required')) { + $this->_tpl->touchBlock($blockName . '_required'); + } + } + // show the error message or keep it for later use + if (!empty($error)) { + if ($this->_tpl->blockExists($blockName . '_error')) { + $this->_tpl->setVariable('qf_error', $error); + } else { + $this->_errors[] = $error; + } + } + $this->_tpl->setVariable('qf_group_label', $group->getLabel()); + } + + + function finishGroup(&$group) + { + $this->_tpl->parse($this->_matchBlock($group)); + $this->_tpl->setCurrentBlock('qf_main_loop'); + $this->_tpl->parseCurrentBlock(); + } + + + /** + * Returns the name of a block to use for element rendering + * + * If a name was not explicitly set via setElementBlock(), it tries + * the names '{prefix}_{element type}' and '{prefix}_{element}', where + * prefix is either 'qf' or the name of the current group's block + * + * @param HTML_QuickForm_element form element being rendered + * @access private + * @return string block name + */ + function _matchBlock(&$element) + { + $name = $element->getName(); + $type = $element->getType(); + if (isset($this->_elementBlocks[$name]) && $this->_tpl->blockExists($this->_elementBlocks[$name])) { + if (('group' == $type) || ($this->_elementBlocks[$name] . '_loop' != $this->_tpl->currentBlock)) { + return $this->_elementBlocks[$name]; + } + } + if ('group' != $type && 'qf_main_loop' != $this->_tpl->currentBlock) { + $prefix = substr($this->_tpl->currentBlock, 0, -5); // omit '_loop' postfix + } else { + $prefix = 'qf'; + } + if ($this->_tpl->blockExists($prefix . '_' . $type)) { + return $prefix . '_' . $type; + } elseif ($this->_tpl->blockExists($prefix . '_' . $name)) { + return $prefix . '_' . $name; + } else { + return $prefix . '_element'; + } + } + + + /** + * Sets the block to use for element rendering + * + * @param mixed element name or array ('element name' => 'block name') + * @param string block name if $elementName is not an array + * @access public + * @return void + */ + function setElementBlock($elementName, $blockName = null) + { + if (is_array($elementName)) { + $this->_elementBlocks = array_merge($this->_elementBlocks, $elementName); + } else { + $this->_elementBlocks[$elementName] = $blockName; + } + } + + + /** + * Sets the name of a block to use for header rendering + * + * @param string block name + * @access public + * @return void + */ + function setHeaderBlock($blockName) + { + $this->_headerBlock = $blockName; + } +} +?> diff --git a/libs/HTML/QuickForm/Renderer/ITStatic.php b/libs/HTML/QuickForm/Renderer/ITStatic.php new file mode 100644 index 0000000000..56c9d1fed2 --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/ITStatic.php @@ -0,0 +1,504 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A static renderer for HTML_QuickForm compatible + * with HTML_Template_IT and HTML_Template_Sigma. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Bertrand Mansion <bmansion@mamasam.com> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * An abstract base class for QuickForm renderers + */ +require_once 'HTML/QuickForm/Renderer.php'; + +/** + * A static renderer for HTML_QuickForm compatible + * with HTML_Template_IT and HTML_Template_Sigma. + * + * As opposed to the dynamic renderer, this renderer needs + * every elements and labels in the form to be specified by + * placeholders at the position you want them to be displayed. + * + * @category HTML + * @package HTML_QuickForm + * @author Bertrand Mansion <bmansion@mamasam.com> + * @version Release: 3.2.11 + * @since 3.0 + */ +class HTML_QuickForm_Renderer_ITStatic extends HTML_QuickForm_Renderer +{ + /**#@+ + * @access private + */ + /** + * An HTML_Template_IT or some other API compatible Template instance + * @var object + */ + var $_tpl = null; + + /** + * Rendered form name + * @var string + */ + var $_formName = 'form'; + + /** + * The errors that were not shown near concrete fields go here + * @var array + */ + var $_errors = array(); + + /** + * Show the block with required note? + * @var bool + */ + var $_showRequired = false; + + /** + * Which group are we currently parsing ? + * @var string + */ + var $_inGroup; + + /** + * Index of the element in its group + * @var int + */ + var $_elementIndex = 0; + + /** + * If elements have been added with the same name + * @var array + */ + var $_duplicateElements = array(); + + /** + * How to handle the required tag for required fields + * @var string + */ + var $_required = '{label}<font size="1" color="red">*</font>'; + + /** + * How to handle error messages in form validation + * @var string + */ + var $_error = '<font color="red">{error}</font><br />{html}'; + + /** + * Collected HTML for hidden elements, if needed + * @var string + */ + var $_hidden = ''; + /**#@-*/ + + /** + * Constructor + * + * @param HTML_Template_IT|HTML_Template_Sigma Template object to use + */ + function HTML_QuickForm_Renderer_ITStatic(&$tpl) + { + $this->HTML_QuickForm_Renderer(); + $this->_tpl =& $tpl; + } // end constructor + + /** + * Called when visiting a form, before processing any form elements + * + * @param HTML_QuickForm form object being visited + * @access public + * @return void + */ + function startForm(&$form) + { + $this->_formName = $form->getAttribute('id'); + + if (count($form->_duplicateIndex) > 0) { + // Take care of duplicate elements + foreach ($form->_duplicateIndex as $elementName => $indexes) { + $this->_duplicateElements[$elementName] = 0; + } + } + } // end func startForm + + /** + * Called when visiting a form, after processing all form elements + * + * @param HTML_QuickForm form object being visited + * @access public + * @return void + */ + function finishForm(&$form) + { + // display errors above form + if (!empty($this->_errors) && $this->_tpl->blockExists($this->_formName.'_error_loop')) { + foreach ($this->_errors as $error) { + $this->_tpl->setVariable($this->_formName.'_error', $error); + $this->_tpl->parse($this->_formName.'_error_loop'); + } + } + // show required note + if ($this->_showRequired) { + $this->_tpl->setVariable($this->_formName.'_required_note', $form->getRequiredNote()); + } + // add hidden elements, if collected + if (!empty($this->_hidden)) { + $this->_tpl->setVariable($this->_formName . '_hidden', $this->_hidden); + } + // assign form attributes + $this->_tpl->setVariable($this->_formName.'_attributes', $form->getAttributes(true)); + // assign javascript validation rules + $this->_tpl->setVariable($this->_formName.'_javascript', $form->getValidationScript()); + } // end func finishForm + + /** + * Called when visiting a header element + * + * @param HTML_QuickForm_header header element being visited + * @access public + * @return void + */ + function renderHeader(&$header) + { + $name = $header->getName(); + $varName = $this->_formName.'_header'; + + // Find placeHolder + if (!empty($name) && $this->_tpl->placeHolderExists($this->_formName.'_header_'.$name)) { + $varName = $this->_formName.'_header_'.$name; + } + $this->_tpl->setVariable($varName, $header->toHtml()); + } // end func renderHeader + + /** + * Called when visiting an element + * + * @param HTML_QuickForm_element form element being visited + * @param bool Whether an element is required + * @param string An error message associated with an element + * @access public + * @return void + */ + function renderElement(&$element, $required, $error) + { + $name = $element->getName(); + + // are we inside a group? + if (!empty($this->_inGroup)) { + $varName = $this->_formName.'_'.str_replace(array('[', ']'), '_', $name); + if (substr($varName, -2) == '__') { + // element name is of type : group[] + $varName = $this->_inGroup.'_'.$this->_elementIndex.'_'; + $this->_elementIndex++; + } + if ($varName != $this->_inGroup) { + $varName .= '_' == substr($varName, -1)? '': '_'; + // element name is of type : group[name] + $label = $element->getLabel(); + $html = $element->toHtml(); + + if ($required && !$element->isFrozen()) { + $this->_renderRequired($label, $html); + $this->_showRequired = true; + } + if (!empty($label)) { + if (is_array($label)) { + foreach ($label as $key => $value) { + $this->_tpl->setVariable($varName.'label_'.$key, $value); + } + } else { + $this->_tpl->setVariable($varName.'label', $label); + } + } + $this->_tpl->setVariable($varName.'html', $html); + } + + } else { + + $name = str_replace(array('[', ']'), array('_', ''), $name); + + if (isset($this->_duplicateElements[$name])) { + // Element is a duplicate + $varName = $this->_formName.'_'.$name.'_'.$this->_duplicateElements[$name]; + $this->_duplicateElements[$name]++; + } else { + $varName = $this->_formName.'_'.$name; + } + + $label = $element->getLabel(); + $html = $element->toHtml(); + + if ($required) { + $this->_showRequired = true; + $this->_renderRequired($label, $html); + } + if (!empty($error)) { + $this->_renderError($label, $html, $error); + } + if (is_array($label)) { + foreach ($label as $key => $value) { + $this->_tpl->setVariable($varName.'_label_'.$key, $value); + } + } else { + $this->_tpl->setVariable($varName.'_label', $label); + } + $this->_tpl->setVariable($varName.'_html', $html); + } + } // end func renderElement + + /** + * Called when visiting a hidden element + * + * @param HTML_QuickForm_element hidden element being visited + * @access public + * @return void + */ + function renderHidden(&$element) + { + if ($this->_tpl->placeholderExists($this->_formName . '_hidden')) { + $this->_hidden .= $element->toHtml(); + } else { + $name = $element->getName(); + $name = str_replace(array('[', ']'), array('_', ''), $name); + $this->_tpl->setVariable($this->_formName.'_'.$name.'_html', $element->toHtml()); + } + } // end func renderHidden + + /** + * Called when visiting a group, before processing any group elements + * + * @param HTML_QuickForm_group group being visited + * @param bool Whether a group is required + * @param string An error message associated with a group + * @access public + * @return void + */ + function startGroup(&$group, $required, $error) + { + $name = $group->getName(); + $varName = $this->_formName.'_'.$name; + + $this->_elementIndex = 0; + + $html = $this->_tpl->placeholderExists($varName.'_html') ? $group->toHtml() : ''; + $label = $group->getLabel(); + + if ($required) { + $this->_renderRequired($label, $html); + } + if (!empty($error)) { + $this->_renderError($label, $html, $error); + } + if (!empty($html)) { + $this->_tpl->setVariable($varName.'_html', $html); + } else { + // Uses error blocks to set the special groups layout error + // <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error --> + if (!empty($error)) { + if ($this->_tpl->placeholderExists($varName.'_error')) { + if ($this->_tpl->blockExists($this->_formName . '_error_block')) { + $this->_tpl->setVariable($this->_formName . '_error', $error); + $error = $this->_getTplBlock($this->_formName . '_error_block'); + } elseif (strpos($this->_error, '{html}') !== false || strpos($this->_error, '{label}') !== false) { + $error = str_replace('{error}', $error, $this->_error); + } + } + $this->_tpl->setVariable($varName . '_error', $error); + array_pop($this->_errors); + } + } + if (is_array($label)) { + foreach ($label as $key => $value) { + $this->_tpl->setVariable($varName.'_label_'.$key, $value); + } + } else { + $this->_tpl->setVariable($varName.'_label', $label); + } + $this->_inGroup = $varName; + } // end func startGroup + + /** + * Called when visiting a group, after processing all group elements + * + * @param HTML_QuickForm_group group being visited + * @access public + * @return void + */ + function finishGroup(&$group) + { + $this->_inGroup = ''; + } // end func finishGroup + + /** + * Sets the way required elements are rendered + * + * You can use {label} or {html} placeholders to let the renderer know where + * where the element label or the element html are positionned according to the + * required tag. They will be replaced accordingly with the right value. + * For example: + * <font color="red">*</font>{label} + * will put a red star in front of the label if the element is required. + * + * @param string The required element template + * @access public + * @return void + */ + function setRequiredTemplate($template) + { + $this->_required = $template; + } // end func setRequiredTemplate + + /** + * Sets the way elements with validation errors are rendered + * + * You can use {label} or {html} placeholders to let the renderer know where + * where the element label or the element html are positionned according to the + * error message. They will be replaced accordingly with the right value. + * The error message will replace the {error} place holder. + * For example: + * <font color="red">{error}</font><br />{html} + * will put the error message in red on top of the element html. + * + * If you want all error messages to be output in the main error block, do not specify + * {html} nor {label}. + * + * Groups can have special layouts. With this kind of groups, the renderer will need + * to know where to place the error message. In this case, use error blocks like: + * <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error --> + * where you want the error message to appear in the form. + * + * @param string The element error template + * @access public + * @return void + */ + function setErrorTemplate($template) + { + $this->_error = $template; + } // end func setErrorTemplate + + /** + * Called when an element is required + * + * This method will add the required tag to the element label and/or the element html + * such as defined with the method setRequiredTemplate + * + * @param string The element label + * @param string The element html rendering + * @see setRequiredTemplate() + * @access private + * @return void + */ + function _renderRequired(&$label, &$html) + { + if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_required_block')) { + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { + $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); + if (is_array($label)) { + $label[0] = $this->_getTplBlock($tplBlock); + } else { + $label = $this->_getTplBlock($tplBlock); + } + } + if (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { + $this->_tpl->setVariable($this->_formName . '_html', $html); + $html = $this->_getTplBlock($tplBlock); + } + } else { + if (!empty($label) && strpos($this->_required, '{label}') !== false) { + if (is_array($label)) { + $label[0] = str_replace('{label}', $label[0], $this->_required); + } else { + $label = str_replace('{label}', $label, $this->_required); + } + } + if (!empty($html) && strpos($this->_required, '{html}') !== false) { + $html = str_replace('{html}', $html, $this->_required); + } + } + } // end func _renderRequired + + /** + * Called when an element has a validation error + * + * This method will add the error message to the element label or the element html + * such as defined with the method setErrorTemplate. If the error placeholder is not found + * in the template, the error will be displayed in the form error block. + * + * @param string The element label + * @param string The element html rendering + * @param string The element error + * @see setErrorTemplate() + * @access private + * @return void + */ + function _renderError(&$label, &$html, $error) + { + if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_error_block')) { + $this->_tpl->setVariable($this->_formName . '_error', $error); + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { + $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); + if (is_array($label)) { + $label[0] = $this->_getTplBlock($tplBlock); + } else { + $label = $this->_getTplBlock($tplBlock); + } + } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { + $this->_tpl->setVariable($this->_formName . '_html', $html); + $html = $this->_getTplBlock($tplBlock); + } + // clean up after ourselves + $this->_tpl->setVariable($this->_formName . '_error', null); + } elseif (!empty($label) && strpos($this->_error, '{label}') !== false) { + if (is_array($label)) { + $label[0] = str_replace(array('{label}', '{error}'), array($label[0], $error), $this->_error); + } else { + $label = str_replace(array('{label}', '{error}'), array($label, $error), $this->_error); + } + } elseif (!empty($html) && strpos($this->_error, '{html}') !== false) { + $html = str_replace(array('{html}', '{error}'), array($html, $error), $this->_error); + } else { + $this->_errors[] = $error; + } + }// end func _renderError + + + /** + * Returns the block's contents + * + * The method is needed because ITX and Sigma implement clearing + * the block contents on get() a bit differently + * + * @param string Block name + * @return string Block contents + */ + function _getTplBlock($block) + { + $this->_tpl->parse($block); + if (is_a($this->_tpl, 'html_template_sigma')) { + $ret = $this->_tpl->get($block, true); + } else { + $oldClear = $this->_tpl->clearCache; + $this->_tpl->clearCache = true; + $ret = $this->_tpl->get($block); + $this->_tpl->clearCache = $oldClear; + } + return $ret; + } +} // end class HTML_QuickForm_Renderer_ITStatic +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Renderer/Object.php b/libs/HTML/QuickForm/Renderer/Object.php new file mode 100644 index 0000000000..eb84fd78e6 --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/Object.php @@ -0,0 +1,461 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A concrete renderer for HTML_QuickForm, makes an object from form contents + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * An abstract base class for QuickForm renderers + */ +require_once 'HTML/QuickForm/Renderer.php'; + +/** + * A concrete renderer for HTML_QuickForm, makes an object from form contents + * + * Based on HTML_Quickform_Renderer_Array code + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @version Release: 3.2.11 + * @since 3.1.1 + */ +class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer +{ + /**#@+ + * @access private + */ + /** + * The object being generated + * @var QuickformForm + */ + var $_obj= null; + + /** + * Number of sections in the form (i.e. number of headers in it) + * @var integer $_sectionCount + */ + var $_sectionCount; + + /** + * Current section number + * @var integer $_currentSection + */ + var $_currentSection; + + /** + * Object representing current group + * @var object $_currentGroup + */ + var $_currentGroup = null; + + /** + * Class of Element Objects + * @var object $_elementType + */ + var $_elementType = 'QuickFormElement'; + + /** + * Additional style information for different elements + * @var array $_elementStyles + */ + var $_elementStyles = array(); + + /** + * true: collect all hidden elements into string; false: process them as usual form elements + * @var bool $_collectHidden + */ + var $_collectHidden = false; + /**#@-*/ + + + /** + * Constructor + * + * @param bool true: collect all hidden elements + * @access public + */ + function HTML_QuickForm_Renderer_Object($collecthidden = false) + { + $this->HTML_QuickForm_Renderer(); + $this->_collectHidden = $collecthidden; + $this->_obj = new QuickformForm; + } + + /** + * Return the rendered Object + * @access public + */ + function toObject() + { + return $this->_obj; + } + + /** + * Set the class of the form elements. Defaults to QuickformElement. + * @param string Name of element class + * @access public + */ + function setElementType($type) + { + $this->_elementType = $type; + } + + function startForm(&$form) + { + $this->_obj->frozen = $form->isFrozen(); + $this->_obj->javascript = $form->getValidationScript(); + $this->_obj->attributes = $form->getAttributes(true); + $this->_obj->requirednote = $form->getRequiredNote(); + $this->_obj->errors = new StdClass; + + if($this->_collectHidden) { + $this->_obj->hidden = ''; + } + $this->_elementIdx = 1; + $this->_currentSection = null; + $this->_sectionCount = 0; + } // end func startForm + + function renderHeader(&$header) + { + $hobj = new StdClass; + $hobj->header = $header->toHtml(); + $this->_obj->sections[$this->_sectionCount] = $hobj; + $this->_currentSection = $this->_sectionCount++; + } + + function renderElement(&$element, $required, $error) + { + $elObj = $this->_elementToObject($element, $required, $error); + if(!empty($error)) { + $name = $elObj->name; + $this->_obj->errors->$name = $error; + } + $this->_storeObject($elObj); + } // end func renderElement + + function renderHidden(&$element) + { + if($this->_collectHidden) { + $this->_obj->hidden .= $element->toHtml() . "\n"; + } else { + $this->renderElement($element, false, null); + } + } //end func renderHidden + + function startGroup(&$group, $required, $error) + { + $this->_currentGroup = $this->_elementToObject($group, $required, $error); + if(!empty($error)) { + $name = $this->_currentGroup->name; + $this->_obj->errors->$name = $error; + } + } // end func startGroup + + function finishGroup(&$group) + { + $this->_storeObject($this->_currentGroup); + $this->_currentGroup = null; + } // end func finishGroup + + /** + * Creates an object representing an element + * + * @access private + * @param HTML_QuickForm_element form element being rendered + * @param required bool Whether an element is required + * @param error string Error associated with the element + * @return object + */ + function _elementToObject(&$element, $required, $error) + { + if($this->_elementType) { + $ret = new $this->_elementType; + } + $ret->name = $element->getName(); + $ret->value = $element->getValue(); + $ret->type = $element->getType(); + $ret->frozen = $element->isFrozen(); + $labels = $element->getLabel(); + if (is_array($labels)) { + $ret->label = array_shift($labels); + foreach ($labels as $key => $label) { + $key = is_int($key)? $key + 2: $key; + $ret->{'label_' . $key} = $label; + } + } else { + $ret->label = $labels; + } + $ret->required = $required; + $ret->error = $error; + + if(isset($this->_elementStyles[$ret->name])) { + $ret->style = $this->_elementStyles[$ret->name]; + $ret->styleTemplate = "styles/". $ret->style .".html"; + } + if($ret->type == 'group') { + $ret->separator = $element->_separator; + $ret->elements = array(); + } else { + $ret->html = $element->toHtml(); + } + return $ret; + } + + /** + * Stores an object representation of an element in the form array + * + * @access private + * @param QuickformElement Object representation of an element + * @return void + */ + function _storeObject($elObj) + { + $name = $elObj->name; + if(is_object($this->_currentGroup) && $elObj->type != 'group') { + $this->_currentGroup->elements[] = $elObj; + } elseif (isset($this->_currentSection)) { + $this->_obj->sections[$this->_currentSection]->elements[] = $elObj; + } else { + $this->_obj->elements[] = $elObj; + } + } + + function setElementStyle($elementName, $styleName = null) + { + if(is_array($elementName)) { + $this->_elementStyles = array_merge($this->_elementStyles, $elementName); + } else { + $this->_elementStyles[$elementName] = $styleName; + } + } + +} // end class HTML_QuickForm_Renderer_Object + + + +/** + * Convenience class for the form object passed to outputObject() + * + * Eg. + * <pre> + * {form.outputJavaScript():h} + * {form.outputHeader():h} + * <table> + * <tr> + * <td>{form.name.label:h}</td><td>{form.name.html:h}</td> + * </tr> + * </table> + * </form> + * </pre> + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @version Release: 3.2.11 + * @since 3.1.1 + */ +class QuickformForm +{ + /** + * Whether the form has been frozen + * @var boolean $frozen + */ + var $frozen; + + /** + * Javascript for client-side validation + * @var string $javascript + */ + var $javascript; + + /** + * Attributes for form tag + * @var string $attributes + */ + var $attributes; + + /** + * Note about required elements + * @var string $requirednote + */ + var $requirednote; + + /** + * Collected html of all hidden variables + * @var string $hidden + */ + var $hidden; + + /** + * Set if there were validation errors. + * StdClass object with element names for keys and their + * error messages as values + * @var object $errors + */ + var $errors; + + /** + * Array of QuickformElementObject elements. If there are headers in the form + * this will be empty and the elements will be in the + * separate sections + * @var array $elements + */ + var $elements; + + /** + * Array of sections contained in the document + * @var array $sections + */ + var $sections; + + /** + * Output <form> header + * {form.outputHeader():h} + * @return string <form attributes> + */ + function outputHeader() + { + return "<form " . $this->attributes . ">\n"; + } + + /** + * Output form javascript + * {form.outputJavaScript():h} + * @return string Javascript + */ + function outputJavaScript() + { + return $this->javascript; + } +} // end class QuickformForm + + +/** + * Convenience class describing a form element. + * + * The properties defined here will be available from + * your flexy templates by referencing + * {form.zip.label:h}, {form.zip.html:h}, etc. + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @version Release: 3.2.11 + * @since 3.1.1 + */ +class QuickformElement +{ + /** + * Element name + * @var string $name + */ + var $name; + + /** + * Element value + * @var mixed $value + */ + var $value; + + /** + * Type of element + * @var string $type + */ + var $type; + + /** + * Whether the element is frozen + * @var boolean $frozen + */ + var $frozen; + + /** + * Label for the element + * @var string $label + */ + var $label; + + /** + * Whether element is required + * @var boolean $required + */ + var $required; + + /** + * Error associated with the element + * @var string $error + */ + var $error; + + /** + * Some information about element style + * @var string $style + */ + var $style; + + /** + * HTML for the element + * @var string $html + */ + var $html; + + /** + * If element is a group, the group separator + * @var mixed $separator + */ + var $separator; + + /** + * If element is a group, an array of subelements + * @var array $elements + */ + var $elements; + + function isType($type) + { + return ($this->type == $type); + } + + function notFrozen() + { + return !$this->frozen; + } + + function isButton() + { + return ($this->type == "submit" || $this->type == "reset"); + } + + + /** + * XXX: why does it use Flexy when all other stuff here does not depend on it? + */ + function outputStyle() + { + ob_start(); + HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this); + $ret = ob_get_contents(); + ob_end_clean(); + return $ret; + } +} // end class QuickformElement +?> diff --git a/libs/HTML/QuickForm/Renderer/ObjectFlexy.php b/libs/HTML/QuickForm/Renderer/ObjectFlexy.php new file mode 100644 index 0000000000..6a232ca04e --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/ObjectFlexy.php @@ -0,0 +1,291 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * QuickForm renderer for Flexy template engine, static version. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * A concrete renderer for HTML_QuickForm, makes an object from form contents + */ +require_once 'HTML/QuickForm/Renderer/Object.php'; + +/** + * QuickForm renderer for Flexy template engine, static version. + * + * A static renderer for HTML_Quickform. Makes a QuickFormFlexyObject + * from the form content suitable for use with a Flexy template + * + * Usage: + * <code> + * $form =& new HTML_QuickForm('form', 'POST'); + * $template =& new HTML_Template_Flexy(); + * $renderer =& new HTML_QuickForm_Renderer_ObjectFlexy(&$template); + * $renderer->setHtmlTemplate("html.html"); + * $renderer->setLabelTemplate("label.html"); + * $form->accept($renderer); + * $view = new StdClass; + * $view->form = $renderer->toObject(); + * $template->compile("mytemplate.html"); + * </code> + * + * Based on the code for HTML_QuickForm_Renderer_ArraySmarty + * + * @category HTML + * @package HTML_QuickForm + * @author Ron McClain <ron@humaniq.com> + * @version Release: 3.2.11 + * @since 3.1.1 + */ +class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object +{ + /**#@+ + * @access private + */ + /** + * HTML_Template_Flexy instance + * @var object $_flexy + */ + var $_flexy; + + /** + * Current element index + * @var integer $_elementIdx + */ + var $_elementIdx; + + /** + * The current element index inside a group + * @var integer $_groupElementIdx + */ + var $_groupElementIdx = 0; + + /** + * Name of template file for form html + * @var string $_html + * @see setRequiredTemplate() + */ + var $_html = ''; + + /** + * Name of template file for form labels + * @var string $label + * @see setErrorTemplate() + */ + var $label = ''; + + /** + * Class of the element objects, so you can add your own + * element methods + * @var string $_elementType + */ + var $_elementType = 'QuickformFlexyElement'; + /**#@-*/ + + /** + * Constructor + * + * @param HTML_Template_Flexy template object to use + * @public + */ + function HTML_QuickForm_Renderer_ObjectFlexy(&$flexy) + { + $this->HTML_QuickForm_Renderer_Object(true); + $this->_obj = new QuickformFlexyForm(); + $this->_flexy =& $flexy; + } // end constructor + + function renderHeader(&$header) + { + if($name = $header->getName()) { + $this->_obj->header->$name = $header->toHtml(); + } else { + $this->_obj->header[$this->_sectionCount] = $header->toHtml(); + } + $this->_currentSection = $this->_sectionCount++; + } // end func renderHeader + + function startGroup(&$group, $required, $error) + { + parent::startGroup($group, $required, $error); + $this->_groupElementIdx = 1; + } //end func startGroup + + /** + * Creates an object representing an element containing + * the key for storing this + * + * @access private + * @param HTML_QuickForm_element form element being rendered + * @param bool Whether an element is required + * @param string Error associated with the element + * @return object + */ + function _elementToObject(&$element, $required, $error) + { + $ret = parent::_elementToObject($element, $required, $error); + if($ret->type == 'group') { + $ret->html = $element->toHtml(); + unset($ret->elements); + } + if(!empty($this->_label)) { + $this->_renderLabel($ret); + } + + if(!empty($this->_html)) { + $this->_renderHtml($ret); + $ret->error = $error; + } + + // Create an element key from the name + if (false !== ($pos = strpos($ret->name, '[')) || is_object($this->_currentGroup)) { + if (!$pos) { + $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; + } else { + $keys = '->{\'' . str_replace( + array('\\', '\'', '[', ']'), array('\\\\', '\\\'', '\'}->{\'', ''), + $ret->name + ) . '\'}'; + } + // special handling for elements in native groups + if (is_object($this->_currentGroup)) { + // skip unnamed group items unless radios: no name -> no static access + // identification: have the same key string as the parent group + if ($this->_currentGroup->keys == $keys && 'radio' != $ret->type) { + return false; + } + // reduce string of keys by remove leading group keys + if (0 === strpos($keys, $this->_currentGroup->keys)) { + $keys = substr_replace($keys, '', 0, strlen($this->_currentGroup->keys)); + } + } + } elseif (0 == strlen($ret->name)) { + $keys = '->{\'element_' . $this->_elementIdx . '\'}'; + } else { + $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; + } + // for radios: add extra key from value + if ('radio' == $ret->type && '[]' != substr($keys, -2)) { + $keys .= '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value) . '\'}'; + } + $ret->keys = $keys; + $this->_elementIdx++; + return $ret; + } + + /** + * Stores an object representation of an element in the + * QuickformFormObject instance + * + * @access private + * @param QuickformElement Object representation of an element + * @return void + */ + function _storeObject($elObj) + { + if ($elObj) { + $keys = $elObj->keys; + unset($elObj->keys); + if(is_object($this->_currentGroup) && ('group' != $elObj->type)) { + $code = '$this->_currentGroup' . $keys . ' = $elObj;'; + } else { + $code = '$this->_obj' . $keys . ' = $elObj;'; + } + eval($code); + } + } + + /** + * Set the filename of the template to render html elements. + * In your template, {html} is replaced by the unmodified html. + * If the element is required, {required} will be true. + * Eg. + * <pre> + * {if:error} + * <font color="red" size="1">{error:h}</font><br /> + * {end:} + * {html:h} + * </pre> + * + * @access public + * @param string Filename of template + * @return void + */ + function setHtmlTemplate($template) + { + $this->_html = $template; + } + + /** + * Set the filename of the template to render form labels + * In your template, {label} is replaced by the unmodified label. + * {error} will be set to the error, if any. {required} will + * be true if this is a required field + * Eg. + * <pre> + * {if:required} + * <font color="orange" size="1">*</font> + * {end:} + * {label:h} + * </pre> + * + * @access public + * @param string Filename of template + * @return void + */ + function setLabelTemplate($template) + { + $this->_label = $template; + } + + function _renderLabel(&$ret) + { + $this->_flexy->compile($this->_label); + $ret->label = $this->_flexy->bufferedOutputObject($ret); + } + + function _renderHtml(&$ret) + { + $this->_flexy->compile($this->_html); + $ret->html = $this->_flexy->bufferedOutputObject($ret); + } +} // end class HTML_QuickForm_Renderer_ObjectFlexy + +/** + * Adds nothing to QuickformForm, left for backwards compatibility + * + * @category HTML + * @package HTML_QuickForm + * @ignore + */ +class QuickformFlexyForm extends QuickformForm +{ +} + +/** + * Adds nothing to QuickformElement, left for backwards compatibility + * + * @category HTML + * @package HTML_QuickForm + * @ignore + */ +class QuickformFlexyElement extends QuickformElement +{ +} +?> diff --git a/libs/HTML/QuickForm/Renderer/QuickHtml.php b/libs/HTML/QuickForm/Renderer/QuickHtml.php new file mode 100644 index 0000000000..ca067daa70 --- /dev/null +++ b/libs/HTML/QuickForm/Renderer/QuickHtml.php @@ -0,0 +1,213 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A renderer that makes it quick and easy to create customized forms. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Jason Rust <jrust@rustyparts.com> + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id$ + * @link http://pear.php.net/package/HTML_QuickForm + */ + +/** + * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one + */ +require_once 'HTML/QuickForm/Renderer/Default.php'; + +/** + * A renderer that makes it quick and easy to create customized forms. + * + * This renderer has three main distinctives: an easy way to create + * custom-looking forms, the ability to separate the creation of form + * elements from their display, and being able to use QuickForm in + * widget-based template systems. See the online docs for more info. + * For a usage example see: docs/renderers/QuickHtml_example.php + * + * @category HTML + * @package HTML_QuickForm + * @author Jason Rust <jrust@rustyparts.com> + * @version Release: 3.2.11 + * @since 3.1.1 + */ +class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default { + // {{{ properties + + /** + * The array of rendered elements + * @var array + */ + var $renderedElements = array(); + + // }}} + // {{{ constructor + + /** + * Constructor + * + * @access public + * @return void + */ + function HTML_QuickForm_Renderer_QuickHtml() + { + $this->HTML_QuickForm_Renderer_Default(); + // The default templates aren't used for this renderer + $this->clearAllTemplates(); + } // end constructor + + // }}} + // {{{ toHtml() + + /** + * returns the HTML generated for the form + * + * @param string $data (optional) Any extra data to put before the end of the form + * + * @access public + * @return string + */ + function toHtml($data = '') + { + // Render any elements that haven't been rendered explicitly by elementToHtml() + foreach (array_keys($this->renderedElements) as $key) { + if (!$this->renderedElements[$key]['rendered']) { + $this->renderedElements[$key]['rendered'] = true; + $data .= $this->renderedElements[$key]['html'] . "\n"; + } + } + + // Insert the extra data and form elements at the end of the form + $this->_html = str_replace('</form>', $data . "\n</form>", $this->_html); + return $this->_html; + } // end func toHtml + + // }}} + // {{{ elementToHtml() + + /** + * Gets the html for an element and marks it as rendered. + * + * @param string $elementName The element name + * @param string $elementValue (optional) The value of the element. This is only useful + * for elements that have the same name (i.e. radio and checkbox), but + * different values + * + * @access public + * @return string The html for the QuickForm element + * @throws HTML_QuickForm_Error + */ + function elementToHtml($elementName, $elementValue = null) + { + $elementKey = null; + // Find the key for the element + foreach ($this->renderedElements as $key => $data) { + if ($data['name'] == $elementName && + // See if the value must match as well + (is_null($elementValue) || + $data['value'] == $elementValue)) { + $elementKey = $key; + break; + } + } + + if (is_null($elementKey)) { + $msg = is_null($elementValue) ? "Element $elementName does not exist." : + "Element $elementName with value of $elementValue does not exist."; + return PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); + } else { + if ($this->renderedElements[$elementKey]['rendered']) { + $msg = is_null($elementValue) ? "Element $elementName has already been rendered." : + "Element $elementName with value of $elementValue has already been rendered."; + return PEAR::raiseError(null, QUICKFORM_ERROR, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); + } else { + $this->renderedElements[$elementKey]['rendered'] = true; + return $this->renderedElements[$elementKey]['html']; + } + } + } // end func elementToHtml + + // }}} + // {{{ renderElement() + + /** + * Gets the html for an element and adds it to the array by calling + * parent::renderElement() + * + * @param HTML_QuickForm_element form element being visited + * @param bool Whether an element is required + * @param string An error message associated with an element + * + * @access public + * @return mixed HTML string of element if $immediateRender is set, else we just add the + * html to the global _html string + */ + function renderElement(&$element, $required, $error) + { + $this->_html = ''; + parent::renderElement($element, $required, $error); + if (!$this->_inGroup) { + $this->renderedElements[] = array( + 'name' => $element->getName(), + 'value' => $element->getValue(), + 'html' => $this->_html, + 'rendered' => false); + } + $this->_html = ''; + } // end func renderElement + + // }}} + // {{{ renderHidden() + + /** + * Gets the html for a hidden element and adds it to the array. + * + * @param HTML_QuickForm_element hidden form element being visited + * @access public + * @return void + */ + function renderHidden(&$element) + { + $this->renderedElements[] = array( + 'name' => $element->getName(), + 'value' => $element->getValue(), + 'html' => $element->toHtml(), + 'rendered' => false); + } // end func renderHidden + + // }}} + // {{{ finishGroup() + + /** + * Gets the html for the group element and adds it to the array by calling + * parent::finishGroup() + * + * @param HTML_QuickForm_group group being visited + * @access public + * @return void + */ + function finishGroup(&$group) + { + $this->_html = ''; + parent::finishGroup($group); + $this->renderedElements[] = array( + 'name' => $group->getName(), + 'value' => $group->getValue(), + 'html' => $this->_html, + 'rendered' => false); + $this->_html = ''; + } // end func finishGroup + + // }}} +} // end class HTML_QuickForm_Renderer_QuickHtml +?> diff --git a/libs/HTML/QuickForm/Rule.php b/libs/HTML/QuickForm/Rule.php index 18442b2ded..914d91e3ff 100644 --- a/libs/HTML/QuickForm/Rule.php +++ b/libs/HTML/QuickForm/Rule.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -27,7 +27,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 * @abstract */ @@ -79,4 +79,4 @@ class HTML_QuickForm_Rule return array('', ''); } } -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Rule/Callback.php b/libs/HTML/QuickForm/Rule/Callback.php index 4589da9012..d6e9eab35e 100644 --- a/libs/HTML/QuickForm/Rule/Callback.php +++ b/libs/HTML/QuickForm/Rule/Callback.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule @@ -121,4 +121,4 @@ class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule } // end func getValidationScript } // end class HTML_QuickForm_Rule_Callback -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Rule/Compare.php b/libs/HTML/QuickForm/Rule/Compare.php index 7b8ed4a283..df4f86b795 100644 --- a/libs/HTML/QuickForm/Rule/Compare.php +++ b/libs/HTML/QuickForm/Rule/Compare.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -35,7 +35,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule diff --git a/libs/HTML/QuickForm/Rule/Email.php b/libs/HTML/QuickForm/Rule/Email.php index 97e0ca18ac..6f79653378 100644 --- a/libs/HTML/QuickForm/Rule/Email.php +++ b/libs/HTML/QuickForm/Rule/Email.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule @@ -70,4 +70,4 @@ class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule } // end func getValidationScript } // end class HTML_QuickForm_Rule_Email -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Rule/Range.php b/libs/HTML/QuickForm/Rule/Range.php index 40cce15c2c..97a8806dc6 100644 --- a/libs/HTML/QuickForm/Rule/Range.php +++ b/libs/HTML/QuickForm/Rule/Range.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule @@ -72,4 +72,4 @@ class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule } // end func getValidationScript } // end class HTML_QuickForm_Rule_Range -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Rule/Regex.php b/libs/HTML/QuickForm/Rule/Regex.php index 0607a44ae9..f496a3fb1c 100644 --- a/libs/HTML/QuickForm/Rule/Regex.php +++ b/libs/HTML/QuickForm/Rule/Regex.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule @@ -94,8 +94,14 @@ class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule { $regex = isset($this->_data[$this->name]) ? $this->_data[$this->name] : $options; + // bug #12376, converting unicode escapes and stripping 'u' modifier + if ($pos = strpos($regex, 'u', strrpos($regex, '/'))) { + $regex = substr($regex, 0, $pos) . substr($regex, $pos + 1); + $regex = preg_replace('/(?<!\\\\)(?>\\\\\\\\)*\\\\x{([a-fA-F0-9]+)}/', '\\u$1', $regex); + } + return array(" var regex = " . $regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})"); } // end func getValidationScript } // end class HTML_QuickForm_Rule_Regex -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/Rule/Required.php b/libs/HTML/QuickForm/Rule/Required.php index f8cc8f5924..28ccc604ac 100644 --- a/libs/HTML/QuickForm/Rule/Required.php +++ b/libs/HTML/QuickForm/Rule/Required.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/Rule.php'; * @category HTML * @package HTML_QuickForm * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_Rule_Required extends HTML_QuickForm_Rule diff --git a/libs/HTML/QuickForm/RuleRegistry.php b/libs/HTML/QuickForm/RuleRegistry.php index cb1a74eb18..98b5cbb6f0 100644 --- a/libs/HTML/QuickForm/RuleRegistry.php +++ b/libs/HTML/QuickForm/RuleRegistry.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -31,7 +31,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_RuleRegistry @@ -54,7 +54,7 @@ class HTML_QuickForm_RuleRegistry * @static * @return HTML_QuickForm_RuleRegistry */ - static function &singleton() + function &singleton() { static $obj; if (!isset($obj)) { diff --git a/libs/HTML/QuickForm/advcheckbox.php b/libs/HTML/QuickForm/advcheckbox.php index adda853f90..9951e79885 100644 --- a/libs/HTML/QuickForm/advcheckbox.php +++ b/libs/HTML/QuickForm/advcheckbox.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Jason Rust <jrust@php.net> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -46,7 +46,7 @@ require_once 'HTML/QuickForm/checkbox.php'; * @package HTML_QuickForm * @author Jason Rust <jrust@php.net> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 2.0 */ class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox diff --git a/libs/HTML/QuickForm/autocomplete.php b/libs/HTML/QuickForm/autocomplete.php index fa10b5e435..57d1e4311c 100644 --- a/libs/HTML/QuickForm/autocomplete.php +++ b/libs/HTML/QuickForm/autocomplete.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Matteo Di Giovinazzo <matteodg@infinito.it> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -47,7 +47,7 @@ require_once 'HTML/QuickForm/text.php'; * @category HTML * @package HTML_QuickForm * @author Matteo Di Giovinazzo <matteodg@infinito.it> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2 */ class HTML_QuickForm_autocomplete extends HTML_QuickForm_text diff --git a/libs/HTML/QuickForm/button.php b/libs/HTML/QuickForm/button.php index 15885503e2..cae1888c18 100644 --- a/libs/HTML/QuickForm/button.php +++ b/libs/HTML/QuickForm/button.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_button extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/checkbox.php b/libs/HTML/QuickForm/checkbox.php index 123a7679cd..4cf1de238f 100644 --- a/libs/HTML/QuickForm/checkbox.php +++ b/libs/HTML/QuickForm/checkbox.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -36,7 +36,7 @@ require_once 'HTML/QuickForm/input.php'; * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_checkbox extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/date.php b/libs/HTML/QuickForm/date.php index 15781ac59b..5fe3320aba 100644 --- a/libs/HTML/QuickForm/date.php +++ b/libs/HTML/QuickForm/date.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -39,7 +39,7 @@ require_once 'HTML/QuickForm/select.php'; * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.1 */ class HTML_QuickForm_date extends HTML_QuickForm_group @@ -435,11 +435,28 @@ class HTML_QuickForm_date extends HTML_QuickForm_group } // }}} + // {{{ _trimLeadingZeros() + + /** + * Trims leading zeros from the (numeric) string + * + * @param string A numeric string, possibly with leading zeros + * @return string String with leading zeros removed + */ + function _trimLeadingZeros($str) + { + if (0 == strcmp($str, $this->_options['emptyOptionValue'])) { + return $str; + } + $trimmed = ltrim($str, '0'); + return strlen($trimmed)? $trimmed: '0'; + } + + // }}} // {{{ setValue() function setValue($value) { - $trimLeadingZeros = create_function('$a', '$b = ltrim($a, \'0\'); return strlen($b)? $b: \'0\';'); if (empty($value)) { $value = array(); } elseif (is_scalar($value)) { @@ -460,14 +477,14 @@ class HTML_QuickForm_date extends HTML_QuickForm_group 'h' => $arr[4], 'g' => $arr[4], 'H' => $arr[5], - 'i' => $trimLeadingZeros($arr[6]), - 's' => $trimLeadingZeros($arr[7]), + 'i' => $this->_trimLeadingZeros($arr[6]), + 's' => $this->_trimLeadingZeros($arr[7]), 'a' => $arr[8], 'A' => $arr[9], - 'W' => $trimLeadingZeros($arr[10]) + 'W' => $this->_trimLeadingZeros($arr[10]) ); } else { - $value = array_map($trimLeadingZeros, $value); + $value = array_map(array($this, '_trimLeadingZeros'), $value); } parent::setValue($value); } diff --git a/libs/HTML/QuickForm/element.php b/libs/HTML/QuickForm/element.php index 1312a18e84..3a5e2b97a6 100644 --- a/libs/HTML/QuickForm/element.php +++ b/libs/HTML/QuickForm/element.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -36,7 +36,7 @@ require_once 'HTML/Common.php'; * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 * @abstract */ @@ -235,7 +235,7 @@ class HTML_QuickForm_element extends HTML_Common function getFrozenHtml() { $value = $this->getValue(); - return ('' != $value? htmlspecialchars($value): ' ') . + return (strlen($value)? htmlspecialchars($value): ' ') . $this->_getPersistantData(); } //end func getFrozenHtml @@ -491,4 +491,4 @@ class HTML_QuickForm_element extends HTML_Common // }}} } // end class HTML_QuickForm_element -?> +?>
\ No newline at end of file diff --git a/libs/HTML/QuickForm/file.php b/libs/HTML/QuickForm/file.php index f3cbdfa7a8..afdf585962 100644 --- a/libs/HTML/QuickForm/file.php +++ b/libs/HTML/QuickForm/file.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -44,7 +44,7 @@ if (class_exists('HTML_QuickForm')) { * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_file extends HTML_QuickForm_input @@ -307,7 +307,7 @@ class HTML_QuickForm_file extends HTML_QuickForm_input if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { return true; } - return preg_match($regex, $elementValue['name']); + return (bool)preg_match($regex, $elementValue['name']); } // end func _ruleCheckFileName // }}} diff --git a/libs/HTML/QuickForm/group.php b/libs/HTML/QuickForm/group.php index 0a7d661630..6a538ea8f5 100644 --- a/libs/HTML/QuickForm/group.php +++ b/libs/HTML/QuickForm/group.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -36,7 +36,7 @@ require_once 'HTML/QuickForm/element.php'; * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_group extends HTML_QuickForm_element diff --git a/libs/HTML/QuickForm/header.php b/libs/HTML/QuickForm/header.php index dbbbcc07ea..b1bd222003 100644 --- a/libs/HTML/QuickForm/header.php +++ b/libs/HTML/QuickForm/header.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/static.php'; * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.0 */ class HTML_QuickForm_header extends HTML_QuickForm_static diff --git a/libs/HTML/QuickForm/hidden.php b/libs/HTML/QuickForm/hidden.php index b3f5737f0c..e0bb7e1d1f 100644 --- a/libs/HTML/QuickForm/hidden.php +++ b/libs/HTML/QuickForm/hidden.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_hidden extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/hiddenselect.php b/libs/HTML/QuickForm/hiddenselect.php index 8f411ed9d4..0c16e96494 100644 --- a/libs/HTML/QuickForm/hiddenselect.php +++ b/libs/HTML/QuickForm/hiddenselect.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Isaac Shepard <ishepard@bsiweb.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -38,7 +38,7 @@ require_once 'HTML/QuickForm/select.php'; * @category HTML * @package HTML_QuickForm * @author Isaac Shepard <ishepard@bsiweb.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 2.1 */ class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select diff --git a/libs/HTML/QuickForm/hierselect.php b/libs/HTML/QuickForm/hierselect.php index 2e9d111006..fa92cc64a4 100644 --- a/libs/HTML/QuickForm/hierselect.php +++ b/libs/HTML/QuickForm/hierselect.php @@ -17,7 +17,7 @@ * @author Herim Vasquez <vasquezh@iro.umontreal.ca> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -45,7 +45,7 @@ require_once 'HTML/QuickForm/select.php'; * @author Herim Vasquez <vasquezh@iro.umontreal.ca> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.1 */ class HTML_QuickForm_hierselect extends HTML_QuickForm_group @@ -313,6 +313,9 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group $this->_js .= <<<JAVASCRIPT function _hs_findOptions(ary, keys) { + if (ary == undefined) { + return {}; + } var key = keys.shift(); if (!key in ary) { return {}; diff --git a/libs/HTML/QuickForm/html.php b/libs/HTML/QuickForm/html.php index 359c4bfbb5..7310f5f150 100644 --- a/libs/HTML/QuickForm/html.php +++ b/libs/HTML/QuickForm/html.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -35,7 +35,7 @@ require_once 'HTML/QuickForm/static.php'; * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.0 * @deprecated Please use the templates rather than add raw HTML via this element */ diff --git a/libs/HTML/QuickForm/image.php b/libs/HTML/QuickForm/image.php index 5ee9547fdb..52190ec446 100644 --- a/libs/HTML/QuickForm/image.php +++ b/libs/HTML/QuickForm/image.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_image extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/input.php b/libs/HTML/QuickForm/input.php index d4b7f1fdab..354f050f45 100644 --- a/libs/HTML/QuickForm/input.php +++ b/libs/HTML/QuickForm/input.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/element.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 * @abstract */ diff --git a/libs/HTML/QuickForm/link.php b/libs/HTML/QuickForm/link.php index db88be2229..d5d3d46c1f 100644 --- a/libs/HTML/QuickForm/link.php +++ b/libs/HTML/QuickForm/link.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/static.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 2.0 */ class HTML_QuickForm_link extends HTML_QuickForm_static diff --git a/libs/HTML/QuickForm/password.php b/libs/HTML/QuickForm/password.php index 1ce247926a..7c6b3902d3 100644 --- a/libs/HTML/QuickForm/password.php +++ b/libs/HTML/QuickForm/password.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_password extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/radio.php b/libs/HTML/QuickForm/radio.php index 969ba88c51..c9d340fcbb 100644 --- a/libs/HTML/QuickForm/radio.php +++ b/libs/HTML/QuickForm/radio.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_radio extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/reset.php b/libs/HTML/QuickForm/reset.php index 1f61b14afe..bf2cbef908 100644 --- a/libs/HTML/QuickForm/reset.php +++ b/libs/HTML/QuickForm/reset.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_reset extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/select.php b/libs/HTML/QuickForm/select.php index ac75a72006..1708fcadb6 100644 --- a/libs/HTML/QuickForm/select.php +++ b/libs/HTML/QuickForm/select.php @@ -17,7 +17,7 @@ * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -36,7 +36,7 @@ require_once 'HTML/QuickForm/element.php'; * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_select extends HTML_QuickForm_element { diff --git a/libs/HTML/QuickForm/static.php b/libs/HTML/QuickForm/static.php index 20f45b8e72..f5ce3cdca2 100644 --- a/libs/HTML/QuickForm/static.php +++ b/libs/HTML/QuickForm/static.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Wojciech Gdela <eltehaem@poczta.onet.pl> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/element.php'; * @category HTML * @package HTML_QuickForm * @author Wojciech Gdela <eltehaem@poczta.onet.pl> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 2.7 */ class HTML_QuickForm_static extends HTML_QuickForm_element { diff --git a/libs/HTML/QuickForm/submit.php b/libs/HTML/QuickForm/submit.php index caa692dd16..a9fa99d65b 100644 --- a/libs/HTML/QuickForm/submit.php +++ b/libs/HTML/QuickForm/submit.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_submit extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/text.php b/libs/HTML/QuickForm/text.php index 0696122b99..8d99735850 100644 --- a/libs/HTML/QuickForm/text.php +++ b/libs/HTML/QuickForm/text.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/input.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_text extends HTML_QuickForm_input diff --git a/libs/HTML/QuickForm/textarea.php b/libs/HTML/QuickForm/textarea.php index b499a9418a..a675e973bf 100644 --- a/libs/HTML/QuickForm/textarea.php +++ b/libs/HTML/QuickForm/textarea.php @@ -16,7 +16,7 @@ * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -34,7 +34,7 @@ require_once 'HTML/QuickForm/element.php'; * @package HTML_QuickForm * @author Adam Daniel <adaniel1@eesus.jnj.com> * @author Bertrand Mansion <bmansion@mamasam.com> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 1.0 */ class HTML_QuickForm_textarea extends HTML_QuickForm_element diff --git a/libs/HTML/QuickForm/xbutton.php b/libs/HTML/QuickForm/xbutton.php index b0769ad136..c795fa53bc 100644 --- a/libs/HTML/QuickForm/xbutton.php +++ b/libs/HTML/QuickForm/xbutton.php @@ -15,7 +15,7 @@ * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @copyright 2001-2007 The PHP Group + * @copyright 2001-2009 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id$ * @link http://pear.php.net/package/HTML_QuickForm @@ -32,7 +32,7 @@ require_once 'HTML/QuickForm/element.php'; * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> - * @version Release: 3.2.9 + * @version Release: 3.2.11 * @since 3.2.3 */ class HTML_QuickForm_xbutton extends HTML_QuickForm_element |