function get_form_field_value($field, $properties, $resources) { $value = $_REQUEST[$field]; switch ($properties['type']) { case 'checkbox': return $value == '1' || $value == 'true' ? $resources['checkbox_checked'] : $resources['checkbox_unchecked']; case 'string': case 'captcha': case 'recaptcha': case 'email': return encode_for_form($value); default: die(get_form_error_response(sprintf($resources['invalid_field_type'], $properties['type']))); } }
function get_form_field_value($field, $properties, $resources, $forOutput) { $value = $_REQUEST[$field]; switch ($properties['type']) { case 'checkbox': return $value == '1' || $value == 'true' ? $resources['checkbox_checked'] : $resources['checkbox_unchecked']; case 'checkboxgroup': if (!is_array($value)) { return NULL; } $outputValue = array(); foreach ($value as $checkboxValue) { array_push($outputValue, $forOutput ? encode_for_form($checkboxValue) : stripslashes($checkboxValue)); } if ($forOutput) { $outputValue = implode(', ', $outputValue); } return $outputValue; case 'radiogroup': return $forOutput ? encode_for_form($value) : stripslashes($value); case 'string': case 'captcha': case 'recaptcha': case 'email': return encode_for_form($value); case 'radio': // never validate the format of a single radio element; only the group gets validated // never validate the format of a single radio element; only the group gets validated default: die(get_form_error_response(sprintf($resources['invalid_field_type'], $properties['type']))); } }
function get_form_field_value($field, $properties) { $value = $_REQUEST[$field]; switch ($properties['type']) { case 'checkbox': return $value == '1' || $value == 'true' ? 'Marcado' : 'Desmarcado'; case 'string': case 'captcha': case 'recaptcha': case 'email': return encode_for_form($value); default: die(get_form_error_response(sprintf('Tipo de campo desconhecido \\"%s\\".', $properties['type']))); } }