Clean code

This commit is contained in:
Laurent Destailleur
2022-06-27 10:17:14 +02:00
parent 0b138167f6
commit 4e46c3f7a2
4 changed files with 29 additions and 5 deletions

View File

@@ -42,6 +42,34 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
if (!function_exists('utf8_encode')) {
/**
* Implement utf8_encode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_encode($elements)
{
return mb_convert_encoding($elements, 'UTF-8', 'ISO-8859-1');
}
}
if (!function_exists('utf8_decode')) {
/**
* Implement utf8_decode for PHP that does not support it.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
*/
function utf8_decode($elements)
{
return mb_convert_encoding($elements, 'ISO-8859-1', 'UTF-8');
}
}
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set