|
Moodle
2.2.1
http://www.collinsharper.com
|
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 = 'sitemapChangefreqNotValid'; 00046 const INVALID = 'sitemapChangefreqInvalid'; 00047 00053 protected $_messageTemplates = array( 00054 self::NOT_VALID => "'%value%' is no valid sitemap changefreq", 00055 self::INVALID => "Invalid type given, the value should be a string", 00056 ); 00057 00063 protected $_changeFreqs = array( 00064 'always', 'hourly', 'daily', 'weekly', 00065 'monthly', 'yearly', 'never' 00066 ); 00067 00076 public function isValid($value) 00077 { 00078 if (!is_string($value)) { 00079 $this->_error(self::INVALID); 00080 return false; 00081 } 00082 00083 $this->_setValue($value); 00084 if (!is_string($value)) { 00085 return false; 00086 } 00087 00088 if (!in_array($value, $this->_changeFreqs, true)) { 00089 $this->_error(self::NOT_VALID); 00090 return false; 00091 } 00092 00093 return true; 00094 } 00095 }