added wrapper for boolean api-parameters, Domains-Module for now, more later; fixes #597
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -79,6 +79,31 @@ abstract class ApiParameter
|
||||
return $this->cmd_params[$param];
|
||||
}
|
||||
|
||||
/**
|
||||
* getParam wrapper for boolean parameter
|
||||
*
|
||||
* @param string $param
|
||||
* parameter to get out of the request-parameter list
|
||||
* @param bool $optional
|
||||
* default: false
|
||||
* @param mixed $default
|
||||
* value which is returned if optional=true and param is not set
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getBoolParam($param = null, $optional = false, $default = false)
|
||||
{
|
||||
$_default = '0';
|
||||
if ($default) {
|
||||
$_default = '1';
|
||||
}
|
||||
$param_value = $this->getParam($param, $optional, $_default);
|
||||
if ($param_value && intval($param_value) != 0) {
|
||||
return '1';
|
||||
}
|
||||
return '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* get specific parameter which also has and unlimited-field
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user