gglcptch_display

The Google Captcha (reCAPTCHA) by BestWebSoft gglcptch display function.

Description

gglcptch_display( (bool) $content = false ); 

Parameters (1)

0. $content — Optional. (bool) => false
The content.

Usage

  1. if ( !function_exists( 'gglcptch_display' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-captcha-recaptcha-by-bestwebsoft/google-captcha.php'; 
  3.  
  4. // The content. 
  5. $content = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gglcptch_display($content); 
  9.  

Defined (1)

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

/google-captcha.php  
  1. function gglcptch_display( $content = false ) { 
  2. global $gglcptch_options, $gglcptch_count, $gglcptch_ip_in_whitelist, $gglcptch_plugin_info; 
  3.  
  4. if ( empty( $gglcptch_options ) ) 
  5.  
  6. if ( ! isset( $gglcptch_ip_in_whitelist ) ) 
  7. $gglcptch_ip_in_whitelist = gglcptch_whitelisted_ip(); 
  8.  
  9. if ( ! $gglcptch_ip_in_whitelist ) { 
  10.  
  11. if ( ! $gglcptch_count ) 
  12. $gglcptch_count = 1; 
  13.  
  14. $publickey = $gglcptch_options['public_key']; 
  15. $privatekey = $gglcptch_options['private_key']; 
  16.  
  17. $content .= '<div class="gglcptch gglcptch_' . $gglcptch_options['recaptcha_version'] . '">'; 
  18. if ( ! $privatekey || ! $publickey ) { 
  19. if ( current_user_can( 'manage_options' ) ) { 
  20. $content .= sprintf( 
  21. '<strong>%s <a target="_blank" href="https://www.google.com/recaptcha/admin#list">%s</a> %s <a target="_blank" href="%s">%s</a>.</strong>',  
  22. __( 'To use Google Captcha you must get the keys from', 'google-captcha' ),  
  23. __( 'here', 'google-captcha' ),  
  24. __( 'and enter them on the', 'google-captcha' ),  
  25. admin_url( '/admin.php?page=google-captcha.php' ),  
  26. __( 'plugin setting page', 'google-captcha' ) 
  27. ); 
  28. $content .= '</div>'; 
  29. $gglcptch_count++; 
  30. return $content; 
  31.  
  32. /** generating random id value in case of getting content with pagination plugin for not getting duplicate id values */ 
  33. $id = mt_rand(); 
  34. if ( isset( $gglcptch_options['recaptcha_version'] ) && in_array( $gglcptch_options['recaptcha_version'], array( 'v2', 'invisible' ) ) ) { 
  35. $content .= '<div id="gglcptch_recaptcha_' . $id . '" class="gglcptch_recaptcha"></div> 
  36. <noscript> 
  37. <div style="width: 302px;"> 
  38. <div style="width: 302px; height: 422px; position: relative;"> 
  39. <div style="width: 302px; height: 422px; position: absolute;"> 
  40. <iframe src="https://www.google.com/recaptcha/api/fallback?k=' . $publickey . '" frameborder="0" scrolling="no" style="width: 302px; height:422px; border-style: none;"></iframe> 
  41. </div> 
  42. </div> 
  43. <div style="border-style: none; bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px; background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px; height: 60px; width: 300px;"> 
  44. <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px !important; height: 40px !important; border: 1px solid #c1c1c1 !important; margin: 10px 25px !important; padding: 0px !important; resize: none !important;"></textarea> 
  45. </div> 
  46. </div> 
  47. </noscript>'; 
  48. $api_url = "https://www.google.com/recaptcha/api.js?onload=gglcptch_onload_callback&render=explicit"; 
  49. $deps = array( 'gglcptch_pre_api' ); 
  50. } else { 
  51. require_once( 'lib/recaptchalib.php' ); 
  52. $content .= '<div id="gglcptch_recaptcha_' . $id . '" class="gglcptch_recaptcha"></div>'; 
  53. $content .= gglcptch_recaptcha_get_html( $publickey, null, is_ssl() ); 
  54. $api_url = "https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"; 
  55. $deps = array(); 
  56. $content .= '</div>'; 
  57. $gglcptch_count++; 
  58.  
  59. /** register reCAPTCHA script */ 
  60. if ( ! wp_script_is( 'gglcptch_api', 'registered' ) ) { 
  61. wp_register_script( 'gglcptch_api', $api_url, $deps, $gglcptch_plugin_info['Version'], true ); 
  62. add_action( 'wp_footer', 'gglcptch_add_scripts' ); 
  63. if ( 
  64. '1' == $gglcptch_options['login_form'] || 
  65. '1' == $gglcptch_options['reset_pwd_form'] || 
  66. '1' == $gglcptch_options['registration_form'] 
  67. } else { 
  68. if ( ! empty( $gglcptch_options['whitelist_message'] ) ) 
  69. $content .= '<label class="gglcptch_whitelist_message">' . $gglcptch_options['whitelist_message'] . '</label>'; 
  70.  
  71. return $content;