Commit 40e55f89 authored by nirgendswo's avatar nirgendswo

adding const

parent 12b19079
APP_DEBUG=true
APP_THEME=simple
APP_DATA_PATH=resources/data
APP_MEDIA_PATH=resources/media
APP_LOCALE=en
......@@ -21,6 +21,8 @@ class PageRepository
/** ordering */
const ORDER_BY_ASC = 'asc';
const ORDER_BY_DESC = 'desc';
const FILE_INDEX = 'index.md';
const FILE_EXTENSION = '.md';
/** exceptions */
const EXCEPTION_FILE_NOT_FOUND = 'PageRepository - File not found';
......@@ -29,15 +31,15 @@ class PageRepository
const REGEX_FILEPATH = '/\..*+$/';
/** directory for md-files */
private $repositoryPath;
protected $repositoryPath;
/** default paramters */
private $parameters = [
protected $parameters = [
'parent' => ''
];
/** default options */
private $options = [
protected $options = [
'offset' => 0,
'limit' => 10
];
......@@ -48,8 +50,7 @@ class PageRepository
*/
public function __construct()
{
// @TODO repositoryPath also set outside the app
$this->repositoryPath = base_path().'/'.env('APP_DATA_PATH');
$this->repositoryPath = base_path().'/'.config('app.repositoryPath');
}
/**
......@@ -118,7 +119,7 @@ class PageRepository
*/
protected function parseSlug($filePathname, $repositoryPath)
{
$slug = str_replace('.md', '', $filePathname);
$slug = str_replace(self::FILE_EXTENSION, '', $filePathname);
$slug = str_replace($repositoryPath, '', $slug);
return $slug;
......@@ -297,7 +298,7 @@ class PageRepository
$file = NULL;
// path of file, first try with slug
$filePath = $repositoryPath.'/'.$slug.'.md';
$filePath = $repositoryPath.'/'.$slug.self::FILE_EXTENSION;
if (file_exists($filePath)) {
$file = file_get_contents($filePath);
......@@ -306,7 +307,7 @@ class PageRepository
$slug = '/'.$slug;
}
$filePath = $repositoryPath.$slug.'/index.md';
$filePath = $repositoryPath.$slug.'/'.self::FILE_INDEX;
if (file_exists($filePath)) {
$file = file_get_contents($filePath);
......
......@@ -96,4 +96,9 @@ $app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
require __DIR__.'/../routes/web.php';
});
/*
| Call configure
*/
$app->configure('app');
return $app;
......@@ -3,5 +3,5 @@
return [
'mediaPath' => 'resources/media',
'mediaPublicPath' => 'media',
'repositoryPath' => 'resources/data',
'repositoryPath' => 'resources/data'
];
......@@ -2,7 +2,7 @@
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Didactic Chainsaw | {{ $page->data['title'] }}</title>
<title>Fuzzy Blog | {{ $page->data['title'] }}</title>
@include('meta', ['page' => $page])
......@@ -11,7 +11,7 @@
<body>
<header class="site-header">
<div class="site-header__title">
Didactic Chainsaw
Fuzzy Blog
</div>
<nav>
<div class="navigation">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment