Merge branch 'inc-tags' of JustAMacUser/tt-rss into master

This commit is contained in:
fox 2021-01-10 08:28:24 +00:00 committed by Gogs
commit 8cf8db8456
1 changed files with 5 additions and 7 deletions

View File

@ -82,6 +82,7 @@ class Handler_Public extends Handler {
while ($line = $result->fetch()) { while ($line = $result->fetch()) {
$line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content"]), 100, '...')); $line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content"]), 100, '...'));
$line["tags"] = Article::get_article_tags($line["id"], $owner_uid);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
$line = $p->hook_query_headlines($line); $line = $p->hook_query_headlines($line);
@ -121,9 +122,7 @@ class Handler_Public extends Handler {
$tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url'] ? $line["site_url"] : get_self_url_prefix()), true); $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url'] ? $line["site_url"] : get_self_url_prefix()), true);
$tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title'] ? $line['feed_title'] : $feed_title), true); $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title'] ? $line['feed_title'] : $feed_title), true);
$tags = Article::get_article_tags($line["id"], $owner_uid); foreach ($line["tags"] as $tag) {
foreach ($tags as $tag) {
$tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
$tpl->addBlock('category'); $tpl->addBlock('category');
} }
@ -181,6 +180,7 @@ class Handler_Public extends Handler {
while ($line = $result->fetch()) { while ($line = $result->fetch()) {
$line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content_preview"]), 100, '...')); $line["content_preview"] = Sanitizer::sanitize(truncate_string(strip_tags($line["content_preview"]), 100, '...'));
$line["tags"] = Article::get_article_tags($line["id"], $owner_uid);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
$line = $p->hook_query_headlines($line, 100); $line = $p->hook_query_headlines($line, 100);
@ -202,12 +202,10 @@ class Handler_Public extends Handler {
if ($line['note']) $article['note'] = $line['note']; if ($line['note']) $article['note'] = $line['note'];
if ($article['author']) $article['author'] = $line['author']; if ($article['author']) $article['author'] = $line['author'];
$tags = Article::get_article_tags($line["id"], $owner_uid); if (count($line["tags"]) > 0) {
if (count($tags) > 0) {
$article['tags'] = array(); $article['tags'] = array();
foreach ($tags as $tag) { foreach ($line["tags"] as $tag) {
array_push($article['tags'], $tag); array_push($article['tags'], $tag);
} }
} }