From: Andrew Dolgov Date: Fri, 26 May 2017 20:22:00 +0000 (+0300) Subject: add HOOK_FORMAT_ARTICLE & HOOK_FORMAT_ARTICLE_CDM X-Git-Tag: 17.12~179 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e50a64791687c27ba6a76df84a0e3b32dfd77936;p=tt-rss.git add HOOK_FORMAT_ARTICLE & HOOK_FORMAT_ARTICLE_CDM Feeds::format_headlines_list: add some comments for cdm article closing tags --- diff --git a/classes/article.php b/classes/article.php index b5a78523..8c8e0bdd 100644 --- a/classes/article.php +++ b/classes/article.php @@ -745,6 +745,10 @@ class Article extends Handler_Protected { $rv['content'] .= ""; } + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ARTICLE) as $p) { + $rv['content'] = $p->hook_format_article($rv['content'], $line, $zoom_mode); + } + return $rv; } diff --git a/classes/feeds.php b/classes/feeds.php index 809a8ff9..b0fa85f9 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -580,21 +580,21 @@ class Feeds extends Handler_Protected { onmouseout='postMouseOut($id)'"; $expanded_class = $expand_cdm ? "expanded" : "expandable"; - - $reply['content'] .= "
"; - $reply['content'] .= "
"; - $reply['content'] .= "
"; + $tmp_content .= "
"; + $tmp_content .= "
"; - $reply['content'] .= ""; - $reply['content'] .= "$marked_pic"; - $reply['content'] .= "$published_pic"; + $tmp_content .= "$marked_pic"; + $tmp_content .= "$published_pic"; - $reply['content'] .= "
"; + $tmp_content .= "
"; if ($highlight_words && count($highlight_words > 0)) { foreach ($highlight_words as $word) { @@ -604,7 +604,7 @@ class Feeds extends Handler_Protected { } // data-article-id included for context menu - $reply['content'] .= " @@ -615,9 +615,9 @@ class Feeds extends Handler_Protected { $line["title"] . " $entry_author"; - $reply['content'] .= $labels_str; + $tmp_content .= $labels_str; - $reply['content'] .= ""; + $tmp_content .= ""; if (!$vfeed_group_enabled) { if (@$line["feed_title"]) { $rgba = @$rgba_cache[$feed_id]; - $reply['content'] .= "
+ $tmp_content .= "
". truncate_string($line["feed_title"],30)." @@ -642,90 +642,87 @@ class Feeds extends Handler_Protected { } } - $reply['content'] .= " - $updated_fmt"; + $tmp_content .= "$updated_fmt"; - $reply['content'] .= "
"; - $reply['content'] .= "$score_pic"; + $tmp_content .= "
"; + $tmp_content .= "$score_pic"; if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) { - $reply['content'] .= "$feed_icon_img"; } - $reply['content'] .= "
"; + $tmp_content .= "
"; //scoreWrap - $reply['content'] .= "
"; + $tmp_content .= "
"; //cdmHeader - $reply['content'] .= "
"; - $reply['content'] .= "
"; + $tmp_content .= "
"; if ($line['note']) { - $reply['content'] .= Article::format_article_note($id, $line['note']); + $tmp_content .= Article::format_article_note($id, $line['note']); } - $reply['content'] .= "
"; + $tmp_content .= "
"; //POSTNOTE if (!$line['lang']) $line['lang'] = 'en'; - $reply['content'] .= "
"; + $tmp_content .= "
"; - if ($line["orig_feed_id"]) { + if ($line["orig_feed_id"]) { - $tmp_result = $this->dbh->query("SELECT * FROM ttrss_archived_feeds - WHERE id = ".$line["orig_feed_id"] . " AND owner_uid = " . $_SESSION["uid"]); + $tmp_result = $this->dbh->query("SELECT * FROM ttrss_archived_feeds + WHERE id = ".$line["orig_feed_id"] . " AND owner_uid = " . $_SESSION["uid"]); if ($this->dbh->num_rows($tmp_result) != 0) { - $reply['content'] .= "
"; - $reply['content'] .= __("Originally from:"); + $tmp_content .= "
"; + $tmp_content .= __("Originally from:"); - $reply['content'] .= " "; + $tmp_content .= " "; $tmp_line = $this->dbh->fetch_assoc($tmp_result); - $reply['content'] .= "" . $tmp_line['title'] . ""; - $reply['content'] .= " "; + $tmp_content .= " "; - $reply['content'] .= ""; - $reply['content'] .= ""; + $tmp_content .= ""; + $tmp_content .= ""; - $reply['content'] .= "
"; + $tmp_content .= "
"; } } - $reply['content'] .= ""; + $tmp_content .= ""; + $tmp_content .= ""; + $tmp_content .= htmlspecialchars($line["content"]); + $tmp_content .= ""; + $tmp_content .= ""; - $reply['content'] .= ""; - $reply['content'] .= htmlspecialchars($line["content"]); - $reply['content'] .= ""; + $tmp_content .= "
"; //cdmContentInner - $reply['content'] .= ""; - - $reply['content'] .= "
"; - - $reply['content'] .= "
"; + $tmp_content .= "
"; $always_display_enclosures = sql_bool_to_bool($line["always_display_enclosures"]); - $reply['content'] .= Article::format_article_enclosures($id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"])); + $tmp_content .= Article::format_article_enclosures($id, $always_display_enclosures, $line["content"], sql_bool_to_bool($line["hide_images"])); - $reply['content'] .= "
"; + $tmp_content .= "
"; // cdmIntermediate - $reply['content'] .= "
"; + $tmp_content .= "
"; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_LEFT_BUTTON) as $p) { - $reply['content'] .= $p->hook_article_left_button($line); + $tmp_content .= $p->hook_article_left_button($line); } $tags_str = Article::format_tags_string($tags, $id); - $reply['content'] .= ""; + $tmp_content .= ""; - $reply['content'] .= "Tags + $tmp_content .= "Tags $tags_str (+)"; @@ -749,25 +746,29 @@ class Feeds extends Handler_Protected { } } - if ($entry_comments) $reply['content'] .= " ($entry_comments)"; + if ($entry_comments) $tmp_content .= " ($entry_comments)"; - $reply['content'] .= ""; - $reply['content'] .= "
"; + $tmp_content .= ""; + $tmp_content .= "
"; -// $reply['content'] .= "$marked_pic"; -// $reply['content'] .= "$published_pic"; +// $tmp_content .= "$marked_pic"; +// $tmp_content .= "$published_pic"; foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_BUTTON) as $p) { - $reply['content'] .= $p->hook_article_button($line); + $tmp_content .= $p->hook_article_button($line); } - $reply['content'] .= "
"; - $reply['content'] .= "
"; + $tmp_content .= "
"; // buttons - $reply['content'] .= "
"; + $tmp_content .= "
"; // cdmFooter + $tmp_content .= "
"; // cdmContent + $tmp_content .= "
"; // RROW.cdm - $reply['content'] .= "
"; + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FORMAT_ARTICLE_CDM) as $p) { + $tmp_content = $p->hook_format_article_cdm($tmp_content, $line); + } + $reply['content'] .= $tmp_content; } ++$lnum; diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 047f50b5..afe4da49 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -52,6 +52,8 @@ class PluginHost { const HOOK_ARTICLE_EXPORT_FEED = 31; const HOOK_MAIN_TOOLBAR_BUTTON = 32; const HOOK_ENCLOSURE_ENTRY = 33; + const HOOK_FORMAT_ARTICLE = 34; + const HOOK_FORMAT_ARTICLE_CDM = 35; const KIND_ALL = 1; const KIND_SYSTEM = 2;