remove theme's plugins from the list

This commit is contained in:
Diego Najar 2021-11-21 18:50:58 +01:00
parent 4cfdf1722b
commit 9bf2663353
5 changed files with 30 additions and 19 deletions

View file

@ -97,6 +97,10 @@ echo Bootstrap::formTitle(array('icon' => 'check-square', 'title' => $L->g('Enab
echo '<table class="table table-striped"><tbody>'; echo '<table class="table table-striped"><tbody>';
foreach ($pluginsInstalled as $plugin) { foreach ($pluginsInstalled as $plugin) {
if ($plugin->type() == 'theme') {
// Do not display theme's plugins
continue;
}
echo '<tr id="' . $plugin->className() . '" class="searchItem">'; echo '<tr id="' . $plugin->className() . '" class="searchItem">';
echo '<td class="align-middle pt-3 pb-3 w-25">'; echo '<td class="align-middle pt-3 pb-3 w-25">';
@ -105,10 +109,7 @@ foreach ($pluginsInstalled as $plugin) {
if (method_exists($plugin, 'form')) { if (method_exists($plugin, 'form')) {
echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'plugins-settings/' . $plugin->className() . '">' . $L->g('Settings') . '</a>'; echo '<a class="me-3" href="' . HTML_PATH_ADMIN_ROOT . 'plugins-settings/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
} }
// You can not disable a plugin for theme which is active
if ($plugin->type() != 'theme') {
echo '<span class="link deactivatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>'; echo '<span class="link deactivatePlugin" data-class-name="' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
}
echo '</div>'; echo '</div>';
echo '</td>'; echo '</td>';
@ -137,6 +138,10 @@ echo '<table class="table table-striped"><tbody>';
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled); $pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
foreach ($pluginsNotInstalled as $plugin) { foreach ($pluginsNotInstalled as $plugin) {
if ($plugin->type() == 'theme') {
// Do not display theme's plugins
continue;
}
echo '<tr id="' . $plugin->className() . '" class="searchItem">'; echo '<tr id="' . $plugin->className() . '" class="searchItem">';
echo '<td class="align-middle pt-3 pb-3 w-25">'; echo '<td class="align-middle pt-3 pb-3 w-25">';

View file

@ -45,7 +45,7 @@ foreach ($themes as $theme) {
echo ' echo '
<tr> <tr>
<td class="align-middle pt-4 pb-4"> <td class="align-middle pt-4 pb-4">
<div>'.$theme['name'].($theme['dirname']==$site->theme()?'<span class="badge bg-primary ms-2">'.$L->g('Enabled').'</span>':'').'</div> <div>'.$theme['name'].($theme['dirname']==$site->theme()?'<span class="badge bg-primary ms-2">'.$L->g('Active').'</span>':'').'</div>
<div class="mt-1"> <div class="mt-1">
'; ';

View file

@ -9,23 +9,20 @@ $theme = getPlugin($site->theme()); // Returns plugin object or False
// Functions // Functions
// ============================================================================ // ============================================================================
function buildThemes() function buildThemes() {
{
global $site; global $site;
$themes = array(); $themes = array();
$themesPaths = Filesystem::listDirectories(PATH_THEMES); $themesPaths = Filesystem::listDirectories(PATH_THEMES);
foreach($themesPaths as $themePath) foreach ($themesPaths as $themePath) {
{
// Check if the theme is translated. // Check if the theme is translated.
$languageFilename = $themePath.DS.'languages'.DS.$site->language().'.json'; $languageFilename = $themePath.DS.'languages'.DS.$site->language().'.json';
if( !Sanitize::pathFile($languageFilename) ) { if( !Sanitize::pathFile($languageFilename) ) {
$languageFilename = $themePath.DS.'languages'.DS.DEFAULT_LANGUAGE_FILE; $languageFilename = $themePath.DS.'languages'.DS.DEFAULT_LANGUAGE_FILE;
} }
if( Sanitize::pathFile($languageFilename) ) if( Sanitize::pathFile($languageFilename) ) {
{
$database = file_get_contents($languageFilename); $database = file_get_contents($languageFilename);
$database = json_decode($database, true); $database = json_decode($database, true);
if (empty($database)) { if (empty($database)) {

View file

@ -113,3 +113,12 @@ footer {
.bi { .bi {
margin-right: .5rem!important; margin-right: .5rem!important;
} }
/* Remove Focus glow */
.btn:focus,
.form-control:focus,
.form-select:focus,
input:focus {
outline: none !important;
box-shadow: none !important;
}