datastone / craft-obfuscate
Datastone obfuscate
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- craftcms/cms: ^5.0.0
README
Obfuscate an email or other strings to prevent spam-bots from sniffing it.
Installation
Install the plugin via the Craft CMS control panel or via the command line:
composer require datastone/craft-obfuscate
./craft plugin/install datastone-obfuscate
Usage
twig filter:
In the simplest form you can use
{{ "email@example.com" | obfuscate }}
Roadmap
- add other methods to obfucate email like text directions
- css and javascript tricks
More advance usage:
{{ string $str | [, obfuscate | obfuscateEmail | obfuscateMailTo] }}
craft extension: {{ craft.obfuscator.obfuscate(string $str) }} {{ craft.obfuscator.email(string $email) }} {{ craft.obfuscator.mailto(string $email) }}
obfuscateMailTo:
{{ string $email | obfuscateMailTo([string $title [, $json ]]) }} {{ craft.obfuscator.mailto(string $email [, string $title [, $json ]]) }}
example :
{{ 'exm@test.nl' | obfuscateMailTo('title', {'class' : 'className', 'attr' : ''}) }}
output :
<a href="mailto:exm@test.nl" class="className" attr>title</a>
string concat: (notice the () for twig otherwise the parsing goes wrong!)
{{ ('Some string to hide ' ~ foo.bar) | obfuscate }} {{ craft.obfuscator.obfuscate('Some string to hide ' ~ foo.bar) }}