HOOK_ARTICLE_BUTTON/HOOK_ARTICLE_LEFT_BUTTON: only try to parse markup if its actually there

This commit is contained in:
Andrew Dolgov 2021-10-26 15:45:12 +03:00
parent 933913410c
commit 76d8b1bf6f
1 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ class Feeds extends Handler_Protected {
$line["buttons_left"] = ""; $line["buttons_left"] = "";
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_LEFT_BUTTON, PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_LEFT_BUTTON,
function ($result, $plugin) use (&$line, &$button_doc) { function ($result, $plugin) use (&$line, &$button_doc) {
if ($button_doc->loadXML($result)) { if ($result && $button_doc->loadXML($result)) {
/** @var DOMElement|null */ /** @var DOMElement|null */
$child = $button_doc->firstChild; $child = $button_doc->firstChild;
@ -254,7 +254,7 @@ class Feeds extends Handler_Protected {
$line["buttons"] = ""; $line["buttons"] = "";
PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_BUTTON, PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_ARTICLE_BUTTON,
function ($result, $plugin) use (&$line, &$button_doc) { function ($result, $plugin) use (&$line, &$button_doc) {
if ($button_doc->loadXML($result)) { if ($result && $button_doc->loadXML($result)) {
/** @var DOMElement|null */ /** @var DOMElement|null */
$child = $button_doc->firstChild; $child = $button_doc->firstChild;