Merge pull request #5 from dignajar/master

Pull request
This commit is contained in:
Edi 2017-05-07 13:23:29 +02:00 committed by GitHub
commit 5b3facb24f
67 changed files with 1316 additions and 9341 deletions

View File

@ -1,307 +1,357 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Content {
public $vars;
function __construct($path)
{
if($this->build($path)===false) {
$this->vars = false;
}
}
// Return TRUE if the content is loaded correctly
public function isValid()
{
return($this->vars!==false);
}
// Returns the value from the $field, FALSE if the field doesn't exist
public function getField($field)
{
if(isset($this->vars[$field])) {
return $this->vars[$field];
}
return false;
}
// Set a value to a field
public function setField($field, $value, $overwrite=true)
{
if($overwrite || empty($this->vars[$field])) {
$this->vars[$field] = $value;
}
return true;
}
// Parse the content from the file index.txt
private function build($path)
{
if( !Sanitize::pathFile($path.FILENAME) ) {
return false;
}
$tmp = 0;
$lines = file($path.FILENAME);
foreach($lines as $lineNumber=>$line)
{
$parts = array_map('trim', explode(':', $line, 2));
// Lowercase variable
$parts[0] = Text::lowercase($parts[0]);
// If variables is content then break the foreach and process the content after.
if($parts[0]==='content')
{
$tmp = $lineNumber;
break;
}
if( !empty($parts[0]) && !empty($parts[1]) ) {
// Sanitize all fields, except Content.
$this->vars[$parts[0]] = Sanitize::html($parts[1]);
}
}
// Process the content.
if($tmp!==0)
{
// Next line after "Content:" variable
$tmp++;
// Remove lines after Content
$output = array_slice($lines, $tmp);
if(!empty($parts[1])) {
array_unshift($output, "\n");
array_unshift($output, $parts[1]);
}
$implode = implode($output);
$this->vars['content'] = $implode;
// Sanitize content.
//$this->vars['content'] = Sanitize::html($implode);
}
}
// Returns the title field
public function title()
{
return $this->getField('title');
}
// Returns the content
// This content is markdown parser
// (boolean) $fullContent, TRUE returns all content, if FALSE returns the first part of the content
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function content($fullContent=true, $noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('content');
if(!$fullContent) {
$content = $this->getField('breakContent');
}
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns the content
// This content is not markdown parser
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function contentRaw($noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('contentRaw');
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns TRUE if the content has the text splited
public function readMore()
{
return $this->getField('readMore');
}
// Returns the field key
public function key()
{
return $this->getField('key');
}
// Returns TRUE if the post/page is published, FALSE otherwise.
public function published()
{
return ($this->getField('status')==='published');
}
// Returns TRUE if the post/page is scheduled, FALSE otherwise.
public function scheduled()
{
return ($this->getField('status')==='scheduled');
}
// Returns TRUE if the post/page is draft, FALSE otherwise.
public function draft()
{
return ($this->getField('status')=='draft');
}
// Returns the file name of the cover image, FALSE there isn't a cover image setted
// (boolean) $absolute, TRUE returns the absolute path and file name, FALSE just the file name
public function coverImage($absolute=true)
{
$fileName = $this->getField('coverImage');
if(empty($fileName)) {
return false;
}
if($absolute) {
return HTML_PATH_UPLOADS.$fileName;
}
return $fileName;
}
/*
DEPRECATED ?
public function profilePicture()
{
return HTML_PATH_UPLOADS_PROFILES.$this->username().'.jpg';
}
*/
// Returns the user object
// (boolean) $field, TRUE returns the value of the field, FALSE returns the object
public function user($field=false)
{
// Get the user object.
$User = $this->getField('user');
if($field) {
return $User->getField($field);
}
return $User;
}
// Returns the username who created the post/page
public function username()
{
return $this->getField('username');
}
// Returns the description field
public function description()
{
return $this->getField('description');
}
// Returns the date according to locale settings and format settings
public function date()
{
return $this->getField('date');
}
// Returns the date according to locale settings and format as database stored
// (string) $format, you can specify the date format
public function dateRaw($format=false)
{
$date = $this->getField('dateRaw');
if($format) {
return Date::format($date, DB_DATE_FORMAT, $format);
}
return $date;
}
// Returns the tags
// (boolean) $returnsArray, TRUE to get the tags as an array, FALSE to get the tags separeted by comma
public function tags($returnsArray=false)
{
global $Url;
$tags = $this->getField('tags');
if($returnsArray) {
if($tags==false) {
return array();
}
return $tags;
}
else {
if($tags==false) {
return false;
}
// Return string with tags separeted by comma.
return implode(', ', $tags);
}
}
// Returns the permalink
// (boolean) $absolute, TRUE returns the post/page link with the DOMAIN, FALSE without the DOMAIN
public function permalink($absolute=false)
{
global $Url;
global $Site;
$filterType = $this->getField('filterType');
$url = trim(DOMAIN_BASE,'/');
$key = $this->key();
$filter = trim($Url->filters($filterType), '/');
$htmlPath = trim(HTML_PATH_ROOT,'/');
if(empty($filter)) {
$tmp = $key;
}
else {
$tmp = $filter.'/'.$key;
}
if($absolute) {
return $url.'/'.$tmp;
}
if(empty($htmlPath)) {
return '/'.$tmp;
}
return '/'.$htmlPath.'/'.$tmp;
}
public function json($returnsArray=false)
{
$tmp['key'] = $this->key();
$tmp['title'] = $this->title();
$tmp['content'] = $this->content(); // Markdown parsed
$tmp['contentRaw'] = $this->contentRaw(); // No Markdown parsed
$tmp['description'] = $this->description();
$tmp['date'] = $this->dateRaw();
$tmp['permalink'] = $this->permalink(true);
if($returnsArray) {
return $tmp;
}
return json_encode($tmp);
}
}
<?php defined('BLUDIT') or die('Bludit CMS.');
class Content {
public $vars;
function __construct($path)
{
if($this->build($path)===false) {
$this->vars = false;
}
}
// Return TRUE if the content is loaded correctly
public function isValid()
{
return($this->vars!==false);
}
// Returns the value from the $field, FALSE if the field doesn't exist
public function getField($field)
{
if(isset($this->vars[$field])) {
return $this->vars[$field];
}
return false;
}
// Set a value to a field
public function setField($field, $value, $overwrite=true)
{
if($overwrite || empty($this->vars[$field])) {
$this->vars[$field] = $value;
}
return true;
}
// Parse the content from the file index.txt
private function build($path)
{
if( !Sanitize::pathFile($path.FILENAME) ) {
return false;
}
$tmp = 0;
$lines = file($path.FILENAME);
foreach($lines as $lineNumber=>$line)
{
$parts = array_map('trim', explode(':', $line, 2));
// Lowercase variable
$parts[0] = Text::lowercase($parts[0]);
// If variables is content then break the foreach and process the content after.
if($parts[0]==='content')
{
$tmp = $lineNumber;
break;
}
if( !empty($parts[0]) && !empty($parts[1]) ) {
// Sanitize all fields, except Content.
$this->vars[$parts[0]] = Sanitize::html($parts[1]);
}
}
// Process the content.
if($tmp!==0)
{
// Next line after "Content:" variable
$tmp++;
// Remove lines after Content
$output = array_slice($lines, $tmp);
if(!empty($parts[1])) {
array_unshift($output, "\n");
array_unshift($output, $parts[1]);
}
$implode = implode($output);
$this->vars['content'] = $implode;
// Sanitize content.
//$this->vars['content'] = Sanitize::html($implode);
}
}
// Returns the title field
public function title()
{
return $this->getField('title');
}
// Returns the content
// This content is markdown parser
// (boolean) $fullContent, TRUE returns all content, if FALSE returns the first part of the content
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function content($fullContent=true, $noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('content');
if(!$fullContent) {
$content = $this->getField('breakContent');
}
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns the content
// This content is not markdown parser
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function contentRaw($noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('contentRaw');
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns TRUE if the content has the text splited
public function readMore()
{
return $this->getField('readMore');
}
//
public function category()
{
return $this->getField('category');
}
public function uuid()
{
return $this->getField('uuid');
}
// Returns the field key
public function key()
{
return $this->getField('key');
}
// Returns TRUE if the post/page is published, FALSE otherwise.
public function published()
{
return ($this->getField('status')==='published');
}
// Returns TRUE if the post/page is scheduled, FALSE otherwise.
public function scheduled()
{
return ($this->getField('status')==='scheduled');
}
// Returns TRUE if the post/page is draft, FALSE otherwise.
public function draft()
{
return ($this->getField('status')=='draft');
}
// Returns the file name of the cover image, FALSE there isn't a cover image setted
// (boolean) $absolute, TRUE returns the absolute path and file name, FALSE just the file name
public function coverImage($absolute=true)
{
$fileName = $this->getField('coverImage');
if(empty($fileName)) {
return false;
}
if($absolute) {
return HTML_PATH_UPLOADS.$fileName;
}
return $fileName;
}
/*
DEPRECATED ?
public function profilePicture()
{
return HTML_PATH_UPLOADS_PROFILES.$this->username().'.jpg';
}
*/
// Returns the user object
// (boolean) $field, TRUE returns the value of the field, FALSE returns the object
public function user($field=false)
{
// Get the user object.
$User = $this->getField('user');
if($field) {
return $User->getField($field);
}
return $User;
}
// Returns the username who created the post/page
public function username()
{
return $this->getField('username');
}
// Returns the description field
public function description()
{
return $this->getField('description');
}
// Returns the date according to locale settings and format settings
public function date()
{
return $this->getField('date');
}
// Returns the date according to locale settings and format as database stored
// (string) $format, you can specify the date format
public function dateRaw($format=false)
{
$date = $this->getField('dateRaw');
if($format) {
return Date::format($date, DB_DATE_FORMAT, $format);
}
return $date;
}
// Returns relative time (e.g. "1 minute ago")
// Based on http://stackoverflow.com/a/18602474
// Modified for Bludit
// $complete = false : short version
// $complete = true : full version
public function relativeTime($complete = false) {
$current = new DateTime;
$past = new DateTime($this->getField('date'));
$elapsed = $current->diff($past);
$elapsed->w = floor($elapsed->d / 7);
$elapsed->d -= $elapsed->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
foreach($string as $key => &$value) {
if($elapsed->$key) {
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : ' ');
} else {
unset($string[$key]);
}
}
if(!$complete) {
$string = array_slice($string, 0 , 1);
}
return $string ? implode(', ', $string) . ' ago' : 'Just now';
}
// Returns the tags
// (boolean) $returnsArray, TRUE to get the tags as an array, FALSE to get the tags separeted by comma
public function tags($returnsArray=false)
{
global $Url;
$tags = $this->getField('tags');
if($returnsArray) {
if($tags==false) {
return array();
}
return $tags;
}
else {
if($tags==false) {
return false;
}
// Return string with tags separeted by comma.
return implode(', ', $tags);
}
}
// Returns the permalink
// (boolean) $absolute, TRUE returns the post/page link with the DOMAIN, FALSE without the DOMAIN
public function permalink($absolute=false)
{
global $Url;
global $Site;
$filterType = $this->getField('filterType');
$url = trim(DOMAIN_BASE,'/');
$key = $this->key();
$filter = trim($Url->filters($filterType), '/');
$htmlPath = trim(HTML_PATH_ROOT,'/');
if(empty($filter)) {
$tmp = $key;
}
else {
$tmp = $filter.'/'.$key;
}
if($absolute) {
return $url.'/'.$tmp;
}
if(empty($htmlPath)) {
return '/'.$tmp;
}
return '/'.$htmlPath.'/'.$tmp;
}
public function json($returnsArray=false)
{
$tmp['key'] = $this->key();
$tmp['title'] = $this->title();
$tmp['content'] = $this->content(); // Markdown parsed
$tmp['contentRaw'] = $this->contentRaw(); // No Markdown parsed
$tmp['description'] = $this->description();
$tmp['date'] = $this->dateRaw();
$tmp['permalink'] = $this->permalink(true);
if($returnsArray) {
return $tmp;
}
return json_encode($tmp);
}
}

View File

@ -51,6 +51,7 @@ function addUser($args)
$tmp['username'] = $args['new_username'];
$tmp['password'] = $args['new_password'];
$tmp['role'] = $args['role'];
$tmp['email'] = $args['email'];
// Add the user to the database
if( $dbUsers->add($tmp) )

View File

@ -0,0 +1,21 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
// Main after POST
// ============================================================================

View File

@ -0,0 +1,83 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function edit($oldCategoryKey, $newCategory)
{
global $Language;
global $dbPosts;
global $dbPages;
global $dbCategories;
if( Text::isEmpty($oldCategoryKey) || Text::isEmpty($newCategory) ) {
Alert::set($Language->g('Empty field'));
Redirect::page('admin', 'categories');
}
if( $dbCategories->edit($oldCategoryKey, $newCategory) == false ) {
Alert::set($Language->g('Already exist a category'));
}
else {
$dbPages->changeCategory($oldCategoryKey, $newCategory);
$dbPosts->changeCategory($oldCategoryKey, $newCategory);
Alert::set($Language->g('The changes have been saved'));
}
Redirect::page('admin', 'categories');
}
function delete($categoryKey)
{
global $Language;
global $dbCategories;
$dbCategories->remove($categoryKey);
Alert::set($Language->g('The changes have been saved'));
Redirect::page('admin', 'categories');
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( isset($_POST['delete']) ) {
delete($_POST['categoryKey']);
}
elseif( isset($_POST['edit']) ) {
edit($_POST['categoryKey'], $_POST['category']);
}
}
// ============================================================================
// Main after POST
// ============================================================================
$categoryKey = $layout['parameters'];
if(!$dbCategories->exists($categoryKey)) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the category: '.$categoryKey);
Redirect::page('admin', 'categories');
}
$category = $dbCategories->getName($layout['parameters']);
$layout['title'] .= ' - '.$Language->g('Edit category').' - '.$category;

View File

@ -24,6 +24,9 @@ function editPage($args)
{
$dbPages->regenerateCli();
// Re index categories
//reIndexCategoriesPages();
// Call the plugins after page created.
Theme::plugins('afterPageModify');

View File

@ -21,6 +21,9 @@ function editPost($args)
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
// Re index categories
//reIndexCategoriesPosts();
// Call the plugins after post created.
Theme::plugins('afterPostModify');

View File

@ -0,0 +1,53 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function add($category)
{
global $dbCategories;
global $Language;
if( Text::isEmpty($category) ) {
Alert::set($Language->g('Category name is empty'), ALERT_STATUS_FAIL);
return false;
}
if( $dbCategories->add($category) ) {
Alert::set($Language->g('Category added'), ALERT_STATUS_OK);
return true;
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the category.');
return false;
}
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( add($_POST['category']) ) {
Redirect::page('admin', 'categories');
}
}
// ============================================================================
// Main after POST
// ============================================================================

View File

@ -18,6 +18,9 @@ function addPage($args)
if($key)
{
// Re index categories
//reIndexCategoriesPages();
// Call the plugins after page created.
Theme::plugins('afterPageCreate');

View File

@ -15,21 +15,24 @@ function addPost($args)
// Add the page, if the $key is FALSE the creation of the post failure.
$key = $dbPosts->add($args);
if($key)
{
if($key) {
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
// Call the plugins after post created.
// Re index categories
//reIndexCategoriesPosts();
// Call the plugins after post creation
Theme::plugins('afterPostCreate');
// Alert for the user
Alert::set($Language->g('Post added successfully'));
Redirect::page('admin', 'manage-posts');
}
else
{
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the post.');
Log::set(__METHOD__.LOG_SEP.'Cleaning database...');
$dbPosts->delete($key);
}
return false;

View File

@ -270,6 +270,10 @@ button.aslink:hover {
padding-left: 20px;
}
.uk-table td, .uk-table th {
padding: 14px 8px !important;
}
/* RESPONSIVE
---------------------------------------------------------------- */
@ -591,6 +595,17 @@ tr.theme-installed {
background: #F2F7FF !important;
}
div.plugin-name i.settings-icon {
float: right;
margin-top: 3px;
margin-left: 3px;
}
i.incompatible-warning {
color: #FFC425;
padding-right: 5px;
}
div.plugin-links > a {
display: inline-block;
margin-top: 5px;
@ -632,7 +647,15 @@ div.plugin-links > span.separator {
}
#paginator li.right {
margin-left: 10px;
margin-left: 10px;
}
#paginator li.next {
margin-right: 1em;
}
#paginator li.previous {
margin-left: 1em;
}
/* ----------- PLUGINS FORM ----------- */

View File

@ -63,6 +63,7 @@ $(document).ready(function() {
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Manage pages') ?></a></li>
<?php if($Login->role() == 'admin') { ?>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Manage users') ?></a></li>
<!-- <li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Manage categories') ?></a></li> -->
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><?php $L->p('General settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-advanced' ?>"><?php $L->p('Advanced settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><?php $L->p('Language and timezone') ?></a></li>
@ -115,6 +116,9 @@ $(document).ready(function() {
<li <?php echo ($layout['view']=='manage-pages')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Pages') ?></a>
</li>
<!--<li <?php echo ($layout['view']=='categories')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Categories') ?></a>
</li>-->
<li <?php echo ($layout['view']=='users')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Users') ?></a>
</li>

View File

@ -143,6 +143,9 @@ class HTML {
$html .= '<label for="'.$id.'" class="uk-form-label">'.$args['label'].'</label>';
$html .= '<div class="uk-form-controls">';
$html .= '<select id="'.$id.'" name="'.$args['name'].'" '.$class.'>';
if(isset($args['addEmptySpace'])) {
$html .= '<option value=""></option>';
}
foreach($args['options'] as $key=>$value) {
$html .= '<option value="'.$key.'"'.( ($args['selected']==$key)?' selected="selected"':'').'>'.$value.'</option>';
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,30 @@
<?php
HTML::title(array('title'=>$L->g('Categories'), 'icon'=>'tag'));
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-category"><i class="uk-icon-plus"></i> '.$L->g('Add a new category').'</a>';
echo '
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>'.$L->g('Name').'</th>
<th>'.$L->g('Key').'</th>
</tr>
</thead>
<tbody>
';
$categories = $dbCategories->getAll();
foreach($categories as $categoryKey=>$category)
{
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$categoryKey.'">'.$category.'</a></td>';
echo '<td>'.$categoryKey.'</td>';
echo '</tr>';
}
echo '
</tbody>
</table>
';

View File

@ -0,0 +1,32 @@
<?php
HTML::title(array('title'=>$L->g('Edit Category'), 'icon'=>'globe'));
HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
HTML::formInputHidden(array(
'name'=>'categoryKey',
'value'=>$categoryKey
));
HTML::formInputText(array(
'name'=>'category',
'label'=>$L->g('Name'),
'value'=>$category,
'class'=>'uk-width-1-2 uk-form-medium'
));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" name="edit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<button type="submit" name="delete" class="uk-button uk-button-primary">'.$L->g('Delete').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'categories" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
HTML::formClose();

View File

@ -65,6 +65,18 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>$_Page->category(),
'tip'=>'',
'addEmptySpace'=>true
));
*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
@ -228,7 +240,7 @@ $(document).ready(function()
}
else {
$(".sidebar-view").hide();
$(view).show();
$(view).show();
}
});

View File

@ -58,6 +58,18 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>$_Post->category(),
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
@ -186,7 +198,7 @@ $(document).ready(function() {
}
else {
$(".sidebar-view").hide();
$(view).show();
$(view).show();
}
});

View File

@ -47,6 +47,7 @@ echo '
<ul>
<?php
if(Paginator::get('showNewer')) {
echo '<li class="first"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page=0">« '.$Language->g('First page').'</a></li>';
echo '<li class="previous"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('prevPage').'">« '.$Language->g('Prev page').'</a></li>';
}
@ -54,6 +55,7 @@ echo '
if(Paginator::get('showOlder')) {
echo '<li class="next"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('nextPage').'">'.$Language->g('Next page').' »</a></li>';
echo '<li class="last"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('numberOfPages').'">'.$Language->g('Last page').' »</a></li>';
}
?>
</ul>

View File

@ -0,0 +1,26 @@
<?php
HTML::title(array('title'=>$L->g('New Category'), 'icon'=>'tag'));
HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
HTML::formInputText(array(
'name'=>'category',
'label'=>$L->g('Name'),
'value'=>'',
'class'=>'uk-width-1-2 uk-form-medium'
));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'categories" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
HTML::formClose();

View File

@ -51,6 +51,18 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>'',
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
@ -201,7 +213,7 @@ $(document).ready(function()
}
else {
$(".sidebar-view").hide();
$(view).show();
$(view).show();
}
});

View File

@ -51,6 +51,17 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>'',
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
@ -62,7 +73,7 @@ echo '<div class="bl-publish-sidebar uk-width-2-10">';
));
echo '</li>';
// IMAGES TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-images-view"><i class="uk-icon-angle-down"></i> '.$L->g('Images').'</h2></li>';
@ -171,7 +182,7 @@ $(document).ready(function() {
}
else {
$(".sidebar-view").hide();
$(view).show();
$(view).show();
}
});

View File

@ -20,37 +20,36 @@ foreach($plugins['all'] as $Plugin)
echo '
<tr '.($Plugin->installed()?'class="plugin-installed"':'class="plugin-notInstalled"').'>
<td>
<div class="plugin-name">'.$Plugin->name().'</div>
<div class="plugin-links">
<div class="plugin-name">
';
if($Plugin->installed()) {
echo '<a class="uninstall" href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'" title="'.$L->g('Deactivate').'"><i class="uk-icon-check-square-o"></i></a> ';
if(method_exists($Plugin, 'form')) {
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'">'.$L->g('Settings').'</a>';
echo '<span class="separator"> | </span>';
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'" title="'.$L->g('Settings').'"><i class="uk-icon-cog settings-icon"></i></a> ';
}
echo '<a class="uninstall" href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'">'.$L->g('Deactivate').'</a>';
}
else {
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'">'.$L->g('Activate').'</a>';
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'" title="'.$L->g('Activate').'"><i class="uk-icon-square-o"></i></a> ';
}
echo '
</div>
'.$Plugin->name().'</div>
</td>';
echo '<td>';
echo $Plugin->description();
if( !$Plugin->isCompatible() ) {
echo '<div class="plugin-incompatible">This plugin is incompatible with Bludit v'.BLUDIT_VERSION.'</div>';
}
echo '</td>';
echo '
<td class="uk-text-center">';
if( !$Plugin->isCompatible() ) {
echo '<i class="uk-icon-exclamation-triangle incompatible-warning" title="'.$L->g('This plugin may not be supported by this version of Bludit').'"></i>';
}
echo '<span>'.$Plugin->version().'</span></td>';
echo '
<td class="uk-text-center">'.$Plugin->version().'</td>
<td class="uk-text-center"><a targe="_blank" href="'.$Plugin->website().'">'.$Plugin->author().'</a></td>
<td class="uk-text-center"><a target="_blank" href="'.$Plugin->website().'">'.$Plugin->author().'</a></td>
';
echo '</tr>';

View File

@ -81,6 +81,15 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
'tip'=>''
));
/*
HTML::formInputText(array(
'name'=>'uriCategory',
'label'=>$L->g('Category'),
'value'=>$Site->uriFilters('category'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
*/
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>

