|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00026 require_once 'Zend/Validate/Abstract.php'; 00027 00031 require_once 'Zend/Uri.php'; 00032 00044 class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract 00045 { 00050 const NOT_VALID = 'sitemapLocNotValid'; 00051 const INVALID = 'sitemapLocInvalid'; 00052 00058 protected $_messageTemplates = array( 00059 self::NOT_VALID => "'%value%' is no valid sitemap location", 00060 self::INVALID => "Invalid type given, the value should be a string", 00061 ); 00062 00071 public function isValid($value) 00072 { 00073 if (!is_string($value)) { 00074 $this->_error(self::INVALID); 00075 return false; 00076 } 00077 00078 $this->_setValue($value); 00079 $result = Zend_Uri::check($value); 00080 if ($result !== true) { 00081 $this->_error(self::NOT_VALID); 00082 return false; 00083 } 00084 00085 return true; 00086 } 00087 }