function _botcha_filter_form_log in BOTCHA Spam Prevention 6.2
Same name and namespace in other branches
- 6 botcha.botcha.inc \_botcha_filter_form_log()
- 6.3 botcha.module \_botcha_filter_form_log()
- 7 botcha.botcha.inc \_botcha_filter_form_log()
- 7.2 botcha.inc \_botcha_filter_form_log()
- 7.3 botcha.module \_botcha_filter_form_log()
Filter out sensitive form data for logging Recursive.
2 calls to _botcha_filter_form_log()
- BotchaRecipebookAbstract::apply in controller/
botcha_recipebook.controller.inc - BotchaRecipebookAbstract::handle in controller/
botcha_recipebook.controller.inc - Handle form depending on the result of spam check.
File
- ./
botcha.inc, line 99 - General BOTCHA functionality and helper functions.
Code
function _botcha_filter_form_log($form, $level = 0) {
if (is_array($form) && !is_string($form)) {
foreach ($form as $key => $value) {
if ($key == '#post') {
$form[$key] = $level == 0 ? _botcha_filter_form_values_log($value) : t('...[redundand entry - removed]');
}
elseif ($key == '#parameters') {
foreach ($value as $n => $arg) {
$value[$n] = _botcha_filter_form_log($arg, -1);
}
$form[$key] = $value;
}
elseif (!element_property($key)) {
// Handle recursion for $key == '#parameters'
if ($level == -1) {
$form[$key] = $key == 'pass' ? '********' : _botcha_filter_form_log($value, -1);
}
else {
$form[$key] = _botcha_filter_form_log($value, $level + 1);
if ($key == 'pass' && isset($form[$key]['#value'])) {
$form[$key]['#value'] = '********';
}
}
}
}
}
return $form;
}