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
Comment | File | Size | Author |
---|---|---|---|
#14 | recaptcha-hide-mailto-173151-14.patch | 7.55 KB | kwikwag |
#13 | recaptcha-hide-mailto-173151-13.patch | 3.27 KB | kwikwag |
#10 | recaptcha-hide-mailto-173151-10.patch | 3.3 KB | kwikwag |
Comments
Comment #1
RobLoachSo, before the reCAPTCHA Mailhide filter goes through, replace tags that reference mailto:// protocols with just the email address. The Mailhide would than run on it, replacing the email addresses. Neat idea, and it would allow reCAPTCHA Mailhide to run after/with the URL/Email filter. The tricky thing to do would be to write the regex for it.
Comment #2
VValdo CreditAttribution: VValdo commentedexactly.... 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
Comment #3
keith_k CreditAttribution: keith_k commentedI think it should. The whole point of the recaptcha mailhide module is to protect people's email addresses. Until it can hide
<a>
withmailto
addresses, it's not doing the job...Comment #4
StephanieM CreditAttribution: StephanieM commentedI'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!)
Comment #5
escoles CreditAttribution: escoles commentedI'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.
Comment #6
chunty CreditAttribution: chunty commentedYup 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
Comment #7
whizdom01 CreditAttribution: whizdom01 commentedHey 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
Comment #8
chunty CreditAttribution: chunty commentedYes 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
Comment #9
armyofda12mnkeys CreditAttribution: armyofda12mnkeys commentedsubscribing... Yes would be nice if the filter handled it. Dont know anyone that leaves emails as raw text vs mailto:'s.
Comment #10
kwikwag CreditAttribution: kwikwag commentedI've patched up my module to replace all
mailto:
links ina
tags. It's at least a start...Comment #11
kwikwag CreditAttribution: kwikwag commented(forgot to change status) I've patched up my module to replace all
mailto:
links ina
tags. It's at least a start...Comment #12
Liam MorlandThanks 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?
Comment #13
kwikwag CreditAttribution: kwikwag commentedLiam - 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.
Comment #14
kwikwag CreditAttribution: kwikwag commented+ added option to enable/disable this in settings.
+ made sure to replace the inner HTML inside
<a>...</a>
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.Comment #15
Liam MorlandI would appreciate it if someone who uses mailhide would try this and RTBC if it works.
Comment #16
hass CreditAttribution: hass commentedI 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.
Comment #17
hass CreditAttribution: hass commentedThat is a serious bug.
<a href="mailto:test@example.com">test@example.com</a>
is not getting protected.Comment #18
hass CreditAttribution: hass commentedComment #19
hass CreditAttribution: hass commented