function _recaptcha_replace in reCAPTCHA 5.2
Same name and namespace in other branches
- 8 recaptcha_mailhide/recaptcha_mailhide.module \_recaptcha_replace()
- 6 recaptcha_mailhide/recaptcha_mailhide.module \_recaptcha_replace()
- 7 recaptcha_mailhide/recaptcha_mailhide.module \_recaptcha_replace()
Private reCAPTCHA function to replace an email regex match
1 string reference to '_recaptcha_replace'
- recaptcha_mailhide_filter in ./
recaptcha_mailhide.module - reCAPTCHA implementation of hook_filter
File
- ./
recaptcha_mailhide.module, line 98 - Protects email addresses using the reCAPTCHA web service.
Code
function _recaptcha_replace($match) {
global $_recaptcha_mailhide_public_key, $_recaptcha_mailhide_private_key, $_recaptcha_mailhide_nokey_warn;
// recaptchalib will die if we invoke without setting the keys. Fail gracefully in this case.
if (empty($_recaptcha_mailhide_public_key) || empty($_recaptcha_mailhide_private_key)) {
if ($_recaptcha_mailhide_nokey_warn != TRUE) {
drupal_set_message(t('Addresses cannot be hidden because the administrator has not set the reCAPTCHA Mailhide keys.'), 'error');
$_recaptcha_mailhide_nokey_warn = TRUE;
}
$email = $match[2];
}
else {
$email = recaptcha_mailhide_html($_recaptcha_mailhide_public_key, $_recaptcha_mailhide_private_key, $match[2]);
}
return $match[1] . $email . $match[3];
}