From 0874e13824723aa47f48c6b39e33857b96739055 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Wed, 28 May 2014 16:57:30 +0200 Subject: [PATCH] Improve HTML output --- formats/HtmlFormat.php | 52 ++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index c52cf963..78599164 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -12,39 +12,61 @@ 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'])); $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) ? '' : '' . date(DATE_ATOM, $data->timestamp) . ''; + $entryTimestamp = is_null($data->timestamp) ? '' : ''; $entryContent = is_null($data->content) ? '' : '

' . $this->sanitizeHtml($data->content). '

'; $entries .= << -

{$entryTitle}

- {$entryTimestamp} - {$entryContent} - +
+

{$entryTitle}

+ {$entryTimestamp} + {$entryContent} +
EOD; } $styleCss = <<<'EOD' -body{font-family:"Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;font-size:10pt;background-color:#aaa;}div.rssitem{border:1px solid black;padding:5px;margin:10px;background-color:#fff;} +body{ + font-family:"Trebuchet MS",Verdana,Arial,Helvetica,sans-serif; + font-size:10pt; + background-color:#aaa; + background-image:linear-gradient(#eee, #aaa); + background-attachment:fixed; +} +div.feeditem{border:1px solid black;padding:1em;margin:1em;background-color:#fff;} +div.feeditem:hover { background-color:#ebf7ff; } +h1 {border-bottom:dotted #bbb;margin:0 1em 1em 1em;} +h2 {margin:0;} +h2 a {color:black;text-decoration:none;} +h2 a:hover {text-decoration:underline;} +span.menu {margin-left:1em;} +span.menu img {vertical-align:middle;} +span.menu a { color:black; text-decoration:none; padding:0.4em; } +span.menu a:hover { background-color:white; } + EOD; /* Data are prepared, now let's begin the "MAGIE !!!" */ $toReturn = << - - {$title} - - - -

{$title}

+ + + {$title} + + + + +

{$title}

+← back to rss-bridge feed {$entries} - + EOD; @@ -58,4 +80,4 @@ EOD; return parent::display(); } -} \ No newline at end of file +}