Documentation

filter

array public
\Bitrix\Security\Filter\Request::filter(
 array $values,
 boolean $isReturnChangedOnly = true
);

Non-static method returns array of filtered values.

Parameters

ParameterDescriptionVersion
$valuesValues. Array type: array("get" => $_GET, "post" => $_POST, "files" => $_FILES, "cookie" => $_COOKIE).
$isReturnChangedOnlyWhen value is true, returns values modified by an auditor.

Example

$ob = new Request();
$ob->setAuditors([
 'SQL' => new Auditor\Sql()
]);
print_r(
 $ob->filter([
     'get' => ['safe bar'],
     'post' => ['select * from foo']
 ])
);
//output: Array ( [post] => Array ( [0] => sel ect * fr om foo ) )

print_r(
 $ob->filter([
         'get' => ['safe bar'],
         'post' => ['select * from foo']
     ],
     false
 )
);
//output: Array ( [get] => Array ( [0] => safe bar ) [post] => Array ( [0] => sel ect * fr om foo ) )



© «Bitrix24», 2001-2024
Up