Esempio n. 1
0
File: Curl.php Progetto: kisma/kisma
 /**
  * @param array $error
  *
  * @return void
  */
 protected static function _setError($error)
 {
     static::$_error = $error;
 }
Esempio n. 2
0
 /**
  * Check that the given response matches the currently reCaptcha challenge.
  *
  *     if (reCaptcha::check())
  *     {
  *         // Pass
  *     }
  * 
  * Or check it when using [Validation]:
  *
  *     $array->rules('recaptcha_challenge_field', array(
  *         'not_empty'        => NULL,
  *         'reCaptcha::check' => NULL,
  *     ));
  *
  * @param   string   reCaptcha response field
  * @param   string   reCaptcha challenge field
  * @return  boolean
  * @uses    Arr::get
  * @uses    Request::$client_ip
  */
 public static function check($response = NULL, $challenge = NULL)
 {
     static::_init();
     if (!$response) {
         $response = Arr::get($_POST, 'recaptcha_response_field', FALSE);
     }
     if (!$challenge) {
         $challenge = Arr::get($_POST, 'recaptcha_challenge_field', FALSE);
     }
     $result = recaptcha_check_answer(static::config('private_key'), Request::$client_ip, $challenge, $response);
     static::$_error = $result->error;
     return (bool) $result->is_valid;
 }