gglcptch_get_message

The Google Captcha (reCAPTCHA) by BestWebSoft gglcptch get message function.

Description

gglcptch_get_message( (string) $message_code = 'incorrect', (bool) $echo = false ); 

Parameters (2)

0. $message_code — Optional. (string) => 'incorrect'
The message code.
1. $echo — Optional. (bool) => false
The echo.

Usage

  1. if ( !function_exists( 'gglcptch_get_message' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-captcha-recaptcha-by-bestwebsoft/google-captcha.php'; 
  3.  
  4. // The message code. 
  5. $message_code = 'incorrect'; 
  6.  
  7. // The echo. 
  8. $echo = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = gglcptch_get_message($message_code, $echo); 
  12.  

Defined (1)

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

/google-captcha.php  
  1. function gglcptch_get_message( $message_code = 'incorrect', $echo = false ) { 
  2. $message = ''; 
  3.  
  4. $messages = array( 
  5. /** customerror*/ 
  6. 'RECAPTCHA_EMPTY_RESPONSE' => __( 'User response is missing.', 'google-captcha' ),  
  7. /** v1error*/ 
  8. 'invalid-site-private-key' => sprintf( 
  9. '<strong>%s</strong>. <a target="_blank" href="https://www.google.com/recaptcha/admin#list">%s</a> %s.',  
  10. __( 'Secret Key is invalid', 'google-captcha' ),  
  11. __( 'Check your domain configuration', 'google-captcha' ),  
  12. __( 'and enter it again', 'google-captcha' ) 
  13. ),  
  14. /** v2error*/ 
  15. 'missing-input-secret' => __( 'Secret Key is missing.', 'google-captcha' ),  
  16. 'invalid-input-secret' => sprintf( 
  17. '<strong>%s</strong>. <a target="_blank" href="https://www.google.com/recaptcha/admin#list">%s</a> %s.',  
  18. __( 'Secret Key is invalid', 'google-captcha' ),  
  19. __( 'Check your domain configuration', 'google-captcha' ),  
  20. __( 'and enter it again', 'google-captcha' ) 
  21. ),  
  22. 'incorrect-captcha-sol' => __( 'User response is invalid', 'google-captcha' ),  
  23. 'incorrect' => __( 'You have entered an incorrect reCAPTCHA value.', 'google-captcha' ),  
  24. 'multiple_blocks' => __( 'More than one reCAPTCHA has been found in the current form. Please remove all unnecessary reCAPTCHA fields to make it work properly.', 'google-captcha' ) 
  25. ); 
  26.  
  27. if ( isset( $messages[ $message_code ] ) ) { 
  28. $message = $messages[ $message_code ]; 
  29. } else { 
  30. $message = $messages[ 'incorrect' ]; 
  31.  
  32. if ( $echo ) 
  33. echo $message; 
  34.  
  35. return $message;