Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Changefreq.php
Go to the documentation of this file.
1 <?php
26 #require_once 'Zend/Validate/Abstract.php';
27 
40 {
45  const NOT_VALID = 'sitemapChangefreqNotValid';
46  const INVALID = 'sitemapChangefreqInvalid';
47 
53  protected $_messageTemplates = array(
54  self::NOT_VALID => "'%value%' is not a valid sitemap changefreq",
55  self::INVALID => "Invalid type given. String expected",
56  );
57 
63  protected $_changeFreqs = array(
64  'always', 'hourly', 'daily', 'weekly',
65  'monthly', 'yearly', 'never'
66  );
67 
76  public function isValid($value)
77  {
78  if (!is_string($value)) {
79  $this->_error(self::INVALID);
80  return false;
81  }
82 
83  $this->_setValue($value);
84  if (!is_string($value)) {
85  return false;
86  }
87 
88  if (!in_array($value, $this->_changeFreqs, true)) {
89  $this->_error(self::NOT_VALID);
90  return false;
91  }
92 
93  return true;
94  }
95 }
_error($messageKey, $value=null)
Definition: Abstract.php:284
$value
Definition: gender.phtml:16