2013-08-11 13:30:41 +02:00
|
|
|
<?php
|
|
|
|
class HtmlFormat extends FormatAbstract{
|
|
|
|
|
|
|
|
public function stringify(){
|
|
|
|
$extraInfos = $this->getExtraInfos();
|
|
|
|
$title = htmlspecialchars($extraInfos['name']);
|
|
|
|
$uri = htmlspecialchars($extraInfos['uri']);
|
2016-08-23 19:46:21 +02:00
|
|
|
$atomquery = str_replace('format=Html', 'format=Atom', htmlentities($_SERVER['QUERY_STRING']));
|
|
|
|
$mrssquery = str_replace('format=Html', 'format=Mrss', htmlentities($_SERVER['QUERY_STRING']));
|
2013-08-11 13:30:41 +02:00
|
|
|
|
|
|
|
$entries = '';
|
2016-08-29 19:47:21 +02:00
|
|
|
foreach($this->getItems() as $item){
|
|
|
|
$entryAuthor = isset($item['author']) ? '<br /><p class="author">by: ' . $item['author'] . '</p>' : '';
|
|
|
|
$entryTitle = isset($item['title']) ? $this->sanitizeHtml(strip_tags($item['title'])) : '';
|
|
|
|
$entryUri = isset($item['uri']) ? $item['uri'] : $uri;
|
|
|
|
$entryTimestamp = isset($item['timestamp']) ? '<time datetime="' . date(DATE_ATOM, $item['timestamp']) . '">' . date(DATE_ATOM, $item['timestamp']) . '</time>' : '';
|
|
|
|
$entryContent = isset($item['content']) ? '<div class="content">' . $this->sanitizeHtml($item['content']). '</div>' : '';
|
2013-08-11 13:30:41 +02:00
|
|
|
$entries .= <<<EOD
|
|
|
|
|
2016-08-03 20:07:49 +02:00
|
|
|
<section class="feeditem">
|
2016-08-09 17:17:37 +02:00
|
|
|
<h2><a class="itemtitle" href="{$entryUri}">{$entryTitle}</a></h2>
|
|
|
|
{$entryTimestamp}
|
|
|
|
{$entryAuthor}
|
|
|
|
{$entryContent}
|
2016-08-03 20:07:49 +02:00
|
|
|
</section>
|
2013-08-11 13:30:41 +02:00
|
|
|
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Data are prepared, now let's begin the "MAGIE !!!" */
|
|
|
|
$toReturn = <<<EOD
|
2014-05-28 16:57:30 +02:00
|
|
|
<!DOCTYPE html>
|
2013-08-11 13:30:41 +02:00
|
|
|
<html>
|
2014-05-28 16:57:30 +02:00
|
|
|
<head>
|
2016-08-09 17:17:37 +02:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>{$title}</title>
|
|
|
|
<link href="css/HtmlFormat.css" rel="stylesheet">
|
|
|
|
<meta name="robots" content="noindex, follow">
|
2014-05-28 16:57:30 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2016-08-09 17:17:37 +02:00
|
|
|
<h1 class="pagetitle"><a href="{$uri}" target="_blank">{$title}</a></h1>
|
|
|
|
<div class="buttons">
|
|
|
|
<a href="./#bridge-{$_GET['bridge']}"><button class="backbutton">← back to rss-bridge</button></a>
|
|
|
|
<a href="./?{$atomquery}"><button class="rss-feed">RSS feed (ATOM)</button></a>
|
|
|
|
<a href="./?{$mrssquery}"><button class="rss-feed">RSS feed (MRSS)</button></a>
|
|
|
|
</div>
|
2013-08-11 13:30:41 +02:00
|
|
|
{$entries}
|
2014-05-28 16:57:30 +02:00
|
|
|
</body>
|
2013-08-11 13:30:41 +02:00
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
|
|
|
|
return $toReturn;
|
|
|
|
}
|
|
|
|
|
2013-08-12 22:37:19 +02:00
|
|
|
public function display() {
|
2013-08-11 13:30:41 +02:00
|
|
|
$this
|
|
|
|
->setContentType('text/html; charset=' . $this->getCharset())
|
|
|
|
->callContentType();
|
|
|
|
|
|
|
|
return parent::display();
|
|
|
|
}
|
2014-05-28 16:57:30 +02:00
|
|
|
}
|