View File

@ -20,29 +20,33 @@ foreach($themes as $theme)
echo '
<tr '.($theme['dirname']==$Site->theme()?'class="theme-installed"':'class="theme-notInstalled"').'>
<td>
<div class="plugin-name">'.$theme['name'].'</div>
<div class="plugin-links">
<div class="plugin-name">
';
if($theme['dirname']!=$Site->theme()) {
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'">'.$L->g('Activate').'</a>';
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'" title="'.$L->g('Activate').'"><i class="uk-icon-square-o"></i></a> ';
}
else {
echo '<i class="uk-icon-check-square-o"></i> ';
}
echo '
</div>
'.$theme['name'].'</div>
</td>';
echo '<td>';
echo $theme['description'];
echo '</td>';
echo '
<td class="uk-text-center">';
if( !$theme['compatible'] ) {
echo '<div class="theme-incompatible">This theme is incompatible with Bludit v'.BLUDIT_VERSION.'</div>';
echo '<i class="uk-icon-exclamation-triangle incompatible-warning" title="This theme is incompatible with Bludit v'.BLUDIT_VERSION.'"></i>';
}
echo '</td>';
echo $theme['version'].'</td>';
echo '
<td class="uk-text-center">'.$theme['version'].'</td>
<td class="uk-text-center"><a targe="_blank" href="'.$theme['website'].'">'.$theme['author'].'</a></td>
<td class="uk-text-center"><a target="_blank" href="'.$theme['website'].'">'.$theme['author'].'</a></td>
';
echo '</tr>';

