Move the filters into CI namespace

This commit is contained in:
Jim Parry 2019-01-24 01:47:00 -08:00
parent 9dc19c3d55
commit 778a26aba5
No known key found for this signature in database
GPG Key ID: CED549230775AD5B
7 changed files with 12 additions and 9 deletions

View File

@ -7,9 +7,9 @@ class Filters extends BaseConfig
// Makes reading things below nicer,
// and simpler to change out script that's used.
public $aliases = [
'csrf' => \App\Filters\CSRF::class,
'toolbar' => \App\Filters\DebugToolbar::class,
'honeypot' => \App\Filters\Honeypot::class,
'csrf' => \CodeIgniter\Filters\CSRF::class,
'toolbar' => \CodeIgniter\Filters\DebugToolbar::class,
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
];
// Always applied before every request

View File

@ -1,4 +1,4 @@
<?php namespace App\Filters;
<?php namespace CodeIgniter\Filters;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;

View File

@ -1,4 +1,4 @@
<?php namespace App\Filters;
<?php namespace CodeIgniter\Filters;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Filters;
namespace CodeIgniter\Filters;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;

View File

@ -209,8 +209,8 @@ class FileLocatorTest extends \CIUnitTestCase
{
$files = $this->locator->listFiles('Filters/');
$expectedWin = APPPATH . 'Filters\DebugToolbar.php';
$expectedLin = APPPATH . 'Filters/DebugToolbar.php';
$expectedWin = SYSTEMPATH . 'Filters\DebugToolbar.php';
$expectedLin = SYSTEMPATH . 'Filters/DebugToolbar.php';
$this->assertTrue(in_array($expectedWin, $files) || in_array($expectedLin, $files));
$expectedWin = SYSTEMPATH . 'Filters\Filters.php';

View File

@ -28,7 +28,9 @@ from the ``$globals`` array, like...::
]
];
A sample Honeypot filter is bundled, as ``app/Filters/Honeypot.php``.
A sample Honeypot filter is bundled, as ``system/Filters/Honeypot.php``.
If it is not suitable, make your own at ``app/Filters/Honeypot.php``,
and modify the ``$aliases`` in the configuration appropriately.
Customizing Honeypot
=====================

View File

@ -28,6 +28,7 @@ and enabling the `csrf` filter globally::
public $globals = [
'before' => [
//'honeypot'
'csrf'
]
];