Commit d12b4bba authored by nirgendswo's avatar nirgendswo

change naming

bugfix 404
parent 93fa1704
## Table of contents
- [\App\Console\Kernel](#class-appconsolekernel)
- [\App\Console\Commands\InstallAssets](#class-appconsolecommandsinstallassets)
- [\App\Console\Commands\AssetsInstall](#class-appconsolecommandsassetsinstall)
- [\App\Console\Commands\MediaClear](#class-appconsolecommandsmediaclear)
- [\App\Exceptions\Handler](#class-appexceptionshandler)
- [\App\Facades\ViewHelperFacade](#class-appfacadesviewhelperfacade)
- [\App\Facades\PageRepositoryFacade](#class-appfacadespagerepositoryfacade)
......@@ -10,6 +11,8 @@
- [\App\Helpers\MarkdownHelper](#class-apphelpersmarkdownhelper)
- [\App\Helpers\ViewHelper](#class-apphelpersviewhelper)
- [\App\Helpers\ImageHelper](#class-apphelpersimagehelper)
- [\App\Http\Actions\PostActionAbstract (abstract)](#class-apphttpactionspostactionabstract-abstract)
- [\App\Http\Actions\PostActionInterface (interface)](#interface-apphttpactionspostactioninterface)
- [\App\Http\Controllers\PageController](#class-apphttpcontrollerspagecontroller)
- [\App\Http\Controllers\RssController](#class-apphttpcontrollersrsscontroller)
- [\App\Http\Middleware\Parameters](#class-apphttpmiddlewareparameters)
......@@ -33,7 +36,20 @@
<hr />
### Class: \App\Console\Commands\InstallAssets
### Class: \App\Console\Commands\AssetsInstall
> Copy all Assets from the Active Theme to the Public-Directory
| Visibility | Function |
|:-----------|:---------|
| public | <strong>__construct()</strong> : <em>void</em><br /><em>Create a new command instance.</em> |
| public | <strong>handle()</strong> : <em>mixed</em><br /><em>Execute the console command.</em> |
*This class extends \Illuminate\Console\Command*
<hr />
### Class: \App\Console\Commands\MediaClear
> Copy all Assets from the Active Theme to the Public-Directory
......@@ -113,6 +129,7 @@
| Visibility | Function |
|:-----------|:---------|
| protected | <strong>inlineImage(</strong><em>array</em> <strong>$excerpt</strong>)</strong> : <em>array</em><br /><em>extend default funcion, if a link is locale, use ImageHelper to generate images</em> |
| protected | <strong>inlineLink(</strong><em>array</em> <strong>$excerpt</strong>)</strong> : <em>array</em><br /><em>extend default function, if a link has http|https in url, then handle this link as external and set target to _blank</em> |
*This class extends \Parsedown*
......@@ -125,6 +142,11 @@
| Visibility | Function |
|:-----------|:---------|
| public | <strong>checkbox(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning checked="checked" as string</em> |
| public | <strong>current(</strong><em>\App\Helpers\PageModel</em> <strong>$page</strong>, <em>string</em> <strong>$class=`'current'`</strong>)</strong> : <em>string</em><br /><em>check if this current route, if so return css class</em> |
| public | <strong>route(</strong><em>\App\Helpers\PageModel</em> <strong>$page</strong>)</strong> : <em>string</em><br /><em>create route, if slug is empty use page.index route</em> |
| public | <strong>selected(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning selected="selected" as string</em> |
| public | <strong>text(</strong><em>string</em> <strong>$key</strong>, <em>array</em> <strong>$data</strong>)</strong> : <em>mixed</em><br /><em>check if $data has a index, and returning him</em> |
| public | <strong>timeElapsed(</strong><em>\App\Helpers\datetime</em> <strong>$dateTime</strong>)</strong> : <em>string</em><br /><em>time elapsed from a datetime object</em> |
| public | <strong>truncated(</strong><em>mixed</em> <strong>$html</strong>, <em>integer</em> <strong>$length=150</strong>)</strong> : <em>string</em><br /><em>truncated html</em> |
......@@ -136,17 +158,41 @@
| Visibility | Function |
|:-----------|:---------|
| public | <strong>passThrough(</strong><em>string</em> <strong>$relativePath</strong>)</strong> : <em>string</em><br /><em>pass through</em> |
| public | <strong>resize(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$width</strong>, <em>string</em> <strong>$height</strong>)</strong> : <em>string</em><br /><em>resize image with width and height</em> |
| public | <strong>resizeToHeight(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$height</strong>)</strong> : <em>string</em><br /><em>resize image height</em> |
| public | <strong>resizeToWidth(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$width</strong>)</strong> : <em>string</em><br /><em>resize image width</em> |
| public | <strong>scale(</strong><em>string</em> <strong>$relativePath</strong>, <em>string</em> <strong>$percentage</strong>)</strong> : <em>string</em><br /><em>scale image with percentage</em> |
| protected | <strong>getFilePathname(</strong><em>string</em> <strong>$filePathname</strong>, <em>string</em> <strong>$suffix</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>getFilePathname(</strong><em>string</em> <strong>$filePathname</strong>, <em>string</em> <strong>$suffix=`''`</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>getPublicFilePathname(</strong><em>string</em> <strong>$filePathname</strong>)</strong> : <em>string</em><br /><em>adding suffix to filename</em> |
| protected | <strong>has(</strong><em>mixed</em> <strong>$destinationPath</strong>, <em>mixed</em> <strong>$sourcePath</strong>)</strong> : <em>mixed</em><br /><em>if file not found create ImageResize</em> |
| protected | <strong>save(</strong><em>\App\Helpers\ImageResize</em> <strong>$image</strong>, <em>string</em> <strong>$filePathname</strong>)</strong> : <em>string</em><br /><em>save image to public</em> |
<hr />
### Class: \App\Http\Actions\PostActionAbstract (abstract)
> Abstract to create controller to handle post-action
| Visibility | Function |
|:-----------|:---------|
| public | <strong>__construct(</strong><em>\App\Http\Actions\Page/[\App\Models\PageModel](#class-appmodelspagemodel)</em> <strong>$page</strong>, <em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>void</em> |
| public | <strong>getResult()</strong> : <em>mixed</em> |
*This class implements [\App\Http\Actions\PostActionInterface](#interface-apphttpactionspostactioninterface)*
<hr />
### Interface: \App\Http\Actions\PostActionInterface
> Interface to handle post-action
| Visibility | Function |
|:-----------|:---------|
| public | <strong>process()</strong> : <em>void</em> |
<hr />
### Class: \App\Http\Controllers\PageController
> Handle Pages
......@@ -155,8 +201,11 @@
|:-----------|:---------|
| public | <strong>__construct()</strong> : <em>void</em><br /><em>Create a new controller instance.</em> |
| public | <strong>jsonAction()</strong> : <em>\App\Http\Controllers\View</em><br /><em>show single page as json</em> |
| public | <strong>postAction(</strong><em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>\App\Http\Controllers\View</em><br /><em>post single page with slug check for controller in current theme and call</em> |
| public | <strong>putAction(</strong><em>\Illuminate\Http\Request</em> <strong>$request</strong>)</strong> : <em>\App\Http\Controllers\View</em><br /><em>put single page with slug check for controller in current theme and call</em> |
| public | <strong>showAction()</strong> : <em>\App\Http\Controllers\View</em><br /><em>show single page with slug</em> |
| protected | <strong>getPage()</strong> : <em>\App\Http\Controllers\PageModel</em><br /><em>search by slug a page, if not found, redirect to page.404</em> |
| protected | <strong>processAction(</strong><em>Mixed</em> <strong>$action</strong>, <em>\App\Http\Controllers\PageModel</em> <strong>$page</strong>, <em>\App\Http\Controllers\Request</em> <strong>$request</strong>)</strong> : <em>Mixed</em> |
*This class extends \Laravel\Lumen\Routing\Controller*
......@@ -247,4 +296,3 @@
| public | <strong>getPage()</strong> : <em>integer</em><br /><em>get current page</em> |
| public | <strong>getSlug()</strong> : <em>string</em><br /><em>getting current slug</em> |
| public | <strong>getTags()</strong> : <em>array</em><br /><em>getting current tags</em> |
......@@ -11,21 +11,21 @@ use Exception;
*
* @author Björn Hase
*/
class MediaClear extends Command
class FilesClear extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'media:clear';
protected $signature = 'files:clear';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete all cached Media';
protected $description = 'Delete all cached Files';
/**
* Create a new command instance.
......@@ -44,11 +44,11 @@ class MediaClear extends Command
*/
public function handle()
{
$mediaDir = base_path().'/resources/media';
$mediaDir = base_path().'/resources/files';
$success = File::cleanDirectory($directory);
if ($success) {
$this->info('all cached Media has been deleted');
$this->info('all cached Files has been deleted');
}
}
}
......@@ -13,7 +13,8 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
Commands\InstallAssets::class,
Commands\AssetsInstall::class,
Commands\FilesClear::class
];
/**
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Laravel\Lumen\Routing\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Facades\PageRepositoryFacade as PageRepository;
use App\PageService;
......@@ -49,14 +50,6 @@ class PageController extends Controller
// get current page with slug
$page = PageRepository::findOne($slug);
// if page not found redirect to 404
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
return $page;
}
......@@ -70,11 +63,24 @@ class PageController extends Controller
public function postAction(Request $request)
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
$view = $this->getView($page);
$action = $this->getAction($page, self::METHOD_POST);
$action = $this->processAction($action, $page, $request);
if (!$action) {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return app()->make('view')->make($view, [
'page' => $page,
'request' => $request,
......@@ -92,11 +98,24 @@ class PageController extends Controller
public function putAction(Request $request)
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
$view = $this->getView($page);
$action = $this->getAction($page, self::METHOD_PUT);
$action = $this->processAction($action, $page, $request);
if (!$action) {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return app()->make('view')->make($view, [
'page' => $page,
'request' => $request,
......@@ -116,10 +135,6 @@ class PageController extends Controller
if ($action) {
$action = new $action($page, $request);
$action->process();
} else {
return redirect()->route('page.show', [
'slug' => $page->slug
]);
}
return $action;
......@@ -135,6 +150,12 @@ class PageController extends Controller
{
$page = $this->getPage();
if (!$page) {
return redirect()->route('page.show', [
'slug' => '404'
]);
}
return app()->make('view')->make($this->getView($page), [
'page' => $page,
'result' => []
......@@ -188,7 +209,6 @@ class PageController extends Controller
$theme = env('APP_THEME');
$className = ucfirst(camel_case(str_replace('/', '', $page->slug)));
$classPath = '\\Themes\\'.$theme.'\\Actions\\'.$className.$method.'Action';
if (class_exists($classPath)) {
......
......@@ -39,6 +39,9 @@
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"generate-documentation": [
"./vendor/bin/phpdoc-md generate app > DOCUMENTATION.md"
]
},
"minimum-stability": "dev",
......
This diff is collapsed.
......@@ -11,14 +11,16 @@
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
......
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageParserTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageRepositoryTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
<?php
use Laravel\Lumen\Testing\DatabaseMigrations;
use Laravel\Lumen\Testing\DatabaseTransactions;
class PageServiceTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->get('/');
$this->assertEquals(
$this->app->version(), $this->response->getContent()
);
}
}
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