rename function to check if the plugin is enabled
This commit is contained in:
parent
ccb9123ac0
commit
f529cd26cb
7 changed files with 25 additions and 18 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
// Init scripts for the theme
|
||||
|
||||
// This theme use the API to work
|
||||
if (!pluginActivated('pluginAPI')) {
|
||||
if (!isPluginActive('pluginAPI')) {
|
||||
activatePlugin('pluginAPI');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<?php endif ?>
|
||||
|
||||
<!-- Custom search form if the plugin "search" is enabled -->
|
||||
<?php if (pluginActivated('pluginSearch')): ?>
|
||||
<?php if (isPluginActive('pluginSearch')): ?>
|
||||
<div class="form-inline d-block">
|
||||
<input id="search-input" class="form-control mr-sm-2" type="search" placeholder="<?php $language->p('Search') ?>" aria-label="Search">
|
||||
<button class="btn btn-outline-primary my-2 my-sm-0" type="button" onClick="searchNow()"><?php $language->p('Search') ?></button>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<div class="col-lg-8 mx-auto">
|
||||
|
||||
<!-- Search input -->
|
||||
<?php if (pluginActivated('pluginSearch')): ?>
|
||||
<?php if (isPluginActive('pluginSearch')): ?>
|
||||
<form class="d-flex mb-4">
|
||||
<input id="search-input" class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-primary" type="button" onClick="searchNow()">Search</button>
|
||||
|
|
Loading…
Reference in a new issue