summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-03-07 15:13:07 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-03-07 15:13:07 +0100
commit0be30fc27d62952e909d920d90716d793b14cfd0 (patch)
tree6e211de89f1983f735c857419a0224545f236e95 /vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
parentc53250f18730b2edef57f098cec3ad706d6efb53 (diff)
update picofeed
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
index 21566527e..0e53d2778 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
@@ -138,16 +138,20 @@ class Atom extends Parser
* Find the item date
*
* @access public
- * @param SimpleXMLElement $entry Feed item
- * @param Item $item Item object
+ * @param SimpleXMLElement $entry Feed item
+ * @param Item $item Item object
+ * @param \PicoFeed\Parser\Feed $feed Feed object
*/
- public function findItemDate(SimpleXMLElement $entry, Item $item)
+ public function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed)
{
$published = isset($entry->published) ? $this->date->getDateTime((string) $entry->published) : null;
$updated = isset($entry->updated) ? $this->date->getDateTime((string) $entry->updated) : null;
- if ($published !== null && $updated !== null) {
- $item->date = max($published, $updated);
+ if ($published === null && $updated === null) {
+ $item->date = $feed->getDate(); // We use the feed date if there is no date for the item
+ }
+ else if ($published !== null && $updated !== null) {
+ $item->date = max($published, $updated); // We use the most recent date between published and updated
}
else {
$item->date = $updated ?: $published;