summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-07 13:22:38 +0300
committerAndrew Dolgov <[email protected]>2021-03-07 13:22:38 +0300
commitac6a59914b0c1a20f084f9ae9a3136b28c89493e (patch)
tree122b1489c91496bb2768a8b84c96af6e8d0321c6 /classes
parentffb93d72acb60d1418cc00f2bc676a623f7e5e1c (diff)
nsfw: support API clients
Diffstat (limited to 'classes')
-rwxr-xr-xclasses/api.php3
-rwxr-xr-xclasses/article.php4
-rwxr-xr-xclasses/feeds.php29
-rwxr-xr-xclasses/handler/public.php2
4 files changed, 19 insertions, 19 deletions
diff --git a/classes/api.php b/classes/api.php
index 952c97166..0cac0bb90 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -787,7 +787,8 @@ class API extends Handler {
list ($flavor_image, $flavor_stream, $flavor_kind) = Article::_get_image($enclosures,
$line["content"], // unsanitized
- $line["site_url"]);
+ $line["site_url"],
+ $headline_row);
$headline_row["flavor_image"] = $flavor_image;
$headline_row["flavor_stream"] = $flavor_stream;
diff --git a/classes/article.php b/classes/article.php
index 648b1e2c1..432354f78 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -543,7 +543,7 @@ class Article extends Handler_Protected {
return $rv;
}
- static function _get_image($enclosures, $content, $site_url) {
+ static function _get_image(array $enclosures, string $content, string $site_url, array $headline) {
$article_image = "";
$article_stream = "";
@@ -553,7 +553,7 @@ class Article extends Handler_Protected {
function ($result) use (&$article_image, &$article_stream, &$content) {
list ($article_image, $article_stream, $content) = $result;
},
- $enclosures, $content, $site_url);
+ $enclosures, $content, $site_url, $headline);
if (!$article_image && !$article_stream) {
$tmpdoc = new DOMDocument();
diff --git a/classes/feeds.php b/classes/feeds.php
index 5eb5c26d0..68d535481 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -251,21 +251,6 @@ class Feeds extends Handler_Protected {
$this->_mark_timestamp(" sanitize");
- PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_CDM,
- function ($result, $plugin) use (&$line) {
- $line = $result;
- $this->_mark_timestamp(" hook_render_cdm: " . get_class($plugin));
- },
- $line);
-
- $this->_mark_timestamp(" hook_render_cdm");
-
- $line['content'] = DiskCache::rewrite_urls($line['content']);
-
- $this->_mark_timestamp(" disk_cache_rewrite");
-
- $this->_mark_timestamp(" note");
-
if (!get_pref(Prefs::CDM_EXPANDED)) {
$line["cdm_excerpt"] = "<span class='collapse'>
<i class='material-icons' onclick='return Article.cdmUnsetActive(event)'
@@ -330,6 +315,20 @@ class Feeds extends Handler_Protected {
}
$this->_mark_timestamp(" color");
+ $this->_mark_timestamp(" pre-hook_render_cdm");
+
+ PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_CDM,
+ function ($result, $plugin) use (&$line) {
+ $line = $result;
+ $this->_mark_timestamp(" hook: " . get_class($plugin));
+ },
+ $line);
+
+ $this->_mark_timestamp(" hook_render_cdm");
+
+ $line['content'] = DiskCache::rewrite_urls($line['content']);
+
+ $this->_mark_timestamp(" disk_cache_rewrite");
/* we don't need those */
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 15ea01103..2de073cc2 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -152,7 +152,7 @@ class Handler_Public extends Handler {
$tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', "", true);
}
- list ($og_image, $og_stream) = Article::_get_image($enclosures, $line['content'], $feed_site_url);
+ list ($og_image, $og_stream) = Article::_get_image($enclosures, $line['content'], $feed_site_url, $line);
$tpl->setVariable('ARTICLE_OG_IMAGE', $og_image, true);