Skip to content

Instantly share code, notes, and snippets.

@lawebfabric
Last active December 1, 2018 15:28
Show Gist options
  • Save lawebfabric/8ce1c1f3df76dbc6cf614f05fd929d67 to your computer and use it in GitHub Desktop.
Save lawebfabric/8ce1c1f3df76dbc6cf614f05fd929d67 to your computer and use it in GitHub Desktop.
email obfuscator for MODX
<?php
//-----------------------------------------------------------
// emailPrefix
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
/*
*
* Usage : [[++contact_email:emailPrefix]] or [[*myEmailTv:emailPrefix]]
* <span class="mel" data-user="[[++contact_email:emailPrefix]]" data-website="[[++contact_email:emailSuffix]]"></span>
*
*/
$emailPrefix = substr ($input, 0, strrpos ($input, '@'));
return $emailPrefix;
<?php
//-----------------------------------------------------------
// emailSuffix
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
/*
*
* Usage : [[++contact_email:emailSuffix]] or [[*myEmailTv:emailSuffix]]
* <span class="mel" data-user="[[++contact_email:emailPrefix]]" data-website="[[++contact_email:emailSuffix]]"></span>
*
*/
$emailSuffix = substr (strstr ($input, '@'), 1);
return $emailSuffix;
/* needed css style for working */
.mel::before {
content: attr(data-user) "@" attr(data-website);
unicode-bidi: bidi-override;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment