From da1b3e3ba151945eb8574b37d4f0231335c9faee Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 2 Mar 2019 17:57:25 +0300 Subject: [PATCH] digest: add ARTICLE_LABELS --- classes/backend.php | 7 ++++--- classes/digest.php | 11 +++++++++++ templates/digest_template_html.txt | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/classes/backend.php b/classes/backend.php index 1e1165517..bd4686aa9 100644 --- a/classes/backend.php +++ b/classes/backend.php @@ -11,9 +11,10 @@ class Backend extends Handler { $rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000); - $rv[3] = "
" . $rv[3] . "
"; - - print_r($rv); + print "

HTML

"; + print $rv[0]; + print "

Plain text

"; + print "
".$rv[3]."
"; } private function display_main_help() { diff --git a/classes/digest.php b/classes/digest.php index 0d2cac77e..68a14ef68 100644 --- a/classes/digest.php +++ b/classes/digest.php @@ -166,6 +166,15 @@ class Digest $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; } + $article_labels = Article::get_article_labels($line["ref_id"], $user_id); + $article_labels_formatted = ""; + + if (is_array($article_labels) && count($article_labels) > 0) { + $article_labels_formatted = implode(", ", array_map(function($a) { + return $a[1]; + }, $article_labels)); + } + $tpl->setVariable('FEED_TITLE', $line["feed_title"]); $tpl->setVariable('ARTICLE_TITLE', $line["title"]); $tpl->setVariable('ARTICLE_LINK', $line["link"]); @@ -174,6 +183,7 @@ class Digest truncate_string(strip_tags($line["content"]), 300)); // $tpl->setVariable('ARTICLE_CONTENT', // strip_tags($article_content)); + $tpl->setVariable('ARTICLE_LABELS', $article_labels_formatted, true); $tpl->addBlock('article'); @@ -181,6 +191,7 @@ class Digest $tpl_t->setVariable('ARTICLE_TITLE', $line["title"]); $tpl_t->setVariable('ARTICLE_LINK', $line["link"]); $tpl_t->setVariable('ARTICLE_UPDATED', $updated); + $tpl_t->setVariable('ARTICLE_LABELS', $article_labels_formatted, true); // $tpl_t->setVariable('ARTICLE_EXCERPT', // truncate_string(strip_tags($line["excerpt"]), 100)); diff --git a/templates/digest_template_html.txt b/templates/digest_template_html.txt index 0759e8a05..ede93d917 100644 --- a/templates/digest_template_html.txt +++ b/templates/digest_template_html.txt @@ -6,7 +6,8 @@