Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Encoded email addresses (obfuscation)
There is a simpler way to accomplish such the subject thing, unfortunately pages within TXP are rendering into UTF-8 characters (converted):
<a href="mailto:user@domain.com">user@domain.com</a>
That is rendering as this:
<a href="mailto:user@domain.com">user@domain.com</a>
Without any obfuscation 😭
So, here is an another (a little bit complex) way. Copy/Past into an email
form:
<txp:if_yield name="email"><txp:variable name="email" value='<txp:yield name="email" />' /><txp:php>
global $variable;
for ($i = 0; $i < strlen($variable['email']); $i++) {
$variable['encoded'] .= '&#'.ord($variable['email'][$i]).';';
}
</txp:php><txp:if_yield name="link"><a href="mailto:<txp:variable name="encoded" />"><txp:variable name="encoded" /></a><txp:else /><txp:variable name="encoded" /></txp:if_yield><txp:variable name="email" value="" /></txp:if_yield>
<txp:variable name="encoded" value="" />
Note: the last variable is required to remove its content (in a multiple use case of this shortcode into a same article).
<txp::email email="user@domain.com" />
<txp::email email='<txp:author_email />' link />
The link
attribute is optional and governs the rendering of a full cliquable link.
😉
Last edited by Pat64 (2020-09-16 16:16:16)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: Encoded email addresses (obfuscation)
i still use Enkoder from Dan Benjamin although it’s no longer available. i use the old code and so far no spam.
…. texted postive
Offline
Re: Encoded email addresses (obfuscation)
bici wrote #325915:
i still use Enkoder from Dan Benjamin although it’s no longer available. i use the old code and so far no spam.
I did too, and I made a plugin out of the standalone php version of the algorithm. You can get it here and use it just like the built-in tag. See the docs for attributes and options.
TXP Builders – finely-crafted code, design and txp
Offline
Offline
Re: Encoded email addresses (obfuscation)
jakob wrote #325916:
I made a plugin out of the standalone php version of the algorithm. You can get it here and use it just like the built-in tag.
More thanks – I didn’t know about the plugin either. I used Enkoder years ago when it had a web page. It really works. Great to have this for Textpattern.
Offline
Pages: 1