|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00026 require_once 'Zend/Validate/Abstract.php'; 00027 00039 class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract 00040 { 00045 const NOT_VALID = 'sitemapPriorityNotValid'; 00046 const INVALID = 'sitemapPriorityInvalid'; 00047 00053 protected $_messageTemplates = array( 00054 self::NOT_VALID => "'%value%' is no valid sitemap priority", 00055 self::INVALID => "Invalid type given, the value should be a integer, a float or a numeric string", 00056 ); 00057 00066 public function isValid($value) 00067 { 00068 if (!is_numeric($value)) { 00069 $this->_error(self::INVALID); 00070 return false; 00071 } 00072 00073 $this->_setValue($value); 00074 $value = (float) $value; 00075 if ($value < 0 || $value > 1) { 00076 $this->_error(self::NOT_VALID); 00077 return false; 00078 } 00079 00080 return true; 00081 } 00082 }