v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT HTML/Common2.php000064400000035134152101606000007330 0ustar00 * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_Common2 * @author Alexey Borzov * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version CVS: $Id: Common2.php 304516 2010-10-19 18:43:58Z avb $ * @link http://pear.php.net/package/HTML_Common2 */ /** * Base class for HTML classes * * Implements methods for working with HTML attributes, parsing and generating * attribute strings. Port of HTML_Common class for PHP4 originally written by * Adam Daniel with contributions from numerous other developers. * * @category HTML * @package HTML_Common2 * @author Alexey Borzov * @version Release: 2.0.0 */ abstract class HTML_Common2 { /** * Associative array of attributes * @var array */ protected $attributes = array(); /** * List of attribites changes to which will be announced via onAttributeChange() * method rather than performed by HTML_Common2 class itself * @var array * @see onAttributeChange() */ protected $watchedAttributes = array(); /** * Indentation level of the element * @var int */ private $_indentLevel = 0; /** * Comment associated with the element * @var string */ private $_comment = null; /** * Global options for all elements generated by subclasses of HTML_Common2 * * Preset options are * - 'charset': charset parameter used in htmlspecialchars() calls, * defaults to 'ISO-8859-1' * - 'indent': string used to indent HTML elements, defaults to "\11" * - 'linebreak': string used to indicate linebreak, defaults to "\12" * * @var array */ private static $_options = array( 'charset' => 'ISO-8859-1', 'indent' => "\11", 'linebreak' => "\12" ); /** * Sets global option(s) * * @param string|array Option name or array ('option name' => 'option value') * @param mixed Option value, if first argument is not an array */ public static function setOption($nameOrOptions, $value = null) { if (is_array($nameOrOptions)) { foreach ($nameOrOptions as $k => $v) { self::setOption($k, $v); } } else { $linebreaks = array('win' => "\15\12", 'unix' => "\12", 'mac' => "\15"); if ('linebreak' == $nameOrOptions && isset($linebreaks[$value])) { $value = $linebreaks[$value]; } self::$_options[$nameOrOptions] = $value; } } /** * Returns global option(s) * * @param string Option name * @return mixed Option value, null if option does not exist, * array of all options if $name is not given */ public static function getOption($name = null) { if (null === $name) { return self::$_options; } else { return isset(self::$_options[$name])? self::$_options[$name]: null; } } /** * Parses the HTML attributes given as string * * @param string HTML attribute string * @return array An associative aray of attributes */ protected static function parseAttributes($attrString) { $attributes = array(); if (preg_match_all( "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/", $attrString, $regs )) { for ($i = 0; $i < count($regs[1]); $i++) { $name = trim($regs[1][$i]); $check = trim($regs[0][$i]); $value = trim($regs[7][$i]); if ($name == $check) { $attributes[strtolower($name)] = strtolower($name); } else { if (!empty($value) && ($value[0] == '\'' || $value[0] == '"')) { $value = substr($value, 1, -1); } $attributes[strtolower($name)] = $value; } } } return $attributes; } /** * Creates a valid attribute array from either a string or an array * * @param mixed Array of attributes or HTML attribute string * @return array An associative aray of attributes */ protected static function prepareAttributes($attributes) { $prepared = array(); if (is_string($attributes)) { return self::parseAttributes($attributes); } elseif (is_array($attributes)) { foreach ($attributes as $key => $value) { if (is_int($key)) { $key = strtolower($value); $prepared[$key] = $key; } else { $prepared[strtolower($key)] = (string)$value; } } } return $prepared; } /** * Removes an attribute from an attribute array * * @param array Attribute array * @param string Name of attribute to remove */ protected static function removeAttributeArray(array &$attributes, $name) { unset($attributes[strtolower($name)]); } /** * Creates HTML attribute string from array * * @param array Attribute array * @return string Attribute string */ protected static function getAttributesString(array $attributes) { $str = ''; $charset = self::getOption('charset'); foreach ($attributes as $key => $value) { $str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES, $charset) . '"'; } return $str; } /** * Class constructor, sets default attributes * * @param mixed Array of attribute 'name' => 'value' pairs or HTML attribute string */ public function __construct($attributes = null) { $this->mergeAttributes($attributes); } /** * Sets the value of the attribute * * @param string Attribute name * @param string Attribute value (will be set to $name if omitted) * @return HTML_Common2 */ public function setAttribute($name, $value = null) { $name = strtolower($name); if (is_null($value)) { $value = $name; } if (in_array($name, $this->watchedAttributes)) { $this->onAttributeChange($name, $value); } else { $this->attributes[$name] = (string)$value; } return $this; } /** * Returns the value of an attribute * * @param string Attribute name * @return string Attribute value, null if attribute does not exist */ public function getAttribute($name) { $name = strtolower($name); return isset($this->attributes[$name])? $this->attributes[$name]: null; } /** * Sets the attributes * * @param mixed Array of attribute 'name' => 'value' pairs or HTML attribute string * @return HTML_Common2 */ public function setAttributes($attributes) { $attributes = self::prepareAttributes($attributes); $watched = array(); foreach ($this->watchedAttributes as $watchedKey) { if (isset($attributes[$watchedKey])) { $this->setAttribute($watchedKey, $attributes[$watchedKey]); unset($attributes[$watchedKey]); } else { $this->removeAttribute($watchedKey); } if (isset($this->attributes[$watchedKey])) { $watched[$watchedKey] = $this->attributes[$watchedKey]; } } $this->attributes = array_merge($watched, $attributes); return $this; } /** * Returns the attribute array or string * * @param bool Whether to return attributes as string * @return mixed Either an array or string of attributes */ public function getAttributes($asString = false) { if ($asString) { return self::getAttributesString($this->attributes); } else { return $this->attributes; } } /** * Merges the existing attributes with the new ones * * @param mixed Array of attribute 'name' => 'value' pairs or HTML attribute string * @return HTML_Common2 */ public function mergeAttributes($attributes) { $attributes = self::prepareAttributes($attributes); foreach ($this->watchedAttributes as $watchedKey) { if (isset($attributes[$watchedKey])) { $this->onAttributeChange($watchedKey, $attributes[$watchedKey]); unset($attributes[$watchedKey]); } } $this->attributes = array_merge($this->attributes, $attributes); return $this; } /** * Removes an attribute * * @param string Name of attribute to remove * @return HTML_Common2 */ public function removeAttribute($attribute) { if (in_array(strtolower($attribute), $this->watchedAttributes)) { $this->onAttributeChange(strtolower($attribute), null); } else { self::removeAttributeArray($this->attributes, $attribute); } return $this; } /** * Sets the indentation level * * @param int * @return HTML_Common2 */ public function setIndentLevel($level) { $level = intval($level); if (0 <= $level) { $this->_indentLevel = $level; } return $this; } /** * Gets the indentation level * * @return int */ public function getIndentLevel() { return $this->_indentLevel; } /** * Returns the string to indent the element * * @return string */ protected function getIndent() { return str_repeat(self::getOption('indent'), $this->getIndentLevel()); } /** * Sets the comment for the element * * @param string * @return HTML_Common2 */ public function setComment($comment) { $this->_comment = $comment; return $this; } /** * Returns the comment associated with the element * * @return string */ public function getComment() { return $this->_comment; } /** * Checks whether the element has given CSS class * * @param string Class name * @return bool */ public function hasClass($class) { $regex = '/(^|\s)' . preg_quote($class, '/') . '(\s|$)/'; return (bool)preg_match($regex, $this->getAttribute('class')); } /** * Adds the given CSS class(es) to the element * * @param string|array Class name, multiple class names separated by * whitespace, array of class names * @return HTML_Common2 */ public function addClass($class) { if (!is_array($class)) { $class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY); } $curClass = preg_split('/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY); foreach ($class as $c) { if (!in_array($c, $curClass)) { $curClass[] = $c; } } $this->setAttribute('class', implode(' ', $curClass)); return $this; } /** * Removes the given CSS class(es) from the element * * @param string|array Class name, multiple class names separated by * whitespace, array of class names * @return HTML_Common2 */ public function removeClass($class) { if (!is_array($class)) { $class = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY); } $curClass = array_diff( preg_split('/\s+/', $this->getAttribute('class'), null, PREG_SPLIT_NO_EMPTY), $class ); if (0 == count($curClass)) { $this->removeAttribute('class'); } else { $this->setAttribute('class', implode(' ', $curClass)); } return $this; } /** * Returns the HTML representation of the element * * This magic method allows using the instances of HTML_Common2 in string * contexts * * @return string */ abstract public function __toString(); /** * Called if trying to change an attribute with name in $watchedAttributes * * This method is called for each attribute whose name is in the * $watchedAttributes array and which is being changed by setAttribute(), * setAttributes() or mergeAttributes() or removed via removeAttribute(). * Note that the operation for the attribute is not carried on after calling * this method, it is the responsibility of this method to change or remove * (or not) the attribute. * * @param string Attribute name * @param string Attribute value, null if attribute is being removed */ protected function onAttributeChange($name, $value = null) { } } ?> HTML/QuickForm2/DataSource/Array.php000064400000006747152101606000013120 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Array.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Interface for data sources used by HTML_QuickForm2 objects */ require_once 'HTML/QuickForm2/DataSource.php'; /** * Array-based data source for HTML_QuickForm2 objects * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_DataSource_Array implements HTML_QuickForm2_DataSource { /** * Array containing elements' values * @var array */ protected $values; /** * Class constructor, initializes the values array * * @param array Array containing the elements' values */ public function __construct($values = array()) { $this->values = $values; } public function getValue($name) { if (empty($this->values)) { return null; } if (strpos($name, '[')) { $tokens = explode('[', str_replace(']', '', $name)); $value = $this->values; do { $token = array_shift($tokens); if (!is_array($value) || !isset($value[$token])) { return null; } $value = $value[$token]; } while (!empty($tokens)); return $value; } elseif (isset($this->values[$name])) { return $this->values[$name]; } else { return null; } } } ?> HTML/QuickForm2/DataSource/Session.php000064400000006145152101606000013455 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Session.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** Interface for data sources containing submitted values */ require_once 'HTML/QuickForm2/DataSource/Submit.php'; /** Array-based data source for HTML_QuickForm2 objects */ require_once 'HTML/QuickForm2/DataSource/Array.php'; /** * Class presenting the values stored in session by Controller as submitted ones * * This is a less hackish implementation of loadValues() method in old * HTML_QuickForm_Controller. The values need to be presented as submitted so * that elements like checkboxes and multiselects do not try to use default * values from subsequent datasources. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_DataSource_Session extends HTML_QuickForm2_DataSource_Array implements HTML_QuickForm2_DataSource_Submit { /** * File upload data is not stored in the session */ public function getUpload($name) { return null; } } ?> HTML/QuickForm2/DataSource/Submit.php000064400000005774152101606000013304 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Submit.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Interface for data sources used by HTML_QuickForm2 objects */ require_once 'HTML/QuickForm2/DataSource.php'; /** * Interface for data sources containing submitted values * * This interface provides method for getting information on uploaded files. * Additionally some elements will only consider getting their values from data * sources implementing this interface. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ interface HTML_QuickForm2_DataSource_Submit extends HTML_QuickForm2_DataSource { /** * Returns the information about uploaded file * * If data source doesn't such information it should return null * * @param string Name of file upload field * @return array|null Information on uploaded file, from $_FILES array */ public function getUpload($name); } ?> HTML/QuickForm2/DataSource/SuperGlobal.php000064400000013701152101606000014245 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: SuperGlobal.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Interface for data sources containing submitted values */ require_once 'HTML/QuickForm2/DataSource/Submit.php'; /** * Array-based data source for HTML_QuickForm2 objects */ require_once 'HTML/QuickForm2/DataSource/Array.php'; /** * Data source for HTML_QuickForm2 objects based on superglobal arrays * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_DataSource_SuperGlobal extends HTML_QuickForm2_DataSource_Array implements HTML_QuickForm2_DataSource_Submit { /** * Information on file uploads (from $_FILES) * @var array */ protected $files = array(); /** * Keys present in the $_FILES array * @var array */ private static $_fileKeys = array('name', 'type', 'size', 'tmp_name', 'error'); /** * Class constructor, intializes the internal arrays from superglobals * * @param string Request method (GET or POST) * @param bool Whether magic_quotes_gpc directive is on */ public function __construct($requestMethod = 'POST', $magicQuotesGPC = false) { if (!$magicQuotesGPC) { if ('GET' == strtoupper($requestMethod)) { $this->values = $_GET; } else { $this->values = $_POST; $this->files = $_FILES; } } else { if ('GET' == strtoupper($requestMethod)) { $this->values = $this->arrayMapRecursive('stripslashes', $_GET); } else { $this->values = $this->arrayMapRecursive('stripslashes', $_POST); foreach ($_FILES as $key1 => $val1) { foreach ($val1 as $key2 => $val2) { if ('name' == $key2) { $this->files[$key1][$key2] = $this->arrayMapRecursive( 'stripslashes', $val2 ); } else { $this->files[$key1][$key2] = $val2; } } } } } } /** * A recursive version of array_map() function * * @param callback Callback function to apply * @param mixed Input array * @return array with callback applied */ protected function arrayMapRecursive($callback, $arr) { if (!is_array($arr)) { return call_user_func($callback, $arr); } $mapped = array(); foreach ($arr as $k => $v) { $mapped[$k] = is_array($v)? $this->arrayMapRecursive($callback, $v): call_user_func($callback, $v); } return $mapped; } public function getUpload($name) { if (empty($this->files)) { return null; } if (false !== ($pos = strpos($name, '['))) { $tokens = explode('[', str_replace(']', '', $name)); $base = array_shift($tokens); $value = array(); if (!isset($this->files[$base]['name'])) { return null; } foreach (self::$_fileKeys as $key) { $value[$key] = $this->files[$base][$key]; } do { $token = array_shift($tokens); if (!isset($value['name'][$token])) { return null; } foreach (self::$_fileKeys as $key) { $value[$key] = $value[$key][$token]; } } while (!empty($tokens)); return $value; } elseif(isset($this->files[$name])) { return $this->files[$name]; } else { return null; } } } ?> HTML/QuickForm2/Rule.php000064400000033775152101606000010720 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Rule.php 310525 2011-04-26 18:42:03Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Abstract base class for HTML_QuickForm2 rules * * This class provides methods that allow chaining several rules together. * Its validate() method executes the whole rule chain starting from this rule. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ abstract class HTML_QuickForm2_Rule { /** * Constant showing that validation should be run server-side * @see HTML_QuickForm2_Node::addRule() */ const SERVER = 1; /** * Constant showing that validation should be run client-side (on form submit) * @see HTML_QuickForm2_Node::addRule() */ const CLIENT = 2; /** * Constant showing that validation should be run client-side (on form submit and on leaving the field) * @see HTML_QuickForm2_Node::addRule() */ const ONBLUR_CLIENT = 6; /** * A combination of SERVER and CLIENT constants * @see HTML_QuickForm2_Node::addRule() */ const CLIENT_SERVER = 3; /** * A combination of SERVER and ONBLUR_CLIENT constants * @see HTML_QuickForm2_Node::addRule() */ const ONBLUR_CLIENT_SERVER = 7; /** * An element whose value will be validated by this rule * @var HTML_QuickForm2_Node */ protected $owner; /** * An error message to display if validation fails * @var string */ protected $message; /** * Configuration data for the rule * @var mixed */ protected $config; /** * Rules chained to this via "and" and "or" operators * * The contents can be described as "disjunctive normal form", where an outer * array represents a disjunction of conjunctive clauses represented by inner * arrays. * * @var array */ protected $chainedRules = array(array()); /** * Class constructor * * @param HTML_QuickForm2_Node Element to validate * @param string Error message to display if validation fails * @param mixed Configuration data for the rule */ public function __construct(HTML_QuickForm2_Node $owner, $message = '', $config = null) { $this->setOwner($owner); $this->setMessage($message); $this->setConfig($config); } /** * Merges local configuration with that provided for registerRule() * * Default behaviour is for global config to override local one, different * Rules may implement more complex merging behaviours. * * @param mixed Local configuration * @param mixed Global configuration, usually provided to {@link HTML_QuickForm2_Factory::registerRule()} * @return mixed Merged configuration */ public static function mergeConfig($localConfig, $globalConfig) { return is_null($globalConfig)? $localConfig: $globalConfig; } /** * Sets configuration data for the rule * * @param mixed Rule configuration data (specific for a Rule) * @return HTML_QuickForm2_Rule * @throws HTML_QuickForm2_InvalidArgumentException in case of invalid * configuration data */ public function setConfig($config) { $this->config = $config; return $this; } /** * Returns the rule's configuration data * * @return mixed Configuration data (specific for a Rule) */ public function getConfig() { return $this->config; } /** * Sets the error message output by the rule * * @param string Error message to display if validation fails * @return HTML_QuickForm2_Rule */ public function setMessage($message) { $this->message = (string)$message; return $this; } /** * Returns the error message output by the rule * * @return string Error message */ public function getMessage() { return $this->message; } /** * Sets the element that will be validated by this rule * * @param HTML_QuickForm2_Node Element to validate * @throws HTML_QuickForm2_InvalidArgumentException if trying to set * an instance of HTML_QuickForm2_Element_Static as rule owner */ public function setOwner(HTML_QuickForm2_Node $owner) { // Very little sense to validate static elements as they're, well, static. // If someone comes up with a validation rule for these, he can override // setOwner() there... if ($owner instanceof HTML_QuickForm2_Element_Static) { throw new HTML_QuickForm2_InvalidArgumentException( get_class($this) . ' cannot validate Static elements' ); } if (null !== $this->owner) { $this->owner->removeRule($this); } $this->owner = $owner; } /** * Adds a rule to the chain with an "and" operator * * Evaluation is short-circuited, next rule will not be evaluated if the * previous one returns false. The method is named this way because "and" is * a reserved word in PHP. * * @param HTML_QuickForm2_Rule * @return HTML_QuickForm2_Rule first rule in the chain (i.e. $this) * @throws HTML_QuickForm2_InvalidArgumentException when trying to add * a "required" rule to the chain */ public function and_(HTML_QuickForm2_Rule $next) { if ($next instanceof HTML_QuickForm2_Rule_Required) { throw new HTML_QuickForm2_InvalidArgumentException( 'and_(): Cannot add a "required" rule' ); } $this->chainedRules[count($this->chainedRules) - 1][] = $next; return $this; } /** * Adds a rule to the chain with an "or" operator * * Evaluation is short-circuited, next rule will not be evaluated if the * previous one returns true. The method is named this way because "or" is * a reserved word in PHP. * * @param HTML_QuickForm2_Rule * @return HTML_QuickForm2_Rule first rule in the chain (i.e. $this) * @throws HTML_QuickForm2_InvalidArgumentException when trying to add * a "required" rule to the chain */ public function or_(HTML_QuickForm2_Rule $next) { if ($next instanceof HTML_QuickForm2_Rule_Required) { throw new HTML_QuickForm2_InvalidArgumentException( 'or_(): Cannot add a "required" rule' ); } $this->chainedRules[] = array($next); return $this; } /** * Performs validation * * The whole rule chain is executed. Note that the side effect of this * method is setting the error message on element if validation fails * * @return boolean Whether the element is valid */ public function validate() { $globalValid = false; $localValid = $this->validateOwner(); foreach ($this->chainedRules as $item) { foreach ($item as $multiplier) { if (!($localValid = $localValid && $multiplier->validate())) { break; } } if ($globalValid = $globalValid || $localValid) { break; } $localValid = true; } $globalValid or $this->setOwnerError(); return $globalValid; } /** * Validates the owner element * * @return bool Whether owner element is valid according to the rule */ abstract protected function validateOwner(); /** * Sets the error message on the owner element */ protected function setOwnerError() { if (strlen($this->getMessage()) && !$this->owner->getError()) { $this->owner->setError($this->getMessage()); } } /** * Returns the client-side validation callback * * This essentially builds a Javascript version of validateOwner() method, * with element ID and Rule configuration hardcoded. * * @return string Javascript function to validate the element's value * @throws HTML_QuickForm2_Exception if Rule can only be run server-side */ protected function getJavascriptCallback() { throw new HTML_QuickForm2_Exception( get_class($this) . ' does not implement javascript validation' ); } /** * Returns IDs of form fields that should trigger "live" Javascript validation * * This returns IDs that are linked to the rule itself. * * @return array */ protected function getOwnJavascriptTriggers() { return $this->owner->getJavascriptTriggers(); } /** * Returns IDs of form fields that should trigger "live" Javascript validation * * This returns IDs that are linked to the rule itself and its chained * rules. Live validation will be be triggered by 'blur' or 'change' event * on any of the elements whose IDs are returned by this method. * * @return array */ protected function getJavascriptTriggers() { $triggers = array_flip($this->getOwnJavascriptTriggers()); foreach ($this->chainedRules as $item) { foreach ($item as $multiplier) { foreach ($multiplier->getJavascriptTriggers() as $trigger) { $triggers[$trigger] = true; } } } return array_keys($triggers); } /** * Returns the client-side representation of the Rule * * The Javascript object returned contains the following fields: * - callback: {@see getJavascriptCallback()} * - elementId: element ID to set error for if validation fails * - errorMessage: error message to set if validation fails * - chained: chained rules, array of arrays like in $chainedRules property * * @return string * @throws HTML_QuickForm2_Exception if Rule or its chained Rules can only * be run server-side */ public function getJavascript($outputTriggers = true) { HTML_QuickForm2_Loader::loadClass('HTML_QuickForm2_JavascriptBuilder'); $js = $this->getJavascriptCallback() . ",\n\t'" . $this->owner->getId() . "', " . HTML_QuickForm2_JavascriptBuilder::encode($this->getMessage()); $js = $outputTriggers && count($triggers = $this->getJavascriptTriggers()) ? 'new qf.LiveRule(' . $js . ', ' . HTML_QuickForm2_JavascriptBuilder::encode($triggers) : 'new qf.Rule(' . $js; if (count($this->chainedRules) > 1 || count($this->chainedRules[0]) > 0) { $chained = array(); foreach ($this->chainedRules as $item) { $multipliers = array(); foreach ($item as $multiplier) { $multipliers[] = $multiplier->getJavascript(false); } $chained[] = '[' . implode(",\n", $multipliers) . ']'; } $js .= ",\n\t [" . implode(",\n", $chained) . "]"; } return $js . ')'; } /** * (( defined by alex@cgi-central.net - it is too wordy to build * rules without such easy chaining )) * Adds a validation rule to the owner of this validation rule * * @param HTML_QuickForm2_Rule|string Validation rule or rule type * @param string Message to display if validation * @param mixed Additional data for the rule * @return HTML_QuickForm2_Rule The added rule * @throws HTML_QuickForm2_InvalidArgumentException if $rule is of a * wrong type or rule name isn't registered with Factory * @throws HTML_QuickForm2_NotFoundException if class for a given rule * name cannot be found */ public function addRule($rule, $message = '', $options = null) { return $this->owner->addRule($rule, $message, $options); } /** @return HTML_QuickForm2_Node */ public function getOwner() { return $this->owner; } } HTML/QuickForm2/Element/InputImage.php000064400000013103152101606000013423 0ustar00 elements * * PHP version 5 * * LICENSE: * * Copyright (c) 2006-2011, Alexey Borzov , * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: InputImage.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Base class for elements */ require_once 'HTML/QuickForm2/Element/Input.php'; /** * Class for elements * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_Element_InputImage extends HTML_QuickForm2_Element_Input { protected $attributes = array('type' => 'image'); /** * Coordinates of user click within the image, array contains keys 'x' and 'y' * @var array */ protected $coordinates = null; /** * Image buttons can not be frozen * * @param bool Whether element should be frozen or editable. This * parameter is ignored in case of image elements * @return bool Always returns false */ public function toggleFrozen($freeze = null) { return false; } /** * Image button's value cannot be set via this method * * @param mixed Element's value, this parameter is ignored * @return HTML_QuickForm2_Element_InputImage */ public function setValue($value) { return $this; } /** * Returns the element's value * * The value is only returned if the form was actually submitted and this * image button was clicked. Returns null in all other cases. * * @return array|null An array with keys 'x' and 'y' containing the * coordinates of user click if the image was clicked, * null otherwise */ public function getRawValue() { return $this->getAttribute('disabled')? null: $this->coordinates; } /** * Returns the HTML representation of the element * * The method changes the element's name to foo[bar][] if it was foo[bar] * originally. If it is not done, then one of the click coordinates will be * lost, see {@link http://bugs.php.net/bug.php?id=745} * * @return string */ public function __toString() { if (false === strpos($this->attributes['name'], '[') || '[]' == substr($this->attributes['name'], -2)) { return parent::__toString(); } else { $this->attributes['name'] .= '[]'; $html = parent::__toString(); $this->attributes['name'] = substr($this->attributes['name'], 0, -2); return $html; } } protected function updateValue() { foreach ($this->getDataSources() as $ds) { if ($ds instanceof HTML_QuickForm2_DataSource_Submit) { $name = $this->getName(); if (false === strpos($name, '[') && null !== ($value = $ds->getValue($name . '_x'))) { $this->coordinates = array( 'x' => $value, 'y' => $ds->getValue($name . '_y') ); return; } elseif (false !== strpos($name, '[')) { if ('[]' == substr($name, -2)) { $name = substr($name, 0, -2); } if (null !== ($value = $ds->getValue($name))) { $this->coordinates = array( 'x' => $value[0], 'y' => $value[1] ); return; } } } } $this->coordinates = null; } } ?> HTML/QuickForm2/Element/Static.php000064400000021234152101606000012614 0ustar00, * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Static.php 311477 2011-05-27 09:01:44Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Base class for simple HTML_QuickForm2 elements (not Containers) */ require_once 'HTML/QuickForm2/Element.php'; /** * Class for static elements that only contain text or markup * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_Element_Static extends HTML_QuickForm2_Element { /** * Name of the tag to wrap around static element's content * @var string */ protected $tagName = null; /** * Whether to output closing tag when $tagName is set and element's content is empty * @var bool */ protected $forceClosingTag = true; /** * Contains options and data used for the element creation * - content: Content of the static element * @var array */ protected $data = array('content' => ''); /** * Class constructor * * Static element can understand the following keys in $data parameter: * - 'content': content of the static element, e.g. text or markup * - 'tagName': name of the tag to wrap around content, e.g. 'div'. * Using tag names corresponding to form elements will cause an Exception * - 'forceClosingTag': whether to output closing tag in case of empty * content, <foo></foo> vs. <foo /> * * @param string Element name * @param mixed Attributes (either a string or an array) * @param array Additional element data */ public function __construct($name = null, $attributes = null, array $data = array()) { if (!empty($data['tagName'])) { $this->setTagName( $data['tagName'], !array_key_exists('forceClosingTag', $data) || $data['forceClosingTag'] ); } unset($data['tagName'], $data['forceClosingTag']); parent::__construct($name, $attributes, $data); } /** * Intercepts setting 'name' and 'id' attributes * * Overrides parent method to allow removal of 'name' attribute on Static * elements * * @param string Attribute name * @param string Attribute value, null if attribute is being removed * @throws HTML_QuickForm2_InvalidArgumentException if trying to * remove a required attribute */ protected function onAttributeChange($name, $value = null) { if ('name' == $name && null === $value) { unset($this->attributes['name']); } else { parent::onAttributeChange($name, $value); } } /** * Sets the element's name * * Passing null here will remove the name attribute * * @param string|null * @return HTML_QuickForm2_Element_Static */ public function setName($name) { if (null !== $name) { return parent::setName($name); } else { return $this->removeAttribute('name'); } } public function getType() { return 'static'; } /** * Static element can not be frozen * * @param bool Whether element should be frozen or editable. This * parameter is ignored in case of static elements * @return bool Always returns false */ public function toggleFrozen($freeze = null) { return false; } /** * Sets the contents of the static element * * @param string Static content * @return HTML_QuickForm2_Element_Static */ function setContent($content) { $this->data['content'] = $content; return $this; } /** * Returns the contents of the static element * * @return string */ function getContent() { return $this->data['content']; } /** * Static element's content can also be set via this method * * @param mixed Element's value, this parameter is ignored * @return HTML_QuickForm2_Element_Static */ public function setValue($value) { $this->setContent($value); return $this; } /** * Static elements have no value * * @return null */ public function getRawValue() { return null; } public function __toString() { $prefix = $this->getIndent(); if ($comment = $this->getComment()) { $prefix .= '' . HTML_Common2::getOption('linebreak') . $this->getIndent(); } if (!$this->tagName) { return $prefix . $this->getContent(); } elseif ('' != $this->getContent()) { return $prefix . '<' . $this->tagName . $this->getAttributes(true) . '>' . $this->getContent() . 'tagName . '>'; } else { return $prefix . '<' . $this->tagName . $this->getAttributes(true) . ($this->forceClosingTag ? '>tagName . '>' : ' />'); } } public function getJavascriptValue($inContainer = false) { return ''; } public function getJavascriptTriggers() { return array(); } /** * Called when the element needs to update its value from form's data sources * * Static elements content can be updated with default form values. */ protected function updateValue() { foreach ($this->getDataSources() as $ds) { if (!$ds instanceof HTML_QuickForm2_DataSource_Submit && null !== ($value = $ds->getValue($this->getName()))) { $this->setContent($value); return; } } } /** * Sets the name of the HTML tag to wrap around static element's content * * @param string tag name * @param bool whether to output closing tag in case of empty contents * @throws HTML_QuickForm2_InvalidArgumentException when trying to set a tag * name corresponding to a form element * @return HTML_QuickForm2_Element_Static */ public function setTagName($name, $forceClosing = true) { // Prevent people shooting themselves in the proverbial foot if (in_array(strtolower($name), array('form', 'fieldset', 'button', 'input', 'select', 'textarea')) ) { throw new HTML_QuickForm2_InvalidArgumentException( "Do not use tag name '{$name}' with Static element, use proper element class" ); } $this->tagName = (string)$name; $this->forceClosingTag = (bool)$forceClosing; return $this; } } ?>HTML/QuickForm2/Element/InputHidden.php000064400000006053152101606000013602 0ustar00 elements * * PHP version 5 * * LICENSE: * * Copyright (c) 2006-2011, Alexey Borzov , * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: InputHidden.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Base class for elements */ require_once 'HTML/QuickForm2/Element/Input.php'; /** * Class for elements * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_Element_InputHidden extends HTML_QuickForm2_Element_Input { protected $attributes = array('type' => 'hidden'); /** * Hidden elements can not be frozen * * @param bool Whether element should be frozen or editable. This * parameter is ignored in case of hidden elements * @return bool Always returns false */ public function toggleFrozen($freeze = null) { return false; } public function render(HTML_QuickForm2_Renderer $renderer) { $renderer->renderHidden($this); $this->renderClientRules($renderer->getJavascriptBuilder()); return $renderer; } } ?> HTML/QuickForm2/Element/InputRadio.php000064400000005250152101606000013443 0ustar00 elements * * PHP version 5 * * LICENSE: * * Copyright (c) 2006-2011, Alexey Borzov , * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: InputRadio.php 309777 2011-03-28 10:41:11Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Base class for checkboxes and radios */ require_once 'HTML/QuickForm2/Element/InputCheckable.php'; /** * Class for elements * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @version Release: @package_version@ */ class HTML_QuickForm2_Element_InputRadio extends HTML_QuickForm2_Element_InputCheckable { protected $attributes = array('type' => 'radio', 'value' => 'on'); protected $frozenHtml = array( 'checked' => '(x)', 'unchecked' => '( )' ); } ?> HTML/QuickForm2/Element/Select.php000064400000046205152101606000012611 0ustar00 elements * * PHP version 5 * * LICENSE: * * Copyright (c) 2006-2011, Alexey Borzov , * Bertrand Mansion * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category HTML * @package HTML_QuickForm2 * @author Alexey Borzov * @author Bertrand Mansion * @license http://opensource.org/licenses/bsd-license.php New BSD License * @version SVN: $Id: Select.php 311435 2011-05-26 10:30:06Z avb $ * @link http://pear.php.net/package/HTML_QuickForm2 */ /** * Base class for simple HTML_QuickForm2 elements */ require_once 'HTML/QuickForm2/Element.php'; /** * Collection of s * * This class handles the output of