♻️ Support theme plugins inside the theme

Fixes #81
This commit is contained in:
Kazhnuz 2025-07-13 19:48:38 +02:00
parent 25cf8ef5be
commit f79056a247
26 changed files with 88 additions and 208 deletions

View file

@ -263,6 +263,7 @@ define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN . HTML_PATH_UPLOADS_THUMBNAILS);
define('DOMAIN_PLUGINS', DOMAIN . HTML_PATH_PLUGINS);
define('DOMAIN_MODULES', DOMAIN . HTML_PATH_MODULES);
define('DOMAIN_CONTENT', DOMAIN . HTML_PATH_CONTENT);
define('DOMAIN_THEMES', DOMAIN . HTML_PATH_THEMES);
define('DOMAIN_ADMIN', DOMAIN_BASE . ADMIN_URI_FILTER . '/');

View file

@ -86,8 +86,13 @@ function buildPlugins($path, $domain, $autoActivate = false)
$database = json_decode($database, true);
// Set name and description from the language file
$Plugin->setMetadata('name',$database['plugin-data']['name']);
$Plugin->setMetadata('description',$database['plugin-data']['description']);
if ($database['theme-data']) {
$Plugin->setMetadata('name',$database['theme-data']['name']);
$Plugin->setMetadata('description',$database['theme-data']['description']);
} else {
$Plugin->setMetadata('name',$database['plugin-data']['name']);
$Plugin->setMetadata('description',$database['plugin-data']['description']);
}
$Plugin->setMetadata('isModule',$autoActivate);
// Remove name and description from the language file loaded and add new words if there are
@ -137,3 +142,4 @@ function buildPlugins($path, $domain, $autoActivate = false)
buildPlugins(PATH_PLUGINS, DOMAIN_PLUGINS);
buildPlugins(PATH_MODULES, DOMAIN_MODULES, true);
buildPlugins(PATH_THEMES, DOMAIN_THEMES);

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,13 +0,0 @@
{
"plugin-data": {
"name": "Alternative Theme",
"description": "This plugin provides configuration for the Alternative theme."
},
"enable-or-disable-dark-mode": "Enable or disable dark mode.",
"enable-or-disable-google-fonts": "Enable or disable Google fonts.",
"relative": "Relative",
"absolute": "Absolute",
"change-the-date-format-for-the-main-page": "Change the date format for the main page.",
"show-tags": "Show tags",
"show-tags-in-the-main-page-for-each-article": "Show tags on the main page for each article."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Popeye Theme",
"description": "Popeyeテーマの設定を行うプラグインです。"
},
"enable-or-disable-dark-mode": "ダークモードを有効または無効にします。",
"enable-or-disable-google-fonts": "Google Fontsの利用を有効または無効にします。",
"relative": "相対的",
"absolute": "絶対的",
"change-the-date-format-for-the-main-page": "メインページの日付表示形式を変更します。",
"show-tags": "タグの表示",
"show-tags-in-the-main-page-for-each-article": "メインページの各記事にタグを表示します。"
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Popeye Thema",
"description": "Met deze plugin kan het thema Popeye geconfigureerd worden."
},
"enable-or-disable-dark-mode": "Donkere modus in-/uitschakelen.",
"enable-or-disable-google-fonts": "Lettertypes van Google in-/uitschakelen.",
"relative": "Relatief",
"absolute": "Absoluut",
"change-the-date-format-for-the-main-page": "Het datumformaat voor de hoofdpagina aanpassen.",
"show-tags": "Tags tonen",
"show-tags-in-the-main-page-for-each-article": "Op de hoofdpagina voor ieder artikel de tags tonen."
}

View file

@ -1,13 +0,0 @@
{
"plugin-data": {
"name": "Настройки темы Alternative",
"description": "Этот плагин содержит настройки для темы Alternative."
},
"enable-or-disable-dark-mode": "Включить или выключить тёмный режим.",
"enable-or-disable-google-fonts": "Включить или выключить шрифты от Google (Google fonts).",
"relative": "Относительный",
"absolute": "Абсолютный",
"change-the-date-format-for-the-main-page": "Изменить формат даты для главной страницы.",
"show-tags": "Отображать теги",
"show-tags-in-the-main-page-for-each-article": "Показывать теги на главной странице для каждой записи."
}

View file

@ -1,11 +0,0 @@
{
"author": "Koblog",
"email": "",
"website": "https://plugins.koblog.com",
"version": "kb_0.0.1",
"releaseDate": "2023-07-10",
"license": "MIT",
"compatible": "kb_0.0.1",
"notes": "",
"type": "theme"
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Theme Popeye",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
},
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
"relative": "Relativ",
"absolute": "Absolut",
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
"show-tags": "Schlagwörter zeigen",
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
}

View file

@ -1,13 +0,0 @@
{
"plugin-data": {
"name": "Popeye Theme",
"description": "This plugin provides configuration for the Popeye theme."
},
"enable-or-disable-dark-mode": "Enable or disable dark mode.",
"enable-or-disable-google-fonts": "Enable or disable Google fonts.",
"relative": "Relative",
"absolute": "Absolute",
"change-the-date-format-for-the-main-page": "Change the date format for the main page.",
"show-tags": "Show tags",
"show-tags-in-the-main-page-for-each-article": "Show tags on the main page for each article."
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Popeye Theme",
"description": "Popeyeテーマの設定を行うプラグインです。"
},
"enable-or-disable-dark-mode": "ダークモードを有効または無効にします。",
"enable-or-disable-google-fonts": "Google Fontsの利用を有効または無効にします。",
"relative": "相対的",
"absolute": "絶対的",
"change-the-date-format-for-the-main-page": "メインページの日付表示形式を変更します。",
"show-tags": "タグの表示",
"show-tags-in-the-main-page-for-each-article": "メインページの各記事にタグを表示します。"
}

