diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php index 4168ff98..1944905f 100644 --- a/formats/AtomFormat.php +++ b/formats/AtomFormat.php @@ -26,9 +26,12 @@ class AtomFormat extends FormatAbstract{ $entryUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : ''; $entryTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_ATOM, $item['timestamp'])) : ''; $entryContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : ''; - $entryEnclosures = ""; - foreach($item['enclosures'] as $enclosure) - $entryEnclosures .= "xml_encode($enclosure)."\"/>"; + + $entryEnclosure = ''; + if(isset($item['enclosure'])){ + $entryEnclosure = ''; + } + $entries .= << @@ -40,7 +43,7 @@ class AtomFormat extends FormatAbstract{ {$entryUri} {$entryTimestamp} {$entryContent} - {$entryEnclosures} + {$entryEnclosure} EOD; diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index b928d139..8f96466b 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -30,6 +30,13 @@ class HtmlFormat extends FormatAbstract { . ''; } + $entryEnclosure = ''; + if(isset($item['enclosure'])){ + $entryEnclosure = '
enclosure
'; + } + $entries .= << @@ -37,6 +44,7 @@ class HtmlFormat extends FormatAbstract { {$entryTimestamp} {$entryAuthor} {$entryContent} + {$entryEnclosure} EOD; diff --git a/formats/MrssFormat.php b/formats/MrssFormat.php index da75b77f..19c703ea 100644 --- a/formats/MrssFormat.php +++ b/formats/MrssFormat.php @@ -30,9 +30,12 @@ class MrssFormat extends FormatAbstract { $itemUri = isset($item['uri']) ? $this->xml_encode($item['uri']) : ''; $itemTimestamp = isset($item['timestamp']) ? $this->xml_encode(date(DATE_RFC2822, $item['timestamp'])) : ''; $itemContent = isset($item['content']) ? $this->xml_encode($this->sanitizeHtml($item['content'])) : ''; - $entryEnclosures = ""; - foreach($item['enclosures'] as $enclosure) - $entryEnclosures .= "xml_encode($enclosure)."\"/>"; + + $entryEnclosure = ''; + if(isset($item['enclosure'])){ + $entryEnclosure = ''; + } + $items .= << @@ -42,7 +45,7 @@ class MrssFormat extends FormatAbstract { {$itemTimestamp} {$itemContent} {$itemAuthor} - {$entryEnclosures} + {$entryEnclosure} EOD;