This plugin provides e-mail obfuscation via field-methods to prevent spam bots from harvesting e-mail addresses from your website.
First things first - I basically copied this plugin code from seehat's post in the Kirby forum. Many thanks to him.
composer require timnarr/kirby-obfuscate-email
Use the obfuscateEmail()
field method if you just want to obfuscate an single e-mail value from a field. Example:
$page->emailField()->obfuscateEmail()
.
If you want to obfuscate multiple e-mails in a text field you can use the obfuscateEmails()
method. This method uses regex to find all e-mails and obfuscate them. Example: $page->myTextField()->obfuscateEmails()
.
Option | Default | Type | Description |
---|---|---|---|
regex |
/[A-Z0-9\._%+-]+(@)[A-Z0-9\.-]+(\.)[a-z]{2,}/i |
string | Regular expression, used to find e-mails in text. Change to custom pattern if needed. |
MIT License Copyright © 2024-present Tim Narr