From: Andrew Dolgov Date: Sun, 15 Dec 2013 08:35:30 +0000 (+0400) Subject: parser: add basic support for media:thumbnail X-Git-Tag: 1.11~9 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e23aedd402a0621e3f92f9325b77952968aadbe7;p=tt-rss.git parser: add basic support for media:thumbnail --- 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; }