protected mixed
getArrayRecursive
(array $vars = array(), mixed $datasource = null, mixed $defaultFilter = 'unknown', mixed $recursion = false)
/**
* Gets an array of values from the request.
*
* @param array $vars Associative array of keys and filter types to apply.
* If empty and datasource is null, all the input data will be returned
* but filtered using the filter given by the parameter defaultFilter in
* InputFilter::clean.
* @param mixed $datasource Array to retrieve data from, or null.
* @param string $defaultFilter Default filter used in InputFilter::clean if vars is empty and
* datasource is null. If 'unknown', the default case is used in
* InputFilter::clean.
* @param bool $recursion Flag to indicate a recursive function call.
*
* @return mixed The filtered input data.
*
* @since 3.4.2
* @deprecated 5.0 Use Joomla\Input\Input instead
*/
protected function getArrayRecursive(array $vars = array(), $datasource = null, $defaultFilter = 'unknown', $recursion = false)
{
if (empty($vars) && \is_null($datasource)) {
$vars = $this->data;
} else {
if (!$recursion) {
$defaultFilter = null;
}
}
$results = array();
foreach ($vars as $k => $v) {
if (\is_array($v)) {
if (\is_null($datasource)) {
$results[$k] = $this->getArrayRecursive($v, $this->get($k, null, 'array'), $defaultFilter, true);
} else {
$results[$k] = $this->getArrayRecursive($v, $datasource[$k], $defaultFilter, true);
}
} else {
$filter = $defaultFilter ?? $v;
if (\is_null($datasource)) {
$results[$k] = $this->get($k, null, $filter);
} elseif (isset($datasource[$k])) {
$results[$k] = $this->filter->clean($datasource[$k], $filter);
} else {
$results[$k] = $this->filter->clean(null, $filter);
}
}
}
return $results;
}