Use filter_id() for the url_param and form_param Twig functions
This is a follow-up to 80263a91dc
This commit is contained in:
parent
80263a91dc
commit
05c2c968c3
1 changed files with 4 additions and 2 deletions
|
@ -303,7 +303,8 @@ class PicoTwigExtension extends Twig_Extension
|
|||
*/
|
||||
public function urlParamFunction($name, $filter = '', $options = null, $flags = null)
|
||||
{
|
||||
if (($filter === 'callback') || ($filter === FILTER_CALLBACK)) {
|
||||
$filter = $filter ? (is_string($filter) ? filter_id($filter) : (int) $filter) : false;
|
||||
if (!$filter || ($filter === FILTER_CALLBACK)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -331,7 +332,8 @@ class PicoTwigExtension extends Twig_Extension
|
|||
*/
|
||||
public function formParamFunction($name, $filter = '', $options = null, $flags = null)
|
||||
{
|
||||
if (($filter === 'callback') || ($filter === FILTER_CALLBACK)) {
|
||||
$filter = $filter ? (is_string($filter) ? filter_id($filter) : (int) $filter) : false;
|
||||
if (!$filter || ($filter === FILTER_CALLBACK)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue