// Validate captcha
$captcha = new Captcha\Captcha();
$captcha->setPublicKey(Config::$RECAPTCHA_PUBLIC);
$captcha->setPrivateKey(Config::$RECAPTCHA_SECRET);
$response = $captcha->check($_POST['recaptcha']['challenge'], $_POST['recaptcha']['response']);
if (!$response->isValid()) {
    Response::json(401, 'Captcha inválido!');
}
unset($_POST['recaptcha']);
// Form creation
$MAX_LENGTH_NAME = 30;
$MAX_LENGTH_SUBJECT = 70;
$MAX_LENGTH_MESSAGE = 250;
$REASONS = array('enquiry' => 'Consultas', 'complaint' => 'Reclamos', 'difussion' => 'Bandas/Difusión', 'other' => 'Otros');
$form = new Form(array('full_name' => array('label' => 'Nombre/s', 'type' => 'string', 'required' => true, 'maxlength' => $MAX_LENGTH_NAME), 'email' => array('label' => 'Correo electrónico', 'type' => 'email', 'required' => true), 'reason' => array('label' => 'Motivo', 'type' => 'string', 'required' => true, 'select' => $REASONS), 'subject' => array('label' => 'Asunto', 'type' => 'string', 'required' => true, 'maxlength' => $MAX_LENGTH_SUBJECT), 'message' => array('label' => 'Mensaje', 'type' => 'string', 'required' => true, 'maxlength' => $MAX_LENGTH_MESSAGE)));
$errors = $form->validate_whitelist();
if (!empty($errors)) {
    Response::json(400, $errors);
}
$errors = $form->validate_required();
if (!empty($errors)) {
    Response::json(400, $errors);
}
$form->fill_values();
$errors = $form->validate_format();
if (!empty($errors)) {
    Response::json(400, $errors);
}
// Get form values
$full_name = $form->value('full_name');
$email = $form->value('email');