View file

@ -1,14 +0,0 @@
{
"plugin-data":
{
"name": "Popeye Thema",
"description": "Met deze plugin kan het thema Popeye geconfigureerd worden."
},
"enable-or-disable-dark-mode": "Donkere modus in-/uitschakelen.",
"enable-or-disable-google-fonts": "Lettertypes van Google in-/uitschakelen.",
"relative": "Relatief",
"absolute": "Absoluut",
"change-the-date-format-for-the-main-page": "Het datumformaat voor de hoofdpagina aanpassen.",
"show-tags": "Tags tonen",
"show-tags-in-the-main-page-for-each-article": "Op de hoofdpagina voor ieder artikel de tags tonen."
}

View file

@ -1,11 +0,0 @@
{
"author": "Koblog",
"email": "",
"website": "https://plugins.koblog.com",
"version": "kb_0.0.1",
"releaseDate": "2023-07-10",
"license": "MIT",
"compatible": "kb_0.0.1",
"notes": "",
"type": "theme"
}

View file

@ -3,5 +3,12 @@
{
"name": "Alternative",
"description": "Simple and elegant theme for websites or blogs. Navbar with social media and static pages."
}
},
"enable-or-disable-dark-mode": "Enable or disable dark mode.",
"enable-or-disable-google-fonts": "Enable or disable Google fonts.",
"relative": "Relative",
"absolute": "Absolute",
"change-the-date-format-for-the-main-page": "Change the date format for the main page.",
"show-tags": "Show tags",
"show-tags-in-the-main-page-for-each-article": "Show tags on the main page for each article."
}

View file

@ -8,5 +8,6 @@
"compatible": "3.15",
"notes": "",
"plugin": "alternative",
"supports": []
"supports": [],
"type": "theme"
}

View file

@ -0,0 +1,6 @@
:root {
--accent-color-dark: #6741d9; /* violet 8 */
--accent-color-dark-hover: #5f3dc4; /* violet 9 */
--accent-color-light: #e5dbff; /* violet 2 */
--accent-color-light-hover: #f3f0ff; /* violet 1 */
}

View file

@ -7,5 +7,7 @@
"license": "MIT",
"compatible": "kb_0.0.1",
"notes": "",
"supports": ["sidebar"]
"supports": ["sidebar"],
"plugin": "defaultTheme",
"type": "theme"
}

View file

@ -0,0 +1,50 @@
<?php
class defaultTheme extends Plugin
{
public function init()
{
$this->dbFields = array(
'showPostInformation' => false,
'dateFormat' => 'relative'
);
}
public function form()
{
global $L;
$html = '';
$html .= '<div class="mb-3">';
$html .= '<label class="form-label" for="showPostInformation">' . $L->get('Show Post Information') . '</label>';
$html .= '<select class="form-select" id="showPostInformation" name="showPostInformation">';
$html .= '<option value="false" ' . ($this->getValue('showPostInformation') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '<option value="true" ' . ($this->getValue('showPostInformation') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '</select>';
$html .= '</div>';
$html .= '<div class="mb-3">';
$html .= '<label class="form-label" for="dateFormat">' . $L->get('Date format') . '</label>';
$html .= '<select class="form-select" id="dateFormat" name="dateFormat">';
$html .= '<option value="noshow" ' . ($this->getValue('dateFormat') == 'noshow' ? 'selected' : '') . '>' . $L->get('No show') . '</option>';
$html .= '<option value="relative" ' . ($this->getValue('dateFormat') == 'relative' ? 'selected' : '') . '>' . $L->get('Relative') . '</option>';
$html .= '<option value="absolute" ' . ($this->getValue('dateFormat') == 'absolute' ? 'selected' : '') . '>' . $L->get('Absolute') . '</option>';
$html .= '</select>';
$html .= '<div class="form-text">' . $L->get('Change the date format for the main page.') . '</div>';
$html .= '</div>';
return $html;
}
public function showPostInformation()
{
return $this->getValue('showPostInformation');
}
public function dateFormat()
{
return $this->getValue('dateFormat');
}
}

View file

@ -6,5 +6,12 @@
},
"related-pages": "Related pages",
"minutes": "minutes",
"read": "read"
"read": "read",
"enable-or-disable-dark-mode": "Enable or disable dark mode.",
"enable-or-disable-google-fonts": "Enable or disable Google fonts.",
"relative": "Relative",
"absolute": "Absolute",
"change-the-date-format-for-the-main-page": "Change the date format for the main page.",
"show-tags": "Show tags",
"show-tags-in-the-main-page-for-each-article": "Show tags on the main page for each article."
}

View file

@ -7,5 +7,6 @@
"license": "MIT",
"compatible": "3.0",
"notes": "",
"plugin": "popeye"
"plugin": "popeye",
"type": "theme"
}