This commit is contained in:
Diego 2017-05-04 21:32:18 +02:00
parent 182d1a6c04
commit 817f249ba5
24 changed files with 25 additions and 9038 deletions

View File

@ -201,19 +201,19 @@ class dbCategories extends dbJSON
return Text::cleanUrl($category);
}
public function getList($pageNumber, $postPerPage, $tagKey)
public function getListOfPosts($pageNumber, $postPerPage, $categoryKey)
{
if( !isset($this->db['postsIndex'][$tagKey]) ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying get the posts list by the tag key: '.$tagKey);
if( !isset($this->db[$categoryKey]) ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying get the posts list by the category key: '.$categoryKey);
return array();
}
$init = (int) $postPerPage * $pageNumber;
$end = (int) min( ($init + $postPerPage - 1), $this->countPostsByTag($tagKey) - 1 );
$end = (int) min( ($init + $postPerPage - 1), count($this->db[$categoryKey]['posts']) );
$outrange = $init<0 ? true : $init > $end;
if(!$outrange) {
$list = $this->db['postsIndex'][$tagKey]['posts'];
$list = $this->db[$categoryKey]['posts'];
$tmp = array_flip($list); // Change the posts keys list in the array key.
return array_slice($tmp, $init, $postPerPage, true);
}

View File

@ -96,16 +96,17 @@ function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeU
{
global $dbPosts;
global $dbTags;
global $dbCategories;
global $Url;
$posts = array();
if($type=='tag') {
if( $type=='tag' && $key ) {
// Get the keys list from tags database, this database is optimized for this case.
$list = $dbTags->getList($pageNumber, $amount, $key);
}
elseif($type=='category') {
$list = $dbCategories->getList($pageNumber, $amount, $key);
elseif( $type=='category' && $key ) {
$list = $dbCategories->getListOfPosts($pageNumber, $amount, $key);
}
else {
// Get the keys list from posts database.

View File

@ -39,14 +39,14 @@ class pluginGoogleTools extends Plugin {
public function siteHead()
{
global $Url;
$html = '';
if((!empty($this->getDbField('google-site-verification'))) && ($Url->whereAmI()=='home')) {
if((!Text::isEmpty($this->getDbField('google-site-verification'))) && ($Url->whereAmI()=='home')) {
$html .= PHP_EOL.'<!-- Google Webmasters Tools -->'.PHP_EOL;
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'">'.PHP_EOL;
}
if(!(Text::isEmpty($this->getDbField('google-tag-manager')))) {
$html .= PHP_EOL."<!-- Google Tag Manager -->".PHP_EOL;
$html .= "<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':".PHP_EOL;
@ -56,7 +56,7 @@ class pluginGoogleTools extends Plugin {
$html .= "})(window,document,'script','dataLayer','".$this->getDbField('google-tag-manager')."');</script>".PHP_EOL;
$html .= "<!-- End Google Tag Manager -->".PHP_EOL;
}
return $html;
}
@ -65,14 +65,14 @@ class pluginGoogleTools extends Plugin {
if((Text::isEmpty($this->getDbField('google-tag-manager')))) {
return false;
}
$html = '<!-- Google Tag Manager (noscript) -->'.PHP_EOL;
$html .= '<noscript><iframe src="https://www.googletagmanager.com/ns.html?id='.$this->getDbField('google-tag-manager').'" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>'.PHP_EOL;
$html .= '<!-- End Google Tag Manager (noscript) -->'.PHP_EOL;
return $html;
}
public function siteBodyEnd()
{
$html = PHP_EOL.'<!-- Google Analytics -->'.PHP_EOL;

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
This version of SimpleMDE have a little changes for Bludit.
--- Image preview hack ---
Original
<img src="'+e+'"
Bludit hack
<img src="'+HTML_PATH_UPLOADS+e+'"

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
{
"plugin-data":
{
"name": "Quill",
"description": ""
}
}

View File

@ -1,10 +0,0 @@
{
"author": "NextStepWebs",
"email": "",
"website": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"version": "1.11.2",
"releaseDate": "2016-06-14",
"license": "MIT",
"compatible": "1.5.2",
"notes": ""
}

View File

@ -1,69 +0,0 @@
<?php
class pluginQuill extends Plugin {
private $loadWhenController = array(
'new-post',
'new-page',
'edit-post',
'edit-page'
);
public function init()
{
return false;
}
// Returns true if the plugins is loaded on the controller defined
private function enabled()
{
global $layout;
return in_array($layout['controller'], $this->loadWhenController);
}
public function adminHead()
{
$html = '';
if( $this->enabled() ) {
$html .= '<link href="https://cdn.quilljs.com/1.2.4/quill.snow.css" rel="stylesheet">';
$html .= '<script src="https://cdn.quilljs.com/1.2.4/quill.js"></script>';
}
return $html;
}
public function adminBodyEnd()
{
global $layout;
global $Language;
$html = '';
if( $this->enabled() ) {
$html .= '
<script>
$("#jscontent").hide().after("<div id=\"quillcontent\"></div>");
var quill = new Quill("#quillcontent", {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
["bold", "italic", "underline"],
["image"]
]
},
theme: "snow"
});
$(".uk-form").submit(function( event ) {
$("#jscontent").val(quill.root.innerHTML);
return true;
});
</script>
';
}
return $html;
}
}

View File

@ -1,64 +0,0 @@
.bl-list {
margin: 20px 0;
}
.bl-container-title {
padding: 7em 0;
}
.bl-container-main {
padding-bottom: 7em;
}
.bl-author img {
max-width: 50%;
border-radius: 150px;
}
.bl-author .name {
margin-top: 10px;
margin-bottom: 4px;
}
.bl-author .social a {
font-size: 0.9em;
}
.plugin-content ul {
list-style: none;
padding: 0 5px;
}
a.page-parent {
color: #000;
}
/*
Page and post content
------------------------------------------------
*/
.bl-page-post-content p {
margin-bottom: 10px;
}
.bl-page-post-content ul {
}
.bl-page-post-content h1,
.bl-page-post-content h2,
.bl-page-post-content h3,
.bl-page-post-content h4,
.bl-page-post-content h5,
.bl-page-post-content h6 {
margin: 0 0 20px 0;
}
.bl-page-post-content h1:not(:first-child),
.bl-page-post-content h2:not(:first-child),
.bl-page-post-content h3:not(:first-child),
.bl-page-post-content h4:not(:first-child),
.bl-page-post-content h5:not(:first-child),
.bl-page-post-content h6:not(:first-child) {
margin-top: 40px;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,115 +0,0 @@
<!DOCTYPE html>
<head>
<?php
// Include the php file ../php/head.php
include(THEME_DIR_PHP.'head.php');
?>
</head>
<body>
<!-- Header
- Logo
- Home link
-->
<header id="fh5co-header" role="banner">
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<!-- Logo
-->
<div class="navbar-header">
<a class="navbar-brand" href="<?php echo $Site->url() ?>"><?php echo $Site->title() ?></a>
</div>
<!-- Links
-->
<div id="fh5co-navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="<?php echo $Site->url() ?>"><span>Home <span class="border"></span></span></a></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
</header>
<!-- Main
- Home page
- Page list
- Post list
-->
<div id="fh5co-main">
<!-- Main
-->
<?php
if( ($Url->whereAmI()=='home') || ($Url->whereAmI()=='tag') || ($Url->whereAmI()=='blog') ) {
include(THEME_DIR_PHP.'home.php');
}
elseif($Url->whereAmI()=='post') {
include(THEME_DIR_PHP.'post.php');
}
elseif($Url->whereAmI()=='page') {
include(THEME_DIR_PHP.'page.php');
}
?>
<!-- Show plugins
-->
<div id="fh5co-services">
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<?php
foreach($plugins['siteSidebar'] as $Plugin) {
echo '<div class="col-md-4 col-sm-6 col-xs-6 col-xxs-12 fh5co-service">';
echo '<div class="fh5co-desc">';
echo $Plugin->siteSidebar();
echo '</div>';
echo '</div>';
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Footer
-->
<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>
<!-- Javascript
-->
<?php
Theme::jquery();
Theme::javascript('jquery.waypoints.min.js');
Theme::javascript('main.js');
?>
<!-- Load plugins
- Hook: Site body end
-->
<?php
Theme::plugins('siteBodyEnd');
?>
</body>
</html>

View File

@ -1,5 +0,0 @@
<?php
define('PARENT_PAGES_LINK', false);
?>

File diff suppressed because one or more lines are too long

View File

@ -1,131 +0,0 @@
;(function () {
'use strict';
// iPad and iPod detection
var isiPad = function(){
return (navigator.platform.indexOf("iPad") != -1);
};
var isiPhone = function(){
return (
(navigator.platform.indexOf("iPhone") != -1) ||
(navigator.platform.indexOf("iPod") != -1)
);
};
// Burger Menu
var burgerMenu = function() {
$('body').on('click', '.js-fh5co-nav-toggle', function(){
if ( $('#fh5co-navbar').is(':visible') ) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
};
// Animate Projects
var animateBox = function() {
if ( $('.animate-box').length > 0 ) {
$('.animate-box').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('animated') ) {
$(this.element).addClass('fadeIn animated');
}
} , { offset: '80%' } );
}
};
// Animate Leadership
var animateTeam = function() {
if ( $('#fh5co-team').length > 0 ) {
$('#fh5co-team .to-animate').each(function( k ) {
var el = $(this);
setTimeout ( function () {
console.log('yaya');
el.addClass('fadeInUp animated');
}, k * 200, 'easeInOutExpo' );
});
}
};
var teamWayPoint = function() {
if ( $('#fh5co-team').length > 0 ) {
$('#fh5co-team').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('animated') ) {
setTimeout(animateTeam, 200);
$(this.element).addClass('animated');
}
} , { offset: '80%' } );
}
};
// Animate Feature
var animateFeatureIcons = function() {
if ( $('#fh5co-services').length > 0 ) {
$('#fh5co-services .to-animate').each(function( k ) {
var el = $(this);
setTimeout ( function () {
el.addClass('bounceIn animated');
}, k * 200, 'easeInOutExpo' );
});
}
};
var featureIconsWayPoint = function() {
if ( $('#fh5co-services').length > 0 ) {
$('#fh5co-services').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('animated') ) {
setTimeout(animateFeatureIcons, 200);
$(this.element).addClass('animated');
}
} , { offset: '80%' } );
}
};
$(function(){
burgerMenu();
animateBox();
teamWayPoint();
featureIconsWayPoint();
});
}());

View File

@ -1,7 +0,0 @@
{
"theme-data":
{
"name": "Klean",
"description": "Based on the theme Clean, minimalist, fast, and klean."
}
}

View File

@ -1,7 +0,0 @@
{
"theme-data":
{
"name": "Klean",
"description": "Basado en el tema Clean, minimalista, rapido y limpio."
}
}

View File

@ -1,10 +0,0 @@
{
"author": "FREEHTML5.co",
"email": "",
"website": "https://freehtml5.co/",
"version": "16.10.13",
"releaseDate": "2016-10-13",
"license": "",
"compatible": "1.5.2",
"notes": "Responsive theme for Bludit adapted by Diego."
}

View File

@ -1,32 +0,0 @@
<?php
// <meta charset="utf-8">
Theme::charset('utf-8');
// <meta name="viewport" content="width=device-width, initial-scale=1">
Theme::viewport('width=device-width, initial-scale=1');
// <title>...</title>
Theme::title();
// <meta name="description" content=".....">
Theme::description();
// <link rel="shortcut icon" href="favicon.png">
Theme::favicon('favicon.png');
// CSS files
Theme::css('style.css');
Theme::css('bludit.css');
?>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Google Webfont
-->
<link href='//fonts.googleapis.com/css?family=Roboto:400,300,100,500' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Slab:400,300,100,500' rel='stylesheet' type='text/css'>
<!-- Load plugins
- Hook: Site head
-->
<?php Theme::plugins('siteHead') ?>

View File

@ -1,59 +0,0 @@
<?php
// PRINT PAGES and SUB-PAGES
// ------------------------------------------------------
foreach($parents as $Parent) {
echo '<div class="bl-list">';
echo '<div class="container">';
echo '<div class="row">';
echo '<div class="col-md-12 text-center">';
if(PARENT_PAGES_LINK) {
echo '<h1><a class="page-parent" href="'.$Parent->permalink().'">'.$Parent->title().'</a></h1>';
} else {
echo '<h1>'.$Parent->title().'</h1>';
}
// Check if the parent has children
if( isset( $pagesParents[ $Parent->key() ] ) ) {
// Get the children of the parent
$children = $pagesParents[ $Parent->key() ];
echo '<ul class="list-unstyled">';
// Foreach child
foreach( $children as $Child ) {
if( $Child->published() ) {
echo '<li><h4><a href="'.$Child->permalink().'">'.$Child->title().'</a></h4></li>';
}
}
echo '</ul>';
}
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
echo '<hr>';
foreach($posts as $Post) {
echo '<div class="bl-list">';
echo '<div class="container">';
echo '<div class="row">';
echo '<div class="col-md-12 text-center">';
echo '<h1><a href="'.$Post->permalink().'">'.$Post->title().'</a></h1>';
echo '<h4>Posted on '.$Post->date().'</h4>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
?>

View File

@ -1,101 +0,0 @@
<!-- Page title and description
-->
<div class="bl-container-title text-center">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 class="title"><?php echo $Page->title() ?></h1>
<p class="description"><?php echo $Page->description() ?></p>
</div>
</div>
</div>
</div>
<!-- Page content and author
-->
<div class="bl-container-main">
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<!-- Author
-->
<div class="col-md-3 col-md-push-9">
<div class="bl-author text-center">
<?php
$User = $Page->user();
$author = $User->username();
if( Text::isNotEmpty($User->firstName()) || Text::isNotEmpty($User->lastName()) ) {
$author = $User->firstName().' '.$User->lastName();
}
?>
<!-- Author profile
-->
<img src="<?php echo $User->profilePicture() ?>" alt="">
<!-- Author name
-->
<h4 class="name"><?php echo $author ?></h4>
<!-- Social networks
-->
<?php
if( Text::isNotEmpty( $User->twitter()) )
echo '<div class="social"><a href="'.$User->twitter().'">Twitter</a></div>';
if( Text::isNotEmpty( $User->facebook()) )
echo '<div class="social"><a href="'.$User->facebook().'">Facebook</a></div>';
if( Text::isNotEmpty( $User->googleplus()) )
echo '<div class="social"><a href="'.$User->googleplus().'">Google+</a></div>';
if( Text::isNotEmpty( $User->instagram()) )
echo '<div class="social"><a href="'.$User->instagram().'">Instagram</a></div>';
?>
</div>
</div>
<!-- Page content
-->
<div class="col-md-9 col-md-pull-3">
<!-- Load plugins
- Hook: Page Begin
-->
<?php Theme::plugins('pageBegin') ?>
<!-- Cover Image
-->
<?php
if( $Page->coverImage() ) {
echo '<div class="bl-cover-image">';
echo '<img src="'.$Page->coverImage().'" alt="Cover Image">';
echo '</div>';
}
?>
<!-- Page content
- The flag TRUE is to get the full content.
- This content is Markdown parsed.
-->
<div class="bl-page-post-content">
<?php echo $Page->content(true) ?>
</div>
<!-- Load plugins
- Hook: Page End
-->
<?php Theme::plugins('pageEnd') ?>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,101 +0,0 @@
<!-- Post title and description
-->
<div class="bl-container-title text-center">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1 class="title"><?php echo $Post->title() ?></h1>
<p class="description"><?php echo $Post->description() ?></p>
</div>
</div>
</div>
</div>
<!-- Post content and author
-->
<div class="bl-container-main">
<div class="container">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<!-- Author
-->
<div class="col-md-3 col-md-push-9">
<div class="bl-author text-center">
<?php
$User = $Post->user();
$author = $User->username();
if( Text::isNotEmpty($User->firstName()) || Text::isNotEmpty($User->lastName()) ) {
$author = $User->firstName().' '.$User->lastName();
}
?>
<!-- Author profile
-->
<img src="<?php echo $User->profilePicture() ?>" alt="">
<!-- Author name
-->
<h4 class="name"><?php echo $author ?></h4>
<!-- Social networks
-->
<?php
if( Text::isNotEmpty( $User->twitter()) )
echo '<div class="social"><a href="'.$User->twitter().'">Twitter</a></div>';
if( Text::isNotEmpty( $User->facebook()) )
echo '<div class="social"><a href="'.$User->facebook().'">Facebook</a></div>';
if( Text::isNotEmpty( $User->googleplus()) )
echo '<div class="social"><a href="'.$User->googleplus().'">Google+</a></div>';
if( Text::isNotEmpty( $User->instagram()) )
echo '<div class="social"><a href="'.$User->instagram().'">Instagram</a></div>';
?>
</div>
</div>
<!-- Post content
-->
<div class="col-md-9 col-md-pull-3">
<!-- Load plugins
- Hook: Post Begin
-->
<?php Theme::plugins('pageBegin') ?>
<!-- Cover Image
-->
<?php
if( $Post->coverImage() ) {
echo '<div class="bl-cover-image">';
echo '<img src="'.$Post->coverImage().'" alt="Cover Image">';
echo '</div>';
}
?>
<!-- Post content
- The flag TRUE is to get the full content.
- This content is Markdown parsed.
-->
<div class="bl-page-post-content">
<?php echo $Post->content(true) ?>
</div>
<!-- Load plugins
- Hook: Post End
-->
<?php Theme::plugins('pageEnd') ?>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -57,15 +57,16 @@
<!-- Main -->
<div id="main">
<?php
if( ($Url->whereAmI()=='home') || ($Url->whereAmI()=='tag') || ($Url->whereAmI()=='blog') ) {
include(THEME_DIR_PHP.'home.php');
}
elseif($Url->whereAmI()=='post') {
if($Url->whereAmI()=='post') {
include(THEME_DIR_PHP.'post.php');
}
elseif($Url->whereAmI()=='page') {
include(THEME_DIR_PHP.'page.php');
}
else {
include(THEME_DIR_PHP.'home.php');
}
?>
</div>

View File

@ -432,7 +432,9 @@ function install($adminPassword, $email, $timezone)
file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File categories.php
$data = array();
$data = array(
'videos'=>array('name'=>'Videos', 'posts'=>array(), 'pages'=>array())
);
file_put_contents(PATH_DATABASES.'categories.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File tags.php