From 072728b5c76aea957ddf6e97ac16f5f3d0d26fd9 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Tue, 15 Jul 2025 14:09:04 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20banner=20and=20background?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bl-kernel/helpers/pluginsettings.class.php | 23 ++++++++++++++ bl-themes/defaultTheme/php/head.php | 24 +++++++++++++++ bl-themes/defaultTheme/plugin.php | 35 +++++++++++++++++++++- 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/bl-kernel/helpers/pluginsettings.class.php b/bl-kernel/helpers/pluginsettings.class.php index 17fa5d00..b57496c8 100644 --- a/bl-kernel/helpers/pluginsettings.class.php +++ b/bl-kernel/helpers/pluginsettings.class.php @@ -42,4 +42,27 @@ class PluginSettings return $html; } + + public static function medias($plugin, $settingName, $title, $description = "") + { + + global $L; + global $medias; + + $html = '
'; + $html .= ''; + $html .= ''; + if ($description != "") { + $html .= '
' . $L->get($description) . '
'; + } + $html .= '
'; + + return $html; + } } \ No newline at end of file diff --git a/bl-themes/defaultTheme/php/head.php b/bl-themes/defaultTheme/php/head.php index c6d8db7a..022197be 100644 --- a/bl-themes/defaultTheme/php/head.php +++ b/bl-themes/defaultTheme/php/head.php @@ -17,5 +17,29 @@ getValue('accentColor').'.css'); ?> + + diff --git a/bl-themes/defaultTheme/plugin.php b/bl-themes/defaultTheme/plugin.php index dad572fa..40ff11a5 100644 --- a/bl-themes/defaultTheme/plugin.php +++ b/bl-themes/defaultTheme/plugin.php @@ -8,7 +8,11 @@ class defaultTheme extends Plugin $this->dbFields = array( 'showPostInformation' => false, 'dateFormat' => 'relative', - 'accentColor' => 'default' + 'accentColor' => 'default', + 'background' => '', + 'backgroundTiled' => true, + 'banner' => '', + 'bannerTiled' => false ); } @@ -16,6 +20,11 @@ class defaultTheme extends Plugin { $html = ''; + $html .= PluginSettings::medias($this, 'background', 'Blog background'); + $html .= PluginSettings::bool($this, 'backgroundTiled', 'Tiled blog background'); + $html .= PluginSettings::medias($this, 'banner', 'Banner background'); + $html .= PluginSettings::bool($this, 'bannerTiled', 'Tiled Banner background'); + $html .= PluginSettings::bool($this, 'showPostInformation', 'Show Post Information'); $html .= PluginSettings::values($this,'dateFormat', 'Date format', ['noshow'=>'No show', 'relative'=>'Relative', 'absolute'=>'Absolute'], 'Change the date format for the main page.'); $html .= PluginSettings::values($this,'accentColor', 'Accent Color', [ @@ -45,4 +54,28 @@ class defaultTheme extends Plugin { return $this->getValue('dateFormat'); } + + public function haveBanner() { + return ($this->getValue('banner') != ''); + } + + public function haveBackground() { + return ($this->getValue('background') != ''); + } + + public function bannerURI() + { + if ($this->getValue('banner') == '') { + return ''; + } + return new Media($this->getValue('banner'))->permalink(); + } + + public function backgroundURI() + { + if ($this->getValue('background') == '') { + return ''; + } + return new Media($this->getValue('background'))->permalink(); + } }