Example #1
0
 /**
  * Validate this input based on the set rules.
  *
  * @return  bool
  */
 public function validate()
 {
     $input = Input::instance();
     $challenge = $input->post("recaptcha_challenge_field", "", true);
     $response = $input->post("recaptcha_response_field", "", true);
     if (!empty($challenge)) {
         $this->_error = recaptcha::is_recaptcha_valid($challenge, $response, module::get_var("recaptcha", "private_key"));
         if (!empty($this->_error)) {
             $this->add_error($this->_error, 1);
         }
     }
     $this->is_valid = empty($this->_error);
     return empty($this->_error);
 }