Use addon to autogenerate mailto-links?

Permalink Browser Info Environment
Hi,

Is it possible to edit the add-on to enable the automatic creation of mailto: links, whenever someone writes ie. [email protected]?

Considering that the add-on does see all mail addresses and replace them with something else (in the sourcecode) I'm figuring it would be possible in someway.

Any ideas on how to approach this?

Thanks!

Type: Discussion
Status: New
View Replies:
Mainio replied on at Permalink Reply
Mainio
Yes, sure everything is possible.

But I would say it's not very easy to do with the current code, I would suggest creating completely another add-on for that purpose.

The reason for why it's not very easy is that currently the add-on searches the email texts with a regular expression and just swaps all the email texts found on the page. To achieve something you want to achieve you'd also need to make sure that the found text is not already inside a link because otherwise you might get double links in your page source which would:
a) break your page source
b) might also break the functionality of those links already existing
c) make your page source syntax invalid.

But of course it's possible if you just write a proper regular expression to make sure the found texts are not already inside links (a-tags).

Also, if you want to use such add-on together with this one, you need to make sure that the other add-on (which creates the mailto-links) is run BEFORE automatic email obfuscator is run. This way your newly created links will get obfuscated as well.

We actually use the regexps from the MIT licensed "Transparent Email Obfuscator" add-on so those are freely available for use. You can also see them straight from here:
http://www.concrete5.org/community/forums/customizing_c5/transparen...

The very first regular expression is something you can start with. You'll need to modify it quite a lot but it's something to start with.

Best,
Antti / Mainio
buntho replied on at Permalink Reply
Hi Antti,

Thanks for the quick response. I can see your point, so for now I'll probably skip it, since it's not that important for my usage. Also, I'm hilariously bad at regexps ;-)

BR,
Thoams

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.