Index: library/Zend/Validate/Sitemap/Lastmod.php =================================================================== --- library/Zend/Validate/Sitemap/Lastmod.php (revision 21296) +++ library/Zend/Validate/Sitemap/Lastmod.php (working copy) @@ -44,12 +44,14 @@ */ 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])?$/'; - /** + /**#@+ * Validation key for not valid - * */ const NOT_VALID = 'invalidSitemapLastmod'; - + + const INVALID = 'sitemapLastmodInvalid'; + /**#@-*/ + /** * Validation failure message template definitions * @@ -57,6 +59,7 @@ */ protected $_messageTemplates = array( self::NOT_VALID => "'%value%' is no valid sitemap lastmod", + self::INVALID => "Invalid type given, value should be string", ); /** @@ -69,12 +72,18 @@ */ public function isValid($value) { - $this->_setValue($value); - if (!is_string($value)) { + $this->_error(self::INVALID); return false; } - - return @preg_match(self::LASTMOD_REGEX, $value) == 1; + + $this->_setValue($value); + + if(!@preg_match(self::LASTMOD_REGEX, $value)) { + $this->_error(self::NOT_VALID); + return false; + } + + return true; } } Index: library/Zend/Validate/Sitemap/Changefreq.php =================================================================== --- library/Zend/Validate/Sitemap/Changefreq.php (revision 21296) +++ library/Zend/Validate/Sitemap/Changefreq.php (working copy) @@ -38,12 +38,14 @@ */ class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract { - /** + /**#@+ * Validation key for not valid - * */ const NOT_VALID = 'invalidSitemapChangefreq'; - + + const INVALID = 'sitemapChangefreqInvalid'; + /**#@-*/ + /** * Validation failure message template definitions * @@ -51,6 +53,7 @@ */ protected $_messageTemplates = array( self::NOT_VALID => "'%value%' is no valid sitemap changefreq", + self::INVALID => "Invalid type given, value should be string", ); /** @@ -73,12 +76,13 @@ */ public function isValid($value) { - $this->_setValue($value); - if (!is_string($value)) { + $this->_error(self::INVALID); return false; } - + + $this->_setValue($value); + if (!in_array($value, $this->_changeFreqs, true)) { $this->_error(self::NOT_VALID); return false; Index: library/Zend/Validate/Sitemap/Loc.php =================================================================== --- library/Zend/Validate/Sitemap/Loc.php (revision 21296) +++ library/Zend/Validate/Sitemap/Loc.php (working copy) @@ -43,12 +43,14 @@ */ class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract { - /** + /**#@+ * Validation key for not valid - * */ const NOT_VALID = 'invalidSitemapLoc'; - + + const INVALID = 'sitemapLocInvalid'; + /**#@-*/ + /** * Validation failure message template definitions * @@ -56,6 +58,7 @@ */ protected $_messageTemplates = array( self::NOT_VALID => "'%value%' is no valid sitemap location", + self::INVALID => "Invalid type given, value should be string", ); /** @@ -68,12 +71,18 @@ */ public function isValid($value) { - $this->_setValue($value); - if (!is_string($value)) { + $this->_error(self::INVALID); return false; } - - return Zend_Uri::check($value); + + $this->_setValue($value); + + if (!Zend_Uri::check($value)) { + $this->_error(self::NOT_VALID); + return false; + } + + return true; } } Index: library/Zend/Validate/Sitemap/Priority.php =================================================================== --- library/Zend/Validate/Sitemap/Priority.php (revision 21296) +++ library/Zend/Validate/Sitemap/Priority.php (working copy) @@ -38,12 +38,14 @@ */ class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract { - /** + /**#@+ * Validation key for not valid - * */ const NOT_VALID = 'invalidSitemapPriority'; - + + const INVALID = 'sitemapPriorityInvalid'; + /**#@-*/ + /** * Validation failure message template definitions * @@ -51,6 +53,7 @@ */ protected $_messageTemplates = array( self::NOT_VALID => "'%value%' is no valid sitemap priority", + self::INVALID => "Invalid type given, value should be numeric", ); /** @@ -63,13 +66,19 @@ */ public function isValid($value) { - $this->_setValue($value); - if (!is_numeric($value)) { + $this->_error(self::INVALID); return false; } - + + $this->_setValue($value); $value = (float)$value; - return $value >= 0 && $value <= 1; + + if ($value < 0 || $value > 1) { + $this->_error(self::NOT_VALID); + return false; + } + + return true; } }