public function Rss::getDateModified in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php \Zend\Feed\Reader\Entry\Rss::getDateModified()
- 8 vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php \Zend\Feed\Reader\Feed\Rss::getDateModified()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php \Zend\Feed\Reader\Feed\Rss::getDateModified()
Get the feed modification date
Return value
DateTime
Throws
Exception\RuntimeException
Overrides FeedInterface::getDateModified
1 call to Rss::getDateModified()
- Rss::getDateCreated in vendor/
zendframework/ zend-feed/ src/ Reader/ Feed/ Rss.php - Get the feed creation date
File
- vendor/
zendframework/ zend-feed/ src/ Reader/ Feed/ Rss.php, line 189
Class
Namespace
Zend\Feed\Reader\FeedCode
public function getDateModified() {
if (array_key_exists('datemodified', $this->data)) {
return $this->data['datemodified'];
}
$date = null;
if ($this
->getType() !== Reader\Reader::TYPE_RSS_10 && $this
->getType() !== Reader\Reader::TYPE_RSS_090) {
$dateModified = $this->xpath
->evaluate('string(/rss/channel/pubDate)');
if (!$dateModified) {
$dateModified = $this->xpath
->evaluate('string(/rss/channel/lastBuildDate)');
}
if ($dateModified) {
$dateModifiedParsed = strtotime($dateModified);
if ($dateModifiedParsed) {
$date = new DateTime('@' . $dateModifiedParsed);
}
else {
$dateStandards = [
DateTime::RSS,
DateTime::RFC822,
DateTime::RFC2822,
null,
];
foreach ($dateStandards as $standard) {
try {
$date = DateTime::createFromFormat($standard, $dateModified);
break;
} catch (\Exception $e) {
if ($standard === null) {
throw new Exception\RuntimeException('Could not load date due to unrecognised' . ' format (should follow RFC 822 or 2822):' . $e
->getMessage(), 0, $e);
}
}
}
}
}
}
if (!$date) {
$date = $this
->getExtension('DublinCore')
->getDate();
}
if (!$date) {
$date = $this
->getExtension('Atom')
->getDateModified();
}
if (!$date) {
$date = null;
}
$this->data['datemodified'] = $date;
return $this->data['datemodified'];
}