koblog/bl-themes/defaultTheme/plugin.php
2025-07-15 14:09:04 +02:00

81 lines
2 KiB
PHP

<?php
class defaultTheme extends Plugin
{
public function init()
{
$this->dbFields = array(
'showPostInformation' => false,
'dateFormat' => 'relative',
'accentColor' => 'default',
'background' => '',
'backgroundTiled' => true,
'banner' => '',
'bannerTiled' => false
);
}
public function form()
{
$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', [
'default'=>'Blue',
'red'=>'Red',
'pink'=>'Pink',
'grape'=>'Grape',
'violet'=>'Violet',
'indigo'=>'Indigo',
'cyan'=>'Cyan',
'teal'=>'Teal',
'green'=>'Green',
'lime'=>'Lime',
'yellow'=>'Yellow',
'orange'=>'Orange'
], 'Change the accent color on the whole theme.');
return $html;
}
public function showPostInformation()
{
return $this->getValue('showPostInformation');
}
public function dateFormat()
{
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();
}
}