diff --git a/recaptcha_mailhide.module b/recaptcha_mailhide.module index fb72edc..b15add8 100644 --- a/recaptcha_mailhide.module +++ b/recaptcha_mailhide.module @@ -68,7 +68,7 @@ function recaptcha_mailhide_filter($op, $delta = 0, $format = -1, $text = '') { $_recaptcha_mailhide_private_key = variable_get('recaptcha_mailhide_private_key', ''); $text = ' '. $text .' '; - $text = preg_replace_callback("!(

|

  • ||[ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})([.,?]?)(?=(

    |
  • ||[ \n\r\t\)]))!i", '_recaptcha_replace', $text); + $text = preg_replace_callback('!\b[A-Z0-9+_.-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b!i', '_recaptcha_replace', $text); $text = substr($text, 1, -1); unset($_recaptcha_mailhide_public_key); @@ -99,12 +99,12 @@ function _recaptcha_replace($match) { 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]; + $email = $match[0]; } else { - $email = recaptcha_mailhide_html($_recaptcha_mailhide_public_key, $_recaptcha_mailhide_private_key, $match[2]); + $email = recaptcha_mailhide_html($_recaptcha_mailhide_public_key, $_recaptcha_mailhide_private_key, $match[0]); } - return $match[1] . $email . $match[3]; + return $email; } /**