1
0
Fork 0
forked from blallo/rss-bridge

Implemented feed item categories (#746)

This commit is contained in:
Eugene Molotov 2018-07-16 15:32:24 +05:00 committed by Teromene
parent 3f41d0593a
commit 049ee52fb5
4 changed files with 40 additions and 1 deletions

View file

@ -40,6 +40,16 @@ class AtomFormat extends FormatAbstract{
}
}
$entryCategories = '';
if(isset($item['categories'])) {
foreach($item['categories'] as $category) {
$entryCategories .= '<category term="'
. $this->xml_encode($category)
. '"/>'
. PHP_EOL;
}
}
$entries .= <<<EOD
<entry>
@ -52,6 +62,7 @@ class AtomFormat extends FormatAbstract{
<updated>{$entryTimestamp}</updated>
<content type="html">{$entryContent}</content>
{$entryEnclosures}
{$entryCategories}
</entry>
EOD;

View file

@ -47,6 +47,20 @@ class HtmlFormat extends FormatAbstract {
$entryEnclosures .= '</div>';
}
$entryCategories = '';
if(isset($item['categories'])) {
$entryCategories = '<div class="categories"><p>Categories:</p>';
foreach($item['categories'] as $category) {
$entryCategories .= '<li class="category">'
. $this->sanitizeHtml($category)
. '</li>';
}
$entryCategories .= '</div>';
}
$entries .= <<<EOD
<section class="feeditem">
@ -55,6 +69,7 @@ class HtmlFormat extends FormatAbstract {
{$entryAuthor}
{$entryContent}
{$entryEnclosures}
{$entryCategories}
</section>
EOD;

View file

@ -51,6 +51,16 @@ Some media files might not be shown to you. Consider using the ATOM format inste
}
}
$entryCategories = '';
if(isset($item['categories'])) {
foreach($item['categories'] as $category) {
$entryCategories .= '<category>'
. $category . '</category>'
. PHP_EOL;
}
}
$items .= <<<EOD
<item>
@ -61,6 +71,7 @@ Some media files might not be shown to you. Consider using the ATOM format inste
<description>{$itemContent}{$entryEnclosuresWarning}</description>
<author>{$itemAuthor}</author>
{$entryEnclosures}
{$entryCategories}
</item>
EOD;

View file

@ -69,12 +69,14 @@ a.backlink, a.backlink:link, a.backlink:visited, a.itemtitle, a.itemtitle:link,
}
section > div.content, section > div.categories,
section > div.content, section > div.attachments {
padding: 10px;
}
section > div.categories > li.category,
section > div.attachments > li.enclosure {
list-style-type: circle;
@ -114,4 +116,4 @@ img {
max-width: 100%;
}
}