o2system /
reactor
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * This file is part of the O2System Reactor package. |
||
| 4 | * |
||
| 5 | * For the full copyright and license information, please view the LICENSE |
||
| 6 | * file that was distributed with this source code. |
||
| 7 | * |
||
| 8 | * @author Steeve Andrian Salim |
||
| 9 | * @copyright Copyright (c) Steeve Andrian Salim |
||
| 10 | */ |
||
| 11 | |||
| 12 | // ------------------------------------------------------------------------ |
||
| 13 | |||
| 14 | namespace O2System\Reactor\Http; |
||
| 15 | |||
| 16 | // ------------------------------------------------------------------------ |
||
| 17 | |||
| 18 | use O2System\Security\Filters\Xss; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Class Input |
||
| 22 | * @package O2System\Reactor\Http |
||
| 23 | */ |
||
| 24 | class Input extends \O2System\Kernel\Http\Input |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * Input::filter |
||
| 28 | * |
||
| 29 | * @param int $type |
||
| 30 | * @param null $offset |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 31 | * @param int $filter |
||
| 32 | * |
||
| 33 | * @return mixed|\O2System\Spl\DataStructures\SplArrayObject|string |
||
| 34 | */ |
||
| 35 | protected function filter($type, $offset = null, $filter = FILTER_DEFAULT) |
||
| 36 | { |
||
| 37 | if (services()->has('xssProtection')) { |
||
| 38 | if ( ! services()->get('xssProtection')->verify()) { |
||
| 39 | $string = parent::filter($type, $offset, $filter); |
||
| 40 | |||
| 41 | if (is_string($string)) { |
||
|
0 ignored issues
–
show
|
|||
| 42 | return Xss::clean($string); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return parent::filter($type, $offset, $filter); |
||
| 48 | } |
||
| 49 | } |