Commit eb4e51c6 authored by nirgendswo's avatar nirgendswo

adding comments

parent e8b765ab
......@@ -10,6 +10,8 @@ use Exception;
* Copy all Assets from the Active Theme to the Public-Directory
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class ThemeInstall extends Command
{
......
......@@ -10,6 +10,8 @@ use Exception;
* delete all cached Files in uploads
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class UploadsClear extends Command
{
......
......@@ -5,6 +5,11 @@ namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
/**
* Kernel
*
*
*/
class Kernel extends ConsoleKernel
{
/**
......
......@@ -9,6 +9,12 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Handler for Exceptions
*
*
*
*/
class Handler extends ExceptionHandler
{
/**
......
......@@ -3,13 +3,13 @@
namespace App\Http\Actions;
/**
* Interface to handle post-action
* Interface to handle methods in Themes
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
interface PostActionInterface
interface MethodInterface
{
public function process();
}
......@@ -6,14 +6,14 @@ use Illuminate\Http\Request;
use App\Models\PageModel as Page;
/**
* Abstract to create controller to handle post-action
* Abstract to create controller to handle post-method
*
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
abstract class PostActionAbstract implements PostActionInterface
abstract class PostMethodAbstract implements MethodInterface
{
/**
* array with results for the action
......
......@@ -9,6 +9,8 @@ use App\PageService;
* middleware for PageService
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class PageMiddleware
{
......
......@@ -9,24 +9,43 @@ use App\Helpers\MarkdownHelper;
*
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class PageModel
{
/** default view */
/**
* default view
* @var string
*/
const VIEW = 'page';
/* slug */
/**
* slug in url of this page
* @var string
*/
public $slug;
/* markdown */
/**
* markdown from page
* @var string
*/
public $markdown;
/* children */
/**
* children of a page
* @var array
*/
public $children = [];
/* meta */
/**
* data of a page
* @var array
*/
public $data = [
'view' => 'page',
'view' => self::VIEW,
'meta' => []
];
......@@ -54,15 +73,9 @@ class PageModel
// getting current theme
$theme = env('APP_THEME');
// check if view is set, if not use default
if (isset($this->data['view'])) {
$view = $this->data['view'];
} else {
$view = self::VIEW;
}
// create path to view
$view = $theme.'.views.'.$view;
// @TODO check if view exists comes here
$view = $theme.'.views.'.$this->data['view'];
return $view;
}
......
......@@ -10,10 +10,15 @@ use App\Models\PageModel;
* Parser for Page
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class PageParser
{
// pattern to find json
/**
* regex to seperate json and markdown
* @var string
*/
CONST REGEX = '/\{(?:[^{}]|(?R))*\}/';
/**
......@@ -29,14 +34,16 @@ class PageParser
preg_match(self::REGEX, $file, $data);
$markdown = preg_replace(self::REGEX, '', $file, 1);
// data has to be set
if (!isset($data[0])) {
throw new Exception('PageParser - JSON in md-file is NULL '.$slug);
throw new Exception('PageParser - JSON in md-file is NULL '.$slug.' from File '.$file);
}
$data = json_decode($data[0], true);
// if data is not a valid json
if (empty($data)) {
throw new Exception('PageParser - JSON is not valid '.$slug);
throw new Exception('PageParser - JSON is not valid '.$slug.' from File'.$file);
}
$page = new PageModel($slug, $data, $markdown);
......
......@@ -8,13 +8,15 @@ use Illuminate\Support\ServiceProvider;
* Register Services
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*
*/
public function register()
{
......
......@@ -15,25 +15,60 @@ use App\Models\PageModel as Page;
*
* Find Pages with Slugs or Search them by there Meta-Data
*
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository
*/
class PageRepository
{
/** ordering */
/**
* ordering asc
* @var string
*/
const ORDER_BY_ASC = 'asc';
/**
* ordering desc
* @var string
*/
const ORDER_BY_DESC = 'desc';
/**
* filename for index
* @var string
*/
const NAME_INDEX = 'index';
/**
* file-extension for markdown
* @var string
*/
const FILE_EXTENSION = '.md';
/**
* file index with extension
* @var string
*/
const FILE_INDEX = self::NAME_INDEX.self::FILE_EXTENSION;
/** exceptions */
/**
* exception message for file not found
* @var string
*/
const EXCEPTION_FILE_NOT_FOUND = 'PageRepository - File not found';
/** regex to get current filepath */
/**
* regex
* @var string
*/
const REGEX_FILEPATH = '/\..*+$/';
/** request */
/**
*
* @var [type]
*/
protected $request;
/** directory for md-files */
......
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