diff options
Diffstat (limited to 'libs/Zend/Validate/Sitemap/Lastmod.php')
-rw-r--r-- | libs/Zend/Validate/Sitemap/Lastmod.php | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/libs/Zend/Validate/Sitemap/Lastmod.php b/libs/Zend/Validate/Sitemap/Lastmod.php index aa2266ecd9..4f01d1a781 100644 --- a/libs/Zend/Validate/Sitemap/Lastmod.php +++ b/libs/Zend/Validate/Sitemap/Lastmod.php @@ -15,15 +15,15 @@ * @category Zend * @package Zend_Validate * @subpackage Sitemap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Lastmod.php 21365 2010-03-07 09:38:41Z thomas $ + * @version $Id: Lastmod.php 16971 2009-07-22 18:05:45Z mikaelkael $ */ /** * @see Zend_Validate_Abstract */ -// require_once 'Zend/Validate/Abstract.php'; +require_once 'Zend/Validate/Abstract.php'; /** * Validates whether a given value is valid as a sitemap <lastmod> value @@ -33,7 +33,7 @@ * @category Zend * @package Zend_Validate * @subpackage Sitemap - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract @@ -42,14 +42,13 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract * Regular expression to use when validating * */ - const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9])(:[0-5][0-9])?(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/'; + const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9]){2}(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/m'; /** * Validation key for not valid * */ - const NOT_VALID = 'sitemapLastmodNotValid'; - const INVALID = 'sitemapLastmodInvalid'; + const NOT_VALID = 'invalidSitemapLastmod'; /** * Validation failure message template definitions @@ -57,8 +56,7 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract * @var array */ protected $_messageTemplates = array( - self::NOT_VALID => "'%value%' is no valid sitemap lastmod", - self::INVALID => "Invalid type given, the value should be a string", + self::NOT_VALID => "'%value%' is not a valid sitemap lastmod", ); /** @@ -71,18 +69,13 @@ class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract */ public function isValid($value) { - if (!is_string($value)) { - $this->_error(self::INVALID); - return false; - } - $this->_setValue($value); - $result = @preg_match(self::LASTMOD_REGEX, $value); - if ($result != 1) { - $this->_error(self::NOT_VALID); + + if (!is_string($value)) { return false; } - return true; + return @preg_match(self::LASTMOD_REGEX, $value) == 1; } + } |