mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
withoutAccents(): use unidecode lib if available
This commit is contained in:
parent
afb67b02e9
commit
b936decf89
2 changed files with 28 additions and 57 deletions
2
debian/control
vendored
2
debian/control
vendored
|
@ -7,7 +7,7 @@ Maintainer: Benjamin Renard <brenard@easter-eggs.com>
|
||||||
Package: ldapsaisie
|
Package: ldapsaisie
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: apache2 | httpd, php-ldap | php5-ldap, php-fpm | libapache2-mod-php5 | libapache2-mod-php | php5-cli | php-cli, smarty | smarty3, php-net-ldap2, php-net-ftp, php-mail, php-mail-mime, php-console-table
|
Depends: apache2 | httpd, php-ldap | php5-ldap, php-fpm | libapache2-mod-php5 | libapache2-mod-php | php5-cli | php-cli, smarty | smarty3, php-net-ldap2, php-net-ftp, php-mail, php-mail-mime, php-console-table
|
||||||
Recommends: php-mbstring, php-phpseclib
|
Recommends: php-mbstring, php-phpseclib, php-unidecode
|
||||||
Description: web based interface for managing LDAP servers content
|
Description: web based interface for managing LDAP servers content
|
||||||
LdapSaisie is a Web application developed to manage LDAP directory.
|
LdapSaisie is a Web application developed to manage LDAP directory.
|
||||||
It has been written in PHP / JavaScript and is published under the
|
It has been written in PHP / JavaScript and is published under the
|
||||||
|
|
|
@ -531,6 +531,14 @@ function LSdebugDefined() {
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to load unidecode library
|
||||||
|
if (!function_exists('unidecode')) {
|
||||||
|
if (file_exists(LS_LIB_DIR."/unidecode/unidecode.php"))
|
||||||
|
@include(LS_LIB_DIR."/unidecode/unidecode.php");
|
||||||
|
if (!function_exists('unidecode') && stream_resolve_include_path("unidecode/unidecode.php"))
|
||||||
|
@include("unidecode/unidecode.php");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime les accents d'une chaine
|
* Supprime les accents d'une chaine
|
||||||
*
|
*
|
||||||
|
@ -539,58 +547,21 @@ function LSdebugDefined() {
|
||||||
* @retval string La chaine sans les accents
|
* @retval string La chaine sans les accents
|
||||||
*/
|
*/
|
||||||
function withoutAccents($string){
|
function withoutAccents($string){
|
||||||
$replaceAccent = Array(
|
// Use unidecode lib if available
|
||||||
"à" => "a",
|
if (function_exists('unidecode'))
|
||||||
"á" => "a",
|
return unidecode($string);
|
||||||
"â" => "a",
|
|
||||||
"ã" => "a",
|
// Otherwise, use historical method
|
||||||
"ä" => "a",
|
$replaceAccent = array(
|
||||||
"ç" => "c",
|
"à" => "a", "á" => "a", "â" => "a", "ã" => "a", "ä" => "a", "ç" => "c",
|
||||||
"è" => "e",
|
"è" => "e", "é" => "e", "ê" => "e", "ë" => "e", "ì" => "i", "í" => "i",
|
||||||
"é" => "e",
|
"î" => "i", "ï" => "i", "ñ" => "n", "ò" => "o", "ó" => "o", "ô" => "o",
|
||||||
"ê" => "e",
|
"õ" => "o", "ö" => "o", "ù" => "u", "ú" => "u", "û" => "u", "ü" => "u",
|
||||||
"ë" => "e",
|
"ý" => "y", "ÿ" => "y", "À" => "A", "Á" => "A", "Â" => "A", "Ã" => "A",
|
||||||
"ì" => "i",
|
"Ä" => "A", "Ç" => "C", "È" => "E", "É" => "E", "Ê" => "E", "Ë" => "E",
|
||||||
"í" => "i",
|
"Ì" => "I", "Í" => "I", "Î" => "I", "Ï" => "I", "Ñ" => "N", "Ò" => "O",
|
||||||
"î" => "i",
|
"Ó" => "O", "Ô" => "O", "Õ" => "O", "Ö" => "O", "Ù" => "U", "Ú" => "U",
|
||||||
"ï" => "i",
|
"Û" => "U", "Ü" => "U", "Ý" => "Y"
|
||||||
"ñ" => "n",
|
|
||||||
"ò" => "o",
|
|
||||||
"ó" => "o",
|
|
||||||
"ô" => "o",
|
|
||||||
"õ" => "o",
|
|
||||||
"ö" => "o",
|
|
||||||
"ù" => "u",
|
|
||||||
"ú" => "u",
|
|
||||||
"û" => "u",
|
|
||||||
"ü" => "u",
|
|
||||||
"ý" => "y",
|
|
||||||
"ÿ" => "y",
|
|
||||||
"À" => "A",
|
|
||||||
"Á" => "A",
|
|
||||||
"Â" => "A",
|
|
||||||
"Ã" => "A",
|
|
||||||
"Ä" => "A",
|
|
||||||
"Ç" => "C",
|
|
||||||
"È" => "E",
|
|
||||||
"É" => "E",
|
|
||||||
"Ê" => "E",
|
|
||||||
"Ë" => "E",
|
|
||||||
"Ì" => "I",
|
|
||||||
"Í" => "I",
|
|
||||||
"Î" => "I",
|
|
||||||
"Ï" => "I",
|
|
||||||
"Ñ" => "N",
|
|
||||||
"Ò" => "O",
|
|
||||||
"Ó" => "O",
|
|
||||||
"Ô" => "O",
|
|
||||||
"Õ" => "O",
|
|
||||||
"Ö" => "O",
|
|
||||||
"Ù" => "U",
|
|
||||||
"Ú" => "U",
|
|
||||||
"Û" => "U",
|
|
||||||
"Ü" => "U",
|
|
||||||
"Ý" => "Y"
|
|
||||||
);
|
);
|
||||||
return strtr($string, $replaceAccent);
|
return strtr($string, $replaceAccent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue