From 7ab4a2609a4db8babb968f79cc2832ec0a02ce09 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 6 Jun 2018 21:29:22 +0200 Subject: Support for media: tags (#1920) * Support for media: tags https://github.com/FreshRSS/FreshRSS/issues/944 E.g. YouTube * Fix for medium attribute * Changelog 944 https://github.com/FreshRSS/FreshRSS/issues/944 https://github.com/FreshRSS/FreshRSS/pull/1920 * enclosure styling * Compatibility old enclosure content --- app/Models/Feed.php | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index c8ccff09b..07a7a5459 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -359,21 +359,45 @@ class FreshRSS_Feed extends Minz_Model { foreach ($item->get_enclosures() as $enclosure) { $elink = $enclosure->get_link(); if ($elink != '' && empty($elinks[$elink])) { - $elinks[$elink] = '1'; + $content .= '
'; + + if ($enclosure->get_title() != '') { + $content .= '

' . $enclosure->get_title() . '

'; + } + + $enclosureContent = ''; + $elinks[$elink] = true; $mime = strtolower($enclosure->get_type()); - if (strpos($mime, 'image/') === 0) { - $content .= '

'; - } elseif (strpos($mime, 'audio/') === 0) { - $content .= '

'; + } elseif ($medium === 'audio' || strpos($mime, 'audio/') === 0) { + $enclosureContent .= '

💾

'; - } elseif (strpos($mime, 'video/') === 0) { - $content .= '

'; - } elseif (strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) { - $content .= '

💾

'; + } elseif ($medium != '' || strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) { + $enclosureContent .= '

💾

'; } else { unset($elinks[$elink]); } + + $thumbnailContent = ''; + foreach ($enclosure->get_thumbnails() as $thumbnail) { + if (empty($elinks[$thumbnail])) { + $elinks[$thumbnail] = true; + $thumbnailContent .= '

'; + } + } + + $content .= $thumbnailContent; + $content .= $enclosureContent; + + if ($enclosure->get_description() != '') { + $content .= '
' . $enclosure->get_description() . '
'; + } + $content .= "
\n"; } } -- cgit v1.2.3