diff options
Diffstat (limited to 'libs/Zend/Validate/Alpha.php')
-rw-r--r-- | libs/Zend/Validate/Alpha.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libs/Zend/Validate/Alpha.php b/libs/Zend/Validate/Alpha.php index ce1f01872f..42864fa561 100644 --- a/libs/Zend/Validate/Alpha.php +++ b/libs/Zend/Validate/Alpha.php @@ -14,33 +14,33 @@ * * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Alpha.php 16223 2009-06-21 20:04:53Z thomas $ + * @version $Id: Alpha.php 20442 2010-01-20 15:15:40Z matthew $ */ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; +// require_once 'Zend/Validate/Abstract.php'; /** * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2010 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 { const INVALID = 'alphaInvalid'; const NOT_ALPHA = 'notAlpha'; - const STRING_EMPTY = 'stringEmpty'; + const STRING_EMPTY = 'alphaStringEmpty'; /** * Whether to allow white space characters; off by default * * @var boolean - * @depreciated + * @deprecated */ public $allowWhiteSpace; @@ -58,18 +58,30 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract */ protected $_messageTemplates = array( self::INVALID => "Invalid type given, value should be a string", - self::NOT_ALPHA => "'%value%' has not only alphabetic characters", + self::NOT_ALPHA => "'%value%' contains non alphabetic characters", self::STRING_EMPTY => "'%value%' is an empty string" ); /** * Sets default option values for this instance * - * @param boolean $allowWhiteSpace + * @param boolean|Zend_Config $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false) { + if ($allowWhiteSpace instanceof Zend_Config) { + $allowWhiteSpace = $allowWhiteSpace->toArray(); + } + + if (is_array($allowWhiteSpace)) { + if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) { + $allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace']; + } else { + $allowWhiteSpace = false; + } + } + $this->allowWhiteSpace = (boolean) $allowWhiteSpace; } @@ -121,7 +133,7 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract /** * @see Zend_Filter_Alpha */ - require_once 'Zend/Filter/Alpha.php'; + // require_once 'Zend/Filter/Alpha.php'; self::$_filter = new Zend_Filter_Alpha(); } |