more hooks, also add type hint for PluginHost::getInstance()

This commit is contained in:
Andrew Dolgov 2021-02-08 21:06:14 +03:00
parent 54bbd08f38
commit a14873d5b4
2 changed files with 6 additions and 4 deletions

View File

@ -731,9 +731,11 @@ class Article extends Handler_Protected {
define('ARTICLE_KIND_VIDEO', 2);
define('ARTICLE_KIND_YOUTUBE', 3);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ARTICLE_IMAGE) as $p) {
list ($article_image, $article_stream, $content) = $p->hook_article_image($enclosures, $content, $site_url);
}
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_IMAGE,
function ($result) use (&$article_image, &$article_stream, &$content) {
list ($article_image, $article_stream, $content) = $result;
},
$enclosures, $content, $site_url);
if (!$article_image && !$article_stream) {
$tmpdoc = new DOMDocument();

View File

@ -90,7 +90,7 @@ class PluginHost {
//
}
public static function getInstance() {
public static function getInstance(): PluginHost {
if (self::$instance == null)
self::$instance = new self();