mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Allow 'options' to be given as array when adding a param detector - similar to env / options.
Allow the following when adding request detectors using CakeRequest::addDetector(): array('param'=>'{param-name}', 'options'=>array())
This commit is contained in:
parent
499212a86e
commit
cf3dfb0c66
1 changed files with 7 additions and 2 deletions
|
@ -516,8 +516,13 @@ class CakeRequest implements ArrayAccess {
|
|||
}
|
||||
if (isset($detect['param'])) {
|
||||
$key = $detect['param'];
|
||||
$value = $detect['value'];
|
||||
return isset($this->params[$key]) ? $this->params[$key] == $value : false;
|
||||
if (isset($detect['value'])) {
|
||||
$value = $detect['value'];
|
||||
return isset($this->params[$key]) ? $this->params[$key] == $value : false;
|
||||
}
|
||||
if (isset($detect['options'])) {
|
||||
return isset($this->params[$key]) ? in_array($this->params[$key],$detect['options']) : false;
|
||||
}
|
||||
}
|
||||
if (isset($detect['callback']) && is_callable($detect['callback'])) {
|
||||
return call_user_func($detect['callback'], $this);
|
||||
|
|
Loading…
Reference in a new issue