|
|
@@ -286,7 +286,9 @@ class Zend_Feed_Writer_Renderer_Entry_Atom
|
|
|
$this->getDataContainer()->getLink());
|
|
|
}
|
|
|
if (!Zend_Uri::check($this->getDataContainer()->getId()) &&
|
|
|
- !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) {
|
|
|
+ !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#",
|
|
|
+ $this->getDataContainer()->getId()
|
|
|
+ ) && !$this->_validateTagUri($this->getDataContainer()->getId())) {
|
|
|
require_once 'Zend/Feed/Exception.php';
|
|
|
throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI');
|
|
|
}
|
|
|
@@ -297,6 +299,38 @@ class Zend_Feed_Writer_Renderer_Entry_Atom
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Validate a URI using the tag scheme (RFC 4151)
|
|
|
+ *
|
|
|
+ * @param string $id
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ protected function _validateTagUri($id)
|
|
|
+ {
|
|
|
+ if (preg_match('/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $id, $matches)) {
|
|
|
+ $dvalid = false;
|
|
|
+ $nvalid = false;
|
|
|
+ $date = $matches['date'];
|
|
|
+ $d6 = strtotime($date);
|
|
|
+ if ((strlen($date) == 4) && $date <= date('Y')) {
|
|
|
+ $dvalid = true;
|
|
|
+ } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) {
|
|
|
+ $dvalid = true;
|
|
|
+ } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) {
|
|
|
+ $dvalid = true;
|
|
|
+ }
|
|
|
+ $validator = new Zend_Validate_EmailAddress;
|
|
|
+ if ($validator->isValid($matches['name'])) {
|
|
|
+ $nvalid = true;
|
|
|
+ } else {
|
|
|
+ $nvalid = $validator->isValid('info@' . $matches['name']);
|
|
|
+ }
|
|
|
+ return $dvalid && $nvalid;
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Set entry content
|
|
|
*
|
|
|
* @param DOMDocument $dom
|