gglcptch_add_scripts

The Google Captcha (reCAPTCHA) by BestWebSoft gglcptch add scripts function.

Description

gglcptch_add_scripts(); 

Usage

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

Defined (1)

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

/google-captcha.php  
  1. function gglcptch_add_scripts() { 
  2. global $gglcptch_options, $gglcptch_plugin_info; 
  3.  
  4. if ( empty( $gglcptch_options ) ) 
  5.  
  6. if ( isset( $gglcptch_options['recaptcha_version'] ) && 'v1' != $gglcptch_options['recaptcha_version'] ) { 
  7. wp_enqueue_script( 'gglcptch_pre_api', plugins_url( 'js/pre-api-script.js', __FILE__ ), array( 'jquery'), $gglcptch_plugin_info['Version'], true ); 
  8. wp_localize_script( 'gglcptch_pre_api', 'gglcptch_pre', array( 
  9. 'messages' => array( 
  10. 'in_progress' => __( 'Please wait until Google reCAPTCHA is loaded.', 'google-captcha' ),  
  11. 'timeout' => __( 'Failed to load Google reCAPTCHA. Please check your internet connection and reload this page.', 'google-captcha' ) 
  12. ) ); 
  13.  
  14. wp_enqueue_script( 'gglcptch_script', plugins_url( 'js/script.js', __FILE__ ), array( 'jquery', 'gglcptch_api' ), $gglcptch_plugin_info["Version"], true ); 
  15.  
  16. $version = $gglcptch_options['recaptcha_version'] == 'v2' ? '_v2' : ''; 
  17.  
  18. /** forms to exclude from ajax check */ 
  19. $excluded_forms = apply_filters( 'gglcptch_exclude_forms', '' ); 
  20. if ( ! empty( $excluded_forms ) && is_array( $excluded_forms ) ) { 
  21. $excluded_forms = implode( ', ', $excluded_forms ); 
  22.  
  23. wp_localize_script( 'gglcptch_script', 'gglcptch', array( 
  24. 'options' => array( 
  25. 'version' => $gglcptch_options['recaptcha_version'],  
  26. 'sitekey' => $gglcptch_options['public_key'],  
  27. 'theme' => $gglcptch_options[ 'theme' . $version ],  
  28. error => sprintf( '<strong>%s</strong>: %s', __( 'Warning', 'google-captcha' ), gglcptch_get_message( 'multiple_blocks' ) ) 
  29. ),  
  30. 'vars' => array( 
  31. 'ajaxurl' => admin_url( 'admin-ajax.php' ),  
  32. 'error_msg' => sprintf( '%s: %s', __( 'Error', 'google-captcha' ), gglcptch_get_message() ),  
  33. 'nonce' => wp_create_nonce( 'gglcptch_recaptcha_nonce' ),  
  34. 'visibility' => ( 'login_footer' == current_filter() ) ? true : false,  
  35. 'excluded_forms' => ! empty( $excluded_forms ) ? ', ' . $excluded_forms : '' 
  36. ) );