Dev.Filtering - pi-engine/pi GitHub Wiki
- Input filtering
- Read parameters from input: see
Pi\Utility\Filter
; Pi\Mvc\Controller\Plugin\Params
- GET:
$var = _get('var_name', 'int');
alias in a controller action: $var = $this->params()->get('var_name', 'int');
- POST:
$var = _post('var_name', 'int');
alias in a controller action: $var = $this->params()->post('var_name', 'int');
- PUT:
$var = _put('var_name', 'int');
alias in a controller action: $var = $this->params()->put('var_name', 'int');
- Generic:
$var = _request('var_name', 'int');
alias in a controller action: $var = $this->params()->request('var_name', 'int');
- Filter a value:
$var = _filter($rawValue, 'email');
- Sanitize a value:
$value = _sanitize($rawValue, 'float', 'allow_thousand');
- Escape a string: `$escapedText = _escape($rawText[, ''|'html'|'css'|'url']);
- Strip a string: `$strippedText = _strip($rawText[, ' '|'-']);