seeder-migration-issues
This commit is contained in:
75
vendor/zendframework/zend-validator/src/Sitemap/Changefreq.php
vendored
Normal file
75
vendor/zendframework/zend-validator/src/Sitemap/Changefreq.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Validator\Sitemap;
|
||||
|
||||
use Zend\Validator\AbstractValidator;
|
||||
|
||||
/**
|
||||
* Validates whether a given value is valid as a sitemap <changefreq> value
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php Sitemaps XML format
|
||||
*/
|
||||
class Changefreq extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Validation key for not valid
|
||||
*
|
||||
*/
|
||||
const NOT_VALID = 'sitemapChangefreqNotValid';
|
||||
const INVALID = 'sitemapChangefreqInvalid';
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messageTemplates = [
|
||||
self::NOT_VALID => "The input is not a valid sitemap changefreq",
|
||||
self::INVALID => "Invalid type given. String expected",
|
||||
];
|
||||
|
||||
/**
|
||||
* Valid change frequencies
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $changeFreqs = [
|
||||
'always', 'hourly', 'daily', 'weekly',
|
||||
'monthly', 'yearly', 'never'
|
||||
];
|
||||
|
||||
/**
|
||||
* Validates if a string is valid as a sitemap changefreq
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php#changefreqdef <changefreq>
|
||||
*
|
||||
* @param string $value value to validate
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
$this->error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setValue($value);
|
||||
if (!is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!in_array($value, $this->changeFreqs, true)) {
|
||||
$this->error(self::NOT_VALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
71
vendor/zendframework/zend-validator/src/Sitemap/Lastmod.php
vendored
Normal file
71
vendor/zendframework/zend-validator/src/Sitemap/Lastmod.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Validator\Sitemap;
|
||||
|
||||
use Zend\Stdlib\ErrorHandler;
|
||||
use Zend\Validator\AbstractValidator;
|
||||
|
||||
/**
|
||||
* Validates whether a given value is valid as a sitemap <lastmod> value
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php Sitemaps XML format
|
||||
*/
|
||||
class Lastmod extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Regular expression to use when validating
|
||||
*
|
||||
*/
|
||||
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])?$/';
|
||||
|
||||
/**
|
||||
* Validation key for not valid
|
||||
*
|
||||
*/
|
||||
const NOT_VALID = 'sitemapLastmodNotValid';
|
||||
const INVALID = 'sitemapLastmodInvalid';
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messageTemplates = [
|
||||
self::NOT_VALID => "The input is not a valid sitemap lastmod",
|
||||
self::INVALID => "Invalid type given. String expected",
|
||||
];
|
||||
|
||||
/**
|
||||
* Validates if a string is valid as a sitemap lastmod
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php#lastmoddef <lastmod>
|
||||
*
|
||||
* @param string $value value to validate
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
$this->error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setValue($value);
|
||||
ErrorHandler::start();
|
||||
$result = preg_match(self::LASTMOD_REGEX, $value);
|
||||
ErrorHandler::stop();
|
||||
if ($result != 1) {
|
||||
$this->error(self::NOT_VALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
65
vendor/zendframework/zend-validator/src/Sitemap/Loc.php
vendored
Normal file
65
vendor/zendframework/zend-validator/src/Sitemap/Loc.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Validator\Sitemap;
|
||||
|
||||
use Zend\Uri;
|
||||
use Zend\Validator\AbstractValidator;
|
||||
|
||||
/**
|
||||
* Validates whether a given value is valid as a sitemap <loc> value
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php Sitemaps XML format
|
||||
*
|
||||
* @see Zend\Uri\Uri
|
||||
*/
|
||||
class Loc extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Validation key for not valid
|
||||
*
|
||||
*/
|
||||
const NOT_VALID = 'sitemapLocNotValid';
|
||||
const INVALID = 'sitemapLocInvalid';
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messageTemplates = [
|
||||
self::NOT_VALID => "The input is not a valid sitemap location",
|
||||
self::INVALID => "Invalid type given. String expected",
|
||||
];
|
||||
|
||||
/**
|
||||
* Validates if a string is valid as a sitemap location
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php#locdef <loc>
|
||||
*
|
||||
* @param string $value value to validate
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
$this->error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setValue($value);
|
||||
$uri = Uri\UriFactory::factory($value);
|
||||
if (!$uri->isValid()) {
|
||||
$this->error(self::NOT_VALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
62
vendor/zendframework/zend-validator/src/Sitemap/Priority.php
vendored
Normal file
62
vendor/zendframework/zend-validator/src/Sitemap/Priority.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework (http://framework.zend.com/)
|
||||
*
|
||||
* @link http://github.com/zendframework/zf2 for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Zend\Validator\Sitemap;
|
||||
|
||||
use Zend\Validator\AbstractValidator;
|
||||
|
||||
/**
|
||||
* Validates whether a given value is valid as a sitemap <priority> value
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php Sitemaps XML format
|
||||
*/
|
||||
class Priority extends AbstractValidator
|
||||
{
|
||||
/**
|
||||
* Validation key for not valid
|
||||
*
|
||||
*/
|
||||
const NOT_VALID = 'sitemapPriorityNotValid';
|
||||
const INVALID = 'sitemapPriorityInvalid';
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messageTemplates = [
|
||||
self::NOT_VALID => "The input is not a valid sitemap priority",
|
||||
self::INVALID => "Invalid type given. Numeric string, integer or float expected",
|
||||
];
|
||||
|
||||
/**
|
||||
* Validates if a string is valid as a sitemap priority
|
||||
*
|
||||
* @link http://www.sitemaps.org/protocol.php#prioritydef <priority>
|
||||
*
|
||||
* @param string $value value to validate
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
$this->error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setValue($value);
|
||||
$value = (float) $value;
|
||||
if ($value < 0 || $value > 1) {
|
||||
$this->error(self::NOT_VALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user