From f529cd26cb7341ee4fe84f3e31ad65de34c7339d Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sat, 25 Sep 2021 20:29:31 +0200 Subject: [PATCH] rename function to check if the plugin is enabled --- bl-kernel/abstract/plugin.class.php | 9 +++++--- .../admin/controllers/plugins-settings.php | 2 +- bl-kernel/admin/themes/booty/init.php | 2 +- bl-kernel/functions.php | 22 +++++++++++-------- bl-kernel/helpers/html.class.php | 4 ++-- bl-themes/alternative/php/home.php | 2 +- bl-themes/popeye/php/home.php | 2 +- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/bl-kernel/abstract/plugin.class.php b/bl-kernel/abstract/plugin.class.php index 68fb1fcf..909ec3e6 100644 --- a/bl-kernel/abstract/plugin.class.php +++ b/bl-kernel/abstract/plugin.class.php @@ -262,9 +262,12 @@ class Plugin { return true; } - // Returns TRUE if the plugin is installed - // This function just check if the database of the plugin is created - public function installed() + /** + * Returns True if the plugin is installed + * + * @return boolean + */ + public function installed(): bool { return file_exists($this->filenameDb); } diff --git a/bl-kernel/admin/controllers/plugins-settings.php b/bl-kernel/admin/controllers/plugins-settings.php index 13a832f6..440629e6 100644 --- a/bl-kernel/admin/controllers/plugins-settings.php +++ b/bl-kernel/admin/controllers/plugins-settings.php @@ -18,7 +18,7 @@ $plugin = false; $pluginClassName = $layout['parameters']; // Check if the plugin is installed/activated -if (pluginActivated($pluginClassName)) { +if (isPluginActive($pluginClassName)) { $plugin = $plugins['all'][$pluginClassName]; } else { Redirect::page('plugins'); diff --git a/bl-kernel/admin/themes/booty/init.php b/bl-kernel/admin/themes/booty/init.php index 93ae2a4e..a1210e01 100644 --- a/bl-kernel/admin/themes/booty/init.php +++ b/bl-kernel/admin/themes/booty/init.php @@ -3,6 +3,6 @@ // Init scripts for the theme // This theme use the API to work -if (!pluginActivated('pluginAPI')) { +if (!isPluginActive('pluginAPI')) { activatePlugin('pluginAPI'); } diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index 1d8267a8..957d3821 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -877,21 +877,25 @@ function buildParentPages() { function getPlugin($pluginClassName) { global $plugins; - if (pluginActivated($pluginClassName)) { + if (isPluginActive($pluginClassName)) { return $plugins['all'][$pluginClassName]; } return false; } -// Check if the plugin is activated / installed -// Returns TRUE if the plugin is activated / installed, FALSE otherwise -function pluginActivated($pluginClassName) { - global $plugins; +/** + * Returns True if the plugin is installed + * + * @param string $pluginClassName Plugin class name + * @return boolean + */ +function isPluginActive(string $pluginClassName): bool { + global $plugins; - if (isset($plugins['all'][$pluginClassName])) { - return $plugins['all'][$pluginClassName]->installed(); - } - return false; + if (isset($plugins['all'][$pluginClassName])) { + return $plugins['all'][$pluginClassName]->installed(); + } + return false; } diff --git a/bl-kernel/helpers/html.class.php b/bl-kernel/helpers/html.class.php index 3fb6b13b..76f04fcb 100644 --- a/bl-kernel/helpers/html.class.php +++ b/bl-kernel/helpers/html.class.php @@ -244,7 +244,7 @@ class HTML { public static function rssUrl() { - if (pluginActivated('pluginRSS')) { + if (isPluginActive('pluginRSS')) { return DOMAIN_BASE.'rss.xml'; } return false; @@ -252,7 +252,7 @@ class HTML { public static function sitemapUrl() { - if (pluginActivated('pluginSitemap')) { + if (isPluginActive('pluginSitemap')) { return DOMAIN_BASE.'sitemap.xml'; } return false; diff --git a/bl-themes/alternative/php/home.php b/bl-themes/alternative/php/home.php index 6d097d3e..79db6012 100644 --- a/bl-themes/alternative/php/home.php +++ b/bl-themes/alternative/php/home.php @@ -10,7 +10,7 @@ - +
diff --git a/bl-themes/popeye/php/home.php b/bl-themes/popeye/php/home.php index ea44ec1f..a0025b5d 100644 --- a/bl-themes/popeye/php/home.php +++ b/bl-themes/popeye/php/home.php @@ -25,7 +25,7 @@
- +