function validate($text, $control, $form) { // note, $text will be null $chall = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : false; $resp = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : false; if (!$chall || !$resp) { $result = array('false', 'incorrect-captcha-sol'); } else { $result = Recaptcha::recaptcha_post(array('privatekey' => $this->options['private_key'], 'remoteip' => $_SERVER['REMOTE_ADDR'], 'challenge' => $chall, 'response' => $resp)); } // if the first part isn't true then return the second part return trim($result[0]) == 'true' ? array() : array('You did not complete the reCAPTCHA correctly (' . $result[1] . ')'); }