From 8f9c4143fcc133f28db4c3f618649fb1170e33b4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 6 Jan 2023 19:53:43 +0100 Subject: Better enclosures (#4944) * Better enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4702 Improvement of https://github.com/FreshRSS/FreshRSS/pull/2898 * A few fixes * Better enclosure titles * Improve thumbnails * Implement thumbnail for HTML+XPath * Avoid duplicate enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/1668 * Fix regex * Add basic support for media:credit And use
for enclosures * Fix link encoding + simplify code * Fix some SimplePie bugs Encoding errors in enclosure links * Remove debugging syslog * Remove debugging syslog * SimplePie fix multiple RSS2 enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4974 * Improve thumbnails * Performance with yield Avoid generating all enclosures if not used * API keep providing enclosures inside content Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite) * Lint * Fix API output enclosure * Fix API content strcut * API tolerate enclosures without a type --- app/views/index/normal.phtml | 2 +- app/views/index/reader.phtml | 2 +- app/views/index/rss.phtml | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'app/views/index') diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index 6f7c47677..847c307ab 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -162,7 +162,7 @@ $today = @strtotime('today');
entry->content()) : $this->entry->content(); + echo $lazyload && $hidePosts ? lazyimg($this->entry->content(true)) : $this->entry->content(true); ?>
show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index 5789f229b..a2ea0e989 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -136,7 +136,7 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
- content() ?> + content(true) ?>
show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml index 0b07a02f3..0b3dc7955 100755 --- a/app/views/index/rss.phtml +++ b/app/views/index/rss.phtml @@ -29,29 +29,41 @@ foreach ($this->entries as $item) { $authors = $item->authors(); if (is_array($authors)) { foreach ($authors as $author) { - echo "\t\t\t" , '', $author, '', "\n"; + echo "\t\t\t", '', $author, '', "\n"; } } $categories = $item->tags(); if (is_array($categories)) { foreach ($categories as $category) { - echo "\t\t\t" , '', $category, '', "\n"; + echo "\t\t\t", '', $category, '', "\n"; } } + $thumbnail = $item->thumbnail(false); + if (!empty($thumbnail['url'])) { + // https://www.rssboard.org/media-rss#media-thumbnails + echo "\t\t\t", '', "\n"; + } $enclosures = $item->enclosures(false); if (is_array($enclosures)) { foreach ($enclosures as $enclosure) { // https://www.rssboard.org/media-rss - echo "\t\t\t" , '', "\n"; + . '">' + . (empty($enclosure['title']) ? '' : '' . $enclosure['title'] . '') + . (empty($enclosure['credit']) ? '' : '' . $enclosure['credit'] . '') + . '', "\n"; } } ?> content(); + echo $item->content(false); ?>]]> date(true)) ?> id() > 0 ? $item->id() : $item->guid() ?> -- cgit v1.2.3