wpcf7_recaptcha_check_with_google

The Contact Form 7 wpcf7 recaptcha check with google function.

Description

wpcf7_recaptcha_check_with_google( $spam ); 

Parameters (1)

0. $spam
The spam.

Usage

  1. if ( !function_exists( 'wpcf7_recaptcha_check_with_google' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/recaptcha.php'; 
  3.  
  4. // The spam. 
  5. $spam = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_recaptcha_check_with_google($spam); 
  9.  

Defined (1)

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

/modules/recaptcha.php  
  1. function wpcf7_recaptcha_check_with_google( $spam ) { 
  2. if ( $spam ) { 
  3. return $spam; 
  4.  
  5. $contact_form = wpcf7_get_current_contact_form(); 
  6.  
  7. if ( ! $contact_form ) { 
  8. return $spam; 
  9.  
  10. $tags = $contact_form->scan_form_tags( array( 'type' => 'recaptcha' ) ); 
  11.  
  12. if ( empty( $tags ) ) { 
  13. return $spam; 
  14.  
  15. $recaptcha = WPCF7_RECAPTCHA::get_instance(); 
  16.  
  17. if ( ! $recaptcha->is_active() ) { 
  18. return $spam; 
  19.  
  20. $response_token = wpcf7_recaptcha_response(); 
  21. $spam = ! $recaptcha->verify( $response_token ); 
  22.  
  23. return $spam;