mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-18 11:11:29 +00:00
pluginhost: deny hook registration to plugins which lack relevant implementation methods
This commit is contained in:
@@ -204,6 +204,15 @@ class PluginHost {
|
|||||||
function add_hook($type, $sender, $priority = 50) {
|
function add_hook($type, $sender, $priority = 50) {
|
||||||
$priority = (int) $priority;
|
$priority = (int) $priority;
|
||||||
|
|
||||||
|
if (!method_exists($sender, strtolower($type))) {
|
||||||
|
user_error(
|
||||||
|
sprintf("Plugin %s tried to register a hook without implementation: %s",
|
||||||
|
get_class($sender), $type),
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($this->hooks[$type])) {
|
if (empty($this->hooks[$type])) {
|
||||||
$this->hooks[$type] = [];
|
$this->hooks[$type] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user