00001 <?php 00026 require_once 'Zend/Validate/Abstract.php'; 00027 00039 class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract 00040 { 00045 const NOT_VALID = 'invalidSitemapChangefreq'; 00046 00052 protected $_messageTemplates = array( 00053 self::NOT_VALID => "'%value%' is not a valid sitemap changefreq", 00054 ); 00055 00061 protected $_changeFreqs = array( 00062 'always', 'hourly', 'daily', 'weekly', 00063 'monthly', 'yearly', 'never' 00064 ); 00065 00074 public function isValid($value) 00075 { 00076 $this->_setValue($value); 00077 00078 if (!is_string($value)) { 00079 return false; 00080 } 00081 00082 if (!in_array($value, $this->_changeFreqs, true)) { 00083 $this->_error(self::NOT_VALID); 00084 return false; 00085 } 00086 00087 return true; 00088 } 00089 }