diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
commit | 8ca6cc32b2c789a3149861159ad258f2cb9491e3 (patch) | |
tree | 2492de6f1528dd44eaa169a5c1555026d9cb75ec /library/vendor/Zend/Form/Element | |
parent | Initial commit. (diff) | |
download | icingaweb2-upstream.tar.xz icingaweb2-upstream.zip |
Adding upstream version 2.11.4.upstream/2.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/vendor/Zend/Form/Element')
18 files changed, 2363 insertions, 0 deletions
diff --git a/library/vendor/Zend/Form/Element/Button.php b/library/vendor/Zend/Form/Element/Button.php new file mode 100644 index 0000000..89de056 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Button.php @@ -0,0 +1,55 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Submit */ + +/** + * Button form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Button extends Zend_Form_Element_Submit +{ + /** + * Use formButton view helper by default + * @var string + */ + public $helper = 'formButton'; + + /** + * Validate element value (pseudo) + * + * There is no need to reset the value + * + * @param mixed $value Is always ignored + * @param mixed $context Is always ignored + * @return boolean Returns always TRUE + */ + public function isValid($value, $context = null) + { + return true; + } +} diff --git a/library/vendor/Zend/Form/Element/Checkbox.php b/library/vendor/Zend/Form/Element/Checkbox.php new file mode 100644 index 0000000..65cdccc --- /dev/null +++ b/library/vendor/Zend/Form/Element/Checkbox.php @@ -0,0 +1,202 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Checkbox form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Checkbox extends Zend_Form_Element_Xhtml +{ + /** + * Is the checkbox checked? + * @var bool + */ + public $checked = false; + + /** + * Use formCheckbox view helper by default + * @var string + */ + public $helper = 'formCheckbox'; + + /** + * Options that will be passed to the view helper + * @var array + */ + public $options = array( + 'checkedValue' => '1', + 'uncheckedValue' => '0', + ); + + /** + * Value when checked + * @var string + */ + protected $_checkedValue = '1'; + + /** + * Value when not checked + * @var string + */ + protected $_uncheckedValue = '0'; + + /** + * Current value + * @var string 0 or 1 + */ + protected $_value = '0'; + + /** + * Set options + * + * Intercept checked and unchecked values and set them early; test stored + * value against checked and unchecked values after configuration. + * + * @param array $options + * @return Zend_Form_Element_Checkbox + */ + public function setOptions(array $options) + { + if (array_key_exists('checkedValue', $options)) { + $this->setCheckedValue($options['checkedValue']); + unset($options['checkedValue']); + } + if (array_key_exists('uncheckedValue', $options)) { + $this->setUncheckedValue($options['uncheckedValue']); + unset($options['uncheckedValue']); + } + parent::setOptions($options); + + $curValue = $this->getValue(); + $test = array($this->getCheckedValue(), $this->getUncheckedValue()); + if (!in_array($curValue, $test)) { + $this->setValue($curValue); + } + + return $this; + } + + /** + * Set value + * + * If value matches checked value, sets to that value, and sets the checked + * flag to true. + * + * Any other value causes the unchecked value to be set as the current + * value, and the checked flag to be set as false. + * + * + * @param mixed $value + * @return Zend_Form_Element_Checkbox + */ + public function setValue($value) + { + if ($value == $this->getCheckedValue()) { + parent::setValue($value); + $this->checked = true; + } else { + parent::setValue($this->getUncheckedValue()); + $this->checked = false; + } + return $this; + } + + /** + * Set checked value + * + * @param string $value + * @return Zend_Form_Element_Checkbox + */ + public function setCheckedValue($value) + { + $this->_checkedValue = (string) $value; + $this->options['checkedValue'] = $value; + return $this; + } + + /** + * Get value when checked + * + * @return string + */ + public function getCheckedValue() + { + return $this->_checkedValue; + } + + /** + * Set unchecked value + * + * @param string $value + * @return Zend_Form_Element_Checkbox + */ + public function setUncheckedValue($value) + { + $this->_uncheckedValue = (string) $value; + $this->options['uncheckedValue'] = $value; + return $this; + } + + /** + * Get value when not checked + * + * @return string + */ + public function getUncheckedValue() + { + return $this->_uncheckedValue; + } + + /** + * Set checked flag + * + * @param bool $flag + * @return Zend_Form_Element_Checkbox + */ + public function setChecked($flag) + { + $this->checked = (bool) $flag; + if ($this->checked) { + $this->setValue($this->getCheckedValue()); + } else { + $this->setValue($this->getUncheckedValue()); + } + return $this; + } + + /** + * Get checked flag + * + * @return bool + */ + public function isChecked() + { + return $this->checked; + } +} diff --git a/library/vendor/Zend/Form/Element/Exception.php b/library/vendor/Zend/Form/Element/Exception.php new file mode 100644 index 0000000..b39e053 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Exception.php @@ -0,0 +1,36 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @version $Id$ + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Exception */ + +/** + * Exception for Zend_Form component. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Form_Element_Exception extends Zend_Form_Exception +{ +} diff --git a/library/vendor/Zend/Form/Element/File.php b/library/vendor/Zend/Form/Element/File.php new file mode 100644 index 0000000..1b336da --- /dev/null +++ b/library/vendor/Zend/Form/Element/File.php @@ -0,0 +1,910 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Zend_Form_Element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_File extends Zend_Form_Element_Xhtml +{ + /** + * Plugin loader type + */ + const TRANSFER_ADAPTER = 'TRANSFER_ADAPTER'; + + /** + * @var string Default view helper + */ + public $helper = 'formFile'; + + /** + * @var Zend_File_Transfer_Adapter_Abstract + */ + protected $_adapter; + + /** + * @var boolean Already validated ? + */ + protected $_validated = false; + + /** + * @var boolean Disable value to be equal to file content + */ + protected $_valueDisabled = false; + + /** + * @var integer Internal multifile counter + */ + protected $_counter = 1; + + /** + * @var integer Maximum file size for MAX_FILE_SIZE attribut of form + */ + protected static $_maxFileSize = -1; + + /** + * Load default decorators + * + * @return Zend_Form_Element_File + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + + parent::loadDefaultDecorators(); + + // This element needs the File decorator and not the ViewHelper decorator + if (false !== $this->getDecorator('ViewHelper')) { + $this->removeDecorator('ViewHelper'); + } + if (false === $this->getDecorator('File')) { + // Add File decorator to the beginning + $decorators = $this->getDecorators(); + array_unshift($decorators, 'File'); + $this->setDecorators($decorators); + } + + return $this; + } + + /** + * Set plugin loader + * + * @param Zend_Loader_PluginLoader_Interface $loader + * @param string $type + * @return Zend_Form_Element_File + */ + public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $type) + { + $type = strtoupper($type); + + if ($type != self::TRANSFER_ADAPTER) { + return parent::setPluginLoader($loader, $type); + } + + $this->_loaders[$type] = $loader; + return $this; + } + + /** + * Get Plugin Loader + * + * @param string $type + * @return Zend_Loader_PluginLoader_Interface + */ + public function getPluginLoader($type) + { + $type = strtoupper($type); + + if ($type != self::TRANSFER_ADAPTER) { + return parent::getPluginLoader($type); + } + + if (!array_key_exists($type, $this->_loaders)) { + $loader = new Zend_Loader_PluginLoader(array( + 'Zend_File_Transfer_Adapter' => 'Zend/File/Transfer/Adapter/', + )); + $this->setPluginLoader($loader, self::TRANSFER_ADAPTER); + } + + return $this->_loaders[$type]; + } + + /** + * Add prefix path for plugin loader + * + * @param string $prefix + * @param string $path + * @param string $type + * @return Zend_Form_Element_File + */ + public function addPrefixPath($prefix, $path, $type = null) + { + $type = strtoupper($type); + if (!empty($type) && ($type != self::TRANSFER_ADAPTER)) { + return parent::addPrefixPath($prefix, $path, $type); + } + + if (empty($type)) { + $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; + $pluginPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Transfer' . $nsSeparator . 'Adapter'; + $pluginPath = rtrim($path, DIRECTORY_SEPARATOR) . '/Transfer/Adapter/'; + $loader = $this->getPluginLoader(self::TRANSFER_ADAPTER); + $loader->addPrefixPath($pluginPrefix, $pluginPath); + return parent::addPrefixPath($prefix, $path, null); + } + + $loader = $this->getPluginLoader($type); + $loader->addPrefixPath($prefix, $path); + return $this; + } + + /** + * Set transfer adapter + * + * @param string|Zend_File_Transfer_Adapter_Abstract $adapter + * @return Zend_Form_Element_File + * @throws Zend_Form_Element_Exception + */ + public function setTransferAdapter($adapter) + { + if ($adapter instanceof Zend_File_Transfer_Adapter_Abstract) { + $this->_adapter = $adapter; + } elseif (is_string($adapter)) { + $loader = $this->getPluginLoader(self::TRANSFER_ADAPTER); + $class = $loader->load($adapter); + $this->_adapter = new $class; + } else { + throw new Zend_Form_Element_Exception('Invalid adapter specified'); + } + + foreach (array('filter', 'validate') as $type) { + $loader = $this->getPluginLoader($type); + $this->_adapter->setPluginLoader($loader, $type); + } + + return $this; + } + + /** + * Get transfer adapter + * + * Lazy loads HTTP transfer adapter when no adapter registered. + * + * @return Zend_File_Transfer_Adapter_Abstract + */ + public function getTransferAdapter() + { + if (null === $this->_adapter) { + $this->setTransferAdapter('Http'); + } + return $this->_adapter; + } + + /** + * Add Validator; proxy to adapter + * + * @param string|Zend_Validate_Interface $validator + * @param bool $breakChainOnFailure + * @param mixed $options + * @return Zend_Form_Element_File + */ + public function addValidator($validator, $breakChainOnFailure = false, $options = array()) + { + $adapter = $this->getTransferAdapter(); + $adapter->addValidator($validator, $breakChainOnFailure, $options, $this->getName()); + $this->_validated = false; + + return $this; + } + + /** + * Add multiple validators at once; proxy to adapter + * + * @param array $validators + * @return Zend_Form_Element_File + */ + public function addValidators(array $validators) + { + $adapter = $this->getTransferAdapter(); + $adapter->addValidators($validators, $this->getName()); + $this->_validated = false; + + return $this; + } + + /** + * Add multiple validators at once, overwriting; proxy to adapter + * + * @param array $validators + * @return Zend_Form_Element_File + */ + public function setValidators(array $validators) + { + $adapter = $this->getTransferAdapter(); + $adapter->setValidators($validators, $this->getName()); + $this->_validated = false; + + return $this; + } + + /** + * Retrieve validator by name; proxy to adapter + * + * @param string $name + * @return Zend_Validate_Interface|null + */ + public function getValidator($name) + { + $adapter = $this->getTransferAdapter(); + return $adapter->getValidator($name); + } + + /** + * Retrieve all validators; proxy to adapter + * + * @return array + */ + public function getValidators() + { + $adapter = $this->getTransferAdapter(); + $validators = $adapter->getValidators($this->getName()); + if ($validators === null) { + $validators = array(); + } + + return $validators; + } + + /** + * Remove validator by name; proxy to adapter + * + * @param string $name + * @return Zend_Form_Element_File + */ + public function removeValidator($name) + { + $adapter = $this->getTransferAdapter(); + $adapter->removeValidator($name); + $this->_validated = false; + + return $this; + } + + /** + * Remove all validators; proxy to adapter + * + * @return Zend_Form_Element_File + */ + public function clearValidators() + { + $adapter = $this->getTransferAdapter(); + $adapter->clearValidators(); + $this->_validated = false; + + return $this; + } + + /** + * Add Filter; proxy to adapter + * + * @param string|array $filter Type of filter to add + * @param string|array $options Options to set for the filter + * @return Zend_Form_Element_File + */ + public function addFilter($filter, $options = null) + { + $adapter = $this->getTransferAdapter(); + $adapter->addFilter($filter, $options, $this->getName()); + + return $this; + } + + /** + * Add Multiple filters at once; proxy to adapter + * + * @param array $filters + * @return Zend_Form_Element_File + */ + public function addFilters(array $filters) + { + $adapter = $this->getTransferAdapter(); + $adapter->addFilters($filters, $this->getName()); + + return $this; + } + + /** + * Sets a filter for the class, erasing all previous set; proxy to adapter + * + * @param array $filters Filters to set + * @return Zend_Form_Element_File + */ + public function setFilters(array $filters) + { + $adapter = $this->getTransferAdapter(); + $adapter->setFilters($filters, $this->getName()); + + return $this; + } + + /** + * Retrieve individual filter; proxy to adapter + * + * @param string $name + * @return Zend_Filter_Interface|null + */ + public function getFilter($name) + { + $adapter = $this->getTransferAdapter(); + return $adapter->getFilter($name); + } + + /** + * Returns all set filters; proxy to adapter + * + * @return array List of set filters + */ + public function getFilters() + { + $adapter = $this->getTransferAdapter(); + $filters = $adapter->getFilters($this->getName()); + + if ($filters === null) { + $filters = array(); + } + return $filters; + } + + /** + * Remove an individual filter; proxy to adapter + * + * @param string $name + * @return Zend_Form_Element_File + */ + public function removeFilter($name) + { + $adapter = $this->getTransferAdapter(); + $adapter->removeFilter($name); + + return $this; + } + + /** + * Remove all filters; proxy to adapter + * + * @return Zend_Form_Element_File + */ + public function clearFilters() + { + $adapter = $this->getTransferAdapter(); + $adapter->clearFilters(); + + return $this; + } + + /** + * Validate upload + * + * @param string $value File, can be optional, give null to validate all files + * @param mixed $context + * @return bool + */ + public function isValid($value, $context = null) + { + if ($this->_validated) { + return true; + } + + $adapter = $this->getTransferAdapter(); + $translator = $this->getTranslator(); + if ($translator !== null) { + $adapter->setTranslator($translator); + } + + if (!$this->isRequired()) { + $adapter->setOptions(array('ignoreNoFile' => true), $this->getName()); + } else { + $adapter->setOptions(array('ignoreNoFile' => false), $this->getName()); + if ($this->autoInsertNotEmptyValidator() && !$this->getValidator('NotEmpty')) { + $this->addValidator('NotEmpty', true); + } + } + + if($adapter->isValid($this->getName())) { + $this->_validated = true; + return true; + } + + $this->_validated = false; + return false; + } + + /** + * Receive the uploaded file + * + * @return boolean + */ + public function receive() + { + if (!$this->_validated) { + if (!$this->isValid($this->getName())) { + return false; + } + } + + $adapter = $this->getTransferAdapter(); + if ($adapter->receive($this->getName())) { + return true; + } + + return false; + } + + /** + * Retrieve error codes; proxy to transfer adapter + * + * @return array + */ + public function getErrors() + { + return parent::getErrors() + $this->getTransferAdapter()->getErrors(); + } + + /** + * Are there errors registered? + * + * @return bool + */ + public function hasErrors() + { + return (parent::hasErrors() || $this->getTransferAdapter()->hasErrors()); + } + + /** + * Retrieve error messages; proxy to transfer adapter + * + * @return array + */ + public function getMessages() + { + return parent::getMessages() + $this->getTransferAdapter()->getMessages(); + } + + /** + * Set the upload destination + * + * @param string $path + * @return Zend_Form_Element_File + */ + public function setDestination($path) + { + $this->getTransferAdapter()->setDestination($path, $this->getName()); + return $this; + } + + /** + * Get the upload destination + * + * @return string + */ + public function getDestination() + { + return $this->getTransferAdapter()->getDestination($this->getName()); + } + + /** + * Get the final filename + * + * @param string $value (Optional) Element or file to return + * @param boolean $path (Optional) Return also the path, defaults to true + * @return string + */ + public function getFileName($value = null, $path = true) + { + if (empty($value)) { + $value = $this->getName(); + } + + return $this->getTransferAdapter()->getFileName($value, $path); + } + + /** + * Get internal file informations + * + * @param string $value (Optional) Element or file to return + * @return array + */ + public function getFileInfo($value = null) + { + if (empty($value)) { + $value = $this->getName(); + } + + return $this->getTransferAdapter()->getFileInfo($value); + } + + /** + * Set a multifile element + * + * @param integer $count Number of file elements + * @return Zend_Form_Element_File Provides fluent interface + */ + public function setMultiFile($count) + { + if ((integer) $count < 2) { + $this->setIsArray(false); + $this->_counter = 1; + } else { + $this->setIsArray(true); + $this->_counter = (integer) $count; + } + + return $this; + } + + /** + * Returns the multifile element number + * + * @return integer + */ + public function getMultiFile() + { + return $this->_counter; + } + + /** + * Sets the maximum file size of the form + * + * @return integer + */ + public function getMaxFileSize() + { + if (self::$_maxFileSize < 0) { + $ini = $this->_convertIniToInteger(trim(ini_get('post_max_size'))); + $max = $this->_convertIniToInteger(trim(ini_get('upload_max_filesize'))); + $min = max($ini, $max); + if ($ini > 0) { + $min = min($min, $ini); + } + + if ($max > 0) { + $min = min($min, $max); + } + + self::$_maxFileSize = $min; + } + + return self::$_maxFileSize; + } + + /** + * Sets the maximum file size of the form + * + * @param integer $size + * @return integer + */ + public function setMaxFileSize($size) + { + $ini = $this->_convertIniToInteger(trim(ini_get('post_max_size'))); + $max = $this->_convertIniToInteger(trim(ini_get('upload_max_filesize'))); + + if (($max > -1) && ($size > $max)) { + trigger_error("Your 'upload_max_filesize' config setting limits the maximum filesize to '$max'. You tried to set '$size'.", E_USER_NOTICE); + $size = $max; + } + + if (($ini > -1) && ($size > $ini)) { + trigger_error("Your 'post_max_size' config setting limits the maximum filesize to '$ini'. You tried to set '$size'.", E_USER_NOTICE); + $size = $ini; + } + + self::$_maxFileSize = $size; + return $this; + } + + /** + * Converts a ini setting to a integer value + * + * @param string $setting + * @return integer + */ + private function _convertIniToInteger($setting) + { + if (!is_numeric($setting)) { + $type = strtoupper(substr($setting, -1)); + $setting = (integer) substr($setting, 0, -1); + + switch ($type) { + case 'K' : + $setting *= 1024; + break; + + case 'M' : + $setting *= 1024 * 1024; + break; + + case 'G' : + $setting *= 1024 * 1024 * 1024; + break; + + default : + break; + } + } + + return (integer) $setting; + } + + /** + * Set if the file will be uploaded when getting the value + * This defaults to false which will force receive() when calling getValues() + * + * @param boolean $flag Sets if the file is handled as the elements value + * @return Zend_Form_Element_File + */ + public function setValueDisabled($flag) + { + $this->_valueDisabled = (bool) $flag; + return $this; + } + + /** + * Returns if the file will be uploaded when calling getValues() + * + * @return boolean Receive the file on calling getValues()? + */ + public function isValueDisabled() + { + return $this->_valueDisabled; + } + + /** + * Processes the file, returns null or the filename only + * For the complete path, use getFileName + * + * @return null|string + */ + public function getValue() + { + if ($this->_value !== null) { + return $this->_value; + } + + $content = $this->getTransferAdapter()->getFileName($this->getName()); + if (empty($content)) { + return null; + } + + if (!$this->isValid(null)) { + return null; + } + + if (!$this->_valueDisabled && !$this->receive()) { + return null; + } + + return $this->getFileName(null, false); + } + + /** + * Disallow setting the value + * + * @param mixed $value + * @return Zend_Form_Element_File + */ + public function setValue($value) + { + return $this; + } + + /** + * Set translator object for localization + * + * @param Zend_Translate|null $translator + * @return Zend_Form_Element_File + */ + public function setTranslator($translator = null) + { + $adapter = $this->getTransferAdapter(); + $adapter->setTranslator($translator); + parent::setTranslator($translator); + + return $this; + } + + /** + * Retrieve localization translator object + * + * @return Zend_Translate_Adapter|null + */ + public function getTranslator() + { + if ($this->translatorIsDisabled()) { + return null; + } + + $translator = $this->getTransferAdapter()->getTranslator(); + if (null === $translator) { + return Zend_Form::getDefaultTranslator(); + } + + return $translator; + } + + /** + * Indicate whether or not translation should be disabled + * + * @param bool $flag + * @return Zend_Form_Element_File + */ + public function setDisableTranslator($flag) + { + $adapter = $this->getTransferAdapter(); + $adapter->setDisableTranslator($flag); + $this->_translatorDisabled = (bool) $flag; + + return $this; + } + + /** + * Is translation disabled? + * + * @return bool + */ + public function translatorIsDisabled() + { + $adapter = $this->getTransferAdapter(); + return $adapter->translatorIsDisabled(); + } + + /** + * Was the file received? + * + * @return bool + */ + public function isReceived() + { + $adapter = $this->getTransferAdapter(); + return $adapter->isReceived($this->getName()); + } + + /** + * Was the file uploaded? + * + * @return bool + */ + public function isUploaded() + { + $adapter = $this->getTransferAdapter(); + return $adapter->isUploaded($this->getName()); + } + + /** + * Has the file been filtered? + * + * @return bool + */ + public function isFiltered() + { + $adapter = $this->getTransferAdapter(); + return $adapter->isFiltered($this->getName()); + } + + /** + * Returns the hash for this file element + * + * @param string $hash (Optional) Hash algorithm to use + * @return string|array Hashstring + */ + public function getHash($hash = 'crc32') + { + $adapter = $this->getTransferAdapter(); + return $adapter->getHash($hash, $this->getName()); + } + + /** + * Returns the filesize for this file element + * + * @return string|array Filesize + */ + public function getFileSize() + { + $adapter = $this->getTransferAdapter(); + return $adapter->getFileSize($this->getName()); + } + + /** + * Returns the mimetype for this file element + * + * @return string|array Mimetype + */ + public function getMimeType() + { + $adapter = $this->getTransferAdapter(); + return $adapter->getMimeType($this->getName()); + } + + /** + * Render form element + * Checks for decorator interface to prevent errors + * + * @param Zend_View_Interface $view + * @return string + * @throws Zend_Form_Element_Exception + */ + public function render(Zend_View_Interface $view = null) + { + $marker = false; + foreach ($this->getDecorators() as $decorator) { + if ($decorator instanceof Zend_Form_Decorator_Marker_File_Interface) { + $marker = true; + } + } + + if (!$marker) { + throw new Zend_Form_Element_Exception('No file decorator found... unable to render file element'); + } + + return parent::render($view); + } + + /** + * Retrieve error messages and perform translation and value substitution + * + * @return array + */ + protected function _getErrorMessages() + { + $translator = $this->getTranslator(); + $messages = $this->getErrorMessages(); + $value = $this->getFileName(); + foreach ($messages as $key => $message) { + if (null !== $translator) { + $message = $translator->translate($message); + } + + if ($this->isArray() || is_array($value)) { + $aggregateMessages = array(); + foreach ($value as $val) { + $aggregateMessages[] = str_replace('%value%', $val, $message); + } + + if (!empty($aggregateMessages)) { + $messages[$key] = $aggregateMessages; + } + } else { + $messages[$key] = str_replace('%value%', $value, $message); + } + } + + return $messages; + } +} diff --git a/library/vendor/Zend/Form/Element/Hidden.php b/library/vendor/Zend/Form/Element/Hidden.php new file mode 100644 index 0000000..c512684 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Hidden.php @@ -0,0 +1,41 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Hidden form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Hidden extends Zend_Form_Element_Xhtml +{ + /** + * Use formHidden view helper by default + * @var string + */ + public $helper = 'formHidden'; +} diff --git a/library/vendor/Zend/Form/Element/Image.php b/library/vendor/Zend/Form/Element/Image.php new file mode 100644 index 0000000..46c914a --- /dev/null +++ b/library/vendor/Zend/Form/Element/Image.php @@ -0,0 +1,131 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Image form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Image extends Zend_Form_Element_Xhtml +{ + /** + * What view helper to use when using view helper decorator + * @var string + */ + public $helper = 'formImage'; + + /** + * Image source + * @var string + */ + public $src; + + /** + * Image value + * @var mixed + */ + protected $_imageValue; + + /** + * Load default decorators + * + * @return Zend_Form_Element_Image + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + + $decorators = $this->getDecorators(); + if (empty($decorators)) { + $this->addDecorator('Tooltip') + ->addDecorator('Image') + ->addDecorator('Errors') + ->addDecorator('HtmlTag', array('tag' => 'dd')) + ->addDecorator('Label', array('tag' => 'dt')); + } + return $this; + } + + /** + * Set image path + * + * @param string $path + * @return Zend_Form_Element_Image + */ + public function setImage($path) + { + $this->src = (string) $path; + return $this; + } + + /** + * Get image path + * + * @return string + */ + public function getImage() + { + return $this->src; + } + + /** + * Set image value to use when submitted + * + * @param mixed $value + * @return Zend_Form_Element_Image + */ + public function setImageValue($value) + { + $this->_imageValue = $value; + return $this; + } + + /** + * Get image value to use when submitted + * + * @return mixed + */ + public function getImageValue() + { + return $this->_imageValue; + } + + /** + * Was this element used to submit the form? + * + * @return bool + */ + public function isChecked() + { + $imageValue = $this->getImageValue(); + return ((null !== $imageValue) && ($this->getValue() == $imageValue)); + } + +} diff --git a/library/vendor/Zend/Form/Element/Multi.php b/library/vendor/Zend/Form/Element/Multi.php new file mode 100644 index 0000000..3de2033 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Multi.php @@ -0,0 +1,316 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Base class for multi-option form elements + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +abstract class Zend_Form_Element_Multi extends Zend_Form_Element_Xhtml +{ + /** + * Array of options for multi-item + * @var array + */ + public $options = array(); + + /** + * Flag: autoregister inArray validator? + * @var bool + */ + protected $_registerInArrayValidator = true; + + /** + * Separator to use between options; defaults to '<br />'. + * @var string + */ + protected $_separator = '<br />'; + + /** + * Which values are translated already? + * @var array + */ + protected $_translated = array(); + + /** + * Retrieve separator + * + * @return mixed + */ + public function getSeparator() + { + return $this->_separator; + } + + /** + * Set separator + * + * @param mixed $separator + * @return self + */ + public function setSeparator($separator) + { + $this->_separator = $separator; + return $this; + } + + /** + * Retrieve options array + * + * @return array + */ + protected function _getMultiOptions() + { + if (null === $this->options || !is_array($this->options)) { + $this->options = array(); + } + + return $this->options; + } + + /** + * Add an option + * + * @param string $option + * @param string $value + * @return Zend_Form_Element_Multi + */ + public function addMultiOption($option, $value = '') + { + $option = (string) $option; + $this->_getMultiOptions(); + if (!$this->_translateOption($option, $value)) { + $this->options[$option] = $value; + } + + return $this; + } + + /** + * Add many options at once + * + * @param array $options + * @return Zend_Form_Element_Multi + */ + public function addMultiOptions(array $options) + { + foreach ($options as $option => $value) { + if (is_array($value) + && array_key_exists('key', $value) + && array_key_exists('value', $value) + ) { + $this->addMultiOption($value['key'], $value['value']); + } else { + $this->addMultiOption($option, $value); + } + } + return $this; + } + + /** + * Set all options at once (overwrites) + * + * @param array $options + * @return Zend_Form_Element_Multi + */ + public function setMultiOptions(array $options) + { + $this->clearMultiOptions(); + return $this->addMultiOptions($options); + } + + /** + * Retrieve single multi option + * + * @param string $option + * @return mixed + */ + public function getMultiOption($option) + { + $option = (string) $option; + $this->_getMultiOptions(); + if (isset($this->options[$option])) { + $this->_translateOption($option, $this->options[$option]); + return $this->options[$option]; + } + + return null; + } + + /** + * Retrieve options + * + * @return array + */ + public function getMultiOptions() + { + $this->_getMultiOptions(); + foreach ($this->options as $option => $value) { + $this->_translateOption($option, $value); + } + return $this->options; + } + + /** + * Remove a single multi option + * + * @param string $option + * @return bool + */ + public function removeMultiOption($option) + { + $option = (string) $option; + $this->_getMultiOptions(); + if (isset($this->options[$option])) { + unset($this->options[$option]); + if (isset($this->_translated[$option])) { + unset($this->_translated[$option]); + } + return true; + } + + return false; + } + + /** + * Clear all options + * + * @return Zend_Form_Element_Multi + */ + public function clearMultiOptions() + { + $this->options = array(); + $this->_translated = array(); + return $this; + } + + /** + * Set flag indicating whether or not to auto-register inArray validator + * + * @param bool $flag + * @return Zend_Form_Element_Multi + */ + public function setRegisterInArrayValidator($flag) + { + $this->_registerInArrayValidator = (bool) $flag; + return $this; + } + + /** + * Get status of auto-register inArray validator flag + * + * @return bool + */ + public function registerInArrayValidator() + { + return $this->_registerInArrayValidator; + } + + /** + * Is the value provided valid? + * + * Autoregisters InArray validator if necessary. + * + * @param string $value + * @param mixed $context + * @return bool + */ + public function isValid($value, $context = null) + { + if ($this->registerInArrayValidator()) { + if (!$this->getValidator('InArray')) { + $multiOptions = $this->getMultiOptions(); + $options = array(); + + foreach ($multiOptions as $opt_value => $opt_label) { + // optgroup instead of option label + if (is_array($opt_label)) { + $options = array_merge($options, array_keys($opt_label)); + } + else { + $options[] = $opt_value; + } + } + + $this->addValidator( + 'InArray', + true, + array($options) + ); + } + } + return parent::isValid($value, $context); + } + + /** + * Translate an option + * + * @param string $option + * @param string $value + * @return bool + */ + protected function _translateOption($option, $value) + { + if ($this->translatorIsDisabled()) { + return false; + } + + if (!isset($this->_translated[$option]) && !empty($value)) { + $this->options[$option] = $this->_translateValue($value); + if ($this->options[$option] === $value) { + return false; + } + $this->_translated[$option] = true; + return true; + } + + return false; + } + + /** + * Translate a multi option value + * + * @param string $value + * @return string + */ + protected function _translateValue($value) + { + if (is_array($value)) { + foreach ($value as $key => $val) { + $value[$key] = $this->_translateValue($val); + } + return $value; + } else { + if (null !== ($translator = $this->getTranslator())) { + return $translator->translate($value); + } + + return $value; + } + } +} diff --git a/library/vendor/Zend/Form/Element/MultiCheckbox.php b/library/vendor/Zend/Form/Element/MultiCheckbox.php new file mode 100644 index 0000000..24fe938 --- /dev/null +++ b/library/vendor/Zend/Form/Element/MultiCheckbox.php @@ -0,0 +1,72 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Multi */ + +/** + * MultiCheckbox form element + * + * Allows specifyinc a (multi-)dimensional associative array of values to use + * as labelled checkboxes; these will return an array of values for those + * checkboxes selected. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_MultiCheckbox extends Zend_Form_Element_Multi +{ + /** + * Use formMultiCheckbox view helper by default + * @var string + */ + public $helper = 'formMultiCheckbox'; + + /** + * MultiCheckbox is an array of values by default + * @var bool + */ + protected $_isArray = true; + + /** + * Load default decorators + * + * @return Zend_Form_Element_MultiCheckbox + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + + parent::loadDefaultDecorators(); + + // Disable 'for' attribute + if (false !== $decorator = $this->getDecorator('label')) { + $decorator->setOption('disableFor', true); + } + + return $this; + } +} diff --git a/library/vendor/Zend/Form/Element/Multiselect.php b/library/vendor/Zend/Form/Element/Multiselect.php new file mode 100644 index 0000000..5e94d56 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Multiselect.php @@ -0,0 +1,53 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Select */ + +/** + * Multiselect form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Multiselect extends Zend_Form_Element_Select +{ + /** + * 'multiple' attribute + * @var string + */ + public $multiple = 'multiple'; + + /** + * Use formSelect view helper by default + * @var string + */ + public $helper = 'formSelect'; + + /** + * Multiselect is an array of values by default + * @var bool + */ + protected $_isArray = true; +} diff --git a/library/vendor/Zend/Form/Element/Note.php b/library/vendor/Zend/Form/Element/Note.php new file mode 100644 index 0000000..77dee53 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Note.php @@ -0,0 +1,63 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Element to show an HTML note + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Note extends Zend_Form_Element_Xhtml +{ + /** + * Default form view helper to use for rendering + * + * @var string + */ + public $helper = 'formNote'; + + /** + * Ignore flag (used when retrieving values at form level) + * + * @var bool + */ + protected $_ignore = true; + + /** + * Validate element value (pseudo) + * + * There is no need to reset the value + * + * @param mixed $value Is always ignored + * @param mixed $context Is always ignored + * @return boolean Returns always TRUE + */ + public function isValid($value, $context = null) + { + return true; + } +} diff --git a/library/vendor/Zend/Form/Element/Password.php b/library/vendor/Zend/Form/Element/Password.php new file mode 100644 index 0000000..8d84c72 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Password.php @@ -0,0 +1,87 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Password form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Password extends Zend_Form_Element_Xhtml +{ + /** + * Use formPassword view helper by default + * @var string + */ + public $helper = 'formPassword'; + + /** + * Whether or not to render the password + * @var bool + */ + public $renderPassword = false; + + /** + * Set flag indicating whether or not to render the password + * @param bool $flag + * @return Zend_Form_Element_Password + */ + public function setRenderPassword($flag) + { + $this->renderPassword = (bool) $flag; + return $this; + } + + /** + * Get value of renderPassword flag + * + * @return bool + */ + public function renderPassword() + { + return $this->renderPassword; + } + + /** + * Override isValid() + * + * Ensure that validation error messages mask password value. + * + * @param string $value + * @param mixed $context + * @return bool + */ + public function isValid($value, $context = null) + { + foreach ($this->getValidators() as $validator) { + if ($validator instanceof Zend_Validate_Abstract) { + $validator->setObscureValue(true); + } + } + return parent::isValid($value, $context); + } +} diff --git a/library/vendor/Zend/Form/Element/Radio.php b/library/vendor/Zend/Form/Element/Radio.php new file mode 100644 index 0000000..883a00d --- /dev/null +++ b/library/vendor/Zend/Form/Element/Radio.php @@ -0,0 +1,65 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Multi */ + +/** + * Radio form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Radio extends Zend_Form_Element_Multi +{ + /** + * Use formRadio view helper by default + * @var string + */ + public $helper = 'formRadio'; + + /** + * Load default decorators + * + * Disables "for" attribute of label if label decorator enabled. + * + * @return Zend_Form_Element_Radio + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + parent::loadDefaultDecorators(); + + // Disable 'for' attribute + if (isset($this->_decorators['Label']) + && !isset($this->_decorators['Label']['options']['disableFor'])) + { + $this->_decorators['Label']['options']['disableFor'] = true; + } + + return $this; + } +} diff --git a/library/vendor/Zend/Form/Element/Reset.php b/library/vendor/Zend/Form/Element/Reset.php new file mode 100644 index 0000000..8a27805 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Reset.php @@ -0,0 +1,41 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Submit */ + +/** + * Reset form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Reset extends Zend_Form_Element_Submit +{ + /** + * Use formReset view helper by default + * @var string + */ + public $helper = 'formReset'; +} diff --git a/library/vendor/Zend/Form/Element/Select.php b/library/vendor/Zend/Form/Element/Select.php new file mode 100644 index 0000000..acf009a --- /dev/null +++ b/library/vendor/Zend/Form/Element/Select.php @@ -0,0 +1,47 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Multi */ + +/** + * Select.php form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Select extends Zend_Form_Element_Multi +{ + /** + * 'multiple' attribute + * @var string + */ + public $multiple = false; + + /** + * Use formSelect view helper by default + * @var string + */ + public $helper = 'formSelect'; +} diff --git a/library/vendor/Zend/Form/Element/Submit.php b/library/vendor/Zend/Form/Element/Submit.php new file mode 100644 index 0000000..ad564e0 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Submit.php @@ -0,0 +1,126 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Submit form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Submit extends Zend_Form_Element_Xhtml +{ + /** + * Default view helper to use + * @var string + */ + public $helper = 'formSubmit'; + + /** + * Constructor + * + * @param string|array|Zend_Config $spec Element name or configuration + * @param string|array|Zend_Config $options Element value or configuration + * @return void + */ + public function __construct($spec, $options = null) + { + if (is_string($spec) && ((null !== $options) && is_string($options))) { + $options = array('label' => $options); + } + + if (!isset($options['ignore'])) { + $options['ignore'] = true; + } + + parent::__construct($spec, $options); + } + + /** + * Return label + * + * If no label is present, returns the currently set name. + * + * If a translator is present, returns the translated label. + * + * @return string + */ + public function getLabel() + { + $value = parent::getLabel(); + + if (null === $value) { + $value = $this->getName(); + + if (null !== ($translator = $this->getTranslator())) { + return $translator->translate($value); + } + } + + return $value; + } + + /** + * Has this submit button been selected? + * + * @return bool + */ + public function isChecked() + { + $value = $this->getValue(); + + if (empty($value)) { + return false; + } + if ($value != $this->getLabel()) { + return false; + } + + return true; + } + + /** + * Default decorators + * + * Uses only 'Submit' and 'DtDdWrapper' decorators by default. + * + * @return Zend_Form_Element_Submit + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + + $decorators = $this->getDecorators(); + if (empty($decorators)) { + $this->addDecorator('Tooltip') + ->addDecorator('ViewHelper') + ->addDecorator('DtDdWrapper'); + } + return $this; + } +} diff --git a/library/vendor/Zend/Form/Element/Text.php b/library/vendor/Zend/Form/Element/Text.php new file mode 100644 index 0000000..1a99b8e --- /dev/null +++ b/library/vendor/Zend/Form/Element/Text.php @@ -0,0 +1,41 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Text form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Text extends Zend_Form_Element_Xhtml +{ + /** + * Default form view helper to use for rendering + * @var string + */ + public $helper = 'formText'; +} diff --git a/library/vendor/Zend/Form/Element/Textarea.php b/library/vendor/Zend/Form/Element/Textarea.php new file mode 100644 index 0000000..ff4ddd5 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Textarea.php @@ -0,0 +1,41 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element_Xhtml */ + +/** + * Textarea form element + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +class Zend_Form_Element_Textarea extends Zend_Form_Element_Xhtml +{ + /** + * Use formTextarea view helper by default + * @var string + */ + public $helper = 'formTextarea'; +} diff --git a/library/vendor/Zend/Form/Element/Xhtml.php b/library/vendor/Zend/Form/Element/Xhtml.php new file mode 100644 index 0000000..6ef15e9 --- /dev/null +++ b/library/vendor/Zend/Form/Element/Xhtml.php @@ -0,0 +1,36 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** Zend_Form_Element */ + +/** + * Base element for XHTML elements + * + * @category Zend + * @package Zend_Form + * @subpackage Element + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +abstract class Zend_Form_Element_Xhtml extends Zend_Form_Element +{ +} |