diff --git a/models/config.php b/models/config.php index 5aed98e..4e50e73 100644 --- a/models/config.php +++ b/models/config.php @@ -16,7 +16,7 @@ use SimpleValidator\Validator; use SimpleValidator\Validators; use PicoDb\Database; -const DB_VERSION = 20; +const DB_VERSION = 21; const HTTP_USERAGENT = 'Miniflux - http://miniflux.net'; const HTTP_FAKE_USERAGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36'; diff --git a/models/item.php b/models/item.php index 93db778..ac7e695 100644 --- a/models/item.php +++ b/models/item.php @@ -18,6 +18,7 @@ function get_everything() 'items.title', 'items.updated', 'items.url', + 'items.enclosure', 'items.bookmark', 'items.feed_id', 'items.status', @@ -41,6 +42,7 @@ function get_everything_since($timestamp) 'items.title', 'items.updated', 'items.url', + 'items.enclosure', 'items.bookmark', 'items.feed_id', 'items.status', @@ -75,6 +77,7 @@ function get_all($status, $offset = null, $limit = null, $order_column = 'update 'items.title', 'items.updated', 'items.url', + 'items.enclosure', 'items.bookmark', 'items.feed_id', 'items.status', @@ -119,6 +122,7 @@ function get_bookmarks($offset = null, $limit = null) 'items.title', 'items.updated', 'items.url', + 'items.enclosure', 'items.bookmark', 'items.status', 'items.content', @@ -155,6 +159,7 @@ function get_all_by_feed($feed_id, $offset = null, $limit = null, $order_column 'items.title', 'items.updated', 'items.url', + 'items.enclosure', 'items.feed_id', 'items.status', 'items.content', @@ -420,7 +425,8 @@ function update_all($feed_id, array $items, $grabber = false) 'author' => $item->author, 'content' => $nocontent ? '' : $item->content, 'status' => 'unread', - 'feed_id' => $feed_id + 'feed_id' => $feed_id, + 'enclosure' => isset($item->enclosure) ? $item->enclosure : NULL )); } else { diff --git a/models/schema.php b/models/schema.php index d586098..5ef0ee8 100644 --- a/models/schema.php +++ b/models/schema.php @@ -3,6 +3,11 @@ namespace Schema; +function version_21($pdo) +{ + $pdo->exec('ALTER TABLE items ADD COLUMN enclosure TEXT'); +} + function version_20($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN redirect_nothing_to_read TEXT DEFAULT "feeds"'); diff --git a/templates/item.php b/templates/item.php index c9beb4a..9b68e13 100644 --- a/templates/item.php +++ b/templates/item.php @@ -35,6 +35,11 @@
  • + +
  • + multimedia 🔉 +
  • + $item, 'menu' => $menu, 'offset' => $offset, 'source' => '')) ?> $item, 'redirect' => $menu, 'offset' => $offset)) ?> diff --git a/vendor/PicoFeed/Parsers/Rss20.php b/vendor/PicoFeed/Parsers/Rss20.php index 86eff74..a44c9d6 100644 --- a/vendor/PicoFeed/Parsers/Rss20.php +++ b/vendor/PicoFeed/Parsers/Rss20.php @@ -110,6 +110,12 @@ class Rss20 extends \PicoFeed\Parser if (empty($item->title)) $item->title = $item->url; + // if optional enclosure tag with multimedia provided, capture here + if (isset($entry->enclosure)) { + $item->enclosure = (string) $entry->enclosure['url']; + // \PicoFeed\Logging::log(\get_called_class().': recorded enclosure ('.(string) $item->enclosure.')'); + } + $item->content = $this->filterHtml($item->content, $item->url); $this->items[] = $item; }