Hey, I don't know if maybe mailhide is clashing with another filter or something, but if I type a raw address in the text of a story node, say like test@example.com, I get the mailhide feature (which rocks by the way).

But if I enclose the mail as a link:

 <a href="mailto:test@example.com">testing</a>

It doesn't seem to see this as an email to be hidden. This would be great because I have a lot of very old content I've converted to drupal that enclosed emails in this fashion... (from the days before text filters) ... It would be cool if the world "testing" above could link to the mailhidden address instead...

Don't know if this is a bug, a feature request, a fixed or a won't fix... but I'd love it if it worked...

Thanks in advance!

W

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

VValdo’s picture

exactly.... and yes the regular expression will be a bitch to get right I'm sure, but it would be a great feature that would go a long way with the many years of imported content... but I bet someone has already written the regex code to extract the "meat" out of an http:// mailto and then it's just a matter of switching the elements around.. (probably easier said than done :) )

W

keith_k’s picture

Version: 5.x-2.3 » 6.x-1.x-dev

I think it should. The whole point of the recaptcha mailhide module is to protect people's email addresses. Until it can hide <a> with mailto addresses, it's not doing the job...

StephanieM’s picture

I'm having the same issue. Email addresses surrounded by spaces or a pre-defined (and hard-coded) set of tags work fine; any other markup causes the preg_replace_callback function to not see it.

What about a two-step process? First, pre-scan the text, which does nothing but search for anything that looks like an email address (regardless of surrounding markup) and puts some custom delimiter around them? Second, feed that to the existing function and let it substitute based on the custom delimiters.

It could even strip out the mailto: from hrefs on the way, although in this case the entire URL would be substituted instead of just the middle of the existing email address.

Disclaimer: My regular expression expertise is virtually nil. I know enough to know that regexes can do this but not how to make them do so. (And to think I used to be able to write APL!)

escoles’s picture

I'm seeing really spotty performance. Mailhide does nothing at all for addresses that are written using anchor tags (which is really problematic, to my mind)

Furthermore, it processes plain-text unlinked email addresses in an inconsistent way. E.g., given the gmail address example@gmail.com, what's rendered is "example...gmail.com", where "..." is linked and produces the Mailhide popup.

Can't use this for production if this is the normal behavior. It's too unreliable.

chunty’s picture

Yup I think it should - particularly as a lot of editors automatically convert email addresses into links so actually the data entry is about out of the editors hands, does make it kinda pointless otherwise

....subscribe!

C

whizdom01’s picture

Hey guys, don't blame reCaptcha. I figured out how to hide the mailto: with reCaptcha.
Go to your recaptcha account and click on "email protection".
Enter the email address you want to protect in the field and click "protect it", next copy the html code.
This code is what you're gonna place into the mailto: link.

Here's what it should look like:

<a href="mailto:name@youremail.com">captcha email html code</a>

Note: be sure to remove the </a> before the latter half of your email from the "captcha email html code"

Here's an example of what it should look like @ My Website And since you're there shoot me an email letting me know you got it.

All thanks goes to Google recaptcha

Wayne

chunty’s picture

Yes this does work but that's not quite the point....

The issue is that the module does not protect email addresses in content when the already have an anchor tag around them. Client using a wysiwyg modules don't want to do this every time they put an email address into a piece of text.

The point is the filter should correct all the content on the way out to the browser not just email addresses that are not a link.

....if that makes sense.

C

armyofda12mnkeys’s picture

subscribing... Yes would be nice if the filter handled it. Dont know anyone that leaves emails as raw text vs mailto:'s.

kwikwag’s picture

Issue summary: View changes
FileSize
3.3 KB

I've patched up my module to replace all mailto: links in a tags. It's at least a start...

kwikwag’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Active » Needs review

(forgot to change status) I've patched up my module to replace all mailto: links in a tags. It's at least a start...

Liam Morland’s picture

Status: Needs review » Needs work

Thanks for the patch.

You have some tabs in your indentation which need to be removed.

In the first hunk, $_recaptcha_mailhide_method and $text are set to values then immediately set to different values. Is this what you meant to do?

kwikwag’s picture

Status: Needs work » Needs review
FileSize
3.27 KB

Liam - thanks for your comments. First time submitting a patch... Hope this time around it's good.
I decided not to touch the way the globals are being passed to _recatpcha_replace() -- I think this should be done, but in another patch.
I tried to simply make it work with minimal changes.

kwikwag’s picture

+ added option to enable/disable this in settings.
+ made sure to replace the inner HTML inside &lt;a&gt;...&lt/a&gt; tags as well.
+ did some code refactoring (pulled out private/public key, mcrypt validation outside replace function and put all globals into a single $_recaptcha_mailhide_preg_replace_context variable). I originally thought it's better to do as part of a different commit but it simply made sense to so this on the go.

Liam Morland’s picture

I would appreciate it if someone who uses mailhide would try this and RTBC if it works.

hass’s picture

Status: Needs review » Needs work

I think this can be done a bit easier and cleaner. Please use domfilter. You can search for all a tags with href and replace the value very easy. See linkchecker or gotwo module, please.

hass’s picture

Category: Feature request » Bug report
Priority: Normal » Critical

That is a serious bug. <a href="mailto:test@example.com">test@example.com</a> is not getting protected.

hass’s picture

Title: Should ReCAPTCHA Mailhide Hide a href mailto: addresses also? » ReCAPTCHA Mailhide does not hide html tags with mailto
hass’s picture

Status: Needs work » Closed (outdated)