diff --git a/classes/api.php b/classes/api.php index 9299c34ea..6debad2f7 100755 --- a/classes/api.php +++ b/classes/api.php @@ -754,8 +754,6 @@ class API extends Handler { } else { $headline_row["content"] = $line["content"]; } - - $headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']); } // unify label output to ease parsing @@ -776,22 +774,28 @@ class API extends Handler { $headline_row["note"] = $line["note"]; $headline_row["lang"] = $line["lang"]; - $hook_object = ["headline" => &$headline_row]; + if ($show_content) { + $hook_object = ["headline" => &$headline_row]; - PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, - function ($result) use (&$headline_row) { - $headline_row = $result; - }, - $hook_object); + list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures, + $line["content"], // unsanitized + $line["site_url"]); - list ($flavor_image, $flavor_stream, $flavor_kind) = Article::get_article_image($enclosures, $line["content"], $line["site_url"]); + $headline_row["flavor_image"] = $flavor_image; + $headline_row["flavor_stream"] = $flavor_stream; - $headline_row["flavor_image"] = $flavor_image; - $headline_row["flavor_stream"] = $flavor_stream; + /* optional */ + if ($flavor_kind) + $headline_row["flavor_kind"] = $flavor_kind; - /* optional */ - if ($flavor_kind) - $headline_row["flavor_kind"] = $flavor_kind; + PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_RENDER_ARTICLE_API, + function ($result) use (&$headline_row) { + $headline_row = $result; + }, + $hook_object); + + $headline_row["content"] = DiskCache::rewriteUrls($headline_row['content']); + } array_push($headlines, $headline_row); }