Refactor Alternative theme for Bludit v4 and include plugin for settings

This commit is contained in:
Diego Najar 2021-11-22 10:57:27 +01:00
parent 9bf2663353
commit 92b91bfde6
17 changed files with 228 additions and 90 deletions

View file

@ -0,0 +1,14 @@
{
"plugin-data":
{
"name": "Alternative Alternative",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Alternative."
},
"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

@ -0,0 +1,14 @@
{
"plugin-data":
{
"name": "Theme Alternative",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Alternative."
},
"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

@ -0,0 +1,14 @@
{
"plugin-data":
{
"name": "Theme Alternative",
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Alternative."
},
"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

@ -0,0 +1,14 @@
{
"plugin-data":
{
"name": "Alternative Theme",
"description": "This plugin provides configuration for the theme Alternative."
},
"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 in the main page for each article."
}

View file

@ -0,0 +1,14 @@
{
"plugin-data":
{
"name": "Alternative Theme",
"description": "Alternativeテーマの設定を行うプラグインです。"
},
"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

@ -0,0 +1,11 @@
{
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "4.0.0",
"releaseDate": "2021-05-23",
"license": "MIT",
"compatible": "4.0.0",
"notes": "",
"type": "theme"
}

View file

@ -0,0 +1,33 @@
<?php
class alternative extends Plugin {
public function init()
{
$this->dbFields = array(
'googleFonts'=>false
);
}
public function form()
{
global $L;
$html = '<div class="mb-3">';
$html .= '<label class="form-label" for="googleFonts">'.$L->get('Google Fonts').'</label>';
$html .= '<select class="form-select" id="googleFonts" name="googleFonts">';
$html .= '<option value="true" '.($this->getValue('googleFonts')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
$html .= '<option value="false" '.($this->getValue('googleFonts')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
$html .= '</select>';
$html .= '<div class="form-text">'.$L->get('Enable or disable Google fonts.').'</div>';
$html .= '</div>';
return $html;
}
public function googleFonts()
{
return $this->getValue('googleFonts');
}
}

View file

@ -18,6 +18,11 @@ img {
max-width: 100%;
}
a {
color: #004ab7;
text-decoration: none;
}
pre, code {
background: #f8f8f8;
color: #333;
@ -139,3 +144,17 @@ section.home-page:nth-child(even) { /* Alternate the background color */
width:100%;
position:absolute;
}
/* Icons */
.bi {
margin-right: .5rem!important;
}
/* Remove Focus glow */
.btn:focus,
.form-control:focus,
.form-select:focus,
input:focus {
outline: none !important;
box-shadow: none !important;
}

View file

@ -1,27 +1,38 @@
<!DOCTYPE html>
<html lang="<?php echo HTML::lang() ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="Bludit">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Bludit">
<!-- Dynamic title tag -->
<?php echo HTML::metaTagTitle(); ?>
<!-- Generate <title>...</title> -->
<?php echo HTML::metaTagTitle(); ?>
<!-- Dynamic description tag -->
<?php echo HTML::metaTagDescription(); ?>
<!-- Generate <meta name="description" content="..."> -->
<?php echo HTML::metaTagDescription(); ?>
<!-- Include Favicon -->
<?php echo HTML::favicon('img/favicon.png'); ?>
<!-- Generate <link rel="icon" href="..."> -->
<?php echo HTML::favicon('img/favicon.png'); ?>
<!-- Include CSS Bootstrap file from Bludit Core -->
<?php echo HTML::cssBootstrap(); ?>
<!-- Include CSS Bootstrap file from Bludit Core -->
<?php echo HTML::cssBootstrap(); ?>
<!-- Include CSS Styles from this theme -->
<?php echo HTML::css('css/style.css'); ?>
<!-- Include CSS Bootstrap ICONS file from Bludit Core -->
<?php echo HTML::cssBootstrapIcons(); ?>
<!-- Load Bludit Plugins: Site head -->
<?php execPluginsByHook('siteHead'); ?>
<!-- Include CSS Styles from this theme -->
<?php echo HTML::css('css/style.css'); ?>
<!-- Enable or disable Google Fonts from theme's settings -->
<?php if ($theme->googleFonts()): ?>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:sans,bold">
<style>
body { font-family: "Open Sans", sans-serif; }
</style>
<?php endif; ?>
<!-- Execute Bludit plugins for the hook "Site head" -->
<?php execPluginsByHook('siteHead'); ?>
</head>
<body>

View file

@ -0,0 +1,5 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
if ($theme==false) {
exit("The theme needs the Alternative plugin to work properly, disables the theme and re-enables it to activate the plugin.");
}

View file

@ -2,9 +2,10 @@
"author": "Bludit",
"email": "",
"website": "https://themes.bludit.com",
"version": "4.0.0",
"version": "4.0",
"releaseDate": "2021-05-23",
"license": "MIT",
"compatible": "4.0.0",
"notes": ""
"compatible": "4.0",
"notes": "",
"plugin": "alternative"
}

View file

@ -1,5 +1,5 @@
<footer class="footer bg-dark">
<div class="container">
<p class="m-0 text-center text-white text-uppercase"><?php echo $site->footer(); ?><span class="ms-5 text-warning">Powered by<img class="mini-logo" src="<?php echo DOMAIN_THEME_IMG.'favicon.png'; ?>"/><a target="_blank" class="text-white" href="https://www.bludit.com">Bludit</a></span></p>
<p class="m-0 text-center text-white text-uppercase"><?php echo $site->footer(); ?><span class="ms-5 text-warning">Powered by <a target="_blank" class="text-white" href="https://www.bludit.com">Bludit</a> - Open source CMS</span></p>
</div>
</footer>
</footer>

View file

@ -11,9 +11,9 @@
<!-- Custom search form if the plugin "search" is enabled -->
<?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>
<div>
<input id="search-input" class="form-control mb-3" type="search" placeholder="<?php $language->p('Search') ?>" aria-label="Search">
<button class="btn btn-outline-primary" type="button" onClick="searchNow()"><?php $language->p('Search') ?></button>
<script>
function searchNow() {
var searchURL = "<?php echo HTML::siteUrl(); ?>search/";

View file

@ -1,44 +1,32 @@
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark text-uppercase">
<div class="container">
<a class="navbar-brand" href="<?php echo HTML::siteUrl(); ?>">
<span class="text-white"><?php echo $site->title(); ?></span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<div class="container">
<a class="navbar-brand" href="<?php echo HTML::siteUrl(); ?>">
<span class="text-white"><?php echo $site->title(); ?></span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<ul class="navbar-nav ms-auto">
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php endforeach ?>
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink(); ?>"><?php echo $staticPage->title(); ?></a>
</li>
<?php endforeach ?>
<!-- Social Networks -->
<?php foreach (HTML::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
<!-- Social Networks -->
<?php foreach (HTML::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
<!-- RSS -->
<?php if (HTML::rssUrl()): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML::rssUrl() ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon text-primary" src="<?php echo DOMAIN_THEME.'img/rss.svg' ?>" alt="RSS" />
<span class="d-inline d-sm-none">RSS</span>
</a>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</nav>
</ul>
</div>
</div>
</nav>

View file

@ -1,5 +1,5 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
if ($theme==false) {
exit("The theme needs the plugin Popeye to work properly, please enable it from the admin panel.");
exit("The theme needs the BlogX plugin to work properly, disables the theme and re-enables it to activate the plugin.");
}

View file

@ -1,32 +1,32 @@
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark text-uppercase">
<div class="container">
<a class="navbar-brand" href="<?php echo HTML::siteUrl() ?>">
<span class="text-white"><?php echo $site->title() ?></span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<div class="container">
<a class="navbar-brand" href="<?php echo HTML::siteUrl(); ?>">
<span class="text-white"><?php echo $site->title(); ?></span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php endforeach ?>
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php endforeach ?>
<!-- Social Networks -->
<?php foreach (HTML::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
<!-- Social Networks -->
<?php foreach (HTML::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</ul>
</div>
</div>
</nav>

View file

@ -1,5 +1,5 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
if ($theme==false) {
exit("The theme needs the plugin Popeye to work properly, please enable it from the admin panel.");
exit("The theme needs the Popeye plugin to work properly, disables the theme and re-enables it to activate the plugin.");
}