New micro theme, fixed response code for 404
This commit is contained in:
parent
2cbf6c5750
commit
bd1cef2741
@ -28,7 +28,7 @@ class dbList extends dbJSON
|
||||
{
|
||||
if( !isset($this->db[$key]) ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
|
||||
return array();
|
||||
return false;
|
||||
}
|
||||
|
||||
$list = $this->db[$key]['list'];
|
||||
@ -43,7 +43,7 @@ class dbList extends dbJSON
|
||||
|
||||
if($outrange) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error out of range');
|
||||
return array();
|
||||
return false;
|
||||
}
|
||||
|
||||
$list = array_flip($list);
|
||||
|
@ -113,30 +113,21 @@ if( $Site->homepage() && $Url->whereAmI()==='home' ) {
|
||||
|
||||
// Build specific page
|
||||
if( $Url->whereAmI()==='page' ) {
|
||||
// Build the page
|
||||
$page = $Page = buildPage( $Url->slug() );
|
||||
|
||||
// The page doesn't exist
|
||||
if($page===false) {
|
||||
$Url->setNotFound(true);
|
||||
}
|
||||
// The page is not published, scheduled or draft
|
||||
elseif( $page->scheduled() || $page->draft() ) {
|
||||
$Url->setNotFound(true);
|
||||
}
|
||||
else {
|
||||
$pages[0] = $page;
|
||||
}
|
||||
buildThePage();
|
||||
}
|
||||
// Build pages by tag
|
||||
elseif( $Url->whereAmI()==='tag' ) {
|
||||
buildPagesByTag();
|
||||
}
|
||||
// Build pages by category
|
||||
elseif( $Url->whereAmI()==='category' ) {
|
||||
buildPagesByCategory();
|
||||
}
|
||||
// Build pages for the homepage
|
||||
elseif( $Url->whereAmI()==='home' ) {
|
||||
buildPagesForHome();
|
||||
}
|
||||
// Build pages for the admin area
|
||||
elseif( $Url->whereAmI()==='admin' ) {
|
||||
buildPagesForAdmin();
|
||||
}
|
||||
@ -144,6 +135,6 @@ elseif( $Url->whereAmI()==='admin' ) {
|
||||
// Set page 404 not found
|
||||
if( $Url->notFound() ) {
|
||||
$Url->setWhereAmI('page');
|
||||
$page = buildPage('error');
|
||||
$page = $Page = buildPage('error');
|
||||
$pages[0] = $page;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// Page not found 404
|
||||
if($Url->notFound())
|
||||
{
|
||||
if ($Url->notFound()) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ class dbPages extends dbJSON
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns an array with a list of pages
|
||||
// Returns an array with a list of pages, FALSE if out of range
|
||||
// The database is sorted by date or by position
|
||||
// (int) $pageNumber, the page number
|
||||
// (int) $amountOfItems, amount of items to return, if -1 returns all the items
|
||||
@ -335,7 +335,7 @@ class dbPages extends dbJSON
|
||||
return array_slice($db, $init, $amountOfItems, true);
|
||||
}
|
||||
|
||||
return array();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns the amount of pages
|
||||
|
@ -57,46 +57,61 @@ function buildPage($key) {
|
||||
return $page;
|
||||
}
|
||||
|
||||
function reindexCategories()
|
||||
{
|
||||
function reindexCategories() {
|
||||
global $dbCategories;
|
||||
return $dbCategories->reindex();
|
||||
}
|
||||
|
||||
function reindexTags()
|
||||
{
|
||||
function reindexTags() {
|
||||
global $dbTags;
|
||||
return $dbTags->reindex();
|
||||
}
|
||||
|
||||
function buildPagesForAdmin()
|
||||
{
|
||||
function buildThePage() {
|
||||
global $Url;
|
||||
global $page, $Page;
|
||||
global $pages;
|
||||
|
||||
$page = $Page = buildPage( $Url->slug() );
|
||||
|
||||
// The page doesn't exist
|
||||
if($page===false) {
|
||||
$Url->setNotFound(true);
|
||||
return false;
|
||||
}
|
||||
// The page is not published
|
||||
elseif( $page->scheduled() || $page->draft() ) {
|
||||
$Url->setNotFound(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
$pages[0] = $page;
|
||||
return true;
|
||||
}
|
||||
|
||||
function buildPagesForAdmin() {
|
||||
return buildPagesFor('admin');
|
||||
}
|
||||
|
||||
function buildPagesForHome()
|
||||
{
|
||||
function buildPagesForHome() {
|
||||
return buildPagesFor('home');
|
||||
}
|
||||
|
||||
function buildPagesByCategory()
|
||||
{
|
||||
function buildPagesByCategory() {
|
||||
global $Url;
|
||||
|
||||
$categoryKey = $Url->slug();
|
||||
return buildPagesFor('category', $categoryKey, false);
|
||||
}
|
||||
|
||||
function buildPagesByTag()
|
||||
{
|
||||
function buildPagesByTag() {
|
||||
global $Url;
|
||||
|
||||
$tagKey = $Url->slug();
|
||||
return buildPagesFor('tag', false, $tagKey);
|
||||
}
|
||||
|
||||
function buildPagesFor($for, $categoryKey=false, $tagKey=false)
|
||||
{
|
||||
function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
|
||||
global $dbPages;
|
||||
global $dbCategories;
|
||||
global $dbTags;
|
||||
@ -127,9 +142,10 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false)
|
||||
$list = $dbTags->getList($tagKey, $pageNumber, $amountOfItems);
|
||||
}
|
||||
|
||||
// There are not items for the page number then set the page notfound
|
||||
if( empty($list) && $pageNumber>1 ) {
|
||||
// There are not items, invalid tag, invalid category, out of range, etc...
|
||||
if( $list===false ) {
|
||||
$Url->setNotFound(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
$pages = array(); // global variable
|
||||
@ -260,6 +276,7 @@ function createPage($args) {
|
||||
Log::set('Function createNewPage()'.LOG_SEP.'Error occurred when trying to create the page');
|
||||
Log::set('Function createNewPage()'.LOG_SEP.'Cleaning database...');
|
||||
$dbPages->delete($key);
|
||||
Log::set('Function createNewPage()'.LOG_SEP.'Cleaning finished...');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
85
bl-themes/micro/css/bludit.css
Executable file
85
bl-themes/micro/css/bludit.css
Executable file
@ -0,0 +1,85 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
a.home-title {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
ul li {
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
table thead {
|
||||
background: #555555;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
table td,
|
||||
table th {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
h1, h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#fh5co-footer {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #f8f8f8;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* SIDEBAR */
|
||||
h1.site-title {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
ul.fixed-pages {
|
||||
font-size: 1em;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.fixed-pages a {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
/* PAGES */
|
||||
|
||||
article.page:not(:last-child) {
|
||||
margin-bottom: 100px;
|
||||
}
|
||||
|
||||
article.page header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
article.page footer {
|
||||
text-align: right;
|
||||
font-size: 0.8em;
|
||||
}
|
8253
bl-themes/micro/css/style.css
Executable file
8253
bl-themes/micro/css/style.css
Executable file
File diff suppressed because it is too large
Load Diff
BIN
bl-themes/micro/img/favicon.png
Normal file
BIN
bl-themes/micro/img/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
46
bl-themes/micro/index.php
Executable file
46
bl-themes/micro/index.php
Executable file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
|
||||
<head>
|
||||
<?php include(THEME_DIR_PHP.'head.php') ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="fh5co-main">
|
||||
|
||||
<div id="fh5co-content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-3">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-2">
|
||||
<?php include(THEME_DIR_PHP.'sidebar.php') ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<?php include(THEME_DIR_PHP.'home.php') ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<footer id="fh5co-footer">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-md-offset-1 text-center">
|
||||
<p><?php echo $Site->footer() ?><br>Powered by <a href="https://www.bludit.com" target="_blank">BLUDIT</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
6
bl-themes/micro/js/respond.min.js
vendored
Executable file
6
bl-themes/micro/js/respond.min.js
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
|
||||
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
||||
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
||||
* */
|
||||
|
||||
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
7
bl-themes/micro/languages/en_US.json
Normal file
7
bl-themes/micro/languages/en_US.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"theme-data":
|
||||
{
|
||||
"name": "Micro",
|
||||
"description": "This theme is for really microblogging or microsites, support cover images, support fixed pages, all plugins on sidebar are excluded."
|
||||
}
|
||||
}
|
10
bl-themes/micro/metadata.json
Normal file
10
bl-themes/micro/metadata.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://themes.bludit.com",
|
||||
"version": "1.0",
|
||||
"releaseDate": "2017-07-23",
|
||||
"license": "MIT",
|
||||
"compatible": "2.0",
|
||||
"notes": ""
|
||||
}
|
25
bl-themes/micro/php/head.php
Normal file
25
bl-themes/micro/php/head.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
echo Theme::charset('utf-8');
|
||||
echo Theme::viewport('width=device-width, initial-scale=1');
|
||||
|
||||
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
|
||||
echo '<link href="//fonts.googleapis.com/css?family=Roboto:400,300,100,500" rel="stylesheet" type="text/css">';
|
||||
echo '<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,100,500" rel="stylesheet" type="text/css">';
|
||||
|
||||
echo Theme::headTitle();
|
||||
echo Theme::headDescription();
|
||||
|
||||
echo Theme::favicon('img/favicon.png');
|
||||
|
||||
echo Theme::fontAwesome();
|
||||
|
||||
echo Theme::css('css/style.css');
|
||||
echo Theme::css('css/bludit.css');
|
||||
|
||||
echo '<!--[if lt IE 9]>';
|
||||
echo Theme::js('js/respond.min.js');
|
||||
echo '<![endif]-->';
|
||||
|
||||
// Load plugins with the hook siteHead
|
||||
Theme::plugins('siteHead');
|
||||
?>
|
22
bl-themes/micro/php/home.php
Normal file
22
bl-themes/micro/php/home.php
Normal file
@ -0,0 +1,22 @@
|
||||
<!-- Section -->
|
||||
<section class="content">
|
||||
<?php foreach ($pages as $page): ?>
|
||||
<article class="page">
|
||||
<?php if( $page->title() ) { ?>
|
||||
<header>
|
||||
<h2><?php echo $page->title() ?></h2>
|
||||
</header>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $page->coverImage() ) { ?>
|
||||
<img src="<?php echo $page->coverImage() ?>" alt="<?php echo $page->slug() ?>">
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $page->content() ?>
|
||||
|
||||
<footer>
|
||||
<?php echo $page->date() ?>
|
||||
</footer>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
18
bl-themes/micro/php/page.php
Normal file
18
bl-themes/micro/php/page.php
Normal file
@ -0,0 +1,18 @@
|
||||
<!-- Section -->
|
||||
<section class="content">
|
||||
<article class="page">
|
||||
<header>
|
||||
<a href="<?php echo $page->permalink() ?>">
|
||||
<h2><?php echo $page->title() ?></h2>
|
||||
</a>
|
||||
|
||||
<?php if( $page->coverImage() ) { ?>
|
||||
<img src="<?php echo $page->coverImage() ?>" alt="<?php echo $page->slug() ?>">
|
||||
<?php } ?>
|
||||
</header>
|
||||
<?php echo $page->content() ?>
|
||||
<footer>
|
||||
<div class="date"><i class="fa fa-clock-o"></i> <?php echo $page->date() ?></div>
|
||||
</footer>
|
||||
</article>
|
||||
</section>
|
21
bl-themes/micro/php/sidebar.php
Normal file
21
bl-themes/micro/php/sidebar.php
Normal file
@ -0,0 +1,21 @@
|
||||
<h1 class="site-title">
|
||||
<a href="<?php echo $Site->url() ?>">
|
||||
<?php echo $Site->title() ?>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<ul class="fixed-pages">
|
||||
|
||||
<?php
|
||||
$fixedPages = $dbPages->getFixedDB();
|
||||
$keys = array_keys($fixedPages);
|
||||
foreach($keys as $pageKey) {
|
||||
$page = buildPage($pageKey);
|
||||
echo '<li>';
|
||||
echo '<a href="'.$page->permalink().'">';
|
||||
echo $page->title();
|
||||
echo '</a>';
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
BIN
bl-themes/micro/screenshot.jpg
Normal file
BIN
bl-themes/micro/screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Loading…
Reference in New Issue
Block a user