summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
committerAndrew Dolgov <[email protected]>2021-02-05 23:41:32 +0300
commit403dca154c6b539de221f9e16174a0fdd0a1e896 (patch)
tree8187096f0e04ecb60440c8551514d990d0e85b2d /classes/pluginhost.php
parentb4cbc792cc5fbbd5356f91038bf6cf5e67a19e42 (diff)
initial WIP for php8; bump php version requirement to 7.0
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 08871af51..e56a237fc 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 {
@@ -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