View File

@ -48,6 +48,8 @@ define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
define('DEBUG_FILE', PATH_CONTENT.'debug.txt');
// Log separator
define('LOG_SEP', ' | ');
@ -144,6 +146,7 @@ include(PATH_KERNEL.'dbusers.class.php');
include(PATH_KERNEL.'dbtags.class.php');
include(PATH_KERNEL.'dblanguage.class.php');
include(PATH_KERNEL.'dbsite.class.php');
include(PATH_KERNEL.'dbcategories.class.php');
include(PATH_KERNEL.'post.class.php');
include(PATH_KERNEL.'page.class.php');
include(PATH_KERNEL.'user.class.php');
@ -183,6 +186,7 @@ $dbPosts = new dbPosts();
$dbPages = new dbPages();
$dbUsers = new dbUsers();
$dbTags = new dbTags();
$dbCategories = new dbCategories();
$Site = new dbSite();
$Url = new Url();
$Parsedown = new ParsedownExtra();

View File

@ -51,7 +51,12 @@ if( ($Url->whereAmI()==='post') && ($Url->notFound()===false) )
// Build posts by specific tag.
elseif( ($Url->whereAmI()==='tag') && ($Url->notFound()===false) )
{
$posts = buildPostsForPage($Url->pageNumber(), $Site->postsPerPage(), true, $Url->slug());
$posts = buildPostsForPage($Url->pageNumber(), $Site->postsPerPage(), true, $Url->slug(), 'tag');
}
// Build posts by specific category.
elseif( ($Url->whereAmI()==='category') && ($Url->notFound()===false) )
{
$posts = buildPostsForPage($Url->pageNumber(), $Site->postsPerPage(), true, $Url->slug(), 'category');
}
// Build posts for homepage or admin area.
else

