From 606e756bc12c51d70f23bcd11df88fe7311827a7 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 9 Aug 2016 17:12:28 +0200 Subject: [PATCH] formats: Use same general entity generation order --- formats/AtomFormat.php | 4 +--- formats/HtmlFormat.php | 8 ++++---- formats/MrssFormat.php | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php index b71b15c7..06ef8eb0 100644 --- a/formats/AtomFormat.php +++ b/formats/AtomFormat.php @@ -23,13 +23,11 @@ class AtomFormat extends FormatAbstract{ $entries = ''; foreach($this->getDatas() as $data){ - $entryAuthor = is_null($data->author) ? $title : $this->xml_encode($data->author); + $entryAuthor = is_null($data->author) ? '' : $this->xml_encode($data->author); $entryTitle = is_null($data->title) ? '' : $this->xml_encode($data->title); $entryUri = is_null($data->uri) ? '' : $this->xml_encode($data->uri); $entryTimestamp = is_null($data->timestamp) ? '' : $this->xml_encode(date(DATE_ATOM, $data->timestamp)); - // We prevent content from closing the CDATA too early. $entryContent = is_null($data->content) ? '' : $this->xml_encode($this->sanitizeHtml($data->content)); - $entries .= << diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index 20d49014..6c75a8e7 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -12,14 +12,14 @@ class HtmlFormat extends FormatAbstract{ $extraInfos = $this->getExtraInfos(); $title = htmlspecialchars($extraInfos['name']); $uri = htmlspecialchars($extraInfos['uri']); - $atomquery = str_replace('format=HtmlFormat', 'format=AtomFormat', htmlentities($_SERVER['QUERY_STRING'])); + $atomquery = str_replace('format=HtmlFormat', 'format=AtomFormat', htmlentities($_SERVER['QUERY_STRING'])); $entries = ''; foreach($this->getDatas() as $data){ - $entryUri = is_null($data->uri) ? $uri : $data->uri; - $entryTitle = is_null($data->title) ? '' : $this->sanitizeHtml(strip_tags($data->title)); - $entryTimestamp = is_null($data->timestamp) ? '' : ''; $entryAuthor = is_null($data->author) ? '' : '

by: ' . $data->author . '

'; + $entryTitle = is_null($data->title) ? '' : $this->sanitizeHtml(strip_tags($data->title)); + $entryUri = is_null($data->uri) ? $uri : $data->uri; + $entryTimestamp = is_null($data->timestamp) ? '' : ''; $entryContent = is_null($data->content) ? '' : '
' . $this->sanitizeHtml($data->content). '
'; $entries .= <<getDatas() as $data){ + $itemAuthor = is_null($data->author) ? '' : $this->xml_encode($data->author); $itemTitle = strip_tags(is_null($data->title) ? '' : $this->xml_encode($data->title)); $itemUri = is_null($data->uri) ? '' : $this->xml_encode($data->uri); - $itemAuthor = is_null($data->author) ? $title : $this->xml_encode($data->author); $itemTimestamp = is_null($data->timestamp) ? '' : $this->xml_encode(date(DATE_RFC2822, $data->timestamp)); - // We prevent content from closing the CDATA too early. $itemContent = is_null($data->content) ? '' : $this->xml_encode($this->sanitizeHtml($data->content)); - $items .= <<