From 1603c10bbab61b4a84380c8a9d5aa77536a4f1c7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 18 Aug 2022 12:10:55 +0200 Subject: XPath ability to define the UID manually (#4507) * XPath ability to define the UID manually * Fix error in i18n --- app/Models/Feed.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 4de61167b..710f8b557 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -611,6 +611,7 @@ class FreshRSS_Feed extends Minz_Model { $xPathItemTimestamp = $xPathSettings['itemTimestamp'] ?? ''; $xPathItemThumbnail = $xPathSettings['itemThumbnail'] ?? ''; $xPathItemCategories = $xPathSettings['itemCategories'] ?? ''; + $xPathItemUid = $xPathSettings['itemUid'] ?? ''; if ($xPathItem == '') { return null; } @@ -657,8 +658,14 @@ class FreshRSS_Feed extends Minz_Model { } } } - if ($item['title'] . $item['content'] . $item['link'] != '') { + if ($xPathItemUid != '') { + $item['guid'] = @$xpath->evaluate('normalize-space(' . $xPathItemUid . ')', $node); + } + if (empty($item['guid'])) { $item['guid'] = 'urn:sha1:' . sha1($item['title'] . $item['content'] . $item['link']); + } + + if ($item['title'] . $item['content'] . $item['link'] != '') { $item = Minz_Helper::htmlspecialchars_utf8($item); $view->entries[] = FreshRSS_Entry::fromArray($item); } -- cgit v1.2.3