View File

@ -0,0 +1,225 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
/*
Database structure
- To re index the list of posts and pages need to be sorted
{
"videos": {
"name": "Videos",
"posts": [ "first-post", "bull-terrier" ],
"pages": [ "my-page", "second-page" ]
},
"pets": {
"name": "Pets",
"posts": [ "second-post", "bull-terrier" ],
"pages": [ "cats-and-dogs" ]
}
}
*/
class dbCategories extends dbJSON
{
public $dbFields = array();
function __construct()
{
parent::__construct(PATH_DATABASES.'categories.php');
}
private function getByCategory($type='posts', $categoryKey, $amountPerPage, $pageNumber)
{
// Check if the category exists
if( !isset($this->db[$categoryKey]) ) {
Log::set(__METHOD__.LOG_SEP.'Error getting '.$type.' by the category: '.$categoryKey);
return array();
}
$list = $this->db[$categoryKey][$type];
$init = (int) $amountPerPage * $pageNumber;
$end = (int) min( ($init + $amountPerPage - 1), count($list) - 1 );
$outrange = $init<0 ? true : $init > $end;
if($outrange) {
Log::set(__METHOD__.LOG_SEP.'Error getting '.$type.' by the category, out of range, pageNumber: '.$pageNumber);
return array();
}
$tmp = array_flip($list);
return array_slice($tmp, $init, $amountPerPage, true);
}
public function getPagesByCategory($categoryKey, $amountPerPage, $pageNumber)
{
return $this->getByCategory('pages', $categoryKey, $amountPerPage, $pageNumber);
}
public function getPostsByCategory($categoryKey, $amountPerPage, $pageNumber)
{
return $this->getByCategory('posts', $categoryKey, $amountPerPage, $pageNumber);
}
private function countByCategory($type='posts', $categoryKey)
{
if( isset($this->db[$categoryKey][$type]) ) {
return count($this->db[$categoryKey][$type]);
}
return 0;
}
public function countPostsByCategory($categoryKey)
{
return $this->countByCategory('posts', $categoryKey);
}
public function countPagesByCategory($categoryKey)
{
return $this->countByCategory('pages', $categoryKey);
}
public function getAll()
{
$tmp = array();
foreach($this->db as $key=>$data) {
$tmp[$key] = $data['name'];
}
// Sort low to high, by value.
natcasesort($tmp);
return $tmp;
}
public function add($category)
{
$categoryKey = $this->generateKey($category);
if( isset($this->db[$categoryKey]) ) {
Log::set(__METHOD__.LOG_SEP.'The category already exist, key: '.$categoryKey.', name: '.$category);
return false;
}
$this->db[$categoryKey]['name'] = $category;
$this->db[$categoryKey]['posts'] = array();
$this->db[$categoryKey]['pages'] = array();
$this->save();
return $categoryKey;
}
public function remove($categoryKey)
{
if( !isset($this->db[$categoryKey]) ) {
Log::set(__METHOD__.LOG_SEP.'The category does not exist, key: '.$categoryKey);
return false;
}
unset($this->db[$categoryKey]);
return $this->save();
}
public function edit($oldCategoryKey, $newCategory)
{
$newCategoryKey = $this->generateKey($newCategory);
if( isset($this->db[$newCategoryKey]) ) {
Log::set(__METHOD__.LOG_SEP.'The category already exist, key: '.$newCategoryKey.', name: '.$newCategory);
return false;
}
// Add the new category with the posts and pages from the old one
$this->db[$newCategoryKey]['name'] = $newCategory;
$this->db[$newCategoryKey]['posts'] = $this->db[$oldCategoryKey]['posts'];
$this->db[$newCategoryKey]['pages'] = $this->db[$oldCategoryKey]['posts'];
// Remove the old category
unset( $this->db[$oldCategoryKey] );
$this->save();
return $newCategoryKey;
}
// Re-generate posts index
// (array) $db, the $db must be sorted by date and the posts published only.
public function reIndexPosts($db)
{
// Clean post list
foreach( $this->db as $key=>$value ) {
$this->db[$key]['posts'] = array();
}
// Foreach post in the database
foreach($db as $postKey=>$postData) {
if( !empty($postData['category']) ) {
$categoryKey = $postData['category'];
if( isset($this->db[$categoryKey]['posts']) ) {
array_push($this->db[$categoryKey]['posts'], $postKey);
}
}
}
return $this->save();
}
// Re-generate pages index
// (array) $db, the $db must be sorted by date and the posts published only.
public function reIndexPages($db)
{
// Clean post list
foreach( $this->db as $key=>$value ) {
$this->db[$key]['pages'] = array();
}
// Foreach post in the database
foreach($db as $postKey=>$postData) {
if( !empty($postData['category']) ) {
$categoryKey = $postData['category'];
if( isset($this->db[$categoryKey]['pages']) ) {
array_push($this->db[$categoryKey]['pages'], $postKey);
}
}
}
return $this->save();
}
public function exists($categoryKey)
{
return isset( $this->db[$categoryKey] );
}
public function getName($categoryKey)
{
return $this->db[$categoryKey]['name'];
}
public function generateKey($category)
{
return Text::cleanUrl($category);
}
public function getListOfPosts($pageNumber, $postPerPage, $categoryKey)
{
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), count($this->db[$categoryKey]['posts']) );
$outrange = $init<0 ? true : $init > $end;
if(!$outrange) {
$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);
}
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying get the list of posts, out of range?. Pagenumber: '.$pageNumber);
return array();
}
}

