mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +02:00
core: Add item uid (#1017)
'uid' represents the unique id for a feed item. This item is null by default and can be set to any string value. The provided string value is always hashed to sha1 to make it the same length in all cases. References #977, #1005
This commit is contained in:
@@ -40,10 +40,15 @@ class AtomFormat extends FormatAbstract{
|
||||
$entryTitle = $this->xml_encode($item->getTitle());
|
||||
$entryContent = $item->getContent();
|
||||
$entryUri = $item->getURI();
|
||||
$entryID = '';
|
||||
|
||||
// the item id must be a valid unique URI
|
||||
$entryID = $this->xml_encode($entryUri);
|
||||
if (empty($entryID))
|
||||
if (!empty($item->getUid()))
|
||||
$entryID = 'urn:sha1:' . $item->getUid();
|
||||
|
||||
if (empty($entryID)) // Fallback to provided URI
|
||||
$entryID = $this->xml_encode($entryUri);
|
||||
|
||||
if (empty($entryID)) // Fallback to title and content
|
||||
$entryID = 'urn:sha1:' . hash('sha1', $entryTitle . $entryContent);
|
||||
|
||||
if (empty($entryTimestamp))
|
||||
|
Reference in New Issue
Block a user