1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 05:40:24 +02:00

Improved style for HtmlFormat.

This commit is contained in:
Teromene
2016-08-03 20:07:49 +02:00
parent 6b7b38db54
commit 1b02330302
2 changed files with 109 additions and 29 deletions

View File

@@ -18,41 +18,21 @@ class HtmlFormat extends FormatAbstract{
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) ? '' : '<small><time datetime="' . date(DATE_ATOM, $data->timestamp) . '">' . date(DATE_ATOM, $data->timestamp) . '</time></small>';
$entryAuthor = is_null($data->author) ? '' : '<br><small>by: ' . $data->author . '</small>';
$entryContent = is_null($data->content) ? '' : '<p>' . $this->sanitizeHtml($data->content). '</p>';
$entryTimestamp = is_null($data->timestamp) ? '' : '<time datetime="' . date(DATE_ATOM, $data->timestamp) . '">' . date(DATE_ATOM, $data->timestamp) . '</time>';
$entryAuthor = is_null($data->author) ? '' : '<br /><p class="author">by: ' . $data->author . '</p>';
$entryContent = is_null($data->content) ? '' : '<div class="content">' . $this->sanitizeHtml($data->content). '</div>';
$entries .= <<<EOD
<div class="feeditem">
<h2><a href="{$entryUri}">{$entryTitle}</a></h2>
<section class="feeditem">
<h2><a class="itemtitle" href="{$entryUri}">{$entryTitle}</a></h2>
{$entryTimestamp}
{$entryAuthor}
{$entryContent}
</div>
</section>
EOD;
}
$styleCss = <<<'EOD'
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 = <<<EOD
@@ -61,12 +41,12 @@ EOD;
<head>
<meta charset="UTF-8">
<title>{$title}</title>
<style type="text/css">{$styleCss}</style>
<link href="css/HtmlFormat.css" rel="stylesheet">
<meta name="robots" content="noindex, follow">
</head>
<body>
<h1>{$title}</h1>
<span class="menu"><a href="./" onclick="window.history.back()">← back to rss-bridge</a> <a title="Get the ATOM feed" href="./?{$atomquery}"><img alt="feed" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZAgMAAAC5h23wAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJUExURf+cCv/8+P/OhD2VurcAAAABdFJOU/4a4wd9AAAAbklEQVQI13XOMQ6AIAwFUGzCgLtHYPEUHMHBTwgTRyFOXoDdUT2ltCKbXV6b/iZV6qcMYmY1EJtw3MwFQRJU/Bfl6VaEzENQxbHIUxKTrY4Xgk4ct0EvcrYa9iTPGrxqbE3XHWSfRfIk1trp6O8+R38aBYbaAE4AAAAASUVORK5CYII="></a></span>
<h1 class="pagetitle">{$title}</h1>
<a class="backlink" href="./"><button class="backbutton">← back to rss-bridge</button></a>
{$entries}
</body>
</html>