View File

@ -44,6 +44,8 @@ class dbLanguage extends dbJSON
$key = Text::lowercase($string);
$key = Text::replace(' ', '-', $key);
#file_put_contents(DEBUG_FILE, $key.PHP_EOL, FILE_APPEND);
if(isset($this->db[$key])) {
return $this->db[$key];
}

View File

@ -14,7 +14,9 @@ class dbPages extends dbJSON
'date'=> array('inFile'=>false, 'value'=>''),
'dateModified'=> array('inFile'=>false, 'value'=>''),
'position'=> array('inFile'=>false, 'value'=>0),
'coverImage'=> array('inFile'=>false, 'value'=>'')
'coverImage'=> array('inFile'=>false, 'value'=>''),
'category'=> array('inFile'=>false, 'value'=>''),
'uuid'=> array('inFile'=>false, 'value'=>'')
);
function __construct()
@ -29,6 +31,9 @@ class dbPages extends dbJSON
$key = $this->generateKey($args['slug'], $args['parent']);
// Generate UUID
$args['uuid'] = md5(time().DOMAIN);
// The user is always the one loggued.
$args['username'] = Session::get('username');
if( Text::isEmpty($args['username']) ) {
@ -332,6 +337,19 @@ class dbPages extends dbJSON
return $tmp;
}
// Change all posts with the old category key for the new category key
public function changeCategory($oldCategoryKey, $newCategoryKey)
{
foreach($this->db as $key=>$value) {
if($value['category']==$oldCategoryKey) {
$this->db[$key]['category'] = $newCategoryKey;
}
}
// Save database
return $this->save();
}
public function count()
{
$count = parent::count();

View File

@ -13,7 +13,9 @@ class dbPosts extends dbJSON
'date'=> array('inFile'=>false, 'value'=>''),
'dateModified'=> array('inFile'=>false, 'value'=>''),
'coverImage'=> array('inFile'=>false, 'value'=>''),
'md5file'=> array('inFile'=>false, 'value'=>'')
'md5file'=> array('inFile'=>false, 'value'=>''),
'category'=> array('inFile'=>false, 'value'=>''),
'uuid'=> array('inFile'=>false, 'value'=>'')
);
function __construct()
@ -21,7 +23,7 @@ class dbPosts extends dbJSON
parent::__construct(PATH_DATABASES.'posts.php');
}
// Return the amount of posts
// Returns the amount of posts
// $total = TRUE, returns the total of posts
// $total = FALSE, return the amount of published posts
public function numberPost($total=false)
@ -42,13 +44,14 @@ class dbPosts extends dbJSON
return $i;
}
// Returns the database
// Returns the complete database
public function getDB()
{
return $this->db;
}
// Return an array with the post's database, FALSE otherwise.
// Return an array with the post database, FALSE otherwise.
// Filtered by post key
public function getPostDB($key)
{
if($this->postExists($key)) {
@ -112,6 +115,11 @@ class dbPosts extends dbJSON
// Generate the database key / index
$key = $this->generateKey($args['slug']);
// Generate UUID
if( empty($args['uuid']) ) {
$args['uuid'] = md5(uniqid());
}
// The user is always who is loggued
$args['username'] = Session::get('username');
if( Text::isEmpty($args['username']) ) {
@ -129,7 +137,7 @@ class dbPosts extends dbJSON
$args['status'] = 'scheduled';
}
// Verify arguments with the database fields.
// Verify arguments with the database fields
foreach($this->dbFields as $field=>$options)
{
// If the field is in the arguments
@ -139,8 +147,9 @@ class dbPosts extends dbJSON
$tmpValue = $this->generateTags($args['tags']);
}
else {
// Sanitize if will be saved on database.
// Where the argument will be stored, database or file
if( !$options['inFile'] ) {
// Sanitize if going to be stored on database
$tmpValue = Sanitize::html($args[$field]);
}
else {
@ -148,18 +157,16 @@ class dbPosts extends dbJSON
}
}
}
// Set a default value if not in the arguments
else
{
else {
// Set a default value if not in the arguments
$tmpValue = $options['value'];
}
// Check where the field will be written, in the file or in the database
// Check where the field will be stored in the file or in the database
if($options['inFile']) {
$dataForFile[$field] = Text::firstCharUp($field).': '.$tmpValue;
}
else
{
else {
// Set type
settype($tmpValue, gettype($options['value']));
@ -168,7 +175,7 @@ class dbPosts extends dbJSON
}
}
// Make the directory.
// Create the directory
if( Filesystem::mkdir(PATH_POSTS.$key) === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the directory '.PATH_POSTS.$key);
return false;
@ -184,19 +191,14 @@ class dbPosts extends dbJSON
// Calculate the checksum of the file
$dataForDb['md5file'] = md5_file(PATH_POSTS.$key.DS.FILENAME);
// Save the database
// Insert in the database
$this->db[$key] = $dataForDb;
// Sort posts before save
// Sort database posts before save
$this->sortByDate();
// Save database file
if( $this->save() === false ) {
// Trying to rollback
Log::set(__METHOD__.LOG_SEP.'Rollback...');
Filesystem::rmfile(PATH_POSTS.$key.DS.FILENAME);
Filesystem::rmdir(PATH_POSTS.$key);
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
return false;
}
@ -206,11 +208,13 @@ class dbPosts extends dbJSON
public function edit($args)
{
// Modified date
$args['dateModified'] = Date::current(DB_DATE_FORMAT);
// Keep UUID
$args['uuid'] = $this->db[$args['key']]['uuid'];
if( $this->delete($args['key']) ) {
// Modified date
$args['dateModified'] = Date::current(DB_DATE_FORMAT);
return $this->add($args);
}
@ -389,6 +393,19 @@ class dbPosts extends dbJSON
return $tmp;
}
// Change all posts with the old category key for the new category key
public function changeCategory($oldCategoryKey, $newCategoryKey)
{
foreach($this->db as $key=>$value) {
if($value['category']==$oldCategoryKey) {
$this->db[$key]['category'] = $newCategoryKey;
}
}
// Save database
return $this->save();
}
// Sort posts by date.
public function sortByDate($HighToLow=true)
{

View File

@ -18,6 +18,7 @@ class dbSite extends dbJSON
'uriPost'=> array('inFile'=>false, 'value'=>'/post/'),
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
'uriBlog'=> array('inFile'=>false, 'value'=>'/blog/'),
'uriCategory'=> array('inFile'=>false, 'value'=>'/category/'),
'url'=> array('inFile'=>false, 'value'=>''),
'emailFrom'=> array('inFile'=>false, 'value'=>''),
'dateFormat'=> array('inFile'=>false, 'value'=>'F j, Y'),
@ -73,6 +74,7 @@ class dbSite extends dbJSON
$filters['page'] = $this->getField('uriPage');
$filters['tag'] = $this->getField('uriTag');
$filters['blog'] = $this->getField('uriBlog');
$filters['category'] = $this->getField('uriCategory');
if(empty($filter)) {
return $filters;
@ -105,6 +107,12 @@ class dbSite extends dbJSON
return $this->url().ltrim($filter, '/');
}
public function urlCategory()
{
$filter = $this->getField('uriCategory');
return $this->url().ltrim($filter, '/');
}
public function twitter()
{
return $this->getField('twitter');

View File

@ -20,6 +20,23 @@ function reIndexTagsPosts()
return true;
}
function reIndexCategoriesPosts()
{
global $dbPosts;
global $dbCategories;
// Remove unpublished.
$dbPosts->removeUnpublished();
// Regenerate the tags index for posts.
$dbCategories->reindexPosts( $dbPosts->db );
// Restore the database, before remove the unpublished.
$dbPosts->restoreDB();
return true;
}
function buildPost($key)
{
global $dbPosts;
@ -75,17 +92,21 @@ function buildPost($key)
return $Post;
}
function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $tagKey=false)
function buildPostsForPage($pageNumber=0, $amount=POSTS_PER_PAGE_ADMIN, $removeUnpublished=true, $key=false, $type='tag')
{
global $dbPosts;
global $dbTags;
global $dbCategories;
global $Url;
$posts = array();
if($tagKey) {
if( $type=='tag' && $key ) {
// Get the keys list from tags database, this database is optimized for this case.
$list = $dbTags->getList($pageNumber, $amount, $tagKey);
$list = $dbTags->getList($pageNumber, $amount, $key);
}
elseif( $type=='category' && $key ) {
$list = $dbCategories->getListOfPosts($pageNumber, $amount, $key);
}
else {
// Get the keys list from posts database.
@ -121,6 +142,17 @@ function sortPages($a, $b)
return ($a['position'] < $b['position']) ? -1 : 1;
}
function reIndexCategoriesPages()
{
global $dbPages;
global $dbCategories;
// Regenerate the tags index for posts.
$dbCategories->reindexPages( $dbPages->db );;
return true;
}
function buildPage($key)
{
global $dbPages;

View File

@ -108,6 +108,8 @@ class Image {
// *** Resample - create image canvas of x, y size
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
@ -230,6 +232,8 @@ class Image {
// *** Now crop from center to exact requested size
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
imagealphablending($this->imageResized, false);
imagesavealpha($this->imageResized, true);
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
}
}

View File

@ -58,6 +58,40 @@ class Paginator {
return $url.'?page='.self::get('prevPage');
}
public static function urlLastPage()
{
global $Url;
$domain = trim(DOMAIN_BASE,'/');
$filter = trim($Url->activeFilter(), '/');
if(empty($filter)) {
$url = $domain.'/'.$Url->slug();
}
else {
$url = $domain.'/'.$filter.'/'.$Url->slug();
}
return $url.'?page='.self::get('numberOfPages');
}
public static function urlFirstPage()
{
global $Url;
$domain = trim(DOMAIN_BASE,'/');
$filter = trim($Url->activeFilter(), '/');
if(empty($filter)) {
$url = $domain.'/'.$Url->slug();
}
else {
$url = $domain.'/'.$filter.'/'.$Url->slug();
}
return $url.'?page=0';
}
public static function html($textPrevPage=false, $textNextPage=false, $showPageNumber=false)
{
global $Language;

View File

@ -17,7 +17,7 @@ class Parsedown
{
# ~
const version = '1.6.0';
const version = '1.6.2';
# ~
@ -115,7 +115,7 @@ class Parsedown
# Blocks
#
private function lines(array $lines)
protected function lines(array $lines)
{
$CurrentBlock = null;
@ -175,7 +175,7 @@ class Parsedown
}
else
{
if (method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
if ($this->isBlockCompletable($CurrentBlock['type']))
{
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
@ -216,7 +216,7 @@ class Parsedown
$Block['identified'] = true;
}
if (method_exists($this, 'block'.$blockType.'Continue'))
if ($this->isBlockContinuable($blockType))
{
$Block['continuable'] = true;
}
@ -245,7 +245,7 @@ class Parsedown
# ~
if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type']))
{
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
}
@ -278,6 +278,16 @@ class Parsedown
return $markup;
}
protected function isBlockContinuable($Type)
{
return method_exists($this, 'block'.$Type.'Continue');
}
protected function isBlockCompletable($Type)
{
return method_exists($this, 'block'.$Type.'Complete');
}
#
# Code
@ -438,7 +448,7 @@ class Parsedown
return $Block;
}
$Block['element']['text']['text'] .= "\n".$Line['body'];;
$Block['element']['text']['text'] .= "\n".$Line['body'];
return $Block;
}
@ -505,6 +515,16 @@ class Parsedown
),
);
if($name === 'ol')
{
$listStart = stristr($matches[0], '.', true);
if($listStart !== '1')
{
$Block['element']['attributes'] = array('start' => $listStart);
}
}
$Block['li'] = array(
'name' => 'li',
'handler' => 'li',
@ -1184,7 +1204,7 @@ class Parsedown
$remainder = $Excerpt['text'];
if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches))
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
{
$Element['text'] = $matches[1];
@ -1197,7 +1217,7 @@ class Parsedown
return;
}
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches))
{
$Element['attributes']['href'] = $matches[1];
@ -1519,10 +1539,10 @@ class Parsedown
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
'i', 'rp', 'del', 'code', 'strike', 'marquee',
'q', 'rt', 'ins', 'font', 'strong',
's', 'tt', 'sub', 'mark',
'u', 'xm', 'sup', 'nobr',
'var', 'ruby',
'wbr', 'span',
'time',
's', 'tt', 'kbd', 'mark',
'u', 'xm', 'sub', 'nobr',
'sup', 'ruby',
'var', 'span',
'wbr', 'time',
);
}
}

