From e23aedd402a0621e3f92f9325b77952968aadbe7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 15 Dec 2013 12:35:30 +0400 Subject: [PATCH] parser: add basic support for media:thumbnail --- classes/feeditem/atom.php | 11 +++++++++++ classes/feeditem/rss.php | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 5f0400fe..244fb1f8 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -175,6 +175,17 @@ class FeedItem_Atom extends FeedItem_Common { array_push($encs, $enc); } + $enclosures = $this->xpath->query("media:thumbnail", $this->elem); + + foreach ($enclosures as $enclosure) { + $enc = new FeedEnclosure(); + + $enc->type = "image/generic"; + $enc->link = $enclosure->getAttribute("url"); + + array_push($encs, $enc); + } + return $encs; } diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php index b5d9695e..f632d3bb 100644 --- a/classes/feeditem/rss.php +++ b/classes/feeditem/rss.php @@ -150,6 +150,17 @@ class FeedItem_RSS extends FeedItem_Common { array_push($encs, $enc); } + $enclosures = $this->xpath->query("media:thumbnail", $this->elem); + + foreach ($enclosures as $enclosure) { + $enc = new FeedEnclosure(); + + $enc->type = "image/generic"; + $enc->link = $enclosure->getAttribute("url"); + + array_push($encs, $enc); + } + return $encs; }