diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2007-09-14 17:39:18 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2007-09-14 17:39:18 +0400 |
commit | 072bada4c51bc7ec7549ebf744a5a5e424771033 (patch) | |
tree | 89025d31219423c374cc893d34137f3a9ad204eb /libs/Zend/Validate | |
parent | 5e672e15ae582ec495dd6ae79e5297c336e26afc (diff) |
Cleaned the SVN deleting useless libs
still phpdocumentor is huge... need to remove it from the releases
git-svn-id: http://dev.piwik.org/svn/trunk@81 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend/Validate')
30 files changed, 0 insertions, 3205 deletions
diff --git a/libs/Zend/Validate/Abstract.php b/libs/Zend/Validate/Abstract.php deleted file mode 100755 index a43975b452..0000000000 --- a/libs/Zend/Validate/Abstract.php +++ /dev/null @@ -1,190 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Abstract.php 5411 2007-06-22 14:08:39Z bkarwin $ - */ - -/** - * @see Zend_Validate_Interface - */ -require_once 'Zend/Validate/Interface.php'; - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Validate_Abstract implements Zend_Validate_Interface -{ - - /** - * @var mixed - */ - protected $_value; - - /** - * Additional variables available for validation failure messages - * - * @var array - */ - protected $_messageVariables = array(); - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array(); - - /** - * @var array - */ - protected $_messages = array(); - - /** - * @var array - */ - protected $_errors = array(); - - /** - * @param string $messageKey - * @param string $value - * @return string - */ - protected function _createMessage($messageKey, $value) - { - if (!isset($this->_messageTemplates[$messageKey])) { - return null; - } - - $message = $this->_messageTemplates[$messageKey]; - $message = str_replace("%value%", (string) $value, $message); - foreach ($this->_messageVariables as $ident => $property) { - $message = str_replace("%$ident%", $this->$property, $message); - } - return $message; - } - - /** - * @param string $messageKey OPTIONAL - * @param string $value OPTIONAL - * @return void - */ - protected function _error($messageKey = null, $value = null) - { - if ($messageKey === null) { - $keys = array_keys($this->_messageTemplates); - $messageKey = current($keys); - } - if ($value === null) { - $value = $this->_value; - } - $this->_errors[] = $messageKey; - $this->_messages[] = $this->_createMessage($messageKey, $value); - } - - /** - * @param mixed $value - * @return void - */ - protected function _setValue($value) - { - $this->_value = $value; - $this->_errors = array(); - $this->_messages = array(); - } - - /** - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * @return array - */ - public function getMessages() - { - return $this->_messages; - } - - /** - * @return array - */ - public function getMessageVariables() - { - return array_keys($this->_messageVariables); - } - - /** - * @param string $messageString - * @param string $messageKey OPTIONAL - * @return Zend_Validate_Abstract - * @throws Zend_Validate_Exception - */ - public function setMessage($messageString, $messageKey = null) - { - if ($messageKey === null) { - $keys = array_keys($this->_messageTemplates); - $messageKey = current($keys); - } - if (!isset($this->_messageTemplates[$messageKey])) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("No message template exists for key '$messageKey'"); - } - $this->_messageTemplates[$messageKey] = $messageString; - return $this; - } - - /** - * @param array $messages - * @return Zend_Validate_Abstract - */ - public function setMessages(array $messages) - { - foreach ($messages as $key => $message) { - $this->setMessage($message, $key); - } - return $this; - } - - /** - * @param string $property - * @return mixed - * @throws Zend_Validate_Exception - */ - public function __get($property) - { - if ($property == 'value') { - return $this->_value; - } - if (array_key_exists($property, $this->_messageVariables)) { - return $this->{$this->_messageVariables[$property]}; - } - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("No property exists by the name '$property'"); - } - -} diff --git a/libs/Zend/Validate/Alnum.php b/libs/Zend/Validate/Alnum.php deleted file mode 100755 index 6ceaf7ab8c..0000000000 --- a/libs/Zend/Validate/Alnum.php +++ /dev/null @@ -1,120 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Alnum.php 5347 2007-06-15 19:30:56Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Alnum extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value contains non-alphabetic or non-digit characters - */ - const NOT_ALNUM = 'notAlnum'; - - /** - * Validation failure message key for when the value is an empty string - */ - const STRING_EMPTY = 'stringEmpty'; - - /** - * Whether to allow white space characters; off by default - * - * @var boolean - */ - public $allowWhiteSpace; - - /** - * Alphanumeric filter used for validation - * - * @var Zend_Filter_Alnum - */ - protected static $_filter = null; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_ALNUM => "'%value%' has not only alphabetic and digit characters", - self::STRING_EMPTY => "'%value%' is an empty string" - ); - - /** - * Sets default option values for this instance - * - * @param boolean $allowWhiteSpace - * @return void - */ - public function __construct($allowWhiteSpace = false) - { - $this->allowWhiteSpace = (boolean) $allowWhiteSpace; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value contains only alphabetic and digit characters - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if ('' === $valueString) { - $this->_error(self::STRING_EMPTY); - return false; - } - - if (null === self::$_filter) { - /** - * @see Zend_Filter_Alnum - */ - require_once 'Zend/Filter/Alnum.php'; - self::$_filter = new Zend_Filter_Alnum(); - } - - self::$_filter->allowWhiteSpace = $this->allowWhiteSpace; - - if ($valueString !== self::$_filter->filter($valueString)) { - $this->_error(self::NOT_ALNUM); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Alpha.php b/libs/Zend/Validate/Alpha.php deleted file mode 100755 index 4775dba7b9..0000000000 --- a/libs/Zend/Validate/Alpha.php +++ /dev/null @@ -1,120 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Alpha.php 5347 2007-06-15 19:30:56Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Alpha extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value contains non-alphabetic characters - */ - const NOT_ALPHA = 'notAlpha'; - - /** - * Validation failure message key for when the value is an empty string - */ - const STRING_EMPTY = 'stringEmpty'; - - /** - * Whether to allow white space characters; off by default - * - * @var boolean - */ - public $allowWhiteSpace; - - /** - * Alphabetic filter used for validation - * - * @var Zend_Filter_Alpha - */ - protected static $_filter = null; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_ALPHA => "'%value%' has not only alphabetic characters", - self::STRING_EMPTY => "'%value%' is an empty string" - ); - - /** - * Sets default option values for this instance - * - * @param boolean $allowWhiteSpace - * @return void - */ - public function __construct($allowWhiteSpace = false) - { - $this->allowWhiteSpace = (boolean) $allowWhiteSpace; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value contains only alphabetic characters - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if ('' === $valueString) { - $this->_error(self::STRING_EMPTY); - return false; - } - - if (null === self::$_filter) { - /** - * @see Zend_Filter_Alpha - */ - require_once 'Zend/Filter/Alpha.php'; - self::$_filter = new Zend_Filter_Alpha(); - } - - self::$_filter->allowWhiteSpace = $this->allowWhiteSpace; - - if ($valueString !== self::$_filter->filter($valueString)) { - $this->_error(self::NOT_ALPHA); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Between.php b/libs/Zend/Validate/Between.php deleted file mode 100755 index 9f860114b0..0000000000 --- a/libs/Zend/Validate/Between.php +++ /dev/null @@ -1,200 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Between.php 5134 2007-06-06 17:54:16Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Between extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value is not between the min and max, inclusively - */ - const NOT_BETWEEN = 'notBetween'; - - /** - * Validation failure message key for when the value is not strictly between the min and max - */ - const NOT_BETWEEN_STRICT = 'notBetweenStrict'; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_BETWEEN => "'%value%' is not between '%min%' and '%max%', inclusively", - self::NOT_BETWEEN_STRICT => "'%value%' is not strictly between '%min%' and '%max%'" - ); - - /** - * Additional variables available for validation failure messages - * - * @var array - */ - protected $_messageVariables = array( - 'min' => '_min', - 'max' => '_max' - ); - - /** - * Minimum value - * - * @var mixed - */ - protected $_min; - - /** - * Maximum value - * - * @var mixed - */ - protected $_max; - - /** - * Whether to do inclusive comparisons, allowing equivalence to min and/or max - * - * If false, then strict comparisons are done, and the value may equal neither - * the min nor max options - * - * @var boolean - */ - protected $_inclusive; - - /** - * Sets validator options - * - * @param mixed $min - * @param mixed $max - * @param boolean $inclusive - * @return void - */ - public function __construct($min, $max, $inclusive = true) - { - $this->setMin($min) - ->setMax($max) - ->setInclusive($inclusive); - } - - /** - * Returns the min option - * - * @return mixed - */ - public function getMin() - { - return $this->_min; - } - - /** - * Sets the min option - * - * @param mixed $min - * @return Zend_Validate_Between Provides a fluent interface - */ - public function setMin($min) - { - $this->_min = $min; - return $this; - } - - /** - * Returns the max option - * - * @return mixed - */ - public function getMax() - { - return $this->_max; - } - - /** - * Sets the max option - * - * @param mixed $max - * @return Zend_Validate_Between Provides a fluent interface - */ - public function setMax($max) - { - $this->_max = $max; - return $this; - } - - /** - * Returns the inclusive option - * - * @return boolean - */ - public function getInclusive() - { - return $this->_inclusive; - } - - /** - * Sets the inclusive option - * - * @param boolean $inclusive - * @return Zend_Validate_Between Provides a fluent interface - */ - public function setInclusive($inclusive) - { - $this->_inclusive = $inclusive; - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is between min and max options, inclusively - * if inclusive option is true. - * - * @param mixed $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - - if ($this->_inclusive) { - if ($this->_min > $value || $value > $this->_max) { - $this->_error(self::NOT_BETWEEN); - return false; - } - } else { - if ($this->_min >= $value || $value >= $this->_max) { - $this->_error(self::NOT_BETWEEN_STRICT); - return false; - } - } - return true; - } - -} diff --git a/libs/Zend/Validate/Ccnum.php b/libs/Zend/Validate/Ccnum.php deleted file mode 100755 index 276dd5141b..0000000000 --- a/libs/Zend/Validate/Ccnum.php +++ /dev/null @@ -1,111 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ccnum.php 5134 2007-06-06 17:54:16Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Ccnum extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value is not of valid length - */ - const LENGTH = 'ccnumLength'; - - /** - * Validation failure message key for when the value fails the mod-10 checksum - */ - const CHECKSUM = 'ccnumChecksum'; - - /** - * Digits filter for input - * - * @var Zend_Filter_Digits - */ - protected static $_filter = null; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::LENGTH => "'%value%' must contain between 13 and 19 digits", - self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum) - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - - if (null === self::$_filter) { - /** - * @see Zend_Filter_Digits - */ - require_once 'Zend/Filter/Digits.php'; - self::$_filter = new Zend_Filter_Digits(); - } - - $valueFiltered = self::$_filter->filter($value); - - $length = strlen($valueFiltered); - - if ($length < 13 || $length > 19) { - $this->_error(self::LENGTH); - return false; - } - - $sum = 0; - $weight = 2; - - for ($i = $length - 2; $i >= 0; $i--) { - $digit = $weight * $valueFiltered[$i]; - $sum += floor($digit / 10) + $digit % 10; - $weight = $weight % 2 + 1; - } - - if ((10 - $sum % 10) % 10 != $valueFiltered[$length - 1]) { - $this->_error(self::CHECKSUM, $valueFiltered); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Date.php b/libs/Zend/Validate/Date.php deleted file mode 100755 index 1d11d11f45..0000000000 --- a/libs/Zend/Validate/Date.php +++ /dev/null @@ -1,87 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Date.php 5134 2007-06-06 17:54:16Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Date extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value does not follow the YYYY-MM-DD format - */ - const NOT_YYYY_MM_DD = 'dateNotYYYY-MM-DD'; - - /** - * Validation failure message key for when the value does not appear to be a valid date - */ - const INVALID = 'dateInvalid'; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_YYYY_MM_DD => "'%value%' is not of the format YYYY-MM-DD", - self::INVALID => "'%value%' does not appear to be a valid date" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is a valid date of the format YYYY-MM-DD - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if (!preg_match('/\d{4}-\d{2}-\d{2}/', $valueString)) { - $this->_error(self::NOT_YYYY_MM_DD); - return false; - } - - list($year, $month, $day) = sscanf($valueString, '%d-%d-%d'); - - if (!checkdate($month, $day, $year)) { - $this->_error(self::INVALID); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Digits.php b/libs/Zend/Validate/Digits.php deleted file mode 100755 index 8fac652708..0000000000 --- a/libs/Zend/Validate/Digits.php +++ /dev/null @@ -1,100 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Digits.php 5159 2007-06-07 18:23:05Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Digits extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value contains non-digit characters - */ - const NOT_DIGITS = 'notDigits'; - - /** - * Validation failure message key for when the value is an empty string - */ - const STRING_EMPTY = 'stringEmpty'; - - /** - * Digits filter used for validation - * - * @var Zend_Filter_Digits - */ - protected static $_filter = null; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_DIGITS => "'%value%' contains not only digit characters", - self::STRING_EMPTY => "'%value%' is an empty string" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value only contains digit characters - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if ('' === $valueString) { - $this->_error(self::STRING_EMPTY); - return false; - } - - if (null === self::$_filter) { - /** - * @see Zend_Filter_Digits - */ - require_once 'Zend/Filter/Digits.php'; - self::$_filter = new Zend_Filter_Digits(); - } - - if ($valueString !== self::$_filter->filter($valueString)) { - $this->_error(self::NOT_DIGITS); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/EmailAddress.php b/libs/Zend/Validate/EmailAddress.php deleted file mode 100755 index d5566bf91b..0000000000 --- a/libs/Zend/Validate/EmailAddress.php +++ /dev/null @@ -1,250 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: EmailAddress.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @see Zend_Validate_Hostname - */ -require_once 'Zend/Validate/Hostname.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_EmailAddress extends Zend_Validate_Abstract -{ - - const INVALID = 'emailAddressInvalid'; - const INVALID_HOSTNAME = 'emailAddressInvalidHostname'; - const INVALID_MX_RECORD = 'emailAddressInvalidMxRecord'; - const DOT_ATOM = 'emailAddressDotAtom'; - const QUOTED_STRING = 'emailAddressQuotedString'; - const INVALID_LOCAL_PART = 'emailAddressInvalidLocalPart'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::INVALID => "'%value%' is not a valid email address in the basic format local-part@hostname", - self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", - self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", - self::DOT_ATOM => "'%localpart%' not matched against dot-atom format", - self::QUOTED_STRING => "'%localpart%' not matched against quoted-string format", - self::INVALID_LOCAL_PART => "'%localpart%' is not a valid local part for email address '%value%'" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'hostname' => '_hostname', - 'localPart' => '_localPart' - ); - - /** - * Local object for validating the hostname part of an email address - * - * @var Zend_Validate_Hostname - */ - public $hostnameValidator; - - /** - * Whether we check for a valid MX record via DNS - * - * @var boolean - */ - protected $_validateMx = false; - - /** - * @var string - */ - protected $_hostname; - - /** - * @var string - */ - protected $_localPart; - - /** - * Instantiates hostname validator for local use - * - * You can pass a bitfield to determine what types of hostnames are allowed. - * These bitfields are defined by the ALLOW_* constants in Zend_Validate_Hostname - * The default is to allow DNS hostnames only - * - * @param integer $allow OPTIONAL - * @param bool $validateMx OPTIONAL - * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL - * @return void - */ - public function __construct($allow = Zend_Validate_Hostname::ALLOW_DNS, $validateMx = false, Zend_Validate_Hostname $hostnameValidator = null) - { - $this->setValidateMx($validateMx); - $this->setHostnameValidator($hostnameValidator, $allow); - } - - /** - * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL - * @param int $allow OPTIONAL - * @return void - */ - public function setHostnameValidator(Zend_Validate_Hostname $hostnameValidator = null, $allow = Zend_Validate_Hostname::ALLOW_DNS) - { - if ($hostnameValidator === null) { - $hostnameValidator = new Zend_Validate_Hostname($allow); - } - $this->hostnameValidator = $hostnameValidator; - } - - /** - * Whether MX checking via dns_get_mx is supported or not - * - * This currently only works on UNIX systems - * - * @return boolean - */ - public function validateMxSupported() - { - return function_exists('dns_get_mx'); - } - - /** - * Set whether we check for a valid MX record via DNS - * - * This only applies when DNS hostnames are validated - * - * @param boolean $allowed Set allowed to true to validate for MX records, and false to not validate them - */ - public function setValidateMx($allowed) - { - $this->_validateMx = (bool) $allowed; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is a valid email address - * according to RFC2822 - * - * @link http://www.ietf.org/rfc/rfc2822.txt RFC2822 - * @link http://www.columbia.edu/kermit/ascii.html US-ASCII characters - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - // Split email address up - if (!preg_match('/^(.+)@([^@]+)$/', $valueString, $matches)) { - $this->_error(self::INVALID); - return false; - } - - $this->_localPart = $matches[1]; - $this->_hostname = $matches[2]; - - // Match hostname part - $hostnameResult = $this->hostnameValidator->isValid($this->_hostname); - if (!$hostnameResult) { - $this->_error(self::INVALID_HOSTNAME); - - // Get messages and errors from hostnameValidator - foreach ($this->hostnameValidator->getMessages() as $message) { - $this->_messages[] = $message; - } - foreach ($this->hostnameValidator->getErrors() as $error) { - $this->_errors[] = $error; - } - } - - // MX check on hostname via dns_get_record() - if ($this->_validateMx) { - if ($this->validateMxSupported()) { - $result = dns_get_mx($this->_hostname, $mxHosts); - if (count($mxHosts) < 1) { - $hostnameResult = false; - $this->_error(self::INVALID_MX_RECORD); - } - } else { - /** - * MX checks are not supported by this system - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Internal error: MX checking not available on this system'); - } - } - - // First try to match the local part on the common dot-atom format - $localResult = false; - - // Dot-atom characters are: 1*atext *("." 1*atext) - // atext: ALPHA / DIGIT / and "!", "#", "$", "%", "&", "'", "*", - // "-", "/", "=", "?", "^", "_", "`", "{", "|", "}", "~" - $atext = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d'; - if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->_localPart)) { - $localResult = true; - } else { - $this->_error(self::DOT_ATOM); - } - - // If not matched, try quoted string format - if (!$localResult) { - - // Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE - // qtext: Non white space controls, and the rest of the US-ASCII characters not - // including "\" or the quote character - $noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f'; - $qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e'; - $ws = '\x20\x09'; - if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->_localPart)) { - $localResult = true; - } else { - $this->_error(self::QUOTED_STRING); - } - } - - if (!$localResult) { - $this->_error(self::INVALID_LOCAL_PART); - } - - // If both parts valid, return true - if ($localResult && $hostnameResult) { - return true; - } else { - return false; - } - } - -} diff --git a/libs/Zend/Validate/Exception.php b/libs/Zend/Validate/Exception.php deleted file mode 100755 index 6bc3c536d3..0000000000 --- a/libs/Zend/Validate/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Exception.php 3278 2007-02-07 21:54:50Z darby $ - */ - - -/** - * @see Zend_Exception - */ -require_once 'Zend/Exception.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Exception extends Zend_Exception -{} diff --git a/libs/Zend/Validate/Float.php b/libs/Zend/Validate/Float.php deleted file mode 100755 index f42b25bf9a..0000000000 --- a/libs/Zend/Validate/Float.php +++ /dev/null @@ -1,75 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Float.php 5229 2007-06-11 20:19:01Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Float extends Zend_Validate_Abstract -{ - - const NOT_FLOAT = 'notFloat'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_FLOAT => "'%value%' does not appear to be a float" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is a floating-point value - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - $locale = localeconv(); - - $valueFiltered = str_replace($locale['decimal_point'], '.', $valueString); - $valueFiltered = str_replace($locale['thousands_sep'], '', $valueFiltered); - - if (strval(floatval($valueFiltered)) != $valueFiltered) { - $this->_error(); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/GreaterThan.php b/libs/Zend/Validate/GreaterThan.php deleted file mode 100755 index a43d4cc34c..0000000000 --- a/libs/Zend/Validate/GreaterThan.php +++ /dev/null @@ -1,114 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: GreaterThan.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_GreaterThan extends Zend_Validate_Abstract -{ - - const NOT_GREATER = 'notGreaterThan'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_GREATER => "'%value%' is not greater than '%min%'" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'min' => '_min' - ); - - /** - * Minimum value - * - * @var mixed - */ - protected $_min; - - /** - * Sets validator options - * - * @param mixed $min - * @return void - */ - public function __construct($min) - { - $this->setMin($min); - } - - /** - * Returns the min option - * - * @return mixed - */ - public function getMin() - { - return $this->_min; - } - - /** - * Sets the min option - * - * @param mixed $min - * @return Zend_Validate_GreaterThan Provides a fluent interface - */ - public function setMin($min) - { - $this->_min = $min; - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is greater than min option - * - * @param mixed $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - - if ($this->_min >= $value) { - $this->_error(); - return false; - } - return true; - } - -} diff --git a/libs/Zend/Validate/Hex.php b/libs/Zend/Validate/Hex.php deleted file mode 100755 index 09eb6f2e87..0000000000 --- a/libs/Zend/Validate/Hex.php +++ /dev/null @@ -1,74 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hex.php 5134 2007-06-06 17:54:16Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Hex extends Zend_Validate_Abstract -{ - /** - * Validation failure message key for when the value contains characters other than hexadecimal digits - */ - const NOT_HEX = 'notHex'; - - /** - * Validation failure message template definitions - * - * @var array - */ - protected $_messageTemplates = array( - self::NOT_HEX => "'%value%' has not only hexadecimal digit characters" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value contains only hexadecimal digit characters - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if (!ctype_xdigit($valueString)) { - $this->_error(); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Hostname.php b/libs/Zend/Validate/Hostname.php deleted file mode 100755 index 9902e69522..0000000000 --- a/libs/Zend/Validate/Hostname.php +++ /dev/null @@ -1,444 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hostname.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - -/** - * @see Zend_Validate_Ip - */ -require_once 'Zend/Validate/Ip.php'; - -/** - * Please note there are two standalone test scripts for testing IDN characters due to problems - * with file encoding. - * - * The first is tests/Zend/Validate/HostnameTestStandalone.php which is designed to be run on - * the command line. - * - * The second is tests/Zend/Validate/HostnameTestForm.php which is designed to be run via HTML - * to allow users to test entering UTF-8 characters in a form. - * - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Hostname extends Zend_Validate_Abstract -{ - - const IP_ADDRESS_NOT_ALLOWED = 'hostnameIpAddressNotAllowed'; - const UNKNOWN_TLD = 'hostnameUnknownTld'; - const INVALID_DASH = 'hostnameDashCharacter'; - const INVALID_HOSTNAME_SCHEMA = 'hostnameInvalidHostnameSchema'; - const UNDECIPHERABLE_TLD = 'hostnameUndecipherableTld'; - const INVALID_HOSTNAME = 'hostnameInvalidHostname'; - const INVALID_LOCAL_NAME = 'hostnameInvalidLocalName'; - const LOCAL_NAME_NOT_ALLOWED = 'hostnameLocalNameNotAllowed'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::IP_ADDRESS_NOT_ALLOWED => "'%value%' appears to be an IP address, but IP addresses are not allowed", - self::UNKNOWN_TLD => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", - self::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position", - self::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", - self::UNDECIPHERABLE_TLD => "'%value%' appears to be a DNS hostname but cannot extract TLD part", - self::INVALID_HOSTNAME => "'%value%' does not match the expected structure for a DNS hostname", - self::INVALID_LOCAL_NAME => "'%value%' does not appear to be a valid local network name", - self::LOCAL_NAME_NOT_ALLOWED => "'%value%' appears to be a local network name but but local network names are not allowed" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'tld' => '_tld' - ); - - /** - * Allows Internet domain names (e.g., example.com) - */ - const ALLOW_DNS = 1; - - /** - * Allows IP addresses - */ - const ALLOW_IP = 2; - - /** - * Allows local network names (e.g., localhost, www.localdomain) - */ - const ALLOW_LOCAL = 4; - - /** - * Allows all types of hostnames - */ - const ALLOW_ALL = 7; - - /** - * Whether IDN domains are validated - * - * @var boolean - */ - private $_validateIdn = true; - - /** - * Whether TLDs are validated against a known list - * - * @var boolean - */ - private $_validateTld = true; - - /** - * Bit field of ALLOW constants; determines which types of hostnames are allowed - * - * @var integer - */ - protected $_allow; - - /** - * Bit field of CHECK constants; determines what additional hostname checks to make - * - * @var unknown_type - */ - // protected $_check; - - /** - * Array of valid top-level-domains - * - * @var array - * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain - */ - protected $_validTlds = array( - 'ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', - 'aq', 'ar', 'arpa', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', - 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'biz', 'bj', 'bm', 'bn', 'bo', - 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc', 'cd', - 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop', - 'cr', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', - 'dz', 'ec', 'edu', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', - 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', - 'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', - 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', - 'im', 'in', 'info', 'int', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', - 'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kr', 'kw', - 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', - 'lv', 'ly', 'ma', 'mc', 'md', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm', - 'mn', 'mo', 'mobi', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', - 'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc', 'ne', 'net', 'nf', 'ng', - 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe', - 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt', - 'pw', 'py', 'qa', 're', 'ro', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', - 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', - 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', - 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw', - 'tz', 'ua', 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', - 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'yu', 'za', 'zm', - 'zw' - ); - - /** - * @var string - */ - protected $_tld; - - /** - * Sets validator options - * - * @param integer $allow OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) - * @param boolean $validateIdn OPTIONAL Set whether IDN domains are validated (default true) - * @param boolean $validateTld OPTIONAL Set whether the TLD element of a hostname is validated (default true) - * @param Zend_Validate_Ip $ipValidator OPTIONAL - * @return void - * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs - */ - public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = true, Zend_Validate_Ip $ipValidator = null) - { - // Set allow options - $this->setAllow($allow); - - // Set validation options - $this->_validateIdn = $validateIdn; - $this->_validateTld = $validateTld; - - $this->setIpValidator($ipValidator); - } - - /** - * @param Zend_Validate_Ip $ipValidator OPTIONAL - * @return void; - */ - public function setIpValidator(Zend_Validate_Ip $ipValidator = null) - { - if ($ipValidator === null) { - $ipValidator = new Zend_Validate_Ip(); - } - $this->_ipValidator = $ipValidator; - } - - /** - * Returns the allow option - * - * @return integer - */ - public function getAllow() - { - return $this->_allow; - } - - /** - * Sets the allow option - * - * @param integer $allow - * @return Zend_Validate_Hostname Provides a fluent interface - */ - public function setAllow($allow) - { - $this->_allow = $allow; - return $this; - } - - /** - * Set whether IDN domains are validated - * - * This only applies when DNS hostnames are validated - * - * @param boolean $allowed Set allowed to true to validate IDNs, and false to not validate them - */ - public function setValidateIdn ($allowed) - { - $this->_validateIdn = (bool) $allowed; - } - - /** - * Set whether the TLD element of a hostname is validated - * - * This only applies when DNS hostnames are validated - * - * @param boolean $allowed Set allowed to true to validate TLDs, and false to not validate them - */ - public function setValidateTld ($allowed) - { - $this->_validateTld = (bool) $allowed; - } - - /** - * Sets the check option - * - * @param integer $check - * @return Zend_Validate_Hostname Provides a fluent interface - */ - /* - public function setCheck($check) - { - $this->_check = $check; - return $this; - } - */ - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if the $value is a valid hostname with respect to the current allow option - * - * @param string $value - * @throws Zend_Validate_Exception if a fatal error occurs for validation process - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - // Check input against IP address schema - if ($this->_ipValidator->isValid($valueString)) { - if (!($this->_allow & self::ALLOW_IP)) { - $this->_error(self::IP_ADDRESS_NOT_ALLOWED); - return false; - } else{ - return true; - } - } - - // Check input against DNS hostname schema - $domainParts = explode('.', $valueString); - if ((count($domainParts) > 1) && (strlen($valueString) >= 4) && (strlen($valueString) <= 254)) { - $status = false; - - do { - // First check TLD - if (preg_match('/([a-z]{2,10})$/i', end($domainParts), $matches)) { - - reset($domainParts); - - // Hostname characters are: *(label dot)(label dot label); max 254 chars - // label: id-prefix [*ldh{61} id-prefix]; max 63 chars - // id-prefix: alpha / digit - // ldh: alpha / digit / dash - - // Match TLD against known list - $this->_tld = strtolower($matches[1]); - if ($this->_validateTld) { - if (!in_array($this->_tld, $this->_validTlds)) { - $this->_error(self::UNKNOWN_TLD); - $status = false; - break; - } - } - - /** - * Match against IDN hostnames - * @see Zend_Validate_Hostname_Interface - */ - $labelChars = 'a-z0-9'; - $utf8 = false; - $classFile = 'Zend/Validate/Hostname/' . ucfirst($this->_tld) . '.php'; - if ($this->_validateIdn) { - if (Zend_Loader::isReadable($classFile)) { - - // Load additional characters - $className = 'Zend_Validate_Hostname_' . ucfirst($this->_tld); - Zend_Loader::loadClass($className); - $labelChars .= call_user_func(array($className, 'getCharacters')); - $utf8 = true; - } - } - - // Keep label regex short to avoid issues with long patterns when matching IDN hostnames - $regexLabel = '/^[' . $labelChars . '\x2d]{1,63}$/i'; - if ($utf8) { - $regexLabel .= 'u'; - } - - // Check each hostname part - $valid = true; - foreach ($domainParts as $domainPart) { - - // Check dash (-) does not start, end or appear in 3rd and 4th positions - if (strpos($domainPart, '-') === 0 || - (strlen($domainPart) > 2 && strpos($domainPart, '-', 2) == 2 && strpos($domainPart, '-', 3) == 3) || - strrpos($domainPart, '-') === strlen($domainPart) - 1) { - - $this->_error(self::INVALID_DASH); - $status = false; - break 2; - } - - // Check each domain part - $status = @preg_match($regexLabel, $domainPart); - if ($status === false) { - /** - * Regex error - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Internal error: DNS validation failed'); - } elseif ($status === 0) { - $valid = false; - } - } - - // If all labels didn't match, the hostname is invalid - if (!$valid) { - $this->_error(self::INVALID_HOSTNAME_SCHEMA); - $status = false; - } - - } else { - // Hostname not long enough - $this->_error(self::UNDECIPHERABLE_TLD); - $status = false; - } - } while (false); - - // If the input passes as an Internet domain name, and domain names are allowed, then the hostname - // passes validation - if ($status && ($this->_allow & self::ALLOW_DNS)) { - return true; - } - } else { - $this->_error(self::INVALID_HOSTNAME); - } - - // Check input against local network name schema; last chance to pass validation - $regexLocal = "/^(([a-zA-Z0-9\x2d]{1,63}\x2e)*[a-zA-Z0-9\x2d]{1,63}){1,254}$/"; - $status = @preg_match($regexLocal, $valueString); - if (false === $status) { - /** - * Regex error - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Internal error: local network name validation failed'); - } - - // If the input passes as a local network name, and local network names are allowed, then the - // hostname passes validation - $allowLocal = $this->_allow & self::ALLOW_LOCAL; - if ($status && $allowLocal) { - return true; - } - - // If the input does not pass as a local network name, add a message - if (!$status) { - $this->_error(self::INVALID_LOCAL_NAME); - } - - // If local network names are not allowed, add a message - if (!$allowLocal) { - $this->_error(self::LOCAL_NAME_NOT_ALLOWED); - } - - return false; - } - - /** - * Throws an exception if a regex for $type does not exist - * - * @param string $type - * @throws Zend_Validate_Exception - * @return Zend_Validate_Hostname Provides a fluent interface - */ - /* - protected function _checkRegexType($type) - { - if (!isset($this->_regex[$type])) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("'$type' must be one of ('" . implode(', ', array_keys($this->_regex)) - . "')"); - } - return $this; - } - */ - -} diff --git a/libs/Zend/Validate/Hostname/At.php b/libs/Zend/Validate/Hostname/At.php deleted file mode 100755 index 2965cbd16d..0000000000 --- a/libs/Zend/Validate/Hostname/At.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: At.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_At implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.nic.at/en/service/technical_information/idn/charset_converter/ Austria (.AT)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00EO}-\x{00F6}\x{00F8}-\x{00FF}\x{0153}\x{0161}\x{017E}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/Ch.php b/libs/Zend/Validate/Hostname/Ch.php deleted file mode 100755 index 64ec38de49..0000000000 --- a/libs/Zend/Validate/Hostname/Ch.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Ch.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_Ch implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 Switzerland (.CH)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00EO}-\x{00F6}\x{00F8}-\x{00FF}\x{0153}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/De.php b/libs/Zend/Validate/Hostname/De.php deleted file mode 100755 index d01472fefd..0000000000 --- a/libs/Zend/Validate/Hostname/De.php +++ /dev/null @@ -1,58 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: De.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_De implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.denic.de/en/domains/idns/liste.html Germany (.DE) alllowed characters
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00E1}\x{00E0}\x{0103}\x{00E2}\x{00E5}\x{00E4}\x{00E3}\x{0105}\x{0101}\x{00E6}\x{0107}' .
- '\x{0109}\x{010D}\x{010B}\x{00E7}\x{010F}\x{0111}\x{00E9}\x{00E8}\x{0115}\x{00EA}\x{011B}' .
- '\x{00EB}\x{0117}\x{0119}\x{0113}\x{011F}\x{011D}\x{0121}\x{0123}\x{0125}\x{0127}\x{00ED}' .
- '\x{00EC}\x{012D}\x{00EE}\x{00EF}\x{0129}\x{012F}\x{012B}\x{0131}\x{0135}\x{0137}\x{013A}' .
- '\x{013E}\x{013C}\x{0142}\x{0144}\x{0148}\x{00F1}\x{0146}\x{014B}\x{00F3}\x{00F2}\x{014F}' .
- '\x{00F4}\x{00F6}\x{0151}\x{00F5}\x{00F8}\x{014D}\x{0153}\x{0138}\x{0155}\x{0159}\x{0157}' .
- '\x{015B}\x{015D}\x{0161}\x{015F}\x{0165}\x{0163}\x{0167}\x{00FA}\x{00F9}\x{016D}\x{00FB}' .
- '\x{016F}\x{00FC}\x{0171}\x{0169}\x{0173}\x{016B}\x{0175}\x{00FD}\x{0177}\x{00FF}\x{017A}' .
- '\x{017E}\x{017C}\x{00F0}\x{00FE}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/Fi.php b/libs/Zend/Validate/Hostname/Fi.php deleted file mode 100755 index d88d1d1cff..0000000000 --- a/libs/Zend/Validate/Hostname/Fi.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Fi.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_Fi implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.ficora.fi/en/index/palvelut/fiverkkotunnukset/aakkostenkaytto.html Finland (.FI)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00E5}\x{00E4}\x{00F6}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/Hu.php b/libs/Zend/Validate/Hostname/Hu.php deleted file mode 100755 index 23c80bd4a4..0000000000 --- a/libs/Zend/Validate/Hostname/Hu.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Hu.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_Hu implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.domain.hu/domain/English/szabalyzat.html Hungary (.HU)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00E1}\x{00E9}\x{00ED}\x{00F3}\x{00F6}\x{0151}\x{00FA}\x{00FC}\x{0171}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/Interface.php b/libs/Zend/Validate/Hostname/Interface.php deleted file mode 100755 index 71f9b903b5..0000000000 --- a/libs/Zend/Validate/Hostname/Interface.php +++ /dev/null @@ -1,52 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 4011 2007-03-16 08:46:49Z studio24 $ - */ - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -interface Zend_Validate_Hostname_Interface -{ - - /** - * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain - * - * UTF-8 characters should be written as four character hex codes \x{XXXX} - * For example é (lowercase e with acute) is represented by the hex code \x{00E9} - * - * You only need to include lower-case equivalents of characters since the hostname - * check is case-insensitive - * - * Please document the supported TLDs in the documentation file at: - * manual/en/module_specs/Zend_Validate-Hostname.xml - * - * @see http://en.wikipedia.org/wiki/Internationalized_domain_name - * @see http://www.iana.org/cctld/ Country-Code Top-Level Domains (TLDs) - * @see http://www.columbia.edu/kermit/utf8-t1.html UTF-8 characters - * @return string - */ - static function getCharacters(); - -}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/Li.php b/libs/Zend/Validate/Hostname/Li.php deleted file mode 100755 index e6446dfcaf..0000000000 --- a/libs/Zend/Validate/Hostname/Li.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Li.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_Li implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 Liechtenstein (.LI)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00EO}-\x{00F6}\x{00F8}-\x{00FF}\x{0153}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/Hostname/No.php b/libs/Zend/Validate/Hostname/No.php deleted file mode 100755 index ed638a825d..0000000000 --- a/libs/Zend/Validate/Hostname/No.php +++ /dev/null @@ -1,52 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: No.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_No implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html Norway (.NO)
- * @return string
- */
- static function getCharacters()
- {
- return '\x00E1\x00E0\x00E4\x010D\x00E7\x0111\x00E9\x00E8\x00EA\x\x014B' .
- '\x0144\x00F1\x00F3\x00F2\x00F4\x00F6\x0161\x0167\x00FC\x017E\x00E6' .
- '\x00F8\x00E5';
- }
-
-}
diff --git a/libs/Zend/Validate/Hostname/Se.php b/libs/Zend/Validate/Hostname/Se.php deleted file mode 100755 index a60144f0ed..0000000000 --- a/libs/Zend/Validate/Hostname/Se.php +++ /dev/null @@ -1,50 +0,0 @@ -<?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_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Se.php 4011 2007-03-16 08:46:49Z studio24 $
- */
-
-
-/**
- * @see Zend_Validate_Hostname_Interface
- */
-require_once 'Zend/Validate/Hostname/Interface.php';
-
-
-/**
- * @category Zend
- * @package Zend_Validate
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Validate_Hostname_Se implements Zend_Validate_Hostname_Interface
-{
-
- /**
- * Returns UTF-8 characters allowed in DNS hostnames for the specified Top-Level-Domain
- *
- * @see http://www.iis.se/english/IDN_campaignsite.shtml?lang=en Sweden (.SE)
- * @return string
- */
- static function getCharacters()
- {
- return '\x{00E5}\x{00E4}\x{00F6}\x{00FC}\x{00E9}';
- }
-
-}
\ No newline at end of file diff --git a/libs/Zend/Validate/InArray.php b/libs/Zend/Validate/InArray.php deleted file mode 100755 index 02044d3aaa..0000000000 --- a/libs/Zend/Validate/InArray.php +++ /dev/null @@ -1,138 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: InArray.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_InArray extends Zend_Validate_Abstract -{ - - const NOT_IN_ARRAY = 'notInArray'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_IN_ARRAY => "'%value%' was not found in the haystack" - ); - - /** - * Haystack of possible values - * - * @var array - */ - protected $_haystack; - - /** - * Whether a strict in_array() invocation is used - * - * @var boolean - */ - protected $_strict; - - /** - * Sets validator options - * - * @param array $haystack - * @param boolean $strict - * @return void - */ - public function __construct(array $haystack, $strict = false) - { - $this->setHaystack($haystack) - ->setStrict($strict); - } - - /** - * Returns the haystack option - * - * @return mixed - */ - public function getHaystack() - { - return $this->_haystack; - } - - /** - * Sets the haystack option - * - * @param mixed $haystack - * @return Zend_Validate_InArray Provides a fluent interface - */ - public function setHaystack(array $haystack) - { - $this->_haystack = $haystack; - return $this; - } - - /** - * Returns the strict option - * - * @return boolean - */ - public function getStrict() - { - return $this->_strict; - } - - /** - * Sets the strict option - * - * @param boolean $strict - * @return Zend_Validate_InArray Provides a fluent interface - */ - public function setStrict($strict) - { - $this->_strict = $strict; - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is contained in the haystack option. If the strict - * option is true, then the type of $value is also checked. - * - * @param mixed $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - if (!in_array($value, $this->_haystack, $this->_strict)) { - $this->_error(); - return false; - } - return true; - } - -} diff --git a/libs/Zend/Validate/Int.php b/libs/Zend/Validate/Int.php deleted file mode 100755 index dc1d7de831..0000000000 --- a/libs/Zend/Validate/Int.php +++ /dev/null @@ -1,75 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Int.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Int extends Zend_Validate_Abstract -{ - - const NOT_INT = 'notInt'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_INT => "'%value%' does not appear to be an integer" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is a valid integer - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - $locale = localeconv(); - - $valueFiltered = str_replace($locale['decimal_point'], '.', $valueString); - $valueFiltered = str_replace($locale['thousands_sep'], '', $valueFiltered); - - if (strval(intval($valueFiltered)) != $valueFiltered) { - $this->_error(); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Interface.php b/libs/Zend/Validate/Interface.php deleted file mode 100755 index 23ac3e0fa8..0000000000 --- a/libs/Zend/Validate/Interface.php +++ /dev/null @@ -1,67 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Interface.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -interface Zend_Validate_Interface -{ - /** - * Returns true if and only if $value meets the validation requirements - * - * If $value fails validation, then this method returns false, and - * $messages will contain an array of messages that explain why the - * validation failed. - * - * @param mixed $value - * @return boolean - * @throws Zend_Valid_Exception If validation of $value is impossible - */ - public function isValid($value); - - /** - * Returns an array of messages that explain why a previous isValid() - * call returned false. - * - * If isValid() was never called or if the most recent isValid() call - * returned true, then this method returns an empty array. - * - * @return array - */ - public function getMessages(); - - /** - * Returns an array of errors that explain why a previous isValid() call - * returned false. - * - * If isValid() was never called or if the most recent isValid() call - * returned true, then this method returns an empty array. - * - * @return array - */ - public function getErrors(); - -} diff --git a/libs/Zend/Validate/Ip.php b/libs/Zend/Validate/Ip.php deleted file mode 100755 index 8094296caa..0000000000 --- a/libs/Zend/Validate/Ip.php +++ /dev/null @@ -1,70 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Ip.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Ip extends Zend_Validate_Abstract -{ - - const NOT_IP_ADDRESS = 'notIpAddress'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_IP_ADDRESS => "'%value%' does not appear to be a valid IP address" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is a valid IP address - * - * @param mixed $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if (!ip2long($valueString)) { - $this->_error(); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/LessThan.php b/libs/Zend/Validate/LessThan.php deleted file mode 100755 index 6b8a72f8fb..0000000000 --- a/libs/Zend/Validate/LessThan.php +++ /dev/null @@ -1,113 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: LessThan.php 5152 2007-06-07 14:19:06Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_LessThan extends Zend_Validate_Abstract -{ - - const NOT_LESS = 'notLessThan'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_LESS => "'%value%' is not less than '%max%'" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'max' => '_max' - ); - - /** - * Maximum value - * - * @var mixed - */ - protected $_max; - - /** - * Sets validator options - * - * @param mixed $max - * @return void - */ - public function __construct($max) - { - $this->setMax($max); - } - - /** - * Returns the max option - * - * @return mixed - */ - public function getMax() - { - return $this->_max; - } - - /** - * Sets the max option - * - * @param mixed $max - * @return Zend_Validate_LessThan Provides a fluent interface - */ - public function setMax($max) - { - $this->_max = $max; - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is less than max option - * - * @param mixed $value - * @return boolean - */ - public function isValid($value) - { - $this->_setValue($value); - if ($this->_max <= $value) { - $this->_error(); - return false; - } - return true; - } - -} diff --git a/libs/Zend/Validate/NotEmpty.php b/libs/Zend/Validate/NotEmpty.php deleted file mode 100755 index 9b3b06c2ca..0000000000 --- a/libs/Zend/Validate/NotEmpty.php +++ /dev/null @@ -1,70 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: NotEmpty.php 5134 2007-06-06 17:54:16Z darby $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_NotEmpty extends Zend_Validate_Abstract -{ - - const IS_EMPTY = 'isEmpty'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::IS_EMPTY => "Value is empty, but a non-empty value is required" - ); - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value is not an empty value. - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - if (empty($value)) { - $this->_error(); - return false; - } - - return true; - } - -} diff --git a/libs/Zend/Validate/Regex.php b/libs/Zend/Validate/Regex.php deleted file mode 100755 index 61a92698ff..0000000000 --- a/libs/Zend/Validate/Regex.php +++ /dev/null @@ -1,125 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Regex.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_Regex extends Zend_Validate_Abstract -{ - - const NOT_MATCH = 'regexNotMatch'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::NOT_MATCH => "'%value%' does not match against pattern '%pattern%'" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'pattern' => '_pattern' - ); - - /** - * Regular expression pattern - * - * @var string - */ - protected $_pattern; - - /** - * Sets validator options - * - * @param string $pattern - * @return void - */ - public function __construct($pattern) - { - $this->setPattern($pattern); - } - - /** - * Returns the pattern option - * - * @return string - */ - public function getPattern() - { - return $this->_pattern; - } - - /** - * Sets the pattern option - * - * @param string $pattern - * @return Zend_Validate_Regex Provides a fluent interface - */ - public function setPattern($pattern) - { - $this->_pattern = (string) $pattern; - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if $value matches against the pattern option - * - * @param string $value - * @throws Zend_Validate_Exception if there is a fatal error in pattern matching - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - - $this->_setValue($valueString); - - $status = @preg_match($this->_pattern, $valueString); - if (false === $status) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Internal error matching pattern '$this->_pattern' against value '$valueString'"); - } - if (!$status) { - $this->_error(); - return false; - } - return true; - } - -} diff --git a/libs/Zend/Validate/StringLength.php b/libs/Zend/Validate/StringLength.php deleted file mode 100755 index 5f96068c11..0000000000 --- a/libs/Zend/Validate/StringLength.php +++ /dev/null @@ -1,163 +0,0 @@ -<?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_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: StringLength.php 4974 2007-05-25 21:11:56Z bkarwin $ - */ - - -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - - -/** - * @category Zend - * @package Zend_Validate - * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Validate_StringLength extends Zend_Validate_Abstract -{ - - const TOO_SHORT = 'stringLengthTooShort'; - const TOO_LONG = 'stringLengthTooLong'; - - /** - * @var array - */ - protected $_messageTemplates = array( - self::TOO_SHORT => "'%value%' is less than %min% characters long", - self::TOO_LONG => "'%value%' is greater than %max% characters long" - ); - - /** - * @var array - */ - protected $_messageVariables = array( - 'min' => '_min', - 'max' => '_max' - ); - - /** - * Minimum length - * - * @var integer - */ - protected $_min; - - /** - * Maximum length - * - * If null, there is no maximum length - * - * @var integer|null - */ - protected $_max; - - /** - * Sets validator options - * - * @param integer $min - * @param integer $max - * @return void - */ - public function __construct($min = 0, $max = null) - { - $this->setMin($min); - $this->setMax($max); - } - - /** - * Returns the min option - * - * @return integer - */ - public function getMin() - { - return $this->_min; - } - - /** - * Sets the min option - * - * @param integer $min - * @return Zend_Validate_StringLength Provides a fluent interface - */ - public function setMin($min) - { - $this->_min = max(0, (integer) $min); - return $this; - } - - /** - * Returns the max option - * - * @return integer|null - */ - public function getMax() - { - return $this->_max; - } - - /** - * Sets the max option - * - * @param integer|null $max - * @return Zend_Validate_StringLength Provides a fluent interface - */ - public function setMax($max) - { - if (null === $max) { - $this->_max = null; - } else { - $this->_max = (integer) $max; - } - - return $this; - } - - /** - * Defined by Zend_Validate_Interface - * - * Returns true if and only if the string length of $value is at least the min option and - * no greater than the max option (when the max option is not null). - * - * @param string $value - * @return boolean - */ - public function isValid($value) - { - $valueString = (string) $value; - $this->_setValue($valueString); - $length = strlen($valueString); - if ($length < $this->_min) { - $this->_error(self::TOO_SHORT); - } - if (null !== $this->_max && $this->_max < $length) { - $this->_error(self::TOO_LONG); - } - if (count($this->_messages)) { - return false; - } else { - return true; - } - } - -} |