View File

@ -246,8 +246,15 @@
"disable-the-user" : "Деактивиране на потребителя",
"add-a-new-page": "Добавяне на нова страница",
"add-a-new-post": "Добавяне на нова публикация",
"save-as-draft": "Запази като чернова"
"save-as-draft": "Запази като чернова",
"categories": "Категории",
"add-a-new-category": "Добавяне на нова категория",
"new-category": "Нова категория",
"slug": "slug",
"edit-category": "Редактиране на категорията",
"last-page": "Последна страница",
"first-page": "Първа страница"
}

View File

@ -51,6 +51,8 @@
"themes": "Themes",
"prev-page": "Prev page",
"next-page": "Next page",
"first-page": "First page",
"last-page": "Last page",
"configure-plugin": "Configure plugin",
"confirm-delete-this-action-cannot-be-undone": "Confirm delete, this action cannot be undone.",
"site-title": "Site title",
@ -249,5 +251,12 @@
"add-a-new-page": "Add a new page",
"add-a-new-post": "Add a new post",
"save-as-draft": "Save as draft"
"save-as-draft": "Save as draft",
"categories": "Сategories",
"add-a-new-category": "Add a new category",
"new-category": "New category",
"slug": "slug",
"edit-category": "Edit category",
"last-page": "Last page",
"first-page": "First page"
}

