From 72c04123d4bc4a585b96ff3db07fbc84c70fadbb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 7 Mar 2021 14:19:00 +0300 Subject: [PATCH] HOOK_ARTICLE_IMAGE: stop after first provided match --- classes/article.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/article.php b/classes/article.php index 432354f78..04855ac9d 100755 --- a/classes/article.php +++ b/classes/article.php @@ -550,8 +550,11 @@ class Article extends Handler_Protected { $article_kind = 0; PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_IMAGE, - function ($result) use (&$article_image, &$article_stream, &$content) { + function ($result, $plugin) use (&$article_image, &$article_stream, &$content) { list ($article_image, $article_stream, $content) = $result; + + // run until first hard match + return !empty($article_image); }, $enclosures, $content, $site_url, $headline);