7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Validate
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Loc.php 16971 2009-07-22 18:05:45Z mikaelkael $
24 * @see Zend_Validate_Abstract
26 require_once 'Zend/Validate/Abstract.php';
31 require_once 'Zend/Uri.php';
34 * Validates whether a given value is valid as a sitemap <loc> value
36 * @link http://www.sitemaps.org/protocol.php Sitemaps XML format
39 * @package Zend_Validate
41 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
42 * @license http://framework.zend.com/license/new-bsd New BSD License
44 class Zend_Validate_Sitemap_Loc
extends Zend_Validate_Abstract
47 * Validation key for not valid
50 const NOT_VALID
= 'invalidSitemapLoc';
53 * Validation failure message template definitions
57 protected $_messageTemplates = array(
58 self
::NOT_VALID
=> "'%value%' is not a valid sitemap location",
62 * Validates if a string is valid as a sitemap location
64 * @link http://www.sitemaps.org/protocol.php#locdef <loc>
66 * @param string $value value to validate
69 public function isValid($value)
71 $this->_setValue($value);
73 if (!is_string($value)) {
77 return Zend_Uri
::check($value);