From d65714fa47d3f7bce4fc5c45c7ef79977598dcc2 Mon Sep 17 00:00:00 2001 From: Roliga Date: Sat, 9 Nov 2019 18:43:21 +0100 Subject: [PATCH] [HtmlFormat] Add syndication links (#1348) Adds elements for each additional output format in the of HTML format output to allow RSS readers to find the actual feeds directly from the HTML page. --- formats/HtmlFormat.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index 5d059253..49d9ca68 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -12,6 +12,7 @@ class HtmlFormat extends FormatAbstract { $formatFac->setWorkingDir(PATH_LIB_FORMATS); $buttons = ''; + $links = ''; foreach($formatFac->getFormatNames() as $format) { if(strcasecmp($format, 'HTML') === 0) { @@ -20,6 +21,9 @@ class HtmlFormat extends FormatAbstract { $query = str_replace('format=Html', 'format=' . $format, htmlentities($_SERVER['QUERY_STRING'])); $buttons .= $this->buildButton($format, $query) . PHP_EOL; + + $mime = $formatFac->create($format)->getMimeType(); + $links .= $this->buildLink($format, $query, $mime) . PHP_EOL; } $entries = ''; @@ -101,6 +105,7 @@ EOD; {$title} + {$links} @@ -131,6 +136,13 @@ EOD; private function buildButton($format, $query) { return << +EOD; + } + + private function buildLink($format, $query, $mime) { + return << + EOD; } }