View File

@ -1,6 +1,5 @@
<?php
class pluginAPI extends Plugin {
public function init()
@ -22,13 +21,6 @@ class pluginAPI extends Plugin {
{
$html = '';
$html .= '<div>';
$html .= '<input type="hidden" name="ping" value="0">';
$html .= '<input name="ping" id="jsping" type="checkbox" value="1" '.($this->getDbField('ping')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsping">Ping Bludit.com</label>';
$html .= '<div class="tip">Enable this feature to share your posts and pages with Bludit.com.</div>';
$html .= '</div>';
$html .= '<div>';
$html .= '<p><b>Authorization Key:</b> '.$this->getDbField('token').'</p>';
$html .= '<div class="tip">This key is private, do not share it with anyone.</div>';
@ -57,22 +49,10 @@ class pluginAPI extends Plugin {
return $html;
}
public function install($position=0)
{
parent::install($position);
$this->ping();
}
// API HOOKS
// ----------------------------------------------------------------------------
public function afterFormSave()
{
$this->ping();
}
public function beforeRulesLoad()
{
global $Url;
@ -128,9 +108,9 @@ class pluginAPI extends Plugin {
// PARAMETERS
// ------------------------------------------------------------
// /api/posts | GET | returns all posts
// /api/posts/{slug} | GET | returns the post with the {slug}
// /api/posts/{key} | GET | returns the post with the {key}
// /api/pages | GET | returns all pages
// /api/pages/{slug} | GET | returns the page with the {slug}
// /api/pages/{key} | GET | returns the page with the {key}
// /api/cli/regenerate | POST | check for new posts and pages
$parameters = explode('/', $URI);
@ -167,12 +147,12 @@ class pluginAPI extends Plugin {
$data = $this->getAllPages();
$this->response($data);
}
// /api/posts/{slug}
// /api/posts/{key}
elseif( ($method==='GET') && ($parameters[0]==='posts') && !empty($parameters[1]) ) {
$data = $this->getPost($parameters[1]);
$this->response($data);
}
// /api/pages/{slug}
// /api/pages/{key}
elseif( ($method==='GET') && ($parameters[0]==='pages') && !empty($parameters[1]) ) {
$data = $this->getPage($parameters[1]);
$this->response($data);

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmasters Tools",
"google-analytics-tracking-id": "Google Analytics ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Gib hier den Google Analytics-Tracking-Code ein, um zu bestätigen, dass die Website Dir gehört.",
"complete-this-field-with-the-tracking-id": "Gib hier die Tracking ID ein."
"complete-this-field-with-the-tracking-id": "Gib hier die Tracking ID ein.",
"complete-this-field-with-the-tracking-id-google-tag": "Gib hier die Tracking ID ein."
}

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmasters Tools",
"google-analytics-tracking-id": "Google Analytics ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Gib hier den Google Analytics-Tracking-Code ein, um zu bestätigen, dass die Website Dir gehört.",
"complete-this-field-with-the-tracking-id": "Gib hier die Tracking ID ein."
"complete-this-field-with-the-tracking-id": "Gib hier die Tracking ID ein.",
"complete-this-field-with-the-tracking-id-google-tag": "Gib hier die Tracking ID ein."
}

View File

@ -7,6 +7,8 @@
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "Google Analytics Tracking ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics."
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.",
"complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Tag Manager."
}

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "Google Analytics Tracking ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Complete este campo con el código de verificación de Google Webmasters Tools para verificar la propiedad del sitio.",
"complete-this-field-with-the-tracking-id": "Complete este campo con el Tracking ID para generar el código Javascript para trackear el sitio."
"complete-this-field-with-the-tracking-id": "Complete este campo con el Tracking ID para generar el código Javascript para trackear el sitio.",
"complete-this-field-with-the-tracking-id-google-tag": "Complete este campo con el Tracking ID para generar el código Javascript para Google Tag Manager."
}

View File

@ -7,6 +7,8 @@
"google-webmasters-tools": "Google Search Console",
"google-analytics-tracking-id": "Google Analytics トラッキングID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Google Seach Consoleがサイト所有権を確認するためのメタタグを入力します。",
"complete-this-field-with-the-tracking-id": "Google Analyticsがトラッキングをするために生成したトラッキングIDを入力します。"
"complete-this-field-with-the-tracking-id": "Google Analyticsがトラッキングをするために生成したトラッキングIDを入力します。",
"complete-this-field-with-the-tracking-id-google-tag": "トラッキングをするために生成したトラッキングIDを入力します。"
}

View File

@ -7,6 +7,8 @@
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "Google Analytics Tracking ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Vul dit veld in met de Google Site verificatie om jezelf te verifiëren als site beheerder.",
"complete-this-field-with-the-tracking-id": "Vul dit veld in met de Tracking ID om de Javascript tracking code te genereren voor Google Analytics."
"complete-this-field-with-the-tracking-id": "Vul dit veld in met de Tracking ID om de Javascript tracking code te genereren voor Google Analytics.",
"complete-this-field-with-the-tracking-id-google-tag": "Vul dit veld in met de Tracking ID."
}

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "Google Analytics Tracking ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics."
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.",
"complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the ID"
}

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "Google Analytics Tracking ID",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Заполните это поле для проверки владельца сайта.",
"complete-this-field-with-the-tracking-id": "Заполните это поле с Tracking ID чтобы сгенерировать код Javascript для отслеживания в Google Analytics."
"complete-this-field-with-the-tracking-id": "Заполните это поле с Tracking ID чтобы сгенерировать код Javascript для отслеживания в Google Analytics.",
"complete-this-field-with-the-tracking-id-google-tag": "Заполните это поле с Tracking ID чтобы сгенерировать код Javascript для."
}

