cwsoft Posted September 24, 2023 Author Share Posted September 24, 2023 @Thomas -Allwinds WebstudioThanks for your feedback. If you disable the code line you mentioned, no text based email like test@domain.com will be obfuscated on any of your pages. However, regular mailto links will still work just fine. The regex used to extract text mails and mailto links are as follows: $patternEmail = '#<a [^>]+>.*?</a>(*SKIP)(*FAIL)|(?<email>[\._a-z0-9-]+@[\._a-z0-9-]+)#i'; $patternMailto = '#<a href=([\'"])mailto:(?<email>.*?)\1>(?<text>.*?)</a>#i' One workaround would be to use an email pattern not recognized by the two regex (which won´t help in your case), or to modify the regex for $patternEmail to skip text emails inside link tags AND input fields. So you could try to change this line inside EmailToEncryptedMailto.module.php as follows: // Regex to find text emails in text excluding emails inside link tags and input fields. private $patternEmail = '#<a [^>]+>.*?</a>(*SKIP)(*FAIL)|<input [^>]+>(*SKIP)(*FAIL)|(?<email>[\._a-z0-9-]+@[\._a-z0-9-]+)#i'; I already planned an option to disable obfuscation based on user defined pageIDs, which may be handy for form or newsletters pages with emails. Not too sure if I want to add an option to skip obfuscation for mailto links with a certain data-attribute/class or text mails e.g. wrapped in a span tag with a certain class too. But an option to skip obfuscation by pageIDs and or turn on/off mailto/email obfuscation may be an handy option for the next release together with the modified regex to exclude emails from input fields too. Will add some of those features with the next release. Link to comment Share on other sites More sharing options...
Thomas -Allwinds Webstudio Posted September 25, 2023 Share Posted September 25, 2023 Hi @cwsoft Thanks for the quick fix - I tested on my small site and it works fine: in the promailer prefilled form the email address is displayed correctly all email addresses on other pages are encrypted Have a good day- BR Thomas 1 Link to comment Share on other sites More sharing options...
cwsoft Posted September 25, 2023 Author Share Posted September 25, 2023 Hello, I have released version v1.1.1 of my EmailToEncryptedMailto module, providing the following new features and bugfixes: Skipped emails entered in input fields from encryption (bugfix, thanks to @Thomas -Allwinds Webstudio) Preserved optional attributes like id, class, data-attributes in mailto links (feature) Added option to specify pageIDs of pages to skip from obfuscation via module config (feature) You can download the latest version from the Processwire module repository as usual. Have fun cwsoft Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now