Merge branch 'release-1.5.0' into stable
This commit is contained in:
commit
161cfc3187
19 changed files with 399 additions and 240 deletions
11
.gitlab-ci.yml
Normal file
11
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
image: php:7.0
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- bash ci/docker_install.sh > /dev/null
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
|
||||||
|
test:
|
||||||
|
script:
|
||||||
|
- phpunit tests/
|
|
@ -7,6 +7,15 @@
|
||||||
|
|
||||||
- [S] release are always compared to the previous [S] release.
|
- [S] release are always compared to the previous [S] release.
|
||||||
|
|
||||||
|
## Version 1.5.0 (2016-08-03) [S]
|
||||||
|
|
||||||
|
- **[FEATURE]** Ability to only show post excerpts on overview pages
|
||||||
|
- **[FIX]** Fixed twitter username not specified in connfig.yaml
|
||||||
|
- **[FIX]** Fixed wrong OpenGraph meta tags
|
||||||
|
- **[CODE]** Further improved code style
|
||||||
|
- **[CODE]** Added unit tests for Config.php and ArticleGenerator.php
|
||||||
|
- **[NOTE]** If you have own language file, please update them. See also the upgrade guide
|
||||||
|
|
||||||
## Version 1.4.4 (2016-06-03) [S]
|
## Version 1.4.4 (2016-06-03) [S]
|
||||||
- **[FIX]** Error when trying to create a feed
|
- **[FIX]** Error when trying to create a feed
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ $themes = getDir('./themes');
|
||||||
$yaml["design"]["theme"] = get("Which theme would you like to use? (" . $themes . ")", $yaml["design"]["theme"], "material-light");
|
$yaml["design"]["theme"] = get("Which theme would you like to use? (" . $themes . ")", $yaml["design"]["theme"], "material-light");
|
||||||
$yaml["design"]["pagination"] =
|
$yaml["design"]["pagination"] =
|
||||||
get("Which posts should be displayed on one page (0 to disable)", $yaml["design"]["pagination"], "0");
|
get("Which posts should be displayed on one page (0 to disable)", $yaml["design"]["pagination"], "0");
|
||||||
|
$yaml["design"]["excerpt"] =
|
||||||
|
getBool("Should be overview pages only show a excerpt of the full posts? (on/off)", $yaml["design"]["excerpt"], "off");
|
||||||
$yaml["design"]["favicon"] = get("URL to your favicon", $yaml["design"]["favicon"], "https://example.com/fav.ico");
|
$yaml["design"]["favicon"] = get("URL to your favicon", $yaml["design"]["favicon"], "https://example.com/fav.ico");
|
||||||
|
|
||||||
// rcc
|
// rcc
|
||||||
|
@ -49,6 +51,9 @@ $yaml["rcc"]["api"] = "off";
|
||||||
$langs = getDir('./lang');
|
$langs = getDir('./lang');
|
||||||
$yaml["language"] = get("Choose a language (" . $langs . ")", $yaml["language"], "en");
|
$yaml["language"] = get("Choose a language (" . $langs . ")", $yaml["language"], "en");
|
||||||
|
|
||||||
|
// social media
|
||||||
|
$yaml["social"]["twitter"] = get("Your Twitter username:", $yaml["social"]["twitter"], "");
|
||||||
|
|
||||||
$config->writeConfig($yaml);
|
$config->writeConfig($yaml);
|
||||||
|
|
||||||
function get($question, $value, $default)
|
function get($question, $value, $default)
|
||||||
|
|
15
ci/docker_install.sh
Normal file
15
ci/docker_install.sh
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Only install dependencies for Docker
|
||||||
|
[[ ! -e /.dockerenv ]] && [[ ! -e /.dockerinit ]] && exit 0
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
# Install git
|
||||||
|
apt-get update -yqq
|
||||||
|
apt-get install git -yqq
|
||||||
|
|
||||||
|
# Install phpunit
|
||||||
|
curl -o /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar
|
||||||
|
chmod +x /usr/local/bin/phpunit
|
||||||
|
|
|
@ -12,12 +12,16 @@ blog:
|
||||||
footer: "Rangitaki 2016 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">\n gitlab.com/mmk2410/rangitaki</a>"
|
footer: "Rangitaki 2016 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">\n gitlab.com/mmk2410/rangitaki</a>"
|
||||||
url: 'https://example.com/blog/'
|
url: 'https://example.com/blog/'
|
||||||
design:
|
design:
|
||||||
|
excerpt: "off"
|
||||||
fab: 'on'
|
fab: 'on'
|
||||||
drawer: 'on'
|
drawer: 'on'
|
||||||
theme: material-light
|
theme: material-light
|
||||||
pagination: 0
|
pagination: 0
|
||||||
|
excerpt: 'off'
|
||||||
favicon: 'http://example.com/res/img/favicon.png'
|
favicon: 'http://example.com/res/img/favicon.png'
|
||||||
rcc:
|
rcc:
|
||||||
rcc: 'on'
|
rcc: 'on'
|
||||||
api: 'on'
|
api: 'on'
|
||||||
language: en
|
language: en
|
||||||
|
social:
|
||||||
|
twitter: ''
|
||||||
|
|
47
index.php
47
index.php
|
@ -114,10 +114,9 @@ $feedurl = $config["blog"]["url"] . "/feed/" . $blog . ".atom";
|
||||||
<meta property="og:url" content="<?php echo $url; ?>"/>
|
<meta property="og:url" content="<?php echo $url; ?>"/>
|
||||||
<meta property="og:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
<meta property="og:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
||||||
<meta property="og:description" content="<?php echo $config['blog']['description']; ?>"/>
|
<meta property="og:description" content="<?php echo $config['blog']['description']; ?>"/>
|
||||||
<meta property="og:locale:alternate" content="<?php echo $lang; ?>"/>
|
|
||||||
<!-- Twitter meta tags -->
|
<!-- Twitter meta tags -->
|
||||||
<meta name="twitter:card" content="summary"/>
|
<meta name="twitter:card" content="summary"/>
|
||||||
<meta name="twitter:site" content="<?php echo $twitter; ?>"/>
|
<meta name="twitter:site" content="<?php echo $config['social']['twitter']; ?>"/>
|
||||||
<meta name="twitter:title" content="<?php echo $hd_subblog_title; ?>"/>
|
<meta name="twitter:title" content="<?php echo $hd_subblog_title; ?>"/>
|
||||||
<meta name="twitter:description" content="<?php echo $config['blog']['description']; ?>"/>
|
<meta name="twitter:description" content="<?php echo $config['blog']['description']; ?>"/>
|
||||||
<meta name="twitter:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
<meta name="twitter:image" content="<?php echo $config['design']['favicon']; ?>"/>
|
||||||
|
@ -194,7 +193,9 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
if ($navblog != "main.md") { // excluding main blog
|
if ($navblog != "main.md") { // excluding main blog
|
||||||
// creating navigation item
|
// creating navigation item
|
||||||
BlogListGenerator::listBlog(
|
BlogListGenerator::listBlog(
|
||||||
"./blogs/", $navblog, $config["blog"]["title"]
|
"./blogs/",
|
||||||
|
$navblog,
|
||||||
|
$config["blog"]["title"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,7 +204,9 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
if ($getblog . ".md" != $navblog) {
|
if ($getblog . ".md" != $navblog) {
|
||||||
// creating navigation item
|
// creating navigation item
|
||||||
BlogListGenerator::listBlog(
|
BlogListGenerator::listBlog(
|
||||||
"./blogs/", $navblog, $blogmaintitle
|
"./blogs/",
|
||||||
|
$navblog,
|
||||||
|
$blogmaintitle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +322,11 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
|
if (strlen($article) >= 3 && substr($article, -3) == ".md") {
|
||||||
// generate the article
|
// generate the article
|
||||||
ArticleGenerator::newArticle(
|
ArticleGenerator::newArticle(
|
||||||
$articlesdir, $article, $getblog
|
$articlesdir,
|
||||||
|
$article,
|
||||||
|
$getblog,
|
||||||
|
$config["design"]["excerpt"],
|
||||||
|
$BLOGLANG["Read More"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,12 +344,20 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
if ($config["design"]["pagination"]) {
|
if ($config["design"]["pagination"]) {
|
||||||
if ($posts_amount < $pag_max && $posts_amount >= $pag_min) {
|
if ($posts_amount < $pag_max && $posts_amount >= $pag_min) {
|
||||||
ArticleGenerator::newArticle(
|
ArticleGenerator::newArticle(
|
||||||
$articlesdir, $article, $getblog
|
$articlesdir,
|
||||||
|
$article,
|
||||||
|
$getblog,
|
||||||
|
$config["design"]["excerpt"],
|
||||||
|
$BLOGLANG["Read More"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ArticleGenerator::newArticle(
|
ArticleGenerator::newArticle(
|
||||||
$articlesdir, $article, $getblog
|
$articlesdir,
|
||||||
|
$article,
|
||||||
|
$getblog,
|
||||||
|
$config["design"]["excerpt"],
|
||||||
|
$BLOGLANG["Read More"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,7 +369,11 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
} elseif (isset($getarticle)) { // ARTICLE VIEW
|
} elseif (isset($getarticle)) { // ARTICLE VIEW
|
||||||
// generate the requested article
|
// generate the requested article
|
||||||
ArticleGenerator::newArticle(
|
ArticleGenerator::newArticle(
|
||||||
$articlesdir, $getarticle . ".md", $getblog
|
$articlesdir,
|
||||||
|
$getarticle . ".md",
|
||||||
|
$getblog,
|
||||||
|
'off',
|
||||||
|
$BLOGLANG["Read More"]
|
||||||
);
|
);
|
||||||
include './res/php/Disqus.php'; // include disques
|
include './res/php/Disqus.php'; // include disques
|
||||||
} else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN
|
} else { // SOMETHING STRANGE: THIS SHOULDN'T HAPPEN
|
||||||
|
@ -417,14 +436,14 @@ if ($config["design"]["drawer"] == "on") {
|
||||||
<script src="./res/js/app.js"></script> <!--include main javascript-->
|
<script src="./res/js/app.js"></script> <!--include main javascript-->
|
||||||
<!-- JS extension support -->
|
<!-- JS extension support -->
|
||||||
<?php
|
<?php
|
||||||
if(file_exists("./extensions")) {
|
if (file_exists("./extensions")) {
|
||||||
$extensions = scandir('./extensions');
|
$extensions = scandir('./extensions');
|
||||||
foreach ($extensions as $extension) {
|
foreach ($extensions as $extension) {
|
||||||
if (substr($extension, -3) == ".js") {
|
if (substr($extension, -3) == ".js") {
|
||||||
echo "<script src='./extensions/$extension'></script>";
|
echo "<script src='./extensions/$extension'></script>";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
require './res/php/GoogleAnalytics.php'; // include google analytics
|
require './res/php/GoogleAnalytics.php'; // include google analytics
|
||||||
|
|
|
@ -8,4 +8,5 @@ $BLOGLANG = [
|
||||||
"Check out" => "Schau dir das an:",
|
"Check out" => "Schau dir das an:",
|
||||||
"Next Page" => "Nächste Seite",
|
"Next Page" => "Nächste Seite",
|
||||||
"Previous Page" => "Vorherige Seite",
|
"Previous Page" => "Vorherige Seite",
|
||||||
|
"Read More" => "Weiterlesen",
|
||||||
];
|
];
|
||||||
|
|
|
@ -8,4 +8,5 @@ $BLOGLANG = [
|
||||||
"Check out" => "Check out:",
|
"Check out" => "Check out:",
|
||||||
"Next Page" => "Next Page",
|
"Next Page" => "Next Page",
|
||||||
"Previous Page" => "Previous Page",
|
"Previous Page" => "Previous Page",
|
||||||
|
"Read More" => "Read More",
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rangitaki",
|
"name": "rangitaki",
|
||||||
"version": "1.4.4",
|
"version": "1.5.0",
|
||||||
"description": "A simple PHP blogging engine without any database dependencies",
|
"description": "A simple PHP blogging engine without any database dependencies",
|
||||||
"main": "index.php",
|
"main": "index.php",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
body{margin-top:94px}.main{height:100%;margin-left:0}.overlay{opacity:0;position:fixed;top:0;left:0;background-color:black;width:100%;z-index:30;height:100%;display:none}.header{top:0;right:0;left:0;width:100%;height:64px;position:absolute}.title{color:#fff;font-size:23px;text-decoration:none;line-height:64px;vertical-align:middle;left:75px}.title>a{text-decoration:none;color:#fff}.fadeout{position:absolute;height:64px;top:0;right:0;width:40px}.nav-img{height:26px;padding:19px;cursor:pointer}.nav{width:300px;position:fixed;height:100%;top:0;left:-301px;z-index:40}.nav-item,.nav-item-static{text-decoration:none;text-indent:0;display:inline-block;height:48px;vertical-align:middle;width:284px;line-height:48px;padding-left:16px;transition:background-color 125ms ease-in-out 0ms}.nav-close{cursor:pointer}.nav-close-img{height:35px;padding:12px}.nav-item{cursor:pointer}.divider{width:100%}.card{margin-right:auto;margin-left:auto;width:75%;padding:24px;margin-bottom:40px;max-width:1160px}.card a{-moz-hyphens:auto;-epub-hyphens:auto;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;word-wrap:break-word}.headline{display:block;padding-bottom:8px}.card img{max-width:100%;max-height:400px;display:block;margin-left:auto;margin-right:auto}.author{display:block}.fabmenu{position:fixed;bottom:20px;right:20px}.fab{height:60px;width:60px;border-radius:30px;cursor:pointer}.fab-img{width:28px;padding:15px}.subfab{height:45px;width:45px;border-radius:30px;margin-right:auto;margin-left:auto;margin-bottom:25px;display:none}.subfab-img{width:22px;padding:12px}.pag_buttons{margin-right:auto;margin-left:auto;width:calc(75% + 48px);margin-bottom:80px;max-width:1160px;text-align:right}.button{text-decoration:none;color:#fff;line-height:36px;min-width:64px;text-align:center;height:36px;padding:8px;margin-top:4px;margin-bottom:5px;cursor:pointer}.pag_next{margin-left:8px}.footer a{transition:border-bottom-color 150ms ease-in-out 100ms}.footer a:hover{border-bottom-color:#383838}@media screen and (min-width: 1440px){.nav{left:0;padding-top:64px}.nav-close-img{display:none}.nav-close{display:none}.nav-img{display:none}.header{left:300px}.main{margin-left:300px;width:calc(100% - 300px)}}@media screen and (max-width: 720px){.card{width:82%}.pag_buttons{width:calc(82% + 48px)}}
|
body{margin-top:94px}.main{height:100%;margin-left:0}.overlay{opacity:0;position:fixed;top:0;left:0;background-color:black;width:100%;z-index:30;height:100%;display:none}.header{top:0;right:0;left:0;width:100%;height:64px;position:absolute}.title{color:#fff;font-size:23px;text-decoration:none;line-height:64px;vertical-align:middle;left:75px}.title>a{text-decoration:none;color:#fff}.fadeout{position:absolute;height:64px;top:0;right:0;width:40px}.nav-img{height:26px;padding:19px;cursor:pointer}.nav{width:300px;position:fixed;height:100%;top:0;left:-301px;z-index:40}.nav-item,.nav-item-static{text-decoration:none;text-indent:0;display:inline-block;height:48px;vertical-align:middle;width:284px;line-height:48px;padding-left:16px;transition:background-color 125ms ease-in-out 0ms}.nav-close{cursor:pointer}.nav-close-img{height:35px;padding:12px}.nav-item{cursor:pointer}.divider{width:100%}.card{margin-right:auto;margin-left:auto;width:75%;padding:24px;margin-bottom:40px;max-width:1160px}.card a{-moz-hyphens:auto;-epub-hyphens:auto;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;word-wrap:break-word}.headline{display:block;padding-bottom:8px}.card img{max-width:100%;max-height:400px;display:block;margin-left:auto;margin-right:auto}.author{display:block}.readmore{padding:12px 0 25px 0}.fabmenu{position:fixed;bottom:20px;right:20px}.fab{height:60px;width:60px;border-radius:30px;cursor:pointer}.fab-img{width:28px;padding:15px}.subfab{height:45px;width:45px;border-radius:30px;margin-right:auto;margin-left:auto;margin-bottom:25px;display:none}.subfab-img{width:22px;padding:12px}.pag_buttons{margin-right:auto;margin-left:auto;width:calc(75% + 48px);margin-bottom:80px;max-width:1160px;text-align:right}.button{text-decoration:none;color:#fff;line-height:36px;min-width:64px;text-align:center;height:36px;padding:8px;margin-top:4px;margin-bottom:5px;cursor:pointer}.pag_next{margin-left:8px}.footer a{transition:border-bottom-color 150ms ease-in-out 100ms}.footer a:hover{border-bottom-color:#383838}@media screen and (min-width: 1440px){.nav{left:0;padding-top:64px}.nav-close-img{display:none}.nav-close{display:none}.nav-img{display:none}.header{left:300px}.main{margin-left:300px;width:calc(100% - 300px)}}@media screen and (max-width: 720px){.card{width:82%}.pag_buttons{width:calc(82% + 48px)}}
|
||||||
|
|
||||||
/*# sourceMappingURL=rangitaki.css.map */
|
/*# sourceMappingURL=rangitaki.css.map */
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -59,7 +59,7 @@ class ArticleGenerator
|
||||||
*
|
*
|
||||||
* @return Null
|
* @return Null
|
||||||
*/
|
*/
|
||||||
function newArticle($directory, $articlefile, $blog)
|
function newArticle($directory, $articlefile, $blog, $excerpt, $readmore)
|
||||||
{
|
{
|
||||||
|
|
||||||
$article = file_get_contents($directory . $articlefile); // get the file
|
$article = file_get_contents($directory . $articlefile); // get the file
|
||||||
|
@ -96,12 +96,39 @@ class ArticleGenerator
|
||||||
|
|
||||||
echo "<div class='articletext'>";
|
echo "<div class='articletext'>";
|
||||||
|
|
||||||
|
// print only a excerpt of the post
|
||||||
|
// with at least 200 characters if possible.
|
||||||
|
if ( $excerpt == 'on' ) {
|
||||||
|
$emptyline = strpos($article, "\n\n");
|
||||||
|
if ( $emptyline !== false ) {
|
||||||
|
if ( $emptyline < 200) {
|
||||||
|
$emptyline2 = strpos($article, "\n\n", $emptyline);
|
||||||
|
if ( $emptyline2 !== false ) {
|
||||||
|
$article = substr($article, 0, $emptyline2);
|
||||||
|
} else {
|
||||||
|
$article = substr($article, 0, $emptyline);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$article = substr($article, 0, $emptyline);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// correct $excerpt for use in line 127.
|
||||||
|
$excerpt = 'off';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo Parsedown::instance()
|
echo Parsedown::instance()
|
||||||
->setBreaksEnabled(true)
|
->setBreaksEnabled(true)
|
||||||
->text($article); // print now the article text as html
|
->text($article); // print now the article text as html
|
||||||
|
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
if ( $excerpt == 'on' ) {
|
||||||
|
echo "<div class='readmore'><a href='$link'>$readmore</a></div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($author)) {
|
if (isset($author)) {
|
||||||
echo "<span class='author'>$author</span>"; // print the author
|
echo "<span class='author'>$author</span>"; // print the author
|
||||||
}
|
}
|
||||||
|
@ -196,15 +223,15 @@ class ArticleGenerator
|
||||||
*/
|
*/
|
||||||
static function getSummary($directory, $articlefile)
|
static function getSummary($directory, $articlefile)
|
||||||
{
|
{
|
||||||
$text = getText($directory, $articlefile);
|
$text = ArticleGenerator::getText($directory, $articlefile);
|
||||||
|
|
||||||
$pos = stripos($text, ".");
|
$pos = stripos($text, "\n\n");
|
||||||
|
|
||||||
if ($pos) {
|
if ($pos !== false) {
|
||||||
$offset = $pos + 1;
|
$offset = $pos;
|
||||||
$pos = stripos($text, ".", $offset);
|
$pos = stripos($text, ".", $offset);
|
||||||
$summary = substr($text, 0, $pos) . ".";
|
$summary = substr($text, 0, $pos) . ".";
|
||||||
return $summary;
|
return trim($summary);
|
||||||
} else {
|
} else {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +302,10 @@ class ArticleGenerator
|
||||||
public function getArray($directory, $articlefile)
|
public function getArray($directory, $articlefile)
|
||||||
{
|
{
|
||||||
$article = file_get_contents($directory . $articlefile);
|
$article = file_get_contents($directory . $articlefile);
|
||||||
|
$title = "";
|
||||||
|
$date = "";
|
||||||
|
$author = "";
|
||||||
|
$tags = array();
|
||||||
|
|
||||||
if (substr($article, 0, 6) == "%TITLE") { // get and remove the title
|
if (substr($article, 0, 6) == "%TITLE") { // get and remove the title
|
||||||
$title = substr($article, 8, strpos($article, "\n") - 8);
|
$title = substr($article, 8, strpos($article, "\n") - 8);
|
||||||
|
|
|
@ -153,6 +153,9 @@ body
|
||||||
|
|
||||||
.tag
|
.tag
|
||||||
|
|
||||||
|
.readmore
|
||||||
|
padding: 12px 0 25px 0
|
||||||
|
|
||||||
/* FAB */
|
/* FAB */
|
||||||
|
|
||||||
.fabmenu
|
.fabmenu
|
||||||
|
|
91
tests/ArticleGeneratorTest.php
Normal file
91
tests/ArticleGeneratorTest.php
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'PHPUnit/Autoload.php';
|
||||||
|
include 'res/php/ArticleGenerator.php';
|
||||||
|
|
||||||
|
class ArticleGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetArray()
|
||||||
|
{
|
||||||
|
$result = [
|
||||||
|
"title" => "The Rangitaki logo 2",
|
||||||
|
"date" => "24 July 2015",
|
||||||
|
"tags" => array(
|
||||||
|
"design", "artwork", "logo",
|
||||||
|
),
|
||||||
|
"author" => "",
|
||||||
|
"text" => "
|
||||||
|
This is the official Rangitaki logo.
|
||||||
|
|
||||||
|
![The Rangitaki logo](media/example.png)
|
||||||
|
|
||||||
|
It is saved in the example blog directory.
|
||||||
|
",
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getArray("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetText()
|
||||||
|
{
|
||||||
|
$result = "
|
||||||
|
This is the official Rangitaki logo.
|
||||||
|
|
||||||
|
![The Rangitaki logo](media/example.png)
|
||||||
|
|
||||||
|
It is saved in the example blog directory.
|
||||||
|
";
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getText("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAuthor()
|
||||||
|
{
|
||||||
|
$result = "";
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getAuthor("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetSummary()
|
||||||
|
{
|
||||||
|
$result = "This is the official Rangitaki logo.";
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getSummary("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetTags()
|
||||||
|
{
|
||||||
|
$result = [ "design", "artwork", "logo" ];
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getTags("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetDate()
|
||||||
|
{
|
||||||
|
$result = "24 July 2015";
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getDate("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetTitle()
|
||||||
|
{
|
||||||
|
$result = "The Rangitaki logo 2";
|
||||||
|
$this->assertEquals(
|
||||||
|
$result,
|
||||||
|
ArticleGenerator::getTitle("articles/example/", "2015-07-25-example.md")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
17
tests/BlogListGeneratorTest.php
Normal file
17
tests/BlogListGeneratorTest.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'PHPUnit/Autoload.php';
|
||||||
|
include 'res/php/BlogListGenerator.php';
|
||||||
|
|
||||||
|
class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetName()
|
||||||
|
{
|
||||||
|
$this->assertEquals("Example", BlogListGenerator::getName("blogs/example.md"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetArticleAmount()
|
||||||
|
{
|
||||||
|
$this->assertEquals(5, BlogListGenerator::getArticleAmount("example"));
|
||||||
|
}
|
||||||
|
}
|
83
tests/ConfigTest.php
Normal file
83
tests/ConfigTest.php
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mmk2410\rbe\tests\config;
|
||||||
|
|
||||||
|
require_once 'PHPUnit/Autoload.php';
|
||||||
|
require 'res/php/Config.php';
|
||||||
|
|
||||||
|
use \mmk2410\rbe\config\Config as Config;
|
||||||
|
|
||||||
|
class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function testGetConfig()
|
||||||
|
{
|
||||||
|
$config = [
|
||||||
|
"blog" => array(
|
||||||
|
"title" => "Example Blog",
|
||||||
|
"author" => "John",
|
||||||
|
"description" => "A short description of your blog",
|
||||||
|
"home" => "on",
|
||||||
|
"homeurl" => "../",
|
||||||
|
"homename" => "Home",
|
||||||
|
"mainname" => "",
|
||||||
|
"intro" => "on",
|
||||||
|
"disqus" => "rangitaki",
|
||||||
|
"analytics" => "",
|
||||||
|
"footer" =>
|
||||||
|
"Rangitaki 2016 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">\n gitlab.com/mmk2410/rangitaki</a>", "url" => "https://example.com/blog/",
|
||||||
|
),
|
||||||
|
"design" => array(
|
||||||
|
"fab" => "on",
|
||||||
|
"drawer" => "on",
|
||||||
|
"theme" => "material-light",
|
||||||
|
"pagination" => 0,
|
||||||
|
"favicon" => "http://example.com/res/img/favicon.png",
|
||||||
|
),
|
||||||
|
"rcc" => array(
|
||||||
|
"rcc" => "on",
|
||||||
|
"api" => "on",
|
||||||
|
),
|
||||||
|
"language" => "en",
|
||||||
|
];
|
||||||
|
|
||||||
|
$configParser = new Config("./config.yaml", "./vendor/autoload.php");
|
||||||
|
$this->assertEquals($config, $configParser->getConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testWriteReadConfig()
|
||||||
|
{
|
||||||
|
$changedConfig = [
|
||||||
|
"blog" => array(
|
||||||
|
"title" => "Examples Blog",
|
||||||
|
"author" => "Wilson O'Sullivan",
|
||||||
|
"description" => "A long description of your blog",
|
||||||
|
"home" => "on",
|
||||||
|
"homeurl" => "../",
|
||||||
|
"homename" => "Exit",
|
||||||
|
"mainname" => "",
|
||||||
|
"intro" => "on",
|
||||||
|
"disqus" => "",
|
||||||
|
"analytics" => "",
|
||||||
|
"footer" =>
|
||||||
|
"pBlog 1102 <a href=\"https://gitlab.com/mmk2410/rangitaki\" target=\"blank\">
|
||||||
|
\n gitlab.com/mmk2410/rangitaki</a>", "url" => "https://example.com/blog/",
|
||||||
|
),
|
||||||
|
"design" => array(
|
||||||
|
"fab" => "off",
|
||||||
|
"drawer" => "off",
|
||||||
|
"theme" => "material-dark",
|
||||||
|
"pagination" => "-1",
|
||||||
|
"favicon" => "http://sample.com/res/img/favicon.png",
|
||||||
|
),
|
||||||
|
"rcc" => array(
|
||||||
|
"rcc" => "on",
|
||||||
|
"api" => "off",
|
||||||
|
),
|
||||||
|
"language" => "en",
|
||||||
|
];
|
||||||
|
$configParser = new Config("/tmp/config-test.yaml", "./vendor/autoload.php");
|
||||||
|
$configParser->writeConfig($changedConfig);
|
||||||
|
$this->assertEquals($changedConfig, $configParser->getConfig());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,207 +1,3 @@
|
||||||
body {
|
body{font-family:"Fira Sans",sans-serif;background:#f0f0f0;color:#383838;margin:130px 0 0}::selection,::-moz-selection{color:#f0f0f0;background-color:#4CAF50}.header{height:55px;background-color:#4CAF50;position:fixed;box-shadow:2px 0 2px 2px rgba(62,62,62,0.45)}.title{line-height:55px;color:#fff;position:absolute;left:0;margin-left:calc(20% + 24px)}.title>a{color:#fff;text-decoration:none}.fadeout{height:55px;background:-moz-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-webkit-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-o-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:-ms-linear-gradient(left, rgba(30,87,153,0) 0%, #4CAF50 100%);background:linear-gradient(to right, rgba(30,87,153,0) 0%, #4CAF50 100%)}.nav-img{padding:14px 19px}.nav{background-color:#fff;border-right:1px solid #e0e0e0}.nav-item,.nav-item-static{color:#383838}.nav-item{font-weight:600}.nav-item:hover{color:#4CAF50}.nav-item:active{background-color:#e2e2e2}.divider{border-bottom:1px solid #e0e0e0}.card{background:none;border-radius:0;box-shadow:none;margin:0 20% 100px;width:auto}.card a{color:#4CAF50;text-decoration:none;border-bottom:1px solid transparent;transition:border-bottom-color 150ms ease-in-out 100ms}.card a:hover{border-bottom-color:#4CAF50}.headline{font-size:30px;line-height:50px;color:#383838 !important;text-decoration:none;border-bottom:none !important}.headline:hover{color:#4CAF50 !important}.date{font-size:13px}.articletext{margin-top:30px;font-size:16px;line-height:30px}.author,.tag{font-size:13px}.fab{background-color:#4CAF50;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.subfab{background-color:#fff;box-shadow:0 1px 1.5px 1.5px rgba(62,62,62,0.3)}.button{color:#4CAF50;border-bottom:1px solid transparent;margin:0;min-width:0;padding:0;line-height:16px;height:16px;transition-property:border-bottom-color;transition-delay:50ms;transition-duration:125ms;transition-timing-function:ease;-moz-transition-property:border-bottom-color;-moz-transition-delay:50ms;-moz-transition-duration:125ms;-moz-transition-timing-function:ease;-webkit-transition-property:border-bottom-color;-webkit-transition-delay:50ms;-webkit-transition-duration:125ms;-webkit-transition-timing-function:ease}.button:hover{border-bottom-color:#4CAF50}.pag_prev{float:left}.button:last-child{float:none}.footer{text-align:center;height:60px;background-color:#2D2D2D;line-height:60px;width:100%;color:#fff}.footer a{color:#fff;text-decoration:none;border-bottom:1px solid transparent}.footer a:hover{border-bottom-color:#fff}.hljs{background:none}@media screen and (min-width: 1440px){.title{margin-left:calc(20% - 40px)}.nav{padding-top:55px}}@media screen and (max-width: 800px){body{margin-top:80px}.title{margin-left:20%}.card{margin:0 5% 100px}}
|
||||||
font-family: "Fira Sans", sans-serif;
|
|
||||||
background: #f0f0f0;
|
|
||||||
color: #383838;
|
|
||||||
margin: 130px 0 0
|
|
||||||
}
|
|
||||||
|
|
||||||
::selection, ::-moz-selection {
|
|
||||||
color: #f0f0f0;
|
|
||||||
background-color: #4CAF50
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
height: 55px;
|
|
||||||
background-color: #4CAF50;
|
|
||||||
position: fixed;
|
|
||||||
box-shadow: 2px 0 2px 2px rgba(62, 62, 62, 0.45)
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
line-height: 55px;
|
|
||||||
color: #fff;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
margin-left: calc(20% + 24px)
|
|
||||||
}
|
|
||||||
|
|
||||||
.title > a {
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none
|
|
||||||
}
|
|
||||||
|
|
||||||
.fadeout {
|
|
||||||
height: 55px;
|
|
||||||
background: -moz-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #4CAF50 100%);
|
|
||||||
background: -webkit-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #4CAF50 100%);
|
|
||||||
background: -o-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #4CAF50 100%);
|
|
||||||
background: -ms-linear-gradient(left, rgba(30, 87, 153, 0) 0%, #4CAF50 100%);
|
|
||||||
background: linear-gradient(to right, rgba(30, 87, 153, 0) 0%, #4CAF50 100%)
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-img {
|
|
||||||
padding: 14px 19px
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav {
|
|
||||||
background-color: #fff;
|
|
||||||
border-right: 1px solid #e0e0e0
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item, .nav-item-static {
|
|
||||||
color: #383838
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item {
|
|
||||||
font-weight: 600
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item:hover {
|
|
||||||
color: #4CAF50
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-item:active {
|
|
||||||
background-color: #e2e2e2
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
|
||||||
border-bottom: 1px solid #e0e0e0
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
background: none;
|
|
||||||
border-radius: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
margin: 0 20% 100px;
|
|
||||||
width: auto
|
|
||||||
}
|
|
||||||
|
|
||||||
.card a {
|
|
||||||
color: #4CAF50;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid transparent;
|
|
||||||
transition: border-bottom-color 150ms ease-in-out 100ms
|
|
||||||
}
|
|
||||||
|
|
||||||
.card a:hover {
|
|
||||||
border-bottom-color: #4CAF50
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline {
|
|
||||||
font-size: 30px;
|
|
||||||
line-height: 50px;
|
|
||||||
color: #383838 !important;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: none !important
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline:hover {
|
|
||||||
color: #4CAF50 !important
|
|
||||||
}
|
|
||||||
|
|
||||||
.date {
|
|
||||||
font-size: 13px
|
|
||||||
}
|
|
||||||
|
|
||||||
.articletext {
|
|
||||||
margin-top: 30px;
|
|
||||||
font-size: 16px;
|
|
||||||
line-height: 30px
|
|
||||||
}
|
|
||||||
|
|
||||||
.author, .tag {
|
|
||||||
font-size: 13px
|
|
||||||
}
|
|
||||||
|
|
||||||
.fab {
|
|
||||||
background-color: #4CAF50;
|
|
||||||
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
|
|
||||||
}
|
|
||||||
|
|
||||||
.subfab {
|
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 0 1px 1.5px 1.5px rgba(62, 62, 62, 0.3)
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
color: #4CAF50;
|
|
||||||
border-bottom: 1px solid transparent;
|
|
||||||
margin: 0;
|
|
||||||
min-width: 0;
|
|
||||||
padding: 0;
|
|
||||||
line-height: 16px;
|
|
||||||
height: 16px;
|
|
||||||
transition-property: border-bottom-color;
|
|
||||||
transition-delay: 50ms;
|
|
||||||
transition-duration: 125ms;
|
|
||||||
transition-timing-function: ease;
|
|
||||||
-moz-transition-property: border-bottom-color;
|
|
||||||
-moz-transition-delay: 50ms;
|
|
||||||
-moz-transition-duration: 125ms;
|
|
||||||
-moz-transition-timing-function: ease;
|
|
||||||
-webkit-transition-property: border-bottom-color;
|
|
||||||
-webkit-transition-delay: 50ms;
|
|
||||||
-webkit-transition-duration: 125ms;
|
|
||||||
-webkit-transition-timing-function: ease
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
border-bottom-color: #4CAF50
|
|
||||||
}
|
|
||||||
|
|
||||||
.pag_prev {
|
|
||||||
float: left
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:last-child {
|
|
||||||
float: none
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
text-align: center;
|
|
||||||
height: 60px;
|
|
||||||
background-color: #2D2D2D;
|
|
||||||
line-height: 60px;
|
|
||||||
width: 100%;
|
|
||||||
color: #fff
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a {
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid transparent
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a:hover {
|
|
||||||
border-bottom-color: #fff
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs {
|
|
||||||
background: none
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 1440px) {
|
|
||||||
.title {
|
|
||||||
margin-left: calc(20% - 40px)
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav {
|
|
||||||
padding-top: 55px
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
body {
|
|
||||||
margin-top: 80px
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin-left: 20%
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
margin: 0 5% 100px
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*# sourceMappingURL=nextDESIGN.css.map */
|
/*# sourceMappingURL=nextDESIGN.css.map */
|
||||||
|
|
File diff suppressed because one or more lines are too long
84
update-scripts/1-4-4_1-5-0.sh
Executable file
84
update-scripts/1-4-4_1-5-0.sh
Executable file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Update script for Rangitaki from version 1.4.4 to 1.5.0
|
||||||
|
|
||||||
|
version="1.5.0"
|
||||||
|
new="./rbe-new"
|
||||||
|
|
||||||
|
echo -n "Downloading version $version from GitLab... "
|
||||||
|
git clone -q https://gitlab.com/mmk2410/rangitaki.git "$new"
|
||||||
|
|
||||||
|
if [[ $1 == "--debug" ]]; then
|
||||||
|
cd $new
|
||||||
|
git checkout -q master
|
||||||
|
cd ../
|
||||||
|
fi
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating ressources... "
|
||||||
|
rm -rf ./res/
|
||||||
|
mv $new/res/ ./
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating languages... "
|
||||||
|
rm -rf ./lang/de.php
|
||||||
|
rm -rf ./lang/en.php
|
||||||
|
mv $new/lang/* ./lang/
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating source files... "
|
||||||
|
rm ./src/sass/rangitaki.sass
|
||||||
|
mv $new/src/sass/rangitaki.sass ./src/sass/
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating core... "
|
||||||
|
rm ./index.php
|
||||||
|
mv $new/index.php ./
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating binaries... "
|
||||||
|
rm -rf ./bin
|
||||||
|
mv $new/bin/ ./
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating themes... "
|
||||||
|
rm ./themes/material-light.css*
|
||||||
|
rm ./themes/material-dark.css*
|
||||||
|
rm ./themes/background-img.css*
|
||||||
|
rm ./themes/nextDESIGN.css*
|
||||||
|
mv $new/themes/* ./themes/
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating npm... "
|
||||||
|
mv $new/package.json ./
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n 'Updating config script... '
|
||||||
|
echo "social:" >> ./config.yaml
|
||||||
|
echo " twitter: ''" >> ./config.yaml
|
||||||
|
sed -i "s/design:/design:\n excerpt: 'off'/" config.yaml
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Updating Changelog... "
|
||||||
|
|
||||||
|
if [ -f ./CHANGELOG.txt ]; then
|
||||||
|
rm CHANGELOG.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv $new/CHANGELOG.md ./
|
||||||
|
echo "done"
|
||||||
|
|
||||||
|
echo -n "Cleaning up... "
|
||||||
|
if [[ $1 != "--debug" ]]; then
|
||||||
|
echo -n "Cleaning up... "
|
||||||
|
rm -rf $new
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "./update-scripts" ]; then
|
||||||
|
echo -n "Remove obsolete update scripts folder... "
|
||||||
|
rm -rf "./update-scripts"
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Your Rangitaki installation is updated to version $version"
|
||||||
|
echo "Run php ./bin/init.php to use set the values for the new features."
|
Reference in a new issue