pmpro_init_recaptcha

The Paid Memberships Pro pmpro init recaptcha function.

Description

pmpro_init_recaptcha(); 

Usage

  1. if ( !function_exists( 'pmpro_init_recaptcha' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/recaptcha.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_init_recaptcha(); 
  7.  

Defined (1)

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

/includes/recaptcha.php  
  1. function pmpro_init_recaptcha() 
  2. //don't load in admin 
  3. if(is_admin()) 
  4. return; 
  5.  
  6. //use recaptcha? 
  7. global $recaptcha; 
  8. $recaptcha = pmpro_getOption("recaptcha"); 
  9. if($recaptcha) 
  10. global $recaptcha_publickey, $recaptcha_privatekey; 
  11.  
  12. require_once(PMPRO_DIR . "/includes/lib/recaptchalib.php"); 
  13.  
  14. function pmpro_recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) 
  15. $locale = get_locale(); 
  16. if(!empty($locale)) 
  17. $parts = explode("_", $locale); 
  18. $lang = $parts[0]; 
  19. else 
  20. $lang = "en"; 
  21.  
  22. //filter 
  23. $lang = apply_filters('pmpro_recaptcha_lang', $lang); 
  24. ?> 
  25. <div class="g-recaptcha" data-sitekey="<?php echo $pubkey;?>"></div> 
  26. <script type="text/javascript" 
  27. src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>"> 
  28. </script> 
  29. <?php  
  30.  
  31. //for templates using the old recaptcha_get_html 
  32. if(!function_exists('recaptcha_get_html')) 
  33. function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) 
  34. return pmpro_recaptcha_get_html($pubkey, $error, $use_ssl); 
  35.  
  36. $recaptcha_publickey = pmpro_getOption("recaptcha_publickey"); 
  37. $recaptcha_privatekey = pmpro_getOption("recaptcha_privatekey");