1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-17 18:36:39 +02:00

Merge branch 'dev'

This commit is contained in:
Awilum
2018-12-14 11:48:22 +03:00
10 changed files with 50 additions and 24 deletions

View File

@@ -1,3 +1,10 @@
# Flextype 0.7.4, 2018-12-14
* Content: new frontMatterParser() - added
* Config: set error reporting - false
* Update theme simple according to the php template syntax guidelines
* Super heavy "imagine/imagine": "1.2.0" - removed
* Flextype Component - Errorhandler updated to 1.0.5
# Flextype 0.7.3, 2018-12-13
* Content: visibility hidden for pages - added
* Settings merged into one settings.yaml file

View File

@@ -1,6 +1,6 @@
# Flextype
[![Discord](https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat&style=flat-square)](https://discordapp.com/invite/CCKPKVG)
![Version](https://img.shields.io/badge/version-0.7.3-brightgreen.svg?style=flat-square)
![Version](https://img.shields.io/badge/version-0.7.4-brightgreen.svg?style=flat-square)
![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
Flextype is Open Source, fast and flexible file-based Content Management System.

View File

@@ -20,14 +20,13 @@
"doctrine/cache": "1.8.0",
"symfony/yaml": "4.2.1",
"thunderer/shortcode": "0.6.5",
"imagine/imagine": "1.2.0",
"flextype-components/arr" : "1.2.3",
"flextype-components/assets" : "1.0.1",
"flextype-components/cookie" : "1.2.0",
"flextype-components/date" : "1.0.0",
"flextype-components/debug" : "1.0.0",
"flextype-components/event" : "1.0.4",
"flextype-components/errorhandler" : "1.0.4",
"flextype-components/errorhandler" : "1.0.5",
"flextype-components/filesystem" : "1.1.3",
"flextype-components/form" : "1.0.1",
"flextype-components/i18n" : "1.2.0",

View File

@@ -313,6 +313,22 @@ class Content
return Content::$shortcode;
}
/**
* Front matter parser
*
* @param string $content Content to parse
* @access public
* @return array
*/
public static function frontMatterParser(string $content) : array
{
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL.ltrim($content));
if (count($parts) < 3) return ['matter' => [], 'body' => $content];
return ['matter' => trim($parts[1]), 'body' => implode(PHP_EOL.'---'.PHP_EOL, array_slice($parts, 2))];
}
/**
* Process page
*
@@ -335,9 +351,9 @@ class Content
} else {
// Create $page_frontmatter and $page_content
$page = explode('---', $page, 3);
$page_frontmatter = $page[1];
$page_content = $page[2];
$page = Content::frontMatterParser($page);
$page_frontmatter = $page['matter'];
$page_content = $page['body'];
// Create empty $_page
$_page = [];

View File

@@ -26,7 +26,7 @@ class Flextype
*
* @var string
*/
const VERSION = '0.7.3';
const VERSION = '0.7.4';
/**
* An instance of the Flextype class

View File

@@ -13,7 +13,7 @@ locale: en
pages:
main: home
errors:
display: true
display: false
cache:
enabled: true
prefix: flextype

View File

@@ -3,26 +3,28 @@
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry, Assets\Assets, Text\Text, Html\Html};
?>
<!doctype html>
<html lang="<?php echo Registry::get('settings.locale'); ?>">
<html lang="<?= Registry::get('settings.locale'); ?>">
<head>
<meta charset="<?php echo Text::lowercase(Registry::get('settings.charset')); ?>">
<meta charset="<?= Text::lowercase(Registry::get('settings.charset')); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="<?php echo (isset($page['description']) ? Html::toText($page['description']) : Html::toText(Registry::get('settings.description'))); ?>">
<meta name="keywords" content="<?php echo (isset($page['keywords']) ? $page['keywords'] : Registry::get('settings.keywords')); ?>">
<meta name="robots" content="<?php echo (isset($page['robots']) ? $page['robots'] : Registry::get('settings.robots')); ?>">
<meta name="generator" content="Powered by Flextype <?php echo Flextype::VERSION; ?>" />
<meta name="description" content="<?= (isset($page['description']) ? Html::toText($page['description']) : Html::toText(Registry::get('settings.description'))); ?>">
<meta name="keywords" content="<?= (isset($page['keywords']) ? $page['keywords'] : Registry::get('settings.keywords')); ?>">
<meta name="robots" content="<?= (isset($page['robots']) ? $page['robots'] : Registry::get('settings.robots')); ?>">
<meta name="generator" content="Powered by Flextype <?= Flextype::VERSION; ?>" />
<?php Event::dispatch('onThemeMeta'); ?>
<title><?php echo Html::toText($page['title']); ?> | <?php echo Html::toText(Registry::get('settings.title')); ?></title>
<title><?= Html::toText($page['title']); ?> | <?= Html::toText(Registry::get('settings.title')); ?></title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700' rel='stylesheet' type='text/css'>
<?php Assets::add('css', Http::getBaseUrl() . '/site/themes/' . Registry::get('settings.theme') . '/assets/dist/css/bootstrap.min.css', 'site', 1); ?>
<?php Assets::add('css', Http::getBaseUrl() . '/site/themes/' . Registry::get('settings.theme') . '/assets/dist/css/simple.min.css', 'site', 2); ?>
<?php foreach (Assets::get('css', 'site') as $assets_by_priorities) { foreach ($assets_by_priorities as $assets) { ?>
<link href="<?php echo $assets['asset']; ?>" rel="stylesheet">
<?php } } ?>
<?php foreach(Assets::get('css', 'site') as $assets_by_priorities): ?>
<?php foreach($assets_by_priorities as $assets): ?>
<link href="<?= $assets['asset']; ?>" rel="stylesheet">
<?php endforeach ?>
<?php endforeach ?>
<?php Event::dispatch('onThemeHeader'); ?>
</head>

View File

@@ -4,14 +4,14 @@
?>
<nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom box-shadow">
<div class="container">
<a class="navbar-brand" href="<?php echo Http::getBaseUrl(); ?>"><?php echo Registry::get('settings.title'); ?></a>
<a class="navbar-brand" href="<?= Http::getBaseUrl(); ?>"><?= Registry::get('settings.title'); ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link <?php if (Http::getUriSegment(0) == 'home' || Http::getUriSegment(0) == '') echo 'active'; ?>" href="<?php echo Http::getBaseUrl(); ?>">Home</a>
<a class="nav-link <?php if(Http::getUriSegment(0) == 'home' || Http::getUriSegment(0) == ''): ?>active<?php endif ?>" href="<?= Http::getBaseUrl(); ?>">Home</a>
</li>
</ul>
</div>

View File

@@ -3,7 +3,9 @@
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry, Assets\Assets};
?>
<?php Assets::add('js', Http::getBaseUrl() . '/site/themes/' . Registry::get('settings.theme') . '/assets/dist/js/simple.min.js', 'site', 1); ?>
<?php foreach (Assets::get('js', 'site') as $assets_by_priorities) { foreach ($assets_by_priorities as $assets) { ?>
<script src="<?php echo $assets['asset']; ?>"></script>
<?php } } ?>
<?php foreach(Assets::get('js', 'site') as $assets_by_priorities): ?>
<?php foreach($assets_by_priorities as $assets): ?>
<script src="<?= $assets['asset']; ?>"></script>
<?php endforeach ?>
<?php endforeach ?>
<?php Event::dispatch('onThemeFooter'); ?>

View File

@@ -1,4 +1,4 @@
<?php namespace Flextype; ?>
<?php Themes::view('partials/head')->display(); ?>
<?php echo $page['content']; ?>
<?= $page['content']; ?>
<?php Themes::view('partials/footer')->display(); ?>