View File

@ -6,6 +6,8 @@
},
"google-webmasters-tools": "Google Webmaster Araçları",
"google-analytics-tracking-id": "Google Analytics İzleme No",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Google Site Doğrulama ile bu alanı doldurarak sitenizi doğrulayın",
"complete-this-field-with-the-tracking-id": "Bu alanı İzleme No ile doldurarak Google Analytics için Javascript kodu oluşturun."
"complete-this-field-with-the-tracking-id": "Bu alanı İzleme No ile doldurarak Google Analytics için Javascript kodu oluşturun.",
"complete-this-field-with-the-tracking-id-google-tag": "Bu alanı İzleme No ile doldurarak için Javascript kodu oluşturun."
}

View File

@ -7,6 +7,8 @@
"google-webmasters-tools": "Google Webmasters tools",
"google-analytics-tracking-id": "КОД відстеження Google Analytics",
"google-tag-manager": "Google Tag Manager",
"complete-this-field-with-the-google-site-verification": "Заповніть це поле для перевірки власника сайту.",
"complete-this-field-with-the-tracking-id": "Заповніть це поле для генерації Javascript-коду відстеження у Google Analytics."
"complete-this-field-with-the-tracking-id": "Заповніть це поле для генерації Javascript-коду відстеження у Google Analytics.",
"complete-this-field-with-the-tracking-id-google-tag": "Заповніть це поле для генерації Javascript-коду відстеження."
}

View File

@ -6,7 +6,8 @@ class pluginGoogleTools extends Plugin {
{
$this->dbFields = array(
'tracking-id'=>'',
'google-site-verification'=>''
'google-site-verification'=>'',
'google-tag-manager'=>''
);
}
@ -26,6 +27,12 @@ class pluginGoogleTools extends Plugin {
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</div>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label for="jsgoogle-tag-manager">'.$Language->get('Google Tag Manager').'</label>';
$html .= '<input id="jsgoogle-tag-manager" type="text" name="google-tag-manager" value="'.$this->getDbField('google-tag-manager').'">';
$html .= '<div class="tip">'.$Language->get('complete-this-field-with-the-tracking-id-google-tag').'</div>';
$html .= '</div>';
return $html;
}
@ -33,13 +40,36 @@ class pluginGoogleTools extends Plugin {
{
global $Url;
if(Text::isEmpty($this->getDbField('google-site-verification')) || !($Url->whereAmI()=='home')) {
$html = '';
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;
$html .= "new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],".PHP_EOL;
$html .= "j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=".PHP_EOL;
$html .= "'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);".PHP_EOL;
$html .= "})(window,document,'script','dataLayer','".$this->getDbField('google-tag-manager')."');</script>".PHP_EOL;
$html .= "<!-- End Google Tag Manager -->".PHP_EOL;
}
return $html;
}
public function siteBodyBegin()
{
if((Text::isEmpty($this->getDbField('google-tag-manager')))) {
return false;
}
$html = PHP_EOL.'<!-- Google Webmasters Tools -->'.PHP_EOL;
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'">'.PHP_EOL;
$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;
}

View File

@ -107,4 +107,4 @@ class pluginRSS extends Plugin {
}
}
}
}

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

@ -2271,13 +2271,50 @@
content: '\f053';
}
ul.actions.pagination .last {
text-decoration: none;
}
ul.actions.pagination .last:after {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
ul.actions.pagination .last:after {
content: '\f050';
}
ul.actions.pagination .first {
text-decoration: none;
}
ul.actions.pagination .first:before {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
ul.actions.pagination .first:before {
content: '\f049';
}
@media screen and (max-width: 1280px) {
ul.actions.pagination {
text-align: center;
}
ul.actions.pagination .next, ul.actions.pagination .previous {
ul.actions.pagination .next, ul.actions.pagination .previous,
ul.actions.pagination .last, ul.actions.pagination .first {
min-width: 20em;
}
@ -2285,7 +2322,8 @@
@media screen and (max-width: 736px) {
ul.actions.pagination .next, ul.actions.pagination .previous {
ul.actions.pagination .next, ul.actions.pagination .previous,
ul.actions.pagination .last, ul.actions.pagination .first {
min-width: 18em;
}

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

@ -73,11 +73,13 @@
<ul class="actions pagination">
<?php
if( Paginator::get('showNewer') ) {
echo '<li><a href="'.Paginator::urlFirstPage().'" class="button big first">'.$Language->get('First page').'</a></li>';
echo '<li><a href="'.Paginator::urlPrevPage().'" class="button big previous">'.$Language->get('Prev page').'</a></li>';
}
if( Paginator::get('showOlder') ) {
echo '<li><a href="'.Paginator::urlNextPage().'" class="button big next">'.$Language->get('Next page').'</a></li>';
echo '<li><a href="'.Paginator::urlLastPage().'" class="button big last">'.$Language->get('Last page').'</a></li>';
}
?>
</ul>

View File

@ -331,7 +331,11 @@ function install($adminPassword, $email, $timezone)
'tags'=>array(),
'status'=>'published',
'date'=>$currentDate,
'position'=>0
'position'=>0,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
),
'about'=>array(
'description'=>$Language->get('About your site or yourself'),
@ -339,7 +343,11 @@ function install($adminPassword, $email, $timezone)
'tags'=>array(),
'status'=>'published',
'date'=>$currentDate,
'position'=>1
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
)
);
@ -353,7 +361,11 @@ function install($adminPassword, $email, $timezone)
'status'=>'published',
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
'allowComments'=>'false',
'date'=>$currentDate
'date'=>$currentDate,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid())
)
);
file_put_contents(PATH_DATABASES.'posts.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
@ -374,6 +386,8 @@ function install($adminPassword, $email, $timezone)
'uriPost'=>'/post/',
'uriPage'=>'/',
'uriTag'=>'/tag/',
'uriBlog'=>'/blog/',
'uriCategory'=>'/category/',
'url'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT,
'emailFrom'=>'no-reply@'.DOMAIN
);
@ -417,6 +431,12 @@ 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(
'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
file_put_contents(
PATH_DATABASES.'tags.php',
@ -727,4 +747,4 @@ $(document).ready(function()
</script>
</body>
</html>
</html>