diff options
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-x | classes/pluginhost.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 08871af51..bcde12551 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -128,7 +128,7 @@ class PluginHost { } function get_plugin($name) { - return $this->plugins[strtolower($name)]; + return $this->plugins[strtolower($name)] ?? null; } function run_hooks($type, $method, $args) { @@ -140,11 +140,11 @@ class PluginHost { function add_hook($type, $sender, $priority = 50) { $priority = (int) $priority; - if (!is_array($this->hooks[$type])) { + if (empty($this->hooks[$type])) { $this->hooks[$type] = []; } - if (!is_array($this->hooks[$type][$priority])) { + if (empty($this->hooks[$type][$priority])) { $this->hooks[$type][$priority] = []; } @@ -277,7 +277,7 @@ class PluginHost { function is_system($plugin) { $about = $plugin->about(); - return @$about[3]; + return $about[3] ?? false; } // only system plugins are allowed to modify routing @@ -307,7 +307,7 @@ class PluginHost { $handler = str_replace("-", "_", strtolower($handler)); $method = strtolower($method); - if (is_array($this->handlers[$handler])) { + if (isset($this->handlers[$handler])) { if (isset($this->handlers[$handler]["*"])) { return $this->handlers[$handler]["*"]; } else { @@ -390,13 +390,13 @@ class PluginHost { if ($sth->fetch()) { $sth = $this->pdo_data->prepare("UPDATE ttrss_plugin_storage SET content = ? WHERE owner_uid= ? AND name = ?"); - $sth->execute([(string)$content, $this->owner_uid, $plugin]); + $sth->execute([$content, $this->owner_uid, $plugin]); } else { $sth = $this->pdo_data->prepare("INSERT INTO ttrss_plugin_storage (name,owner_uid,content) VALUES (?, ?, ?)"); - $sth->execute([$plugin, $this->owner_uid, (string)$content]); + $sth->execute([$plugin, $this->owner_uid, $content]); } $this->pdo_data->commit(); @@ -429,9 +429,7 @@ class PluginHost { function get_all($sender) { $idx = get_class($sender); - $data = $this->storage[$idx]; - - return $data ? $data : []; + return $this->storage[$idx] ?? []; } function clear_data($sender) { @@ -461,7 +459,7 @@ class PluginHost { } function get_feeds($cat_id) { - return $this->feeds[$cat_id]; + return $this->feeds[$cat_id] ?? []; } // convert feed_id (e.g. -129) to pfeed_id first |