ValidatedSanitizedInputSniff
extends Sniff
in package
uses
SanitizationHelperTrait
Flag any non-validated/sanitized input ( _GET / _POST / etc. ).
Tags
Table of Contents
Properties
- $check_validation_in_scope_only : bool
- Check for validation functions for a variable within its own parenthesis only.
- $phpcsFile : File
- The current file being sniffed.
- $tokens : array<string|int, mixed>
- The list of tokens in the current file being sniffed.
- $slashed_superglobals : array<string, true>
- Superglobals for which the values will be slashed by WP.
Methods
- add_unslash_error() : void
- Add an error for missing use of unslashing.
- process() : int|void
- Set sniff properties and hand off to child class for processing of the token.
- process_token() : void
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
Properties
$check_validation_in_scope_only
Check for validation functions for a variable within its own parenthesis only.
public
bool
$check_validation_in_scope_only
= false
$phpcsFile
The current file being sniffed.
protected
File
$phpcsFile
Tags
$tokens
The list of tokens in the current file being sniffed.
protected
array<string|int, mixed>
$tokens
Tags
$slashed_superglobals
Superglobals for which the values will be slashed by WP.
private
array<string, true>
$slashed_superglobals
= array('$_COOKIE' => true, '$_GET' => true, '$_POST' => true, '$_REQUEST' => true, '$_SERVER' => true)
Tags
Methods
add_unslash_error()
Add an error for missing use of unslashing.
public
add_unslash_error(File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The index of the token in the stack which is missing unslashing.
Tags
process()
Set sniff properties and hand off to child class for processing of the token.
public
process(File $phpcsFile, int $stackPtr) : int|void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Tags
Return values
int|void —Integer stack pointer to skip forward or void to continue normal file processing.
process_token()
Processes this test, when one of its tokens is encountered.
public
process_token(int $stackPtr) : void
Parameters
- $stackPtr : int
-
The position of the current token in the stack.
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>