Last active
December 1, 2018 15:29
-
-
Save lawebfabric/5e55b5293726dae72d91e56de180abdb to your computer and use it in GitHub Desktop.
Simple (output modifier) snippet to replace accent caracters with caracters whithout accent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//----------------------------------------------------------- | |
// noaccents | |
//----------------------------------------------------------- | |
/* | |
* @author: Steeve from lawebfabric | |
* @website: http://www.lawebfabric.com | |
* @tutorial modx website: http://www.tutocms.fr/ | |
*/ | |
/* | |
* Example : [[*maTv:noaccents]] or [[*content:noaccents]] | |
* | |
*/ | |
$search = array(‘À’,‘Á’,‘Â’,‘Ã’,‘Ä’,‘Å’,‘Ç’,‘È’,‘É’,‘Ê’,‘Ë’,‘Ì’,‘Í’,‘Î’,‘Ï’,‘Ò’,‘Ó’,‘Ô’,‘Õ’,‘Ö’,‘Ù’,‘Ú’,‘Û’,‘Ü’,‘Ý’,‘à’,‘á’,‘â’,‘ã’,‘ä’,‘å’,‘ç’,‘è’,‘é’,‘ê’,‘ë’,‘ì’,‘í’,‘î’,‘ï’,‘ð’,‘ò’,‘ó’,‘ô’,‘õ’,‘ö’,‘ù’,‘ú’,‘û’,‘ü’,‘ý’,‘ÿ’); | |
$replace = array(‘A’,‘A’,‘A’,‘A’,‘A’,‘A’,‘C’,‘E’,‘E’,‘E’,‘E’,‘I’,‘I’,‘I’,‘I’,‘O’,‘O’,‘O’,‘O’,‘O’,‘U’,‘U’,‘U’,‘U’,‘Y’,‘a’,‘a’,‘a’,‘a’,‘a’,‘a’,‘c’,‘e’,‘e’,‘e’,‘e’,‘i’,‘i’,‘i’,‘i’,‘o’,‘o’,‘o’,‘o’,‘o’,‘o’,‘u’,‘u’,‘u’,‘u’,‘y’,‘y’); | |
$output = str_replace($search, $replace, $input); | |
return $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment