Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
Apply php cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
deathart committed May 14, 2018
1 parent 987edbe commit 8b9ac9d
Show file tree
Hide file tree
Showing 95 changed files with 1,086 additions and 380 deletions.
7 changes: 4 additions & 3 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ BlogCI4 - Blog write with Codeigniter v4dev
@copyright Copyright (c) 2018 Deathart
@license https://opensource.org/licenses/MIT MIT License
EOF;

$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
Expand Down Expand Up @@ -45,10 +46,10 @@ $config = PhpCsFixer\Config::create()
])
->setFinder(
PhpCsFixer\Finder::create()
->notPath('Config')
->in(__DIR__ . '/application')
)
;
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
);

try {
PhpCsFixer\FixerFactory::create()
->registerBuiltInFixers()
Expand Down
12 changes: 10 additions & 2 deletions application/Controllers/Admin/Ajax/Ajax.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Libraries\CSRFToken;
use App\Libraries\General;
Expand All @@ -14,7 +23,6 @@
*/
class Ajax extends Controller
{

/**
* @var \Config\App
*/
Expand Down
20 changes: 16 additions & 4 deletions application/Controllers/Admin/Ajax/Article.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Models\Admin\ArticleModel;
use CodeIgniter\HTTP\Response;
Expand Down Expand Up @@ -48,11 +57,14 @@ public function edit():Response
$this->article_model->Edit($_POST['postid'], $_POST['title'], $_POST['link'], $_POST['content'], $_POST['wordkey'], $_POST['cat'], $_POST['pic'], $_POST['important'], $_POST['type']);
if ($_POST['type'] === 0) {
return $this->Responded(['code' => 1, 'title' => "Edition d'article", 'message' => 'Article modifié']);
} elseif ($_POST['type'] === 1) {
}
if ($_POST['type'] === 1) {
return $this->Responded(['code' => 1, 'title' => "Edition d'article", 'message' => 'Article corrigé, il est maintenant publié']);
} elseif ($_POST['type'] === 2) {
}
if ($_POST['type'] === 2) {
return $this->Responded(['code' => 1, 'title' => "Edition d'article", 'message' => 'Article corrigé, il est en attente de correction']);
} elseif ($_POST['type'] === 3) {
}
if ($_POST['type'] === 3) {
return $this->Responded(['code' => 1, 'title' => "Edition d'article", 'message' => 'Article corrigé, il est en attente de publication']);
}

Expand Down
12 changes: 10 additions & 2 deletions application/Controllers/Admin/Ajax/Categories.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Models\Admin\CategoriesModel;
use CodeIgniter\HTTP\Response;
Expand All @@ -10,7 +19,6 @@
*/
class Categories extends Ajax
{

/**
* @var \App\Models\Admin\CategoriesModel
*/
Expand Down
12 changes: 10 additions & 2 deletions application/Controllers/Admin/Ajax/Comments.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Models\Admin\CommentsModel;
use CodeIgniter\HTTP\Response;
Expand All @@ -10,7 +19,6 @@
*/
class Comments extends Ajax
{

/**
* @var \App\Models\Admin\CommentsModel
*/
Expand Down
14 changes: 11 additions & 3 deletions application/Controllers/Admin/Ajax/Contact.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Libraries\Mailer;
use App\Models\Admin\ContactModel;
Expand All @@ -11,7 +20,6 @@
*/
class Contact extends Ajax
{

/**
* @var \App\Models\Admin\ContactModel
*/
Expand Down Expand Up @@ -60,8 +68,8 @@ public function markedview():Response
}

/**
* @return Response
* @throws \CodeIgniter\Database\Exceptions\DatabaseException
* @return Response
*/
public function del():Response
{
Expand Down
26 changes: 17 additions & 9 deletions application/Controllers/Admin/Ajax/Media.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Libraries\Twig\Twig;
use App\Models\Admin\MediaModel;
Expand All @@ -11,16 +20,15 @@
*/
class Media extends Ajax
{

/**
* @var \App\Models\Admin\MediaModel
* @var \App\Libraries\Twig\Twig
*/
private $media_model;
protected $twig;

/**
* @var \App\Libraries\Twig\Twig
* @var \App\Models\Admin\MediaModel
*/
protected $twig;
private $media_model;

/**
* Media constructor.
Expand All @@ -37,10 +45,10 @@ public function __construct(...$params)
}

/**
* @return Response
* @throws \Codeigniter\UnknownFileException
* @throws \Codeigniter\Files\Exceptions\FileNotFoundException
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
* @return Response
*/
public function modal():Response
{
Expand Down Expand Up @@ -79,8 +87,8 @@ public function add_media():Response
}

/**
* @return Response
* @throws \CodeIgniter\Database\Exceptions\DatabaseException
* @return Response
*/
public function remove_media():Response
{
Expand Down
11 changes: 10 additions & 1 deletion application/Controllers/Admin/Ajax/Pages.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin\Ajax;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin\Ajax;

use App\Models\Admin\PagesModel;

Expand Down
119 changes: 63 additions & 56 deletions application/Controllers/Admin/Application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?php namespace App\Controllers\Admin;
<?php

/*
* BlogCI4 - Blog write with Codeigniter v4dev
* @author Deathart <contact@deathart.fr>
* @copyright Copyright (c) 2018 Deathart
* @license https://opensource.org/licenses/MIT MIT License
*/

namespace App\Controllers\Admin;

use App\Libraries\CSRFToken;
use App\Libraries\Twig\Twig;
Expand All @@ -14,7 +23,6 @@
*/
class Application extends Controller
{

/**
* @var \CodeIgniter\Session\Session
*/
Expand Down Expand Up @@ -93,57 +101,6 @@ public function __construct(...$params)
$this->response->setHeader('X-robots-tag', 'noindex');
}

/**
* Set js & css file
*
* @return \App\Controllers\Admin\Application $this
*/
private function base_template(): self
{

//Set css file
$this->set_css($this->asset_path('css/vendor/fontawesome.css'));
$this->set_css('//fonts.googleapis.com/css?family=RobotoDraft:300,400,500');
$this->set_css($this->asset_path('css/vendor/bootstrap.css'));

//Set JS
$this->set_js($this->asset_path('js/vendor/jquery.min.js'));
$this->set_js($this->asset_path('js/vendor/bootstrap.bundle.js'));
$this->set_js($this->asset_path('js/vendor/cookie.min.js'));
$this->set_js($this->asset_path('js/vendor/jquery.toast.js'));

//Set by page
if ($this->request->uri->getSegment(2) == 'auth') {
$this->set_css($this->asset_path('css/admin/auth.css'));
$this->set_js($this->asset_path('js/admin/auth.js'));
} else {
$this->set_css($this->asset_path('css/admin/style.css'));
$this->set_js($this->asset_path('js/admin/app.js'));

if ($this->request->uri->getSegment(2) == 'article') {
$this->set_js($this->asset_path('js/vendor/spectrum.js'));
$this->set_js($this->asset_path('js/admin/bbcode.js'));
$this->set_js($this->asset_path('js/admin/article.js'));
} elseif ($this->request->uri->getSegment(2) == 'comments') {
$this->set_js($this->asset_path('js/admin/comments.js'));
} elseif ($this->request->uri->getSegment(2) == 'config') {
$this->set_js($this->asset_path('js/admin/config.js'));
} elseif ($this->request->uri->getSegment(2) == 'categories') {
$this->set_js($this->asset_path('js/admin/categories.js'));
} elseif ($this->request->uri->getSegment(2) == 'contact') {
$this->set_js($this->asset_path('js/admin/contact.js'));
} elseif ($this->request->uri->getSegment(2) == 'page') {
$this->set_js($this->asset_path('js/vendor/spectrum.js'));
$this->set_js($this->asset_path('js/admin/bbcode.js'));
$this->set_js($this->asset_path('js/admin/page.js'));
} elseif ($this->request->uri->getSegment(2) == 'media') {
$this->set_js($this->asset_path('js/admin/media.js'));
}
}

return $this;
}

/**
* @param string $file link
*
Expand Down Expand Up @@ -191,10 +148,10 @@ public function meta(string $title): string
* @param string $page set page
* @param string $title set title page
*
* @return \App\Controllers\Admin\Application $this
* @throws \Codeigniter\UnknownFileException
* @throws \Codeigniter\Files\Exceptions\FileNotFoundException
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
* @return \App\Controllers\Admin\Application $this
*/
public function render(string $page, string $title = null): self
{
Expand Down Expand Up @@ -242,6 +199,56 @@ protected function breadcrumb(): string
return $bread;
}

/**
* Set js & css file
*
* @return \App\Controllers\Admin\Application $this
*/
private function base_template(): self
{
//Set css file
$this->set_css($this->asset_path('css/vendor/fontawesome.css'));
$this->set_css('//fonts.googleapis.com/css?family=RobotoDraft:300,400,500');
$this->set_css($this->asset_path('css/vendor/bootstrap.css'));

//Set JS
$this->set_js($this->asset_path('js/vendor/jquery.min.js'));
$this->set_js($this->asset_path('js/vendor/bootstrap.bundle.js'));
$this->set_js($this->asset_path('js/vendor/cookie.min.js'));
$this->set_js($this->asset_path('js/vendor/jquery.toast.js'));

//Set by page
if ($this->request->uri->getSegment(2) == 'auth') {
$this->set_css($this->asset_path('css/admin/auth.css'));
$this->set_js($this->asset_path('js/admin/auth.js'));
} else {
$this->set_css($this->asset_path('css/admin/style.css'));
$this->set_js($this->asset_path('js/admin/app.js'));

if ($this->request->uri->getSegment(2) == 'article') {
$this->set_js($this->asset_path('js/vendor/spectrum.js'));
$this->set_js($this->asset_path('js/admin/bbcode.js'));
$this->set_js($this->asset_path('js/admin/article.js'));
} elseif ($this->request->uri->getSegment(2) == 'comments') {
$this->set_js($this->asset_path('js/admin/comments.js'));
} elseif ($this->request->uri->getSegment(2) == 'config') {
$this->set_js($this->asset_path('js/admin/config.js'));
} elseif ($this->request->uri->getSegment(2) == 'categories') {
$this->set_js($this->asset_path('js/admin/categories.js'));
} elseif ($this->request->uri->getSegment(2) == 'contact') {
$this->set_js($this->asset_path('js/admin/contact.js'));
} elseif ($this->request->uri->getSegment(2) == 'page') {
$this->set_js($this->asset_path('js/vendor/spectrum.js'));
$this->set_js($this->asset_path('js/admin/bbcode.js'));
$this->set_js($this->asset_path('js/admin/page.js'));
} elseif ($this->request->uri->getSegment(2) == 'media') {
$this->set_js($this->asset_path('js/admin/media.js'));
}
}

return $this;
}

/**
* @param $filename
* @return mixed
Expand All @@ -262,4 +269,4 @@ private function asset_path($filename)

return base_url('assets/' . $filename);
}
}
}
Loading

0 comments on commit 8b9ac9d

Please sign in to comment.