aboutsummaryrefslogtreecommitdiff
path: root/formats/AtomFormat.php
diff options
context:
space:
mode:
Diffstat (limited to 'formats/AtomFormat.php')
-rw-r--r--formats/AtomFormat.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php
index 1e01a0ff..02d7d61a 100644
--- a/formats/AtomFormat.php
+++ b/formats/AtomFormat.php
@@ -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))