evolve_GoogleRecaptcha

ReCaptcha Class.

Defined (1)

The class is defined in the following location(s).

/library/functions/functions.php  
  1. class evolve_GoogleRecaptcha { 
  2. /** Google recaptcha API url */ 
  3.  
  4. public function VerifyCaptcha($response) { 
  5.  
  6. $response = isset($_POST['g-recaptcha-response']) ? esc_attr($_POST['g-recaptcha-response']) : ''; 
  7. $remote_ip = $_SERVER["REMOTE_ADDR"]; 
  8. $secret = evolve_get_option('evl_recaptcha_private', ''); 
  9. $request = wp_remote_get('https://www.google.com/recaptcha/api/siteverify?secret=' . $secret . '&response=' . $response . '&remoteip=' . $remote_ip); 
  10. $response_body = wp_remote_retrieve_body($request); 
  11. $res = json_decode($response_body, TRUE); 
  12. if ($res['success'] == 'true') 
  13. return TRUE; 
  14. else 
  15. return FALSE; 
  16.