Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Validate/Sitemap/Lastmod.php
Go to the documentation of this file.
00001 <?php
00026 require_once 'Zend/Validate/Abstract.php';
00027 
00039 class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
00040 {
00045     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])?$/';
00046 
00051     const NOT_VALID = 'sitemapLastmodNotValid';
00052     const INVALID   = 'sitemapLastmodInvalid';
00053 
00059     protected $_messageTemplates = array(
00060         self::NOT_VALID => "'%value%' is no valid sitemap lastmod",
00061         self::INVALID   => "Invalid type given, the value should be a string",
00062     );
00063 
00072     public function isValid($value)
00073     {
00074         if (!is_string($value)) {
00075             $this->_error(self::INVALID);
00076             return false;
00077         }
00078 
00079         $this->_setValue($value);
00080         $result = @preg_match(self::LASTMOD_REGEX, $value);
00081         if ($result != 1) {
00082             $this->_error(self::NOT_VALID);
00083             return false;
00084         }
00085 
00086         return true;
00087     }
00088 }
 All Data Structures Namespaces Files Functions Variables Enumerations